[OpenSIPS-Users] Why does NAT keepalive only work for UDP?

Iñaki Baz Castillo ibc at aliax.net
Wed Nov 12 02:16:55 CET 2008

Hi, I wonder why SIP keepalive method (sending a NOTIFY/OPTIONS perdiodically) 
just works for UDP, this is: why the request is not sent via TCP?

For example: new nat_traversal module is very flexible, allow mantaining the 
NAT open even if the caller is not registered, but the fact is that if the 
client uses TCP (*and it's not registered*), then "nat_keepalive()" method 
does nothing.

We have "tcp_persistent_flag" in registrar module, but this is just valid for 
REGISTER (so what about all the features and flexibility of "nat_traversal" 
module?), and also note that many devices close, by themself, the TCP 
connection after 64*T1 = 32 seconds, even if the server didn't close it.

So again, I wonder why OPTIONS/NOTIFY is not sent via TCP while this would be 
the *unique* way to mantain a TCP connection open when NAT exists.

BTW I would like to know how "tcp_persistent_flag" is supposed to work. I read 
in the documentation:
  "the module, via the “save()” functions will set the lifetime of the TCP
   connection to the contact expire value. By doing this, the TCP connection
   will stay on as long as the contact is valid."

So I understand that the server doesn't close the connection before 
registration expires, but how can the client know it? why would a client 
mantain the TCP connection open until "expires" time? why to expect it?
For example, Twinkle closes the TCP connection by itself after 32 seconds.

PD: I know the PingPong TCP keepalive method, but it has nothing to do with 
the above, and also, it only works for *registered* clients.

Thanks a lot.

Iñaki Baz Castillo

More information about the Users mailing list