<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hello,</p>
    <p><br>
    </p>
    <p>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:</p>
    <p><br>
    </p>
    <p>if(is_present_hf("Contact")) {</p>
    <p>  remove_hf("Contact");</p>
    <p>  append_hf("Contact:
      <a class="moz-txt-link-rfc2396E" href="sip:$(ct{tobody.user})@$Ri:$Rp"><sip:$(ct{tobody.user})@$Ri:$Rp></a>\r\n)");</p>
    <p>}</p>
    <p><br>
    </p>
    <p>If doesn't work, let me know.</p>
    <p><br>
    </p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 20.04.17 16:09, Narayan P wrote:<br>
    </div>
    <blockquote
cite="mid:HK2PR0201MB17457C163479531D35CE4C3DD71B0@HK2PR0201MB1745.apcprd02.prod.outlook.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
      <div id="divtagdefaultwrapper"
style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;"
        dir="ltr">
        <p>Thanks for your kind Response Daniel,</p>
        <p><br>
        </p>
        <p>Yes as you told with the requirement I have mentioned call
          will not reach client, I have explained my requirement in
          detail,</p>
        <p><br>
        </p>
        <p>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,</p>
        <p><br>
        </p>
        <p>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<span>(Username to IP:port tuple)
            I</span> have stored in Kamailio database.</p>
        <p><br>
        </p>
        <p>Please suggest me if you have better Idea than what i am
          doing<br>
        </p>
        <p><br>
        </p>
        <p>Thanks & Regards</p>
        <p>Narayan<br>
        </p>
      </div>
      <hr style="display:inline-block;width:98%" tabindex="-1">
      <div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
          color="#000000" face="Calibri, sans-serif"><b>From:</b>
          Daniel-Constantin Mierla <a class="moz-txt-link-rfc2396E" href="mailto:miconda@gmail.com"><miconda@gmail.com></a><br>
          <b>Sent:</b> Tuesday, April 18, 2017 1:04:38 PM<br>
          <b>To:</b> Narayan P; <a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
          <b>Subject:</b> Re: Not able to replace route_uri in contact
          header uri</font>
        <div> </div>
      </div>
      <div>
        <p>Hello,</p>
        <p><br>
        </p>
        <p>to clarify, in the REGISTER you sent and pasted again below,
          from</p>
        <p><br>
        </p>
        <p>Contact: <a moz-do-not-send="true"
            class="moz-txt-link-rfc2396E"
            href="sip:OTT919620649614@125.16.231.74:25841;ob">
            <sip:OTT919620649614@125.16.231.74:25841;ob></a></p>
        <p><br>
        </p>
        <p>you want to have:<br>
        </p>
        <p><br>
        </p>
        <p>Contact: <a moz-do-not-send="true"
            class="moz-txt-link-rfc2396E"
            href="sip:OTT919620649614@185.122.205.178:5070;lr">
            <sip:OTT919620649614@185.122.205.178:5070;lr></a></p>
        <p><br>
        </p>
        <p>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.</p>
        <p><br>
        </p>
        <p>Cheers,<br>
          Daniel<br>
        </p>
        <p><br>
        </p>
        <p><br>
        </p>
        <pre wrap="">REGISTER <a moz-do-not-send="true" class="moz-txt-link-freetext" href="sip:185.122.206.62">sip:185.122.206.62</a> SIP/2.0
Via: SIP/2.0/UDP 125.16.231.74:25841;rport;branch=z9hG4bKPj592750e4-9a06-4662-a55e-a8a71dedb974
Route: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="sip:185.122.205.178:5070;lr"><sip:185.122.205.178:5070;lr></a>
Max-Forwards: 70
From: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="sip:OTT919620649614@185.122.206.62"><sip:OTT919620649614@185.122.206.62></a>;tag=35af1666-a2b1-4c6e-a7b6-8675845036e7
To: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="sip:OTT919620649614@185.122.206.62"><sip:OTT919620649614@185.122.206.62></a>
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: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="sip:OTT919620649614@125.16.231.74:25841;ob"><sip:OTT919620649614@125.16.231.74:25841;ob></a>
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=<a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="sip:185.122.206.62">"sip:185.122.206.62"</a>, 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: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="sip:OTT919620649614@185.122.206.62"><sip:OTT919620649614@185.122.206.62></a>;tag=35af1666-a2b1-4c6e-a7b6-8675845036e7
Call-ID: 5bc6558f-1ffc-4990-bc99-d099c4fdcbcb
CSeq: 41801 REGISTER
To: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="sip:OTT919620649614@185.122.206.62"><sip:OTT919620649614@185.122.206.62></a>;tag=1492409213989
Expires: 50
Contact: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="sip:OTT919620649614@125.16.231.74:25841;ob"><sip:OTT919620649614@125.16.231.74:25841;ob></a>;expires=50
Content-Length: 0</pre>
        <br>
        <div class="moz-cite-prefix">On 17.04.17 08:38, Narayan P wrote:<br>
        </div>
        <blockquote
