<div><div dir="auto">Make sure you don’t have 2 contacts</div></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, 8 Mar 2020 at 23:22, Jehanzaib Younis <<a href="mailto:jehanzaib.kiani@gmail.com">jehanzaib.kiani@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="ltr">but i have strange issue. <div>nathelper keep on sending the OPTION to old IP:PORT. As soon as the new REGISTER comes in, it should only send the option to the latest one. </div><div>For example, I see OPTION going to xx.xxx.xx.xx:25001 and opensips keep on sending to this after every 120 seconds (which is my setting)</div><div>The new register comes in and the 

xx.xxx.xx.xx:25004 letsay and now opensips sends to 25001 as well as 25004. Obviously my cpe only replies to the latest one. </div><div><br></div><div>Anyone have faced this issue ?</div><div><br></div><div>Thank you</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 6, 2020 at 2:54 PM Jehanzaib Younis <<a href="mailto:jehanzaib.kiani@gmail.com" target="_blank">jehanzaib.kiani@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="ltr"><div dir="ltr"><div>Thank you for your suggestions Diptesh,</div><div><br></div><div>Actually adding modparam("nathelper", "received_avp", "$avp(s:rcv)") & modparam("registrar", "received_avp", "$avp(s:rcv)") did the trick.</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 5, 2020 at 7:25 PM Dipteshkumar Patel <<a href="mailto:diptesh.patel@ecosmob.com" target="_blank">diptesh.patel@ecosmob.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="ltr">Hello Jehan,<div><br></div><div>OpenSIPS handle NAT different way for INVITE and REGISTER packets. If we use fix_nated_contact(), it will get the actual source ip from network and create a lump for that and replace the headers(like Contact, Received in Via and c parameter in SDP packet) just before sent out or relay the packet.</div><div><br></div><div>In your case, You need to manage the REGISTER and we are using OpenSIPS as a Registrar so we are not relay the packet so fix_nated_contact() will not help you. and your location table will have the private ip not public. So Let me guide how NAT can be managed in Registration.</div><div><br></div><div>There are three modules are responsible for the registration with NAT handling.</div><div>1. registrar module</div><div>2. usrloc module</div><div>3. nathelper module</div><div><br></div><div>nathelper module can check the packet source is behind nat or nat and get the public ip from source ip.</div><div><br></div><div>We need to define a module parameter for netheper module with an avp variable so the module will store the received IP in that avp. and similar avp should be in registrar module so registrar module can read the avp and store it into location as received parameter.</div><div><br></div><div><pre style="border:1px solid rgb(153,204,204);padding-left:15pt;font-family:monospace;background-color:rgb(254,254,238);color:rgb(0,0,0)">modparam("nathelper", "received_avp", "$avp(received)")</pre><pre style="border:1px solid rgb(153,204,204);padding-left:15pt;font-family:monospace;background-color:rgb(254,254,238);color:rgb(0,0,0)">modparam("registrar", "received_avp", "$avp(received)")<br></pre></div><div><br></div><div>Refer the following snippet.</div><div><br></div><div>/*Other registrar Parameters*/<br>modparam("registrar", "received_avp", "$avp(received)")<br><br>/*Other nethelper Parameters*/<br>modparam("nathelper", "received_avp", "$avp(received)") #keep in mind that this avp should be same in registrar module.<br><br>/*Other usrloc Parameters*/<br>modparam("usrloc", "nat_bflag", "NAT_FLAG")<br><br>route(NAT_MANAGE);<br>-------<br>/*Some Authentication Stuff*/<br>-------<br>if(!save("location")) {<br>            sl_reply_error();<br>}<br><br>route[NAT_MANAGE] {<br>    if(nat_uac_test("19")){<br>        xlog("L_INFO","--- [NAT_MANAGE] UAC IS BEHIND NAT ---");<br>        if(is_method("REGISTER")){<br>            fix_nated_register();<br>            setbflag(NAT_FLAG);<br>        } else {<br>            fix_nated_contact();<br>            setflag(NAT_FLAG);<br>            if (has_body("application/sdp")){<br>                fix_nated_sdp("3");<br>            }<br>        }<br>    }<br>}</div><div><br></div><div>Output of opensipsctl ul show</div><div>-----------------------------------------------</div><div><br></div><div>AOR:: <a href="mailto:100@world.provider.in" target="_blank">100@world.provider.in</a><br>    Contact:: sip:100@[ACTUAL CONTACT IP]:5060 Q=<br>            ContactID:: 2522655082190201667<br>            Expires:: 2219<br>            Callid:: <a href="mailto:18480129104911-28121824031899@192.168.30.238" target="_blank">18480129104911-28121824031899@192.168.30.238</a><br>            Cseq:: 6<br>            User-agent:: Phone Ver2.2<br>            Received:: sip:[RECEIVED IP]:5060 /*This IP will be used as request domain on relay the packet*/<br>            State:: CS_SYNC<br>            Flags:: 0<br>            Cflags:: SIPPING_RTO SIPPING_ENABLE NAT_FLAG<br>            Socket:: udp:[OPENSIPS LISTEN SOCKET]:5070<br>            Methods:: 7551</div><div><br></div><div>I hope this will solve your problem.</div><div><br><div><div dir="ltr"><div dir="ltr"><div><div>Thanks & Regards</div><div dir="ltr"><b>Diptesh Patel</b><div>Software Developer </div><div>Ecosmob Technologies Ltd, </div><div>Ahmedabad</div><div>Mo:<b>+919898962659</b></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 5, 2020 at 4:35 AM Jehanzaib Younis <<a href="mailto:jehanzaib.kiani@gmail.com" target="_blank">jehanzaib.kiani@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="ltr"><div dir="ltr"><div>Thank you for your email Callum,</div><div>I can not see the public IP in the command line that is strange. but OPTION is working fine. i can see 200 OK in the OPTION. <br></div><div>I have already tried what you have suggested i.e fixed_nated_contact on INVITE it is still sending to my 10.xx.xx.xx ip. <br></div><div><br></div><div>Here is my URL location <br></div><div>AOR:: xxxxxx<br>        Contact:: sip:xxx@10.202.128.xx:5060;transport=udp Q=<br>                Expires:: 2914<br>                Callid:: n883832msp1lm0nl3cmjks88jkpinsc0@10.202.128.xx<br>                Cseq:: 12<br>                User-agent:: HUAWEI-EchoLife HG8240H/V3R013C10S108<br>                State:: CS_NEW<br>                Flags:: 0<br>                Cflags:: 3<br>                Socket:: udp:mysipserverip:5060<br>                Methods:: 8191</div><div><br></div><div>here is my url and nat module parameters</div><div><br></div><div>loadmodule "usrloc.so"<br>modparam("usrloc", "nat_bflag", "NAT")<br>modparam("usrloc", "db_mode",   0)<br></div><div><br></div><div>loadmodule "nathelper.so"<br>modparam("nathelper", "natping_interval", 120) # Ping interval 120 s<br>modparam("nathelper", "ping_nated_only", 1)   # Ping only clients behind NAT<br>modparam("nathelper", "sipping_method", "OPTIONS")<br>modparam("nathelper", "sipping_from", "<a href="mailto:sip%3Apinger@mytestdomain.com" target="_blank">sip:pinger@mytestdomain.com</a>")<br>modparam("nathelper", "received_avp", "$avp(i:42)")<br>modparam("nathelper", "sipping_bflag", 7)<br><br>loadmodule "nat_traversal.so"<br>modparam("nat_traversal", "keepalive_interval", 120)<br>modparam("nat_traversal", "keepalive_method", "OPTIONS")<br>modparam("nat_traversal", "keepalive_from", "<a href="mailto:sip%3Apinger@mytestdomain.com" target="_blank">sip:pinger@mytestdomain.com</a>")</div><div><br></div><div>Any suggestions please?</div><div><br></div><div>Thank you <br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 4, 2020 at 9:50 PM Callum Guy <<a href="mailto:callum.guy@x-on.co.uk" target="_blank">callum.guy@x-on.co.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="ltr">Hi Jehan,<br><div><br></div><div>Sounds like you want to be using fix_nated_contact() - when the INVITE arrives you can try the following:</div><div><font face="monospace" style="font-family:monospace;color:rgb(0,0,0)"><br></font></div><div><font face="monospace" style="font-family:monospace;color:rgb(0,0,0)"># Check if contact is RFC1918</font></div><div><font face="monospace" style="font-family:monospace;color:rgb(0,0,0)">if (nat_uac_test(1)) {</font></div><div><font face="monospace" style="font-family:monospace;color:rgb(0,0,0)">    # Replace the contact IP with the received address from the network</font></div><div><font face="monospace" style="font-family:monospace;color:rgb(0,0,0)">    fix_nated_contact();</font></div><div><font face="monospace" style="font-family:monospace;color:rgb(0,0,0)">}<br></font></div><div><br></div><div>If you look at the registrations via CLI or database (if in use) you'll see that OpenSIPs is tracking both a contact and received value to deal with this - that will be where your NAT pings are getting the address from.</div><div><br></div><div>Hopefully that helps to get you on the correct path!</div><div><br></div><div>Callum</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 3 Mar 2020 at 21:06, Jehanzaib Younis <<a href="mailto:jehanzaib.kiani@gmail.com" target="_blank">jehanzaib.kiani@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="ltr"><div>Hi gang,</div><div><br></div><div>I have quite strange issue. When in some cases when my customer's have 10.202.128.xx range they are behind NAT. when i see opensipsctl ul show number@sip</div><div>i see contact header as Contact:: sip:number@10.202.128.xx:5060;transport=udp Q=</div><div>which means when i try to relay the invite goes to that 10.202.128.xx:5060 which is wrong. It should go to its public IP:port<br></div><div><br></div><div>but weird thing is, i see the OPTION is sent to its Public IP (OPTIONS sip:180.xx.xx.xx:1502). I also see the 200 OK 
which is perfect. <br></div><div><br></div><div>I tried to use fix_nated_register(); but it does not change anything. <br></div><div><br></div><div>Can anyone help please?</div><div><br></div><div>Thank you<br></div><div><br></div><div><br></div><div>Regards,</div><div>Jehan<br></div></div>
_______________________________________________<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-bin/mailman/listinfo/users</a><br>
</blockquote></div>

