forward REGISTER message with kamailio

7k Views Asked by At

There is kamailio on centos box and my scheme looks like this:

sip client ---> Kamailio ---> PBX (not asterisk)

and i need to know how i can just forward REGISTER and all MESSAGE from sip client via kamailio to PBX, except SUBSCRIBE.

i googled and i tried many times and i dont know what i am doing wrong

example : rewritehost and send

there is a default kamailio.cfg and i am tring to add handle SIP registration method

if(is_method("REGISTER"))
 {
 send("udp:ip address:5060");
 };

and also i tried

rewritehost("ip address");

but it does not work.

2

There are 2 best solutions below

13
On BEST ANSWER

Please check path module.

route[REGISTRAR] {
    if(!is_method("REGISTER"))
        return;
    add_path_received();
        route(DISPATCH);
}

I have created sample config, which works with Freeswitch and should work with any PBX which support PATH.

https://github.com/os11k/dispatcher/blob/master/kamailio.cfg

5
On

Please use this code block that will surely help you:

if (!is_method("REGISTER")) { save("location","0x02"); }

And before relay use, only for register message:

rewritehostport("192.168.1.90:5060");