Why STUN/TURN?
In order to do WebRTC across different networks, we need to bypass firewalls and we also have all kinds of restrictions set by ISPs, in order to bypass this restrictions and punch a hole in the receptors firewalls to get media through we need to rely on a STUN/TURN server, to either find the right route if possible (STUN), or act as a relay server for the media passing through (TURN), in this brief guide we setup a basic STUN/TURN server.
We’ll use an open source implementation of a STUN/TURN server, Coturn.
Installing Coturn.
Assuming you are on a Ubuntu 14.04 LTS server run the following commands:
https://gist.github.com/deviantfero/71a61b27423969fc1b810918c6f24940
When the installation is ready, run the following command in your terminal:
https://gist.github.com/deviantfero/d019769174fda4878b370f4a0d0e85f5
Testing your STUN/TURN server.
In order to test your TURN server, you can make use of this tool provided by the WebRTC team: https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/
Input your server information like this:
A successful output from testing TURN should look like this:
You can see two rows that say relay, this indicates that the TURN server is working correctly, if there’s nothing that says relay on this output, the TURN server is not working as expected.
Keep in mind, this is not a setup appropriate for production environments, it’s simply to have a way to test your WebRTC application without the need of purchasing a TURN server or getting it by other means.
If you want to know more about WebRTC solutions, need assessment, or just want to have a quote on our services, Contact us!