<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <tt>Hi, Dragomir!<br>
      <br>
      If you simply do fix_nated_register() on the REGISTER messages,
      all these will be sorted out. Moreover, it's actually not correct
      to change the contact of the user, because in the SIP message it
      might expect to have exactly what he sent.<br>
      When using fix_nated_register(), there is another field (called
      Received) that stores the actual IP and port where the REGISTER
      came from, and when an invite comes in, it is automatically set by
      the lookup() function in the DST uri, without changing the contact
      (the contact may still be private).<br>
      <br>
      So simply calling fix_nated_register() should fix this issue for
      all scenarios.<br>
      I initially though that you were using the Contact from something
      else and you really need that value there.<br>
      <br>
      Best regards,<br>
    </tt>
    <pre class="moz-signature" cols="72">Răzvan Crainea
OpenSIPS Developer
<a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></pre>
    <div class="moz-cite-prefix">On 11/03/2017 09:36 PM, Dragomir
      Haralambiev wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CADzurO+jp+JDghFT6NxzjRwEbgqekWC-yk2A0fW8nAebEFk4Yg@mail.gmail.com">
      <div dir="ltr">
        <div>
          <div>Hi,</div>
          <div><br>
          </div>
          <div>Why I need the real IP and port in location table?</div>
          <div><br>
          </div>
          <div>Now I make only outgoing call. Everything works fine on
            the following scenario.:</div>
          <div>User -----> Opensips ------> ITSP</div>
          <div><br>
          </div>
          <div>If I not have real IP in location table incoming calls
            not be implemented.</div>
          <div>ITSP ----> Opensips ---->?</div>
          <div><br>
          </div>
          <div>Opensips get IP from location table and try to send call.
            But in location table have not real IP.</div>
          <div>I see how the Opensips try to send call to 192.168.2.34.</div>
          <div><br>
          </div>
          <div>This is the main problem.</div>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">2017-11-03 11:45 GMT+02:00 Răzvan
          Crainea <span dir="ltr"><<a
              href="mailto:razvan@opensips.org" target="_blank"
              moz-do-not-send="true">razvan@opensips.org</a>></span>:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div text="#000000" bgcolor="#FFFFFF"> <tt>Unfortunately I
                just realised that you cannot change the Contact header
                for this scenario.<br>
                And to be honest I don't really understand why you are
                trying to change it - if you need the real IP and port,
                you can take them from the received field.<br>
                <br>
                Best regards,</tt><span class="">
                <pre class="m_-4701204381392790406moz-signature" cols="72">Răzvan Crainea
OpenSIPS Developer
<a class="m_-4701204381392790406moz-txt-link-abbreviated" href="http://www.opensips-solutions.com" target="_blank" moz-do-not-send="true">www.opensips-solutions.com</a></pre>
              </span><span class="">
                <div class="m_-4701204381392790406moz-cite-prefix">On
                  11/02/2017 11:43 PM, Dragomir Haralambiev wrote:<br>
                </div>
              </span>
              <blockquote type="cite">
                <div dir="ltr">Hi,
                  <div><br>
                  </div>
                  <span class="">
                    <div>Here is part of my script:<br>
                      ....</div>
                    <div>modparam("registrar", "mcontact_avp",
                      "$avp(register)")</div>
                    <div>.....<br>
                      <br>
                          if (t_check_status("2[0-9][0-9]")<wbr>)  {<br>
                      <div><span style="white-space:pre-wrap">                    </span>$log_level
                        = 5;</div>
                      <div><span style="white-space:pre-wrap">                    </span>script_trace(
                        1, "$rm from $si, ruri=$ru, ct=$ct.fields(uri)
                        avp(register)=$avp(register)", "me");</div>
                      <div><span style="white-space:pre-wrap">                    </span>route(save_location);</div>
                      <div>                       .......   </div>
                      <div>    }</div>
                      <div><br>
                        You can see log here:<br>
                      </div>
                    </div>
                    <div><a href="https://pastebin.com/WWQ9Mmh4"
                        target="_blank" moz-do-not-send="true">https://pastebin.com/WWQ9Mmh4</a><br>
                      <br>
                      Here is the replacement contact:<br>
                      <br>
                      <div>DBG:registrar:build_contact: created Contact
                        HF: Contact: <<a
                          href="http://sip:55595009@192.168.22.138:5062"
                          target="_blank" moz-do-not-send="true">sip:55595009@192.168.22.138:<wbr>5062</a>>;expires=360</div>
                      <div>DBG:registrar:save: replacing contact uri [<a
                          href="http://sip:55595009@188.23.232.10:1043"
                          target="_blank" moz-do-not-send="true">sip:55595009@188.23.232.10:<wbr>1043</a>]
                        with [<a
                          href="http://sip:55595009@192.168.22.138:5062"
                          target="_blank" moz-do-not-send="true">sip:55595009@192.168.22.138:<wbr>5062</a>]<br>
                        <br>
                        How to stop replacing contact from <a
                          href="http://188.23.232.10:1043"
                          target="_blank" moz-do-not-send="true">188.23.232.10:1043</a>
                        to <a href="http://192.168.22.138:5062"
                          target="_blank" moz-do-not-send="true">192.168.22.138:5062</a>
                        ?</div>
                    </div>
                  </span></div>
              </blockquote>
            </div>
            <br>
            ______________________________<wbr>_________________<br>
            Users mailing list<br>
            <a href="mailto:Users@lists.opensips.org"
              moz-do-not-send="true">Users@lists.opensips.org</a><br>
            <a
              href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users"
              rel="noreferrer" target="_blank" moz-do-not-send="true">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a><br>
            <br>
          </blockquote>
        </div>
        <br>
      </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>