Firefox上的Ice连接失败消息,但在Chrome上有效

时间:2018-10-11 14:44:23

标签: node.js webrtc

我有一个webRTC项目,可以在本地计算机上工作(nodeJS + firefox / chrome)。当我尝试将其部署到Amazon云下时,firefug出现问题:“ Ice Connection Failed”(在chrome上工作正常)

这是从服务器收到的SDP:

v=0
o=- 1613416276519675431 2 IN IP4 127.0.0.1
s=-
t=0 0
a=sendrecv
a=group:BUNDLE sdparta_0
a=msid-semantic:WMS
m=video 50830 UDP/TLS/RTP/SAVPF 120 121
c=IN IP4 172.19.0.4
a=candidate:3317750581 1 udp 2122260223 172.19.0.4 50830 typ host generation 0 network-id 1 network-cost 50
a=candidate:3317750581 1 udp 2122260223 172.19.0.4 50830 typ host generation 0 ufrag aByY network-id 1 network-cost 50
a=candidate:652303833 1 udp 1686052607 18.196.192.26 62055 typ srflx raddr 172.19.0.4 rport 50830 generation 0 ufrag aByY network-id 1 network-cost 50
a=candidate:2367567423 1 udp 41885439 172.19.0.3 64097 typ relay raddr 18.196.192.26 rport 62055 generation 0 ufrag aByY network-id 1 network-cost 50
a=candidate:2336434117 1 tcp 1518280447 172.19.0.4 47162 typ host tcptype passive generation 0 ufrag aByY network-id 1 network-cost 50
a=recvonly
a=extmap:5 urn:ietf:params:rtp-hdrext:toffset
a=extmap:4 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=fingerprint:sha-256 D7:1F:45:72:1D:CF:93:C5:39:1A:1E:EF:11:5C:50:2A:77:5D:46:B5:63:8B:9D:A8:9C:60:8E:ED:5E:4A:AE:FD
a=ice-options:trickle
a=ice-pwd:Pl6x4NQYDFLspg6WsFJiRGj8
a=ice-ufrag:aByY
a=mid:sdparta_0
a=rtcp:9 IN IP4 0.0.0.0
a=rtcp-fb:120 ccm fir
a=rtcp-fb:120 nack
a=rtcp-fb:120 nack pli
a=rtcp-fb:120 goog-remb
a=rtcp-fb:121 ccm fir
a=rtcp-fb:121 nack
a=rtcp-fb:121 nack pli
a=rtcp-fb:121 goog-remb
a=rtcp-mux
a=rtpmap:120 VP8/90000
a=rtpmap:121 VP9/90000
a=setup:active

来自about:webrtc的日志:

