Hello community,

Please your support, I tell you that I am integrating Kamailio with MsTeams, after some time reviewing this, I finally achieved the connection from my Kamailio server to MsTeams and I can validate that the connection to MsTeams is in AP.

[root @ kamailio-server kamailio] # kamcmd dispatcher.list | egrep "URI | FLAGS"
                                        URI: sip: sip.pstnhub.microsoft.com; transport = tls
                                        FLAGS: AP

However, from the admin panel of MsTeams (Direct Routing) I see that the connection to my sbc "sbc.netvoiceperu.com" is with TLS connectivity status in "Active" but the SIP options status is in "Warning".

I have made calls from MsTeams thinking that the SIP options status would change to "active" but it is still in "Warning" state. On the other hand, I have enabled a siptrace in Kamailio and verify that the SIP OPTIONS from kamailio are being sent in the following format to MsTeams.

OPTIONS sip: sip.pstnhub.microsoft.com; transport = tls SIP / 2.0
Via: SIP / 2.0 / TLS 161.35.44.66:5061;branch=z9hG4bKea07.52224687000000000000000000000000.0
To: <sip: sip.pstnhub.microsoft.com; transport = tls>
From: <sip: sbc.netvoiceperu.com>; tag = d3569c818b500aeb8c373426e76c2884-81763c71
CSeq: 10 OPTIONS
Call-ID: 13ea237a751e0c48-9148@161.35.44.66
Max-Forwards: 70
Content-Length: 0
User-Agent: kamailio (5.4.0 (x86_64 / linux))

As you can see, the SIP OPTIONS sent from Kamailio to MsTeams does not contain the "Contact" field, which in theory said "Contact" field should have been added by Kamailio according to the configuration added in kamailio.cfg

event_route [tm: local-request] {
sip_trace ();
        if (is_method ("OPTIONS") && $ ru = ~ "pstnhub.microsoft.com") {
               append_hf ("Contact: <sip: sbc.netvoiceperu.com: 5061; transport = tls> \ r \ n");
        }
        xlog ("L_INFO", "Sent out tm request: $ mb \ n");
}

As additional information, I inform you that I also managed to observe the SIP OPTIONS that MsTeams sends to Kamailio.

OPTIONS sip: sbc.netvoiceperu.com: 5061; transport = tls SIP / 2.0
FROM: <sip: sip-du-a-eu.pstnhub.microsoft.com: 5061>; tag = f1bdeb5f-662f-4544-a436-e9aa9ad78da4
TO: <sip: sbc.netvoiceperu.com>
CSEQ: 1 OPTIONS
CALL-ID: c47e2782-16c3-49cb-8931-24e9709d260a
MAX-FORWARDS: 70
VIA: SIP / 2.0 / TLS 52.114.75.24:5061;branch=z9hG4bK48b0e6be
CONTACT: <sip: sip-du-a-eu.pstnhub.microsoft.com: 5061>
CONTENT-LENGTH: 0
USER-AGENT: Microsoft.PSTNHub.SIPProxy v.2021.1.15.7 i.EUWE.10
ALLOW: INVITE, ACK, OPTIONS, CANCEL, BYE, NOTIFY

However I don't see the 200 OK SIP responses from Kamailio to MsTeams.

I think this may be the reason why I see the SIP OPTIONS status in "Warning" from the MsTeams panel. Maybe the contact field is not being added in the SIP OPTIONS messages that Kamailio sends to MsTeams and for that reason I don't see 200OK responses from MsTeams.

Could you help me solve this please.

Cheers

Saludos Cordiales
-- 
Willy Valles Rios
Unified Communications Specialist

phone: +51955747343