M
M
maverick_home2015-01-02 22:14:45
JavaScript
maverick_home, 2015-01-02 22:14:45

How to configure turn-server for WebRTC?

Help set up a turn server.
I'm trying to make a video chat via WebRTC, but there was a problem with Nat bypass.
Installed rfc5766-turn-server on vps hosting under Ubuntu 12.04.
I configured it as follows.
$ sudo turnadmin -a -u username -r <server name> -p password
from which the following inscription appeared in turnserdb.conf:
username : 0x210b47ada1d3ff38bacb0d6b38071f38
And uncommented the line in /etc/defaultrfc5766-turn-server so that it would start automatically. Now if you go to http://<server name>:3478/ shows the line
TURN Server.
I use it like this:

var PeerConnection = window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
var pcConfig = {};
var pcConstraints = {};
var turnServer = {
  username:'username',
  credential: 'password',
  url:'turn:<имя сервера>:3478'
}

 var peers=[]; 
 function newConnection()
 { 
 	var pc; // PeerConnection
 	pcConfig.iceServers = [turnServer] 
  pc = new PeerConnection(pcConfig, pcConstraints);
  
  	pc.addStream(my_stream);
  	pc.onicecandidate = gotIceCandidate;
  	pc.onaddstream = gotRemoteStream;
  	peers.push(pc);
 }

Everything works successfully on my router's network, in other directions I get:
ICE failed, see about: webrtc for more details

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question