<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 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="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 11:02 AM, Royee Tichauer
      via Users wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAFrVV=w1oGsOvS1NdjSJ8io_mt68z=f2_sANa8snRtY11QwY6w@mail.gmail.com">
      <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="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>