[asterisk-dev] Asterisk 13 and PJSIP 2.6 TLS Disconnections

Matt Fredrickson creslin at digium.com
Thu Mar 2 15:04:55 CST 2017


On Thu, Mar 2, 2017 at 2:51 PM, Ross Beer <ross.beer at outlook.com> wrote:
> Hi Matthew,
>
> I have the option 'keep_alive_interval' disabled at present as the function
> causes a deadlock. There is an issue open for this.
>
> As I understand it, this function is Asterisk's own way of sending keep
> alive and not using the underlying OS to manage them. I was looking at a
> work around for the deadlock and thought that chan_sip uses the SO_KEEPALIVE
> option therefore this might be an easy solution.

Ah, I see.  Not a bad thought, I'd say.  I'll reply with my standard
"patches are always welcome" :-)  I think fixing any bugs/deadlocks in
keep_alive_interval is probably the best way to fix it though - at
least from an architectural perspective.  But the effort involved in
setting a socket option is a lot lower.  Might be a good starter patch
if you're trying to break into Asterisk development.

Matthew Fredrickson

>
> Kind regards,
>
> Ross
>
>
>
> _____________________________
> From: Matt Fredrickson <creslin at digium.com>
> Sent: Thursday, March 2, 2017 20:38
> Subject: Re: [asterisk-dev] Asterisk 13 and PJSIP 2.6 TLS Disconnections
> To: Asterisk Developers Mailing List <asterisk-dev at lists.digium.com>
>
>
>
> On Thu, Mar 2, 2017 at 7:02 AM, Ross Beer <ross.beer at outlook.com> wrote:
>> Hi All,
>>
>>
>> I'm trying to diagnose an issue with Asterisk 13 and PJSIP where TLS
>> connections are being randomly closed by Asterisk. I'm currently testing
>> the
>> latest GIT version which uses Bundled PJSIP 2.6.
>>
>>
>> Phones are set to register every 120 seconds, so connections shouldn't be
>> timing out.
>>
>>
>> I have a feeling this is related to the PJSIP keepalive options
>> (https://trac.pjsip.org/repos/ticket/95):
>>
>>
>> PJSIP_TCP/TLS_KEEP_ALIVE_INTERVAL
>>
>>
>> I have tried setting these in the pjsip config, however, it doesn't appear
>> to be working:
>>
>>
>> 'netstat --timers -tn' shows that keepalives are not currently is use:
>>
>>
>> tcp 0 0 <DESTINATION IP>:5060 <SROURCE IP>:39395
>> ESTABLISHED off (0.00/0/0)
>> tcp 0 0 <DESTINATION IP>:22 <SROURCE IP>:61282
>> ESTABLISHED keepalive (195.31/0/0)
>> tcp 0 0 <DESTINATION IP>:5061 <SROURCE IP>:46216
>> ESTABLISHED off (0.00/0/0)
>> tcp 0 0 <DESTINATION IP>:5061 <SROURCE IP>:47727
>> ESTABLISHED off (0.00/0/0)
>> tcp 0 0 <DESTINATION IP>:5061 <SROURCE IP>:56087
>> ESTABLISHED off (0.00/0/0)
>> tcp 0 704 <DESTINATION IP>:22 <SROURCE IP>:59566
>> ESTABLISHED on (0.04/0/0)
>> tcp 0 0 <DESTINATION IP>:5060 <SROURCE IP>:39394
>> ESTABLISHED off (0.00/0/0)
>> tcp 0 0 <DESTINATION IP>:5060 <SROURCE IP>:46139
>> ESTABLISHED off (0.00/0/0)
>>
>>
>>
>> Would SO_KEEPALIVE need to be defined when setting up sockets in Asterisk?
>
> Good question. I believe that application level keep alives are
> generally relied upon in Asterisk's TCP/TLS code. Essentially, a
> '\r\n\r\n' is sent over the TCP socket every so often to verify/ensure
> connectivity.
>
> Do you have the variable keep_alive_interval set in the [global]
> section of your pjsip.conf? The value you set it to in seconds is the
> interval at which it sends a keep alive message over the socket.
>
> --
> Matthew Fredrickson
> Digium, Inc. | Engineering Manager
> 445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-dev
>
>
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev



-- 
Matthew Fredrickson
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA



More information about the asterisk-dev mailing list