[SR-Users] TLS and TCP port question

Cyrille Demaret cyrille at omail.be
Fri Jan 24 15:43:36 CET 2020


Hi,

 

I’m trying to implement kamailio as a Teams SBC as described here :
<https://skalatan.de/en/blog/kamailio-sbc-teams>
https://skalatan.de/en/blog/kamailio-sbc-teams (thanks to the author, I
think he’s here)

 

I’m using Kamailio 5.2.1 and I still have a problem to have the SBC active
on the Microsoft side. I’m correctly receiving the OPTIONS packet from
Microsoft but I have some doubt on my OK reply.

 

Here’s the dialog captured in sngrep using the siptrace module :

 



 

The OPTIONS packet I receive from Microsoft contains a Contact header with a
different port as the original packet. So, Kamailio send the 200 OK back to
this port.

 

However, when I capture packets using tcpdump, I can see that there’s no
connection to 52.114.76.76:5061 :

 

15:01:35.466926 IP 52.114.76.76.3008 > MY_IP.sip-tls: Flags [.], ack 1, win
2053, length 0

15:01:35.467383 IP 52.114.76.76.3008 > MY_IP.sip-tls: Flags [P.], seq 1:189,
ack 1, win 2053, length 188

15:01:35.467423 IP MY_IP.sip-tls > 52.114.76.76.3008: Flags [.], ack 189,
win 237, length 0

15:01:35.478535 IP MY_IP.sip-tls > 52.114.76.76.3008: Flags [.], seq 1:2881,
ack 189, win 237, length 2880

15:01:35.478771 IP MY_IP.sip-tls > 52.114.76.76.3008: Flags [P.], seq
2881:3017, ack 189, win 237, length 136

15:01:35.498028 IP 52.114.76.76.3008 > MY_IP.sip-tls: Flags [.], ack 2881,
win 2053, length 0

15:01:35.551569 IP 52.114.76.76.3008 > MY_IP.sip-tls: Flags [.], ack 3017,
win 2052, length 0

15:01:35.765965 IP 52.114.76.76.3008 > MY_IP.sip-tls: Flags [P.], seq
189:282, ack 3017, win 2052, length 93

15:01:35.767719 IP MY_IP.sip-tls > 52.114.76.76.3008: Flags [P.], seq
3017:3259, ack 282, win 237, length 242

15:01:35.800634 IP 52.114.76.76.3008 > MY_IP.sip-tls: Flags [P.], seq
282:825, ack 3259, win 2051, length 543

15:01:35.802362 IP MY_IP.sip-tls > 52.114.76.76.3008: Flags [P.], seq
3259:3656, ack 825, win 245, length 397

15:01:35.863823 IP 52.114.76.76.3008 > MY_IP.sip-tls: Flags [.], ack 3656,
win 2050, length 0

 

If I check the Kamailio log file :

 

Jan 24 15:01:35 mysbc kamailio[17788]: 25(17837) exec: {1 1 OPTIONS
fcde6307-1d3b-42fd-91bd-4547744fa00c} *** cfgtrace:request_route=[REQINIT]
c=[/etc/kamailio/kamailio.cfg] l=613 a=26 n=sl_send_reply

Jan 24 15:01:35 mysbc kamailio[17788]: 25(17837) DEBUG: {1 1 OPTIONS
fcde6307-1d3b-42fd-91bd-4547744fa00c} <core> [core/msg_translator.c:162]:
check_via_address(): (52.114.76.76, 52.114.76.76, 0)

Jan 24 15:01:35 mysbc kamailio[17788]: 25(17837) DEBUG: {1 1 OPTIONS
fcde6307-1d3b-42fd-91bd-4547744fa00c} sl [sl_funcs.c:500]:
sl_run_callbacks(): execute callback for event type 1

Jan 24 15:01:35 mysbc kamailio[17788]: 25(17837) DEBUG: {1 1 OPTIONS
fcde6307-1d3b-42fd-91bd-4547744fa00c} sl [sl_funcs.c:500]:
sl_run_callbacks(): execute callback for event type 1

Jan 24 15:01:35 mysbc kamailio[17788]: 25(17837) DEBUG: {1 1 OPTIONS
fcde6307-1d3b-42fd-91bd-4547744fa00c} siptrace [siptrace.c:1364]:
trace_sl_onreply_out(): trace off...

Jan 24 15:01:35 mysbc kamailio[17788]: 25(17837) DEBUG: {1 1 OPTIONS
fcde6307-1d3b-42fd-91bd-4547744fa00c} <core> [core/tcp_main.c:2225]:
tcpconn_send_put(): send from reader (17837 (25)), reusing fd

Jan 24 15:01:35 mysbc kamailio[17788]: 25(17837) DEBUG: {1 1 OPTIONS
fcde6307-1d3b-42fd-91bd-4547744fa00c} <core> [core/tcp_main.c:2460]:
tcpconn_do_send(): sending...

Jan 24 15:01:35 mysbc kamailio[17788]: 25(17837) DEBUG: {1 1 OPTIONS
fcde6307-1d3b-42fd-91bd-4547744fa00c} <core> [core/tcp_main.c:2494]:
tcpconn_do_send(): after real write: c= 0x7f81740edb30 n=397 fd=8

