[sr-dev] [kamailio/kamailio] t_relay() sending packets from the wrong TCP socket (#1532)

Jared Hull notifications at github.com
Wed Jun 20 17:40:04 CEST 2018


Let me rephrase, Kamailio is using the wrong local TCP socket as the source.
It is my understanding that a TCP connection is defined by 4 things: source IP, source port, destination IP, and destination port. A device which has registered to Kamailio over TCP establishes a connection which should be used for all requests from the server. The 'location' table used by the registrar module has a 'socket' column which shows the local socket that the remote device registered to. This is the socket transport:address:port which I would expect Kamailio to use for all INVITEs to the remote device.

The problem we were having was that Kamailio started sending INVITEs from the wrong local socket, then the customer's router couldn't figure out to translate NAT for that socket. This was recreated when the remote device received an INVITE which had a contact header which differed from the sending socket, and caused the device to create a new TCP connection for it's response. For some reason, Kamailio saw this new connection and started sending calls (initial INVITEs in a completely new transaction) to it instead of the actual TCP connection that was used for registration. Another possibly important factor is that the "new" socket created by the remote router for NAT was similar to another device's registration socket. It had the same remote source, so maybe Kamailio matched this with an existing registration for a different device?
Device A: tcp:CustomerIP:10042 -> tcp:KamailioIP:4242
Device B: tcp:CustomerIP:11042 -> tcp:KamailioIP:4242
Device A new connection for a 200 OK response: tcp:CustomerIP:11042 -> tcp:KamailioIP:5062

I am not using any functions which update the registration for the device with this new TCP connection, and interestingly other kinds of packets like NOTIFY in response to a subscription and OPTIONs keep alives continue to use the registration socket. I think it is somehow internal to Kamailio.

-- 
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1532#issuecomment-398796849
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20180620/92db9246/attachment-0001.html>


More information about the sr-dev mailing list