<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <tt>Hi Faheem,<br>
      <br>
      In onreply route you must not touch the contact hdr if reply comes
      from the proxy. That reply will contain as contact the IP of the
      end callee (some device behind the proxy). IF you do
      fix_nated_contact(), you will overwrite it with the IP of the
      source entity (the proxy) loosing valuable routing info. <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>
    <div class="moz-cite-prefix">On 29.09.2015 20:00, Faheem Muhammad
      wrote:<br>
    </div>
    <blockquote
cite="mid:CA++nn_z8awu+DBLWWgLhqFKPx8bDY0JM5TOdMuFbszB7Qs4y0Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div id=":10r" class=""
          style="margin-bottom:0px;margin-left:0px;padding-bottom:5px">
          <div id=":10s" class="" style="overflow:hidden">
            <div dir="ltr" style=""><span
                style="font-size:12.8000001907349px">Hi,</span>
              <div style="font-size:12.8000001907349px">I'm facing an
                ACK loop while making calls. The issue is occurred due
                to bad CONTACT header. Scenario is as follows.</div>
              <div style="font-size:12.8000001907349px"><br>
              </div>
              <div style="font-size:12.8000001907349px"><font
                  color="#ff00ff">sip_user1(10.111.11.136) </font>&lt;-&gt; <font
                  color="#cc0000">OpenSIPS-1(10.109.5.189)</font> &lt;--&gt;<font
                  color="#0000ff">Outbound_proxy1 (10.109.5.237)</font></div>
              <div style="font-size:12.8000001907349px"><font
                  color="#0000ff"><br>
                </font></div>
              <div style="font-size:12.8000001907349px">The issue occurs
                when sip_user1 sends INVITE to OpenSIPS-1. OpenSIPS-1
                processes the request and send to Outbound_proxy1.</div>
              <div style="font-size:12.8000001907349px">When OpenSIPS-1
                receive 200 OK from Outbound_proxy1, it relays '200 OK'
                back to sip_user1 with bad CONTACT header. It relays
                '200 OK' with the CONTACT header of the proxy.</div>
              <div style="font-size:12.8000001907349px"><br>
              </div>
              <div style="font-size:12.8000001907349px">I have tried to
                apply the fix_nated_contact() in reply route block but
                it does not fix the contact header which causes an ACK
                loop internally when first ACK is received from
                sip_user1.</div>
              <div style="font-size:12.8000001907349px">Can you please
                suggest me what's wrong with my routing logic.</div>
              <div style="font-size:12.8000001907349px"><br>
              </div>
              <div style="font-size:12.8000001907349px"><br>
              </div>
              <div style="font-size:12.8000001907349px">Here is my
                reply_route block.</div>
              <div style="font-size:12.8000001907349px">------------------------------------------------------------------</div>
              <div style="font-size:12.8000001907349px">
                <div>onreply_route[handle_nat] {</div>
                <div>   
                  search_append('Contact:.*sip:[^&gt;[:cntrl:]]*',
                  ';nat=yes');<br>
                </div>
                <div>    if (isbflagset(FLB_NAT)) {</div>
                <div>       <span style="font-size:12.8000001907349px"> xlog("L_NOTICE",
                    <a class="moz-txt-link-rfc2396E" href="mailto:[$pr:$fU@$si:$sp]: fixingNatedContact.\n">"[$pr:$fU@$si:$sp]:  fixing Nated Contact. \n"</a>);</span></div>
                <div><span style="font-size:12.8000001907349px">       
                    # issue comes here...</span><br>
                </div>
                <div>        fix_nated_contact(); </div>
                <div><br>
                </div>
                <div>    }</div>
                <div><br>
                </div>
                <div>}</div>
              </div>
              <div style="font-size:12.8000001907349px">--------------------------------------------------------------------</div>
              <div style="font-size:12.8000001907349px"><br>
              </div>
              <div style="font-size:12.8000001907349px">OpenSIPS Logs
                and SIP trace is attached below link.</div>
              <div style=""><span style="font-size:12.8000001907349px"><a
                    moz-do-not-send="true"
href="https://www.dropbox.com/sh/rrjgajt9zgj852q/AABrCIftwjVcaMbWgJwR9NYha?dl=0">https://www.dropbox.com/sh/rrjgajt9zgj852q/AABrCIftwjVcaMbWgJwR9NYha?dl=0</a></span><br>
              </div>
              <div style="font-size:12.8000001907349px"><br>
              </div>
              <div style="font-size:12.8000001907349px">Regards,</div>
              <div style="font-size:12.8000001907349px">Faheem</div>
              <div style="font-size:12.8000001907349px"><br>
              </div>
            </div>
          </div>
        </div>
      </div>
      <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>