2

我已经定制了 Apprtc项目(安卓版)。假设我们有四个互联网连接(来自不同的网络连接):

NetA --NetB

NetC --NetD

我可以从NetAto连接NetB,但我无法从NetCto连接NetD

我已经设置了turn serverstun server但我不知道出了什么问题。

--

NetAto连接时NetB(成功):

提供 SDP:

"v=0\r\no=- 632333030865012591 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE audio video\r\na=msid-semantic: WMS ARDAMS___\r\nm=音频 9 UDP/TLS/RTP/SAVPF 111 103 9 102 0 8 105 13 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 ...... …………”

“候选人:2580031558 1 udp 2122260223 100.95.184.57 37422 typ host generation 0 ufrag NL4P network-id 3 network-cost 900”

“候选人:411053810 1 udp 1686052607 5.116.182.156 1026 typ srflx raddr 100.95.184.57 rport 37422 generation 0 ufrag NL4P network-id 3 network-cost 900”

“候选人:3902036248 1 udp 41885695 34.197.185.148 52061 typ relay raddr 5.116.182.156 rport 1026 generation 0 ufrag NL4P network-id 3 network-cost 900”

“候选人”:“候选人:2786567656 1 udp 25108223 34.197.185.148 52062 typ relay raddr 5.116.182.156 rport 1032 generation 0 ufrag NL4P network-id 3 network-cost 900”

回答 SDP:

"v=0\r\no=- 3736097442176838392 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE audio video\r\na=msid-semantic: WMS ARDAMS___\r\nm=音频 9 UDP/TLS/RTP/SAVPF 111 103 9 102 0 8 105 13 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\ na=ice-ufrag:7upj\r\na…………”

“候选人:1892013251 1 udp 2122260223 192.168.7.7 37718 typ host generation 0 ufrag 7upj network-id 3 network-cost 10”

“候选人:3650771734 1 udp 1686052607 151.242.87.74 37718 typ srflx raddr 192.168.7.7 rport 37718 generation 0 ufrag 7upj network-id 3 network-cost 10”

“候选人:3902036248 1 udp 41885695 34.197.185.148 52063 typ relay raddr 151.242.87.74 rport 37718 generation 0 ufrag 7upj network-id 3 network-cost 10”

“候选人”:“候选人:2786567656 1 udp 25108223 34.197.185.148 52064 typ relay raddr 151.242.87.74 rport 45889 generation 0 ufrag 7upj network-id 3 network-cost 10”

--

NetCto连接时NetD(失败):

提供 SDP:

"v=0\r\no=- 280763199112942253 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE audio video\r\na=msid-semantic: WMS ARDAMS___\r\nm=音频 9 UDP/TLS/RTP/SAVPF 111 103 9 102 0 8 105 13 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\ na=ice-ufrag:UPpi\r\na=ice-pwd:Ow2J0AHuS86I0o0yZ5MOv6a/\r\na=ice-options:renomination\r\na=指纹:sha-256............ ……”

“候选人”:“候选人:2580031558 1 udp 2122260223 100.95.184.57 34267 typ host generation 0 ufrag UPpi network-id 3 network-cost 900”

“候选人”:“候选人:411053810 1 udp 1686052607 5.116.182.156 1287 typ srflx raddr 100.95.184.57 rport 34267 generation 0 ufrag UPpi network-id 3 network-cost 900”

“候选人”:“候选人:3902036248 1 udp 41885695 34.197.185.148 58779 typ relay raddr 5.116.182.156 rport 1287 generation 0 ufrag UPpi network-id 3 network-cost 900”

“候选人”:“候选人:2786567656 1 udp 25108223 34.197.185.148 58780 typ relay raddr 5.116.182.156 rport 1201 generation 0 ufrag UPpi network-id 3 network-cost 900”

回答 SDP:

"v=0\r\no=- 6478139475592243492 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE audio video\r\na=msid-semantic: WMS ARDAMS___\r\nm=音频 9 UDP/TLS/RTP/SAVPF 111 103 9 102 0 8 105 13 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\ na=ice-ufrag:Js6x\r\na=ice-pwd:5tyUT023mAERirumK7aal+9F\r\na=ice-options:renomination\r\na=指纹:sha-256 45:97:7F:BC:37:90 :4D:B6:35:E5:23:C8:12:09:5A:43:D7:4B:03:EC:A0:7B:70:EB:E4:DB:12:B8:7B:1C:6E :5D\r\na=setup:active.......”

"candidate","label":0,"id":"audio","candidate":"candidate:1106113138 1 udp 2122260223 192.168.1.169 44238 typ host generation 0 ufrag Js6x network-id 3 network-cost 10"

“候选人”:“候选人:3232101574 1 udp 1686052607 151.247.139.59 44238 typ srflx raddr 192.168.1.169 rport 44238 代 0 ufrag Js6x 网络 ID 3 网络成本 10”

“候选人”:“候选人:3902036248 1 udp 41885695 34.197.185.148 58781 typ relay raddr 151.247.139.59 rport 44238 generation 0 ufrag Js6x network-id 3 network-cost 10”

“候选人”:“候选人:2786567656 1 udp 25108223 34.197.185.148 58782 typ relay raddr 151.247.139.59 rport 36519 generation 0 ufrag Js6x network-id 3 network-cost 10”

“候选人”:“候选人:238873586 1 udp 2122194687 100.116.182.76 48966 typ host generation 0 ufrag Js6x network-id 4 network-cost 900”

“候选人”:“候选人:3266434145 1 udp 1685987071 91.251.147.158 16369 typ srflx raddr 100.116.182.76 rport 48966 generation 0 ufrag Js6x network-id 4 network-cost 900”

“候选人”:“候选人:3902036248 1 udp 41820159 34.197.185.148 58783 typ relay raddr 91.251.147.158 rport 16369 generation 0 ufrag Js6x network-id 4 network-cost 900”

“候选人”:“候选人:2786567656 1 udp 25042687 34.197.185.148 58784 typ relay raddr 91.251.147.158 rport 16222 generation 0 ufrag Js6x network-id 4 network-cost 900”

编辑 :

谢谢大家。我发现我的问题出在我的转向服务器上。使用appr.tc ice 服务器(谷歌转服务器)时,我可以在任何情况下连接。但我无法连接到我的转向服务器。请在此页面检查有关我的轮到服务器的问题:

为什么我的回合服务器不工作?

4

2 回答 2

1

如果 TURN 服务器真的能正常工作,我会开始测试它。禁用防火墙上的直接链接(在 NetC 和 NetD 之间或只是阻止对等 IP)以查看它是否通过 TURN 工作。如果没有,请修复您的 TURN 服务器或其配置。

于 2017-07-10T18:59:43.873 回答
1

看看这篇文章WebRTC 协议简介

您需要设置 STUN 和 TURN 服务器,才能通过防火墙。如果对等点位于防火墙或路由器后面,通过仅连接到 IP 地址,您将访问路由器而不是请求的对等设备。等等等等

于 2017-06-29T01:56:38.363 回答