简体   繁体   English

为什么我的WebRTC连接在某些网络上不起作用?

[英]Why my WebRTC connection doesn't works at some networks?

I've customized Apprtc project (android version). 我已自定义Apprtc项目(Android版本)。 assume we have four internet connection (from different network connections): 假设我们有四个Internet连接(来自不同的网络连接):

NetA -- NetB NetA - NetB

NetC -- NetD NetC - NetD

I can connect from NetA to NetB , but i can't connect from NetC to NetD ! 我可以从NetA连接到NetB ,但不能从NetC连接到NetD

I have set turn server and stun server but i don't know what is wrong. 我设置了turn serverstun server但我不知道出了什么问题。

-- -

When connecting from NetA to NetB (success): NetA连接到NetB (成功)时:

Offer SDP: 优惠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=audio 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 .............." “ v = 0 \\ r \\ no =-632333030865012591 2 IN IP4 127.0.0.1 \\ r \\ ns =-\\ r \\ nt = 0 0 \\ r \\ na = group:Bundle音频视频\\ r \\ na = msid语义:WMS ARDAMS ___ \\ r \\ nm =音频9 UDP / TLS / RTP / SAVPF 111103 9102 0 8 105 13 126 \\ r \\ nc = IN IP4 0.0.0.0 \\ r \\ na = rtcp:9 IN IP4 ...... ........”

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

"candidate: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" “候选人:411053810 1 udp 1686052607 5.116.182.156 1026 typ srflx raddr 100.95.184.57 rport 37422第0代ufrag NL4P network-id 3 network-cost 900”

"candidate: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" “候选:3902036248 1 udp 41885695 34.197.185.148 52061典型继电器raddr 5.116.182.156移动1026代0 ufrag NL4P network-id 3 network-cost 900”

"candidate":"candidate: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" “ candidate”:“ candidate: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”

Answer SDP: 回答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=audio 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............" “ v = 0 \\ r \\ no =-3736097442176838392 2 IN IP4 127.0.0.1 \\ r \\ ns =-\\ r \\ nt = 0 0 \\ r \\ na = group:Bundle音频视频\\ r \\ na = msid语义:WMS ARDAMS ___ \\ r \\ nm =音频9 UDP / TLS / RTP / SAVPF 111103 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 =冰ufrag:7upj \\ r \\呐............”

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

"candidate: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" “候选人: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”

"candidate: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" “候选:3902036248 1 udp 41885695 34.197.185.148 52063典型继电器raddr 151.242.87.74出口37718生成0 ufrag 7upj network-id 3 network-cost 10”

"candidate":"candidate: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" “候选人”:“候选人: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”

-- -

When connecting from NetC to NetD (failed): NetC连接到NetD (失败):

Offer SDP: 优惠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=audio 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=fingerprint:sha-256................." “ v = 0 \\ r \\ no =-280763199112942253 2 IN IP4 127.0.0.1 \\ r \\ ns =-\\ r \\ nt = 0 0 \\ r \\ na = group:Bundle音频视频\\ r \\ na = msid语义:WMS ARDAMS ___ \\ r \\ nm =音频9 UDP / TLS / RTP / SAVPF 111103 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 =冰ufrag:UPpi \\ r \\ NA =冰冷PWD:Ow2J0AHuS86I0o0yZ5MOv6a / \\ r \\ NA =冰冷选项:再提名\\ r \\ NA =指纹:SHA-256 ............ .....”

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

"candidate":"candidate: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" “候选人”:“候选人: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”

"candidate":"candidate: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" “候选人”:“候选人: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”

"candidate":"candidate: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" “ candidate”:“ candidate: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”

Answer SDP: 回答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=audio 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=fingerprint: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.............." “ v = 0 \\ r \\ no =-6478139475592243492 2 IN IP4 127.0.0.1 \\ r \\ ns =-\\ r \\ nt = 0 0 \\ r \\ na = group:Bundle音频视频\\ r \\ na = msid语义:WMS ARDAMS ___ \\ r \\ nm =音频9 UDP / TLS / RTP / SAVPF 111103 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 = fingerprint: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 =设置:活性..............”

"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" “候选”,“标签”:0,“ id”:“音频”,“候选”:“候选:1106113138 1 udp 2122260223 192.168.1.169 44238 typ host generation 0 ufrag Js6x network-id 3 network-cost 10”

"candidate":"candidate:3232101574 1 udp 1686052607 151.247.139.59 44238 typ srflx raddr 192.168.1.169 rport 44238 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 generation 0 ufrag Js6x network-id 3 network-cost 10”

"candidate":"candidate: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" “候选人”:“候选人: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”

"candidate":"candidate: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" “ candidate”:“ candidate: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”

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

"candidate":"candidate: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" “候选人”:“候选人: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”

"candidate":"candidate: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" “ candidate”:“ candidate: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”

"candidate":"candidate: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" “ candidate”:“ candidate: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”

EDIT : 编辑:

Thanks to all. 谢谢大家。 I found my problem is from my turn server. 我发现问题出在我的转弯服务器上。 I can connect in any situation when using appr.tc ice servers (google turn servers). 使用appr.tc ice服务器(谷歌转弯服务器)时,无论如何我都可以连接。 but i can't connect with my turn server. 但是我无法连接我的转弯服务器。 please check question about my turn server at this page : 请在此页面检查有关我的转弯服务器的问题:

Why my turn server doesn't work? 为什么我的转弯服务器不起作用?

Take a look at this article Introduction to WebRTC protocols . 看一下本文WebRTC协议简介

You need to set up STUN and TURN server, to pass the firewall. 您需要设置STUN和TURN服务器,以通过防火墙。 If peer is behind a firewall or a router, by connecting only to IP address you will hit router not the requested peer device. 如果对等设备位于防火墙或路由器后面,则通过仅连接到IP地址,您将访问路由器而不是请求的对等设备。 etc etc. 等等等

I would begin to test my TURN server if it is really working. 我将开始测试TURN服务器是否确实有效。 Disable direct links on your firewall (between NetC and NetD or just block the peer IP) to see if it is working via TURN. 禁用防火墙上的直接链接(在NetC和NetD之间或仅阻止对等IP),以查看它是否可以通过TURN运行。 If not, then fix your TURN server or it's configuration. 如果不是,则修复您的TURN服务器或它的配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM