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; this.openvidu.recorder = true;
} }
if (!!turnUsername && !!turnCredential) { if (!!turnUsername && !!turnCredential) {
const turnUrl = 'turn:' + url.hostname + ':3478'; const turnUrl1 = 'turn:' + url.hostname + ':3478';
this.openvidu.turnCredentials = { urls: [turnUrl], username: turnUsername, credential: turnCredential }; const turnUrl2 = turnUrl1 + '?transport=tcp';
console.warn(turnUrl); this.openvidu.turnCredentials = { urls: [turnUrl1, turnUrl2], username: turnUsername, credential: turnCredential };
console.warn(turnUsername); console.log('TURN temp credentials [' + turnUsername + ':' + turnCredential + ']')
console.warn(turnCredential);
} }
if (!!role) { if (!!role) {
this.openvidu.role = role; this.openvidu.role = role;

View File

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

View File

@ -25,6 +25,16 @@ public class BashCoturnCredentialsService extends CoturnCredentialsService {
this.coturnAvailable = false; this.coturnAvailable = false;
} else { } else {
log.info("COTURN Redis DB accessible with string " + this.coturnDatabaseString); 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) { } catch (IOException | InterruptedException e) {
e.printStackTrace(); e.printStackTrace();