Hi,
for a start - did you already tried this parameter:http://www.kamailio.org/wiki/cookbooks/5.5.x/core#tcp_reuse_port
Then have a look for example to this discussion:https://lists.kamailio.org/pipermail/sr-users/2019-November/107222.html
Thanks for the pointers. Got it to work.
For the record, what I did:
* add "name sock_tls" to the listen= parameter
* set tcp_reuse_port=yes
* the handler for OPTIONS saves the remote port to $shv(port__XXX)
* my call handler sets $fsn="sock_tls" and $rp to $shv(port__XXX)
… and that's it. So that was easier than expected.
NB, when browsing the sources for this I noticed that the "tcp_reuse_port" option is not recognized at all if the OS does not support SO_REUSEPORT.
However, here we're re-using an existing connection instead of opening a new connection from a port that has existing connections. Thus on systems that don't have SO_REUSEPORT (some BSDs, AFAIK) this method doesn't work (but should).
This mismatch is also the reason why I didn't notice this option in the documentation …