<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body 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="moz-signature" cols="72">Liviu Chircu
OpenSIPS 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 26.10.2017 17:08, Jim DeVito wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAAcmnhm0GKJsj=tioSnU8QCra3NzAerktGqg=zizOczD4qR5oA@mail.gmail.com">
      <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");</div>
        </div>
        <div><br>
        </div>
        <div>It fails with this error. <br>
        </div>
        <div><br>
        </div>
        <div>
          <div>ERROR:mid_registrar:overwrite_all_contact_hostports:
            SCRIPT BUG - second attempt to change URI Contact</div>
          <div><br>
          </div>
          <div>ERROR:mid_registrar:mid_reg_req_fwded: failed to
            overwrite Contact URI</div>
        </div>
        <div><br>
        </div>
        <div>Thoughts? And Thanks!!<br>
          <br>
          <div class="gmail_signature">
            <div dir="ltr">-------------
              <div>Jim DeVito</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>