[SR-Users] sip domain

David Villasmil david.villasmil.work at gmail.com
Wed Mar 4 10:32:27 CET 2020


One could also use dialplan and dispatcher, add the domains to the dialplan
table with the GID of the dispatcher, add all IPs to redirect to, and use
dispatcher instead. That would also give you failover and distribution.

In terms of multiple domains, there’s probably a better way, but this is
how I do it:

So I would add to the dialplan table the domains I’m serving to, I.e.:

Match *dom1* and attrs 1
Match *dom2* and attrs 2
...

Then on the dispatcher:

GID:1 ip: sip:1.2.3.4:5060
GID:1 ip: sip:2.3.4.4:5060
GID:2 ip: sip:9.8.7.6:5060
GID:2 ip: sip:8.7.6.5:5060

So anything with “dom1” in the $ru would be sent out to GID 1, “dom2” to
GID 2, and so on.

And use the dialplan and dispatcher like so:


modparam("dialplan", "db_url", "mysql://DB_USER:DB_PASS@DB_HOST/kamailio")

modparam("dialplan", "attrs_pvar", "$var(dispatcher_id)")

modparam("dialplan", "fetch_rows", 100)

...

route[DISPATCH] {

    dp_match("1", "$ru");

    xlog("[DISPATCH] '$ru' was translated to '$var(dispatcher_id)'\n");

    xlog("[DISPATCH] avp(dsdstid): $avp(dsdstid)\n");


        if(!ds_select_dst("$var(dispatcher_id)", "9"))

{

send_reply("404", "No destination");

exit;

}

xlog("L_DBG", "--- SCRIPT: going to <$ru> via <$du>\n");

t_on_failure("RTF_DISPATCH”);

      append_to_reply("Contact: <sip:$du>\r\n");

      sl_send_reply("300","Multiple Choices");

exit;

}


Or something like that. (I took this off my
https://github.com/davidcsi/kamailio-private-public/blob/master/README.md )

Please excuse and errors, typing on my phone :)

Hope that helps!

David

On Wed, 4 Mar 2020 at 07:49, Daniel-Constantin Mierla <miconda at gmail.com>
wrote:

> Hello,
>
> On 04.03.20 04:44, Joli Martinez wrote:
> > Hello,
> >
> > We have several SIP domains coming into our SBC.  I need to build a
> > Kamailio box that will 302 the call to the appropriate server based on
> > the domain.  If the call does not come in with a recognized domain I
> > would like for it to 404 the call.  Not sure how to do this.  Can
> > someone point me in the right direction?
>
> the complete solution and complexity can be a matter of scalability and
> security needs, but for redirect itself is about sending a
> sl_send_reply(...) after using append_to_reply(). If relevant data is
> stored in database, sqlops is the module that can help to fetch the
> matching records.
>
> Cheers,
> Daniel
>
> --
> Daniel-Constantin Mierla -- www.asipto.com
> www.twitter.com/miconda -- www.linkedin.com/in/miconda
> Kamailio Advanced Training - March 9-11, 2020, Berlin - www.asipto.com
> Kamailio World Conference - April 27-29, 2020, in Berlin --
> www.kamailioworld.com
>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
-- 
Regards,

David Villasmil
email: david.villasmil.work at gmail.com
phone: +34669448337
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20200304/3784f4b3/attachment-0001.html>


More information about the sr-users mailing list