[SR-Users] NatHelper ignoring force_socket module parameter

Asgaroth 00asgaroth00 at gmail.com
Tue Oct 24 11:04:47 CEST 2017


Hi All,

Just to continue on on this particular issue, we are now testing 
kamailio v5.0.3 and I are still experiencing the same issue.

We run 3 registrar servers which run with user location "in-memory" 
(db_mode 0). These registrar's are configured to replicate registrations 
using the dmg_usrloc module. All works well except for when nat pinging 
is enabled.

When nat ping is enabled, it appears that the nathelper sends options 
pings from all 3 servers, and not only the server that processed the 
registration request. I have tried setting the server_id core parameter 
on all three of these servers in an attempt to ensure their uniqness, 
but still, the options pings are being sent from all 3 systems.

What I was expecting to see happen was that the registrar that 
processed/saved the registration, would be the only registrar performing 
the sip options ping, and the remaining two only have a replicated 
"copy" of the registration.

I'm not sure if this is meant to be classified as a bug or a feature 
request, seeing that the feature appears to be available when running 
with an sql database (I've not tested with usloc in database, we require 
usrloc to be in memory). Do I need to log a bug on github for this issue?

I've attached a copy of the aor (usrlock_dump.txt) as dumped by "kamctl 
ul show" on each of the registrars, and also a sip capture where you can 
see the options being sent by 3 registrars, but only 1 being responded to.

I've attached "sip_capture.txt" to show the options messages being sent 
by the 3 registrars.
I've attached "module_settings.txt" to show the settings for the 
usrloc/registrar/nathelper modules in case there is a mishap there.

An additional observation is that when the registrars that did not 
process the registration (the ones replicated to), try to send their 
"ping", they send it over the incorrect interface (ignoring the 
nathelper parameter "force_socket" which has been set for all 3 
registrars). I guess, in this circumstance, this is also a blessing in 
disguise or else the endpoint would have received 3 options pings to 
reply to every ping interval. However, I'm not sure if this is the 
expected bahaviour when setting force_socket for natping module.

Any thoughts/tips would be much appreciated.

Thanks
-------------- next part --------------
# Registrar 1 has core parmeter server_id=1
# Registrar 2 has core parmeter server_id=2
# Registrar 3 has core parmeter server_id=3
#
# REGTIME is defined as 113
# NAT_BLFAG is defined as 6
# Registrar 1 has NAT_PING_SOCKET defined as "10.7.0.183:5060"
# Registrar 2 has NAT_PING_SOCKET defined as "10.7.0.184:5060"
# Registrar 3 has NAT_PING_SOCKET defined as "10.7.0.185:5060"

# 
# ----- registrar params -----
#
modparam("registrar", "method_filtering",  1)
modparam("registrar", "case_sensitive",    1)
modparam("registrar", "append_branches",   0)
modparam("registrar", "use_path",          1)
modparam("registrar", "path_mode",         0)
modparam("registrar", "path_use_received", 1)
modparam("registrar", "path_check_local",  1)
modparam("registrar", "default_expires",   REGTIME)
modparam("registrar", "min_expires",       REGTIME)
modparam("registrar", "max_expires",       REGTIME)
modparam("registrar", "max_contacts",      1)

#
# ----- usrloc params -----
#
modparam("usrloc", "db_mode",              0)
modparam("usrloc", "use_domain",           1)
modparam("usrloc", "timer_interval",       60)
modparam("usrloc", "timer_procs",          4)
modparam("usrloc", "nat_bflag",            NAT_BFLAG)

# 
# ----- nathelper params ----- 
#
#modparam("nathelper", "received_avp",      "$avp(RECEIVED)")
modparam("nathelper", "natping_interval",   20)
modparam("nathelper", "natping_processes",  4)
modparam("nathelper", "ping_nated_only",    0)
modparam("nathelper", "sipping_from",       "sip:keepalive at domain.com")
modparam("nathelper", "sipping_method",     "OPTIONS")
modparam("nathelper", "sipping_bflag",      NAT_BFLAG)
modparam("nathelper", "force_socket", NAT_PING_SOCKET)
-------------- next part --------------
subnet 10.6.0.0/24 admin lan (not used for voip)
subnet 10.7.0.0/24 voip lan (used for voip)

