I am facing a problem. I can connect by webrtc in local network (using wifi), but not being able to connect to different netowrk. How can I solve this problem?
new RTCPeerConnection({
iceServers: [
{ urls: "stun:stun.l.google.com:19302" },
{ urls: "stun:stun1.l.google.com:19302" },
{ urls: "stun:stun2.l.google.com:19302" },
{ urls: "stun:stun3.l.google.com:19302" },
{
url: 'turn:numb.viagenie.ca',
credential: 'muazkh',
username: 'webrtc@live.com'
}
]
});
Caller -- (Cellular network) log
*** Negotiation needed
Track added - true
---> Creating offer
---> Setting local description to the offer
*** WebRTC signaling state changed to: have-local-offer
---> Sending the offer to the remote peer
{"type":"offer","sdp":"v=0\r\no=- 613095391791482847 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0\r\na=extmap-allow-mixed\r\na=msid-semantic: WMS Xfgp8d5z5kDjOpdAhdQ71GA5CQchvV6f1P29\r\nm=audio 9 UDP/TLS/RTP/SAVPF 111 103 9 0 8 105 13 110 113 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:yr8E\r\na=ice-pwd:aY0ptyV4+qlcN3O5i8l9ApdA\r\na=ice-options:trickle\r\na=fingerprint:sha-256 9B:51:75:EA:97:F5:0C:46:2F:54:3F:4B:55:34:6A:A0:AE:CB:F5:2A:AD:D3:EB:23:5F:2B:AA:F3:54:89:7C:D8\r\na=setup:actpass\r\na=mid:0\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=extmap:5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id\r\na=extmap:6 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id\r\na=sendrecv\r\na=msid:Xfgp8d5z5kDjOpdAhdQ71GA5CQchvV6f1P29 574ebf18-2253-4c92-9e22-c799159399c7\r\na=rtcp-mux\r\na=rtpmap:111 opus/48000/2\r\na=rtcp-fb:111 transport-cc\r\na=fmtp:111 minptime=10;useinbandfec=1\r\na=rtpmap:103 ISAC/16000\r\na=rtpmap:9 G722/8000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:105 CN/16000\r\na=rtpmap:13 CN/8000\r\na=rtpmap:110 telephone-event/48000\r\na=rtpmap:113 telephone-event/16000\r\na=rtpmap:126 telephone-event/8000\r\na=ssrc:954464282 cname:u4QAtLPWh6uHA7eN\r\na=ssrc:954464282 msid:Xfgp8d5z5kDjOpdAhdQ71GA5CQchvV6f1P29 574ebf18-2253-4c92-9e22-c799159399c7\r\na=ssrc:954464282 mslabel:Xfgp8d5z5kDjOpdAhdQ71GA5CQchvV6f1P29\r\na=ssrc:954464282 label:574ebf18-2253-4c92-9e22-c799159399c7\r\n"}
*** ICE gathering state changed to: gathering
*** Outgoing ICE candidate: candidate:3988473628 1 udp 2122260223 10.94.236.243 59747 typ host generation 0 ufrag yr8E network-id 1 network-cost 10
*** Outgoing ICE candidate: candidate:2738404332 1 tcp 1518280447 10.94.236.243 9 typ host tcptype active generation 0 ufrag yr8E network-id 1 network-cost 10
*** Outgoing ICE candidate: candidate:1827881384 1 udp 1686052607 103.253.46.151 11381 typ srflx raddr 10.94.236.243 rport 59747 generation 0 ufrag yr8E network-id 1 network-cost 10
*** Call recipient has accepted our call
*** Adding received ICE candidate: {"candidate":"candidate:3351850224 1 udp 2122260223 192.168.0.5 45822 typ host generation 0 ufrag ebh0 network-id 1 network-cost 10","sdpMid":"0","sdpMLineIndex":0}
*** WebRTC signaling state changed to: stable
***
ICE connection state changed to checking
*** Adding received ICE candidate: {"candidate":"candidate:2303381504 1 tcp 1518280447 192.168.0.5 9 typ host tcptype active generation 0 ufrag ebh0 network-id 1 network-cost 10","sdpMid":"0","sdpMLineIndex":0}
*** Adding received ICE candidate: {"candidate":"candidate:1855365925 1 udp 1686052607 103.138.125.193 45822 typ srflx raddr 192.168.0.5 rport 45822 generation 0 ufrag ebh0 network-id 1 network-cost 10","sdpMid":"0","sdpMLineIndex":0}
*** ICE connection state changed to disconnected
Disonnected
*** ICE gathering state changed to: complete
Receiver Log--- (Wifi/broadband connection)
Received video chat offer from cd625e27-f1e8-40f4-9cb2-0d415bccaf0b
- Setting remote description
*** WebRTC signaling state changed to: have-remote-offer
Track added - true
---> Creating and sending answer to caller
*** WebRTC signaling state changed to: stable
{"type":"answer","sdp":"v=0\r\no=- 1805969134806418443 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0\r\na=extmap-allow-mixed\r\na=msid-semantic: WMS fX8AVqBizpVv9FtfBPN3jn06D5G0TDxwzbve\r\nm=audio 9 UDP/TLS/RTP/SAVPF 111 103 9 0 8 105 13 110 113 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:ebh0\r\na=ice-pwd:IC096hRjgd0/J6riuOr5/4pL\r\na=ice-options:trickle\r\na=fingerprint:sha-256 EB:BD:EA:35:C9:C7:7A:D6:AE:95:1B:A5:52:E8:D7:62:74:72:89:70:08:09:88:8E:D5:B4:91:03:99:7E:9B:0A\r\na=setup:active\r\na=mid:0\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=sendrecv\r\na=msid:fX8AVqBizpVv9FtfBPN3jn06D5G0TDxwzbve 755ea3c3-a9cf-4ed3-b2e1-ca318c57860b\r\na=rtcp-mux\r\na=rtpmap:111 opus/48000/2\r\na=rtcp-fb:111 transport-cc\r\na=fmtp:111 minptime=10;useinbandfec=1\r\na=rtpmap:103 ISAC/16000\r\na=rtpmap:9 G722/8000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:105 CN/16000\r\na=rtpmap:13 CN/8000\r\na=rtpmap:110 telephone-event/48000\r\na=rtpmap:113 telephone-event/16000\r\na=rtpmap:126 telephone-event/8000\r\na=ssrc:678356208 cname:fq1NgjQWtrq1/SLi\r\n"}
*** ICE gathering state changed to: gathering
*** Outgoing ICE candidate: candidate:3351850224 1 udp 2122260223 192.168.0.5 45822 typ host generation 0 ufrag ebh0 network-id 1 network-cost 10
*** Outgoing ICE candidate: candidate:2303381504 1 tcp 1518280447 192.168.0.5 9 typ host tcptype active generation 0 ufrag ebh0 network-id 1 network-cost 10
*** Outgoing ICE candidate: candidate:1855365925 1 udp 1686052607 103.138.125.193 45822 typ srflx raddr 192.168.0.5 rport 45822 generation 0 ufrag ebh0 network-id 1 network-cost 10
*** ICE gathering state changed to: complete
By the logs you provided I can tell your turn server is not accessible as there are no relay
candidates on both ends.
The easiest way to check it is via trickle ice page. It might be that you use a wrong port, made a typo in credentials or that the server is not responding.