(ice/INFO) ICE-PEER(PC:1539156510689000 (id=8589934603 url=https://siteperso/):default)/STREAM(0-1539156510689000 (id=8589934603 url=https://siteperso/) aLevel=0)/COMP(1): All pairs are failed, and grace period has elapsed. Marking component as failed.

(ice/INFO) ICE-PEER(PC:1539156510689000 (id=8589934603 url=https://siteperso/):default): all checks completed success=0 fail=1

(generic/ERR) Error from TCPSocketChild: type: ConnectionRefusedError, name: Network

(turn/INFO) TURN(relay(IP4:192.168.44.17:64764/UDP|IP4:52.28.148.27:3478/UDP)): deallocating

当我在本地测试时,我有这个额外的标签:

a=fmtp:126 profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1

也许是一个问题,因为该标签不存在?

更新:

我曾尝试使用Google /其他眩晕/转弯,但行为并未改变 这是chrome和firefox coturn的日志

// chrome working


140: handle_udp_packet: New UDP endpoint: local addr 172.18.0.2:3478, remote addr 10.126.240.227:55194
140: session 129000000000000001: realm <webrtc> user <>: incoming packet BINDING processed, success
140: handle_udp_packet: New UDP endpoint: local addr 172.18.0.2:3478, remote addr 10.126.229.172:52614
140: session 129000000000000002: realm <webrtc> user <>: incoming packet BINDING processed, success
140: session 129000000000000001: realm <webrtc> user <>: incoming packet message processed, error 401: Unauthorised
140: IPv4. Local relay addr: 172.18.0.2:59273
140: session 129000000000000001: new, realm=<webrtc>, username=<mph>, lifetime=600
140: session 129000000000000001: realm <webrtc> user <mph>: incoming packet ALLOCATE processed, success
140: session 129000000000000001: realm <webrtc> user <mph>: incoming packet CREATE_PERMISSION processed, success
140: session 129000000000000001: realm <webrtc> user <mph>: incoming packet CREATE_PERMISSION processed, success
140: session 129000000000000002: realm <webrtc> user <>: incoming packet message processed, error 401: Unauthorised
140: IPv4. Local relay addr: 172.18.0.2:60174
140: session 129000000000000002: new, realm=<webrtc>, username=<mph>, lifetime=600
140: session 129000000000000002: realm <webrtc> user <mph>: incoming packet ALLOCATE processed, success
140: session 129000000000000002: realm <webrtc> user <mph>: incoming packet CREATE_PERMISSION processed, success
140: session 129000000000000002: realm <webrtc> user <mph>: incoming packet CREATE_PERMISSION processed, success
140: session 129000000000000001: realm <webrtc> user <mph>: incoming packet CREATE_PERMISSION processed, success
140: session 129000000000000002: realm <webrtc> user <mph>: incoming packet CREATE_PERMISSION processed, success
145: session 129000000000000002: refreshed, realm=<webrtc>, username=<mph>, lifetime=0
145: session 129000000000000002: realm <webrtc> user <mph>: incoming packet REFRESH processed, success
146: session 129000000000000002: closed (2nd stage), user <mph> realm <webrtc> origin <>, local 172.18.0.2:3478, remote 10.126.229.172:52614, reason: allocation timeout
146: session 129000000000000002: delete: realm=<webrtc>, username=<mph>
147: session 129000000000000001: refreshed, realm=<webrtc>, username=<mph>, lifetime=0
147: session 129000000000000001: realm <webrtc> user <mph>: incoming packet REFRESH processed, success
148: session 129000000000000001: closed (2nd stage), user <mph> realm <webrtc> origin <>, local 172.18.0.2:3478, remote 10.126.240.227:55194, reason: allocation timeout
148: session 129000000000000001: delete: realm=<webrtc>, username=<mph>


//firefox

355: handle_udp_packet: New UDP endpoint: local addr 172.18.0.2:3478, remote addr 10.126.229.172:45338
355: session 129000000000000003: realm <webrtc> user <>: incoming packet BINDING processed, success
355: session 129000000000000003: realm <webrtc> user <>: incoming packet message processed, error 401: Unauthorised
355: IPv4. Local relay addr: 172.18.0.2:65030
355: session 129000000000000003: new, realm=<webrtc>, username=<mph>, lifetime=600
355: session 129000000000000003: realm <webrtc> user <mph>: incoming packet ALLOCATE processed, success
356: handle_udp_packet: New UDP endpoint: local addr 172.18.0.2:3478, remote addr 10.126.240.227:61693
356: session 129000000000000004: realm <webrtc> user <>: incoming packet BINDING processed, success
356: session 129000000000000004: realm <webrtc> user <>: incoming packet message processed, error 401: Unauthorised
356: IPv4. Local relay addr: 172.18.0.2:52732
356: session 129000000000000004: new, realm=<webrtc>, username=<mph>, lifetime=3600
356: session 129000000000000004: realm <webrtc> user <mph>: incoming packet ALLOCATE processed, success
356: handle_udp_packet: New UDP endpoint: local addr 172.18.0.2:3478, remote addr 10.126.240.227:61694
356: session 129000000000000005: realm <webrtc> user <>: incoming packet BINDING processed, success
356: session 129000000000000005: realm <webrtc> user <>: incoming packet message processed, error 401: Unauthorised
356: IPv4. Local relay addr: 172.18.0.2:61007
356: session 129000000000000005: new, realm=<webrtc>, username=<mph>, lifetime=3600
356: session 129000000000000005: realm <webrtc> user <mph>: incoming packet ALLOCATE processed, success

365: session 129000000000000003: realm <webrtc> user <mph>: incoming packet BINDING processed, success

1 个答案:

答案 0 :(得分:0)

在PeerConnection对象创建期间是否提供了任何冰服务器?如果您没有提供,我建议您这样做。它可以在您的本地计算机上工作,因为它们位于同一网络中。但是它不能在生产(AWS)中工作,因为它们位于不同的网络中,并且它本身无法进行NAT遍历。

如果要添加冰服务器Read this

free STUN servers

很少

有关冰服务器Read this

的更多信息

如果需要TURN服务器,则可以使用Xirsys等某些服务提供商,也可以使用CoTURN制作自己的Turn服务器。