TURN And STUN Server Credentials

Dvlpr picture Dvlpr · Aug 22, 2014 · Viewed 8.3k times · Source

I am follwing this http://www.html5rocks.com/en/tutorials/webrtc/infrastructure tutorial. This tutorial or discussion is about TURN/STUN servers. And this tutorial add turn and stun server code like below.

{
  'iceServers': [
    {
      'url': 'stun:stun.l.google.com:19302'
    },
    {
      'url': 'turn:192.158.29.39:3478?transport=udp',
      'credential': 'JZEOEt2V3Qb0y27GRntt2u2PAYA=',
      'username': '28224511:1379330808'
    },
    {
      'url': 'turn:192.158.29.39:3478?transport=tcp',
      'credential': 'JZEOEt2V3Qb0y27GRntt2u2PAYA=',
      'username': '28224511:1379330808'
    }
  ]
}

Can i use this credentials to make Web-RTC communication between browsers (on different pcs).

And ı read this tutorial also Implementing our own STUN/TURN server for WebRTC Application. According to this tutorial when we use turn server for nat and firewalls, using stun server is unnecessary. And this tutorial added this code for stun and turn server.

var pc_config = {"iceServers": [{"url":"turn:my_username@<turn_server_ip_address>", "credential":"my_password"}]};

pc_new = new webkitRTCPeerConnection(pc_config);

What is "turn_server_ip_address" or what is "my_password" ? how can ı know this credential ?

Answer

Benjamin Trent picture Benjamin Trent · Aug 22, 2014

those credentials provided in the examples are EXAMPLES, you cannot use them in a product.

Most TURN servers require credentials to utilize because of the possible high network usage because of relaying the SRTP/SRTCP packets. STUN servers on the other hand are usually not protected as there is not much computing power or network utilization when using them for candidate gathering.

There are open turn servers(NUMB for example, you can set up a username and password to use against their servers) out there that you can test against but I would suggest creating your own in some sort of cloud computing service if you are creating a product.

In short, you know the credentials and IP address of the TURN server because either you signed up for the service you are using or it is your server.