[SR-Users] Kamailio - passing registration to another sip server

Daniel Tryba d.tryba at pocos.nl
Fri Aug 26 10:51:40 CEST 2016


On Thu, Aug 25, 2016 at 01:34:30PM -0400, Mike Patterson wrote:
> Thank you.  I am reviewing the doc.  I am new to Kamailio so it will
> take some time for me.

Good luck then :)

Here is my slightly redacted config for a setup similar to yours (which
is just a loadbalancer/proxy), which uses both contact rewriting
(invites) and Path (registers) and dispatcher to contact the backends.
It is based on the default config supplied with kamailio (so look there
for REQINIT and WITHINDLG and anything not listed here) and has NATting
stuff enabled by default (for SIP, RTP is handled elsewhere). I don't
pretend to know that it works perfectly, it just works fine for me.

request_route {
        route(REQINIT);
        route(NATDETECT);
        route(WITHINDLG);

        if (is_method("INVITE|SUBSCRIBE"))
        {
                record_route();
        }

        if(!is_in_subnet($si, "x.x.x.x/30"))
        {
                add_path_received("fromlb");
                ds_select_dst(1, 0);
                t_on_failure("RTF_DISPATCH");
        }
        else
        {
                remove_hf("Route");
                loose_route();
        }
        
        route(RELAY);
}


route[NATDETECT] {
        if(!is_in_subnet($si, "x.x.x.x/30"))
        {
                if (!is_method("REGISTER") && is_first_hop()) 
                {
                        set_contact_alias();
                }
        }

        return;
}

route[NATMANAGE] {
        if(!is_in_subnet($si, "x.x.x.x/30"))
        {
                if (is_reply() && is_first_hop())
                {
                        set_contact_alias();
                }
        }

        return;
}



More information about the sr-users mailing list