Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(breakout): Adds a checkout whether participants were in breakout.

damencho274ef35a5b28
diff --git a/resources/prosody-plugins/README.md b/resources/prosody-plugins/README.md
index 4151cdd2c8..97f2465536 100644
--- a/resources/prosody-plugins/README.md
+++ b/resources/prosody-plugins/README.md
@@ -89,6 +89,7 @@
- visitors_destroy_timer - A timer used to destroy the room when there are no main occupants or visitors left. It is set by mod_fmuc.lua to clean up the room after a certain period of inactivity.
# session fields added by jitsi
+- jitsi_breakout_main_jid - Once an occupant joins main room we mark this to check it when joining breakout rooms.
- jitsi_meet_context_user - The context from the jwt token, added after token verify.
- jitsi_meet_context_group - The group from the jwt context, added after token verify.
- jitsi_meet_context_features - The features from the context, added after token verify.
diff --git a/resources/prosody-plugins/mod_auth_token.lua b/resources/prosody-plugins/mod_auth_token.lua
index 54215097cb..c9f8abcaa5 100644
--- a/resources/prosody-plugins/mod_auth_token.lua
+++ b/resources/prosody-plugins/mod_auth_token.lua
@@ -201,4 +201,5 @@ module:hook_global('c2s-session-updated', function (event)
session.jitsi_meet_str_tenant = from_session.jitsi_meet_str_tenant;
session.jitsi_meet_domain = from_session.jitsi_meet_domain;
session.jitsi_meet_tenant_mismatch = from_session.jitsi_meet_tenant_mismatch;
+ session.jitsi_breakout_main_jid = from_session.jitsi_breakout_main_jid;
end, 1);
diff --git a/resources/prosody-plugins/mod_muc_breakout_rooms.lua b/resources/prosody-plugins/mod_muc_breakout_rooms.lua
index d8bac8d6b8..62ed17c0cd 100644
--- a/resources/prosody-plugins/mod_muc_breakout_rooms.lua
+++ b/resources/prosody-plugins/mod_muc_breakout_rooms.lua
@@ -398,7 +398,7 @@ function on_breakout_room_pre_create(event)
end
function on_occupant_joined(event)
- local occupant, room = event.occupant, event.room;
+ local occupant, room, session = event.occupant, event.room, event.origin;
if is_healthcheck_room(room.jid) then
return;
@@ -421,6 +421,12 @@ function on_occupant_joined(event)
-- clear any switching state for this occupant, we always store main room / resource
switching_room_cache:set(main_room_jid..'/'..jid_resource(occupant.nick), nil);
end
+
+ -- check if this is joining main room or breakout room
+ if main_room == room and not isFocus then
+ -- mark that this session was in the main room
+ session.jitsi_breakout_main_jid = main_room_jid;
+ end
end
function exist_occupants_in_room(room)
@@ -567,6 +573,7 @@ end
-- conflict with a jid which is currently in switching state or already in another room.
function on_occupant_pre_join_or_change(e)
local room, stanza, origin = e.room, e.stanza, e.origin;
+ local occupant = e.dest_occupant or e.occupant;
local requested_jid = stanza.attr.to;
local main_room = get_main_room(room.jid);
@@ -577,6 +584,10 @@ function on_occupant_pre_join_or_change(e)
return true;
end
+ if is_admin(occupant.bare_jid) then
+ return;
+ end
+
local main_room_requested_jid = main_room.jid..'/'..jid_resource(requested_jid);
local bare_jid = jid_bare(stanza.attr.from);
@@ -597,6 +608,12 @@ function on_occupant_pre_join_or_change(e)
end
end
else
+ if origin.jitsi_breakout_main_jid ~= main_room.jid then
+ -- this session did not come from the main room
+ origin.send(st.error_reply(stanza, 'cancel', 'not-allowed'));
+ return true;
+ end
+
-- this is a breakout room let's check the main room
if check_for_existing_occupant_in_room(main_room, jid_resource(requested_jid), bare_jid, stanza, origin) then
return true;