drma usama
drma usama

Reputation: 105

ICE failed, your TURN server appears to be broken, see about:webrtc for more details

Im trying to find client Ip address using WebRTC, but in firefox im getting this error :

ICE failed, your TURN server appears to be broken, see about:webrtc for more details

     var myPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
            var pc = new myPeerConnection({ iceServers: [
   { url: "turn:numb.viagenie.ca:3478", username: "[email protected]", "credential": "xxxxxx" },
   { urls: "stun:stun.l.google.com:19302" }


] }),
                noop = function () { },
                localIPs = {},
                ipRegex = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/g,
                key;
            function ipIterate(ip) {
                if (!localIPs[ip]) onNewIP(ip);
                localIPs[ip] = true;
            }
            pc.createDataChannel("");
            pc.createOffer(function (sdp) {
                sdp.sdp.split('\n').forEach(function (line) {
                    if (line.indexOf('candidate') < 0) return;
                    line.match(ipRegex).forEach(ipIterate);
                });
                pc.setLocalDescription(sdp, noop, noop);
            }, noop);
            pc.onicecandidate = function (ice) {
                if (!ice || !ice.candidate || !ice.candidate.candidate || !ice.candidate.candidate.match(ipRegex)) return;
                ice.candidate.candidate.match(ipRegex).forEach(ipIterate);
            };

log in about:webrtc:

about:webrtc

ICE Relay log

0.009 rtp host 3350409123 udp e6e7f092-e632-4986-97b2-90b20c3b15cd.local 59923 126 | 30 | 255 0.062 rtp srflx 842163049 udp IP 59923 100 | 30 | 255 0.313 rtp relay 453802058 udp IP 57652 2 | 30 | 255 0.313 Done 0.315

Upvotes: 4

Views: 17136

Answers (2)

Bhautik
Bhautik

Reputation: 19

go to about:webrtc in firefox and tap clear history and clear log. in my case that's work for me

Upvotes: 0

msd
msd

Reputation: 123

This could be caused by some "privacy" addons (for example, the "Prevent WebRTC from leaking local IP addresses" setting of ublock could cause this problem). So, make sure the value of media.peerconnection.ice.proxy_only in about:config is not set to true

Upvotes: 1

Related Questions