【问题标题】:Coturn stun server returned an error with code=701Coturn stun 服务器返回错误代码=701
【发布时间】:2020-07-13 00:40:30
【问题描述】:

我有自己的 ubuntu 19 服务器。

注意:我需要一个用于视频聊天 Web 应用程序的 stun/turn 服务器。如果两台设备在同一个网络中,它已经可以工作了。

我已经成功安装和配置了coturn。我可以通过运行成功启动turnserver: turnservernohup turnserver & 在终端中。

注意:我有一个到我的服务器的SSH 连接。

我还确保打开了必要的端口并使用netstat -tulpn 进行了检查。

我在测试sudo service coturn restart时也重启了几次coturn。

我在turnserver.conf中使用这些配置:

# Also tried 80
listening-port=3478
# Also tried 443
tls-listening-port=5349
listening-ip=<MY-IP4>
listening-ip=<MY-IP6>
relay-ip=<MY-IP4>
external-ip=<MY-IP4>
oauth
user=root:<password>
userdb=/var/lib/turn/turndb
no-stdout-log

这是我在 js 中的 iceServers 配置,我相信它应该可以工作(我已经完成了很多其他组合)。

var pcConfig = {
  'iceServers': [
    {
      'urls': 'stun:<MY-IP4>:80'
    },
    {
      'urls': 'turn:<MY-IP4>:80',
      'credential': '<PASSWORD>',
      'username': 'root'
    }
  ]
};

我已经完成了大量不同的眩晕/转弯服务器组合,例如:

  • 我使用了 google 的 stun 服务器:stun.l.google.com:19302、stun2.l.google.com:19302 等。

  • 我尝试了端口 3478 和 5349(当然是在重启 coturn 之后)

  • 我尝试使用 stun 服务器的凭据,但我确信它不需要它们

  • 我尝试使用IP6地址

我也一直在我的网络项目上进行实时测试,也在这里: https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/

基本上上面的测试网址总是给我:

Note: errors from onicecandidateerror above are not neccessarily fatal. For example an IPv6 DNS lookup may fail but relay candidates can still be gathered via IPv4.
The server stun:<MY-IP4>:80 returned an error with code=701:
STUN server address is incompatible.
The server stun:<MY-IP4>:80 returned an error with code=701:
STUN server address is incompatible.

不管我用google的stun服务器还是我自己的,错误都是一样的。

如果我使用相同的网络,我的 webproject 和视频聊天工作得很好,但我相信 stun 和 turn 服务器不在同一个网络中使用。

另外,当我更新我的 JS 文件时,我总是删除缓存,所以使用了新的 JS 文件。所以这也不是问题。

编辑

这种组合不会报错,只是:

Note: errors from onicecandidateerror above are not 
neccessarily fatal. For example an IPv6 DNS 
lookup may fail but relay candidates can still be gathered via IPv4.

https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/上测试

{
  'urls': 'stun:<MY-IP6>:80'
},
{
  'urls': 'turn:<MY-IP4>:80',
  'credential': '<PASSWORD>',
  'username': 'root'
}

我只是使用 IP6 进行眩晕和 IP4 转身。 不同网络的视频聊天仍然无法正常工作,找不到其他错误。

编辑:

今天注意到https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/ 不起作用。我在 Firefox 上没有错误。但是你可以在那里输入一些废话,它也不会显示任何错误......

编辑:

我现在还添加了有效证书:

cert=/usr/local/etc/turn.pem                                                                                    
pkey=/usr/local/etc/turn.key.pem

似乎有效。我重新启动了 coturn,状态告诉我一切都在正常运行。

视频聊天在不同的网络中仍然无法使用。

【问题讨论】:

  • 其他人可能会感兴趣:Firefox (v 85.0) 尚未实现 onicecandidateerror,但如果无法访问 TURN 服务器,例如服务器或端口被阻止、TURN 请求,则使用状态为“失败”的 oniceconnectionstatechange 报告连接问题不允许,...

标签: ubuntu server webrtc coturn


【解决方案1】:

好的。我从错误的角度看整个事情。 TURN/STUN 服务器设置正确。

问题在于客户端/服务器代码。信号不起作用。

我关注了this 文章,但我在设置信令服务时遇到了问题。我认为这必须在一个新问题中提出。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-17
    • 1970-01-01
    相关资源
    最近更新 更多