Skip to content

Commit

Permalink
feat(transcription): Drops TranscriberManager and expects dialIQ. (#1163
Browse files Browse the repository at this point in the history
)

* feat(transcription): Drops TranscriberManager and expects dialIQ.

* feat(transcription,recording): Adds option to disable moderator checks.

Default behavior is not changed.

* ref: Remove unused transcription code.

* feat(transcription): Returns an error if transcriber is already in room.

* squash: Fixes comments.

---------

Co-authored-by: Boris Grozev <[email protected]>
  • Loading branch information
damencho and bgrozev authored Sep 13, 2024
1 parent cd6901a commit 5cba140
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 363 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ interface ChatRoom {
* Read from the MUC config form. */
val participantsSoftLimit: Int?

/** Whether the room is configured to require transcription. */
val transcriptionRequested: Boolean

val debugState: OrderedJsonObject

/** Returns the number of members that currently have their audio sources unmuted. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,6 @@ class ChatRoomImpl(
}
}

override var transcriptionRequested: Boolean = false
private set(value) {
if (value != field) {
logger.info("transcriptionRequested is now $value.")
field = value
eventEmitter.fireEvent { transcriptionRequestedChanged(value) }
}
}

private val avModerationByMediaType = ConcurrentHashMap<MediaType, AvModerationForMediaType>()

/** The emitter used to fire events. */
Expand Down Expand Up @@ -297,7 +288,6 @@ class ChatRoomImpl(
}

override fun setRoomMetadata(roomMetadata: RoomMetadata) {
transcriptionRequested = roomMetadata.metadata?.recording?.isTranscribingEnabled == true
visitorsLive = roomMetadata.metadata?.visitors?.live == true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ interface ChatRoomListener {
fun localRoleChanged(newRole: MemberRole) {}
fun numAudioSendersChanged(numAudioSenders: Int) {}
fun numVideoSendersChanged(numVideoSenders: Int) {}
fun transcriptionRequestedChanged(transcriptionRequested: Boolean) {}
}

/** A class with the default kotlin method implementations (to avoid using @JvmDefault) **/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ data class RoomMetadata(
val metadata: Metadata?
) {
@JsonIgnoreProperties(ignoreUnknown = true)
data class Metadata(val recording: Recording?, val visitors: Visitors?) {
@JsonIgnoreProperties(ignoreUnknown = true)
data class Recording(val isTranscribingEnabled: Boolean?)

data class Metadata(val visitors: Visitors?) {
@JsonIgnoreProperties(ignoreUnknown = true)
data class Visitors(val live: Boolean?)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,20 @@ package org.jitsi.jicofo.xmpp.muc

import io.kotest.assertions.throwables.shouldThrow
import io.kotest.core.spec.style.ShouldSpec
import io.kotest.matchers.nulls.shouldNotBeNull
import io.kotest.matchers.shouldBe
import io.kotest.matchers.types.shouldBeInstanceOf

class RoomMetadataTest : ShouldSpec() {
init {
context("Valid") {
context("With isTranscribingEnabled set") {
context("With visitors.live set") {
val parsed = RoomMetadata.parse(
"""
{
"type": "room_metadata",
"metadata": {
"recording": {
"isTranscribingEnabled": true,
"visitors": {
"live": true,
"anotherField": 123
},
"anotherField": {}
Expand All @@ -42,9 +41,9 @@ class RoomMetadataTest : ShouldSpec() {
""".trimIndent()
)
parsed.shouldBeInstanceOf<RoomMetadata>()
parsed.metadata!!.recording!!.isTranscribingEnabled shouldBe true
parsed.metadata!!.visitors!!.live shouldBe true
}
context("With no recording included") {
context("With no visitors included") {

val parsed = RoomMetadata.parse(
"""
Expand All @@ -60,8 +59,7 @@ class RoomMetadataTest : ShouldSpec() {
""".trimIndent()
)
parsed.shouldBeInstanceOf<RoomMetadata>()
parsed.metadata.shouldNotBeNull()
parsed.metadata?.recording shouldBe null
parsed.metadata!!.visitors shouldBe null
}
}
context("Invalid") {
Expand Down
3 changes: 3 additions & 0 deletions jicofo-selector/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ jicofo {
// the next in line when the current owner leaves).
enable-auto-owner = true

// Can be used to disable moderator checks for starting a recording or placing a call
enable-moderator-checks = true

// How long to wait for the initial participant in a conference.
initial-timeout = 15 seconds

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,6 @@ public class JitsiMeetConferenceImpl
*/
private JibriSipGateway jibriSipGateway;

/**
* The {@link TranscriberManager} who listens for participants requesting
* transcription and, when necessary, dialing the transcriber instance.
*/
private TranscriberManager transcriberManager;

private ChatRoomRoleManager chatRoomRoleManager;

/**
Expand Down Expand Up @@ -502,15 +496,6 @@ private void joinTheRoom()
this.chatRoom = chatRoom;
chatRoom.addListener(chatRoomListener);

transcriberManager = new TranscriberManager(
jicofoServices.getXmppServices().getXmppConnectionByName(
JigasiConfig.config.xmppConnectionName()
),
this,
chatRoom,
jicofoServices.getXmppServices().getJigasiDetector(),
logger);

ChatRoomInfo chatRoomInfo = chatRoom.join();
if (chatRoomInfo.getMeetingId() == null)
{
Expand Down Expand Up @@ -651,11 +636,6 @@ private void leaveTheRoom()
chatRoom.removeListener(chatRoomRoleManager);
chatRoomRoleManager.stop();
}
if (transcriberManager != null)
{
transcriberManager.dispose();
transcriberManager = null;
}

chatRoom.leave();

Expand Down Expand Up @@ -1545,7 +1525,6 @@ private OrderedJsonObject getDebugState(boolean full)
o.put("participants", participantsJson);
//o.put("jibri_recorder", jibriRecorder.getDebugState());
//o.put("jibri_sip_gateway", jibriSipGateway.getDebugState());
//o.put("transcriber_manager", transcriberManager.getDebugState());
ChatRoomRoleManager chatRoomRoleManager = this.chatRoomRoleManager;
o.put("chat_room_role_manager", chatRoomRoleManager == null ? "null" : chatRoomRoleManager.getDebugState());
o.put("started", started.get());
Expand Down Expand Up @@ -2159,7 +2138,12 @@ public IqProcessingResult handleJibriRequest(@NotNull IqRequest<JibriIq> request
@Override
public boolean acceptJigasiRequest(@NotNull Jid from)
{
return MemberRoleKt.hasModeratorRights(getRoleForMucJid(from));
if (ConferenceConfig.config.getEnableModeratorChecks())
{
return MemberRoleKt.hasModeratorRights(getRoleForMucJid(from));
}

return true;
}

@Override
Expand Down Expand Up @@ -2418,11 +2402,6 @@ public void memberPresenceChanged(@NotNull ChatRoomMember member)
{
}

@Override
public void transcriptionRequestedChanged(boolean transcriptionRequested)
{
}

@Override
public void numAudioSendersChanged(int numAudioSenders)
{
Expand Down
Loading

0 comments on commit 5cba140

Please sign in to comment.