Asterisk with MS Teams integration

Hi Community,

Recently, I have been actively working towards integrating Asterisk as an SBC with MS Teams directly using the Direct Routing product of Microsoft Teams.

I started off with a testing domain (SBC), after following this link (☎️ Asterisk as a Teams Direct Routing SBC · nick.bouwhuis.net) and was successful in making and receiving calls to and from MS Teams.

However, when I tried to shift towards production, which operates on a different domain, after replicating the settings from the testing domain (SBC), I started having an issue (in bold) like the logs below:

Blockquote
Received SIP request (995 bytes) from TLS:52.114.148.0:35405
BYE sip:: 5061; transport=TLS SIP/2.0
FROM: “Hisham”<sip: +100000000;ext=3333@sip.pstnhub.microsoft.com: 5061; user-phone>; tag=d603f748ca5d4a7b93abf9f3f502bfce
TO: sip:+1234556789@domain; user-phone; tag=864c9d62-4fd3-4c17-a95e-ffee64f37fcd
CSEQ: 2 BYE
CALL-ID: 4d28bea7367455818e9207575ef26988
MAX-FORWARDS: 70
VIA: SIP/2.0/TLS 52.114.148.0:5061; branch=z9hG4bK89f27231
REASON: Q.850; cause=79; text=“bc83672c-bd94-48f2-9b89-9c2d945eb23f; InternalDiagCode: Unrecognized TransportProfile, InternalErrorPhrase: Transport profile is not recognized or not compatible”
CONTACT:
sip:apı-au-D-Jawe.psɩnnud.microsoft.com:443;X-1=DC8367Zc-b094-48TZ-9D89-9C20945еDZ3T;X-C=40Z8pea/36/455818E9Z0/5/5еTZ6988/0/8/09/1E45C98ZT4989ac35bcc9pead/
CONTENT-LENGTH: 0
USER-AGENT: Microsoft.PSTNHub.SIPProxy v.2024.3.27.6 i.USWE2.3
ALLOW: INVITE, ACK, OPTIONS, CANCEL, BYE, NOTIFY
P-ASSERTED-IDENTITY: <tel: +100000000;ext=3333>,sip:domain
PRIVACY: id

The issue clearly states that I received a BYE from Microsoft with the given REASON, but upon verifying the hash value of my public and private certificates, the value matched, hence no issue from my end.

My certificate details are as below (pjsip.conf):

Blockquote
[transport-tls]
type=transport
protocol=tls
bind=0.0.0.0:5061
cert_file=/etc/asterisk/keys/certificate.crt
ca_list_file=/etc/asterisk/keys/ca.crt
priv_key_file=/etc/asterisk/keys/certificate.key
method=tlsv1_2
local_net=10.0.0.0/8,0.0.0.0/32
external_media_address= server_ip
external_signaling_address= server_ip

However, I want to know if there is something else that I should check to further clarify the issue above, which I have not encountered while using the testing domain?

Any degree of help will be appreciated.

Thanks and regards,
Hisham

hi members!

@david551
@Pooh

can anyone please assist me with this?

Regards,
Hisham

On Monday 08 April 2024 at 19:58:35, hishamjan via Asterisk Community wrote:

can anyone please assist me with this?

I’ve not done this myself, although I have investigated the integration of
Asterisk and MS Teams, and you’ve certainly got a lot further than I’m
familiar with, without using Kamailio (which I believe is the “usual” way of
getting these two to work together).

Antony.


A user interface is like a joke.
If you have to explain it, it means it doesn’t work.

                                               Please reply to the list;
                                                     please *don't* CC me.

One of the basic rules here is you do not tag frequent contributors for answers.

In any case, my position is that only use teams when I have to communicate with someone is locked into the Microsoft fold. I believe it mis-implements open standards, as well.

Hi, i think you should give us more details.
First how does your certiificate’s CN and SAN is? Then, can you post entire sip’s call log?
Regards

Let me start writing this by apologizing to the frequent contributors first, David and Antony. I did not mean to offend anyone.

As far as my progress is concerned, I truly have advanced a lot and this includes my involvement with Microsoft’s support team as well. Since Asterisk is not a “certified” SBC yet, I was refused any help regarding this issue from Microsoft.

To put things into perspective, I was able to route calls from a test domain and inbound/outbound calls worked like a charm, hence, the decision to move on to the production domain.

I have googled a lot but no one has encountered this type of issue except this link. But, I am in no position to alter the SDP packet as per my liking so the issue remains as is.

Hi @spady7 ,

