openvidu-server: Added coturn.ip configuration parameter

pull/391/head
cruizba 2020-01-25 16:50:33 +01:00
parent 9ecd8bfc66
commit 06225b4894
4 changed files with 15 additions and 5 deletions

View File

@ -38,6 +38,11 @@ import java.util.stream.Stream;
import javax.annotation.PostConstruct;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import org.apache.http.Header;
import org.apache.http.message.BasicHeader;
import org.kurento.jsonrpc.JsonUtils;
@ -50,11 +55,6 @@ import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.support.PropertiesLoaderUtils;
import org.springframework.stereotype.Component;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import io.openvidu.java.client.OpenViduRole;
import io.openvidu.server.OpenViduServer;
import io.openvidu.server.cdr.CDREventName;
@ -160,6 +160,9 @@ public class OpenviduConfig {
@Value("${openvidu.streams.video.min-send-bandwidth}")
protected int openviduStreamsVideoMinSendBandwidth;
@Value("${coturn.ip}")
protected String coturnIp;
@Value("${coturn.redis.ip}")
protected String coturnRedisIp;
@ -273,6 +276,10 @@ public class OpenviduConfig {
return this.openviduStreamsVideoMinSendBandwidth;
}
public String getCoturnIp() {
return this.coturnIp;
}
public String getCoturnDatabaseString() {
return "\"ip=" + this.coturnRedisIp + " dbname=" + this.coturnRedisDbname + " password="
+ this.coturnRedisPassword + " connect_timeout=" + this.coturnRedisConnectTimeout + "\"";

View File

@ -47,6 +47,7 @@ public class TokenGeneratorDefault implements TokenGenerator {
if (this.coturnCredentialsService.isCoturnAvailable()) {
turnCredentials = coturnCredentialsService.createUser();
if (turnCredentials != null) {
token += "&coturnIp=" + openviduConfig.getCoturnIp();
token += "&turnUsername=" + turnCredentials.getUsername();
token += "&turnCredential=" + turnCredentials.getCredential();
}

View File

@ -45,6 +45,7 @@ public class BashCoturnCredentialsService extends CoturnCredentialsService {
log.warn("Redis DB is not accesible with connection string " + this.coturnDatabaseString);
log.error("No COTURN server will be automatically configured for clients");
} else {
log.info("COTURN IP: " + this.openviduConfig.getCoturnIp());
log.info("COTURN Redis DB accessible with string " + this.coturnDatabaseString);
log.info("Cleaning COTURN DB...");
if (response.contains("log file opened")) {

View File

@ -36,6 +36,7 @@ openvidu.streams.video.min-recv-bandwidth=300
openvidu.streams.video.max-send-bandwidth=1000
openvidu.streams.video.min-send-bandwidth=300
coturn.ip=127.0.0.1
coturn.redis.ip=127.0.0.1
coturn.redis.dbname=0
coturn.redis.password=turn