What is a STUN/TURN Server?

Security Network

Photo Source: Pixabay · Interactive Powers Creative Commons.

WebRTC communications in real-world connectivity require to handle multi-party calls and interact with STUN and TURN servers.


Our Video Gateway (WebRTC) platform offers all customers an advanced video real-time communications solution through all audio/video/data streams are transmitted. Generally, a Video Gateway has to be deployed over a public Internet so any user must connect and send media fragments over RTP (Real-time Transport Protocol) ports without specific network issues.

STUN/TURN Server

Why you should require a STUN/TURN Server?

However, sometimes this is not enough. Some users try to connect through different IP networks where Firewalls and NATs (Network Address Translators) could include specific policies that do not allow any kind of RTC communications. ICE (Interactive Connectivity Establishment) protocol is used to find the best connection solution. It defines a systematic way of finding possible communication options between a peer and the Video Gateway (WebRTC).

What is a STUN Server?

Sometimes, you can use a protocol called STUN (Session Traversal Utilities for NAT) that allows clients to discover their public IP address and the type of NAT they are behind. This information is used to establish the media connection. In most cases, a STUN server is only used during the connection setup and once that session has been established, media will flow directly between the peer and the Video Gateway (WebRTC).

What is a TURN Server?

However, even if we setup properly a STUN server, there are very restrictive corporate networks (e.g: UDP traffic forbidden, only 443 TCP allowed…), which will require clients to use a TURN (Traversal Using Relays around NAT) server to relay traffic if direct (peer to Video Gateway) connection fails. In these cases, you can install our TURN server (in another instance) to solve these issues.

The TURN server is really easy to add for all your RTC developments, including it as another ICE server within the Video Gateway (WebRTC) connection array like this:

var endPoints = [
    "https://example.com:HTTPS_PORT/webrtc-gateway"
];
var iceServers = [
    {
        url: "stun:server:port"
    },
    {
        url: "turn:server", 
        username: "myuser", 
        credential: "******"
    }
];
var myVideoApp = new VideoRTC(endPoints, iceServers, debugLevel);
JavaScript

Feel free to reach out if you have any questions or comments bellow or just want to show off what kind of cool stuff you’ve built with our Video RTC solutions.

Email: support@ivrpowers.com · Twitter: @ivrpowers · Github: IVRPowers


Interactive Powers - Streamline your business communications

© 2024 Interactive Powers Published with Hugo