<p></p>
<h3>Description</h3>
<p>Kamailio has two IP interfaces: one (192.168.0.206) towards the Internet-based endpoints and the second (10.197.184.1) - toward my internal SIP servers.<br>
I am trying to disable the topology hiding when the messages are sent to my internal SIP servers.<br>
In order to achieve this, I added the special event_route block:</p>
<pre><code>event_route[topoh:msg-outgoing] {
     if ($sndfrom(ip) == "10.197.184.1" ) {
        drop;
     }
}
</code></pre>
<p>The problem is that the topoh module generates ERROR when trying to parse the response for the "dropped" request:</p>
<pre><code>Aug 11 09:32:57 weyl kamailio[31439]: 19(31536) DEBUG: topoh [th_msg.c:401]: th_unmask_via(): =======via[1]
Aug 11 09:32:57 weyl kamailio[31439]: 19(31536) DEBUG: topoh [th_msg.c:402]: th_unmask_via(): hdr: [Via]
Aug 11 09:32:57 weyl kamailio[31439]: 19(31536) DEBUG: topoh [th_msg.c:404]: th_unmask_via(): body: 100: [SIP/2.0/UDP 10.197.184.1;branch=z9hG4bK3fe4.fc634d55237786cb052f1c0d4fd7d949.0;received=10.197.184.1]
Aug 11 09:32:57 weyl kamailio[31439]: 19(31536) DEBUG: topoh [th_msg.c:401]: th_unmask_via(): =======via[2]
Aug 11 09:32:57 weyl kamailio[31439]: 19(31536) DEBUG: topoh [th_msg.c:402]: th_unmask_via(): hdr: [Via]
Aug 11 09:32:57 weyl kamailio[31439]: 19(31536) DEBUG: topoh [th_msg.c:404]: th_unmask_via(): body: 96: [SIP/2.0/UDP 192.168.6.108:5260;received=192.168.6.108;TH=div;rport=5260;branch=z9hG4bK2821386093]
Aug 11 09:32:57 weyl kamailio[31439]: 19(31536) DEBUG: topoh [th_msg.c:438]: th_unmask_via(): +body: 5: [DÏã#Ã]
Aug 11 09:32:57 weyl kamailio[31439]: 19(31536) ERROR: <core> [core/parser/parse_via.c:1808]: parse_via(): bad char <D> on state 100
Aug 11 09:32:57 weyl kamailio[31439]: 19(31536) ERROR: <core> [core/parser/parse_via.c:2704]: parse_via(): parsing via on: <DÏã#Ã
Aug 11 09:32:57 weyl kamailio[31439]: X>
Aug 11 09:32:57 weyl kamailio[31439]: 19(31536) ERROR: <core> [core/parser/parse_via.c:2710]: parse_via(): via parse error
Aug 11 09:32:57 weyl kamailio[31439]: 19(31536) ERROR: topoh [th_msg.c:464]: th_unmask_via(): cannot find cookie in via2
Aug 11 09:32:57 weyl kamailio[31439]: 19(31536) DEBUG: topoh [th_msg.c:597]: th_flip_record_route(): no record route header
Aug 11 09:32:57 weyl kamailio[31439]: 19(31536) DEBUG: topoh [topoh_mod.c:389]: th_msg_received(): adding cookie: uc
Aug 11 09:32:57 weyl kamailio[31439]: 19(31536) DEBUG: topoh [th_msg.c:1034]: th_add_hdr_cookie(): added cookie header [TH: uch
Aug 11 09:32:57 weyl kamailio[31439]: ]
</code></pre>
<p>This problem was also<br>
<a href="https://github.com/kamailio/kamailio/files/5056198/topoh-error-logs.tar.gz">topoh-error-logs.tar.gz</a><br>
discussed here: <a href="https://lists.kamailio.org/pipermail/sr-users/2019-February/104730.html" rel="nofollow">https://lists.kamailio.org/pipermail/sr-users/2019-February/104730.html</a>.</p>
<h3>Troubleshooting</h3>
<h4>Reproduction</h4>

<h4>Debugging Data</h4>
<p><a href="https://github.com/kamailio/kamailio/files/5056184/topoh-error-logs.tar.gz">topoh-error-logs.tar.gz</a></p>
<pre><code>(paste your debugging data here)
</code></pre>
<h4>Log Messages</h4>
<p>ref. the attached file</p>
<pre><code>(paste your log messages here)
</code></pre>
<h4>SIP Traffic</h4>
<p>Ref. the attached file. A relevant SIP messages trace excerpt is here:</p>
<pre><code>====================
tag: rcv
pid: 31533
process: 16
time: 1597138377.884735
date: Tue Aug 11 09:32:57 2020
proto: udp ipv4
srcip: 192.168.6.108
srcport: 5260
dstip: 192.168.0.206
dstport: 5060
~~~~~~~~~~~~~~~~~~~~
INVITE sip:9992003@leotst.weyl.in.xorcom.com:5060 SIP/2.0^M
Via: SIP/2.0/UDP 192.168.6.108:5260;rport;branch=z9hG4bK2821386093^M
From: "9000" <sip:2001@leotst.weyl.in.xorcom.com>;tag=399dbddb56237da^M
To: <sip:9992003@leotst.weyl.in.xorcom.com:5060>^M
Call-ID: 9d993e292700d20@192.168.6.108^M
CSeq: 20 INVITE^M
Contact: <sip:2001@192.168.6.108:5260;transport=UDP>^M
Max-Forwards: 70^M
User-Agent: Htek UC903 V2.0.4.6.15 001fc11cc555^M
Supported: replaces^M
Subject: SIP Call^M
Expires: 120^M
Allow: INVITE, ACK, UPDATE, INFO, CANCEL, BYE, OPTIONS, REFER, SUBSCRIBE, NOTIFY, MESSAGE, PRACK^M
Content-Type: application/sdp^M
Content-Length: 236^M
^M
v=0^M
o=- 887 886 IN IP4 192.168.6.108^M
s=SIP Call^M
c=IN IP4 192.168.6.108^M
t=0 0^M
m=audio 12100 RTP/AVP 0 8 101^M
a=rtpmap:0 PCMU/8000^M
a=ptime:20^M
a=rtpmap:8 PCMA/8000^M
a=rtpmap:101 telephone-event/8000^M
a=fmtp:101 0-11,16^M
a=sendrecv^M
..........................
====================
tag: snd
pid: 31533
process: 16
time: 1597138377.929560
date: Tue Aug 11 09:32:57 2020
proto: udp ipv4
srcip: 10.197.184.1
srcport: 5060
dstip: 10.197.184.108
dstport: 5060
~~~~~~~~~~~~~~~~~~~~
INVITE sip:9992003@leotst.weyl.in.xorcom.com:5060 SIP/2.0^M
Record-Route: <sip:10.197.184.1;r2=on;lr;did=67a.f1e1>^M
Record-Route: <sip:192.168.0.206;r2=on;lr;did=67a.f1e1>^M
Via: SIP/2.0/UDP 10.197.184.1;branch=z9hG4bK3fe4.fc634d55237786cb052f1c0d4fd7d949.0^M
Via: SIP/2.0/UDP 192.168.6.108:5260;received=192.168.6.108;TH=div;rport=5260;branch=z9hG4bK2821386093^M
From: "9000" <sip:2001@leotst.weyl.in.xorcom.com>;tag=399dbddb56237da^M
To: <sip:9992003@leotst.weyl.in.xorcom.com:5060>^M
Call-ID: 9d993e292700d20@192.168.6.108^M
CSeq: 20 INVITE^M
Contact: <sip:2001@192.168.6.108:5260;transport=UDP;alias=192.168.6.108~5260~1>^M
Max-Forwards: 69^M
User-Agent: Htek UC903 V2.0.4.6.15 001fc11cc555^M
Supported: replaces^M
Subject: SIP Call^M
Expires: 120^M
Allow: INVITE, ACK, UPDATE, INFO, CANCEL, BYE, OPTIONS, REFER, SUBSCRIBE, NOTIFY, MESSAGE, PRACK^M
Content-Type: application/sdp^M
Content-Length: 252^M
TH: dih^M
X-cpbxmt-srcip: 192.168.6.108^M
^M
v=0^M
o=- 887 886 IN IP4 10.197.184.1^M
s=SIP Call^M
c=IN IP4 10.197.184.1^M
t=0 0^M
m=audio 11554 RTP/AVP 0 8 101^M
a=rtpmap:0 PCMU/8000^M
a=ptime:20^M
a=rtpmap:8 PCMA/8000^M
a=rtpmap:101 telephone-event/8000^M
a=fmtp:101 0-11,16^M
a=sendrecv^M
a=nortpproxy:yes^M
||||||||||||||||||||
====================
||||||||||||||||||||
====================
tag: rcv
pid: 31536
process: 19
time: 1597138377.930085
date: Tue Aug 11 09:32:57 2020
proto: udp ipv4
srcip: 10.197.184.108
srcport: 5060
dstip: 10.197.184.1
dstport: 5060
~~~~~~~~~~~~~~~~~~~~
SIP/2.0 401 Unauthorized^M
Via: SIP/2.0/UDP 10.197.184.1;branch=z9hG4bK3fe4.fc634d55237786cb052f1c0d4fd7d949.0;received=10.197.184.1^M
Via: SIP/2.0/UDP 192.168.6.108:5260;received=192.168.6.108;TH=div;rport=5260;branch=z9hG4bK2821386093^M
From: "9000" <sip:2001@leotst.weyl.in.xorcom.com>;tag=399dbddb56237da^M
To: <sip:9992003@leotst.weyl.in.xorcom.com:5060>;tag=as36995166^M
Call-ID: 9d993e292700d20@192.168.6.108^M
CSeq: 20 INVITE^M
Server: GHJ-5.1.10^M
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE^M
Supported: replaces, timer^M
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="34e38346"^M
Content-Length: 0^M

</code></pre>
<h3>Possible Solutions</h3>

<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.4.0 (x86_64/linux) 
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, 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, TLS_PTHREAD_MUTEX_SHARED
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: unknown 
compiled with gcc 7.5.0

</code></pre>
<ul>
<li><strong>Operating System</strong>:</li>
</ul>
<pre><code>Ubuntu 18.04
</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/2437">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZN2YILQ65P4VNTNLJ3SAEIQ3ANCNFSM4P23LUAA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZJJ3RZIJ22KFNSYPG3SAEIQ3A5CNFSM4P23LUAKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4KCWH56A.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/2437",
"url": "https://github.com/kamailio/kamailio/issues/2437",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>