My certificates are wildcard certificates and are part of CN and SAN. I am also attaching the SIP logs below:




After receiving a 200 OK for ACK from MS, I immediately received a BYE from them with the reason Q.850; cause=79; text=“bc83672c-bd94-48f2-9b89-9c2d945eb23f; InternalDiagCode: Unrecognized TransportProfile, InternalErrorPhrase: Transport profile is not recognized or not compatible.

I have also checked the MD5 hash values of my public and private keys and they match, hence, no issues with the certificates. On the plus side, I can make calls from my hard phone (cisco 7960) to MS teams (leveraging 5-digit extension voice routes). This issue arises as soon as I try to dial a 4-digit extension from MS Teams to my Cisco phone.

Let me know if the info provided above is of any help!

Thanks,
Hisham

That would be a protocol violation! ACK stops the sending of final responses, it does not result in a final response, itself.

The convention on this forum is that logs should be provided as plain text, so they can be, easily, searched. I also wouldn’t have to extract and enlarge the images, to make the text readable.

Your logs are also incomplete, as I can’t find the intiial INVITE.

Hi Hisham,
I think entire sip log, in txt format as said, could help. I read link you mentioned about S4B and Audiocodes. We need to have entire sip log of call and then i can compare to one that is working (i work avery day with Teams Direct ROuting and SBCs, so is easy to me compare it).
Let us know.

Hi @spady7 sorry for the late reply as I was celebrating a religious holiday.

I have pasted the sip logs in txt format below, pls have a look and let me know if it’s of any help! :slight_smile:

<----- Received SIP request (2072 bytes) from TLS:52.114.148.0:35521 ----->

INVITE sip:+103226398775@domain:5061;user=phone;transport=tls SIP/2.0
FROM: *Hisham Ahmad Jan’sip:+123456789;ext=4038@sip.pstnhub.microsoft.com:5062;user=phone;tag=620ea63bdecde108692002ed3fd2e49
TO: sip:+103226398775@domain:5061;user=phone
cseq: 1 INVITE
CALL-ID: 79048753400c5b609d69df
MAX- FORWARDS: 70
VIA: SIP/2.0/TLS 52.114.148.0:5061; branch=z9hGbKIBBOf5c9
RECORD-ROUTE: <sip:sip-du-a.us.pstnhub.microsoft.com:5061; transport=tls;lr>
CONTACT: sip:api-du-b-jawe.pstnhub.microsoft.com:443;x-i=e1545640-7ae9-4eb-8a0c-aad993010857;x-c=T9048753400Cfee299
CONTENT-LENGTH: 1099
MIN-SE: 300
SUPPORTED: histinfo, timer
USER-AGENT: Microsoft.PSTNHub.SIPProxy v.2024.3.27.6 1.USWE2.3
CONTENT-TYPE: application/sdp
ALLOW: INVITE, ACK, OPTIONS, CANCEL, BYE NOTIFY
P-ASSERTED- IDENTITY: tel:+1234567890;ext=4038,sip:hjan@domain
PRIVACY: id
SESSION-EXPIRES: 3600

v=0
o=- 198799 0 IN IP4 127.0.0.1
s=session
c=IN IP4 52.115.152.39
b=CT:10000000
t=0 0
m=audio 52318 RTP/SAVP 104 9 013 111 18 0 8 97 101 13 118
c=IN IP4 52.115.152.39
a=rtcp:52319
a=ice-ufrag:Bwgc
a=ice-pwd:UUNFOu1qamEJrMYC3bg6m4z7
a=rtcp-mux
a=candidate:1 1 UDP 2130706431 52.115.152.39 52318 typ srflx raddr 10.0.20.64 rport 52318
a=candidate:1 2 UDP 2130705918 52.115.152.39 52319 typ srflx raddr 10.0.20.64 rport 52319
a=candidate:2 1 tcp-act 2121006078 52.115.152.39 49152 typ srflx raddr 10.0.20.64 rport 49152
a=candidate:2 2 tcp-act 2121006078 52.115.152.39 49152 typ srflx raddr 10.0.20.64 rport 49152
a=label:main-audio
a=mid:1
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:z0CUYpi+mLZyz9Wpb7406IlILFiigcktNIJAzA+X|2^31
a=sendrecv
a=rtpmap:104 SILK/16000
a=rtpmap:9 G722/8000
a=rtpmap:103 SILK/8000
a=rtpmap:111 SIREN/16000
a=fmtp:111 bitrate=16000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:97 RED/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=rtpmap:13 CN/8000
a=rtpmap:118 CN/16000
a=ptime:20

