The FQDN must be in the Contact of the OPTIONS request that is used for the trunk keep alive. No need to mess up with the Contact header for in dialog requests/replies.
However, the FQDN must be in the Record-Route header facing MS for in dialog requests/replies.

Regards,
Ovidiu Sas

On Fri, Apr 10, 2020 at 12:59 Karsten Horsmann <khorsmann@gmail.com> wrote:
Hi,

Like in Hennings howto described if the front facing Kamailio used the FQDN names in contact and so one it works. 

And the "must be an certified sbc" is an marketing foo and for support cases they can say "go-to your sbc vendor" imho. 

I had this setup up and running. 

Kind regards 
Karsten Horsmann 

Sergiu Pojoga <pojogas@gmail.com> schrieb am Fr., 10. Apr. 2020, 18:27:
Contact: <sip:KAMAILIO_IP;line=sr-DHZToOtmMdn7MODy9AnmD10TGLpUrL4noJCE4A03DdQE9LUaMXr*> 

Again, MS says it expects FQDN in Contact. 

If you are re-writing the Contact received from ENDPOINT_BEHIND_KAMAILIO_IP, then I suggest you don't, it's sufficient to have FQDN in RR. This isn't a "[certified] SBC", if it was like MS says - it shouldn't work at all with a proxy like Kamailio.

On Fri, Apr 10, 2020 at 12:00 PM Sergiu Pojoga <pojogas@gmail.com> wrote:
You're likely referring to this:
Priority 1. Top-level Record-Route. If the top-level Record-Route contains the FQDN name or IP, the FQDN name or IP is used to make the outbound in-dialog connection.

Like with many Microsoft products, nobody knows precisely what they expect. To make matters worse - they don't reply back suggesting what's wrong, no tools on their side to troubleshoot.

Regardless, why do you have 3 RRs of Kamailio? Fix the RRs, try again, or don't, it's up to you.

Good luck.

--Sergiu
 

On Fri, Apr 10, 2020 at 11:42 AM Aidar Kamalov <aidar.kamalov@gmail.com> wrote:
I thought they look only at first RR field?

пт, 10 апр. 2020 г. в 17:03, Sergiu Pojoga <pojogas@gmail.com>:
You have too many RR of Kamailio, x1 FQDN, x3 IP. Why?

IMO, you should have only 2 of Kamailio, if you're doing transport conversion. Both FQDNs + ";r2=on". MS clearly says FQDN everywhere, no IP, especially RR

