diff --git a/openvidu-server/src/main/java/io/openvidu/server/core/Participant.java b/openvidu-server/src/main/java/io/openvidu/server/core/Participant.java index f5640779..7bb093e2 100644 --- a/openvidu-server/src/main/java/io/openvidu/server/core/Participant.java +++ b/openvidu-server/src/main/java/io/openvidu/server/core/Participant.java @@ -163,6 +163,11 @@ public class Participant { return fullMetadata; } + public void deleteIpcamProperties() { + this.clientMetadata = ""; + this.token.setToken(null); + } + @Override public int hashCode() { final int prime = 31; @@ -225,7 +230,9 @@ public class Participant { json.addProperty("createdAt", this.createdAt); json.addProperty("location", this.location != null ? this.location.toString() : "unknown"); json.addProperty("platform", this.platform); - json.addProperty("token", this.token.getToken()); + if (this.token.getToken() != null) { + json.addProperty("token", this.token.getToken()); + } json.addProperty("role", this.token.getRole().name()); json.addProperty("serverData", this.serverMetadata); json.addProperty("clientData", this.clientMetadata); diff --git a/openvidu-server/src/main/java/io/openvidu/server/kurento/core/KurentoSessionManager.java b/openvidu-server/src/main/java/io/openvidu/server/kurento/core/KurentoSessionManager.java index 53802684..fe08ffc4 100644 --- a/openvidu-server/src/main/java/io/openvidu/server/kurento/core/KurentoSessionManager.java +++ b/openvidu-server/src/main/java/io/openvidu/server/kurento/core/KurentoSessionManager.java @@ -624,6 +624,10 @@ public class KurentoSessionManager extends SessionManager { if (participantPrivateId != null) { Participant participant = this.getParticipant(participantPrivateId); if (participant != null) { + if (participant.isIpcam()) { + throw new OpenViduException(Code.USER_GENERIC_ERROR_CODE, "Stream '" + streamId + + " belonging to an IPCAM participant cannot be unpublished. IPCAM streams can only be unpublished by forcing the disconnection of the IPCAM connection"); + } this.unpublishVideo(participant, moderator, transactionId, reason); return true; } else { @@ -921,6 +925,8 @@ public class KurentoSessionManager extends SessionManager { // Publish the IpCam stream into the session KurentoParticipant kParticipant = (KurentoParticipant) this.getParticipant(rtspConnectionId); + kParticipant.deleteIpcamProperties(); + this.publishVideo(kParticipant, mediaOptions, null); return kParticipant; }