<— Transmitting SIP response (484 bytes) to TLS:52.114.148.0:35521 —>
SIP/2.0 100 Trying
Via: SIP/2.0/TLS 52.114.148.0:5061; rport=35521; received=52.114.148.0; branch:z9hG4bK1b80f5c9
Record-Route: <sip:sip-du-a-us.pstnhub.microsoft.com:5061; transport=tls; lr>
Call-ID: 79048753400c5b609d80d
From: “Hisham Ahmad Jan" sip:+123456789;ext=403@sip.pstnhub.microsoft.com;user=phone;tag=620ee63b6dcc4e108692002ed3fd2e49
To: sip:+103226308775@domain;user=phone
Cseq: 1 INVITE
Server: Asterisk PBX 18.9.0
Content-Length: 0

DTLS ECDH initialized (automatic), faster PFS enabled

Executing [+103226308775@teams:1] NoOP (“PJSIP/teams-in-00000”, “PSTN”) in new stack
Executing [+103226398775@teams:2] Set(“PISIP/teams-in-00000”, “PJSIP_HEADER(add,CALLERID(ALL))= <sip:+123456789”) in new stack
Executing [+103226398775@teams:3] NoOP (“PJSIP/teams-in-00000”, “+103226398775”) in new stack
Executing [+103226398775@teams:4] (NoOP (“PJSIP/teams-in-00000”, “Hisham Ahmad Jan<+123456789>") in new stack
Executing [+103226398775@teams:5] Answer(“PJSIP/teams-in-00000”, “”) in new stack
0x7aacB0300b0 - Strict RTP learning after remote address set to: 52.115.152.39:52318

<— Transmitting SIP response (1541 bytes) to TLS:52.114.148.0:35521 —>

SIP/2.0 200 0K
Via: SIP/2.0/TLS 52.114.148.0:5061;rport=35521;received=52.114.148.0;branch=z9hGbKIBBOf5c9
Record-Route: sip:sip-du-a-us.pstnhub.microsoft.com:5061;transport=tls;lr
Call-ID: 79048753400c5b609ds0d
From: "Hisham Ahmad Jan <sip:+123456789;ext=4038@sip.pstnhub.microsoft.com,user=phone;tag=620ea63bdecde108692002ed3fd2e49
To: sip:+103226398775@domain;user=phone;tag=BeceabTa13ba-4576-ae3e-6005ca01fd56
Cseq: 1 INVITE
Server: Asterisk PBX 18.9.0
Contact: <sip:domain:5061; transport=TLS>
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Session Expires: 3600; refresher=uac
Require: timer
Content Type: application/sdp
Content-Length: 719

v=0
0=- 198799 2 IN IP4 server_ip
s=Asterisk
c=IN IP4 server_ip
t=0 0
a=msid-semantic:WMS *
m=audio 34656 RTP/SAVP 0 8 101
a=connection:new
a=setup:actpass
a=fingerprint:SHA-256 4A:E6:AB:AL:F0:82:70:17
a=ice-ufrag:2695350261202185628fab76f
a=ice-pwd:363320912fbb68ba9692412829bc
a=candidate:Hc760de91 1 UDP 2130706431 server_ip 34656 typ host
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv
a=rtcp-mux
a=msid:164720028-6add-468a-bee3-64180206c2d8 88382281-a7d3-4cdb-950f-953989203afd
a=rtcp-fb:* transport-cc
a=mid:1

0x7faac500b0 – strict RTP Learning after ICE completion
<---- Received SIP request (719 bytes) from T15:52.114.148.0:35521 —>
ACK sip:domain:5061;transport=TLS SIP/2.0
FROM: “Hisham Ahaad Jan sip:+123456789;ext=4038@sip.pstnhub.microsoft.com:5061;user=phone;tag=620ea63bdecde108692002ed3fd2e49
TO: <sip:+103226398775@domain;user=phone;tag=BeceabTa13ba-4576-ae3e-6005ca01fd56
Cseq: 1 ACK
CALL-ID: 79048753400c5b609d80d
MAX-FORWARDS : 70
VIA: SIP/2.0/TLS 52.114.148.0:5061;branch=z9hGbKIBBOf5c9

<---- Received SIP request (995 bytes) from TLS:52.114.148.0:355256 ---->
BYE sip:dmain:5061;transport=TLS SIP./2.0
FROM: “Hisham Ahmad Jan” <sip:+123456789;ext=4038@sip.pstnhub.microsoft.com:5061;user=phone;tag=620ea63bdecde108692002ed3fd2e49
To: <sip:+103226398775@domain;user=phone;tag=BeceabTa13ba-4576-ae3e-6005ca01fd56
CSEQ: 2 BYE
CALL-ID: 79048753400c5b609d80d
MAX FORWARDS : 70
VIA: SIP/2.0/TL5 52.114.148.0:5061;branch=z9hGbKIBBOf5c9
REASON: Q.850;cause=79;text=“e1545640-7ae9-4aeb-8a0c-aad993e19857;InternalDiagCode: UnrecognizedTransportProfile, InternalErrorPhrase: Transport Profile is not recognized or not compatible”
CONTACT: sip:api.du-b-jawe.pstnhub.microsoft.com:443;x-i=e1545640-7ae9-4eb-8a0c-aad993010857;x-c=T9048753400Cfee299
CONTENT-LENGTH: 0
USER-AGENT: Microsoft.PSTNHub.SIPProxy v.2024.3.27.6 i.USWE2.3
ALLOW: INVITE, ACK, OPTIONS, CANCEL, BYE, NOTIFY
P-ASSERTED- IDENTITY: tel:+123456789ext=4038,sip:hjan@domain
PRIVACY: id

<---- Transmitting SIP response (441 bytes) to TLS:52.114.148.0:35526 ---->
SIP/2.0 200 OK
Via: SIP/2.0/TLS 52.114.148.0:5061; rport=35526;received=52.114.148.0;branch:z9hG4bK1b80f5c9
Call-ID: 79048753400c5b609d80d
From: “Hisham Ahmad Jan” <sip:+123456789;ext=4038@sip.pstnhub.microsoft.com;user=phone;tag=620ea63bdecde108692002ed3fd2e49
To: sip:+103226398775@domain;tag=BeceabTa13ba-4576-ae3e-6005ca01fd56;user:phone
CSeq: 2 BYE
Server: Asterisk PBX 18.9.0
Content-Length: 0

<---- Transmitting SIP response (1541 bytes) to TLS:52.114.148.0:35521 ---->
SIP/2.0 200 OK
Via: SIP/2.0/TLS 52.114.148.0:5061;rport=35521;received=52.114.148.0; branch:z9hG4bK1b80f5c9
Record-Route: sip:s1p-du-a-us.pstnhub.microsoft.com:5061;transport=tls;lr
Call-ID: 79048753400c5b609d80d
From: “Hisham Ahmad Jan” <sip:+123456789;ext=4038@sip.pstnhub.microsoft.com;user:phone;tag=620ea63bdecde108692002ed3fd2e49
To: <sip:+103226308775@domain;user=phone;tag=BeceabTa13ba-4576-ae3e-6005ca01fd56
CSeq: 1 INVITE
Server: Asterisk PBX 18.9.0
Contact: sip:domain:5061;transportTLS
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefarsub
Session Expires: 3600; refresher=uac
Require: timer
Content Type: application/sdp
Content Length: 719

v=0
0=- 198799 2 IN IP4 server_ip
s=Asterisk
c=IN IP4 server_ip
t=0 0
a=msid-semantic:WMS *
m=audio 34656 RTP/SAVP 0 8 101
a=connection:new
a=setup:actpass
a=fingerprint:SHA-256 4A:E6:AB:AL:F0:82:70:17
a=ice-ufrag:2695350261202185628fab76f
a=ice-pwd:363320912fbb68ba9692412829bc
a=candidate:Hc760de91 1 UDP 2130706431 server_ip 34656 typ host
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv
a=rtcp-mux
a=msid:164720028-6add-468a-bee3-64180206c2d8 88382281-a7d3-4cdb-950f-953989203afd
a=rtcp-fb:* transport-cc
a=mid:1

0x7faac500b0 - strict RTP Learning after ICE completion
<---- Received SIP request (719 bytes) from T15:52.114.148.0:35521 —>
ACK sip:domain:5061;transport=TLS SIP/2.0
FROM: “Hisham Ahmad Jan” <sip:+123456789;ext=4038@sip.pstnhub.microsoft.com:5061;user=phone;tag=620ea63bédecde108692002ed3fd2e49
TO: <sip:+103226398775@domain;user=phone;tag=BeceabTa13ba-4576-ae3e-6005ca01fd56
CSEQ: 1 ACK
CALL-ID: 79048753400c5b609d80d
MAX FORWARDS : 70
VIA: SIP/2.0/TLS 52.114.148.0:5061;branch=z9hGbKIBBOf5c9
CONTACT: sip:api.-du-b-jawe.pstnhub.microsoft.com:443;x-i=e1545640-7ae9-4eb-8a0c-aad993010857;x-c=T9048753400Cfee299
CONTENT-LENGTH: 0
USER-AGENT: Microsoft.PSTNHub.SIPProxy v.2024.3.27.6 1.USWE2.3
ALLOW: INVITE, ACK, OPTIONS, CANCEL, BYE , NOTIFY

Kindly let me know if i need to provide any more info. I have bolded the issue in the logs above btw :slight_smile:

Best regards,
Hisham

Hi @spady7

Did you get the chance to look into my sip trace? :slight_smile:

Let me know if you would like to see my dialplan and pjsip.conf files as well.

Best,
Hisham

Hi @hishamjan i had a look and I cannot find any special that is different from normal SIP trace in direct routing (using a certified SBC).
Say that, i see on my trace more lines and exchange of reply/responses. Can you please copy the entire sip trace?
I suspect something is missing

Hi @spady7,

I replicated the issue and the logs are pasted below:

smcpagtprlv310011*CLI> pjsip set logger verbose on
PJSIP Logging to verbose has been enabled
<--- Received SIP request (2076 bytes) from TLS:52.114.148.0:29381 --->
INVITE sip:+103226398775@domain:5061;user=phone;transport=tls SIP/2.0
FROM: "Hisham Ahmad Jan"<sip:+10000000000;ext=4038@sip.pstnhub.microsoft.com:5061;user=phone>;tag=10395f168fec4692b1e4f685412f328d
TO: <sip:+103226398775@domain:5061;user=phone>
CSEQ: 1 INVITE
CALL-ID: 8fad891962f159da9064b52bcea17f51
MAX-FORWARDS: 70
VIA: SIP/2.0/TLS 52.114.148.0:5061;branch=z9hG4bK514034db
RECORD-ROUTE: <sip:sip-du-a-us.pstnhub.microsoft.com:5061;transport=tls;lr>
CONTACT: <sip:api-du-a-jaea.pstnhub.microsoft.com:443;x-i=8a2869a7-c958-4120-b13d-4ab93a71a257;x-c=8fad891962f159da9064b52bcea17f51/d/8/e5782412e3af4af0932fc68d48f71417>
CONTENT-LENGTH: 1102
MIN-SE: 300
SUPPORTED: histinfo,timer
USER-AGENT: Microsoft.PSTNHub.SIPProxy v.2024.4.11.1 i.USWE2.14
CONTENT-TYPE: application/sdp
ALLOW: INVITE,ACK,OPTIONS,CANCEL,BYE,NOTIFY
P-ASSERTED-IDENTITY: <tel:+10000000000;ext=4038>,<sip:hjan@domain>
PRIVACY: id
SESSION-EXPIRES: 3600

v=0
o=- 11149 0 IN IP4 127.0.0.1
s=session
c=IN IP4 52.115.160.30
b=CT:10000000
t=0 0
m=audio 51484 RTP/SAVP 104 9 103 111 18 0 8 97 101 13 118
c=IN IP4 52.115.160.30
a=rtcp:51485
a=ice-ufrag:Xq31
a=ice-pwd:5BaaDWLAqEvflN+mNiBgebHK
a=rtcp-mux
a=candidate:1 1 UDP 2130706431 52.115.160.30 51484 typ srflx raddr 10.0.21.119 rport 51484
a=candidate:1 2 UDP 2130705918 52.115.160.30 51485 typ srflx raddr 10.0.21.119 rport 51485
a=candidate:2 1 tcp-act 2121006078 52.115.160.30 49152 typ srflx raddr 10.0.21.119 rport 49152
a=candidate:2 2 tcp-act 2121006078 52.115.160.30 49152 typ srflx raddr 10.0.21.119 rport 49152
a=label:main-audio
a=mid:1
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:epnanrVB8vYAlz7XxwhstrYVY8XivmxlVCwTMymJ|2^31
a=sendrecv
a=rtpmap:104 SILK/16000
a=rtpmap:9 G722/8000
a=rtpmap:103 SILK/8000
a=rtpmap:111 SIREN/16000
a=fmtp:111 bitrate=16000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:97 RED/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=rtpmap:13 CN/8000
a=rtpmap:118 CN/16000
a=ptime:20

<--- Transmitting SIP response (484 bytes) to TLS:52.114.148.0:29381 --->
SIP/2.0 100 Trying
Via: SIP/2.0/TLS 52.114.148.0:5061;rport=29381;received=52.114.148.0;branch=z9hG4bK514034db
Record-Route: <sip:sip-du-a-us.pstnhub.microsoft.com:5061;transport=tls;lr>
Call-ID: 8fad891962f159da9064b52bcea17f51
From: "Hisham Ahmad Jan" <sip:+10000000000;ext=4038@sip.pstnhub.microsoft.com;user=phone>;tag=10395f168fec4692b1e4f685412f328d
To: <sip:+103226398775@domain;user=phone>
CSeq: 1 INVITE
Server: Asterisk PBX 18.9.0
Content-Length:  0


  == DTLS ECDH initialized (automatic), faster PFS enabled
    -- Executing [+103226398775@teams:1] NoOp("PJSIP/teams-in-00000009", "PSTN") in new stack
    -- Executing [+103226398775@teams:2] Set("PJSIP/teams-in-00000009", "PJSIP_HEADER(add,CALLERID(ALL))= <sip:+10000000000>") in new stack
    -- Executing [+103226398775@teams:3] NoOp("PJSIP/teams-in-00000009", "+103226398775") in new stack
    -- Executing [+103226398775@teams:4] NoOp("PJSIP/teams-in-00000009", ""Hisham Ahmad Jan" <+10000000000>") in new stack
    -- Executing [+103226398775@teams:5] Answer("PJSIP/teams-in-00000009", "") in new stack
       > 0x7f5c6c0c1280 -- Strict RTP learning after remote address set to: 52.115.160.30:51484
<--- Transmitting SIP response (1540 bytes) to TLS:52.114.148.0:29381 --->
SIP/2.0 200 OK
Via: SIP/2.0/TLS 52.114.148.0:5061;rport=29381;received=52.114.148.0;branch=z9hG4bK514034db
Record-Route: <sip:sip-du-a-us.pstnhub.microsoft.com:5061;transport=tls;lr>
Call-ID: 8fad891962f159da9064b52bcea17f51
From: "Hisham Ahmad Jan" <sip:+10000000000;ext=4038@sip.pstnhub.microsoft.com;user=phone>;tag=10395f168fec4692b1e4f685412f328d
To: <sip:+103226398775@domain;user=phone>;tag=1dcba4ba-fc4f-4e50-a447-5a51b739dec7
CSeq: 1 INVITE
Server: Asterisk PBX 18.9.0
Contact: <sip:domain:5061;transport=TLS>
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 3600;refresher=uac
Require: timer
Content-Type: application/sdp
Content-Length:   718

v=0
o=- 11149 2 IN IP4 199.96.222.145
s=Asterisk
c=IN IP4 199.96.222.145
t=0 0
a=msid-semantic:WMS *
m=audio 27564 RTP/SAVP 0 8 101
a=connection:new
a=setup:actpass
a=fingerprint:SHA-256 CF:51:CB:20:6C:4B:03:2F:82:E3:96:CB:6A:FB:31:9F:36:5C:3D:65:5A:15:60:23:D2:FC:D6:34:DB:DB:0F:2D
a=ice-ufrag:3b05fb7f3fd02c1d00bd465113a4bb26
a=ice-pwd:00fb1931674f5dcf462429f024c96f82
a=candidate:Hc760de91 1 UDP 2130706431 199.96.222.145 27564 typ host
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv
a=rtcp-mux
a=msid:2eb7aef4-21b4-4dfc-b739-b8e243e4a1db 8511326c-d825-4d34-be40-4cea8575ec6e
a=rtcp-fb:* transport-cc
a=mid:1

<--- Received SIP request (720 bytes) from TLS:52.114.148.0:29381 --->
ACK sip:domain:5061;transport=TLS SIP/2.0
FROM: "Hisham Ahmad Jan"<sip:+10000000000;ext=4038@sip.pstnhub.microsoft.com:5061;user=phone>;tag=10395f168fec4692b1e4f685412f328d
TO: <sip:+103226398775@domain>;user=phone;tag=1dcba4ba-fc4f-4e50-a447-5a51b739dec7
CSEQ: 1 ACK
CALL-ID: 8fad891962f159da9064b52bcea17f51
MAX-FORWARDS: 70
VIA: SIP/2.0/TLS 52.114.148.0:5061;branch=z9hG4bK31c48f2d
CONTACT: <sip:api-du-a-jaea.pstnhub.microsoft.com:443;x-i=8a2869a7-c958-4120-b13d-4ab93a71a257;x-c=8fad891962f159da9064b52bcea17f51/d/8/e5782412e3af4af0932fc68d48f71417>
CONTENT-LENGTH: 0
USER-AGENT: Microsoft.PSTNHub.SIPProxy v.2024.4.11.1 i.USWE2.14
ALLOW: INVITE,ACK,OPTIONS,CANCEL,BYE,NOTIFY


       > 0x7f5c6c0c1280 -- Strict RTP learning after ICE completion
<--- Received SIP request (996 bytes) from TLS:52.114.148.0:29390 --->
BYE sip:domain:5061;transport=TLS SIP/2.0
FROM: "Hisham Ahmad Jan"<sip:+10000000000;ext=4038@sip.pstnhub.microsoft.com:5061;user=phone>;tag=10395f168fec4692b1e4f685412f328d
TO: <sip:+103226398775@domain>;user=phone;tag=1dcba4ba-fc4f-4e50-a447-5a51b739dec7
CSEQ: 2 BYE
CALL-ID: 8fad891962f159da9064b52bcea17f51
MAX-FORWARDS: 70
VIA: SIP/2.0/TLS 52.114.148.0:5061;branch=z9hG4bKd8f8996f
REASON: Q.850;cause=79;text="8a2869a7-c958-4120-b13d-4ab93a71a257;InternalDiagCode: UnrecognizedTransportProfile, InternalErrorPhrase: Transport profile is not recognized or not compatible"
CONTACT: <sip:api-du-a-jaea.pstnhub.microsoft.com:443;x-i=8a2869a7-c958-4120-b13d-4ab93a71a257;x-c=8fad891962f159da9064b52bcea17f51/d/8/e5782412e3af4af0932fc68d48f71417>
CONTENT-LENGTH: 0
USER-AGENT: Microsoft.PSTNHub.SIPProxy v.2024.4.11.1 i.USWE2.14
ALLOW: INVITE,ACK,OPTIONS,CANCEL,BYE,NOTIFY
P-ASSERTED-IDENTITY: <tel:+10000000000;ext=4038>,<sip:hjan@domain>
PRIVACY: id


<--- Transmitting SIP response (441 bytes) to TLS:52.114.148.0:29390 --->
SIP/2.0 200 OK
Via: SIP/2.0/TLS 52.114.148.0:5061;rport=29390;received=52.114.148.0;branch=z9hG4bKd8f8996f
Call-ID: 8fad891962f159da9064b52bcea17f51
From: "Hisham Ahmad Jan" <sip:+10000000000;ext=4038@sip.pstnhub.microsoft.com;user=phone>;tag=10395f168fec4692b1e4f685412f328d
To: <sip:+103226398775@domain>;tag=1dcba4ba-fc4f-4e50-a447-5a51b739dec7;user=phone
CSeq: 2 BYE
Server: Asterisk PBX 18.9.0
Content-Length:  0


  == Spawn extension (teams, +103226398775, 5) exited non-zero on 'PJSIP/teams-in-00000009'
<--- Received SIP request (536 bytes) from UDP:192.168.70.111:5060 --->
OPTIONS sip:199.96.222.145 SIP/2.0
Via: SIP/2.0/UDP 192.168.70.111:5060;branch=z9hG4bK5d332c4a;rport
Max-Forwards: 70
From: "asterisk" <sip:asterisk@192.168.70.111>;tag=as63fdff7d
To: <sip:199.96.222.145>
Contact: <sip:asterisk@192.168.70.111:5060>
Call-ID: 53ab483b256649086df3ac250adb5240@192.168.70.111:5060
CSeq: 102 OPTIONS
User-Agent: I2c-PBX
Date: Sun, 21 Apr 2024 13:38:46 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


<--- Transmitting SIP response (839 bytes) to UDP:192.168.70.111:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.70.111:5060;rport=5060;received=192.168.70.111;branch=z9hG4bK5d332c4a
Call-ID: 53ab483b256649086df3ac250adb5240@192.168.70.111:5060
From: "asterisk" <sip:asterisk@192.168.70.111>;tag=as63fdff7d
To: <sip:199.96.222.145>;tag=z9hG4bK5d332c4a
CSeq: 102 OPTIONS
Accept: application/xpidf+xml, application/cpim-pidf+xml, application/dialog-info+xml, application/simple-message-summary, application/pidf+xml, application/pidf+xml, application/dialog-info+xml, application/simple-message-summary, application/sdp, message/sipfrag;version=2.0
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Accept-Encoding: identity
Accept-Language: en
Server: Asterisk PBX 18.9.0
Content-Length:  0


<--- Transmitting SIP request (482 bytes) to TLS:52.114.132.46:5061 --->
OPTIONS sip:sip.pstnhub.microsoft.com SIP/2.0
Via: SIP/2.0/TLS domain:5061;rport;branch=z9hG4bKPj6c934cc6-4258-4a2f-a62c-5f816b54fb67;alias
From: <sip:teams-out@domain>;tag=6c5b84f4-764c-4360-be02-dfa561955b71
To: <sip:sip.pstnhub.microsoft.com>
Contact: <sip:teams-out@domain:5061;transport=TLS>
Call-ID: 43e05b88-9192-433c-be0a-05d8ac7bafda
CSeq: 35163 OPTIONS
Max-Forwards: 70
User-Agent: Asterisk PBX 18.9.0
Content-Length:  0


<--- Received SIP response (433 bytes) from TLS:52.114.132.46:5061 --->
SIP/2.0 200 OK
FROM: <sip:teams-out@domain>;tag=6c5b84f4-764c-4360-be02-dfa561955b71
TO: <sip:sip.pstnhub.microsoft.com>
CSEQ: 35163 OPTIONS
CALL-ID: 43e05b88-9192-433c-be0a-05d8ac7bafda
VIA: SIP/2.0/TLS domain:5061;branch=z9hG4bKPj6c934cc6-4258-4a2f-a62c-5f816b54fb67;rport
CONTENT-LENGTH: 0
ALLOW: INVITE,ACK,OPTIONS,CANCEL,BYE,NOTIFY
SERVER: Microsoft.PSTNHub.SIPProxy v.2024.4.11.1 i.USEA.13


<--- Received SIP request (531 bytes) from TLS:52.114.132.46:23507 --->
OPTIONS sip:teams-out@domain:5061;transport=TLS SIP/2.0
FROM: <sip:sip-du-a-us.pstnhub.microsoft.com:5061>;tag=b8a1792c-7792-4d97-abef-85e56d0b1372
TO: <sip:teams-out@domain>
CSEQ: 1 OPTIONS
CALL-ID: 3db35368-4d6a-46e8-a48d-ad37b4a47fa3
MAX-FORWARDS: 70
VIA: SIP/2.0/TLS 52.114.132.46:5061;branch=z9hG4bK6519ff43
CONTACT: <sip:sip-du-a-us.pstnhub.microsoft.com:5061>
CONTENT-LENGTH: 0
USER-AGENT: Microsoft.PSTNHub.SIPProxy v.2024.4.11.1 i.USEA.13
ALLOW: INVITE,ACK,OPTIONS,CANCEL,BYE,NOTIFY


<--- Transmitting SIP response (860 bytes) to TLS:52.114.132.46:23507 --->
SIP/2.0 200 OK
Via: SIP/2.0/TLS 52.114.132.46:5061;rport=23507;received=52.114.132.46;branch=z9hG4bK6519ff43
Call-ID: 3db35368-4d6a-46e8-a48d-ad37b4a47fa3
From: <sip:sip-du-a-us.pstnhub.microsoft.com>;tag=b8a1792c-7792-4d97-abef-85e56d0b1372
To: <sip:teams-out@domain>;tag=z9hG4bK6519ff43
CSeq: 1 OPTIONS
Accept: application/xpidf+xml, application/cpim-pidf+xml, application/dialog-info+xml, application/simple-message-summary, application/pidf+xml, application/pidf+xml, application/dialog-info+xml, application/simple-message-summary, application/sdp, message/sipfrag;version=2.0
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Accept-Encoding: identity
Accept-Language: en
Server: Asterisk PBX 18.9.0
Content-Length:  0

I have redacted some info such as the domain name and my office UAN.

Hope this helps! :slight_smile:

Best,
Hisham

Asterisk is not sending an a=crypto line in its response. You may be missing a module.

Or the endpoint configuration is incorrect (I don’t see it provided anywhere here).

Hi, @david551 is right.
Comparing to a sip trace where there is a canonical SBC, crypto line is always present when SBC talks to Teams.
You need, first of all, adjust it.
Then try again.
Let me know.

Hi @david551 @spady7 @jcolp

Thank you guys for your time to review my sip trace

I have pasted the screenshot of my pjsip.conf file below where SDES is being used as the media encryption, thus (supposedly) sending a=crypto in the SDP as you suggested.

Also, I checked the modules (res_crypto.so and res_srtp.so) which are loaded and running successfully.

Could you please suggest if I should verify something else that could be causing the issue in principle?

Best,
Hisham

You have the “webrtc” option set for “teams-in” which will cause it to use DTLS-SRTP, as that is what is required for WebRTC. You have to remove it.

Worked like a charm!
Thanks a lot @jcolp :smiley: