<div dir="ltr">Hi,<div><br></div><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]"))  {<br><div><span style="white-space:pre">                     </span>$log_level = 5;</div><div><span style="white-space:pre">                       </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">                        </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">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">sip:55595009@192.168.22.138:5062</a>>;expires=360</div><div>DBG:registrar:save: replacing contact uri [<a href="http://sip:55595009@188.23.232.10:1043">sip:55595009@188.23.232.10:1043</a>] with [<a href="http://sip:55595009@192.168.22.138:5062">sip:55595009@192.168.22.138:5062</a>]<br><br>How to stop replacing contact from <a href="http://188.23.232.10:1043">188.23.232.10:1043</a> to <a href="http://192.168.22.138:5062">192.168.22.138:5062</a> ?</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-11-02 11:31 GMT+02:00 Răzvan Crainea <span dir="ltr"><<a href="mailto:razvan@opensips.org" target="_blank">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>Did you put the mcontact_avp parameter I asked you to?<br>
      Can you print the value of the register just before save()? Also,
      can you send over some logs for the reply?<br>
      <br>
      Best regards,<br>
    </tt><span class="">
    <pre class="m_1226959779000449433moz-signature" cols="72">Răzvan Crainea
OpenSIPS Developer
<a class="m_1226959779000449433moz-txt-link-abbreviated" href="http://www.opensips-solutions.com" target="_blank">www.opensips-solutions.com</a></pre>
    </span><div><div class="h5"><div class="m_1226959779000449433moz-cite-prefix">On 11/02/2017 12:26 AM, Dragomir
      Haralambiev wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">Hi,<br>
        <br>
        I try this but in location table I not see real IP. Problem
        exists.<br>
        <br>
        When make save location $avp(register)=<a href="http://sip:55996201@192.27.47.139:5060" target="_blank">sip:55996201@<wbr>192.27.47.139:5060</a><br>
        <br>
        <div>opensipsctl ul show <a href="mailto:55996201@192.27.47.139" target="_blank">55996201@192.27.47.139</a><br>
          <br>
        </div>
        <div>AOR:: 55996201</div>
        <div>        Contact:: <a href="http://sip:57996201@192.168.22.201:5060" target="_blank">sip:57996201@192.168.22.201:<wbr>5060</a>
          Q=</div>
        <div>        ContactID:: 182005870676967428</div>
        <div>  </div>
        <div>Where is problem?</div>
        <br>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">2017-11-01 15:08 GMT+02:00 OpenSIPS
          Marketing <span dir="ltr"><<a href="mailto:marketing@opensips.org" target="_blank">marketing@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>OK, I managed to
                figure out why you get the private IP in the location
                table - that's because you are saving the registration
                in the onreply route, where you no longer have access to
                the fix_nated_contact() value.<br>
                <br>
                To fix your issue, you need to do the following:<br>
                a. specify a mcontact_avp[1] in your script:<br>
                modparam("registrar", "mcontact_avp", "$avp(register)")<br>
                <br>
                b. just after fix_nated_contact() on your REGISTER
                request, store the changed contact in that AVP:<br>
                fix_nated_contact();<br>
                $avp(register) = $ct.fields(uri);<br>
                <br>
                Doing these two changes to your script should store the
                real IP in the location table.<br>
                <br>
                [1]
                <a class="m_1226959779000449433m_5861672758880187697moz-txt-link-freetext" href="http://www.opensips.org/html/docs/modules/2.4.x/registrar.html#idp5598160" target="_blank">http://www.opensips.org/html/d<wbr>ocs/modules/2.4.x/registrar.ht<wbr>ml#idp5598160</a><br>
                <br>
                Best regards,<br>
              </tt>
              <div>
                <div class="m_1226959779000449433h5"><br>
                  <div class="m_1226959779000449433m_5861672758880187697moz-cite-prefix">On
                    11/01/2017 10:24 AM, Răzvan Crainea wrote:<br>
                  </div>
                  <blockquote type="cite"> <tt>Can you print
                      $ct.fields(uri) instead of $ct?<br>
                      Also, please post the output on <a href="http://pastebin.com" target="_blank">pastebin.com</a>.<br>
                      <br>
                      Best regards,<br>
                    </tt>
                    <pre class="m_1226959779000449433m_5861672758880187697moz-signature" cols="72">Răzvan Crainea
