WebRTC-Experiment icon indicating copy to clipboard operation
WebRTC-Experiment copied to clipboard

We really need TURN server or STUN server to get video conferencing code efficiently worked on internet?

Open tusharkadam opened this issue 11 years ago • 5 comments

Dear Mauz Khan,

    https://github.com/webRTC/webrtc.io-demo     
    I have used above code for video conferencing and text chatting but I have not used any TURN or STUN server but still I can able to make connection for video calling between two user on internet but the video clarity is worst and some times it gets halt (when I use bandwidth limitation as You have implemented in your experiments also , I dont think its a bandwidth issue).
    But on LAN it works fine for three users. Please need help whether i need to implement TURN or STUN server? If yes how to setup STUN or TURN server as I don't want to use googles STUN or TURN server .
     I have implemented exact above code from github. Any suggestion also goint to help me a lot.

Regards,

Tushar K.

tusharkadam avatar Aug 01 '13 14:08 tusharkadam

The key difference between these two types of solutions though is that media will travel directly between both endpoints if STUN is used, whereas media will be proxied through the server if TURN is utilized.

I prefer TURN because it is capable to traverse symmetric NATs too. However, STUN is useful to speedup the connection out of getting immediate candidates when users are sitting behind same NAT e.g. LAN.

A media relay server or ICE server is utilized to setup the media session and provide the list of potential candidates to both parties in a call regardless of which media delivery option is selected for each end of the call.

Also understand that the media stream may not always use the same solution on both ends as STUN may be possible for one endpoint but not for the other endpoint.

When we use both STUN and TURN servers; STUN is always attempted first; TURN is used as fallback option depending on client locations and network topologies.

var iceServers = {
     iceServers: [STUN, TURN]
};

TURN protocol runs top of STUN to setup a relay service. A well written TURN server will also function as STUN; so you can skip a "separate STUN server" option in such case.

TURN is developed to cover holes haven't (or may not) punched by the STUN; e.g. SNATs i.e. Symmetric NATs.

A critical disadvantage of a TURN server is its cost; and huge bandwidth usage in case when HD video stream is delivered.

If you wanna install your own TURN server; there is a BSD-licensed open source TURN/STUN server (in C language) with all the latest RFCs here: http://code.google.com/p/rfc5766-turn-server/

Windows-based (.NET/C#) developers can try OfficeSIP's TURN server.

The acronym STUN may also be seen referred to as Simple Traversal of UDP through NAT which was the protocol’s original name (as defined in now obsolete RFC 3489).

When the protocol was updated to include support for TCP the name was changed to Session Traversal Utilities for NAT to reflect that it was no longer limited to UDP traffic.

Although media leveraging STUN is not a direct host-to-host session it is the next best option as the media path is still sent directly between the two client’s own firewalls, over the Internet.

This keeps the media session as short as possible and does not burden the corporate network with handling the media relay processing or bandwidth.

There are three types of candidates:

  1. Local (or Host candidates) — the actual IP address bound directly to the remote client’s host operating system. It is "highest preferred" candidate option; and attempted first.
  2. Reflexive (STUN) — the public IP address assigned to the client’s immediate firewall perform network address translation. It is "next preferred" candidate option.
  3. Relay (TURN) — the publically accessible IP address assigned to the media relay server which is allocated to the client. If STUN fails; the final option is "relay candidates".

muaz-khan avatar Aug 02 '13 10:08 muaz-khan

I have installed Windows-based (.NET/C#) OfficeSIP's TURN server. it has been installed as service I want to get/set TURN url, username, password to use in WebRTC peer connection. I dont find a way to obtain the same. is there a way to get it?

amiteshawa avatar Sep 17 '13 19:09 amiteshawa

I'm too facing the problem.How to use this @amiteshawa @muaz-khan

RamyaAshika avatar Nov 12 '18 05:11 RamyaAshika

Here explain why is necessary a stun/turn server

https://blog.mgechev.com/2014/12/26/multi-user-video-conference-webrtc-angularjs-yeoman/

@muaz-khan say me, in my tests I see that key difference between stun and turn is authenticated and the other not.

IgorDePaula avatar Nov 12 '18 17:11 IgorDePaula

how to use [OfficeSIP's TURN server]? i run it but i dont know ip or port for it, i know im late

moeelbadri avatar Sep 08 '22 19:09 moeelbadri