IP of registrar 1: 10.6.0.183/10.7.0.183
IP of registrar 2: 10.6.0.184/10.7.0.184
IP of registrar 3: 10.6.0.185/10.7.0.185


#
# Ping from registrar3 (did not process the registration)
# Also sending message over incorrect interface ignoring force_socket parameter of nathelper.
#
U 2017/10/24 08:30:34.075074 10.6.0.185:5060 -> 10.7.0.80:5062

OPTIONS sip:QYqWUnDJhxDJttkvUsJz at 194.213.29.1:57360;rinstance=868b1645ead0e835;transport=UDP SIP/2.0.
Via: SIP/2.0/UDP 10.6.0.185:5060;branch=z9hG4bK2759558.
Route: <sip:10.7.0.80:5062;lr;received=sip:194.213.29.1:57360>.
From: sip:keepalive at domain.com;tag=uloc-2-59eafc13-518-5b-ed34fbdb-161bf6e3.
To: sip:QYqWUnDJhxDJttkvUsJz at 194.213.29.1:57360;rinstance=868b1645ead0e835;transport=UDP.
Call-ID: ba11235-4790b2e5-3a266c4 at 10.6.0.185.
CSeq: 1 OPTIONS.
Content-Length: 0.
.


#
# Ping from registrar1 (did not process the registration)
# Also sending message over incorrect interface ignoring force_socket parameter of nathelper.
#
U 2017/10/24 08:30:34.582416 10.6.0.183:5060 -> 10.7.0.80:5062

OPTIONS sip:QYqWUnDJhxDJttkvUsJz at 194.213.29.1:57360;rinstance=868b1645ead0e835;transport=UDP SIP/2.0.
Via: SIP/2.0/UDP 10.6.0.183:5060;branch=z9hG4bK8244078.
Route: <sip:10.7.0.80:5062;lr;received=sip:194.213.29.1:57360>.
From: sip:keepalive at domain.com;tag=uloc-2-59eafc13-518-5b-ed34fbdb-430c24e4.
To: sip:QYqWUnDJhxDJttkvUsJz at 194.213.29.1:57360;rinstance=868b1645ead0e835;transport=UDP.
Call-ID: 9baec3c3-db68fb62-38f6df2 at 10.6.0.183.
CSeq: 1 OPTIONS.
Content-Length: 0.
.

#
# Ping from registrar2 (this one processed the registration)
#
U 2017/10/24 08:30:44.575431 10.7.0.184:5060 -> 10.7.0.80:5062

OPTIONS sip:QYqWUnDJhxDJttkvUsJz at 194.213.29.1:57360;rinstance=868b1645ead0e835;transport=UDP SIP/2.0.
Via: SIP/2.0/UDP 10.7.0.184:5060;branch=z9hG4bK5442522.
Route: <sip:10.7.0.80:5062;lr;received=sip:194.213.29.1:57360>.
From: sip:keepalive at domain.com;tag=uloc-2-59eafc13-518-5b-ed34fbdb-941ff002.
To: sip:QYqWUnDJhxDJttkvUsJz at 194.213.29.1:57360;rinstance=868b1645ead0e835;transport=UDP.
Call-ID: 72ea0177-d9e5d612-f68b4f4 at 10.7.0.184.
CSeq: 1 OPTIONS.
Content-Length: 0.
.


U 2017/10/24 08:30:44.576552 194.213.29.80:5062 -> 194.213.29.1:57360

