[SR-Users] TCP Persistent Connections

Ross McKillop ross at rsmck.co.uk
Wed Nov 10 16:34:50 CET 2021

Hopefully the collective hive mind can help with this one, as I have little experience of using TCP in this manner and neither does a friendly Kamailio expert I know personally. 

I'm replacing a closed box thing that accepts connections from various nodes over TCP. They send INVITEs and REGISTERs over that TCP socket and expect to receive inbound calls over the same established TCP socket. 

Struggling to make Kamailio behave the same way, but it should be possible. 

The first time it receives a message, I add the sender to the dispatcher as follows;

jsonrpc_exec('{"jsonrpc": "2.0", "method": "dispatcher.add", "params": [5, "sip:$si:$sp;transport=tcp", 0, "socket=tcp:"], "id": 1}');

This works great, but despite setting the socket to use there, when a call later comes in and it's routed to one of the dispatcher nodes that's been added in this way it fails because Kamailio attempts to open a new connection to the IP / PORT rather than having kept the socket open from the earlier message and reusing the same connection/.

Any ideas? I get the feeling I'm missing something obvious! 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20211110/2c9ca95f/attachment.htm>

More information about the sr-users mailing list