<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hi Răzvan.</p>
<p><br>
</p>
<p>Thank you very much.</p>
<p>I'm facing a problem here related to TCP connection teared down during dialogs.</p>
<p>While a peer is not in dialogs, its TCP connection to OpenSIPS keeps online all the time.</p>
<p>However, when such peer enters in a conversation (be part of a dialog), after few minutes there is a EOF received in a socket. After this, OpenSIPS can no more send SIP BYEs to the respective peer. In the log I can see:</p>
<p><br>
</p>
<p></p>
<div><span style="font-size: 10pt; color: rgb(0, 111, 201);">Jan 02 01:38:45 colibri-imx6-jfl opensips[21018]: Jan&nbsp; 2 01:38:45 [21027] DBG:core:tcp_read: EOF on 0x74e3d048, FD 24&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</span><br>
<span style="font-size: 10pt; color: rgb(0, 111, 201);">Jan 02 01:38:45 colibri-imx6-jfl opensips[21018]: Jan&nbsp; 2 01:38:45 [21027] DBG:core:tcp_read_req: EOF received&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</span><br>
<span style="font-size: 10pt; color: rgb(0, 111, 201);">Jan 02 01:38:45 colibri-imx6-jfl opensips[21018]: Jan&nbsp; 2 01:38:45 [21027] DBG:core:io_watch_del: [TCP_worker] io_watch_del op on index 0 24 (0x1875e8, 24, 0, 0x10,0x3) fd_no=3 called&nbsp; &nbsp;</span><br>
<span style="font-size: 10pt; color: rgb(0, 111, 201);">Jan 02 01:38:45 colibri-imx6-jfl opensips[21018]: Jan&nbsp; 2 01:38:45 [21027] DBG:core:tcpconn_release:&nbsp; releasing con 0x74e3d048, state -1, fd=-1, id=3&nbsp;&nbsp;
</span><br>
<span style="font-size: 10pt; color: rgb(0, 111, 201);">Jan 02 01:38:45 colibri-imx6-jfl opensips[21018]: Jan&nbsp; 2 01:38:45 [21027] DBG:core:tcpconn_release:&nbsp; extra_data (nil)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</span><br>
<span style="font-size: 10pt; color: rgb(0, 111, 201);">Jan 02 01:38:45 colibri-imx6-jfl opensips[21018]: Jan&nbsp; 2 01:38:45 [21029] DBG:core:handle_tcp_worker: reader response= 74e3d048, -1 from 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</span><br>
<span style="font-size: 10pt; color: rgb(0, 111, 201);">Jan 02 01:38:45 colibri-imx6-jfl opensips[21018]: Jan&nbsp; 2 01:38:45 [21029] DBG:core:tcpconn_destroy: destroying connection 0x74e3d048, flags 0006&nbsp;&nbsp;</span></div>
<br>
<p></p>
<p>...</p>
<p>When OpenSIPS try to send a SIP BYE via socket <span style="font-size: 10pt; color: rgb(0, 111, 201);">
0x74e3d048</span> , I can see the log:<br>
</p>
<p><span style="font-size: 10pt; color: rgb(0, 111, 201);">Jan 02 01:40:49 colibri-imx6-jfl opensips[21018]: Jan&nbsp; 2 01:40:49 [21026] DBG:core:proto_tcp_send: no open tcp connection found, opening new one, async = 1</span></p>
<p><br>
</p>
<p>I have already used the flag &quot;Pp&quot; in the creation of dialogs, but it didn't take effect. That is, even with &quot;Pp&quot; I'm still getting &quot;EOF&quot; in the TCP socket.</p>
<p><br>
</p>
<p>1 - Should the flag &quot;Pp&quot; avoid those EOFs during dialogs?</p>
<p><br>
</p>
<p>That flag causes the OpenSIPS to send SIP OPTIONS. The peers are replying with SIP 500.
<br>
</p>
<p><br>
</p>
<p>2- Is a SIP 500 reply enough to OpenSIPS keep the dialog connected?</p>
<p><br>
</p>
<p>3 - Does it make sense getting <span>absence</span> of keep alive messages during dialogs?</p>
<p><br>
</p>
<p>Any hint will be very helpful!</p>
<p>P.S.: I will check the TCP trace too, looking for keep alives.&nbsp;</p>
<p><br>
</p>
<p>Best regards.<br>
</p>
<p><br>
</p>
<p><br>
</p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div class="BodyFragment"><font size="2">
<div class="PlainText">RODRIGO PIMENTA CARVALHO<br>
Inatel Competence Center<br>
Software<br>
Ph: &#43;55 35 3471 9200 RAMAL 979<br>
</div>
</font></div>
</div>
</div>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>De:</b> users-bounces@lists.opensips.org &lt;users-bounces@lists.opensips.org&gt; em nome de Răzvan Crainea &lt;razvan@opensips.org&gt;<br>
<b>Enviado:</b> quarta-feira, 26 de outubro de 2016 13:08<br>
<b>Para:</b> users@lists.opensips.org<br>
<b>Assunto:</b> Re: [OpenSIPS-Users] Is it a kind of TCP keep alive produced by OpenSIPS?</font>
<div>&nbsp;</div>
</div>
<div><tt>Hi, Rodrigo!<br>
<br>
The logs you are tracing are printed when OpenSIPS receives something from the client, and then immediately responds back. Due to the fact that we don't see any other debug messages, like SIP parsing &amp; stuff, makes me think that it is a CRLF pinging - the client
 periodically sends a CRLFCRLF TCP message to OpenSIPS, and OpenSIPS responds with a single CRLF. Note that this is different from a TCP keep-alive, where each peer send a 0-length TCP message, without any body. That message doesn't even get to the application
 layer.<br>
