[sr-dev] New module proposal: TCP keepalive

Camille Oudot camille.oudot at orange.com
Wed Feb 4 18:50:17 CET 2015


Hi,

I'm currently working on a new module, that allows setting the TCP
keepalive options by socket, on demand, through the kamailio cfg:

https://github.com/kamailio/kamailio/tree/coudot/tcp_keepalive/modules/tcp_keepalive

This allows turning this mechanism on only when needed during the
whole lifetime of a SIP/TCP connection. In our case, this would be only
during a media session, to efficiently detect a disconnection (clients
are smartphones on mobile network). Then, disabling keepalive when the
session ends allows to save on network traffic, and battery for the
client.

Setting the options on the socket is straightforward when the TCP
worker owns the file descriptor, but it's more tricky when it does not.
In the latter case, I've been re-using the core functions from
pass_fd.c.

Are the functions from pass_fd safe to use from modules? Apart from
close()ing the fd after setting the sock options, is there anything to
take care of in term of resource locking or releasing?

Any feedback is appreciated.

Cheers,

-- 
Camille



More information about the sr-dev mailing list