OPTIONS sip:QYqWUnDJhxDJttkvUsJz at 194.213.29.1:57360;rinstance=868b1645ead0e835;transport=UDP SIP/2.0.
Max-Forwards: 10.
Record-Route: <sip:194.213.29.80:5062;r2=on;lr;ftag=uloc-2-59eafc13-518-5b-ed34fbdb-941ff002>.
Record-Route: <sip:10.7.0.80:5062;r2=on;lr;ftag=uloc-2-59eafc13-518-5b-ed34fbdb-941ff002>.
Via: SIP/2.0/UDP 194.213.29.80:5062;branch=z9hG4bKc7a8.166d2735b5ea7d8bb297dc1f3b0e3900.0.
Via: SIP/2.0/UDP 10.7.0.184:5060;rport=5060;branch=z9hG4bK5442522.
From: sip:keepalive at domain.com;tag=uloc-2-59eafc13-518-5b-ed34fbdb-941ff002.
To: sip:QYqWUnDJhxDJttkvUsJz at 194.213.29.1:57360;rinstance=868b1645ead0e835;transport=UDP.
Call-ID: 72ea0177-d9e5d612-f68b4f4 at 10.7.0.184.
CSeq: 1 OPTIONS.
Content-Length: 0.
.


U 2017/10/24 08:30:44.582088 194.213.29.1:57360 -> 194.213.29.80:5062

SIP/2.0 200 OK.
Via: SIP/2.0/UDP 194.213.29.80:5062;branch=z9hG4bKc7a8.166d2735b5ea7d8bb297dc1f3b0e3900.0.
Via: SIP/2.0/UDP 10.7.0.184:5060;rport=5060;branch=z9hG4bK5442522.
Record-Route: <sip:194.213.29.80:5062;r2=on;lr;ftag=uloc-2-59eafc13-518-5b-ed34fbdb-941ff002>.
Record-Route: <sip:10.7.0.80:5062;r2=on;lr;ftag=uloc-2-59eafc13-518-5b-ed34fbdb-941ff002>.
Contact: <sip:194.213.29.1:57360>.
To: <sip:QYqWUnDJhxDJttkvUsJz at 194.213.29.1:57360;rinstance=868b1645ead0e835;transport=UDP>;tag=9d7b572b.
From: sip:keepalive at domain.com;tag=uloc-2-59eafc13-518-5b-ed34fbdb-941ff002.
Call-ID: 72ea0177-d9e5d612-f68b4f4 at 10.7.0.184.
CSeq: 1 OPTIONS.
Accept: application/sdp, application/sdp.
Accept-Language: en.
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE.
Supported: replaces, norefersub, extended-refer, timer, outbound, path, X-cisco-serviceuri.
User-Agent: Z 3.15.40006 rv2.8.20.
Allow-Events: presence, kpml, talk.
Content-Length: 0.
.


U 2017/10/24 08:30:44.582442 10.7.0.80:5062 -> 10.7.0.184:5060

SIP/2.0 200 OK.
Via: SIP/2.0/UDP 10.7.0.184:5060;rport=5060;branch=z9hG4bK5442522.
Record-Route: <sip:194.213.29.80:5062;r2=on;lr;ftag=uloc-2-59eafc13-518-5b-ed34fbdb-941ff002>.
Record-Route: <sip:10.7.0.80:5062;r2=on;lr;ftag=uloc-2-59eafc13-518-5b-ed34fbdb-941ff002>.
Contact: <sip:194.213.29.1:57360>.
To: <sip:QYqWUnDJhxDJttkvUsJz at 194.213.29.1:57360;rinstance=868b1645ead0e835;transport=UDP>;tag=9d7b572b.
From: sip:keepalive at domain.com;tag=uloc-2-59eafc13-518-5b-ed34fbdb-941ff002.
Call-ID: 72ea0177-d9e5d612-f68b4f4 at 10.7.0.184.
CSeq: 1 OPTIONS.
Accept: application/sdp, application/sdp.
Accept-Language: en.
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE.
Supported: replaces, norefersub, extended-refer, timer, outbound, path, X-cisco-serviceuri.
User-Agent: Z 3.15.40006 rv2.8.20.
Allow-Events: presence, kpml, talk.
Content-Length: 0.
.
-------------- next part --------------
#
# usrloc dump from registrar 1 (Socket not set)
#

