<h3>Description</h3>
<p>Kamailio server has two legs that are connected to different networks.<br>
I'm using Kamailio v.5.2.3 and the "enable_double_rr" is implicitly set to "1".<br>
The leg "A" IP address is 10.28.80.1<br>
The leg "B" IP address is 192.168.9.103<br>
The call is initiated from 10.28.80.47</p>
<p>According to the "rr" module documentation, function record_route()<br>
should insert two "Record_Route" header fields when a request is<br>
accepted on one leg is should go out via the second leg. This works as<br>
expected in case of UDP protocol:</p>
<p>INVITE sip:2601@192.168.0.178:49162;transport=udp SIP/2.0<br>
Record-Route: sip:192.168.9.103;r2=on;lr;did=e2c.a191<br>
Record-Route: sip:10.28.80.1;r2=on;lr;did=e2c.a191<br>
Via: SIP/2.0/UDP 192.168.9.103;branch=z9hG4bKcfa5.d64ecbd87d5315b5993c4ccf16f86537.0<br>
Via: SIP/2.0/UDP 10.28.80.47:5060;rport=5060;branch=z9hG4bK3a9e9a4d</p>
<p>But when the TCP protocol is used AND "listen" parameters are defined:<br>
listen=udp:10.28.80.1:5060<br>
listen=tcp:10.28.80.1:5060<br>
listen=udp:192.168.9.103:5060<br>
listen=tcp:192.168.9.103:5060</p>
<p>then the outbound message looks like this:</p>
<p>INVITE sip:2601@192.168.0.178:48758;transport=tcp SIP/2.0<br>
Record-Route: sip:10.28.80.1;transport=tcp;lr;did=bcd.72f<br>
Via: SIP/2.0/TCP 10.28.80.1;branch=z9hG4bKb9ca.26ea08654c9dbc32bb0dc6e3b6f92d45.0;i=3<br>
Via: SIP/2.0/TCP 10.28.80.47:5060;rport=33976;branch=z9hG4bK5291fab1</p>
<p>There are two problems there:<br>
a) only one Record-Route with leg "A" is inserted<br>
b) the added "Via" header field contains the leg "A" IP address instead of expected leg "B" IP address (192.168.9.103). In the LAN trace, I see that in reality the message was sent from leg "B".</p>
<p>IMPORTANT: The problem occurs only when the "listen" parameters are defined in the Kamailio configuration. When the "listens" are not configured then everything works correctly.</p>
<h3>Troubleshooting</h3>
<h4>Reproduction</h4>
<h4>Debugging Data</h4>
<h4>Log Messages</h4>
<p><a href="http://updates.xorcom.com/~xorcom/kam-tcp-problem.tar.gz" rel="nofollow">http://updates.xorcom.com/~xorcom/kam-tcp-problem.tar.gz</a><br>
The archive contains the following files:</p>
<ul>
<li>syslog-bad.log and bad.cap - Kamailio log and tcpdump trace of a call when the problem occurs</li>
<li>syslog-good.log and good.cap - Kamailio log and tcpdump trace of a call when the problem doesn't occur</li>
</ul>
<h4>SIP Traffic</h4>
<h3>Possible Solutions</h3>
<h3>Additional Information</h3>
<p>kamailio -v<br>
version: kamailio 5.2.3 (x86_64/linux)<br>
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<br>
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144 MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB<br>
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.<br>
id: unknown<br>
compiled with gcc 7.3.0</p>
<p>*<strong>Operating System</strong>:</p>
<p>Ubuntu 18.0.4</p>

<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/2033?email_source=notifications&email_token=ABO7UZMWZX67MKF7OFU2FDLQEUE5NA5CNFSM4IL4AQRKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HFMDIVQ">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZJ72EF5JJVFW7VSXOTQEUE5NANCNFSM4IL4AQRA">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABO7UZKX2KBYLGJK3IBRXR3QEUE5NA5CNFSM4IL4AQRKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HFMDIVQ.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/2033?email_source=notifications\u0026email_token=ABO7UZMWZX67MKF7OFU2FDLQEUE5NA5CNFSM4IL4AQRKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HFMDIVQ",
"url": "https://github.com/kamailio/kamailio/issues/2033?email_source=notifications\u0026email_token=ABO7UZMWZX67MKF7OFU2FDLQEUE5NA5CNFSM4IL4AQRKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HFMDIVQ",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>