0

我使用 webRTC 与其他浏览器建立 web 浏览器实时通信。为了确保这种连接始终稳固,我想建立自己的 STUN/TURN 服务器。我决定在 Azure VM(Ubuntu 服务器)上使用 coturn。我按照此文档在 Azure https://www.microsoft.com/developerblog/2018/01/29/orchestrating-turn-servers-cloud-deployment/上设置了 coturn 。

根据 [Trickele ICE][1] [1]:https ://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/我的 STUN 服务器工作正常,我得到了积极的结果。

每当我尝试使用我的 STUN/TURN 服务器建立网络摄像头连接时,它都不起作用。

webRTC 协议会话统计:

Local SDP
v=0
o=mozilla...THIS_IS_SDPARTA-58.0.2 8794114299540424628 0 IN IP4 0.0.0.0
s=-
t=0 0
a=sendrecv
a=fingerprint:sha-256 8B:A5:5A:36:D7:42:B0:DE:D8:FB:3B:AC:7A:41:AE:D1:F2:86:71:66:CB:99:79:54:08:9B:B2:97:DC:54:D7:E6
a=group:BUNDLE sdparta_0 sdparta_1
a=ice-options:trickle
a=msid-semantic:WMS *
m=audio 52254 UDP/TLS/RTP/SAVPF 109 9 0 8 101
c=IN IP4 192.168.9.1
a=candidate:0 1 UDP 2122252543 192.168.9.1 52254 typ host
a=candidate:1 1 UDP 2122187007 192.168.67.1 52255 typ host
a=candidate:2 1 UDP 2122121471 192.168.1.151 52256 typ host
a=candidate:3 1 TCP 2105524479 192.168.9.1 9 typ host tcptype active
a=candidate:4 1 TCP 2105458943 192.168.67.1 9 typ host tcptype active
a=candidate:5 1 TCP 2105393407 192.168.1.151 9 typ host tcptype active
a=candidate:0 2 UDP 2122252542 192.168.9.1 52257 typ host
a=candidate:1 2 UDP 2122187006 192.168.67.1 52258 typ host
a=candidate:2 2 UDP 2122121470 192.168.1.151 52259 typ host
a=candidate:3 2 TCP 2105524478 192.168.9.1 9 typ host tcptype active
a=candidate:4 2 TCP 2105458942 192.168.67.1 9 typ host tcptype active
a=candidate:5 2 TCP 2105393406 192.168.1.151 9 typ host tcptype active
a=sendrecv
a=end-of-candidates
a=extmap:1/sendonly urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid
a=fmtp:109 maxplaybackrate=48000;stereo=1;useinbandfec=1
a=fmtp:101 0-15
a=ice-pwd:b8b3237da4b403dd6e1e50c3a182f227
a=ice-ufrag:4efa27f0
a=mid:sdparta_0
a=msid:{9866f92b-4ef3-44d8-88bf-40e0064ad000} {24f74a5f-6173-4d87-b2fd-90f05de1c3c4}
a=rtcp:52257 IN IP4 192.168.9.1
a=rtcp-mux
a=rtpmap:109 opus/48000/2
a=rtpmap:9 G722/8000/1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=setup:actpass
a=ssrc:753158800 cname:{38718aae-997b-4110-aeeb-a8126f52f4f3}
m=video 52260 UDP/TLS/RTP/SAVPF 120 121 126 97
c=IN IP4 192.168.9.1
a=candidate:0 1 UDP 2122252543 192.168.9.1 52260 typ host
a=candidate:1 1 UDP 2122187007 192.168.67.1 52261 typ host
a=candidate:2 1 UDP 2122121471 192.168.1.151 52262 typ host
a=candidate:3 1 TCP 2105524479 192.168.9.1 9 typ host tcptype active
a=candidate:4 1 TCP 2105458943 192.168.67.1 9 typ host tcptype active
a=candidate:5 1 TCP 2105393407 192.168.1.151 9 typ host tcptype active
a=candidate:0 2 UDP 2122252542 192.168.9.1 58499 typ host
a=candidate:1 2 UDP 2122187006 192.168.67.1 58500 typ host
a=candidate:2 2 UDP 2122121470 192.168.1.151 58501 typ host
a=candidate:3 2 TCP 2105524478 192.168.9.1 9 typ host tcptype active
a=candidate:4 2 TCP 2105458942 192.168.67.1 9 typ host tcptype active
a=candidate:5 2 TCP 2105393406 192.168.1.151 9 typ host tcptype active
a=sendrecv
a=end-of-candidates
a=extmap:1 htttp://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:2 urn:ietf:params:rtp-hdrext:toffset
a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid
a=fmtp:126 profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1
a=fmtp:97 profile-level-id=42e01f;level-asymmetry-allowed=1
a=fmtp:120 max-fs=12288;max-fr=60
a=fmtp:121 max-fs=12288;max-fr=60
a=ice-pwd:b8b3237da4b403dd6e1e50c3a182f227
a=ice-ufrag:4efa27f0
a=mid:sdparta_1
a=msid:{9866f92b-4ef3-44d8-88bf-40e0064ad000} {59810283-0f69-47fa-964d-7ba8966daaff}
a=rtcp:58499 IN IP4 192.168.9.1
a=rtcp-fb:120 nack
a=rtcp-fb:120 nack pli
a=rtcp-fb:120 ccm fir
a=rtcp-fb:120 goog-remb
a=rtcp-fb:121 nack
a=rtcp-fb:121 nack pli
a=rtcp-fb:121 ccm fir
a=rtcp-fb:121 goog-remb
a=rtcp-fb:126 nack
a=rtcp-fb:126 nack pli
a=rtcp-fb:126 ccm fir
a=rtcp-fb:126 goog-remb
a=rtcp-fb:97 nack
a=rtcp-fb:97 nack pli
a=rtcp-fb:97 ccm fir
a=rtcp-fb:97 goog-remb
a=rtcp-mux
a=rtpmap:120 VP8/90000
a=rtpmap:121 VP9/90000
a=rtpmap:126 H264/90000
a=rtpmap:97 H264/90000
a=setup:actpass
a=ssrc:3734878749 cname:{38718aae-997b-4110-aeeb-a8126f52f4f3}
Remote SDP
v=0
o=mozilla...THIS_IS_SDPARTA-58.0.1 2958360105461551245 0 IN IP4 0.0.0.0
s=-
t=0 0
a=sendrecv
a=fingerprint:sha-256 29:21:2A:C5:42:11:8E:E9:2D:A2:8E:48:FA:AA:EB:C8:61:33:ED:B3:24:71:BC:20:27:68:1F:48:FB:EC:64:64
a=group:BUNDLE sdparta_0 sdparta_1
a=ice-options:trickle
a=msid-semantic:WMS *
m=audio 9 UDP/TLS/RTP/SAVPF 109 101
c=IN IP4 0.0.0.0
a=candidate:0 1 UDP 2122252543 192.168.1.155 58107 typ host
a=candidate:1 1 TCP 2105524479 192.168.1.155 9 typ host tcptype active
a=sendrecv
a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid
a=fmtp:109 maxplaybackrate=48000;stereo=1;useinbandfec=1
a=fmtp:101 0-15
a=ice-pwd:83ca8dee4d50f43c443762e84fdb52c4
a=ice-ufrag:1a999d61
a=mid:sdparta_0
a=msid:{b9e14e75-b26e-4d1c-a5be-b359c6f0b91b} {b0b43916-ee73-474e-acbf-f57d639c99ae}
a=rtcp-mux
a=rtpmap:109 opus/48000/2
a=rtpmap:101 telephone-event/8000
a=setup:active
a=ssrc:3242481895 cname:{d0c1b500-19b7-483a-be5b-46da70b91ab2}
m=video 9 UDP/TLS/RTP/SAVPF 120
c=IN IP4 0.0.0.0
a=sendrecv
a=extmap:1 htttp://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:2 urn:ietf:params:rtp-hdrext:toffset
a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid
a=fmtp:120 max-fs=12288;max-fr=60
a=ice-pwd:83ca8dee4d50f43c443762e84fdb52c4
a=ice-ufrag:1a999d61
a=mid:sdparta_1
a=msid:{b9e14e75-b26e-4d1c-a5be-b359c6f0b91b} {e297d5a1-76cc-46f8-8ea2-acb932a3056a}
a=rtcp-fb:120 nack
a=rtcp-fb:120 nack pli
a=rtcp-fb:120 ccm fir
a=rtcp-fb:120 goog-remb
a=rtcp-mux
a=rtpmap:120 VP8/90000
a=setup:active
a=ssrc:1237891263 cname:{d0c1b500-19b7-483a-be5b-46da70b91ab2}

