<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=iso-8859-1"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        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 70.85pt 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=FR-BE link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal>Hi,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-US>I’m trying to implement kamailio as a Teams SBC as described here : </span><a href="https://skalatan.de/en/blog/kamailio-sbc-teams"><span lang=EN-US>https://skalatan.de/en/blog/kamailio-sbc-teams</span></a> <span lang=EN-US>(thanks to the author, I think he’s here)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>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.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Here’s the dialog captured in sngrep using the siptrace module :<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US><img border=0 width=1264 height=152 style='width:13.1666in;height:1.5833in' id="Image_x0020_1" src="cid:image001.png@01D5D2CB.DA7A2650"></span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>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.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>However, when I capture packets using tcpdump, I can see that there’s no connection to 52.114.76.76:5061 :<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>15:01:35.466926 IP 52.114.76.76.3008 > MY_IP.sip-tls: Flags [.], ack 1, win 2053, length 0<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>15:01:35.467423 IP MY_IP.sip-tls > 52.114.76.76.3008: Flags [.], ack 189, win 237, length 0<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>15:01:35.478535 IP MY_IP.sip-tls > 52.114.76.76.3008: Flags [.], seq 1:2881, ack 189, win 237, length 2880<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>15:01:35.498028 IP 52.114.76.76.3008 > MY_IP.sip-tls: Flags [.], ack 2881, win 2053, length 0<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>15:01:35.551569 IP 52.114.76.76.3008 > MY_IP.sip-tls: Flags [.], ack 3017, win 2052, length 0<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>15:01:35.863823 IP 52.114.76.76.3008 > MY_IP.sip-tls: Flags [.], ack 3656, win 2050, length 0<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>If I check the Kamailio log file :<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>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<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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...<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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...<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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=<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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...<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>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<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>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?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Is that a normal behavior?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Thanks for your help.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Best regards,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Cyrille<o:p></o:p></span></p></div></body></html>