<br>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;text-align:justify"><font size="3" face="Verdana" style="font-family:Verdana;color:rgb(0,0,0)"><span style="font-size:8px;font-weight:400;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-east-asian:normal;text-decoration:none;vertical-align:baseline;font-family:Verdana;background-color:transparent;color:rgb(0,0,0)"></span></font></p><div><img src="https://www.x-on.co.uk/email/footer/General-Practice-Awards-winners.jpg"></div><div><br></div><div><div><div><font size="4" style="color:rgb(0,0,0)"><b><sup><font face="Verdana" style="font-family:Verdana;color:rgb(0,0,0)">0333 332 0000  |  <a href="http://www.x-on.co.uk" target="_blank" style="font-family:Verdana">www.x-on.co.uk</a>  |  <sub style="font-family:Verdana"> </sub></font></sup></b></font><font size="4" style="color:rgb(0,0,0)"><b><sub><sup><font face="Verdana" style="font-family:Verdana;color:rgb(0,0,0)"><a href="https://www.linkedin.com/company/x-on" target="_blank" style="font-family:Verdana"><img src="http://www.x-on.co.uk//images/icon/linkedin.png" width="24" height="24" style="font-family: Verdana;"></a>  <a href="https://www.facebook.com/XonTel" target="_blank" style="font-family:Verdana"><img src="http://www.x-on.co.uk//images/icon/facebook.png" width="24" height="24" style="font-family: Verdana;"></a>  <a href="https://twitter.com/xonuk" target="_blank" style="font-family:Verdana"><img src="http://www.x-on.co.uk//images/icon/twitter.png" width="24" height="24" style="font-family: Verdana;"></a></font></sup></sub> </b></font><br><p><span style="font-size:6pt;font-family:Verdana;color:black">X-on
is a trading name of Storacall Technology Ltd a limited company registered in
England and Wales.<br>
Registered Office : Avaland House, <a href="https://www.google.com/maps/search/110+London+Road,+Apsley,+Hemel+Hempstead,%0D%0AHerts,+HP3+9SD?entry=gmail&source=g" style="font-family:Verdana">110 London Road, Apsley, Hemel Hempstead,
Herts, HP3 9SD</a>. Company Registration No. 2578478.<br>
The information in this e-mail is confidential and for use by the addressee(s)
only. If you are not the intended recipient, please notify X-on immediately on <span style="font-family:Verdana">+44(0)333 332 0000</span> and delete the<br>message from your computer. If you are not a named addressee you must not use,
disclose, disseminate, distribute, copy, print or reply to this email. </span><span style="font-size:6pt;font-family:Verdana;color:black">Views
or opinions expressed by an individual<br>within this email may not necessarily
reflect the views of X-on or its associated companies. Although X-on routinely
screens for viruses, addressees should scan this email and any attachments<br>for
viruses. X-on makes no representation or warranty as to the absence of viruses
in this email or any attachments.</span></p>





