openvidu-server flush Redis DB on launch. openviud-browser tcp ICEServer

pull/88/merge
pabloFuente 2018-06-22 15:17:55 +02:00
parent 001d938312
commit 3b838baceb
3 changed files with 42 additions and 19 deletions

View File

@ -945,11 +945,10 @@ export class Session implements EventDispatcher {
this.openvidu.recorder = true;
}
if (!!turnUsername && !!turnCredential) {
const turnUrl = 'turn:' + url.hostname + ':3478';
this.openvidu.turnCredentials = { urls: [turnUrl], username: turnUsername, credential: turnCredential };
console.warn(turnUrl);
console.warn(turnUsername);
console.warn(turnCredential);
const turnUrl1 = 'turn:' + url.hostname + ':3478';
const turnUrl2 = turnUrl1 + '?transport=tcp';
this.openvidu.turnCredentials = { urls: [turnUrl1, turnUrl2], username: turnUsername, credential: turnCredential };
console.log('TURN temp credentials [' + turnUsername + ':' + turnCredential + ']')
}
if (!!role) {
this.openvidu.role = role;

View File

@ -113,20 +113,34 @@ export class WebRtcStats {
remoteCandidateId = stat.remoteCandidateId;
}
}
const finalLocalCandidate = localCandidates[localCandidateId];
finalLocalCandidate.raw = this.stream.getLocalIceCandidateList().filter((c: RTCIceCandidate) => {
let finalLocalCandidate = localCandidates[localCandidateId];
if (!!finalLocalCandidate) {
const candList = this.stream.getLocalIceCandidateList();
const cand = candList.filter((c: RTCIceCandidate) => {
return (!!c.candidate &&
c.candidate.indexOf(finalLocalCandidate.ipAddress) > 0 &&
c.candidate.indexOf(finalLocalCandidate.portNumber) > 0) &&
c.candidate.indexOf(finalLocalCandidate.priority) > 0;
})[0].candidate;
const finalRemoteCandidate = remoteCandidates[remoteCandidateId];
finalRemoteCandidate.raw = this.stream.getRemoteIceCandidateList().filter((c: RTCIceCandidate) => {
c.candidate.indexOf(finalLocalCandidate.ipAddress) >= 0 &&
c.candidate.indexOf(finalLocalCandidate.portNumber) >= 0 &&
c.candidate.indexOf(finalLocalCandidate.priority) >= 0);
});
finalLocalCandidate.raw = !!cand[0] ? cand[0].candidate : 'ERROR: Cannot find local candidate in list of sent ICE candidates';
} else {
finalLocalCandidate = 'ERROR: No active local ICE candidate. Probably ICE-TCP is being used'
}
let finalRemoteCandidate = remoteCandidates[remoteCandidateId];
if (!!finalRemoteCandidate) {
const candList = this.stream.getRemoteIceCandidateList();
const cand = candList.filter((c: RTCIceCandidate) => {
return (!!c.candidate &&
c.candidate.indexOf(finalRemoteCandidate.ipAddress) > 0 &&
c.candidate.indexOf(finalRemoteCandidate.portNumber) > 0) &&
c.candidate.indexOf(finalRemoteCandidate.priority) > 0;
})[0].candidate;
c.candidate.indexOf(finalRemoteCandidate.ipAddress) >= 0 &&
c.candidate.indexOf(finalRemoteCandidate.portNumber) >= 0 &&
c.candidate.indexOf(finalRemoteCandidate.priority) >= 0);
});
finalRemoteCandidate.raw = !!cand[0] ? cand[0].candidate : 'ERROR: Cannot find remote candidate in list of received ICE candidates';
} else {
finalRemoteCandidate = 'ERROR: No active remote ICE candidate. Probably ICE-TCP is being used'
}
resolve({
googCandidatePair,
localCandidate: finalLocalCandidate,

View File

@ -25,6 +25,16 @@ public class BashCoturnCredentialsService extends CoturnCredentialsService {
this.coturnAvailable = false;
} else {
log.info("COTURN Redis DB accessible with string " + this.coturnDatabaseString);
log.info("Cleaning COTURN DB...");
response = CommandExecutor.execCommand("/bin/sh", "-c",
"redis-cli -n " + this.openviduConfig.getCoturnDatabaseDbname() + " flushdb");
String response2 = CommandExecutor.execCommand("/bin/sh", "-c",
"redis-cli -n " + this.openviduConfig.getCoturnDatabaseDbname() + " --scan --pattern '*'");
if ("OK".equals(response) && response2.isEmpty()) {
log.info("COTURN DB is now empty");
} else {
log.error("COTURN DB is not empty");
}
}
} catch (IOException | InterruptedException e) {
e.printStackTrace();