[SR-Users] Not able to replace route_uri in contact header uri

Narayan P narayana88 at outlook.com
Fri Apr 14 14:54:25 CEST 2017


Hi Daniel,

Thanks for your response.

I mean to say,
In my register request the route header i.e. route_uri is <sip:185.122.205.178> and contact header is 3333 at 172.22.13.41.
I want my contact header to be 3333 at 185.122.205.178.
So how can I replace the contact header's only domain part with route_uri.the user part of the contact header remains same.


Thanks,
Narayan
________________________________________
From: Narayan P
Sent: Thursday, April 13, 2017 11:13 AM
To: sr-users at lists.sip-router.org
Subject: Re: Not able to replace route_uri in contact header uri

Hi ,

Can anybody help me how to replace the domain part of $route-uri in contact  header .

I am using avp_subst().But kamailio is not starting.


I am new to kamailio.Any help will be highly appreciated.


Thanks,

Narayan

________________________________
From: Narayan P
Sent: Wednesday, April 12, 2017 8:17:02 AM
To: sr-users at lists.sip-router.org
Subject: Not able to replace route_uri in contact header uri


Hi All,

I am using pjsip client and kamailiio,both running on different servers.I want to replace the uri on which pjsip is running with the uri on which kamailio is running in contact header.
I put some logs on route[REGISTRAR] and able to see the $route_uri as kamailio server uri($avp(s:fs) and  $hdr(Contact) as pjsip server uri ($avp(s:contact).But I am not able to replace the uri with avp_subst() function.

Can anybody help me how to replace the uri or with any any other function.

Below I have put the snippet of config file.


# Handle SIP registrations
route[REGISTRAR] {
        if (!is_method("REGISTER")) return;

        if(isflagset(FLT_NATS)) {
                setbflag(FLB_NATB);
#!ifdef WITH_NATSIPPING
                # do SIP NAT pinging
                setbflag(FLB_NATSIPPING);
#!endif
        }
        xlog("Narayan: before sending contact\n");
        $avp(s:contact) = $hdr(Contact);
        $avp(s:fs) = $route_uri;
        xlog("Narayan: Forced socket is $avp(s:fs)\n");
        xlog("Narayan: contact header is $avp(s:contact)\n");
        avp_subst("$avp(s:contact)/avp(s:contac)/g", "/(.*)@(.*)/$route_uri/");
        #avp_pushto("$ru/domain","$fd");
        #rewritehostport("185.122.206.62:5060");
        t_on_reply("MANAGE_REPLY");
        t_relay();
        #if (!save("location")) {
        #       sl_reply_error();
        #}
        exit;
}


Any suggestion will be highly appreciated.


Thanks,
Narayan





More information about the sr-users mailing list