All, The IETF SIP WG is working on a draft for better support of UACs behind firewalls / NATs (http://www.ietf.org/internet-drafts/draft-ietf-sip-outbound-02.txt). As part of this a mechanism to keep the connection alive and detect failures is required
As a possible solution, some platforms support TCP per-connection keep-alive. For example, on Windows you can use the following code: #include <mstcpip.h> // for tcp_keepalive int val = TRUE; ::setsockopt( s, SOL_SOCKET, SO_DONTLINGER, (const char*) &val, sizeof(val) ); ::setsockopt( s, SOL_SOCKET, SO_KEEPALIVE, (const char*) &val, sizeof(val) ); ::setsockopt( s, IPPROTO_TCP, TCP_NODELAY, (const char*) &val, sizeof(val) ); tcp_keepalive settings; settings.onoff = 1; settings.keepaliveinterval = 1000; // interval of a probe when failed, in ms settings.keepalivetime = 60000; // every X ms, default is 2 hours DWORD nBytes=0; int r = ::WSAIoctl( s, SIO_KEEPALIVE_VALS, &settings, sizeof(settings), NULL, 0, &nBytes, NULL, NULL ); // succeeds, r==0 This will cause the client to send a 1-byte out-of-sequence segment every minute (only when there is no other traffic) Linux seems to offer similar functionality, using 3 non-standard TCP socket options for tweaking the keepalive behavior of individual sockets: TCP_KEEPIDLE, TCP_KEEPCNT, and TCP_KEEPINTVL. The question is: how broadly is this functionality supported on current UAC platforms being used? If implementors could provide some feedback (on this list), it will help to decide whether or not this can be recommended in the standard, and consequently will save YOU (the implementor) time and effort in the long run... (10 lines of code is all it takes, see above) Regards, Jeroen van Bemmel _______________________________________________ Sip-implementors mailing list [email protected] https://lists.cs.columbia.edu/cucslists/listinfo/sip-implementors
