Description

Kamailio server has two legs that are connected to different networks.
I'm using Kamailio v.5.2.3 and the "enable_double_rr" is implicitly set to "1".
The leg "A" IP address is 10.28.80.1
The leg "B" IP address is 192.168.9.103
The call is initiated from 10.28.80.47

According to the "rr" module documentation, function record_route()
should insert two "Record_Route" header fields when a request is
accepted on one leg is should go out via the second leg. This works as
expected in case of UDP protocol:

INVITE sip:2601@192.168.0.178:49162;transport=udp SIP/2.0
Record-Route: sip:192.168.9.103;r2=on;lr;did=e2c.a191
Record-Route: sip:10.28.80.1;r2=on;lr;did=e2c.a191
Via: SIP/2.0/UDP 192.168.9.103;branch=z9hG4bKcfa5.d64ecbd87d5315b5993c4ccf16f86537.0
Via: SIP/2.0/UDP 10.28.80.47:5060;rport=5060;branch=z9hG4bK3a9e9a4d

But when the TCP protocol is used AND "listen" parameters are defined:
listen=udp:10.28.80.1:5060
listen=tcp:10.28.80.1:5060
listen=udp:192.168.9.103:5060
listen=tcp:192.168.9.103:5060

then the outbound message looks like this:

INVITE sip:2601@192.168.0.178:48758;transport=tcp SIP/2.0
Record-Route: sip:10.28.80.1;transport=tcp;lr;did=bcd.72f
Via: SIP/2.0/TCP 10.28.80.1;branch=z9hG4bKb9ca.26ea08654c9dbc32bb0dc6e3b6f92d45.0;i=3
Via: SIP/2.0/TCP 10.28.80.47:5060;rport=33976;branch=z9hG4bK5291fab1

There are two problems there:
a) only one Record-Route with leg "A" is inserted
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".

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.

Troubleshooting

Reproduction

Debugging Data

Log Messages

http://updates.xorcom.com/~xorcom/kam-tcp-problem.tar.gz
The archive contains the following files:

SIP Traffic

Possible Solutions

Additional Information

kamailio -v
version: kamailio 5.2.3 (x86_64/linux)
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: unknown
compiled with gcc 7.3.0

*Operating System:

Ubuntu 18.0.4


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.