[asterisk-dev] Idle Timers and Keep-Alives

George Joseph gjoseph at digium.com
Wed Jan 24 14:50:20 CST 2018


So here's a proposal...

We remove BOTH pjproject and asterisk keep-alives.
We add the following parameters to pjsip transport:

tcp_keepalives = <boolean> ; turn on or off tcp keepalives
; If tcp_keepalives = yes, the following parameters can be used to override
the default kernel
; settings in /proc/sys/net/ipv4/tcp_keepalive_(time,intvl,probes)
tcp_keepalive_time = <seconds> ; The number of seconds a connection can be
idle before the first keepalive is sent.
tcp_keepalive_interval = <seconds> ; Interval between keepalive probes.
tcp_keepalive_probes = <number> ; Number of unacknowledged probes before a
failure is reported.

To preserve backward compatibility, the current keep_alive_interval setting
in pjsip.conf/global
would turn tcp keepalives on for tcp and tls transports with both
tcp_keepalive_time and
tcp_keepalive_interval set to keep_alive_interval and tcp_keepalive_probes
set to 2.

One advantage of this is that wireshark captures will clearly show these as
tcp keepalives even on
a tls connection.   Another advantage is that we eliminate the competing
keepalive mechanisms
with their threading and locking baggage.

No code changes to pjproject would be required for this change.  We can
turn off their keepalives
in our config_site.h file.




On Fri, Jan 5, 2018 at 9:07 AM, Ross Beer <ross.beer at outlook.com> wrote:

> Could the operating system manage this also, for example with the
> following:
>
> sysctl.conf
>
> net.ipv4.tcp_fin_timeout = 60
> net.ipv4.tcp_retries1 = 3
> net.ipv4.tcp_syn_retries = 5
>
> # Keep TCP connections alive
> net.ipv4.tcp_keepalive_time = 300
> net.ipv4.tcp_keepalive_intvl = 60
> net.ipv4.tcp_keepalive_probes = 20
>
> From a chan_pjsip point of view, it would receive notification that the
> underlying connection has closed.
> ------------------------------
> *From:* asterisk-dev-bounces at lists.digium.com <asterisk-dev-bounces at lists.
> digium.com> on behalf of Alexander Traud <pabstraud at compuserve.com>
> *Sent:* 05 January 2018 15:44
> *To:* Asterisk Developers Mailing List
> *Subject:* Re: [asterisk-dev] Idle Timers and Keep-Alives
>
> > Do we even WANT an idle timer?
>
> I posted my concerns already in <http://gerrit.asterisk.org/6807>: I have
> a device which crashes when it receives such a keepalive. I could live with
> a timer when Asterisk is not the registrar but registered somewhere else.
> But I do not _need_ that either.
>
>
>
> --
> _____________________________________________________________________
> -- 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
>



-- 
George Joseph
Digium, Inc. | Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
Check us out at: www.digium.com & www.asterisk.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20180124/05f8a38f/attachment.html>


More information about the asterisk-dev mailing list