OpenSIPS Developer
<a class="m_1226959779000449433m_5861672758880187697moz-txt-link-abbreviated" href="http://www.opensips-solutions.com" target="_blank">www.opensips-solutions.com</a></pre>
                    <div class="m_1226959779000449433m_5861672758880187697moz-cite-prefix">On
                      10/31/2017 03:47 PM, Răzvan Crainea wrote:<br>
                    </div>
                    <blockquote type="cite"> <tt>Hi, Dragomir!<br>
                        <br>
                        Please post the logs I asked you to.<br>
                        <br>
                        Best regards,<br>
                      </tt>
                      <pre class="m_1226959779000449433m_5861672758880187697moz-signature" cols="72">Răzvan Crainea
OpenSIPS Developer
<a class="m_1226959779000449433m_5861672758880187697moz-txt-link-abbreviated" href="http://www.opensips-solutions.com" target="_blank">www.opensips-solutions.com</a></pre>
                      <div class="m_1226959779000449433m_5861672758880187697moz-cite-prefix">On
                        10/31/2017 03:45 PM, Sumit Birla wrote:<br>
                      </div>
                      <blockquote type="cite">
                        <div>X-Lite figures out its public IP and uses
                          that in Via: and Contact: headers unless you
                          set ‘Firewall traversal method’ to ‘None’ in
                          the account settings.</div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                        <div>
                          <blockquote type="cite">
                            <div>On Oct 31, 2017, at 9:14 AM, Dragomir
                              Haralambiev <<a href="mailto:goup2010@gmail.com" target="_blank">goup2010@gmail.com</a>>
                              wrote:</div>
                            <br class="m_1226959779000449433m_5861672758880187697Apple-interchange-newline">
                            <div>
                              <div dir="ltr">When REGISTER received from
                                X-lite all is OK. Here part from
                                REGISTER message:<br>
                                <br>
                                <div>    REGISTER <a>sip:OpenSip_IP:Opensips_port;t<wbr>ransport=UDP</a>
                                  SIP/2.0</div>
                                <div>    Via: SIP/2.0/UDP
                                  219.101.241.150:64726;branch=z<wbr>9hG4bK-524287-1---39ee8718032a<wbr>1a5a;rport<br>
                                      Contact: <<a>sip:577222@219.101.241.150:64<wbr>726;transport=UDP;rinstance=d6<wbr>122d9250e9d0bd</a>><br>
                                  <br>
                                  Here  "Via" contains real IP (this is
                                  Route IP).<br>
                                  <br>
                                  When REGISTER received from Yealink
                                  VoIP phone I have problem. Here part
                                  from REGISTER message:<br>
                                  <br>
                                </div>
                                <div>
                                  <div>    REGISTER <a>sip:OpenSip_IP:Opensips_port</a> S<wbr>IP/2.0</div>
                                  <div>    Via: SIP/2.0/UDP
                                    192.168.2.207:5062;branch=z9hG<wbr>4bK77238423<br>
                                        Contact: <<a href="http://sip:55896207@192.168.2.207:5062/" target="_blank">sip:55896207@192.168.2.207:50<wbr>62</a>><br>
                                    <br>
                                    Here  "Via" contains not real IP
                                    (this is Yealink IP).<br>
                                    <br>
                                    What I do ?</div>
                                </div>
                                 </div>
                              <div class="gmail_extra"><br>
                                <div class="gmail_quote">2017-10-31
                                  14:18 GMT+02:00 Răzvan Crainea <span dir="ltr"><<a href="mailto:razvan@opensips.org" target="_blank">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>So you did
                                        manage to fix your problem?</tt><span><br>
                                        <pre class="m_1226959779000449433m_5861672758880187697m_2339828074249716840moz-signature" cols="72">Răzvan Crainea
OpenSIPS Developer
<a class="m_1226959779000449433m_5861672758880187697m_2339828074249716840moz-txt-link-abbreviated" href="http://www.opensips-solutions.com/" target="_blank">www.opensips-solutions.com</a></pre>
                                      </span>
                                      <div>
                                        <div class="m_1226959779000449433m_5861672758880187697h5">
                                          <div class="m_1226959779000449433m_5861672758880187697m_2339828074249716840moz-cite-prefix">On
                                            10/31/2017 02:17 PM,
                                            Dragomir Haralambiev wrote:<br>
                                          </div>
                                          <blockquote type="cite">
                                            <div dir="ltr">Hi,
                                              <div><br>
                                              </div>
                                              <div>Thanks for your
                                                replay.</div>
                                              <div><br>
                                              </div>
                                              <div>I execute
                                                fix_nated_contact()
                                                after
                                                fix_nated_register().<br>
                                                <br>
                                                Here part of my script:</div>
                                              <div>
                                                <div><span style="white-space:pre-wrap">  </span>if
                                                  (isflagset(NAT)) {</div>
                                                <div>                if
(is_method("REGISTER")) {</div>
                                                <div>                   
                                                     
                                                  fix_nated_register();</div>
                                                <div><span style="white-space:pre-wrap">                  </span>setbflag(NAT_BFLAG);
                                                  # nat register</div>
                                                <div>                }</div>
                                                <div><span style="white-space:pre-wrap">          </span>fix_nated_contact();</div>
                                                <div><span style="white-space:pre-wrap">  </span>}</div>
                                              </div>
                                              <div><br>
                                              </div>
                                              <div>In this case
                                                fix_nated_contact() will
                                                be fix contact records
                                                in location table.<br>
                                                <br>
                                              </div>
                                            </div>
                                            <div class="gmail_extra"><br>
                                              <div class="gmail_quote">2017-10-31
                                                14:02 GMT+02:00 Răzvan
                                                Crainea <span dir="ltr"><<a href="mailto:razvan@opensips.org" target="_blank">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>Hi,
                                                      Dragomir!<br>
                                                      <br>
fix_nated_register() does not change the contact of the message,
                                                      fix_nated_contact()
                                                      does that.<br>
                                                      Please print the
                                                      Contact header as
                                                      I instructed
                                                      earlier and send
                                                      back the script
                                                      trace. Also,
                                                      please post the
                                                      logs on <a href="http://pastebin.com/" target="_blank">pastebin.com</a> or something, don't do it
                                                      directly in the
                                                      email.<br>
                                                      <br>
                                                      Best regards,</tt><span>
                                                      <pre class="m_1226959779000449433m_5861672758880187697m_2339828074249716840m_-6119473667299360433moz-signature" cols="72">Răzvan Crainea
OpenSIPS Developer
<a class="m_1226959779000449433m_5861672758880187697m_2339828074249716840m_-6119473667299360433moz-txt-link-abbreviated" href="http://www.opensips-solutions.com/" target="_blank">www.opensips-solutions.com</a></pre>
                                                    </span><span>
                                                      <div class="m_1226959779000449433m_5861672758880187697m_2339828074249716840m_-6119473667299360433moz-cite-prefix">On
                                                        10/31/2017 12:40
                                                        AM, Dragomir
                                                        Haralambiev
                                                        wrote:<br>
                                                      </div>
                                                      <blockquote type="cite">
                                                        <div dir="ltr">What
                                                          will I do to
                                                          solve this
                                                          problem?</div>
                                                        <div class="gmail_extra"><br>
                                                          <div class="gmail_quote">2017-10-27
                                                          11:50
                                                          GMT+03:00
                                                          Dragomir
                                                          Haralambiev <span dir="ltr"><<a href="mailto:goup2010@gmail.com" target="_blank">goup2010@gmail.com</a>></span>:<br>
                                                          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                                                          <div dir="ltr">
                                                          <div>Oct 27
                                                          11:47:32 web
                                                          /usr/local/sbin/opensips[30490<wbr>]: <span style="font-size:12.8px;white-space:nowrap">57995010</span>: REGISTER
                                                          before
                                                          fix_nated_register
                                                          <sip:<span style="font-size:12.8px;white-space:nowrap">57995010</span>@<a href="http://192.168.2.196:5060/" target="_blank">192.168.2.196:50<wbr>60</a>>[1]</div>
                                                          <div>Oct 27
                                                          11:47:32 web
                                                          /usr/local/sbin/opensips[30490<wbr>]: <span style="font-size:12.8px;white-space:nowrap">57995010</span>: REGISTER
                                                          after
                                                          fix_nated_register
                                                          <sip:<span style="font-size:12.8px;white-space:nowrap">57995010</span>@<a href="http://192.168.2.196:5060/" target="_blank">192.168.2.196:50<wbr>60</a>>[1]</div>
                                                          <div><br>
                                                          </div>
                                                          </div>
                                                          <div class="m_1226959779000449433m_5861672758880187697m_2339828074249716840m_-6119473667299360433HOEnZb">
                                                          <div class="m_1226959779000449433m_5861672758880187697m_2339828074249716840m_-6119473667299360433h5">
                                                          <div class="gmail_extra"><br>
                                                          <div class="gmail_quote">2017-10-27
                                                          10:41
                                                          GMT+03:00
                                                          Răzvan Crainea
                                                          <span dir="ltr"><<a href="mailto:razvan@opensips.org" target="_blank">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>Hi, Dragomir!<br>
                                                          <br>
                                                          Can you also
                                                          print the
                                                          Contact header
                                                          ($ct[1]).<br>
                                                          <br>
                                                          [1] <a class="m_1226959779000449433m_5861672758880187697m_2339828074249716840m_-6119473667299360433m_1988118695986928569m_-3317261220468934746moz-txt-link-freetext" href="http://www.opensips.org/Documentation/Script-CoreVar-2-4#toc26" target="_blank">http://www.opensips.org/Docume<wbr>ntation/Script-CoreVar-2-4#toc<wbr>26</a><br>
                                                          <br>
                                                          Best regards,<br>
                                                          </tt><span>
                                                          <pre class="m_1226959779000449433m_5861672758880187697m_2339828074249716840m_-6119473667299360433m_1988118695986928569m_-3317261220468934746moz-signature" cols="72">Răzvan Crainea
