Hi,
I use Kamailio for basic call setup with one exception where it has to route call to another server by seeing the domain name in the Request URI. If the Request uri in the received INVITE message looks like "sip12345@video-conf", then it should route the INVITE request to the video-conf server by resolving the domain name. I changed the config file kamailio.cfg as given below.
route[SIPOUT] { if (!uri==myself) { append_hf("P-hint: outbound\r\n"); # AKS: call routing if (uri=~".*@video-conf") { rewritehost("video-conf"); } # AKS route(RELAY); } }
It resolves the domain name and routes the INVITE message to the resolved IP address. However it uses the domain name in the Request line and To header and I need to replace domain with the resolved IP address in the Request URI and To header. Now Request URI and To header look like "INVITE sip:12345@video-conf" and "To: sip:12345:video-conf" respectively and I need them as "INVITE sip:12345@video-conf" and "To: sip:12345:video-conf".
I don't have any knowledge in tweaking kamailio. I tried some tricks like the following by going through documents and pervious emails in the forum. But it didn't work. Some of them have spoken about avp and pseudo variables. But I am getting confused as I have just begun using Kamailio and it is vast. # $ru = "sip:" + $rU + "@" + to_ip;
I will appreciate if you could help me or guide me in right direction.
Thanks, Ajay
On Thursday 07 February 2013 04:08:06 Ajay Sabat wrote:
I don't have any knowledge in tweaking kamailio. I tried some tricks like the following by going through documents and pervious emails in the forum. But it didn't work. Some of them have spoken about avp and pseudo variables. But I am getting confused as I have just begun using Kamailio and it is vast. # $ru = "sip:" + $rU + "@" + to_ip;
You are looking for uac_replace_to(display,uri): http://kamailio.org/docs/modules/stable/modules_k/uac.html#id2538444
Hi Daniel, Thanks for your help. I am trying to use uac_replace_to(uri). But how would I mention the destination ip address resolved from the domain name? For example, if I hard code the ip address as given below it works. But I need to modify such a way that it automatically uses the ip address of the remote host in the To header uri.
if (uri=~".*@video-conf") { rewritehost("video-conf"); uac_replace_to("sip:$rU@192.168.252.155"); }
From the core book I found "to_ip" contains the ip address of the host the message will be sent to. But unfortunately I am unable to use it.
Also, I need to do modify URI in Request URI besides To header.
Thanks, Ajay
-----Original Message----- From: Daniel Tryba [mailto:daniel@pocos.nl] Sent: Thursday, February 07, 2013 5:25 AM To: sr-users@lists.sip-router.org Cc: Ajay Sabat Subject: Re: [SR-Users] Need help in rewriting the Request URI
On Thursday 07 February 2013 04:08:06 Ajay Sabat wrote:
I don't have any knowledge in tweaking kamailio. I tried some tricks like the following by going through documents and pervious emails in the forum. But it didn't work. Some of them have spoken about avp and pseudo variables. But I am getting confused as I have just begun using Kamailio and it is vast. # $ru = "sip:" + $rU + "@" + to_ip;
You are looking for uac_replace_to(display,uri): http://kamailio.org/docs/modules/stable/modules_k/uac.html#id2538444