Hello, I wish to use RTJSON for routing inbound calls from Kamailio to external 
endpoint(s), based on JSON received from my API.
My rtjson setup is based on guide below, with my route(RELAY) sending Invite 
via t_relay();
https://wazo-platform.org/blog/kamailio-routing-with-rtjson-and-http-async-client
I am including rtjson_init_routes("$var(rtjson)");, rtjson_push_routes(); & 
rtjson_update_branch(); in my routes.
Also have defined: listen=tls:10.129.1.168:5061 advertise ${PUBLIC_IPV4}:5061

Routing from rtjson is working fine for TCP / UDP connections, however - once I 
try to forward an INVITE via rtjson using TLS, then the TLS connection is 
simply closed with Kamailio reporting "tcp_read_data(): EOF on connection". 
Please see logs and setup below. 

- tcp_reuse_port = yes, tcp_children = 8, tcp_accept_no_cl= yes & 
tcp_connection_lifetime=3605
- Also no success with tcp_reuse_port = no
- I have HOMER setup and see here that SIP headers from the RTJSON is being 
used (Outbound SIP Invites is being duplicated to HOMER before connection is 
released)
- I see no drop in traffic from my firewall

As you can see from logs below, Kamailio is reusing the socket (0x7fc3ebc65060) 
from the exsisting connection (not new socket 0x7fc3ef70aab0).

I am sending SIP Options toward the external endpoint (which is working fine), 
and my theory is that Kamailio is reusing the exisitng SIP OPTIONS tcp 
connection for the SIP INVITE and somehow close the connection when RTJSON is 
used (since routing without RTJSON is working fine).

Any idea how to solve this?
Thank you!

(x.x.x.x:5061 is external endpoint)

14(43) DEBUG: rtjson [rtjson_routing.c:364]: rtjson_init_serial(): rewrite 
dst-uri to: [sip:x.x.x.x:5061;transport=tls]
14(43) DEBUG: rtjson [rtjson_routing.c:388]: rtjson_init_serial(): trying to 
set send socket to: [tls:10.129.1.168:5061]
14(43) DEBUG: <core> [core/socket_info.c:726]: grep_sock_info(): checking if 
host==us: 12==12 && [10.129.1.168] == [10.129.1.168]
14(43) DEBUG: <core> [core/socket_info.c:730]: grep_sock_info(): checking if 
port 5061 (advertise 5061) matches port 5061

.........

14(43) DEBUG: tm [../../core/forward.h:276]: msg_send_buffer(): sending to: 
x.x.x.x:5061, force_socket=4, send_sock=0x7fc3ef70aab0
14(43) DEBUG: <core> [core/tcp_main.c:1741]: _tcpconn_find(): found connection 
by peer address (id: 9)
14(43) DEBUG: <core> [core/tcp_main.c:2627]: tcpconn_send_put(): tcp connection 
found (0x7fc3ebc65060), acquiring fd
14(43) DEBUG: <core> [core/tcp_main.c:2637]: tcpconn_send_put(): 
c=0x7fc3ebc65060, n=16
23(52) DEBUG: <core> [core/tcp_main.c:3982]: handle_ser_child(): read response= 
7fc3ebc65060, 2, fd -1 from 14 (43)
14(43) DEBUG: <core> [core/tcp_main.c:2665]: tcpconn_send_put(): after 
receive_fd: c= 0x7fc3ebc65060 n=8 fd=20
14(43) DEBUG: <core> [core/tcp_main.c:2842]: tcpconn_do_send(): sending...
14(43) DEBUG: <core> [core/tcp_main.c:2878]: tcpconn_do_send(): after real 
write: c= 0x7fc3ebc65060 n=1372 fd=20
14(43) DEBUG: <core> [core/tcp_main.c:2879]: tcpconn_do_send(): buf=

.........

23(52) DEBUG: <core> [core/tcp_main.c:4671]: handle_tcpconn_ev(): sending to 
child, events 2001
23(52) DEBUG: <core> [core/tcp_main.c:4299]: send2child(): checking per-socket 
generic workers (48/19..-1828836960/21964) [tls:10.129.1.168:5061]
23(52) DEBUG: <core> [core/tcp_main.c:4326]: send2child(): WARNING: no free tcp 
receiver, connection passed to the least busy one (idx:0 busy:2)
23(52) DEBUG: <core> [core/tcp_main.c:4330]: send2child(): selected tcp worker 
idx:0 proc:19 pid:48 for activity on [tls:10.129.1.168:5061], 0x7fc3ebc65060
19(48) DEBUG: <core> [core/tcp_read.c:1782]: handle_io(): received n=8 
con=0x7fc3ebc65060, fd=14
19(48) DEBUG: <core> [core/tcp_read.c:280]: tcp_read_data(): EOF on connection 
0x7fc3ebc65060 (state: 0, flags: 118) - FD 14, bytes 0, rd-flags 10000 
([x.x.x.x]:5061 -> [x.x.x.x]:5061)19(48) DEBUG: <core> [core/tcp_read.c:1544]: 
tcp_read_req(): EOF
19(48) DEBUG: <core> [core/tcp_read.c:1702]: release_tcpconn(): releasing con 
0x7fc3ebc65060, state -1, fd=14, id=9 ([x.x.x.x]:5061 -> [x.x.x.x]:5061)
19(48) DEBUG: <core> [core/tcp_read.c:1705]: release_tcpconn(): extra_data 
0x7fc3ebc305b0
23(52) DEBUG: <core> [core/tcp_main.c:3744]: handle_tcp_child(): reader 
response= 7fc3ebc65060, -1 from 0
23(52) DEBUG: <core> [core/tcp_main.c:3668]: tcp_emit_closed_event(): TCP 
closed event creation triggered (reason: 0)
23(52) DEBUG: <core> [core/tcp_main.c:3676]: tcp_emit_closed_event(): no 
callback registering for handling TCP closed event
23(52) DEBUG: tls [tls_server.c:732]: tls_h_tcpconn_close_f(): Closing SSL 
connection 0x7fc3ebc305b0
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:

Reply via email to