<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <tt>Hi, Dragomir!<br>
      <br>
      This is something that I noticed from the first email you have
      sent - the fix_nated_register() function is not called, or does
      not work properly. Can you also print the avp you are setting in
      the received_avp[1]. Also, call script trace for the reply too.<br>
      <br>
      [1]
<a class="moz-txt-link-freetext" href="http://www.opensips.org/html/docs/modules/2.4.x/nathelper.html#idp5510048">http://www.opensips.org/html/docs/modules/2.4.x/nathelper.html#idp5510048</a><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/06/2017 06:18 PM, Dragomir
      Haralambiev wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CADzurOJ0WRYF7fGw468QYg30t0orUmYF1VFj7nZN6=53jTseaw@mail.gmail.com">
      <div dir="ltr">Hi, 
        <div><br>
        </div>
        <div>Thanks for your email.<br>
          <br>
          Here is part of my location table:<br>
          <br>
          <div>         contact_id  username   domain  contact         
                                                                     
             received  path    expires                   q  callid     
                                                    cseq  last_modified 
                   flags  cflags     user_agent                       
            socket                   methods  sip_instance  attr    </div>
          <div>-------------------  ---------  ------ 
-------------------------------------------------------------------------- 
            --------  ------  -------------------  ------ 
            ------------------------------------------------  ------ 
            -------------------  ------  --------- 
            --------------------------------  ----------------------- 
            -------  ------------  --------</div>
          <div> 181494352482801881  57996206   (NULL)  <a
              href="http://sip:57996206@192.168.22.206:5062"
              moz-do-not-send="true">sip:57996206@192.168.22.206:5062</a> 
                                                      (NULL)    (NULL) 
            2017-11-06 17:58:48   -1.00  <a
              href="mailto:1162502851@192.168.22.206"
              moz-do-not-send="true">1162502851@192.168.22.206</a>     
                                  162  2017-11-06 17:52:48       0 
            NAT_BFLAG  Yealink SIP-T19P 31.72.0.75     
             udp:OpenSips_IP:5060    16383  (NULL)        (NULL)  </div>
          <div> 181654460760464436  57996204   (NULL)  <a
              href="http://sip:57996204@192.168.22.204:5060"
              moz-do-not-send="true">sip:57996204@192.168.22.204:5060</a> 
                                                      (NULL)    (NULL) 
            2017-11-06 17:59:02   -1.00  <a
              href="mailto:0_1763370066@192.168.22.204"
              moz-do-not-send="true">0_1763370066@192.168.22.204</a>   
                                  179  2017-11-06 17:53:02       0 
            NAT_BFLAG  Yealink SIP-T21P_E2 52.81.0.25   
            udp:OpenSips_IP:5060    16383  (NULL)        (NULL)  </div>
          <div> </div>
        </div>
        <div>Why "received" field is blank?<br>
          Where could be the problem?<br>
          <br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">2017-11-06 11:44 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>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><span class="">
                <pre class="m_6567376357742622228moz-signature" cols="72">Răzvan Crainea
OpenSIPS Developer
<a class="m_6567376357742622228moz-txt-link-abbreviated" href="http://www.opensips-solutions.com" target="_blank" moz-do-not-send="true">www.opensips-solutions.com</a></pre>
              </span>
              <div>
                <div class="h5">
                  <div class="m_6567376357742622228moz-cite-prefix">On
                    11/03/2017 09:36 PM, Dragomir Haralambiev wrote:<br>
                  </div>
                  <blockquote type="cite">
                    <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>
                              <pre class="m_6567376357742622228m_-4701204381392790406moz-signature" cols="72">Răzvan Crainea
OpenSIPS Developer
<a class="m_6567376357742622228m_-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>
                              <div
                                class="m_6567376357742622228m_-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>
                                  <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:5<wbr>062</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:10<wbr>43</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:5<wbr>062</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"
                            target="_blank" 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="m_6567376357742622228mimeAttachmentHeader"></fieldset>
                    <br>
                    <pre>______________________________<wbr>_________________
Users mailing list
<a class="m_6567376357742622228moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" target="_blank" moz-do-not-send="true">Users@lists.opensips.org</a>
<a class="m_6567376357742622228moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank" moz-do-not-send="true">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"
              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>