From 68b050adfad3c070fe1d0f1e62c4132b2cae41c6 Mon Sep 17 00:00:00 2001 From: damencho Date: Fri, 6 Sep 2024 18:44:14 -0500 Subject: [PATCH] feat(transcription): Handles dial iq coming from visitors. --- .../jicofo/conference/JitsiMeetConference.java | 5 +++++ .../conference/JitsiMeetConferenceImpl.java | 7 +++++++ .../org/jitsi/jicofo/xmpp/JigasiIqHandler.kt | 17 ++++++++++++----- .../org/jitsi/jicofo/xmpp/XmppServices.kt | 4 +++- 4 files changed, 27 insertions(+), 6 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 9007f5bb03..9ffb427c06 100644 --- a/jicofo/src/main/java/org/jitsi/jicofo/conference/JitsiMeetConference.java +++ b/jicofo/src/main/java/org/jitsi/jicofo/conference/JitsiMeetConference.java @@ -49,6 +49,11 @@ public interface JitsiMeetConference extends XmppProvider.Listener */ EntityBareJid getMainRoomJid(); + /** + * @return the JIDs of the connected visitor rooms. + */ + List getVisitorRoomsJids(); + /** Return the number of visitors in the conference */ long getVisitorCount(); 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 415b1dcdcb..4939627a61 100644 --- a/jicofo/src/main/java/org/jitsi/jicofo/conference/JitsiMeetConferenceImpl.java +++ b/jicofo/src/main/java/org/jitsi/jicofo/conference/JitsiMeetConferenceImpl.java @@ -316,6 +316,13 @@ public EntityBareJid getMainRoomJid() return mainRoomJid; } + @Override + public List getVisitorRoomsJids() + { + return this.visitorChatRooms.values().stream().map(ChatRoom::getRoomJid) + .collect(Collectors.toList()); + } + /** * @return the colibri session manager, late init. */ diff --git a/jicofo/src/main/kotlin/org/jitsi/jicofo/xmpp/JigasiIqHandler.kt b/jicofo/src/main/kotlin/org/jitsi/jicofo/xmpp/JigasiIqHandler.kt index fbf9773c3c..2632eadf5e 100644 --- a/jicofo/src/main/kotlin/org/jitsi/jicofo/xmpp/JigasiIqHandler.kt +++ b/jicofo/src/main/kotlin/org/jitsi/jicofo/xmpp/JigasiIqHandler.kt @@ -62,11 +62,18 @@ class JigasiIqHandler( Stats.rejectedRequests.inc() } - val conference = conferenceStore.getConference(conferenceJid) - ?: return RejectedWithError(request, StanzaError.Condition.item_not_found).also { - logger.warn("Rejected request for non-existent conference: $conferenceJid") - Stats.rejectedRequests.inc() - } + var conference = conferenceStore.getConference(conferenceJid) + + if (conference == null) { + // let's search for visitor room with that jid, maybe it's an invite from a visitor + conference = conferenceStore.getAllConferences() + .find { c -> c.visitorRoomsJids.contains(conferenceJid) } + } + + conference ?: return RejectedWithError(request, StanzaError.Condition.item_not_found).also { + logger.warn("Rejected request for non-existent conference: $conferenceJid") + Stats.rejectedRequests.inc() + } if (!conference.acceptJigasiRequest(request.iq.from)) { return RejectedWithError(request, StanzaError.Condition.forbidden).also { diff --git a/jicofo/src/main/kotlin/org/jitsi/jicofo/xmpp/XmppServices.kt b/jicofo/src/main/kotlin/org/jitsi/jicofo/xmpp/XmppServices.kt index 607de2c033..b93a657d82 100644 --- a/jicofo/src/main/kotlin/org/jitsi/jicofo/xmpp/XmppServices.kt +++ b/jicofo/src/main/kotlin/org/jitsi/jicofo/xmpp/XmppServices.kt @@ -83,7 +83,9 @@ class XmppServices( private val jigasiIqHandler = if (jigasiDetector != null) { JigasiIqHandler( - setOf(clientConnection.xmppConnection, serviceConnection.xmppConnection), + setOf(clientConnection.xmppConnection, serviceConnection.xmppConnection) + visitorConnections.map { + it.xmppConnection + }.toSet(), conferenceStore, jigasiDetector )