Skip to content

Commit

Permalink
feat(moderator): Skips redirect events when moving to main from break…
Browse files Browse the repository at this point in the history
…out.
  • Loading branch information
damencho committed Sep 20, 2024
1 parent 83ba892 commit 5671c5d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
7 changes: 7 additions & 0 deletions JitsiConference.js
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,13 @@ JitsiConference.prototype.leave = async function(reason) {
return;
}

// let's check is this breakout
if (reason === 'switch_room' && this.getBreakoutRooms()?.isBreakoutRoom()) {
const mJid = this.getBreakoutRooms().getMainRoomJid();

this.xmpp.connection._breakoutMovingToMain = mJid;
}

const room = this.room;

// Unregister connection state listeners
Expand Down
3 changes: 3 additions & 0 deletions modules/xmpp/ChatRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ export default class ChatRoom extends Listenable {
const preJoin
= this.options.disableFocus
? Promise.resolve()
.finally(() => {
this.xmpp.connection._breakoutMovingToMain = undefined;
})
: this.xmpp.moderator.sendConferenceRequest(this.roomjid);

preJoin.then(() => {
Expand Down
12 changes: 12 additions & 0 deletions modules/xmpp/moderator.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,9 @@ export default class Moderator extends Listenable {
}
}).then(() => {
this.conferenceRequestSent = true;
})
.finally(() => {
this.xmpp.connection._breakoutMovingToMain = undefined;
});
}

Expand Down Expand Up @@ -411,7 +414,16 @@ export default class Moderator extends Listenable {
this.getNextTimeout(true);

// we want to ignore redirects when this is jibri (record/live-stream or a sip jibri)
// we ignore redirects when moving from a breakout room to the main room
if (conferenceRequest.vnode && !this.options.iAmRecorder && !this.options.iAmSipGateway) {
if (this.connection._breakoutMovingToMain === roomJid) {
logger.info('Skipping redirect as we are moving from breakout to main.');

callback();

return;
}

logger.warn(`Redirected to: ${conferenceRequest.vnode} with focusJid ${conferenceRequest.focusJid}`);

this.xmpp.eventEmitter.emit(CONNECTION_REDIRECTED, conferenceRequest.vnode, conferenceRequest.focusJid);
Expand Down

0 comments on commit 5671c5d

Please sign in to comment.