[asterisk-dev] Asterisk / pjsip: Bug or feature? TCP/TLS connection is endless after unregistering the last trunk to the destination

Michael Maier m1278468 at mailbox.org
Fri Jan 8 23:37:45 CST 2021


Hello!

I'm not sure if the following finding is a bug or a feature. Given is a trunk to a registered destination:


virtast*CLI> pjsip show registrations

  <Registration/ServerURI..............................>  <Auth..........>  <Status.......>
==========================================================================================

  easybellPJSIP/sip:secure.sip.easybell.de                easybellPJSIP     Registered

Objects found: 1


The related connection:
# netstat -n | grep 5061
tcp        0      0 192.168.122.174:58709   212.172.58.207:5061     ESTABLISHED

=> That's expected.


Now doing an unregister

pjsip send unregister *all

gives:

virtast*CLI> pjsip show registrations

  <Registration/ServerURI..............................>  <Auth..........>  <Status.......>
==========================================================================================

  easybellPJSIP/sip:secure.sip.easybell.de                easybellPJSIP     Unregistered

Objects found: 1

So far so good.


But (even after hours - pjsip sends per default tcp/tls keep alives each 90 s):
# netstat -n | grep 5061
tcp        0      0 192.168.122.174:58709   212.172.58.207:5061     ESTABLISHED

=> That's not what I expect.

Shouldn't the connection been closed after the last trunk to a destination has been closed (there could be more than one numbers / trunks use the same destination / connection - 
therefore this would have to be checked before).

What could be the use case to hold the connection forever even if it is unused?


This behavior can be found with Asterisk 18.x (not tested with 16.x).


Thanks
Michael



More information about the asterisk-dev mailing list