openvidu-server COTURN DB configuration extended on startup

pull/73/head
pabloFuente 2018-06-07 16:41:13 +02:00
parent 3166f67f0d
commit b480eca0af
2 changed files with 15 additions and 5 deletions

View File

@ -206,11 +206,13 @@ public abstract class SessionManager {
TurnCredentials turnCredentials = null;
if (this.coturnCredentialsService.isCoturnAvailable()) {
turnCredentials = coturnCredentialsService.createUser();
if (turnCredentials != null) {
if (turnCredentials != null) {
token += "&turnUsername=" + turnCredentials.getUsername();
token += "&turnCredential=" + turnCredentials.getCredential();
}
}
}
Token t = new Token(token, role, serverMetadata, turnCredentials);
final String finalToken = token;
@ -282,9 +284,11 @@ public abstract class SessionManager {
TurnCredentials turnCredentials = null;
if (this.coturnCredentialsService.isCoturnAvailable()) {
turnCredentials = coturnCredentialsService.createUser();
if (turnCredentials != null) {
token += "&turnUsername=" + turnCredentials.getUsername();
token += "&turnCredential=" + turnCredentials.getCredential();
}
}
Token t = new Token(token, role, serverMetadata, turnCredentials);
map.putIfAbsent(token, t);

View File

@ -22,9 +22,15 @@ public class BashCoturnCredentialsService extends CoturnCredentialsService {
if (response.contains("turnadmin: not found")) {
// No coturn installed in the host machine
log.warn("No COTURN server is installed in the host machine");
log.warn("No COTURN server will be configured for clients");
this.coturnAvailable = false;
}
} else if (response.contains("Cannot open SQLite DB connection")) {
log.warn("COTURN SQLite database is not accesible at path " + this.coturnDatabaseLocation);
log.warn("No COTURN server will be configured for clients");
this.coturnAvailable = false;
} else {
log.info("COTURN sqlite database location: " + this.openviduConfig.getCoturnSqlite());
}
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}