[Freeswitch-users] Microsoft Teams integration

Stefan Kainz s.kainz at wnt.at
Thu Oct 1 14:20:52 UTC 2020


Ok, then i might have found whats causing all my problems.
Would you happen to know how I achive this in freeswitch?

Ive tried a couple of things already, but none seem to work.
The gateway has “contact-host” set correctly, I also tried sip_contact_host …

Thank you very much!

Regards,

From: David Horton <daveh at drachtio.org>
Sent: Donnerstag, 1. Oktober 2020 14:20
To: Stefan Kainz <s.kainz at wnt.at>
Cc: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org>
Subject: Re: [Freeswitch-users] Microsoft Teams integration

Yes, you must have a domain in the Contact header.  That’s another ridiculous requirement Microsoft came up with for this integration...

On Oct 1, 2020, at 1:30 AM, Stefan Kainz <s.kainz at wnt.at<mailto:s.kainz at wnt.at>> wrote:

Im following your advice now, and dont add record-route headers.
Im trying an outbound call ( teams -> pstn ) and it disconnects soon after freeswitch sends the OK.

Here is the OK:

send 1695 bytes to tls/[52.114.75.24]:10176 at 07:12:26.210854:
------------------------------------------------------------------------
SIP/2.0 200 OK
Via: SIP/2.0/TLS 52.114.75.24:5061;branch=z9hG4bKbc16542e;rport=10176
Record-Route: <sip:sip-du-a-eu.pstnhub.microsoft.com:5061;transport=tls;lr>
FROM: Stefan Kainz<sip:+FROMNUMBER at sip.pstnhub.microsoft.com:5061;user=phone>;tag=b88e3a220f48472cb452fec5fe46579e
To: <sip:+TONUMBER at xxx.example.at:5061;user=phone>;tag=9FFZm2y4cBmrS
CALL-ID: 6a933a0ac454552081ca931b3daf42de
CSEQ: 1 INVITE
Contact: <sip:+TONUMBER at xxx.xxx.xxx.xxx:5061;transport=tls>
User-Agent: TTG01 1.0
Accept: application/sdp
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, NOTIFY
Require: timer
Supported: timer, path, replaces
Allow-Events: talk, hold, conference, refer
Session-Expires: 3600;refresher=uac
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 801
P-Asserted-Identity: "+TONUMBER" <sip:+TONUMBER at xxx.example.at>

v=0
o=FreeSWITCH 1601512094 1601512095 IN IP4 xxx.xxx.xxx.xxx
s=FreeSWITCH
c=IN IP4 xxx.xxx.xxx.xxx
t=0 0
a=msid-semantic: WMS pGvDw5lMt7NEFur7TOXy5dyI4XJtq8cF
m=audio 17052 RTP/SAVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=rtcp-mux
a=rtcp:17052 IN IP4 xxx.xxx.xxx.xxx
a=ice-ufrag:czL8C9GwWgQdfSIK
a=ice-pwd:gICzT6c1eiFHGhUJGvI8vevi
a=candidate:2023834489 1 udp 659136 xxx.xxx.xxx.xxx 17052 typ host generation 0
a=end-of-candidates
a=ssrc:1804998514 cname:Fy91tlEMiigNDyLm
a=ssrc:1804998514 msid:pGvDw5lMt7NEFur7TOXy5dyI4XJtq8cF a0
a=ssrc:1804998514 mslabel:pGvDw5lMt7NEFur7TOXy5dyI4XJtq8cF
a=ssrc:1804998514 label:pGvDw5lMt7NEFur7TOXy5dyI4XJtq8cFa0
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:aoXrZjxmNQmdkxShUkmMO526J+5laS1UL8ZWiKyS

I compared it with your examples, and noticed that i have an ip-address in contact-header, you on the other hand have a domain.
Do you think that could be the problem?

regards,


________________________________
Von: David Horton <daveh at drachtio.org<mailto:daveh at drachtio.org>>
Gesendet: Mittwoch, 23. September 2020 19:24
An: Stefan Kainz <s.kainz at wnt.at<mailto:s.kainz at wnt.at>>
Cc: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org<mailto:freeswitch-users at lists.freeswitch.org>>
Betreff: Re: [Freeswitch-users] Microsoft Teams integration

In my implementation I am using a drachtio server (https://drachtio<https://drachtio/>.org), more specifically configured as part of the jambonz CPaaS platform I build (https://docs.jambonz.org/teams/)

A Record-Route header only makes sense if you are creating a sip proxy, AFAIC.  In my implementation I built a B2BUA so on requests I send to Teams there is no RR.  Of course, on responses I preserve their RR headers.

For your scenario, I think I passed on the trace but just in case here is a link to it again: https://gist.github.com/davehorton/9ea3d79e8eeda3cbb5e2e87209dcfe63

One question: for the domain you are putting in the Contact header of your 200 OK response, does that resolve to a single server or multiple?  I have found in the latter case Teams will gladly send a mid-call request to a different server that heretofore was not involved in the call at all.  On the server that initially handled the call, it will simply look like Teams is not being responsive..

Dave

On Sep 23, 2020, at 3:56 AM, Stefan Kainz <s.kainz at wnt.at<mailto:s.kainz at wnt.at>> wrote:

Thank you for your Answer!

May I ask what kind of SBC you are using?
We also use Audiocodes SBC’s, which are working great, but even those send Record-Route Headers.

Maybe I need to explain the szenario a little better…
In the teams client I dial an external number ( my mobile phone for example )
I pick up, and then push hold in the teams client. ( So far so good )
When I try to unhold, of course also in teams, it becomes silent on both ends. ( even the moh stops )

And then as I said I see a few OK Messages being retransmitted to the Microsoft servers.

Its funny that you say you don’t need Record-Route Headers at all, because without setting those, I cant even make incoming calls work.
With those headers, everything works perfectly except for the thing explained above.
Even when trying to get incoming calls back from hold on teams. ( PSTN – freeswitch – teams, hold / unhold on teams )

I also found a tutorial from kamailio on how to connect it to teams.
There they also state that the record-route headers a needed.
https://skalatan.de/en/blog/kamailio-sbc-teams

Thank you again David!

Regards,
Stefan


From: David Horton <daveh at drachtio.org<mailto:daveh at drachtio.org>>
Sent: Montag, 21. September 2020 22:36
To: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org<mailto:freeswitch-users at lists.freeswitch.org>>
Cc: Stefan Kainz <s.kainz at wnt.at<mailto:s.kainz at wnt.at>>
Subject: Re: [Freeswitch-users] Microsoft Teams integration

It has not been my experience that Microsoft Teams direct routing requires a Record-Route header on requests / responses you send to it (though their requests will have an RR and you must Route accordingly)

Here is a sip trace showing a successful on-hold / off-hold scenario from one of my servers (not a freeswitch server).  This is an on-hold triggered from the MS teams client, not sure if you are trying to do the reverse.

One thing: make sure the Contact header in your INVITEs resolve to a single server, otherwise (if you have mutiple A records for the DNS name) you will find that MS Teams will gladly respond to a reINVITE to a completely different server than you sent from — this will manifest as not seeing the 200 OK to a re-INVITE you send, or not seeing the ACK when you respond 200 OK to a re-INVITE.

daveh

One thing to make sure of is that

On Sep 20, 2020, at 12:05 PM, Stefan Kainz <s.kainz at wnt.at<mailto:s.kainz at wnt.at>> wrote:

Hello,

we're trying to use Freeswitch as a Microsoft Teams direct routing SBC.

So far everything works perfectly, except getting the call back from hold on an outbound call.
The Problem is that Microsoft expects a Record-Route Header in every Request and every Response.
I have been able to set/rewrite this Record-Route header with sip_h_ and sip_rh_ in most szenarios, but like i said - unhold on an outgoing call does not work.

The hold is initiated with a reinvite with a=inactive in sdp, which does work.
However, the unhold - also a reinvite with a=sendrecv in sdp does not work correctly.
In the sip-trace i see that the OK ( in response to the INVITE for unhold ) gets retransmitted a couple of times, because the ACK from microsoft isn't received.

This is due to the missing Record-Route Header in the OK Message.
I have seen this behavior on inbound calls too, when i didnt set the Record-Route Header.

Now my question:
Is there any way to add the Record-Route Header to every Message on a sip-profile or gateway?
Or if not, is it possible to handle a reinvite in dialplan so i could set the header manually?
Maybe there is somebody who already has this working that could point me in the right direction.

I know freeswitch isn't a SBC, but it would be nice to be able to use freeswitch as a Teams-SBC without Kamailio or something similar.

Any help is very much appreciated 🙂

regards,
Stefan







_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com<https://signalwire.com/>
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community<https://signalwire.community/>

Professional FreeSWITCH Services
sales at freeswitch.com<mailto:sales at freeswitch.com>
https://freeswitch.com<https://freeswitch.com/>

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com<https://cluecon.com/>

FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org<mailto:FreeSWITCH-users at lists.freeswitch.org>
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com<https://freeswitch.com/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20201001/0c67234f/attachment-0001.html>


More information about the FreeSWITCH-users mailing list