<div dir="ltr">HI <span style="white-space:pre-wrap">Liviu,</span><div><span style="white-space:pre-wrap"><br></span></div><div><span style="white-space:pre-wrap">I am trying to deal with NAT while OpenSIPS is acting as the mid-register. The problem is that unless I use fix_nated_contact() mid_register saves the private IP address in the location "table" so when an INVITE comes from the main registrar OpenSIPS is unable to route it. Still trying to figure out how to make that work.</span></div><div><span style="white-space:pre-wrap"><br></span></div><div><span style="white-space:pre-wrap">Thanks!!</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 27, 2017 at 4:40 AM, Liviu Chircu <span dir="ltr"><<a href="mailto:liviu@opensips.org" target="_blank">liviu@opensips.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <p><tt>Hi Jim,</tt></p>
    <p><tt>Both functions attempt to rewrite the Contact - the former
        with SOURCE_IP:SOURCE_PORT, while the latter attempts to do it
        with ADV_IP:ADV_PORT. Due to the "lazy changes" optimization of
        the OpenSIPS stack, you cannot serialize these two function
        calls, rather you are forced to pick one of them.<br>
      </tt></p>
    <p><tt>Fortunately, there is another way around the above: you can
        have the mid-registrar insert itself through a Path header,
        rather than rewriting the Contact to point to its interface. So
        just switch the mid_registrar to "insertion_mode = 1" and you
        should be good.<br>
      </tt></p>
    <p><tt>PS: can you elaborate on what you are trying to achieve?
        IIRC, fix_nated_contact() should not be called on a REGISTER,
        rather you should use the fix_nated_register() which forces a
        ";received=" param into the Contact. Conceptually, at least -
        I'm pretty sure this also won't work well with
        mid_registrar_save().<br>
      </tt></p>
    <p><tt>Best regards,</tt><br>
    </p>
    <pre class="m_7140627330513166803moz-signature" cols="72">Liviu Chircu
OpenSIPS Developer
<a class="m_7140627330513166803moz-txt-link-freetext" href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.<wbr>com</a></pre>
    <div class="m_7140627330513166803moz-cite-prefix">On 26.10.2017 17:08, Jim DeVito wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">Hi All,
        <div><br>
        </div>
        <div>So if I call fix_nated_contact(); before
          mid_registrar_save(); It will correctly rewrite the Contact
          URI with the recived IP:PORT however it mid_register is then
          not able to append the contact_match_param to the new Contact
          URI. </div>
        <div><br>
        </div>
        <div>The script looks like this...</div>
        <div><br>
        </div>
        <div>
          <div>if (is_method("REGISTER")) {</div>
          <div>                fix_nated_contact();</div>
          <div>                mid_registrar_save("location")<wbr>;</div>
        </div>
        <div><br>
        </div>
        <div>It fails with this error. <br>
        </div>
        <div><br>
        </div>
        <div>
          <div>ERROR:mid_registrar:overwrite_<wbr>all_contact_hostports:
            SCRIPT BUG - second attempt to change URI Contact</div>
          <div><br>
          </div>
          <div>ERROR:mid_registrar:mid_reg_<wbr>req_fwded: failed to
            overwrite Contact URI</div>
        </div>
        <div><br>
        </div>
        <div>Thoughts? And Thanks!!<br>
          <br>
          <div class="m_7140627330513166803gmail_signature">
            <div dir="ltr">-------------
              <div>Jim DeVito</div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="m_7140627330513166803mimeAttachmentHeader"></fieldset>
      <br>
      <pre>______________________________<wbr>_________________
Users mailing list
<a class="m_7140627330513166803moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a class="m_7140627330513166803moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </div>

<br>______________________________<wbr>_________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">-------------<div>Jim DeVito</div><div>Mobile 216.507.9497</div></div></div>
</div>