<div dir="ltr">So here's a proposal...<div><br></div><div>We remove BOTH pjproject and asterisk keep-alives.</div><div>We add the following parameters to pjsip transport:</div><div><br></div><div>tcp_keepalives = <boolean> ; turn on or off tcp keepalives</div><div>; If tcp_keepalives = yes, the following parameters can be used to override the default kernel</div>; settings in /proc/sys/net/ipv4/tcp_keepalive_(time,intvl,probes)<div>tcp_keepalive_time = <seconds> ; The number of seconds a connection can be idle before the first keepalive is sent.</div>tcp_keepalive_interval = <seconds> ; Interval between keepalive probes.<div>tcp_keepalive_probes = <number> ; Number of unacknowledged probes before a failure is reported.</div><div><br></div><div>To preserve backward compatibility, the current keep_alive_interval setting in pjsip.conf/global</div><div>would turn tcp keepalives on for tcp and tls transports with both tcp_keepalive_time and</div><div>tcp_keepalive_interval set to keep_alive_interval and tcp_keepalive_probes set to 2.</div><div><br></div><div>One advantage of this is that wireshark captures will clearly show these as tcp keepalives even on</div><div>a tls connection.   Another advantage is that we eliminate the competing keepalive mechanisms</div><div>with their threading and locking baggage.</div><div><br></div><div>No code changes to pjproject would be required for this change.  We can turn off their keepalives</div><div>in our config_site.h file.</div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 5, 2018 at 9:07 AM, Ross Beer <span dir="ltr"><<a href="mailto:ross.beer@outlook.com" target="_blank">ross.beer@outlook.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
Could the operating system manage this also, for example with the following:</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
sysctl.conf</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
<div>net.ipv4.tcp_fin_timeout = 60</div>
<div>net.ipv4.tcp_retries1 = 3</div>
<div>net.ipv4.tcp_syn_retries = 5</div>
<div><br>
</div>
<div># Keep TCP connections alive</div>
<div>net.ipv4.tcp_keepalive_time = 300</div>
<div>net.ipv4.tcp_keepalive_intvl = 60</div>
net.ipv4.tcp_keepalive_probes = 20<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
>From a chan_pjsip point of view, it would receive notification that the underlying connection has closed.</div>
<hr style="display:inline-block;width:98%">
<div id="m_6525430264456044430divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> <a href="mailto:asterisk-dev-bounces@lists.digium.com" target="_blank">asterisk-dev-bounces@lists.<wbr>digium.com</a> <<a href="mailto:asterisk-dev-bounces@lists.digium.com" target="_blank">asterisk-dev-bounces@lists.<wbr>digium.com</a>> on behalf of Alexander Traud <<a href="mailto:pabstraud@compuserve.com" target="_blank">pabstraud@compuserve.com</a>><br>
<b>Sent:</b> 05 January 2018 15:44<br>
<b>To:</b> Asterisk Developers Mailing List<br>
<b>Subject:</b> Re: [asterisk-dev] Idle Timers and Keep-Alives</font>
<div> </div>
</div><div><div class="h5">
<div class="m_6525430264456044430BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="m_6525430264456044430PlainText">> Do we even WANT an idle timer?<br>
<br>
I posted my concerns already in <<a href="http://gerrit.asterisk.org/6807" target="_blank">http://gerrit.asterisk.org/<wbr>6807</a>>: 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.<br>
<br>
<br>
<br>
-- <br>
______________________________<wbr>______________________________<wbr>_________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
<br>
asterisk-dev mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
   <a href="http://lists.digium.com/mailman/listinfo/asterisk-dev" target="_blank">http://lists.digium.com/<wbr>mailman/listinfo/asterisk-dev</a><br>
</div>
</span></font></div>
</div></div></div>

<br>--<br>
______________________________<wbr>______________________________<wbr>_________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" rel="noreferrer" target="_blank">http://www.api-digital.com</a> --<br>
<br>
asterisk-dev mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
   <a href="http://lists.digium.com/mailman/listinfo/asterisk-dev" rel="noreferrer" target="_blank">http://lists.digium.com/<wbr>mailman/listinfo/asterisk-dev</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><span style="font-size:12.8px">George Joseph</span><br style="font-size:12.8px"><span style="font-size:12.8px">Digium, Inc. | Software Developer</span><span style="font-size:12.8px"><br>445 Jan Davis Drive NW - Huntsville, AL 35806 - US<br></span><span style="font-size:12.8px">Check us out at: </span><a href="http://www.digium.com/" rel="noreferrer" style="color:rgb(17,85,204);font-size:12.8px" target="_blank">www.digium.com</a><span style="font-size:12.8px"> & </span><a href="http://www.asterisk.org/" rel="noreferrer" style="color:rgb(17,85,204);font-size:12.8px" target="_blank">www.asterisk.org</a><br><div><br></div></div></div>
</div>