[SR-Users] Inserting local path into shared USRLOC table.
Daniel Tryba
d.tryba at pocos.nl
Wed Oct 11 11:15:06 CEST 2017
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 at localhost;tag={$location['ruid']}\r
To: {$location['contact']}\r
Call-ID: {$location['id']}-$listenport-$uid at localhost\r
CSeq: 1 OPTIONS\r
Content-Length: 0\r
\r
EOS;
socket_sendto($sock,$str,strlen($str),MSG_EOR,$dst[0],$dst[1]);
More information about the sr-users
mailing list