iceConnectionState已断开连接(在互联网上使用时) [英] iceConnectionState is disconnected (when used over the internet)

查看:280
本文介绍了iceConnectionState已断开连接(在互联网上使用时)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

之前已经问过这个问题,但我还没有找到答案。我基本上遇到的问题与此处在哪里

This question has been asked before, but I have not found an answer yet. I'm basically having the same problem as described here and here.

我正在尝试建立一个webRTC使用PeerJS连接。它在局域网中完美运行但我无法通过互联网工作。我使用coturn作为TURN服务器,但到目前为止这还没有解决问题.Chromium控制台打印出以下内容:

I'm trying to set up a webRTC connection using PeerJS. It works flawlessly in LAN but I can't get it to work over the internet. I'm using coturn as TURN server, but so far this has not solved the problem.The Chromium console prints out the following:

PeerJS:  Added ICE candidate for: client1
peer.js:1476 PeerJS:  Set remoteDescription: ANSWER for: client1
peer.js:1476 PeerJS:  Set remoteDescription: OFFER for: client1
peer.js:1476 PeerJS:  Set remoteDescription: ANSWER for: client1
peer.js:1476 PeerJS:  Received remote stream
peer.js:1476 PeerJS:  Receiving stream MediaStream
peer.js:1476 PeerJS:  Created answer.
peer.js:1476 PeerJS:  Set localDescription: answer for: client1
3peer.js:1476 PeerJS:  Received ICE candidates for: client1
3peer.js:1476 PeerJS:  Added ICE candidate for: client1
peer.js:1476 PeerJS:  iceConnectionState is disconnected, closing connections to client1
peer.js:1476 PeerJS:  Cleaning up PeerConnection to client1
2peer.js:1476 PeerJS:  iceConnectionState is disconnected, closing connections to client1

我正在使用的对等对象如下:

The peer object I'm using looks like that:

var peer = new Peer(
    GetURLParameter('id'),
    { key: peerKey, debug: peerDebug},
    {config:
        { 'iceServers': [
            { url: 'stun:[server ip here]:3478'},
            { url: 'turn:[server ip here]:3478'}
        ]}
    }
);

coturn,在使用turnserver -L [server ip]启动turnserver时,打印出以下内容: / p>

coturn, upon starting the turnserver with turnserver -L [server ip], prints out the following:

0: Relay address to use: [server ip here]
0: pid file created: /var/run/turnserver.pid
0: IO method (main listener thread): epoll (with changelist)
0: WARNING: I cannot support STUN CHANGE_REQUEST functionality because only one IP address is provided
0: Wait for relay ports initialization...
0:   relay [server ip here] initialization...
0:   relay [server ip here] initialization done
0: Relay ports initialization done
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=0 created
0: IPv4. UDP listener opened on: [server ip here]:3478
0: IPv4. TCP listener opened on : [server ip here]:3478
0: Total UDP servers: 1
0: Total General servers: 1
0: IO method (cli thread): epoll (with changelist)
0: IPv4. CLI listener opened on : 127.0.0.1:5766
0: IO method (auth thread): epoll (with changelist)

最后因为我猜这可能是一个安全问题,我的iptables配置目前看起来像这样:

And finally since I guess this could be a security issue, my iptables configuration currently looks like that:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:3478
ACCEPT     udp  --  anywhere             anywhere             udp dpt:3478

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:3478
ACCEPT     udp  --  anywhere             anywhere             udp dpt:3478

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:3478
ACCEPT     udp  --  anywhere             anywhere             udp dpt:3478

任何人都知道如何让这个东西工作?任何帮助将不胜感激!

Anyone got an idea how to get this thing working? Any help would be greatly appreciated!

编辑:事实证明我的TURN配置的JSON很乱。我的新同行对象现在看起来像这样:

EDIT: It turns out my JSON for the TURN config was messy. My new peer object now looks like that:

var peer = new Peer(
    GetURLParameter('id'), {
        key: peerKey,
        debug: peerDebug,
        config: {
            'iceServers': [
                { url: 'stun:[server ip]:3478'},
                { url: 'turn:[server ip]:3478'}
            ]
        }
    }
);

这给了我更多关于TURN服务器的反馈(所以我想我正在前进正确的方向) - 但问题仍然存在。

This gives me a lot more feedback on the TURN server (so I guess I'm heading in the right direction) - but the problem persists nonetheless.

EDIT2:
嗯,它变得相当奇怪。这似乎是某种跨浏览器兼容性问题。使用mido建议的TURN服务器测试工具,我在Firefox中得到的结果与Chromium不同。我打算使用Chromium,因为它的自助服务终端模式对我的应用来说非常方便。但回到转弯服务器。在Firefox中,当使用用户帐户时,一切似乎都运行正常:
github测试页的输出:

Well, it gets rather strange. It seems to be some kind of cross browser compatiblity issue. Using the TURN server test tool that mido suggested, I get different results in Firefox than in Chromium. I intend to use Chromium because it's kiosk mode would come in very handy for my application. But back to the turn server. In Firefox, when using user accounts, everything seems to work fine: The output of the github test page:

0.004   1   host    0   UDP 192.168.178.28  39919   126 | 32512 | 255
0.005   2   host    0   UDP 192.168.178.28  56123   126 | 32512 | 254
0.076   1   srflx   1   UDP 178.39.74.108   39919   100 | 32543 | 255
0.077   1   relay   2   UDP [Server IP ]    52147   5 | 32543 | 255
0.098   2   srflx   1   UDP 178.39.74.108   56123   100 | 32543 | 254
0.099   2   relay   2   UDP [Server IP ]    60002   5 | 32543 | 254
0.099   Done

然而,允许匿名访问TURN服务器并尝试登录没有用户名和密码,绝对没有任何反应。

However, allowing anonymous access to the TURN server and trying to log in without username and password, absolutely nothing happens.

Chromium中的不同故事:提供用户名和密码后,会发生以下情况:

Different story in Chromium: With username and password supplied, the following happens:

0.002   1   host    138421141   udp 192.168.178.28  42343   126 | 30 | 255
0.002   2   host    138421141   udp 192.168.178.28  49001   126 | 30 | 254
0.028   1   srflx   842163049   udp 178.39.74.108   42343   100 | 30 | 255
0.049   2   srflx   842163049   udp 178.39.74.108   49001   100 | 30 | 254

...而TURN服务器上的终端一遍又一遍地打印出401错误消息。在我看来,使用铬时凭证永远不会到达服务器。 401错误消息表明空用户名。

...while the terminal on the TURN server is printing out 401 error messages over and over. It seems to me that the credentials never reach the server when using chromium. The 401 error message states an empty username.

我真的可以使用Chromium来做那件事。有没有人知道如何使其工作?

I could really use Chromium for that thing. Does anyone has an idea on how to get that working?

推荐答案

请检查您的转弯服务器上的防火墙设置。

please check firewall setting at your turn server.

这篇关于iceConnectionState已断开连接(在互联网上使用时)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