OpenSIPS Developer
<a class="m_1226959779000449433m_5861672758880187697m_2339828074249716840m_-6119473667299360433m_1988118695986928569m_-3317261220468934746moz-txt-link-abbreviated" href="http://www.opensips-solutions.com/" target="_blank">www.opensips-solutions.com</a>
</pre>
                                                          </span></div>
                                                          </blockquote>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </blockquote>
                                                          </div>
                                                        </div>
                                                      </blockquote>
                                                    </span></div>
                                                  <br>
______________________________<wbr>_________________<br>
                                                  Users mailing list<br>
                                                  <a href="mailto:Users@lists.opensips.org" target="_blank">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>
                                            </div>
                                            <br>
                                            <fieldset class="m_1226959779000449433m_5861672758880187697m_2339828074249716840mimeAttachmentHeader"></fieldset>
                                            <br>
                                            <pre>______________________________<wbr>_________________
Users mailing list
<a class="m_1226959779000449433m_5861672758880187697m_2339828074249716840moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a class="m_1226959779000449433m_5861672758880187697m_2339828074249716840moz-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>
                                      </div>
                                    </div>
                                    <br>
                                    ______________________________<wbr>_________________<br>
                                    Users mailing list<br>
                                    <a href="mailto:Users@lists.opensips.org" target="_blank">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>
                              </div>
                              ______________________________<wbr>_________________<br>
                              Users mailing list<br>
                              <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
                              <a class="m_1226959779000449433m_5861672758880187697moz-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><br>
                            </div>
                          </blockquote>
                        </div>
                        <br>
                        <br>
                        <fieldset class="m_1226959779000449433m_5861672758880187697mimeAttachmentHeader"></fieldset>
                        <br>
                        <pre>______________________________<wbr>_________________
Users mailing list
<a class="m_1226959779000449433m_5861672758880187697moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a class="m_1226959779000449433m_5861672758880187697moz-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>
                      <br>
                      <fieldset class="m_1226959779000449433m_5861672758880187697mimeAttachmentHeader"></fieldset>
                      <br>
                      <pre>______________________________<wbr>_________________
Users mailing list
<a class="m_1226959779000449433m_5861672758880187697moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a class="m_1226959779000449433m_5861672758880187697moz-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>
                    <br>
                    <fieldset class="m_1226959779000449433m_5861672758880187697mimeAttachmentHeader"></fieldset>
                    <br>
                    <pre>______________________________<wbr>_________________
Users mailing list
<a class="m_1226959779000449433m_5861672758880187697moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a class="m_1226959779000449433m_5861672758880187697moz-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>
              </div>
            </div>
            <br>
            ______________________________<wbr>_________________<br>
            Users mailing list<br>
            <a href="mailto:Users@lists.opensips.org" target="_blank">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>
      </div>
      <br>
      <fieldset class="m_1226959779000449433mimeAttachmentHeader"></fieldset>
      <br>
      <pre>______________________________<wbr>_________________
Users mailing list
<a class="m_1226959779000449433moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a class="m_1226959779000449433moz-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></div></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></div>