Hi Daniel,


Thanks for your response.I have added this in the registrar module but it didn't work.


Please see the sip trace.


-end msg--
17:28:47.162 sip_endpoint.c  .Response msg 408/REGISTER/cseq=52880 (rdata0x231b418) from 185.122.205.178:5070 was dropped/unhandled by any modules
17:28:47.404   pjsua_core.c  .TX 597 bytes Request msg REGISTER/cseq=3179 (tdta0x2320060) to UDP 185.122.205.178:5070:
REGISTER sip:185.122.205.178:5070 SIP/2.0
Via: SIP/2.0/UDP 172.22.13.41:5067;rport;branch=z9hG4bKPjd734f1a6-d644-4a96-913c-c31738a33eed
Max-Forwards: 70
From: <sip:OTT919620649614@185.122.205.178>;tag=9f62c1ea-36a3-4318-a767-55a6b278fd23
To: <sip:OTT919620649614@185.122.205.178>
Call-ID: 6fc0b9f9-8439-4fc6-a28e-05ce1e52ec80
CSeq: 3179 REGISTER
User-Agent: PJSUA v2.3 Linux-4.4.0.64/x86_64/glibc-2.19
Contact: <sip:OTT919620649614@172.22.13.41:5067;ob>
Expires: 300
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Content-Length:  0

Thanks,

Narayan


From: Daniel-Constantin Mierla <miconda@gmail.com>
Sent: Friday, April 21, 2017 9:36:37 AM
To: Narayan P; sr-users@lists.sip-router.org
Subject: Re: Not able to replace route_uri in contact header uri
 

Hello,


skipping to understand exactly the purpose of what you want to achieve, if you want to replace the contact header uri with [username from old Contact]@[kamailio ip]:[kamailio port] , you can try this:


if(is_present_hf("Contact")) {

  remove_hf("Contact");

  append_hf("Contact: <sip:$(ct{tobody.user})@$Ri:$Rp>\r\n)");

}


If doesn't work, let me know.


Cheers,
Daniel


On 20.04.17 16:09, Narayan P wrote:

Thanks for your kind Response Daniel,


Yes as you told with the requirement I have mentioned call will not reach client, I have explained my requirement in detail,


My requirement is to establish a call between 2 SIP clients Alice and Bob which are using 185.122.205.178(Kamailio) as outbound proxy and registered to a SIP SERVER,


I am not able to establish call between Alice and Bob, So I am trying to Replace the Contact header in Register request with Kamailio IP and then I will direct the Invite request to callee client using the data(Username to IP:port tuple) I have stored in Kamailio database.


Please suggest me if you have better Idea than what i am doing


Thanks & Regards

Narayan


From: Daniel-Constantin Mierla <miconda@gmail.com>
Sent: Tuesday, April 18, 2017 1:04:38 PM
To: Narayan P; sr-users@lists.sip-router.org
Subject: Re: Not able to replace route_uri in contact header uri
 

Hello,


to clarify, in the REGISTER you sent and pasted again below, from


Contact: <sip:OTT919620649614@125.16.231.74:25841;ob>


you want to have:


Contact: <sip:OTT919620649614@185.122.205.178:5070;lr>


If yes, then this doesn't look right at all, then the device cannot receive calls anymore. Maybe you can explain the purpose and then we may be able to offer some hints.


Cheers,
Daniel



REGISTER sip:185.122.206.62 SIP/2.0
Via: SIP/2.0/UDP 125.16.231.74:25841;rport;branch=z9hG4bKPj592750e4-9a06-4662-a55e-a8a71dedb974
Route: <sip:185.122.205.178:5070;lr>
Max-Forwards: 70
From: <sip:OTT919620649614@185.122.206.62>;tag=35af1666-a2b1-4c6e-a7b6-8675845036e7
To: <sip:OTT919620649614@185.122.206.62>
Call-ID: 5bc6558f-1ffc-4990-bc99-d099c4fdcbcb
CSeq: 41801 REGISTER
User-Agent: PJSUA v2.3 Linux-4.4.0.64/x86_64/glibc-2.19
Contact: <sip:OTT919620649614@125.16.231.74:25841;ob>
Expires: 300
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Authorization: Digest username="OTT919620649614", realm="185.122.206.62", nonce="af7780946d2b72ddc5e765a68798e937", uri="sip:185.122.206.62", response="a4c0614fbc3c72ece619247de5766a4b", algorithm=MD5
Content-Length:  0


SIP/2.0 200 OK
Via: SIP/2.0/UDP 125.16.231.74:25841;rport=25841;branch=z9hG4bKPj592750e4-9a06-4662-a55e-a8a71dedb974;received=125.16.231.74
From: <sip:OTT919620649614@185.122.206.62>;tag=35af1666-a2b1-4c6e-a7b6-8675845036e7
Call-ID: 5bc6558f-1ffc-4990-bc99-d099c4fdcbcb
CSeq: 41801 REGISTER
To: <sip:OTT919620649614@185.122.206.62>;tag=1492409213989
Expires: 50
Contact: <sip:OTT919620649614@125.16.231.74:25841;ob>;expires=50
Content-Length: 0

On 17.04.17 08:38, Narayan P wrote:

Hi Daniel,


I am attaching here my sip trace at client side.Request you to see this.

My client IP in register request is 125.16.231.74 and the server on which kamailio is running is 185.122.205.178.


I want my contact header to be <sip:OTT919620649614@185.122.205.178:5070;lr>


I am using avp_subst() function to replace this.But kamailio is not starting.

Please reply if I am in wrong way or have different understanding as I am very new to kamailio.


Thanks,

Narayan




From: Narayan P
Sent: Friday, April 14, 2017 12:54:25 PM
To: sr-users@lists.sip-router.org
Cc: moconda@gmail.com
Subject: RE: Not able to replace route_uri in contact header uri
 
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@172.22.13.41.
I want my contact header to be 3333@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

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - May 22-24 (USA) - www.asipto.com
Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - May 22-24 (USA) - www.asipto.com
Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com