<div dir="ltr">Hi guys and Daniel, <div><br></div><div>Finally, I dropped my config and generated a new config with the "osipsconfig" command line tool including the "USE_NAT" option.</div><div>Actually my config was from one of my colleagues. He generated that config without USE_NAT option. And I tried to make "NAT" enabled by my beginner's hand. Some articles help me out but that causes this nightmare.</div><div>To make opensips supporting NAT, it is needed to modify many parts in the config(script). But some articles introduce a little concept of it. I'm not sure if that recipe worked with old versions but NOT NOW. </div><div><br></div><div>If you are not an expert, please use osipconfig to generate config file and start from scratch.</div><div><br></div><div>Daniel helped me a lot!</div><div>Thank you</div><div><br></div><div>Regard</div><div>Kiwon</div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">2022년 3월 30일 (수) 오후 12:01, 이기원 <<a href="mailto:chester@zigbang.com">chester@zigbang.com</a>>님이 작성:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Thank you for you advice, Daniel.<div><br></div><div>I was testing with older versions of opensips such as 3.1 today.</div><div><br></div><div>You give me wonderful information. I'll spend some time with opensip and share my results with you. </div><div><br></div><div>Good night</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">2022년 3월 30일 (수) 오전 11:50, Daniel Zanutti <<a href="mailto:daniel.zanutti@gmail.com" target="_blank">daniel.zanutti@gmail.com</a>>님이 작성:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">GMT -3:00 here<div><br></div><div>I'm sending a copy of a config we have here, for Opensips 1.11.11. </div><div><br></div><div>I configured some months ago to a developer use on his machine and test with no DB backend configured. This config will allow any user/pass and should handle NAT seamlessly. Please take a look and study how it works. You could install opensips 1.11.11 and test it or port the config to 3.x, we use 1.11.11 in production with no known bugs.</div><div><br></div><div>Don't forget that you are handling NAT using SIP, to also handle NAT for audio (RTP), you're gonna need RTPPROXY. It's already configured on this script, if you don't want it, just comment the module and all errors you find.</div><div><br></div><div>Hope this helps.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 29, 2022 at 10:23 PM 이기원 <<a href="mailto:chester@zigbang.com" target="_blank">chester@zigbang.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Daniel,<div><br></div><div>I see the empty value for the received column.<br><div><br></div><div><img src="cid:ii_l1cvpi744" alt="image.png" width="562" height="53"><br></div></div><div><br></div><div>However I read the right IP address for that device. Opensips resolves its IP address but doesn't write it down in DB.</div><div><br></div><div>Any options?</div><div><br></div><div>By the way, what timezone do you live in? I'm in GMT+9 Seoul, Korea. </div><div><br></div><div>Thank you</div><div><br></div><div>Kiwon</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">2022년 3월 29일 (화) 오후 11:41, Daniel Zanutti <<a href="mailto:daniel.zanutti@gmail.com" target="_blank">daniel.zanutti@gmail.com</a>>님이 작성:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Kiwon<div><br></div><div>You are almost there.</div><div><br></div><div>On location table, the Contact column will be the same as the SIP Contact header. The public IP will be on the "received" column. Take a look at a production server we have here:</div><div><br></div><div><img src="cid:ii_l1c8q6cs3" alt="image.png" style="margin-right: 25px;"><br></div><div><br></div><div>Could you check this is correct on your table?</div><div><br></div><div>This e-mail is a Gmail account, add me for chat if you want.</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 29, 2022 at 4:43 AM 이기원 <<a href="mailto:chester@zigbang.com" target="_blank">chester@zigbang.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Daniel, </div><div><br></div><div>Thank you for your kind help again.</div><div><br></div><div>In my first trial, I told you there was no response from opensips. Now I realized that it was because of crashing due to "Mar 29 14:38:36 [70] ERROR:core:check_actions: check failed for function <nat_uac_test>, /etc/opensips/opensips.cfg:256</div><div>Mar 29 14:38:36 [70] ERROR:core:main: bad function call in config file". </div><div>That's why there is no response from opensips. </div><div>nat_uac_test's parameter should be number. :)</div><div><br></div><div>And I revised the config file as your second advice, but it's just the same as before I put the NAT helper script. Please take a look at the call flow.</div><div><img src="cid:ii_l1bpw30t0" alt="image.png" width="562" height="348"><br></div><div>In the picture, </div><div>* 175.223.34.31 is "zoiper" that is a soft-phone on iPhone</div><div>* 10.0.0.177 is opensips server in AWS. Its external IP address is 52.79.209.75 and I put "advertised_address" with that IP address in cfg file ( <a href="https://blog.opensips.org/2017/10/25/running-opensips-in-the-cloud/" target="_blank">https://blog.opensips.org/2017/10/25/running-opensips-in-the-cloud/</a> )</div><div>* 192.168.10.187 is testing phone. Its public IP address is 14.52.242.236. The picture below is a registration flow for the testing phone.</div><div><img src="cid:ii_l1br19vj1" alt="image.png" width="562" height="221"><br></div><div><br></div><div><br></div><div>and some logs from opensips------------------------------</div><div><br></div><div>Mar 29 14:50:48 ip-10-0-0-177 /usr/sbin/opensips[45]: Fix contact - M=REGISTER RURI=sip:<a href="http://52.79.209.75:5090" target="_blank">52.79.209.75:5090</a> F=<a href="http://sip:6002@52.79.209.75:5090" target="_blank">sip:6002@52.79.209.75:5090</a> T=<a href="http://sip:6002@52.79.209.75:5090" target="_blank">sip:6002@52.79.209.75:5090</a> IP=14.52.252.236 ID=<a href="mailto:147053064617476-337321534728858@192.168.10.187" target="_blank">147053064617476-337321534728858@192.168.10.187</a><br>Mar 29 14:50:48 ip-10-0-0-177 /usr/sbin/opensips[48]: Fix contact - M=REGISTER RURI=sip:<a href="http://52.79.209.75:5090" target="_blank">52.79.209.75:5090</a> F=<a href="http://sip:6002@52.79.209.75:5090" target="_blank">sip:6002@52.79.209.75:5090</a> T=<a href="http://sip:6002@52.79.209.75:5090" target="_blank">sip:6002@52.79.209.75:5090</a> IP=14.52.252.236 ID=<a href="mailto:147053064617476-337321534728858@192.168.10.187" target="_blank">147053064617476-337321534728858@192.168.10.187</a><br>Mar 29 14:51:04 ip-10-0-0-177 /usr/sbin/opensips[45]: Fix contact - M=INVITE RURI=sip:6002@52.79.209.75:5090;transport=UDP F=sip:6001@52.79.209.75:5090;transport=UDP T=<a href="http://sip:6002@52.79.209.75:5090" target="_blank">sip:6002@52.79.209.75:5090</a> IP=175.223.34.31 ID=hqy06Z2nJ2lT0z1h4DKKUg..<br>Mar 29 14:51:04 ip-10-0-0-177 /usr/sbin/opensips[48]: Fix contact - M=INVITE RURI=sip:6002@52.79.209.75:5090;transport=UDP F=sip:6001@52.79.209.75:5090;transport=UDP T=<a href="http://sip:6002@52.79.209.75:5090" target="_blank">sip:6002@52.79.209.75:5090</a> IP=175.223.34.31 ID=hqy06Z2nJ2lT0z1h4DKKUg..<br></div><div><br></div><div><br></div><div><br></div><div>The document says </div><div><div style="color:rgb(0,0,0);font-family:Helvetica,Arial;font-size:medium"><div><div><h3>1.5.4.  <code>fix_nated_register()</code></h3></div></div></div><p style="font-family:Helvetica,Arial;font-size:12px;text-align:justify;color:rgb(0,0,0)">The function creates a URI consisting of the source IP, port, and protocol and stores the URI in an Attribute-Value-Pair. The URI will be appended as "received" parameter to Contact in 200 OK and registrar will store it in the user location database.</p><div>So I looked into mysql, especially the location table. I read that the contact address is still written with a private IP address. </div><p style="font-family:Helvetica,Arial;font-size:12px;text-align:justify;color:rgb(0,0,0)"></p><div></div><p></p><div><img src="cid:ii_l1btuo5m2" alt="image.png" width="562" height="65"><br></div></div><div><br></div><div>Hmm. What am I missing?</div><div><br></div><div>Thank you again. </div><div><br></div><div>Regards</div><div>Kiwon</div><div><br></div><div><br></div><div><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">2022년 3월 29일 (화) 오후 1:08, Daniel Zanutti <<a href="mailto:daniel.zanutti@gmail.com" target="_blank">daniel.zanutti@gmail.com</a>>님이 작성:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Kiwon<div><br></div><div>You applied at beginning, before loose_route. Not sure it gonna work this way, i sent you exactly line where to put the code.</div><div>Move this:</div><div> if (nat_uac_test(23)) {<br>         if (is_method("REGISTER")) {<br>                        fix_nated_register();<br>                 setbflag("NAT");<br>            } else {<br>                      fix_nated_contact();<br>                  setflag("NAT");<br>             }<br>     }<br></div><div><br></div><div>After:</div><div>t_check_trans();<br></div><div><br></div><div>Anyway, I suggest you add some log to confirm messages are coming. Put this line right after main route:</div><div>xlog("L_ERR","MESSAGE RECEIVED $rm [$fu/$tu/$ru/$ci/$si]");<br></div><div><br></div><div>There's no big deal on Opensips, everything comes to main route, internal transaction responses comes from specific routes. (<a href="https://www.opensips.org/Documentation/Script-Routes-3-1" target="_blank">https://www.opensips.org/Documentation/Script-Routes-3-1</a>)</div><div><br></div><div>I have some spare time tomorrow, send me a direct message if you need help.</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 29, 2022 at 12:43 AM 이기원 <<a href="mailto:chester@zigbang.com" target="_blank">chester@zigbang.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Daniel and opensips users goup,<div>Thank you for answering my questions.<div><br></div><div>I missed to inform you about the opensips version I'm trying. It is 3.2.5.<br></div><div> </div><div>After modifying config, opensips does not respond for the REGISTER requests from phones.<br></div><div>Actually I already tried the following <a href="https://kb.smartvox.co.uk/opensips/nat-contact-and-via-fixing-in-sip-part-3/" target="_blank">https://kb.smartvox.co.uk/opensips/nat-contact-and-via-fixing-in-sip-part-3/</a> article but I have the same problem - no response for REGISTERs.</div><div><br></div><div>Is there any way to know why opensips ignores or does not respond for REGISTERs?</div><div>Please find my new opensips.cfg that Diniel's advice is applied.</div><div><br></div><div><br></div><div>Thank you</div><div><br></div><div>Regards</div><div>Kiwon</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">2022년 3월 28일 (월) 오후 10:47, Daniel Zanutti <<a href="mailto:daniel.zanutti@gmail.com" target="_blank">daniel.zanutti@gmail.com</a>>님이 작성:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Kiwon<div><br></div><div>You need to handle NAT scenarios. Try putting this code on line 254, right after "t_check_trans()":</div><div><br></div><div>if (nat_uac_test("7"))<br>{<br>  #nathelper<br>  if(is_method("REGISTER"))<br>    fix_nated_register();<br>  else<br>    fix_nated_contact();<br>  xlog("L_NOTICE", "Fix contact - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");<br>}<br></div><div><br></div><div>You also need to enable nathelper module. The reason is that you need to use the public IP/Port that sent data to opensips and ignore the Contact. </div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 28, 2022 at 5:20 AM 이기원 <<a href="mailto:chester@zigbang.com" target="_blank">chester@zigbang.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi guys, I'm trying to introduce opensips into my company these days.<div><br></div><div>I'm testing with many other phones. During the test, I had a very strange symptom.</div><div><br></div><div>Please, take look at the picture below first. (Please find my screenshot from the link below)</div><div>A. The most left one 14.52.252.236 is a phone (with hardware).</div><div>B. 10.0.0.177 is proxy which is woking on cloud and its external IP is 58.79.209.75</div><div>C. 175.223.34.31 is a zoiper softphone which is working on iphone</div><div>D. 192.168.10.187 is the private IP address of A - a phone which is the most left one (14.52.252.236)</div><div><br></div><div><br></div><div><br></div><div><a href="https://drive.google.com/file/d/14zAREWLsluIa1TcU7tZJLSgff-iPqBDA/view?usp=sharing" target="_blank">https://drive.google.com/file/d/14zAREWLsluIa1TcU7tZJLSgff-iPqBDA/view?usp=sharing</a><br></div><div><br></div><div><div>As you can see, C is calling A but opensips transmits the INVITE rqeuset to A's private IP address.</div><div>INVITE request should be transmitted A's public IP address - In this scenario 14.52.252.236 (A) </div><div><br></div><div>I also attach my opensips.cfg. What's wrong with me? </div><div><br></div><div>Thank you</div><div><br></div><div><br></div><div>Regards </div><div>Kiwon</div></div><div dir="ltr"><div dir="ltr"></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><br>
</blockquote></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></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>
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>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>