Jan 24 15:01:35 mysbc kamailio[17788]: 25(17837) DEBUG: {1 1 OPTIONS
fcde6307-1d3b-42fd-91bd-4547744fa00c} <core> [core/tcp_main.c:2495]:
tcpconn_do_send(): buf=

Jan 24 15:01:35 mysbc kamailio[17788]:
#027#003#003#001...M...t.[.._..gu..-3.8D#027#022..J.>..a..H.AË..
..)om.Oh.O.1.A..'.Fa...c.9..M}...#004O..#004

Jan 24 15:01:35 mysbc kamailio[17788]: 25(17837) DEBUG: {1 1 OPTIONS
fcde6307-1d3b-42fd-91bd-4547744fa00c} siptrace [siptrace_hep.c:498]:
pipport2su(): the port string is 5061

Jan 24 15:01:35 mysbc kamailio[17788]: 25(17837) DEBUG: {1 1 OPTIONS
fcde6307-1d3b-42fd-91bd-4547744fa00c} siptrace [siptrace_hep.c:498]:
pipport2su(): the port string is 5061

Jan 24 15:01:35 mysbc kamailio[17788]: 25(17837) DEBUG: {1 1 OPTIONS
fcde6307-1d3b-42fd-91bd-4547744fa00c} <core> [core/proxy.c:264]: mk_proxy():
doing DNS lookup...

Jan 24 15:01:35 mysbc kamailio[17788]: 25(17837) DEBUG: {1 1 OPTIONS
fcde6307-1d3b-42fd-91bd-4547744fa00c} siptrace [siptrace_hep.c:302]:
trace_send_hep2_duplicate(): setting up the socket_info

Jan 24 15:01:35 mysbc kamailio[17788]: 25(17837) exec: {1 1 OPTIONS
fcde6307-1d3b-42fd-91bd-4547744fa00c} *** cfgtrace:request_route=[REQINIT]
c=[/etc/kamailio/kamailio.cfg] l=614 a=2 n=exit

Jan 24 15:01:35 mysbc kamailio[17788]: 25(17837) DEBUG: {1 1 OPTIONS
fcde6307-1d3b-42fd-91bd-4547744fa00c} <core> [core/receive.c:353]:
receive_msg(): request-route executed in: 1018 usec

Jan 24 15:01:35 mysbc kamailio[17788]: 25(17837) DEBUG: {1 1 OPTIONS
fcde6307-1d3b-42fd-91bd-4547744fa00c} <core> [core/usr_avp.c:636]:
destroy_avp_list(): destroying list (nil)

Jan 24 15:01:35 mysbc kamailio[17788]: 25(17837) DEBUG: {1 1 OPTIONS
fcde6307-1d3b-42fd-91bd-4547744fa00c} <core> [core/usr_avp.c:636]:
destroy_avp_list(): destroying list (nil)

Jan 24 15:01:35 mysbc kamailio[17788]: 25(17837) DEBUG: {1 1 OPTIONS
fcde6307-1d3b-42fd-91bd-4547744fa00c} <core> [core/usr_avp.c:636]:
destroy_avp_list(): destroying list (nil)

Jan 24 15:01:35 mysbc kamailio[17788]: 25(17837) DEBUG: {1 1 OPTIONS
fcde6307-1d3b-42fd-91bd-4547744fa00c} <core> [core/usr_avp.c:636]:
destroy_avp_list(): destroying list (nil)

Jan 24 15:01:35 mysbc kamailio[17788]: 25(17837) DEBUG: {1 1 OPTIONS
fcde6307-1d3b-42fd-91bd-4547744fa00c} <core> [core/usr_avp.c:636]:
destroy_avp_list(): destroying list (nil)

Jan 24 15:01:35 mysbc kamailio[17788]: 25(17837) DEBUG: {1 1 OPTIONS
fcde6307-1d3b-42fd-91bd-4547744fa00c} <core> [core/usr_avp.c:636]:
destroy_avp_list(): destroying list (nil)

Jan 24 15:01:35 mysbc kamailio[17788]: 25(17837) DEBUG: {1 1 OPTIONS
fcde6307-1d3b-42fd-91bd-4547744fa00c} <core> [core/xavp.c:495]:
xavp_destroy_list(): destroying xavp list (nil)

Jan 24 15:01:35 mysbc kamailio[17788]: 25(17837) DEBUG: {1 1 OPTIONS
fcde6307-1d3b-42fd-91bd-4547744fa00c} <core> [core/receive.c:457]:
receive_msg(): cleaning up

 

 

So, it seems that Kamailio is reusing the existing tls connection and then
sends my 200 OK to the port 3008 and not to the port 5061 as asked in the
contact header. Is my understanding ok?

Is that a normal behavior?

 

Thanks for your help.

 

Best regards,

 

Cyrille

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20200124/a68a9e42/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 18858 bytes
Desc: not available
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20200124/a68a9e42/attachment.png>


More information about the sr-users mailing list