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

Klaus Darilion klaus.mailinglists at pernau.at
Wed Nov 12 10:44:06 CET 2008



Iñaki Baz Castillo schrieb:
> 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?

Because it is the only way the receive messages if the client is behind 
NAT. Have you ever called a hotline? Never hang up because they wont 
call you back - the same with SIP. If you are behind NAT there is no way 
for the server to make a TCP connection to the client. So, if the client 
is behind NAT and tears down the TCP connection it is a damn stupid client.

> For example, Twinkle closes the TCP connection by itself after 32 seconds.

Report it.

regards
klaus





More information about the Users mailing list