sipsorcery-org / sipsorcery

A WebRTC, SIP and VoIP library for C# and .NET. Designed for real-time communications apps.
https://sipsorcery-org.github.io/sipsorcery
Other
1.42k stars 431 forks source link

WebRTC connection using a JWT token and custom domain #1043

Closed dk-infsys closed 7 months ago

dk-infsys commented 8 months ago

Hello, good sir! I'm new at communication protocols and I've been given the task to send audio via WebRTC to an automatic speech recognition AI and retrieve the text it parsed from it. The project should result in a C# desktop application, so I've tried getting aquainted with sipsorcery the last month and I have a question about a scenario that I haven't found in the examples: I want to create a WebRTC connection to a host server API, let's call it https://xxx.yyy.de, but on the domain de-DE-GENERIC, because multiple domains exist. There is also a TURN server URI given, and for authentication, I was given a JWT token that has already been created.

So my question(s): Is this possible using sipsorcery? If yes, how do I specify the domain and authenticate using the token? I cannot use a UserAgent, because they only work for SIP, right? Am I maybe even on the right track (no pun intended) thinking I have to create a RTCPeerConnection and directly communicate over that, using the token as a certificate in the RTCConfiguration?

OK, that was more questions than I planned. Thank you in advance!

sipsorcery commented 8 months ago

WebRTC does not use bearer token (JWT) authentication. It's not an HTTP protocol. Instead it uses a DTLS handshake and typically the client is anonymous.

Are you sure the AI endpoint supports WebRTC? If you've been given a JWT token it may be the endpoint just needs a HTTP, or other, stream of some kind.

There is a very basic example of using the Azure cognitive services for speech to text here but it does not have anything to do with WebRTC.

sipsorcery commented 7 months ago

Feel free to re-open if any further queries.