<p><span style="font-size:6pt;font-family:Verdana;color:black"></span><font size="2" style="color:rgb(0,0,0)"><span style="font-size:6pt;font-family:Verdana;color:black"></span></font></p></div></div></div>_______________________________________________<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-bin/mailman/listinfo/users</a></blockquote></div></div></blockquote></div></blockquote><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><br>
</blockquote></div><a href="https://vndpbx.com" target="_blank">A cloud hosted phone system</a><br></div>
_______________________________________________<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-bin/mailman/listinfo/users</a><br>
</blockquote></div>

<br>
<div><font style="font-family:Arial;background-color:white;color:rgb(128,128,128)" size="2" face="Arial"><b style="font-family:Arial">Disclaimer</b></font></div><div><div><span style="font-family:Arial;font-size:small;background-color:white;color:rgb(128,128,128)">In addition to generic Disclaimer which you have agreed on our website, any views or opinions presented in this email are solely those of the originator and do not necessarily represent those of the Company or its sister concerns. Any liability (in negligence, contract or otherwise) arising from any third party taking any action, or refraining from taking any action on the basis of any of the information contained in this email is hereby excluded.</span></div></div><div><span style="font-family:Arial;font-size:small;background-color:white;color:rgb(128,128,128)"><br></span></div><div><font style="font-family:Arial;background-color:white;color:rgb(128,128,128)" size="2" face="Arial"><b style="font-family:Arial">Confidentiality</b></font></div><div><font style="font-family:Arial;background-color:white;color:rgb(128,128,128)" size="2" face="Arial">This communication (including any attachment/s) is intended only for the use of the addressee(s) and contains information that is PRIVILEGED AND CONFIDENTIAL. Unauthorized reading, dissemination, distribution, or copying of this communication is prohibited. Please inform originator if you have received it in error.</font></div><div><font style="font-family:Arial;background-color:white;color:rgb(128,128,128)" size="2" face="Arial"><br></font></div><div><span style="font-family:Arial;font-size:small;background-color:white;color:rgb(128,128,128)"><b style="font-family:Arial">Caution for viruses, malware etc.</b></span></div><div><font style="font-family:Arial;background-color:white;color:rgb(128,128,128)" size="2" face="Arial">This communication, including any attachments, may not be free of viruses, trojans, similar or new contaminants/malware, interceptions or interference, and may not be compatible with your systems. You shall carry out virus/malware scanning on your own before opening any attachment to this e-mail. The sender of this e-mail and Company including its sister concerns shall not be liable for any damage that may incur to you as a result of viruses, incompleteness of this message, a delay in receipt of this message or any other computer problems. </font></div>_______________________________________________<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-bin/mailman/listinfo/users</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr"><div>Regards,</div>
<div>Jehanzaib</div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div>Regards,</div>
<div>Jehanzaib</div></div>
_______________________________________________<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-bin/mailman/listinfo/users</a><br>
</blockquote></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Regards,</div><div><br></div>David Villasmil<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div><div>phone: +34669448337</div></div></div>