<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Vorformatiert Zchn";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.HTMLVorformatiertZchn
{mso-style-name:"HTML Vorformatiert Zchn";
mso-style-priority:99;
mso-style-link:"HTML Vorformatiert";
font-family:Consolas;
mso-fareast-language:DE;}
span.E-MailFormatvorlage21
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Hello,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">did not looked into the code yet, but it might be just a bug/limitation of the module. You could open an issue on our github tracker about it.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Cheers,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Henning<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">-- <o:p>
</o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Henning Westerholt –
</span><span style="mso-fareast-language:EN-US"><a href="https://skalatan.de/blog/"><span lang="EN-GB" style="color:#0563C1">https://skalatan.de/blog/</span></a></span><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Kamailio services –
</span><span style="mso-fareast-language:EN-US"><a href="https://gilawa.com/"><span lang="EN-GB" style="color:#0563C1">https://gilawa.com</span></a></span><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-left:35.4pt"><b>From:</b> sr-users <sr-users-bounces@lists.kamailio.org>
<b>On Behalf Of </b>sthustfo<br>
<b>Sent:</b> Tuesday, October 11, 2022 4:50 AM<br>
<b>To:</b> sr-users@lists.kamailio.org<br>
<b>Subject:</b> Re: [SR-Users] detect tcp connection close using tcpops module<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-left:35.4pt"><o:p> </o:p></p>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">Any pointers on what I am missing would be highly appreciated. The event routes are being called but the $conid does not contain the proper
value.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt">------- Original Message -------<br>
On Sunday, October 9th, 2022 at 20:55, sthustfo <<a href="mailto:sthustfo@proton.me">sthustfo@proton.me</a>> wrote:<br>
<br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">Looking at the source code, it seems the extra_data is not set. But that does not explain why $conid is <null> when tcp:closed event route is triggered.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt">------- Original Message -------<br>
On Sunday, October 9th, 2022 at 19:55, sthustfo <<a href="mailto:sthustfo@proton.me">sthustfo@proton.me</a>> wrote:<br>
<br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">I am running latest kamailio 5.6.2 and attempting to detect tcp/tls connection being disconnected or closed using tcpops module. As suggested in tcpops
documentation at <a href="https://www.kamailio.org/docs/modules/devel/modules/tcpops.html" target="_blank">https://www.kamailio.org/docs/modules/devel/modules/tcpops.html</a>, registered event routes as below.<o:p></o:p></span></p>
</div>
<div>
<div style="mso-element:para-border-div;border:solid #99CCCC 1.0pt;padding:0cm 0cm 0cm 15.0pt;background:#FCFFFC;margin-left:35.4pt;margin-right:0cm">
<pre style="background:#FCFFFC;border:none;padding:0cm;border-radius:2.5px;overflow:auto"><span style="font-size:11.5pt;color:black">event_route[tcp:closed] {</span><span style="font-size:11.5pt"><o:p></o:p></span></pre>
<pre style="background:#FCFFFC;border:none;padding:0cm"><span style="font-size:11.5pt;color:black"> xlog("L_INFO", "$proto connection closed ($conid)\n");</span><span style="font-size:11.5pt"><o:p></o:p></span></pre>
<pre style="background:#FCFFFC;border:none;padding:0cm"><span style="font-size:11.5pt;color:black">}</span><span style="font-size:11.5pt"><o:p></o:p></span></pre>
<pre style="background:#FCFFFC;border:none;padding:0cm"><span style="font-size:11.5pt"><o:p> </o:p></span></pre>
<pre style="background:#FCFFFC;border:none;padding:0cm"><span style="font-size:11.5pt;color:black">event_route[tcp:timeout] {</span><span style="font-size:11.5pt"><o:p></o:p></span></pre>
<pre style="background:#FCFFFC;border:none;padding:0cm"><span style="font-size:11.5pt;color:black"> xlog("L_INFO", "$proto connection timed out ($conid)\n");</span><span style="font-size:11.5pt"><o:p></o:p></span></pre>
<pre style="background:#FCFFFC;border:none;padding:0cm"><span style="font-size:11.5pt;color:black">}</span><span style="font-size:11.5pt"><o:p></o:p></span></pre>
<pre style="background:#FCFFFC;border:none;padding:0cm"><span style="font-size:11.5pt"><o:p> </o:p></span></pre>
<pre style="background:#FCFFFC;border:none;padding:0cm"><span style="font-size:11.5pt;color:black">event_route[tcp:reset] {</span><span style="font-size:11.5pt"><o:p></o:p></span></pre>
<pre style="background:#FCFFFC;border:none;padding:0cm"><span style="font-size:11.5pt;color:black"> xlog("L_INFO", "$proto connection reset by peer ($conid)\n");</span><span style="font-size:11.5pt"><o:p></o:p></span></pre>
<pre style="background:#FCFFFC;border:none;padding:0cm"><span style="font-size:11.5pt;color:black">}</span><span style="font-size:11.5pt"><o:p></o:p></span></pre>
</div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">Now it is observed that the event route is being called but the $conid is not set. The logs show the below log statements and extra data is (nil).<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">24(4263) DEBUG: <core> [core/tcp_read.c:284]: tcp_read_data(): EOF on connection 0x7ffff2ff8b90 (state: 0, flags: 4018) - FD 7, bytes 0, rd-flags 10000
([10.8.137.33]:51069 -> [10.8.137.33]:5060)24(4263) DEBUG: <core> [core/tcp_read.c:1500]: tcp_read_req(): EOF<o:p></o:p></span></p>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">24(4263) DEBUG: <core> [core/io_wait.h:600]: io_watch_del(): DBG: io_watch_del (0x555555ab6960, 7, -1, 0x10) fd_no=2 called<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">24(4263) DEBUG: <core> [core/tcp_read.c:1870]: handle_io(): removing from list 0x7ffff2ff8b90 id 1 fd 7, state 2, flags 4018, main fd 51, refcnt 2
([10.8.137.33]:51069 -> [10.8.137.33]:5060)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><b><span style="font-size:10.5pt;font-family:"Arial",sans-serif">24(4263) DEBUG: <core> [core/tcp_read.c:1653]: release_tcpconn(): releasing con 0x7ffff2ff8b90, state -1, fd=7, id=1 ([10.8.137.33]:51069 -> [10.8.137.33]:5060)</span></b><span style="font-size:10.5pt;font-family:"Arial",sans-serif"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><b><span style="font-size:10.5pt;font-family:"Arial",sans-serif">24(4263) DEBUG: <core> [core/tcp_read.c:1657]: release_tcpconn(): extra_data (nil)</span></b><span style="font-size:10.5pt;font-family:"Arial",sans-serif"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">32(4271) DEBUG: <core> [core/tcp_main.c:3651]: handle_tcp_child(): reader response= 7ffff2ff8b90, -1 from 0<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">32(4271) DEBUG: <core> [core/tcp_main.c:3576]: tcp_emit_closed_event(): TCP closed event creation triggered (reason: 0)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><b><span style="font-size:10.5pt;font-family:"Arial",sans-serif">32(4271) DEBUG: tcpops [tcpops.c:295]: tcpops_handle_tcp_closed(): received TCP closed event</span></b><span style="font-size:10.5pt;font-family:"Arial",sans-serif"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><b><span style="font-size:10.5pt;font-family:"Arial",sans-serif">32(4271) DEBUG: tcpops [tcpops.c:249]: tcpops_tcp_closed_run_route(): event reason id: 0 rt: 1</span></b><span style="font-size:10.5pt;font-family:"Arial",sans-serif"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">32(4271) DEBUG: <core> [core/parser/parse_fline.c:249]: parse_first_line(): first line type 1 (request) flags 1<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">32(4271) DEBUG: <core> [core/parser/msg_parser.c:679]: parse_msg(): SIP Request:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">32(4271) DEBUG: <core> [core/parser/msg_parser.c:681]: parse_msg(): method: <OPTIONS><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">32(4271) DEBUG: <core> [core/parser/msg_parser.c:683]: parse_msg(): uri: <<a href="mailto:sip:you@kamailio.org" target="_blank">sip:you@kamailio.org</a>><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">32(4271) DEBUG: <core> [core/parser/msg_parser.c:685]: parse_msg(): version: <SIP/2.0><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">32(4271) DEBUG: <core> [core/parser/parse_hname2.c:301]: parse_sip_header_name(): parsed header name [Via] type 1<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">32(4271) DEBUG: <core> [core/parser/parse_via.c:2639]: parse_via(): end of header reached, state=2<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">32(4271) DEBUG: <core> [core/parser/msg_parser.c:555]: parse_headers(): Via found, flags=2<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">32(4271) DEBUG: <core> [core/parser/msg_parser.c:557]: parse_headers(): this is the first via<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">32(4271) exec: *** cfgtrace:dbg_cfg_trace(): unknown_route=[tcp:closed] c=[/usr/local/etc/kamailio/kamailio.cfg] l=976 a=26 n=xlog<o:p></o:p></span></p>
</div>
<p class="MsoNormal" style="margin-left:35.4pt"><b><span style="font-size:10.5pt;font-family:"Arial",sans-serif">32(4271) INFO: <script> tcp connection closed (<null>)</span></b><span style="font-size:10.5pt;font-family:"Arial",sans-serif"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">Can anyone provide any pointers on what I am missing?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif">Thanks in advance.<o:p></o:p></span></p>
</div>
</blockquote>
<p class="MsoNormal" style="margin-left:35.4pt"><o:p> </o:p></p>
</div>
</blockquote>
<p class="MsoNormal" style="margin-left:35.4pt"><o:p> </o:p></p>
</div>
</div>
</body>
</html>