我正在从localhost运行hello-world客户端示例。
Kurento媒体服务器安装在Amazon ec2实例上。打开所有TCP和UDP端口。对于kurento,配置了google STUN服务器,并将来自Amazon的公共IP分配给HttpEndPoint(宣布的IP)我设法建立套接字连接并交换icec候选者。
更新在WebRtcEnpoint.conf.ini中这样配置Stun服务器:stunServerAddress=stun.1.google.comstunServerPort = 19302
在这篇文章的时候,这个STUN似乎工作得很好。
最后两帧总是这样返回:
{"id":26,"jsonrpc":"2.0","result":{"sessionId":"4b9642c4-5d42-41e0-ba61-83698b85552f","value":null}}
{"id":27,"jsonrpc":"2.0","result":{"sessionId":"4b9642c4-5d42-41e0-ba61-83698b85552f","value":null}}
使值始终为null。
下面是完整的帧交换列表:
{"id":15,"jsonrpc":"2.0","result":{"sessionId":"4b9642c4-5d42-41e0-ba61-83698b85552f","value":null}} 101
13:20:50.185
{"id":16,"jsonrpc":"2.0","result":{"sessionId":"4b9642c4-5d42-41e0-ba61-83698b85552f","value":null}} 101
13:20:50.185
{"id":17,"jsonrpc":"2.0","result":{"sessionId":"4b9642c4-5d42-41e0-ba61-83698b85552f","value":null}} 101
13:20:50.185
{"id":18,"jsonrpc":"2.0","result":{"sessionId":"4b9642c4-5d42-41e0-ba61-83698b85552f","value":null}} 101
13:20:50.210
{"id":19,"jsonrpc":"2.0","result":{"sessionId":"4b9642c4-5d42-41e0-ba61-83698b85552f","value":null}} 101
13:20:50.210
{"id":20,"jsonrpc":"2.0","result":{"sessionId":"4b9642c4-5d42-41e0-ba61-83698b85552f","value":null}} 101
13:20:50.210
{"id":21,"jsonrpc":"2.0","result":{"sessionId":"4b9642c4-5d42-41e0-ba61-83698b85552f","value":null}} 101
13:20:50.210
{"id":22,"jsonrpc":"2.0","result":{"sessionId":"4b9642c4-5d42-41e0-ba61-83698b85552f","value":null}} 101
13:20:50.210
{"id":23,"jsonrpc":"2.0","result":{"sessionId":"4b9642c4-5d42-41e0-ba61-83698b85552f","value":null}} 101
13:20:50.210
{"id":24,"jsonrpc":"2.0","result":{"sessionId":"4b9642c4-5d42-41e0-ba61-83698b85552f","value":"32d60f30-b7c6-4bba-a626-2af81356641d"}} 135
13:20:50.211
{"id":25,"jsonrpc":"2.0","result":{"sessionId":"4b9642c4-5d42-41e0-ba61-83698b85552f","value":"v=0rno=- 3652338053 3652338053 IN IP4 0.0.0.0rns=Kurento Media Serverrnc=IN IP4 0.0.0.0rnt=0 0rna=msid-semantic: WMS GQCQVoS3xcQNmo4JJyGzwHIL1YzJ8QPZiQP3rna=group:BUNDLE audio videornm=audio 1 RTP/SAVPF 111 0rna=rtcp:9 IN IP4 0.0.0.0rna=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-timerna=rtpmap:111 opus/48000/2rna=rtpmap:0 PCMU/8000rna=setup:activerna=mid:audiorna=sendrecvrna=rtcp-muxrna=fmtp:111 minptime=10; useinbandfec=1rna=maxptime:60rna=ssrc:142379529 cname:user3741506464@host-cb3eed9arna=ice-ufrag:Rk14rna=ice-pwd:N8cBI2tYxNA96MBRt33lr/rna=fingerprint:sha-256 60:F6:3A:EB:47:7E:01:9C:B1:A8:7A:F2:4A:6A:98:A0:E9:1B:04:64:E9:76:04:AF:2F:19:96:FC:27:38:4D:B7rnm=video 1 RTP/SAVPF 100rnb=AS:500rna=rtcp:9 IN IP4 0.0.0.0rna=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-timerna=rtpmap:100 VP8/90000rna=rtcp-fb:100 ccm firrna=rtcp-fb:100 nackrna=rtcp-fb:100 nack plirna=rtcp-fb:100 goog-rembrna=setup:activerna=mid:videorna=sendrecvrna=rtcp-muxrna=ssrc:3535835016 cname:user3741506464@host-cb3eed9arna=ice-ufrag:Rk14rna=ice-pwd:N8cBI2tYxNA96MBRt33lr/rna=fingerprint:sha-256 60:F6:3A:EB:47:7E:01:9C:B1:A8:7A:F2:4A:6A:98:A0:E9:1B:04:64:E9:76:04:AF:2F:19:96:FC:27:38:4D:B7rn"}} 1389
13:20:50.211
{"jsonrpc":"2.0","method":"onEvent","params":{"value":{"data":{"candidate":{"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:1 1 UDP 2013266431 10.189.139.160 44044 typ host","sdpMLineIndex":0,"sdpMid":"audio"},"source":"a7d787c2-c252-47e5-b576-8923f69886a0_kurento.MediaPipeline/73f8d561-6349-4d1d-b2e6-9e2743e0c8d2_kurento.WebRtcEndpoint","tags":[],"timestamp":"1443349253","type":"OnIceCandidate"},"object":"a7d787c2-c252-47e5-b576-8923f69886a0_kurento.MediaPipeline/73f8d561-6349-4d1d-b2e6-9e2743e0c8d2_kurento.WebRtcEndpoint","type":"OnIceCandidate"}}} 581
13:20:50.215
{"jsonrpc":"2.0","method":"onEvent","params":{"value":{"data":{"candidate":{"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:1 1 UDP 2013266431 10.189.139.160 44044 typ host","sdpMLineIndex":1,"sdpMid":"video"},"source":"a7d787c2-c252-47e5-b576-8923f69886a0_kurento.MediaPipeline/73f8d561-6349-4d1d-b2e6-9e2743e0c8d2_kurento.WebRtcEndpoint","tags":[],"timestamp":"1443349253","type":"OnIceCandidate"},"object":"a7d787c2-c252-47e5-b576-8923f69886a0_kurento.MediaPipeline/73f8d561-6349-4d1d-b2e6-9e2743e0c8d2_kurento.WebRtcEndpoint","type":"OnIceCandidate"}}} 581
13:20:50.215
{"jsonrpc":"2.0","method":"onEvent","params":{"value":{"data":{"candidate":{"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:1 2 UDP 2013266430 10.189.139.160 46539 typ host","sdpMLineIndex":0,"sdpMid":"audio"},"source":"a7d787c2-c252-47e5-b576-8923f69886a0_kurento.MediaPipeline/73f8d561-6349-4d1d-b2e6-9e2743e0c8d2_kurento.WebRtcEndpoint","tags":[],"timestamp":"1443349253","type":"OnIceCandidate"},"object":"a7d787c2-c252-47e5-b576-8923f69886a0_kurento.MediaPipeline/73f8d561-6349-4d1d-b2e6-9e2743e0c8d2_kurento.WebRtcEndpoint","type":"OnIceCandidate"}}} 581
13:20:50.215
{"jsonrpc":"2.0","method":"onEvent","params":{"value":{"data":{"candidate":{"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:1 2 UDP 2013266430 10.189.139.160 46539 typ host","sdpMLineIndex":1,"sdpMid":"video"},"source":"a7d787c2-c252-47e5-b576-8923f69886a0_kurento.MediaPipeline/73f8d561-6349-4d1d-b2e6-9e2743e0c8d2_kurento.WebRtcEndpoint","tags":[],"timestamp":"1443349253","type":"OnIceCandidate"},"object":"a7d787c2-c252-47e5-b576-8923f69886a0_kurento.MediaPipeline/73f8d561-6349-4d1d-b2e6-9e2743e0c8d2_kurento.WebRtcEndpoint","type":"OnIceCandidate"}}} 581
13:20:50.535
{"id":26,"jsonrpc":"2.0","result":{"sessionId":"4b9642c4-5d42-41e0-ba61-83698b85552f","value":null}} 101
13:20:50.535
{"id":27,"jsonrpc":"2.0","result":{"sessionId":"4b9642c4-5d42-41e0-ba61-83698b85552f","value":null}} 101
13:20:50.53
你的KMS没有生成STUN候选,正如你从这个帧中看到的
13:20:50.211
{"jsonrpc":"2.0","method":"onEvent","params":{"value":{"data":{"candidate":{"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:1 1 UDP 2013266431 10.189.139.160 44044 typ host","sdpMLineIndex":0,"sdpMid":"audio"},"source":"a7d787c2-c252-47e5-b576-8923f69886a0_kurento.MediaPipeline/73f8d561-6349-4d1d-b2e6-9e2743e0c8d2_kurento.WebRtcEndpoint","tags":[],"timestamp":"1443349253","type":"OnIceCandidate"},"object":"a7d787c2-c252-47e5-b576-8923f69886a0_kurento.MediaPipeline/73f8d561-6349-4d1d-b2e6-9e2743e0c8d2_kurento.WebRtcEndpoint","type":"OnIceCandidate"}}} 581
13:20:50.215
{"jsonrpc":"2.0","method":"onEvent","params":{"value":{"data":{"candidate":{"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:1 1 UDP 2013266431 10.189.139.160 44044 typ host","sdpMLineIndex":1,"sdpMid":"video"},"source":"a7d787c2-c252-47e5-b576-8923f69886a0_kurento.MediaPipeline/73f8d561-6349-4d1d-b2e6-9e2743e0c8d2_kurento.WebRtcEndpoint","tags":[],"timestamp":"1443349253","type":"OnIceCandidate"},"object":"a7d787c2-c252-47e5-b576-8923f69886a0_kurento.MediaPipeline/73f8d561-6349-4d1d-b2e6-9e2743e0c8d2_kurento.WebRtcEndpoint","type":"OnIceCandidate"}}} 581
13:20:50.215
{"jsonrpc":"2.0","method":"onEvent","params":{"value":{"data":{"candidate":{"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:1 2 UDP 2013266430 10.189.139.160 46539 typ host","sdpMLineIndex":0,"sdpMid":"audio"},"source":"a7d787c2-c252-47e5-b576-8923f69886a0_kurento.MediaPipeline/73f8d561-6349-4d1d-b2e6-9e2743e0c8d2_kurento.WebRtcEndpoint","tags":[],"timestamp":"1443349253","type":"OnIceCandidate"},"object":"a7d787c2-c252-47e5-b576-8923f69886a0_kurento.MediaPipeline/73f8d561-6349-4d1d-b2e6-9e2743e0c8d2_kurento.WebRtcEndpoint","type":"OnIceCandidate"}}} 581
13:20:50.215
{"jsonrpc":"2.0","method":"onEvent","params":{"value":{"data":{"candidate":{"__module__":"kurento","__type__":"IceCandidate","candidate":"candidate:1 2 UDP 2013266430 10.189.139.160 46539 typ host","sdpMLineIndex":1,"sdpMid":"video"},"source":"a7d787c2-c252-47e5-b576-8923f69886a0_kurento.MediaPipeline/73f8d561-6349-4d1d-b2e6-9e2743e0c8d2_kurento.WebRtcEndpoint","tags":[],"timestamp":"1443349253","type":"OnIceCandidate"},"object":"a7d787c2-c252-47e5-b576-8923f69886a0_kurento.MediaPipeline/73f8d561-6349-4d1d-b2e6-9e2743e0c8d2_kurento.WebRtcEndpoint","type":"OnIceCandidate"}}} 581
这意味着您的STUN配置不正确,或者配置的STUN服务器不工作。您可以查看这个公共STUN服务器列表,并记住您只能在KMS配置中使用ip,因为libnice不接受cname。
旁注:HttpEndPoint
配置对WebRTC功能没有任何影响
编辑1
你在你的STUN配置中使用了cname,这是不支持的。请阅读这部分文档,了解如何配置KMS以使用STUN/TURN。应该是这样的
stunServerAddress=173.194.66.127
stunServerPort=19302
确保您使用的服务器正在工作。您可能需要检查其中的几个