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

Matt Fredrickson creslin at digium.com
Thu Mar 2 14:38:20 CST 2017


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



More information about the asterisk-dev mailing list