[OpenSIPS-Users] strange INVITE transmission

이기원 chester at zigbang.com
Wed Mar 30 11:45:14 UTC 2022


Hi guys and Daniel,

Finally, I dropped my config and generated a new config with
the "osipsconfig" command line tool including the "USE_NAT" option.
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.
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.

If you are not an expert, please use osipconfig to generate config file and
start from scratch.

Daniel helped me a lot!
Thank you

Regard
Kiwon




2022년 3월 30일 (수) 오후 12:01, 이기원 <chester at zigbang.com>님이 작성:

> Thank you for you advice, Daniel.
>
> I was testing with older versions of opensips such as 3.1 today.
>
> You give me wonderful information. I'll spend some time with opensip and
> share my results with you.
>
> Good night
>
>
>
> 2022년 3월 30일 (수) 오전 11:50, Daniel Zanutti <daniel.zanutti at gmail.com>님이 작성:
>
>> GMT -3:00 here
>>
>> I'm sending a copy of a config we have here, for Opensips 1.11.11.
>>
>> 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.
>>
>> 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.
>>
>> Hope this helps.
>>
>> On Tue, Mar 29, 2022 at 10:23 PM 이기원 <chester at zigbang.com> wrote:
>>
>>> Hi Daniel,
>>>
>>> I see the empty value for the received column.
>>>
>>> [image: image.png]
>>>
>>> However I read the right IP address for that device. Opensips resolves
>>> its IP address but doesn't write it down in DB.
>>>
>>> Any options?
>>>
>>> By the way, what timezone do you live in? I'm in GMT+9 Seoul, Korea.
>>>
>>> Thank you
>>>
>>> Kiwon
>>>
>>> 2022년 3월 29일 (화) 오후 11:41, Daniel Zanutti <daniel.zanutti at gmail.com>님이
>>> 작성:
>>>
>>>> Hi Kiwon
>>>>
>>>> You are almost there.
>>>>
>>>> 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:
>>>>
>>>> [image: image.png]
>>>>
>>>> Could you check this is correct on your table?
>>>>
>>>> This e-mail is a Gmail account, add me for chat if you want.
>>>>
>>>>
>>>>
>>>> On Tue, Mar 29, 2022 at 4:43 AM 이기원 <chester at zigbang.com> wrote:
>>>>
>>>>> Hi Daniel,
>>>>>
>>>>> Thank you for your kind help again.
>>>>>
>>>>> 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
>>>>> Mar 29 14:38:36 [70] ERROR:core:main: bad function call in config
>>>>> file".
>>>>> That's why there is no response from opensips.
>>>>> nat_uac_test's parameter should be number. :)
>>>>>
>>>>> 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.
>>>>> [image: image.png]
>>>>> In the picture,
>>>>> * 175.223.34.31 is "zoiper" that is a soft-phone on iPhone
>>>>> * 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 (
>>>>> https://blog.opensips.org/2017/10/25/running-opensips-in-the-cloud/ )
>>>>> * 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.
>>>>> [image: image.png]
>>>>>
>>>>>
>>>>> and some logs from opensips------------------------------
>>>>>
>>>>> Mar 29 14:50:48 ip-10-0-0-177 /usr/sbin/opensips[45]: Fix contact -
>>>>> M=REGISTER RURI=sip:52.79.209.75:5090 F=sip:6002 at 52.79.209.75:5090 T=
>>>>> sip:6002 at 52.79.209.75:5090 IP=14.52.252.236 ID=
>>>>> 147053064617476-337321534728858 at 192.168.10.187
>>>>> Mar 29 14:50:48 ip-10-0-0-177 /usr/sbin/opensips[48]: Fix contact -
>>>>> M=REGISTER RURI=sip:52.79.209.75:5090 F=sip:6002 at 52.79.209.75:5090 T=
>>>>> sip:6002 at 52.79.209.75:5090 IP=14.52.252.236 ID=
>>>>> 147053064617476-337321534728858 at 192.168.10.187
>>>>> Mar 29 14:51:04 ip-10-0-0-177 /usr/sbin/opensips[45]: Fix contact -
>>>>> M=INVITE RURI=sip:6002 at 52.79.209.75:5090;transport=UDP
>>>>> F=sip:6001 at 52.79.209.75:5090;transport=UDP T=
>>>>> sip:6002 at 52.79.209.75:5090 IP=175.223.34.31
>>>>> ID=hqy06Z2nJ2lT0z1h4DKKUg..
>>>>> Mar 29 14:51:04 ip-10-0-0-177 /usr/sbin/opensips[48]: Fix contact -
>>>>> M=INVITE RURI=sip:6002 at 52.79.209.75:5090;transport=UDP
>>>>> F=sip:6001 at 52.79.209.75:5090;transport=UDP T=
>>>>> sip:6002 at 52.79.209.75:5090 IP=175.223.34.31
>>>>> ID=hqy06Z2nJ2lT0z1h4DKKUg..
>>>>>
>>>>>
>>>>>
>>>>> The document says
>>>>> 1.5.4.  fix_nated_register()
>>>>>
>>>>> 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.
>>>>> So I looked into mysql, especially the location table. I read that the
>>>>> contact address is still written with a private IP address.
>>>>>
>>>>> [image: image.png]
>>>>>
>>>>> Hmm. What am I missing?
>>>>>
>>>>> Thank you again.
>>>>>
>>>>> Regards
>>>>> Kiwon
>>>>>
>>>>>
>>>>>
>>>>> 2022년 3월 29일 (화) 오후 1:08, Daniel Zanutti <daniel.zanutti at gmail.com>님이
>>>>> 작성:
>>>>>
>>>>>> Hi Kiwon
>>>>>>
>>>>>> You applied at beginning, before loose_route. Not sure it gonna work
>>>>>> this way, i sent you exactly line where to put the code.
>>>>>> Move this:
>>>>>>  if (nat_uac_test(23)) {
>>>>>> if (is_method("REGISTER")) {
>>>>>> fix_nated_register();
>>>>>> setbflag("NAT");
>>>>>> } else {
>>>>>> fix_nated_contact();
>>>>>> setflag("NAT");
>>>>>> }
>>>>>> }
>>>>>>
>>>>>> After:
>>>>>> t_check_trans();
>>>>>>
>>>>>> Anyway, I suggest you add some log to confirm messages are coming.
>>>>>> Put this line right after main route:
>>>>>> xlog("L_ERR","MESSAGE RECEIVED $rm [$fu/$tu/$ru/$ci/$si]");
>>>>>>
>>>>>> There's no big deal on Opensips, everything comes to main route,
>>>>>> internal transaction responses comes from specific routes. (
>>>>>> https://www.opensips.org/Documentation/Script-Routes-3-1)
>>>>>>
>>>>>> I have some spare time tomorrow, send me a direct message if you need
>>>>>> help.
>>>>>>
>>>>>>
>>>>>> On Tue, Mar 29, 2022 at 12:43 AM 이기원 <chester at zigbang.com> wrote:
>>>>>>
>>>>>>> Hi Daniel and opensips users goup,
>>>>>>> Thank you for answering my questions.
>>>>>>>
>>>>>>> I missed to inform you about the opensips version I'm trying. It is
>>>>>>> 3.2.5.
>>>>>>>
>>>>>>> After modifying config, opensips does not respond for the REGISTER
>>>>>>> requests from phones.
>>>>>>> Actually I already tried the following
>>>>>>> https://kb.smartvox.co.uk/opensips/nat-contact-and-via-fixing-in-sip-part-3/
>>>>>>> article but I have the same problem - no response for REGISTERs.
>>>>>>>
>>>>>>> Is there any way to know why opensips ignores or does not respond
>>>>>>> for REGISTERs?
>>>>>>> Please find my new opensips.cfg that Diniel's advice is applied.
>>>>>>>
>>>>>>>
>>>>>>> Thank you
>>>>>>>
>>>>>>> Regards
>>>>>>> Kiwon
>>>>>>>
>>>>>>> 2022년 3월 28일 (월) 오후 10:47, Daniel Zanutti <daniel.zanutti at gmail.com>님이
>>>>>>> 작성:
>>>>>>>
>>>>>>>> Hi Kiwon
>>>>>>>>
>>>>>>>> You need to handle NAT scenarios. Try putting this code on line
>>>>>>>> 254, right after "t_check_trans()":
>>>>>>>>
>>>>>>>> if (nat_uac_test("7"))
>>>>>>>> {
>>>>>>>>   #nathelper
>>>>>>>>   if(is_method("REGISTER"))
>>>>>>>>     fix_nated_register();
>>>>>>>>   else
>>>>>>>>     fix_nated_contact();
>>>>>>>>   xlog("L_NOTICE", "Fix contact - M=$rm RURI=$ru F=$fu T=$tu IP=$si
>>>>>>>> ID=$ci\n");
>>>>>>>> }
>>>>>>>>
>>>>>>>> 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.
>>>>>>>>
>>>>>>>>
>>>>>>>> On Mon, Mar 28, 2022 at 5:20 AM 이기원 <chester at zigbang.com> wrote:
>>>>>>>>
>>>>>>>>> Hi guys, I'm trying to introduce opensips into my company these
>>>>>>>>> days.
>>>>>>>>>
>>>>>>>>> I'm testing with many other phones. During the test, I had a very
>>>>>>>>> strange symptom.
>>>>>>>>>
>>>>>>>>> Please, take look at the picture below first. (Please find my
>>>>>>>>> screenshot from the link below)
>>>>>>>>> A. The most left one 14.52.252.236 is a phone (with hardware).
>>>>>>>>> B. 10.0.0.177 is proxy which is woking on cloud and its external
>>>>>>>>> IP is 58.79.209.75
>>>>>>>>> C. 175.223.34.31 is a zoiper softphone which is working on iphone
>>>>>>>>> D. 192.168.10.187 is the private IP address of A - a phone which
>>>>>>>>> is the most left one (14.52.252.236)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> https://drive.google.com/file/d/14zAREWLsluIa1TcU7tZJLSgff-iPqBDA/view?usp=sharing
>>>>>>>>>
>>>>>>>>> As you can see, C is calling A but opensips transmits the INVITE
>>>>>>>>> rqeuset to A's private IP address.
>>>>>>>>> INVITE request should be transmitted A's public IP address - In
>>>>>>>>> this scenario 14.52.252.236 (A)
>>>>>>>>>
>>>>>>>>> I also attach my opensips.cfg. What's wrong with me?
>>>>>>>>>
>>>>>>>>> Thank you
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Regards
>>>>>>>>> Kiwon
>>>>>>>>> _______________________________________________
>>>>>>>>> Users mailing list
>>>>>>>>> Users at lists.opensips.org
>>>>>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Users mailing list
>>>>>>>> Users at lists.opensips.org
>>>>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Users mailing list
>>>>>>> Users at lists.opensips.org
>>>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>>>
>>>>>> _______________________________________________
>>>>>> Users mailing list
>>>>>> Users at lists.opensips.org
>>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>>
>>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20220330/5c0a3df9/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 197017 bytes
Desc: not available
URL: <http://lists.opensips.org/pipermail/users/attachments/20220330/5c0a3df9/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 137619 bytes
Desc: not available
URL: <http://lists.opensips.org/pipermail/users/attachments/20220330/5c0a3df9/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 50118 bytes
Desc: not available
URL: <http://lists.opensips.org/pipermail/users/attachments/20220330/5c0a3df9/attachment-0007.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 6903 bytes
Desc: not available
URL: <http://lists.opensips.org/pipermail/users/attachments/20220330/5c0a3df9/attachment-0008.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 62775 bytes
Desc: not available
URL: <http://lists.opensips.org/pipermail/users/attachments/20220330/5c0a3df9/attachment-0009.png>


More information about the Users mailing list