[OpenSIPS-Users] Weird problem with NATHELPER

Ricardo Martinez rmartinez at redvoiss.net
Fri Nov 20 14:41:22 EST 2020


Hi.

I’m facing a weird problem with the NATHELPER module.  I’m using Opensips
3.1.0.

Seems that for certains REGISTER messages the nathelper module can fix the
Contact IP address with the fix_nated_register() function.  I don’t know if
I’m missing something or maybe is a bug.

So, this is the scenarario.

I have opensips in front of a PBX, using the NATHELPER module for NAT
traversal and the MID_REGISTER module for managing the REGISTER messages to
the PBX



Local PBX – Opensips (NATHELPE + REGISTER) --- UAC



The UAC is a softphone in a local WiFi network, when the softphone register
for the first time I can see the REGISTER flow OK, NATHELPER module
changing the private IP with the public received IP and port.  This is the
initial register:



2020/11/20 11:05:21.150428 186.106.166.154:44849 -> 64.76.XXX.133:5060

REGISTER sip:my.domain.com:5060 SIP/2.0

Via: SIP/2.0/UDP 192.168.1.83:44849
;branch=z9hG4bK-524287-1---10f17e71be522f67;rport

Max-Forwards: 70

Contact: <sip:d1.920 at 192.168.1.83:44849;rinstance=e21f207006bd104d
>;+sip.instance="<urn:uuid:f7a5b4e0-92dd-5227-b355-0467623c49c0>";reg-id=1

To: "User 920"<sip:d1.920 at my.domain.com:5060>

From: "User 920"<sip:d1.920 at my.domain.com:5060>;tag=4fa4f17b

Call-ID: 186079_mobile-rel120NjE4M2U3MWEzMjFhYjRmZDM0NGQyYWNkYWJjZjliNjA

CSeq: 1 REGISTER

Expires: 300

Allow: OPTIONS, INVITE, ACK, CANCEL, BYE, REFER, INFO, NOTIFY, UPDATE,
PRACK, SUBSCRIBE, MESSAGE

Supported: outbound, path

User-Agent: VEX Android 6.3.1.1 build 122490

Content-Length: 0



And the output for the command ul_dump



[root at sbcar opensips]# opensips-cli -x mi ul_dump

{

    "Domains": [

        {

            "name": "location",

            "hash_size": 4096,

            "AORs": [

                {

                    "AOR": "d1.920-mydomain1",

                    "Contacts": [

                        {

                            "Contact": "
sip:d1.920 at 186.106.166.154:44849;rinstance=e21f207006bd104d",

                            "ContactID": "933089547795829631",

                            "Expires": 290,

                            "Q": "",

                            "Callid":
"186079_mobile-rel120NjE4M2U3MWEzMjFhYjRmZDM0NGQyYWNkYWJjZjliNjA",

                            "Cseq": 10,

                            "User-agent": "VEX Android 6.3.1.1 build
122490",

                            "Received": "sip:186.106.166.154:44849",

                            "State": "CS_NEW",

                            "Flags": 0,

                            "Cflags": "SIP_PING NAT",

                            "Socket": "udp:64.76.XXX.133:5060",

                            "Methods": 8063,

                            "SIP_instance":
"<urn:uuid:f7a5b4e0-92dd-5227-b355-0467623c49c0>"



So far so good.

But, the softphone is an app in a mobile phone, so at some point the
softphone “goes to sleep”, and my “PUSH” server takes control.  So the Push
server REGISTERS on behalf of the softphone… the REGISTER arrives at the
Opensip, again from a NATED environment, so the uac_nat_test(19) catch the
REGISTER, and apply fix_nated_register.  But for some reason I don’t get
the stored “Contact” keeps the “private” IP.

This is the “new” REGISTER for the PUSH SERVER….



2020/11/20 11:06:21.333836 216.93.246.120:5060 -> 64.76.XXX.133:5060

REGISTER sip:my.domain.com:5060 SIP/2.0

Via: SIP/2.0/UDP 10.10.223.107:5060
;branch=z9hG4bK-524287-1---4703675abd3a9c18;rport

Max-Forwards: 70

Contact: <
sip:d1.920 at 10.10.223.107:5060;rinstance=d1.920-d789e5c341f8ac524c0a3441cded7ba6
>;+sip.instance="<urn:uuid:f7a5b4e0-92dd-5227-b355-0467623c49c0>";reg-id=1;expires=600

To: <sip:d1.920 at my.domain.com:5060>

From: <sip:d1.920 at my.domain.com:5060>;tag=cfad065a

Call-ID: txOBq9Lhk1tSVlM9eOTdzA.. at 216.93.246.122

CSeq: 1 REGISTER

Expires: 600

Allow: ACK, BYE, CANCEL, INVITE, NOTIFY, MESSAGE, OPTIONS, PRACK, REGISTER,
UPDATE

User-Agent: CounterPath Bria Push Server 2.3.0 (20980)

Content-Length: 0



And this is the locations table.

[root at sbcar opensips]# opensips-cli -x mi ul_dump

{

    "Domains": [

        {

            "name": "location",

            "hash_size": 4096,

            "AORs": [

                {

                    "AOR": "d1.920-mydomain",

                    "Contacts": [

                        {

                            "Contact": "
sip:d1.920 at 10.10.223.107:5060;rinstance=d1.920-d789e5c341f8ac524c0a3441cded7ba6
",

                            "ContactID": "933089547795829633",

                            "Expires": 587,

                            "Q": "",

                            "Callid": "
txOBq9Lhk1tSVlM9eOTdzA.. at 216.93.246.122",

                            "Cseq": 2,

                            "User-agent": "CounterPath Bria Push Server
2.3.0 (20980)",

                            "Received": "sip:216.93.246.120:5060",

                            "State": "CS_NEW",

                            "Flags": 0,

                            "Cflags": "SIP_PING NAT",

                            "Socket": "udp:64.76.XXX.133:5060",

                            "Methods": 3567,

                            "SIP_instance":
"<urn:uuid:f7a5b4e0-92dd-5227-b355-0467623c49c0>"



Does someone have a clue on this?

Thanks!



*Ricardo Martinez*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20201120/b12ee33c/attachment-0001.html>


More information about the Users mailing list