From 81d5598e2ebcc6509462f43c22c780161dc20479 Mon Sep 17 00:00:00 2001 From: damencho Date: Tue, 18 Feb 2025 18:43:01 -0600 Subject: [PATCH] feat(avmoderation): When muting skip the actor. --- .../org/jitsi/jicofo/conference/JitsiMeetConference.java | 3 ++- .../jitsi/jicofo/conference/JitsiMeetConferenceImpl.java | 7 +++++-- .../kotlin/org/jitsi/jicofo/xmpp/AvModerationHandler.kt | 7 +++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/jicofo/src/main/java/org/jitsi/jicofo/conference/JitsiMeetConference.java b/jicofo/src/main/java/org/jitsi/jicofo/conference/JitsiMeetConference.java index 9ffb427c06..56f2ae92b5 100644 --- a/jicofo/src/main/java/org/jitsi/jicofo/conference/JitsiMeetConference.java +++ b/jicofo/src/main/java/org/jitsi/jicofo/conference/JitsiMeetConference.java @@ -125,8 +125,9 @@ default JibriSipGateway getJibriSipGateway() /** * Used for av moderation, when we want to mute all participants. * @param mediaType the media type we want to mute. + * @param actor the entity that requested the mute. */ - void muteAllParticipants(MediaType mediaType); + void muteAllParticipants(MediaType mediaType, EntityFullJid actor); /** * Return {@code true} if the user with the given JID should be allowed to invite jigasi to this conference. diff --git a/jicofo/src/main/java/org/jitsi/jicofo/conference/JitsiMeetConferenceImpl.java b/jicofo/src/main/java/org/jitsi/jicofo/conference/JitsiMeetConferenceImpl.java index dc5ebb5ef1..63dd379160 100644 --- a/jicofo/src/main/java/org/jitsi/jicofo/conference/JitsiMeetConferenceImpl.java +++ b/jicofo/src/main/java/org/jitsi/jicofo/conference/JitsiMeetConferenceImpl.java @@ -1645,7 +1645,7 @@ else if (member.isJigasi()) /** * Mutes all participants (except jibri or jigasi without "audioMute" support). Will block for colibri responses. */ - public void muteAllParticipants(MediaType mediaType) + public void muteAllParticipants(MediaType mediaType, EntityFullJid actor) { Set participantsToMute = new HashSet<>(); synchronized (participantLock) @@ -1665,8 +1665,11 @@ public void muteAllParticipants(MediaType mediaType) // Force mute at the backend. We assume this was successful. If for some reason it wasn't the colibri layer // should handle it (e.g. remove a broken bridge). + // we skip the participant that enabled the av moderation getColibriSessionManager().mute( - participantsToMute.stream().map(Participant::getEndpointId).collect(Collectors.toSet()), + participantsToMute.stream() + .filter(p -> p.getMucJid() != actor) + .map(Participant::getEndpointId).collect(Collectors.toSet()), true, mediaType); diff --git a/jicofo/src/main/kotlin/org/jitsi/jicofo/xmpp/AvModerationHandler.kt b/jicofo/src/main/kotlin/org/jitsi/jicofo/xmpp/AvModerationHandler.kt index 43035f6a1c..2fefdeac40 100644 --- a/jicofo/src/main/kotlin/org/jitsi/jicofo/xmpp/AvModerationHandler.kt +++ b/jicofo/src/main/kotlin/org/jitsi/jicofo/xmpp/AvModerationHandler.kt @@ -89,8 +89,11 @@ class AvModerationHandler( logger.info( "Moderation for $mediaType in $conferenceJid was enabled by ${incomingJson["actor"]}" ) - // let's mute everyone - conference.muteAllParticipants(mediaType) + // let's mute everyone except the actor + conference.muteAllParticipants( + mediaType, + JidCreate.entityFullFrom(incomingJson["actor"]?.toString()) + ) } } incomingJson["whitelists"]?.let {