cite="mid:HK2PR0201MB17457956E1094C7269B2CA9FD7060@HK2PR0201MB1745.apcprd02.prod.outlook.com"
          type="cite">
          <meta name="Generator" content="Microsoft Exchange Server">
          <!-- converted from text -->
          <style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
          <meta content="text/html; charset=UTF-8">
          <style type="text/css" style="">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
          <div dir="ltr">
            <div id="x_divtagdefaultwrapper" dir="ltr"
              style="font-size:12pt; color:#000000;
              font-family:Calibri,Arial,Helvetica,sans-serif">
              <p>Hi Daniel,</p>
              <p><br>
              </p>
              <p>I am attaching here my sip trace at client side.Request
                you to see this.</p>
              <p>My client IP in register request is <span>125.16.231.74
                  and the server on which kamailio is running is
                  185.122.205.178.</span></p>
              <p><span><br>
                </span></p>
              <p><span>I want my contact header to be <span><a
                      moz-do-not-send="true"
                      class="moz-txt-link-rfc2396E"
                      href="sip:OTT919620649614@185.122.205.178:5070;lr"><sip:OTT919620649614@185.122.205.178:5070;lr></a></span></span></p>
              <p><span><span><br>
                  </span></span></p>
              <p><span><span>I am using avp_subst() function to replace
                    this.But kamailio is not starting.</span></span></p>
              <p><span><span>Please reply if I am in wrong way or have
                    different understanding as I am very new to
                    kamailio.</span></span></p>
              <p><span><span><br>
                  </span></span></p>
              <p><span><span>Thanks,</span></span></p>
              <p><span><span>Narayan<br>
                  </span></span></p>
              <p><span><span><br>
                  </span></span></p>
              <p><span><span></span></span><br>
              </p>
            </div>
            <hr tabindex="-1" style="display:inline-block; width:98%">
            <div id="x_divRplyFwdMsg" dir="ltr"><font
                style="font-size:11pt" color="#000000" face="Calibri,
                sans-serif"><b>From:</b> Narayan P<br>
                <b>Sent:</b> Friday, April 14, 2017 12:54:25 PM<br>
                <b>To:</b> <a moz-do-not-send="true"
                  class="moz-txt-link-abbreviated"
                  href="mailto:sr-users@lists.sip-router.org">
                  sr-users@lists.sip-router.org</a><br>
                <b>Cc:</b> <a moz-do-not-send="true"
                  class="moz-txt-link-abbreviated"
                  href="mailto:moconda@gmail.com">moconda@gmail.com</a><br>
                <b>Subject:</b> RE: Not able to replace route_uri in
                contact header uri</font>
              <div> </div>
            </div>
          </div>
          <font size="2"><span style="font-size:10pt;">
              <div class="PlainText">Hi Daniel,<br>
                <br>
                Thanks for your response.<br>
                <br>
                I mean to say,<br>
                In my register request the route header i.e. route_uri
                is <a moz-do-not-send="true"
                  class="moz-txt-link-rfc2396E"
                  href="sip:185.122.205.178">
                  <sip:185.122.205.178></a> and contact header is
                <a moz-do-not-send="true"
                  class="moz-txt-link-abbreviated"
                  href="mailto:3333@172.22.13.41">
                  3333@172.22.13.41</a>.<br>
                I want my contact header to be <a
                  moz-do-not-send="true"
                  class="moz-txt-link-abbreviated"
                  href="mailto:3333@185.122.205.178">
                  3333@185.122.205.178</a>.<br>
                So how can I replace the contact header's only domain
                part with route_uri.the user part of the contact header
                remains same.<br>
                <br>
                <br>
                Thanks,<br>
                Narayan<br>
              </div>
            </span></font></blockquote>
        <br>
        <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - May 22-24 (USA) - <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
Kamailio World Conference - May 8-10, 2017 - <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
      </div>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - May 22-24 (USA) - <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
Kamailio World Conference - May 8-10, 2017 - <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
  </body>
</html>