I am having troubles with a webrtc app that works fine on all the PCs I test, even virtual machines, but it's not working on a Windows Server 2012 R2. I tracked it down to missing Server Reflexive (srflx) candidate on the server.
With this piece of test code (running it on a chrome dev console):
var rtc = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
var r = new rtc({ iceServers: [{ urls: "stun:stun.l.google.com:19302" }] }, {});
r.onicecandidate = function (a) { console.log('candidate:', JSON.stringify(a.candidate)); };
r.onicecandidateerror = function(a) { console.log('error:', a); }
r.createDataChannel("");
r.createOffer().then(x);
function x(a) {
r.setLocalDescription(a, function () {}, function () {});
}
On my PC, it shows something like this:
candidate: {"candidate":"candidate:1221703924 1 udp 2113937151 a044b6a7-4d08-XXXX-XXXX-bc858326ac0f.local 59233 typ host generation 0 ufrag IYpO network-cost 999","sdpMid":"0","sdpMLineIndex":0}
candidate: {"candidate":"candidate:842163049 1 udp 1677729535 111.222.333.444 59233 typ srflx raddr 0.0.0.0 rport 0 generation 0 ufrag IYpO network-cost 999","sdpMid":"0","sdpMLineIndex":0}
candidate: null
But on the server it looks like this:
candidate: {"candidate":"candidate:3704228534 1 udp 2113937151 e277d76d-XXXX-XXXX-9471-3461192326ad.local 50857 typ host generation 0 ufrag WWDW network-cost 999","sdpMid":"0","sdpMLineIndex":0}
candidate: null
What could be causing the srflx candidate to be missing? Using a turn server with credentials instead of stun does the same thing. Also tried turning off windows firewall.
Same thing here. Your issue is likely udp comms blocked, but mine is from running a local STUN server with no NAT in between. A nonsense host candidate is resolved with MDNS. Since it matches the ip of the srflx candidate, it's discarded. If you're on a local network and can't resolve MDNS, you need a relay, which is trash. My private ip address is 10.43.212.107. The whole world can have it. I don't give a flying monkey's arse. MDNS is trash!
5.1.3. Eliminating Redundant Candidates
Next, the ICE agents (initiating and responding) eliminate redundant candidates. Two candidates can have the same transport address yet different bases, and these would not be considered redundant. Frequently, a server-reflexive candidate and a host candidate will be redundant when the agent is not behind a NAT. A candidate is redundant if and only if its transport address and base equal those of another candidate. The agent SHOULD eliminate the redundant candidate with the lower priority.