[OpenSIPS-Users] Best way to call with prefix and trunks

Jehanzaib Younis jehanzaib.kiani at gmail.com
Thu Feb 29 23:30:36 UTC 2024


Hi,

You can use drouting for IP based authentication trunks.
For username/password based i think you can use digest_auth somethin like

digest_domain("MySIPTrunkRealm", "sip.trunk1.com", "username1", "password1")
digest_domain("MySIPTrunkRealm", "sip.trunk2.com", "username2", "password2")

in the routing you can do something like the following:-

if (is_method("INVITE") && has_totag()) {
         $var(dest_ip) = $si;
         if (!digest_auth_check("$var(dest_ip)", "MySIPTrunkRealm",
"username", "password")) {
            xlog("L_ERR", "Failed to authenticate call to $var(dest_ip)\n");
            sl_send_reply("403", "Forbidden");
            exit;
         }

        # Route the call to the trunk
        route(SOME_OTHER_ROUTE);
}


Regards,
Jehanzaib


On Fri, Mar 1, 2024 at 12:21 PM Social Boh <social at bohboh.info> wrote:

> First reply;
>
> UAC, UAC AUTH and DROUTING Modules
>
> ?
>
> ---
> I'm SoCIaL, MayBe
>
> El 29/02/2024 a las 4:05 p. m., Social Boh escribió:
> > Hello list,
> >
> > I have to make calls to PSTN using trunks con IP auth y trunks with
> > user and password
> >
> > I'd like use DROUTING module but I don't know how solve user/password
> > auth trunk
> >
> > Any idea?
> >
> > Thank you
> >
> > Regards
> >
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20240301/289db5f8/attachment.html>


More information about the Users mailing list