TURN server is used to establish WebRTC connection and transmit media traffic when UDP exchange between client and server is blocked by firewall
There are the following ways to use TURN server with WCS server
1. Using external TURN server, This is suitable for customers with enterprise infrastructure and customers which prefer to separate task performed by servers.
2. Using internal TURN server that embedded to WCS. This is sutable for small office and customer which prefer out-of-the-box solutions.
Supported platforms and browsers
Using external TURN server
When external TURN server is used, traffic flows through available ports as follows:
Installing and configuring the TURN server on CentOS 7
1. Download and install turnserver
To compile from sources use the following guide.
2. Create the configuration file turnserver.conf
An example of the turnserver.conf.default configurationb file is in the /usr/local/etc directory. You can rename it to turnserver.conf or create a new file.
Below is an example of the minimum configuration file:
a) As seen from this example, operation of the TURN server requires a certificate and a private key.
If the TURN server is installed on the same server as the WCS server, you can use certificates of the WCS server.
If the TURN server is installed on another server, you can use openssl to generate a certificate and a private key:
b) REQUIRED: the configuration file of the TURN server must enable authorization, and users for authorization must be specified (the first three lines of the configuration file example).
3. Start turnserver
Connection using external TURN server
When you create a session using the Flashphoner API you need to pass the mediaOptions parameter where the coordinates of the TURN server are specified. Below is an example of creating such a session:
Using internal TURN server
When internal TURN server is used, traffic flows through available ports as follows:
Client browser establishes TCP connection to internal TURN server port (3478 by default), then internal TURN server connects to local WCS interface through UDP ports from specified range (36001-37000 by default). Thus, for client media traffic flows through TCP tunnel, and for WCS server nothing is changed, traffic flows via UDP ports.
The side effect is that all media traffic between client and server goes through TCP, this may seriously improve quality of HD translations with high bitrate.
Internal TURN server configuration
Internal TURN server should be set up using the following parameters in flashphoner.properties file:
|Internal TURN server IP address (by default is the same as ip)
|Internal TURN server local IP address used for port binding (by default is the same as ip_local)
|Internal TURN server TCP port
|Internal TURN server password (username is
|Beginning of media UDP ports range for WebRTC connection between TURN and WCS
|End of media UDP ports range
|Audit interval for busy and free ports, in milliseconds
|Number of audits to make sure freed port is not bound
|Receive buffer size in bytes
|Send buffer size in bytes
Connection using internal TURN server
When you create a session using the Flashphoner API you need to pass the mediaOptions parameter where the coordinates of the internal TURN server are specified:
If UDP ports are not blocked by firewall, browser may establish WebRTC connection through UDP. In this case,
"iceTransportPolicy": "relay" parameter should be set in
for media traffic go through TURN server.
Quick manual for testing
1. For test we use:
- WCS with active embedded TURN server
- Firewall Traversal Streaming web application in Chrome browser
- iptables to block UDP ports on server
2. Block UDP posrt on external network interface of WCS server
Where ens192 is external network interface of WCS server.
If this step is successful, go to 3b, if ports cannot be blocked, go to 3a
3. Open Firewall Traversal Streaming application, set the following to
- test.flashphoner.com is WCS server hostname
- 3478 internal TURN server port
a) if UDP ports on WCS server are not blocked, uncheck
b) if UDP ports on WCS server are blocked, check
Connect, enter stream name
test and press
Publish. Stream publishing starts through internal TURN server.
1. The Microsoft Legacy Edge and Mozilla Firefox browser does not connect via the TURN server
Symptoms: publishing/playing do not work when trying to connect through the TURN server
Solution: use Chrome browser or its successors.