webRTC协议连接日志:

(ice/WARNING) z:/build/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3
(ice/WARNING) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): failed to create passive TCP host candidate: 3
(ice/INFO) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): Skipping TURN server because of link local mis-match
(ice/WARNING) z:/build/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3
(ice/WARNING) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): failed to create passive TCP host candidate: 3
(ice/INFO) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): Skipping TURN server because of link local mis-match
(ice/WARNING) z:/build/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3
(ice/WARNING) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): failed to create passive TCP host candidate: 3
(ice/INFO) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): Skipping TURN server because of link local mis-match
(ice/WARNING) z:/build/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3
(ice/WARNING) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): failed to create passive TCP host candidate: 3
(ice/INFO) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): Skipping TURN server because of link local mis-match
(ice/WARNING) z:/build/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3
(ice/WARNING) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): failed to create passive TCP host candidate: 3
(ice/INFO) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): Skipping TURN server because of link local mis-match
(ice/WARNING) z:/build/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3
(ice/WARNING) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): failed to create passive TCP host candidate: 3
(ice/INFO) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): Skipping TURN server because of link local mis-match
(generic/ERR) Error from TCPSocketChild: type: ConnectionRefusedError, name: Network
(generic/ERR) Error from TCPSocketChild: type: ConnectionRefusedError, name: Network
(generic/ERR) Error from TCPSocketChild: type: ConnectionRefusedError, name: Network
(generic/ERR) Error from TCPSocketChild: type: ConnectionRefusedError, name: Network
(generic/ERR) Error from TCPSocketChild: type: ConnectionRefusedError, name: Network
(ice/WARNING) z:/build/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3
(ice/WARNING) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): failed to create passive TCP host candidate: 3
(ice/INFO) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): Skipping TURN server because of link local mis-match
(ice/WARNING) z:/build/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3
(ice/WARNING) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): failed to create passive TCP host candidate: 3
(ice/INFO) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): Skipping TURN server because of link local mis-match
(ice/WARNING) z:/build/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3
(ice/WARNING) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): failed to create passive TCP host candidate: 3
(generic/ERR) Error from TCPSocketChild: type: ConnectionRefusedError, name: Network
(ice/INFO) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): Skipping TURN server because of link local mis-match
(generic/ERR) Error from TCPSocketChild: type: ConnectionRefusedError, name: Network
(generic/ERR) Error from TCPSocketChild: type: ConnectionRefusedError, name: Network
(generic/ERR) Error from TCPSocketChild: type: ConnectionRefusedError, name: Network
(generic/ERR) Error from TCPSocketChild: type: ConnectionRefusedError, name: Network
(ice/WARNING) z:/build/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3
(ice/WARNING) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): failed to create passive TCP host candidate: 3
(ice/INFO) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): Skipping TURN server because of link local mis-match
(ice/WARNING) z:/build/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3
(ice/WARNING) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): failed to create passive TCP host candidate: 3
(ice/INFO) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): Skipping TURN server because of link local mis-match
(ice/WARNING) z:/build/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3
(ice/WARNING) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): failed to create passive TCP host candidate: 3
(ice/INFO) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): Skipping TURN server because of link local mis-match
(generic/ERR) Error from TCPSocketChild: type: ConnectionRefusedError, name: Network
(generic/ERR) Error from TCPSocketChild: type: ConnectionRefusedError, name: Network
(generic/ERR) Error from TCPSocketChild: type: ConnectionRefusedError, name: Network
(generic/ERR) Error from TCPSocketChild: type: ConnectionRefusedError, name: Network
(generic/ERR) Error from TCPSocketChild: type: ConnectionRefusedError, name: Network
(generic/ERR) Error from TCPSocketChild: type: ConnectionRefusedError, name: Network
(generic/ERR) Error from TCPSocketChild: type: ConnectionRefusedError, name: Network
(generic/ERR) Error from TCPSocketChild: type: ConnectionRefusedError, name: Network
(generic/ERR) Error from TCPSocketChild: type: ConnectionRefusedError, name: Network
(generic/ERR) Error from TCPSocketChild: type: ConnectionRefusedError, name: Network
(generic/ERR) Error from TCPSocketChild: type: ConnectionRefusedError, name: Network
(generic/ERR) Error from TCPSocketChild: type: ConnectionRefusedError, name: Network
(generic/ERR) Error from TCPSocketChild: type: ConnectionRefusedError, name: Network
(generic/ERR) Error from TCPSocketChild: type: ConnectionRefusedError, name: Network
(ice/WARNING) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): peer (PC:222222222222222 (id=1111111111url=(link to myhompage)):default) has no stream matching stream 0-1519224369457000 (id=1111111111url=(link to myhompage)) aLevel=1
(ice/NOTICE) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): peer (PC:222222222222222 (id=1111111111url=(link to myhompage)):default) no streams with non-empty check lists
(ice/NOTICE) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): peer (PC:222222222222222 (id=1111111111url=(link to myhompage)):default) no streams with pre-answer requests
(ice/NOTICE) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): peer (PC:222222222222222 (id=1111111111url=(link to myhompage)):default) no checks to start
(ice/INFO) ICE-PEER(PC:222222222222222 (id=1111111111url=(link to myhompage)):default)/CAND-PAIR(mR+z): setting pair to state FROZEN: mR+z|IP4:192.168.9.1:52254/UDP|IP4:192.168.1.155:58107/UDP(host(IP4:192.168.9.1:52254/UDP)|candidate:0 1 UDP 2122252543 192.168.1.155 58107 typ host)
(ice/INFO) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage)))/CAND-PAIR(mR+z): Pairing candidate IP4:192.168.9.1:52254/UDP (7e7f00ff):IP4:192.168.1.155:58107/UDP (7e7f00ff) priority=9115005270282338815 (7e7f00fffcfe01ff)
(ice/INFO) ICE-PEER(PC:222222222222222 (id=1111111111url=(link to myhompage)):default)/ICE-STREAM(0-1519224369457000 (id=1111111111url=(link to myhompage)) aLevel=0): Starting check timer for stream.
(ice/INFO) ICE-PEER(PC:222222222222222 (id=1111111111url=(link to myhompage)):default)/CAND-PAIR(mR+z): setting pair to state WAITING: mR+z|IP4:192.168.9.1:52254/UDP|IP4:192.168.1.155:58107/UDP(host(IP4:192.168.9.1:52254/UDP)|candidate:0 1 UDP 2122252543 192.168.1.155 58107 typ host)
(ice/INFO) ICE-PEER(PC:222222222222222 (id=1111111111url=(link to myhompage)):default)/CAND-PAIR(mR+z): setting pair to state IN_PROGRESS: mR+z|IP4:192.168.9.1:52254/UDP|IP4:192.168.1.155:58107/UDP(host(IP4:192.168.9.1:52254/UDP)|candidate:0 1 UDP 2122252543 192.168.1.155 58107 typ host)
(ice/NOTICE) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): peer (PC:222222222222222 (id=1111111111url=(link to myhompage)):default) is now checking
(ice/INFO) ICE-PEER(PC:222222222222222 (id=1111111111url=(link to myhompage)):default)/CAND-PAIR(TCv6): setting pair to state FROZEN: TCv6|IP4:192.168.67.1:52255/UDP|IP4:192.168.1.155:58107/UDP(host(IP4:192.168.67.1:52255/UDP)|candidate:0 1 UDP 2122252543 192.168.1.155 58107 typ host)
(ice/INFO) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage)))/CAND-PAIR(TCv6): Pairing candidate IP4:192.168.67.1:52255/UDP (7e7e00ff):IP4:192.168.1.155:58107/UDP (7e7f00ff) priority=9114723795305628158 (7e7e00fffcfe01fe)
(ice/INFO) ICE-PEER(PC:222222222222222 (id=1111111111url=(link to myhompage)):default)/CAND-PAIR(9PJr): setting pair to state FROZEN: 9PJr|IP4:192.168.1.151:52256/UDP|IP4:192.168.1.155:58107/UDP(host(IP4:192.168.1.151:52256/UDP)|candidate:0 1 UDP 2122252543 192.168.1.155 58107 typ host)
(ice/INFO) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage)))/CAND-PAIR(9PJr): Pairing candidate IP4:192.168.1.151:52256/UDP (7e7d00ff):IP4:192.168.1.155:58107/UDP (7e7f00ff) priority=9114442320328917502 (7e7d00fffcfe01fe)
(ice/INFO) ICE-PEER(PC:222222222222222 (id=1111111111url=(link to myhompage)):default)/CAND-PAIR(TCv6): setting pair to state WAITING: TCv6|IP4:192.168.67.1:52255/UDP|IP4:192.168.1.155:58107/UDP(host(IP4:192.168.67.1:52255/UDP)|candidate:0 1 UDP 2122252543 192.168.1.155 58107 typ host)
(ice/INFO) ICE-PEER(PC:222222222222222 (id=1111111111url=(link to myhompage)):default)/CAND-PAIR(TCv6): setting pair to state IN_PROGRESS: TCv6|IP4:192.168.67.1:52255/UDP|IP4:192.168.1.155:58107/UDP(host(IP4:192.168.67.1:52255/UDP)|candidate:0 1 UDP 2122252543 192.168.1.155 58107 typ host)
(ice/INFO) ICE-PEER(PC:222222222222222 (id=1111111111url=(link to myhompage)):default)/CAND-PAIR(9PJr): setting pair to state WAITING: 9PJr|IP4:192.168.1.151:52256/UDP|IP4:192.168.1.155:58107/UDP(host(IP4:192.168.1.151:52256/UDP)|candidate:0 1 UDP 2122252543 192.168.1.155 58107 typ host)
(ice/INFO) ICE-PEER(PC:222222222222222 (id=1111111111url=(link to myhompage)):default)/CAND-PAIR(9PJr): setting pair to state IN_PROGRESS: 9PJr|IP4:192.168.1.151:52256/UDP|IP4:192.168.1.155:58107/UDP(host(IP4:192.168.1.151:52256/UDP)|candidate:0 1 UDP 2122252543 192.168.1.155 58107 typ host)
(ice/WARNING) ICE-PEER(PC:222222222222222 (id=1111111111url=(link to myhompage)):default): no pairs for 0-1519224369457000 (id=1111111111url=(link to myhompage)) aLevel=0
(ice/INFO) ICE-PEER(PC:222222222222222 (id=1111111111url=(link to myhompage)):default)/CAND-PAIR(9PJr): triggered check on 9PJr|IP4:192.168.1.151:52256/UDP|IP4:192.168.1.155:58107/UDP(host(IP4:192.168.1.151:52256/UDP)|candidate:0 1 UDP 2122252543 192.168.1.155 58107 typ host)
(ice/INFO) ICE-PEER(PC:222222222222222 (id=1111111111url=(link to myhompage)):default)/CAND-PAIR(9PJr): setting pair to state FROZEN: 9PJr|IP4:192.168.1.151:52256/UDP|IP4:192.168.1.155:58107/UDP(host(IP4:192.168.1.151:52256/UDP)|candidate:0 1 UDP 2122252543 192.168.1.155 58107 typ host)
(ice/INFO) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage)))/CAND-PAIR(9PJr): Pairing candidate IP4:192.168.1.151:52256/UDP (7e7d00ff):IP4:192.168.1.155:58107/UDP (7e7f00ff) priority=9114442320328917502 (7e7d00fffcfe01fe)
(ice/INFO) CAND-PAIR(9PJr): Adding pair to check list and trigger check queue: 9PJr|IP4:192.168.1.151:52256/UDP|IP4:192.168.1.155:58107/UDP(host(IP4:192.168.1.151:52256/UDP)|candidate:0 1 UDP 2122252543 192.168.1.155 58107 typ host)
(ice/INFO) ICE-PEER(PC:222222222222222 (id=1111111111url=(link to myhompage)):default)/CAND-PAIR(9PJr): setting pair to state WAITING: 9PJr|IP4:192.168.1.151:52256/UDP|IP4:192.168.1.155:58107/UDP(host(IP4:192.168.1.151:52256/UDP)|candidate:0 1 UDP 2122252543 192.168.1.155 58107 typ host)
(ice/INFO) ICE-PEER(PC:222222222222222 (id=1111111111url=(link to myhompage)):default)/CAND-PAIR(9PJr): setting pair to state CANCELLED: 9PJr|IP4:192.168.1.151:52256/UDP|IP4:192.168.1.155:58107/UDP(host(IP4:192.168.1.151:52256/UDP)|candidate:0 1 UDP 2122252543 192.168.1.155 58107 typ host)
(ice/INFO) ICE-PEER(PC:222222222222222 (id=1111111111url=(link to myhompage)):default)/ICE-STREAM(0-1519224369457000 (id=1111111111url=(link to myhompage)) aLevel=0): Starting check timer for stream.
(ice/INFO) ICE-PEER(PC:222222222222222 (id=1111111111url=(link to myhompage)):default)/CAND-PAIR(9PJr): setting pair to state IN_PROGRESS: 9PJr|IP4:192.168.1.151:52256/UDP|IP4:192.168.1.155:58107/UDP(host(IP4:192.168.1.151:52256/UDP)|candidate:0 1 UDP 2122252543 192.168.1.155 58107 typ host)
(ice/WARNING) ICE-PEER(PC:222222222222222 (id=1111111111url=(link to myhompage)):default): no pairs for 0-1519224369457000 (id=1111111111url=(link to myhompage)) aLevel=0
(stun/INFO) STUN-CLIENT(9PJr|IP4:192.168.1.151:52256/UDP|IP4:192.168.1.155:58107/UDP(host(IP4:192.168.1.151:52256/UDP)|candidate:0 1 UDP 2122252543 192.168.1.155 58107 typ host)): Received response; processing
(ice/INFO) ICE-PEER(PC:222222222222222 (id=1111111111url=(link to myhompage)):default)/CAND-PAIR(9PJr): setting pair to state SUCCEEDED: 9PJr|IP4:192.168.1.151:52256/UDP|IP4:192.168.1.155:58107/UDP(host(IP4:192.168.1.151:52256/UDP)|candidate:0 1 UDP 2122252543 192.168.1.155 58107 typ host)
(ice/INFO) ICE-PEER(PC:222222222222222 (id=1111111111url=(link to myhompage)):default)/STREAM(0-1519224369457000 (id=1111111111url=(link to myhompage)) aLevel=0)/COMP(1)/CAND-PAIR(9PJr): nominated pair is 9PJr|IP4:192.168.1.151:52256/UDP|IP4:192.168.1.155:58107/UDP(host(IP4:192.168.1.151:52256/UDP)|candidate:0 1 UDP 2122252543 192.168.1.155 58107 typ host)
(ice/INFO) ICE-PEER(PC:222222222222222 (id=1111111111url=(link to myhompage)):default)/STREAM(0-1519224369457000 (id=1111111111url=(link to myhompage)) aLevel=0)/COMP(1)/CAND-PAIR(9PJr): cancelling all pairs but 9PJr|IP4:192.168.1.151:52256/UDP|IP4:192.168.1.155:58107/UDP(host(IP4:192.168.1.151:52256/UDP)|candidate:0 1 UDP 2122252543 192.168.1.155 58107 typ host)
(ice/INFO) ICE-PEER(PC:222222222222222 (id=1111111111url=(link to myhompage)):default)/ICE-STREAM(0-1519224369457000 (id=1111111111url=(link to myhompage)) aLevel=0): all active components have nominated candidate pairs
(ice/INFO) ICE-PEER(PC:222222222222222 (id=1111111111url=(link to myhompage)):default): all checks completed success=1 fail=0
(stun/INFO) STUN-CLIENT(9PJr|IP4:192.168.1.151:52256/UDP|IP4:192.168.1.155:58107/UDP(host(IP4:192.168.1.151:52256/UDP)|candidate:0 1 UDP 2122252543 192.168.1.155 58107 typ host)): Received response; processing
(ice/INFO) ICE-PEER(PC:222222222222222 (id=1111111111url=(link to myhompage)):default)/CAND-PAIR(9PJr): setting pair to state SUCCEEDED: 9PJr|IP4:192.168.1.151:52256/UDP|IP4:192.168.1.155:58107/UDP(host(IP4:192.168.1.151:52256/UDP)|candidate:0 1 UDP 2122252543 192.168.1.155 58107 typ host)
(ice/ERR) ICE(PC:222222222222222 (id=1111111111url=(link to myhompage))): peer (PC:222222222222222 (id=1111111111url=(link to myhompage)):default), stream(0-1519224369457000 (id=1111111111url=(link to myhompage)) aLevel=0) tried to trickle ICE in inappropriate state 4
+++++++ END ++++++++

