<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix"><tt>Hello,<br>
        <br>
        The ACK is sent to the contact URI from the 200 OK. As you
        found, the problem is when the 200 OK is processed by your
        OpenSIPS - the private IP in the 200 OK Contact header must be
        replaced with the public one (take from the network level) by
        the fix_nated_contact() (or similar function).<br>
        <br>
        So be sure your 200 OK hits the onreply route and the function
        is triggered.<br>
        <br>
        Regards,<br>
      </tt>
      <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
      On 20.01.2014 10:19, Miha wrote:<br>
    </div>
    <blockquote cite="mid:52DCDC13.5060908@softnet.si" type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      HI,<br>
      <br>
      Problem is that I am relaying call throught FS and I guess I am
      arming on_replay_route on wrong spot. I am arming it when call is
      send to UAC.<br>
      <br>
      Here is my replay_route:<br>
      <br>
      onreply_route[1] {<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlog("on replay");<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (client_nat_test("3")) {<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlog("L_INFO", "NAT Reply\n");<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fix_contact();<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit;<br>
      }<br>
      <br>
      <br>
      here is a sip trace:<br>
      <br>
      U UAC_PUBLIC_IP:1079 -&gt; opensips_ip:5060<br>
      SIP/2.0 200 OK.<br>
      Via: SIP/2.0/UDP opensips_ip:5060;branch=z9hG4bK13dc.ad5b3917.0.<br>
      Via: SIP/2.0/UDP
      FS_IP:5080;received=FS_IP;rport=5080;branch=z9hG4bKj26KZH1XvKm9p.<br>
      Record-Route:
      <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
href="sip:opensips_ip;lr;ftag=c8N0ZtF52D3vF;vsf=AAAAAAMLBwYFAAACA3cFcQAfAx0fARoLGg8eNjA-;did=b88.c27c8733">&lt;sip:opensips_ip;lr;ftag=c8N0ZtF52D3vF;vsf=AAAAAAMLBwYFAAACA3cFcQAfAx0fARoLGg8eNjA-;did=b88.c27c8733&gt;</a>.<br>
      From: "031545477" <a moz-do-not-send="true"
        class="moz-txt-link-rfc2396E" href="sip:44431545477@FS_IP">&lt;sip:44431545477@FS_IP&gt;</a>;tag=c8N0ZtF52D3vF.<br>
      To: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="sip:44418108754@opensips_ip">&lt;sip:44418108754@opensips_ip&gt;</a>;tag=581792008.<br>
      Call-ID: 65b7d8a0-fc4c-1231-bb95-005056b2fe3d.<br>
      CSeq: 54766485 INVITE.<br>
      Contact: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="sip:44418108754@10.105.15.67:5060">&lt;sip:44418108754@10.105.15.67:5060&gt;</a>.<br>
      Supported: replaces, path, timer.<br>
      User-Agent: Grandstream GXP1405 1.0.5.32.<br>
      Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO,
      REFER, UPDATE, MESSAGE.<br>
      Content-Type: application/sdp.<br>
      Content-Length:&nbsp;&nbsp; 242.<br>
      .<br>
      v=0.<br>
      o=44418108754 8000 8000 IN IP4 10.105.15.67.<br>
      s=SIP Call.<br>
      c=IN IP4 10.105.15.67.<br>
      t=0 0.<br>
      m=audio 5004 RTP/AVP 8 0 101.<br>
      a=sendrecv.<br>
      a=rtpmap:8 PCMA/8000.<br>
      a=ptime:20.<br>
      a=rtpmap:0 PCMU/8000.<br>
      a=rtpmap:101 telephone-event/8000.<br>
      a=fmtp:101 0-15.<br>
      <br>
      <br>
      U opensips_ip:5060 -&gt; FS_IP:5080<br>
      SIP/2.0 200 OK.<br>
      Via: SIP/2.0/UDP
      FS_IP:5080;received=FS_IP;rport=5080;branch=z9hG4bKj26KZH1XvKm9p.<br>
      Record-Route:
      <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
href="sip:opensips_ip;lr;ftag=c8N0ZtF52D3vF;vsf=AAAAAAMLBwYFAAACA3cFcQAfAx0fARoLGg8eNjA-;did=b88.c27c8733">&lt;sip:opensips_ip;lr;ftag=c8N0ZtF52D3vF;vsf=AAAAAAMLBwYFAAACA3cFcQAfAx0fARoLGg8eNjA-;did=b88.c27c8733&gt;</a>.<br>
      From: "031545477" <a moz-do-not-send="true"
        class="moz-txt-link-rfc2396E" href="sip:031545477@FS_IP">&lt;sip:031545477@FS_IP&gt;</a>;tag=c8N0ZtF52D3vF.<br>
      To: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="sip:44418108754@opensips_ip">&lt;sip:44418108754@opensips_ip&gt;</a>;tag=581792008.<br>
      Call-ID: 65b7d8a0-fc4c-1231-bb95-005056b2fe3d.<br>
      CSeq: 54766485 INVITE.<br>
      Contact: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="sip:44418108754@10.105.15.67:5060">&lt;sip:44418108754@10.105.15.67:5060&gt;</a>.<br>
      Supported: replaces, path, timer.<br>
      User-Agent: Grandstream GXP1405 1.0.5.32.<br>
      Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO,
      REFER, UPDATE, MESSAGE.<br>
      Content-Type: application/sdp.<br>
      Content-Length:&nbsp;&nbsp; 242.<br>
      .<br>
      v=0.<br>
      o=44418108754 8000 8000 IN IP4 10.105.15.67.<br>
      s=SIP Call.<br>
      c=IN IP4 10.105.15.67.<br>
      t=0 0.<br>
      m=audio 5004 RTP/AVP 8 0 101.<br>
      a=sendrecv.<br>
      a=rtpmap:8 PCMA/8000.<br>
      a=ptime:20.<br>
      a=rtpmap:0 PCMU/8000.<br>
      a=rtpmap:101 telephone-event/8000.<br>
      a=fmtp:101 0-15.<br>
      <br>
      <br>
      U FS_IP:5080 -&gt; opensips_ip:5060<br>
      ACK <a moz-do-not-send="true" class="moz-txt-link-freetext"
        href="sip:44418108754@10.105.15.67:5060">sip:44418108754@10.105.15.67:5060</a>
      SIP/2.0.<br>
      Via: SIP/2.0/UDP FS_IP:5080;rport;branch=z9hG4bKKB0c1cj1Svavj.<br>
      Route:
      <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
href="sip:opensips_ip;lr;ftag=c8N0ZtF52D3vF;vsf=AAAAAAMLBwYFAAACA3cFcQAfAx0fARoLGg8eNjA-;did=b88.c27c8733">&lt;sip:opensips_ip;lr;ftag=c8N0ZtF52D3vF;vsf=AAAAAAMLBwYFAAACA3cFcQAfAx0fARoLGg8eNjA-;did=b88.c27c8733&gt;</a>.<br>
      Max-Forwards: 70.<br>
      From: "031545477" <a moz-do-not-send="true"
        class="moz-txt-link-rfc2396E" href="sip:031545477@FS_IP">&lt;sip:031545477@FS_IP&gt;</a>;tag=c8N0ZtF52D3vF.<br>
      To: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="sip:44418108754@opensips_ip">&lt;sip:44418108754@opensips_ip&gt;</a>;tag=581792008.<br>
      Call-ID: 65b7d8a0-fc4c-1231-bb95-005056b2fe3d.<br>
      CSeq: 54766485 ACK.<br>
      Contact: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="sip:mod_sofia@FS_IP:5080">&lt;sip:mod_sofia@FS_IP:5080&gt;</a>.<br>
      Content-Length: 0.<br>
      .<br>
      <br>
      <br>
      U opensips_ip:5060 -&gt; 10.105.15.67:5060<br>
      ACK <a moz-do-not-send="true" class="moz-txt-link-freetext"
        href="sip:44418108754@">sip:44418108754@</a><b>10.105.15.67</b>:5060
      SIP/2.0.<br>
      Via: SIP/2.0/UDP opensips_ip:5060;branch=z9hG4bK13dc.ad5b3917.2.<br>
      Via: SIP/2.0/UDP
      FS_IP:5080;received=FS_IP;rport=5080;branch=z9hG4bKKB0c1cj1Svavj.<br>
      Max-Forwards: 69.<br>
      From: "031545477" <a moz-do-not-send="true"
        class="moz-txt-link-rfc2396E" href="sip:44431545477@FS_IP">&lt;sip:44431545477@FS_IP&gt;</a>;tag=c8N0ZtF52D3vF.<br>
      To: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="sip:44418108754@opensips_ip">&lt;sip:44418108754@opensips_ip&gt;</a>;tag=581792008.<br>
      Call-ID: 65b7d8a0-fc4c-1231-bb95-005056b2fe3d.<br>
      CSeq: 54766485 ACK.<br>
      Contact: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="sip:mod_sofia@FS_IP:5080">&lt;sip:mod_sofia@FS_IP:5080&gt;</a>.<br>
      Content-Length: 0.<br>
      <br>
      <div class="moz-cite-prefix">Dne 1/17/2014 2:13 PM, pi&#353;e Miha:<br>
      </div>
      <blockquote cite="mid:52D92C89.3030800@softnet.si" type="cite">Hi,
        <br>
        <br>
        in my config I have: <br>
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (nat_uac_test("18")) { <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlog("fixing nat"); <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (method=="REGISTER") { <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fix_nated_register(); <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fix_nated_contact(); <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else { <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fix_nated_contact(); <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }; <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; force_rport(); <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }; <br>
        <br>
        <br>
        In location table I can see that ip:port is saved from source
        ip:port and not from contact which is good (contact has
        private_ip). Invites are also send to right ip:port. Problem is
        that ACK is send to private ip instead to public_ip:port. <br>
        <br>
        What I am missing? <br>
        <br>
        br <br>
        miha <br>
        <br>
        <br>
        _______________________________________________ <br>
        Users mailing list <br>
        <a moz-do-not-send="true" class="moz-txt-link-abbreviated"
          href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
        <br>
        <a moz-do-not-send="true" class="moz-txt-link-freetext"
          href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
        <br>
        <br>
      </blockquote>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>