我刚刚下载了一个视频聊天项目,它使用了一个 STUN 服务器,并指定了 URL
stun:23.21.150.121
。我该如何使用自己的服务器代替 STUN 服务器?我需要输入什么 URL?{url:'stun:stun01.sipphone.com'},
{url:'stun:stun.ekiga.net'},
{url:'stun:stun.fwdnet.net'},
{url:'stun:stun.ideasip.com'},
{url:'stun:stun.iptel.org'},
{url:'stun:stun.rixtelecom.se'},
{url:'stun:stun.schlund.de'},
{url:'stun:stun.l.google.com:19302'},
{url:'stun:stun1.l.google.com:19302'},
{url:'stun:stun2.l.google.com:19302'},
{url:'stun:stun3.l.google.com:19302'},
{url:'stun:stun4.l.google.com:19302'},
{url:'stun:stunserver.org'},
{url:'stun:stun.softjoys.com'},
{url:'stun:stun.voiparound.com'},
{url:'stun:stun.voipbuster.com'},
{url:'stun:stun.voipstunt.com'},
{url:'stun:stun.voxgratia.org'},
{url:'stun:stun.xten.com'},
{
url: 'turn:numb.viagenie.ca',
credential: 'muazkh',
username: 'webrtc@live.com'
},
{
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'
}
https://gist.github.com/yetithefoot/7592580
如果您需要自己的STUN服务器,可以使用Node.js编写的这个,或者在这里找到一些。有几种选项可以设置您自己的stun服务器。有rfc5766-turn-server。一旦您在服务器上设置好它,您可以使用该服务器的IP地址和端口来监听。您需要一些基本的Linux系统管理员知识。
EmerCoin拥有大量的公共STUN服务器列表:http://enumer.org/public-stun.txt。你可以使用其中任意一个。
这是在RTCPeerConnection初始化中配置STUN和TURN的新方法。下面是从apprtc.appspot.com的工作模式。
var peerConnectionConfig = {
iceServers:[
{urls: ["turn:173.194.72.127:19305?transport=udp",
"turn:[2404:6800:4008:C01::7F]:19305?transport=udp",
"turn:173.194.72.127:443?transport=tcp",
"turn:[2404:6800:4008:C01::7F]:443?transport=tcp"
],
username:"CKjCuLwFEgahxNRjuTAYzc/s6OMT",
credential:"u1SQDR/SQsPQIxXNWQT7czc/G4c="
},
{urls:["stun:stun.l.google.com:19302"]}
]};