[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
Mon Jan 11 10:46:23 CST 2021
On 11.01.21 at 15:27 Joshua C. Colp wrote:
> On Mon, Jan 11, 2021 at 10:21 AM Michael Maier <m1278468 at mailbox.org> wrote:
>> It is possible to tcpkill the first connection without being restarted:
>>
>> # tcpkill -i eth0 tcp port 54761
>> [2021-01-11 14:42:15] DEBUG[8569] pjproject: tlsc0x7fa1d82efae8 TLS
>> connection closed
>> [2021-01-11 14:42:15] DEBUG[8569] res_pjsip/pjsip_transport_events.c:
>> Reliable transport 'tlsc0x7fa1d82efae8' state:DISCONNECTED
>> [2021-01-11 14:42:15] DEBUG[8569] pjproject: sip_transport.c
>> Transport tlsc0x7fa1d82efae8 shutting down, force=0
>> [2021-01-11 14:42:15] DEBUG[8569] res_pjsip/pjsip_transport_events.c:
>> Reliable transport 'tlsc0x7fa1d82efae8' state:SHUTDOWN
>> [2021-01-11 14:42:15] DEBUG[8569] res_pjsip/pjsip_transport_events.c:
>> Reliable transport 'tlsc0x7fa1d82efae8' state:DESTROY
>> [2021-01-11 14:42:15] DEBUG[8569] pjproject: tlsc0x7fa1d82efae8 TLS
>> transport destroyed with reason 120104: Connection reset by peer
>>
>> If you're doing the same against Telekom, they drop the first connect
>> after 10 s (therefore no tcpkill is necessary)
>>
>> Any idea why there are 2 connections started though only one is necessary?
>> This is really odd.
>>
>
> Nope. The code itself wasn't explicitly designed or written for this usage,
> so there may be issues with it.
Sounds like a bug to me. Anyway, I found another solution to add n standard transports listening all to no port (tested with Asterisk 18.0.1):
[estandard]
type=transport
protocol=tls
bind=0.0.0.0:0
^
ca_list_file=/etc/pki/tls/certs/ca-bundle.crt
method=tlsv1_2
verify_server=yes
allow_reload=no
tos=cs3
cos=3
[telekom1]
...
# netstat -tulpn | grep 5061
tcp 0 0 0.0.0.0:5061 0.0.0.0:* LISTEN 11329/asterisk
CLI> pjsip show transports
Transport: <TransportId........> <Type> <cos> <tos> <BindAddress....................>
==========================================================================================
Transport: 0.0.0.0-tls tls 3 184 0.0.0.0:5061
Transport: 0.0.0.0-udp udp 3 184 0.0.0.0:5060
Transport: estandard tls 3 96 0.0.0.0:5061
Transport: telekom1 tls 3 96 0.0.0.0:5061
Transport: telekom2 tls 3 96 0.0.0.0:5061
Transport: telekom3 tls 3 96 0.0.0.0:5061
Using the estandard transport for easybell works fine and doesn't start two connections to the ISP at startup.
Hope that works for my other trunks as expected.
Thanks
Michael
More information about the asterisk-dev
mailing list