mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: Set default coturnIp and coturnPort in customIceServers at joinRoom RPC response, ONLY if customIceServers are not defined
parent
e505cd6c8d
commit
789ff26cfc
|
@ -1544,13 +1544,6 @@ export class Session extends EventDispatcher {
|
|||
}
|
||||
this.openvidu.iceServers.push(rtcIceServer);
|
||||
}
|
||||
} else if (opts.coturnIp != null && opts.coturnPort != null && opts.turnUsername != null && opts.turnCredential != null) {
|
||||
const turnUrl1 = 'turn:' + opts.coturnIp + ':' + opts.coturnPort;
|
||||
this.openvidu.iceServers = [
|
||||
{ urls: [turnUrl1], username: opts.turnUsername, credential: opts.turnCredential }
|
||||
];
|
||||
logger.log("STUN/TURN server IP: " + opts.coturnIp);
|
||||
logger.log('TURN temp credentials [' + opts.turnUsername + ':' + opts.turnCredential + ']');
|
||||
}
|
||||
this.openvidu.role = opts.role;
|
||||
this.openvidu.finalUserId = opts.finalUserId;
|
||||
|
|
|
@ -190,7 +190,16 @@ public class SessionEventsHandler {
|
|||
result.addProperty(ProtocolElements.PARTICIPANTJOINED_COTURNIP_PARAM, coturnIp);
|
||||
result.addProperty(ProtocolElements.PARTICIPANTJOINED_COTURNPORT_PARAM, openviduConfig.getCoturnPort());
|
||||
List<IceServerProperties> customIceServers = participant.getToken().getCustomIceServers();
|
||||
if (customIceServers != null && !customIceServers.isEmpty()) {
|
||||
|
||||
if (customIceServers == null || customIceServers.isEmpty()) {
|
||||
JsonArray defaultCustomIceServers = new JsonArray();
|
||||
IceServerProperties defaultIceServer = new IceServerProperties.Builder()
|
||||
.url("turn:" + coturnIp + ":" + openviduConfig.getCoturnPort())
|
||||
.username(participant.getToken().getTurnCredentials().getUsername())
|
||||
.credential(participant.getToken().getTurnCredentials().getCredential())
|
||||
.build();
|
||||
defaultCustomIceServers.add(defaultIceServer.toJson());
|
||||
} else {
|
||||
result.add(ProtocolElements.PARTICIPANTJOINED_CUSTOM_ICE_SERVERS,
|
||||
participant.getToken().getCustomIceServersAsJson());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue