<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <tt>Hi, Royee!<br>
      <br>
      Can you turn on debugging for this call and send the logs (in
      private if privacy is an issue)?<br>
      My assumption is that the dialog is created before
      fix_nated_contact() is called, perhaps due to a siptrace() call or
      something, and the wrong contact ends up in the dialog. Or perhaps
      fix_nated_contact() is not called for some reason, although the
      nat test seems all right. Can you add some debugging between the
      fix_nated_contact() block, so we can make sure it is called?<br>
      <br>
      Best regards,<br>
    </tt>
    <pre class="moz-signature" cols="72">Răzvan Crainea
OpenSIPS Solutions
<a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></pre>
    <div class="moz-cite-prefix">On 06/06/2017 12:15 PM, Royee Tichauer
      via Users wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAFrVV=w-sNg0mLKJP3fvF3V9-gPB6=zaw4FKtSTc1-8J_visQw@mail.gmail.com">
      <div dir="ltr">Razvan,
        <div><br>
        </div>
        <div>Thanks for the help! </div>
        <div><br>
        </div>
        <div>fix_nated_contact is called before create_dialog as you can
          also see from the configuration file I added in the previous
          email.</div>
        <div><br>
        </div>
        <div>When using the MI command I see:</div>
        <div>
          <p class="inbox-inbox-p1"><span class="inbox-inbox-s1">callee_contact::
              sip:USERNAME@PRIVATE_IP:PORT;transport=TCP</span></p>
          <p class="inbox-inbox-p1"><span class="inbox-inbox-s1">So it
              seems like the dialog is created with a private IP. Any
              suggestions?</span></p>
          <p class="inbox-inbox-p1">Thanks,</p>
          <p class="inbox-inbox-p1">Royee</p>
          <p class="inbox-inbox-p1"><span class="inbox-inbox-s1"><br>
            </span></p>
        </div>
        <div><br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr">On Tue, Jun 6, 2017 at 11:06 AM Răzvan Crainea
          <<a href="mailto:razvan@opensips.org"
            moz-do-not-send="true">razvan@opensips.org</a>> wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div text="#000000" bgcolor="#FFFFFF"> <tt>Hi, Royee!<br>
              <br>
              Can you make sure that fix_nated_contact() is called
              before create_dialog()?<br>
              Also, if you run through MI the dlg_list_ctx command, what
              is the contact header stored in the dialog?<br>
              <br>
              Best regards,<br>
              Răzvan<br>
            </tt>
            <pre class="m_-5089538494520844847moz-signature" cols="72">Răzvan Crainea
OpenSIPS Solutions
<a class="m_-5089538494520844847moz-txt-link-abbreviated" href="http://www.opensips-solutions.com" target="_blank" moz-do-not-send="true">www.opensips-solutions.com</a></pre>
          </div>
          <div text="#000000" bgcolor="#FFFFFF">
            <div class="m_-5089538494520844847moz-cite-prefix">On
              06/06/2017 11:02 AM, Royee Tichauer via Users wrote:<br>
            </div>
          </div>
          <div text="#000000" bgcolor="#FFFFFF">
            <blockquote type="cite">
              <div dir="ltr"><span
                  style="color:rgb(33,33,33);font-size:13px">Hi,</span>
                <div style="color:rgb(33,33,33);font-size:13px"><br>
                </div>
                <div style="color:rgb(33,33,33);font-size:13px">I'm
                  having some problems when using topology hiding. In my
                  scenario an INVITE comes in to the opensips (SBC)
                  instance from another opensips instance (Proxy). It is
                  routed to a callee which eventually answers with a
                  200OK. The 200 OK is routed through the SBC to the
                  Proxy which answers back with an ACK. This ACK is
                  absorbed by the SBC which (by looking at the logs)
                  attempts to send this ACK to the private IP of the
                  callee instead of the the NAT IP which was originally
                  used for the incoming INVITE.</div>
                <div style="color:rgb(33,33,33);font-size:13px"><br>
                </div>
                <div style="color:rgb(33,33,33);font-size:13px">From the
                  logs I see that right before I attempt to do
                  'topology_hiding_match()' the 'ruri=public_IP' and
                  after the method is called the ruri switches to
                  'ruri=private_IP'.</div>
                <div style="color:rgb(33,33,33);font-size:13px"><br>
                </div>
                <div style="color:rgb(33,33,33);font-size:13px">Attached
                  is a trace. Below is a partial opensips.cfg file I am
                  using with opensips 2.1:</div>
                <div style="color:rgb(33,33,33);font-size:13px"><br>
                </div>
                <div style="color:rgb(33,33,33);font-size:13px"><br>
                </div>
                <div style="color:rgb(33,33,33);font-size:13px">
                  <div><font color="#666666"># ----- NATHELPER -----</font></div>
                  <div><font color="#666666">loadmodule "nathelper.so"</font></div>
                  <div><font color="#666666">modparam("nathelper",
                      "received_avp", "$avp(42)")</font></div>
                  <div><font color="#666666"><br>
                    </font></div>
                  <div><font color="#666666"># ----- DIALOG -----</font></div>
                  <div><font color="#666666">loadmodule "dialog.so"</font></div>
                  <div><font color="#666666">modparam("dialog",
                      "db_mode", 0)</font></div>
                  <div><font color="#666666">modparam("dialog",
                      "dlg_match_mode", 1)</font></div>
                  <div><font color="#666666">modparam("dialog",
                      "profiles_no_value", "inboundcalls")</font></div>
                  <div><font color="#666666"><br>
                    </font></div>
                  <div><font color="#666666"><br>
                    </font></div>
                  <div><font color="#666666"># ----- TOPOLOGY_HIDING
                      -----</font></div>
                  <div><font color="#666666">loadmodule
                      "topology_hiding.so"</font></div>
                  <div><font color="#666666">modparam("topology_hiding",
                      "force_dialog", 1)</font></div>
                  <div><font color="#666666">modparam("topology_hiding",
                      "th_callid_passwd", "*********")</font></div>
                  <div><font color="#666666">modparam("topology_hiding",
                      "th_contact_encode_passwd", "*****")</font></div>
                  <div><font color="#666666">modparam("topology_hiding",
                      "th_callid_prefix", "****")</font></div>
                  <div><font color="#666666"><br>
                    </font></div>
                  <div><font color="#666666">route {</font></div>
                  <div><font color="#666666">  route(nat_checks);</font></div>
                  <div><font color="#666666">  route(topology_check);</font></div>
                  <div><font color="#666666">  .</font></div>
                  <div><font color="#666666">  .</font></div>
                  <div><font color="#666666">  .</font></div>
                  <div><font color="#666666"><br>
                    </font></div>
                  <div><font color="#666666">  create_dialog();</font></div>
                  <div><font color="#666666"><br>
                    </font></div>
                  <div><font color="#666666">  record_route();</font></div>
                  <div><font color="#666666"><br>
                    </font></div>
                  <div><font color="#666666">  if (!has_totag()
                      && is_method("INVITE")) {</font></div>
                  <div><font color="#666666">    topology_hiding("U");</font></div>
                  <div><font color="#666666">  }</font></div>
                  <div><font color="#666666"><br>
                    </font></div>
                  <div><font color="#666666">  .</font></div>
                  <div><font color="#666666">  .</font></div>
                  <div><font color="#666666">  .</font></div>
                  <div><font color="#666666">}</font></div>
                  <div><font color="#666666"><br>
                    </font></div>
                  <div><font color="#666666"><br>
                    </font></div>
                  <div><font color="#666666">route[topology_check] {</font></div>
                  <div><font color="#666666"><br>
                    </font></div>
                  <div><font color="#666666">  force_rport();</font></div>
                  <div><font color="#666666">  xlog("L_INFO", "[REQUEST
                      $ci] current  ruri: $ruri");</font></div>
                  <div><font color="#666666">  if (has_totag()) {</font></div>
                  <div><font color="#666666">    if
                      (topology_hiding_match()) {</font></div>
                  <div><font color="#666666">        xlog("L_INFO",
                      "[REQUEST $ci] $rm topology_check successful match
                      reinvite TH_callee_callid: $TH_callee_callid ruri:
                      $ruri");</font></div>
                  <div><font color="#666666">        route(relay);</font></div>
                  <div><font color="#666666">    } else {</font></div>
                  <div><font color="#666666">      xlog("L_INFO",
                      "[REQUEST $ci] $rm topology_check Did not match
                      this request to a topology hiding dialog.");</font></div>
                  <div><font color="#666666">      if ( is_method("ACK")
                      ) {</font></div>
                  <div><font color="#666666">        if (
                      t_check_trans() ) {</font></div>
                  <div><font color="#666666">          xlog("L_INFO",
                      "[REQUEST $ci] $rm within a transaction
                      relaying");</font></div>
                  <div><font color="#666666">          route(relay);</font></div>
                  <div><font color="#666666">        } else {</font></div>
                  <div><font color="#666666">          xlog("L_INFO",
                      "[REQUEST $ci] $rm not within a transaction
                      exiting");</font></div>
                  <div><font color="#666666">          exit;</font></div>
                  <div><font color="#666666">        }</font></div>
                  <div><font color="#666666">      }</font></div>
                  <div><font color="#666666">      xlog("L_INFO",
                      "[REQUEST $ci] $rm sending 404 Not Found");</font></div>
                  <div><font color="#666666">      send_reply("404","Not
                      Found");</font></div>
                  <div><font color="#666666">      exit;</font></div>
                  <div><font color="#666666">    }</font></div>
                  <div><font color="#666666">  }</font></div>
                  <div><font color="#666666"><br>
                    </font></div>
                  <div><font color="#666666">}</font></div>
                  <div><font color="#666666"><br>
                    </font></div>
                  <div><font color="#666666">route[nat_checks] {</font></div>
                  <div><font color="#666666"><br>
                    </font></div>
                  <div><font color="#666666">  if (nat_uac_test("1")) {</font></div>
                  <div><font color="#666666">    xlog("L_INFO",
                      "[REQUEST $ci] $rm fix_nated_contact()");</font></div>
                  <div><font color="#666666">    fix_nated_contact();</font></div>
                  <div><font color="#666666">  }</font></div>
                  <div><font color="#666666">}</font></div>
                  <div><font color="#666666">.</font></div>
                  <div><font color="#666666">.</font></div>
                  <div><font color="#666666">.</font></div>
                </div>
              </div>
              <br>
              <fieldset
                class="m_-5089538494520844847mimeAttachmentHeader"></fieldset>
              <br>
            </blockquote>
          </div>
          <div text="#000000" bgcolor="#FFFFFF">
            <blockquote type="cite">
              <pre>_______________________________________________
Users mailing list
<a class="m_-5089538494520844847moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" target="_blank" moz-do-not-send="true">Users@lists.opensips.org</a>
<a class="m_-5089538494520844847moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank" moz-do-not-send="true">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
            </blockquote>
            <br>
          </div>
        </blockquote>
      </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>