<h3>Description</h3>
<p>When using the PATH header option to keep track of original Kamailio node that received the REGISTER, if nathelper is also used with SIP ping enabled, the SIP OPTIONS is sent to itself following the PATH header and not sent directly to the destination.<br>
The nathelper/user location modules should have a flag similar to the "path_check_local" of the registrar module, which is meant to avoid looping the message to itself in case the next hop pointed by the PATH header is "myself".</p>

<h3>Troubleshooting</h3>
<h4>Reproduction</h4>
<p>Configure the registrar module to support PATH and before saving the contact info add the PATH header with the local Kamailio information. Also make sure to have the nathelper and usrloc modules configured to send the keepalive SIP OPTIONS to the registered extensions.<br>
By the time the SIP OPTIONS is sent, Kamailio sends to itself, then the message has to be loose_route'd to the final destination.<br>
This could be avoided by having the nathelper module to identify the next hop is Kamailio itself skipping this destination as a call to "lookup()" does for the registrar module when the flag path_check_local is true.</p>

<h4>SIP Traffic</h4>

<p>172.128.128.10 is the Kamailio IP and 172.128.128.20 is the extension IP</p>
<pre><code>11:51:07.224713 IP (tos 0x60, ttl 64, id 64497, offset 0, flags [none], proto UDP (17), length 518)
    172.128.128.10.5060 > 172.128.128.10.5060: SIP, length: 490
        OPTIONS sip:345671002@172.128.128.20:5060;rinstance=d1eb3444a5cec5a1;transport=UDP SIP/2.0
        Via: SIP/2.0/UDP 172.128.128.10:5060;branch=z9hG4bK2540713
        Route: <sip:172.128.128.10:5060;received=sip:172.128.128.20:5060;lr;cluster_node=192.168.156.10:5060>
        From: sip:sbc@mydomain.com;tag=uloc-5d2e6499-2fb5-1-0-c15309d2
        To: sip:345671002@172.128.128.20:5060;rinstance=d1eb3444a5cec5a1;transport=UDP
        Call-ID: 40ee1573-7506bba3-5e30c05@172.128.128.10
        CSeq: 1 OPTIONS
        Content-Length: 0
        
        
11:51:07.226132 IP (tos 0x60, ttl 64, id 44359, offset 0, flags [none], proto UDP (17), length 502)
    172.128.128.10.5060 > 172.128.128.20.5060: SIP, length: 474
        OPTIONS sip:345671002@172.128.128.20:5060;rinstance=d1eb3444a5cec5a1;transport=UDP SIP/2.0
        Via: SIP/2.0/UDP 172.128.128.10;branch=z9hG4bKb958.b807e80b742db62504a45220d8f0e974.0
        Via: SIP/2.0/UDP 172.128.128.10:5060;branch=z9hG4bK2540713
        From: sip:sbc@mydomain.com;tag=uloc-5d2e6499-2fb5-1-0-c15309d2
        To: sip:345671002@172.128.128.20:5060;rinstance=d1eb3444a5cec5a1;transport=UDP
        Call-ID: 40ee1573-7506bba3-5e30c05@172.128.128.10
        CSeq: 1 OPTIONS
        Content-Length: 0
        
        
11:51:07.303474 IP (tos 0x0, ttl 128, id 10816, offset 0, flags [none], proto UDP (17), length 786)
    172.128.128.20.5060 > 172.128.128.10.5060: SIP, length: 758
        SIP/2.0 200 OK
        Via: SIP/2.0/UDP 172.128.128.10;branch=z9hG4bKb958.b807e80b742db62504a45220d8f0e974.0
        Via: SIP/2.0/UDP 172.128.128.10:5060;branch=z9hG4bK2540713
        Contact: <sip:172.128.128.20:5060>
        To: <sip:345671002@172.128.128.20:5060;rinstance=d1eb3444a5cec5a1;transport=UDP>;tag=bb0c1f2d
        From: sip:sbc@mydomain.com;tag=uloc-5d2e6499-2fb5-1-0-c15309d2
        Call-ID: 40ee1573-7506bba3-5e30c05@172.128.128.10
        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
        
        
11:51:07.306821 IP (tos 0x60, ttl 64, id 64570, offset 0, flags [none], proto UDP (17), length 727)
    172.128.128.10.5060 > 172.128.128.10.5060: SIP, length: 699
        SIP/2.0 200 OK
        Via: SIP/2.0/UDP 172.128.128.10:5060;branch=z9hG4bK2540713
        Contact: <sip:172.128.128.20:5060;alias=172.128.128.20~5060~1>
        To: <sip:345671002@172.128.128.20:5060;rinstance=d1eb3444a5cec5a1;transport=UDP>;tag=bb0c1f2d
        From: sip:sbc@mydomain.com;tag=uloc-5d2e6499-2fb5-1-0-c15309d2
        Call-ID: 40ee1573-7506bba3-5e30c05@172.128.128.10
        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
</code></pre>
<h3>Possible Solutions</h3>

<p>Not found.</p>
<h3>Additional Information</h3>
<ul>
<li><strong>Kamailio Version</strong> - output of <code>kamailio -v</code></li>
</ul>
<pre><code># kamailio -v
version: kamailio 5.2.2 (x86_64/linux) 67f967
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144 MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: 67f967 
compiled on 11:40:41 Mar 11 2019 with gcc 4.8.5
</code></pre>
<ul>
<li><strong>Operating System</strong>:</li>
</ul>

<pre><code># uname -a
Linux kamailio-1 3.10.0-514.21.2.el7.x86_64 #1 SMP Tue Jun 20 12:24:47 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/2011?email_source=notifications&email_token=ABO7UZPZJDUBLEMJFU7JEKTP72ND5A5CNFSM4IELLGRKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G7UBKJQ">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZPRDDJEJWNIBIQZZYDP72ND5ANCNFSM4IELLGRA">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABO7UZO3FEIDDSM6XB6CHKLP72ND5A5CNFSM4IELLGRKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G7UBKJQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/2011?email_source=notifications\u0026email_token=ABO7UZPZJDUBLEMJFU7JEKTP72ND5A5CNFSM4IELLGRKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G7UBKJQ",
"url": "https://github.com/kamailio/kamailio/issues/2011?email_source=notifications\u0026email_token=ABO7UZPZJDUBLEMJFU7JEKTP72ND5A5CNFSM4IELLGRKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G7UBKJQ",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>