如果有人可以帮助我,那将不胜感激。谢谢。

4

1 回答 1

7

我怀疑您的某些配置未在您的 CoTurn 服务器上正确设置。我会给你适合我的配置。我还使用 Ubuntu Server 16.04 LTS(数字海洋)。首先删除您的 CoTurn 服务器(最好使用新的 droplet),然后重新安装:

sudo apt-get update
sudo apt-get install coturn

接下来,编辑sudo vi /etc/turnserver.conf并将其更改为以下选项(删除所有其他设置):

fingerprint
lt-cred-mech
realm=ip-of-your-server-accessible-from-outside
listening-ip=ip-of-your-server-accessible-from-outside
user=test:test

接下来,编辑sudo vi /etc/default/coturn并将其更改为以下选项(删除所有其他设置):

TURNSERVER_ENABLED=1

Ubuntu 上的防火墙可能会阻止传入连接。配置您的服务器以允许端口 3478 上的传入 STUN / TURN 连接。如果您使用 UFW,命令是:

sudo ufw allow 3478

重新启动您的 Ubuntu 服务器。重新启动后,确保您的 turnserver 正在运行:

turnserver -o

再次重新启动 Ubuntu 后,turnserver 不再运行。要克服这个问题,您可能希望 turnserver 成为系统服务。

在您的应用程序中,您需要添加以下内容:

peerConnectionConfig = {
    'iceServers': [
      { 'urls': 'stun:ip-of-your-server:3478' },
      { 'urls': 'turn:ip-of-your-server:3478', 'username': 'test', 'credential': 'test' }
    ]
  };
peerConnection = new RTCPeerConnection(peerConnectionConfig);

在 Firefox 中的两个选项卡中运行您的 WebRTC 应用程序,它们在同一 LAN 中建立连接。因为您的应用程序现在不会使用 STUN 或 TURN,所以我们可以确定应用程序不是问题所在

现在做同样的测试,但强制 Firefox 使用 TURN 服务器或replay. 打开一个新选项卡并键入about:config. 搜索media.peerconnection.ice.relay_only并将其设置为true. 目前 Firefox 只使用 TURN 中继。如果您的 WebRTC 应用程序现在可以运行,您可以确定您的 TURN 服务器运行良好。

于 2018-02-22T11:26:19.073 回答