{
  "jsonrpc":  "2.0",
  "result": {
    "Domain": "location",
    "Size": 1024,
    "AoRs": [{
        "Info": {
          "AoR":  "QYqWUnDJhxDJttkvUsJz at domain.com",
          "HashID": -1111538722,
          "Contacts": [{
              "Contact":  {
                "Address":  "sip:QYqWUnDJhxDJttkvUsJz at 194.213.29.1:57360;rinstance=868b1645ead0e835;transport=UDP",
                "Expires":  91,
                "Q":  -1,
                "Call-ID":  "EpH_EjJfbxhmbAznle32dw..",
                "CSeq": 3,
                "User-Agent": "Z 3.15.40006 rv2.8.20",
                "Received": "sip:194.213.29.1:57360",
                "Path": "<sip:10.7.0.80:5062;lr;received=sip:194.213.29.1:57360>",
                "State":  "CS_NEW",
                "Flags":  2,
                "CFlags": 64,
                "Socket": "[not set]",
                "Methods":  -1,
                "Ruid": "uloc-2-59eafc13-518-5b",
                "Instance": "[not set]",
                "Reg-Id": 0,
                "Last-Keepalive": 1508830258,
                "Last-Modified":  1508830258
              }
            }]
        }
      }
  ],
    "Stats":  {
      "Records":  1,
      "Max-Slots":  1
    }
  },
  "id": 3664
}

#
# usrloc dump from registrar 2 (Socket is set)
#

{
  "jsonrpc":  "2.0",
  "result": {
    "Domain": "location",
    "Size": 1024,
    "AoRs": [{
        "Info": {
          "AoR":  "QYqWUnDJhxDJttkvUsJz at domain.com",
          "HashID": -1111538722,
          "Contacts": [{
              "Contact":  {
                "Address":  "sip:QYqWUnDJhxDJttkvUsJz at 194.213.29.1:57360;rinstance=868b1645ead0e835;transport=UDP",
                "Expires":  89,
                "Q":  -1,
                "Call-ID":  "EpH_EjJfbxhmbAznle32dw..",
                "CSeq": 3,
                "User-Agent": "Z 3.15.40006 rv2.8.20",
                "Received": "sip:194.213.29.1:57360",
                "Path": "<sip:10.7.0.80:5062;lr;received=sip:194.213.29.1:57360>",
                "State":  "CS_NEW",
                "Flags":  0,
                "CFlags": 64,
                "Socket": "udp:10.7.0.184:5060",
                "Methods":  -1,
                "Ruid": "uloc-2-59eafc13-518-5b",
                "Instance": "[not set]",
                "Reg-Id": 0,
                "Last-Keepalive": 1508830258,
                "Last-Modified":  1508830258
              }
            }]
        }
      }
  ],
    "Stats":  {
      "Records":  1,
      "Max-Slots":  1
    }
  },
  "id": 3780
}

#
# usrloc dump from registrar 3 (Socket not set)
#

{
  "jsonrpc":  "2.0",
  "result": {
    "Domain": "location",
    "Size": 1024,
    "AoRs": [{
        "Info": {
          "AoR":  "QYqWUnDJhxDJttkvUsJz at domain.com",
          "HashID": -1111538722,
          "Contacts": [{
              "Contact":  {
                "Address":  "sip:QYqWUnDJhxDJttkvUsJz at 194.213.29.1:57360;rinstance=868b1645ead0e835;transport=UDP",
                "Expires":  87,
                "Q":  -1,
                "Call-ID":  "EpH_EjJfbxhmbAznle32dw..",
                "CSeq": 3,
                "User-Agent": "Z 3.15.40006 rv2.8.20",
                "Received": "sip:194.213.29.1:57360",
                "Path": "<sip:10.7.0.80:5062;lr;received=sip:194.213.29.1:57360>",
                "State":  "CS_NEW",
                "Flags":  2,
                "CFlags": 64,
                "Socket": "[not set]",
                "Methods":  -1,
                "Ruid": "uloc-2-59eafc13-518-5b",
                "Instance": "[not set]",
                "Reg-Id": 0,
                "Last-Keepalive": 1508830258,
                "Last-Modified":  1508830258
              }
            }]
        }
      }
  ],
    "Stats":  {
      "Records":  1,
      "Max-Slots":  1
    }
  },
  "id": 3053
}


More information about the sr-users mailing list