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.43k stars 436 forks source link

[Question] Using turns doesn't result in any candidate. And no IPv6 or TCP candidate support? #616

Closed SimonAJT closed 2 years ago

SimonAJT commented 2 years ago

Hi again! When using our TURN servers we set the URL in the RTCIceServer objects as the following:

List<RTCIceServer> concat = new List<RTCIceServer>();
foreach (var turnServer in response.TurnServers)
{
    foreach (var url in turnServer.Urls)
    {
        concat.Add(new RTCIceServer
        {
            urls = url, // turns:secret.com:port?transport=tcp or ?transport=udp
            username = turnServer.Username,
            credential = turnServer.Password,
        });
    }
}
foreach (var stunServer in response.StunServers)
{
    foreach (var url in stunServer.Urls)
    {
        concat.Add(new RTCIceServer { urls = url });
    }
}
RTCConfiguration peerConnectionConfig = new RTCConfiguration
{
    iceServers = concat,
    X_ICEIncludeAllInterfaceAddresses = true,
    bundlePolicy = RTCBundlePolicy.max_bundle,
    iceTransportPolicy = RTCIceTransportPolicy.all,
};
var peerConnection = new RTCPeerConnection(peerConnectionConfig);

Which doesn't result in the peer connection generating any ICE Candidates from the RTCPeerConnection. However, if we replace the leading turns: with turn: in the TURN-server URLs we start getting relay candidates which we can use and connect with.

Is there no support for the TURNS protocol at the moment?

Also is it possible to generate IPv6 candidates? At the moment only IPv4 candidates are generated. When using GStreamer the IPv6 candidates are generated in addition to the IPv4 candidates. We also only get UDP candidates, but this might be another issue.

We are using SIPSorcery version 5.2.3

Thank you!

sipsorcery commented 2 years ago

Sorry, missed this issue.

There is no TURNS, TURN over TCP or TURN with IPv6 support in this library. Or to put it another way the only supported option is TURN over IPv4 and UDP.

The only reason that's the case is time and effort. Last year I had a reasonably sized block of time to work on this project and focused on getting a minimal WebRTC end-to-end connection working + datachannels + rudimentary audio/video encoding + Windows audio/video device integration etc. That time ran out and while it would be nice to go back and fill in some of the missing pieces, such as better TURN support, I won't be in a position to do so in the near future.

Terricide commented 2 years ago

Thanks again for the webrtc end to end datachannel support :)

SimonAJT commented 2 years ago

Thank you for the response! Good to know!