On Fri, Apr 10, 2020 at 7:06 AM Aidar Kamalov <aidar.kamalov@gmail.com> wrote:
Thanks for the answer, I have disabled forse_rport() for Teams side, responses now going to address in Via header, but it is not resolved my issue, no ACK from Teams :(

чт, 9 апр. 2020 г. в 18:22, Sergiu Pojoga <pojogas@gmail.com>:
Hi Aydar,

Request from MS proxy has  VIA: SIP/2.0/TLS 52.114.7.24:5061, that's where your reply should go. You're sending to 52.114.7.24:1024 instead?

Also, looks like you're missing "r2=on" on the other RR, only one has it.

Cheers,

On Thu, Apr 9, 2020 at 11:09 AM Aidar Kamalov <aidar.kamalov@gmail.com> wrote:
Hello,

I read https://skalatan.de/en/blog/kamailio-sbc-teams and trying to use kamailio for teams.
But I faced that MS not responding ACK to my 200OK. Somethin is wrong, but I don't know what. I call from teams to kamailio.
Can you help me please

This is initial INVITE from Teams:
2020/04/09 22:55:17.346092 52.114.7.24:1024 -> KAMAILIO_IP:5061
INVITE sip:+xxxxxxxxx@MY_KAMAILIO_FQDN:5061;user=phone;transport=tls SIP/2.0
FROM: Aidar Kamalov<sip:+xxxxxxxxx@sip.pstnhub.microsoft.com:5061;user=phone>;tag=de28a5b5333b451a97312097f91f5564
TO: <sip:xxxxxxxx@MY_KAMAILIO_FQDN:5061;user=phone>
CSEQ: 1 INVITE
CALL-ID: 3d5ad3cdd01457be94d127fa20478cf1
MAX-FORWARDS: 70
VIA: SIP/2.0/TLS 52.114.7.24:5061;branch=z9hG4bKdb903e2c
RECORD-ROUTE: <sip:sip-du-a-as.pstnhub.microsoft.com:5061;transport=tls;lr>
CONTACT: <sip:api-du-a-euno.pstnhub.microsoft.com:443;x-i=903eeaac-b19e-43a0-8e75-bb222049922a;x-c=3d5ad3cdd01457be94d127fa20478cf1/d/8/d3d2c2e3f3c14f88bb2fe843b4bc70e4>
CONTENT-LENGTH: 2426
USER-AGENT: Microsoft.PSTNHub.SIPProxy v.2020.4.4.3 i.ASEA.5
CONTENT-TYPE: application/sdp
ALLOW: INVITE,ACK,OPTIONS,CANCEL,BYE,NOTIFY

v=0
o=- 0 0 IN IP4 52.114.252.146
s=session
c=IN IP4 52.114.252.146
b=CT:50000
t=0 0
m=audio 52939 RTP/SAVP 104 9 111 18 0 8 103 97 13 118 119 101
a=rtcp:52925
a=ice-ufrag:rKBm
a=ice-pwd:BkjUnkfIvYV5pjteSteevL1O
a=rtcp-mux
a=candidate:4 1 UDP 184547839 52.114.252.146 52939 typ relay raddr 31.13.144.55 rport 57780
a=candidate:4 2 UDP 184547326 52.114.252.146 52925 typ relay raddr 31.13.144.55 rport 57781
a=candidate:1 1 tcp-act 2121006590 100.78.247.179 1024 typ host
a=candidate:1 2 tcp-act 2121006590 100.78.247.179 1024 typ host
a=candidate:2 1 UDP 2130705919 100.78.247.179 39182 typ host
a=candidate:2 2 UDP 2130705406 100.78.247.179 39183 typ host
a=candidate:3 1 UDP 1694497791 31.13.144.55 57780 typ srflx raddr 100.78.247.179 rport 39182
a=candidate:3 2 UDP 1694497278 31.13.144.55 57781 typ srflx raddr 100.78.247.179 rport 39183
a=candidate:5 1 tcp-act 1684796926 31.13.144.55 9761 typ srflx raddr 100.78.247.179 rport 41775
a=candidate:5 2 tcp-act 1684796926 31.13.144.55 9761 typ srflx raddr 100.78.247.179 rport 41775
a=candidate:6 1 tcp-pass 174453758 52.114.252.130 59925 typ relay raddr 31.13.144.55 rport 9761
a=candidate:6 2 tcp-pass 174453758 52.114.252.130 59925 typ relay raddr 31.13.144.55 rport 9761
a=candidate:7 1 tcp-act 174846462 52.114.252.130 59925 typ relay raddr 31.13.144.55 rport 9761
a=candidate:7 2 tcp-act 174846462 52.114.252.130 59925 typ relay raddr 31.13.144.55 rport 9761
a=x-candidate-info:4 network-type=WWAN
a=x-candidate-info:1 network-type=WWAN
a=x-candidate-info:2 network-type=WWAN
a=x-candidate-info:3 network-type=WWAN
a=x-candidate-info:5 network-type=WWAN
a=x-candidate-info:6 network-type=WWAN
a=x-candidate-info:7 network-type=WWAN
a=crypto:1 AES_CM_128_HMAC_SHA1_32 inline:DY3r3DWRojJm94CJQ83OAavmlRCwPf5ciRxHCT40|2^31
a=crypto:2 AES_CM_128_HMAC_SHA1_80 inline:DY3r3DWRojJm94CJQ83OAavmlRCwPf5ciRxHCT40|2^31
a=crypto:3 AES_CM_128_HMAC_SHA1_80 inline:DY3r3DWRojJm94CJQ83OAavmlRCwPf5ciRxHCT40|2^31|1:1
a=rtpmap:104 SILK/16000
a=fmtp:104 useinbandfec=1; usedtx=0
a=rtpmap:9 G722/8000
a=rtpmap:111 SIREN/16000
a=fmtp:111 bitrate=16000
a=rtpmap:18 G729/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:103 SILK/8000
a=fmtp:103 useinbandfec=1; usedtx=0
a=rtpmap:97 RED/8000
a=rtpmap:13 CN/8000
a=rtpmap:118 CN/16000
a=rtpmap:119 CN/24000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:200



and my 200OK to MS is:

2020/04/09 22:55:19.976427 KAMAILIO_IP:5061 -> 52.114.7.24:1024
SIP/2.0 200 OK
Record-Route: <sip:KAMAILIO_FQDN_DOMAIN:5061;transport=tls;ftag=de28a5b5333b451a97312097f91f5564;lr=on>
Record-Route: <sip:KAMAILIO_IP:5060;ftag=de28a5b5333b451a97312097f91f5564;lr=on>
Via: SIP/2.0/TLS 52.114.7.24:5061;rport=1024;branch=z9hG4bKdb903e2c
Record-Route: <sip:ENDPOINT_BEHIND_KAMAILIO_IP;line=sr-QyfKA15Kw1rKw1hKEoPljM0oE1VLX10RQ1VLX10gkY37WJufE1BBjJhVE6E6r14VEJ5Nj6ElE1UNjyrNEJrVjnr.AyudmMV1rg52rJrlAyNBkMVNmSE*>
Record-Route: <sip:ENDPOINT_BEHIND_KAMAILIO_IP;r2=on;lr=on;ftag=de28a5b5333b451a97312097f91f5564;did=cba.af1;nat=yes>
Record-Route: <sip:KAMAILIO_IP;r2=on;lr=on;ftag=de28a5b5333b451a97312097f91f5564;did=cba.42a1;nat=yes>
Record-Route: <sip:KAMAILIO_IP:5061;transport=tls;r2=on;lr=on;ftag=de28a5b5333b451a97312097f91f5564;did=cba.42a1;nat=yes>
Record-Route: <sip:sip-du-a-as.pstnhub.microsoft.com:5061;transport=tls;lr>
To: <sip:+xxxxxxxxxx@KAMAILIO_FQDN_DOMAIN:5061;user=phone>;tag=3795432917-393759697
From: <sip:+xxxxxxxxxx@sip.pstnhub.microsoft.com:5061;user=phone>;tag=de28a5b5333b451a97312097f91f5564
Call-ID: 3d5ad3cdd01457be94d127fa20478cf1
CSeq: 1 INVITE
Allow: PUBLISH,MESSAGE,UPDATE,PRACK,SUBSCRIBE,REFER,INFO,NOTIFY,REGISTER,OPTIONS,BYE,INVITE,ACK,CANCEL
Content-Type: application/sdp
Accept: application/sdp
Content-Length: 282
User-Agent: MY_DOMAIN
Contact: <sip:KAMAILIO_IP;line=sr-DHZToOtmMdn7MODy9AnmD10TGLpUrL4noJCE4A03DdQE9LUaMXr*>

v=0
o=ETPI-MSX1 0 0 IN IP4 KAMAILIO_IP
s=sip call
c=IN IP4 KAMAILIO_IP
t=0 0
m=audio 12176 RTP/SAVP 8
b=AS:64
a=maxptime:20
a=rtpmap:8 PCMA/8000
a=sendrecv
a=rtcp:12177
a=crypto:1 AES_CM_128_HMAC_SHA1_32 inline:03ZmcR+CxxB7k7C8QvWBgseYq7cH7py7VxqfLM8j
a=ptime:20


--
Aydar A. Kamalov
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


--
Aydar A. Kamalov
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


--
Aydar A. Kamalov
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
--
VoIP Embedded, Inc.
http://www.voipembedded.com