mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: Fix OPENVIDU_WEBRTC_ICE_SERVERS not being used when customIceServer is an empty list but not null
parent
90d13cedc4
commit
72b95741ca
|
@ -21,6 +21,7 @@ import java.net.MalformedURLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
@ -844,9 +845,21 @@ public class SessionRestController {
|
||||||
|
|
||||||
ConnectionType type = ConnectionProperties.fromJson(params).build().getType();
|
ConnectionType type = ConnectionProperties.fromJson(params).build().getType();
|
||||||
|
|
||||||
|
// Check if custom ice servers are defined in params
|
||||||
|
boolean definedCustomIceServers = false;
|
||||||
|
|
||||||
if (ConnectionType.WEBRTC.equals(type)) {
|
if (ConnectionType.WEBRTC.equals(type)) {
|
||||||
if (params != null && params.get("customIceServers") == null
|
if (params != null) {
|
||||||
&& !openviduConfig.getWebrtcIceServersBuilders().isEmpty()) {
|
JsonArray customIceServersJsonArray = null;
|
||||||
|
if (params.get("customIceServers") != null) {
|
||||||
|
customIceServersJsonArray = new Gson().toJsonTree(params.get("customIceServers"), List.class)
|
||||||
|
.getAsJsonArray();
|
||||||
|
definedCustomIceServers = customIceServersJsonArray.size() > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!definedCustomIceServers && !openviduConfig.getWebrtcIceServersBuilders().isEmpty()) {
|
||||||
// If not defined in Connection, check if defined in OpenVidu global config
|
// If not defined in Connection, check if defined in OpenVidu global config
|
||||||
for (IceServerProperties.Builder iceServerPropertiesBuilder : openviduConfig
|
for (IceServerProperties.Builder iceServerPropertiesBuilder : openviduConfig
|
||||||
.getWebrtcIceServersBuilders()) {
|
.getWebrtcIceServersBuilders()) {
|
||||||
|
@ -854,7 +867,6 @@ public class SessionRestController {
|
||||||
builder.addCustomIceServer(configIceBuilder.build());
|
builder.addCustomIceServer(configIceBuilder.build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue