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

How to get the current connection type of WebRTC #1054

Closed Hu-Said closed 7 months ago

Hu-Said commented 7 months ago

I want to know when the WebRTC connection is successful, how do I know what the current connection mode is? Where can I get this information? image

sipsorcery commented 7 months ago

onconnectionstatechange sounds like what you need.

Hu-Said commented 7 months ago

onconnectionstatechange sounds like what you need.

No, this can only know his connection status. I want to know his connection mode, such as relay or host, or something else.

I want to know when the WebRTC connection is successful, how do I know what the current connection mode is? Where can I get this information? image

Just like the four in this screenshot, I want to know which mode is used after the connection is successful.

Hu-Said commented 7 months ago

I know there is a type in RTCIceCandidate to know this mode, but this is a collection, and I hope to accurately find the RTCIceCandidate type being used by the current connection.

sipsorcery commented 7 months ago

The RtpIceChannel has a NominatedEntry property that contains the local and remote ICE candidates that were used.

Hu-Said commented 7 months ago

The RtpIceChannel has a NominatedEntry property that contains the local and remote ICE candidates that were used.

Yes I see that and this does what I need, thanks for the reply!