From sthustfo@proton.me Sun Oct 9 16:25:27 2022 From: sthustfo To: sr-users@lists.kamailio.org Subject: [SR-Users] detect tcp connection close using tcpops module Date: Sun, 09 Oct 2022 14:25:21 +0000 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1945985287==" --===============1945985287== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable I am running latest kamailio 5.6.2 and attempting to detect tcp/tls connectio= n being disconnected or closed using tcpops module. As suggested in tcpops do= cumentation at https://www.kamailio.org/docs/modules/devel/modules/tcpops.htm= l, registered event routes as below. event_route[tcp:closed] { xlog("L_INFO", "$proto connection closed ($conid)\n"); } event_route[tcp:timeout] { xlog("L_INFO", "$proto connection timed out ($conid)\n"); } event_route[tcp:reset] { xlog("L_INFO", "$proto connection reset by peer ($conid)\n"); } 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). 24(4263) DEBUG: [core/tcp_read.c:284]: tcp_read_data(): EOF on connect= ion 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/tcp_rea= d.c:1500]: tcp_read_req(): EOF 24(4263) DEBUG: [core/io_wait.h:600]: io_watch_del(): DBG: io_watch_de= l (0x555555ab6960, 7, -1, 0x10) fd_no=3D2 called 24(4263) DEBUG: [core/tcp_read.c:1870]: handle_io(): removing from lis= t 0x7ffff2ff8b90 id 1 fd 7, state 2, flags 4018, main fd 51, refcnt 2 ([10.8.= 137.33]:51069 -> [10.8.137.33]:5060) 24(4263) DEBUG: [core/tcp_read.c:1653]: release_tcpconn(): releasing c= on 0x7ffff2ff8b90, state -1, fd=3D7, id=3D1 ([10.8.137.33]:51069 -> [10.8.137= .33]:5060) 24(4263) DEBUG: [core/tcp_read.c:1657]: release_tcpconn(): extra_data = (nil) 32(4271) DEBUG: [core/tcp_main.c:3651]: handle_tcp_child(): reader res= ponse=3D 7ffff2ff8b90, -1 from 0 32(4271) DEBUG: [core/tcp_main.c:3576]: tcp_emit_closed_event(): TCP c= losed event creation triggered (reason: 0) 32(4271) DEBUG: tcpops [tcpops.c:295]: tcpops_handle_tcp_closed(): received T= CP closed event 32(4271) DEBUG: tcpops [tcpops.c:249]: tcpops_tcp_closed_run_route(): event r= eason id: 0 rt: 1 32(4271) DEBUG: [core/parser/parse_fline.c:249]: parse_first_line(): f= irst line type 1 (request) flags 1 32(4271) DEBUG: [core/parser/msg_parser.c:679]: parse_msg(): SIP Reque= st: 32(4271) DEBUG: [core/parser/msg_parser.c:681]: parse_msg(): method: <= OPTIONS> 32(4271) DEBUG: [core/parser/msg_parser.c:683]: parse_msg(): uri: 32(4271) DEBUG: [core/parser/msg_parser.c:685]: parse_msg(): version: = 32(4271) DEBUG: [core/parser/parse_hname2.c:301]: parse_sip_header_nam= e(): parsed header name [Via] type 1 32(4271) DEBUG: [core/parser/parse_via.c:2639]: parse_via(): end of he= ader reached, state=3D2 32(4271) DEBUG: [core/parser/msg_parser.c:555]: parse_headers(): Via f= ound, flags=3D2 32(4271) DEBUG: [core/parser/msg_parser.c:557]: parse_headers(): this = is the first via 32(4271) exec: *** cfgtrace:dbg_cfg_trace(): unknown_route=3D[tcp:closed] c= =3D[/usr/local/etc/kamailio/kamailio.cfg] l=3D976 a=3D26 n=3Dxlog32(4271) INF= O: