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 <[email protected]>
> *Sent:* Tuesday, April 18, 2017 1:04:38 PM
> *To:* Narayan P; [email protected]
> *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:[email protected]:25841;ob>
>
>
> you want to have:
>
>
> Contact: <sip:[email protected]: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:[email protected]>;tag=35af1666-a2b1-4c6e-a7b6-8675845036e7
> To: <sip:[email protected]>
> 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:[email protected]: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:[email protected]>;tag=35af1666-a2b1-4c6e-a7b6-8675845036e7
> Call-ID: 5bc6558f-1ffc-4990-bc99-d099c4fdcbcb
> CSeq: 41801 REGISTER
> To: <sip:[email protected]>;tag=1492409213989
> Expires: 50
> Contact: <sip:[email protected]: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:[email protected]: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:* [email protected]
>> *Cc:* [email protected]
>> *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 [email protected].
>> I want my contact header to be [email protected].
>> 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

_______________________________________________
Kamailio (SER) - Users Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to