Hi All,
I am wondering if the following is possible. For simplicity imagine two asterisk boxes and two kamailio proxies. Kamailio on the edge, asterisk in the 'core'
Kamailio <=> Asterisk Asterisk <=> Kamailio
A user may register to either kamailio proxy, and a call may originate from either Asterisk box where it will be sent to its *local *Kamailio proxy.
From there I'd like Kamailio to forward the request to the AoR, following
the same path the registration took if it registered to the other proxy, to avoid NAT issues.
I think this requires a shared USRLOC table, and also for the proxy that handled the registration to insert itself in the path of the USRLOC table.
The registrar module has the 'path_check_local' parameter which sounds relevant, ignoring the path if the first hop is local.
I've included add_path_received() in my REGISTRAR routing block, however I see 'Path: [not set]' in the USRLOC table.
Is it possible to force the insertion of the local proxy into the path field?
One additional question, in the case of NAT keepalives, is it possible to only send these from the proxy the received the register request?
Thanks in advance,
Matthew
Hello,
you may need msg_apply_changes() there, see the details from:
- https://www.kamailio.org/wiki/tutorials/faq/main#why_changes_made_to_headers...
Cheers, Daniel
On 11.10.17 00:36, Marrold wrote:
Hi All,
I am wondering if the following is possible. For simplicity imagine two asterisk boxes and two kamailio proxies. Kamailio on the edge, asterisk in the 'core'
Kamailio <=> Asterisk Asterisk <=> Kamailio
A user may register to either kamailio proxy, and a call may originate from either Asterisk box where it will be sent to its /local /Kamailio proxy. From there I'd like Kamailio to forward the request to the AoR, following the same path the registration took if it registered to the other proxy, to avoid NAT issues.
I think this requires a shared USRLOC table, and also for the proxy that handled the registration to insert itself in the path of the USRLOC table.
The registrar module has the 'path_check_local' parameter which sounds relevant, ignoring the path if the first hop is local.
I've included add_path_received() in my REGISTRAR routing block, however I see 'Path: [not set]' in the USRLOC table.
Is it possible to force the insertion of the local proxy into the path field?
One additional question, in the case of NAT keepalives, is it possible to only send these from the proxy the received the register request?
Thanks in advance,
Matthew
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
On Tue, Oct 10, 2017 at 11:36:56PM +0100, Marrold wrote:
I've included add_path_received() in my REGISTRAR routing block, however I see 'Path: [not set]' in the USRLOC table.
Is it possible to force the insertion of the local proxy into the path field?
Like Daniel already mentioned, add the header and msg_apply_changes() For example: https://lists.kamailio.org//pipermail/sr-users/2015-April/087872.html
One additional question, in the case of NAT keepalives, is it possible to only send these from the proxy the received the register request?
I decided to not use kamailio itself for sending these OPTIONS but to use a simple script that queries the database and simply opens a connection to the local kamailio. Mainly because I needed to monitor some UAC and alert when it wasn't reachable (even though it is present in location). In your case select the approriate UACs on Path.
while($location=mysql_fetch_assoc($res)) { usleep(1000); $branch=uniqid(); $send[$location['id']]=0; $dst=preg_replace('/.*@([^;]+);.*/',"$1",$location['path']); $dst=explode(':',$dst); if(count($dst)<2) { $dst[1]=5060; } $str=<<<EOS OPTIONS {$location['contact']} SIP/2.0\r Via: SIP/2.0/UDP 127.0.1.1:$listenport;branch=$branch;rport;alias\r Route: {$location['path']}\r From: sip:pinger@localhost;tag={$location['ruid']}\r To: {$location['contact']}\r Call-ID: {$location['id']}-$listenport-$uid@localhost\r CSeq: 1 OPTIONS\r Content-Length: 0\r \r
EOS; socket_sendto($sock,$str,strlen($str),MSG_EOR,$dst[0],$dst[1]);
Hello,
On 11 Oct 2017 10:16 a.m., "Daniel Tryba" d.tryba@pocos.nl wrote:
On Tue, Oct 10, 2017 at 11:36:56PM +0100, Marrold wrote:
I've included add_path_received() in my REGISTRAR routing block, however I see 'Path: [not set]' in the USRLOC table.
Is it possible to force the insertion of the local proxy into the path field?
Like Daniel already mentioned, add the header and msg_apply_changes() For example: https://lists.kamailio.org//pipermail/sr-users/2015-April/087872.html
One additional question, in the case of NAT keepalives, is it possible to only send these from the proxy the received the register request?
I decided to not use kamailio itself for sending these OPTIONS but to use a simple script that queries the database and simply opens a connection to the local kamailio. Mainly because I needed to monitor some UAC and alert when it wasn't reachable (even though it is present in location). In your case select the approriate UACs on Path.
while($location=mysql_fetch_assoc($res)) { usleep(1000); $branch=uniqid(); $send[$location['id']]=0; $dst=preg_replace('/.*@([^;]+);.*/',"$1",$location['path']); $dst=explode(':',$dst); if(count($dst)<2) { $dst[1]=5060; } $str=<<<EOS OPTIONS {$location['contact']} SIP/2.0\r Via: SIP/2.0/UDP 127.0.1.1:$listenport;branch=$branch;rport;alias\r Route: {$location['path']}\r From: sip:pinger@localhost;tag={$location['ruid']}\r To: {$location['contact']}\r Call-ID: {$location['id']}-$listenport-$uid@localhost\r CSeq: 1 OPTIONS\r Content-Length: 0\r \r
EOS; socket_sendto($sock,$str,strlen($str),MSG_EOR,$dst[0],$dst[1]);
Just to add, another option is to use the nat_traversal module: https://kamailio.org/docs/modules/stable/modules/nat_traversal.html. We use it for this very reason.
Cheers,
Charles
msg_apply_changes() worked nicely, thanks guys
On Wed, Oct 11, 2017 at 10:45 AM, Charles Chance < charles.chance@sipcentric.com> wrote:
Hello,
On 11 Oct 2017 10:16 a.m., "Daniel Tryba" d.tryba@pocos.nl wrote:
On Tue, Oct 10, 2017 at 11:36:56PM +0100, Marrold wrote:
I've included add_path_received() in my REGISTRAR routing block, however
I
see 'Path: [not set]' in the USRLOC table.
Is it possible to force the insertion of the local proxy into the path field?
Like Daniel already mentioned, add the header and msg_apply_changes() For example: https://lists.kamailio.org//pipermail/sr-users/2015-April/087872.html
One additional question, in the case of NAT keepalives, is it possible to only send these from the proxy the received the register request?
I decided to not use kamailio itself for sending these OPTIONS but to use a simple script that queries the database and simply opens a connection to the local kamailio. Mainly because I needed to monitor some UAC and alert when it wasn't reachable (even though it is present in location). In your case select the approriate UACs on Path.
while($location=mysql_fetch_assoc($res)) { usleep(1000); $branch=uniqid(); $send[$location['id']]=0; $dst=preg_replace('/.*@([^;]+);.*/',"$1",$location['path']); $dst=explode(':',$dst); if(count($dst)<2) { $dst[1]=5060; } $str=<<<EOS OPTIONS {$location['contact']} SIP/2.0\r Via: SIP/2.0/UDP 127.0.1.1:$listenport;branch=$branch;rport;alias\r Route: {$location['path']}\r From: sip:pinger@localhost;tag={$location['ruid']}\r To: {$location['contact']}\r Call-ID: {$location['id']}-$listenport-$uid@localhost\r CSeq: 1 OPTIONS\r Content-Length: 0\r \r
EOS; socket_sendto($sock,$str,strlen($str),MSG_EOR,$dst[0],$dst[1]);
Just to add, another option is to use the nat_traversal module: https://kamailio.org/docs/modules/stable/modules/nat_traversal.html. We use it for this very reason.
Cheers,
Charles
Sipcentric Ltd. Company registered in England & Wales no. 7365592. Registered office: Faraday Wharf, Innovation Birmingham Campus, Holt Street, Birmingham Science Park, Birmingham B7 4BB.
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users