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:
fingerprint lt-cred-mech user=username1:password1 realm=flashphoner.com cert=/usr/local/etc/turn_server_cert.pem pkey=/usr/local/etc/turn_server_pkey.pem pkey-pwd=qweasd
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:
openssl req -x509 -newkey rsa:4096 -keyout /usr/local/etc/turn_server_pkey.pem -out usr/local/etc/turn_server_cert.pem -days 365
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
turnserver
Connection using the 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:
Flashphoner.createSession({urlServer: url, mediaOptions: {"iceServers": [ { 'url': 'turn:192.168.0.1:3478?transport=tcp', 'credential': 'password1', 'username': 'username1' } ], "iceTransportPolicy": "relay"}})
Known issues
1) The Microsoft Edge browser does not play streams via the TURN server
Solution: use another browser, because Microsoft Edge does not support TURN via TCP