EasyRTC works only inside same LAN (ICE failed)

890 Views Asked by At

The problem is that the remote video can seen only if two computers are in same LAN Environment, namely from different ip's the remote video not seen and in the js console I get error ICE failed, see about:webrtc for more details.

I'm trying to search solution and found only that the problem may be because "ICE Candidates are received before answer is sent RemoteDescription should be set", but i have no idea how to correct it.

In part of other webrtc scripts, RTCMultiConnection for example not have this problem.

Any solution?

EasyRTC - http://easyrtc.com/download/

Running EasyRTC- http://wdd.co.il:8280

Update: my onIceCandidate

pc.onicecandidate = function(event) {
            if (newPeerConn.cancelled) {
                return;
            }
            var candidateData;
            if (event.candidate && peerConns[otherUser]) {
                candidateData = {
                    type: 'candidate',
                    label: event.candidate.sdpMLineIndex,
                    id: event.candidate.sdpMid,
                    candidate: event.candidate.candidate
                };

                if( iceCandidateFilter ) {
                   candidateData = iceCandidateFilter(candidateData, false);
                   if( !candidateData ) {
                      return;
                   }
                } 
                //
                // some candidates include ip addresses of turn servers. we'll want those 
                // later so we can see if our actual connection uses a turn server.
                // The keyword "relay" in the candidate identifies it as referencing a 
                // turn server. The \d symbol in the regular expression matches a number.
                // 
                if (event.candidate.candidate.indexOf("typ relay") > 0) {
                    var ipAddress = event.candidate.candidate.match(/(udp|tcp) \d+ (\d+\.\d+\.\d+\.\d+)/i)[2];
                    self._turnServers[ipAddress] = true;
                }

                if (peerConns[otherUser].connectionAccepted) {
                    sendSignalling(otherUser, "candidate", candidateData, null, function() {
                        failureCB(self.errCodes.PEER_GONE, "Candidate disappeared");
                    });
                }
                else {
                    peerConns[otherUser].candidatesToSend.push(candidateData);
                }
            }
        };
1

There are 1 best solutions below

1
On

If the two clients can reach each other while on the same subnet, but not across subnets, then the problem is invariably that either the supplied list of STUN servers isn't working for you, or you need a TURN server because your clients are behind nasty corporate firewalls or symmetric NATs that block pure P2P. Usually it's you need a TURN server. You can check this out by trying the demos at demo.easyrtc.com; they are backed by a TURN server. If you were running RTCMultiConnection demo from their site (rather than downloading it to your own), it was probably backed by a TURN server as well.

If you check the easyrtc google group, you'll see this question pop up once a week or so.

I wrote the client side of EasyRTC and answer most of the questions posted on the easyrtc google group (https://groups.google.com/forum/#!forum/easyrtc).