However, tracing the communication between OpenSIPS and the client should confirm the above :).<br>
<br>
Best regards,<br>
</tt>
<pre class="moz-signature" cols="72">Răzvan Crainea
OpenSIPS Solutions
<a previewremoved="true" id="LPlnk872928" class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></pre>
<div style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;" id="LPBorder_GT_14774896262840.7749040558889541">
<table style="width: 90%; background-color: rgb(255, 255, 255); position: relative; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top: 1px dotted rgb(200, 200, 200); border-bottom: 1px dotted rgb(200, 200, 200);" id="LPContainer_14774896262790.8131331098353491" cellspacing="0">
<tbody>
<tr style="border-spacing: 0px;" valign="top">
<td colspan="2" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;" id="TextCell_14774896262810.25225818451243276">
<div id="LPRemovePreviewContainer_14774896262810.5370222787637303"></div>
<div style="top: 0px; color: rgb(0, 120, 215); font-weight: 400; font-size: 21px; font-family: &quot;wf_segoe-ui_light&quot;,&quot;Segoe UI Light&quot;,&quot;Segoe WP Light&quot;,&quot;Segoe UI&quot;,&quot;Segoe WP&quot;,Tahoma,Arial,sans-serif; line-height: 21px;" id="LPTitle_14774896262810.20247837430869875">
<a target="_blank" href="http://www.opensips-solutions.com/" style="text-decoration: none;" id="LPUrlAnchor_14774896262820.020496668580710642">Home — OpenSIPS Solutions</a></div>
<div style="margin: 10px 0px 16px; color: rgb(102, 102, 102); font-weight: 400; font-family: &quot;wf_segoe-ui_normal&quot;,&quot;Segoe UI&quot;,&quot;Segoe WP&quot;,Tahoma,Arial,sans-serif; font-size: 14px; line-height: 14px;" id="LPMetadata_14774896262820.29194839532997063">
www.opensips-solutions.com</div>
<div style="display: block; color: rgb(102, 102, 102); font-weight: 400; font-family: &quot;wf_segoe-ui_normal&quot;,&quot;Segoe UI&quot;,&quot;Segoe WP&quot;,Tahoma,Arial,sans-serif; font-size: 14px; line-height: 20px; max-height: 100px; overflow: hidden;" id="LPDescription_14774896262830.7344774807265421">
OpenSIPS is a mature Open Source implementation of a SIP server. OpenSIPS is more than a SIP proxy/router as it includes application-level functionalities.</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="moz-cite-prefix">On 10/26/2016 05:10 PM, Rodrigo Pimenta Carvalho wrote:<br>
</div>
<blockquote type="cite">
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Dear OpenSIPS users,<br>
</p>
<p><br>
</p>
<p>In the OpenSIPS log I see:<br>
</p>
<p><br>
</p>
<div>Jan 01 19:30:38 colibri-imx6-jfl opensips[3444]: Jan&nbsp; 1 19:30:38 [3451] DBG:core:tcp_read_req: Using the global ( per process ) buff<br>
Jan 01 19:30:38 colibri-imx6-jfl opensips[3444]: Jan&nbsp; 1 19:30:38 [3451] DBG:core:tcp_handle_req: content-length= 0<br>
Jan 01 19:30:38 colibri-imx6-jfl opensips[3444]: Jan&nbsp; 1 19:30:38 [3451] DBG:core:async_tsend_stream: Async successful write from first try on 0x74e13548<br>
Jan 01 19:30:38 colibri-imx6-jfl opensips[3444]: Jan&nbsp; 1 19:30:38 [3451] DBG:core:tcp_read_req: tcp_read_req end<br>
<br>
The frequency is 1 time at each 1,5 minute. There is only one client online. I suspect that OpenSIPS uses the socket
<span>0x74e13548</span> to send messages to such client. The client became online using TCP.<br>
<br>
Just to confirm, is this log a result of a TCP keep alive function enabled?<br>
<br>
Best regards.<br>
<br>
<br>
</div>
<p><br>
</p>
<p><br>
</p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div class="BodyFragment"><font size="2">
<div class="PlainText">RODRIGO PIMENTA CARVALHO<br>
Inatel Competence Center<br>
Software<br>
Ph: &#43;55 35 3471 9200 RAMAL 979<br>
</div>
</font></div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset> <br>
<pre>_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</div>
</div>
</div>
</body>
</html>