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@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