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(sip): Added auto-knocking for sip gateway if lobby is enabled

Gabriel Imred22792c9e3b1
diff --git a/react/features/lobby/middleware.js b/react/features/lobby/middleware.js
index bd707c4d1f..b06efbaa65 100644
--- a/react/features/lobby/middleware.js
+++ b/react/features/lobby/middleware.js
@@ -6,7 +6,7 @@ import { getFirstLoadableAvatarUrl, getParticipantDisplayName } from '../base/pa
import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
import { isTestModeEnabled } from '../base/testing';
import { NOTIFICATION_TYPE, showNotification } from '../notifications';
-import { isPrejoinPageEnabled } from '../prejoin/functions';
+import { shouldAutoKnock } from '../prejoin/functions';
import { KNOCKING_PARTICIPANT_ARRIVED_OR_UPDATED } from './actionTypes';
import {
@@ -100,8 +100,7 @@ function _conferenceFailed({ dispatch, getState }, next, action) {
dispatch(openLobbyScreen());
- if (isPrejoinPageEnabled(state) && !state['features/lobby'].knocking) {
- // prejoin is enabled, so we knock automatically
+ if (shouldAutoKnock(state)) {
dispatch(startKnocking());
}
diff --git a/react/features/prejoin/functions.js b/react/features/prejoin/functions.js
index fa39ff342b..27e8f8678c 100644
--- a/react/features/prejoin/functions.js
+++ b/react/features/prejoin/functions.js
@@ -162,3 +162,16 @@ export function isPrejoinPageEnabled(state: Object): boolean {
export function isPrejoinPageVisible(state: Object): boolean {
return isPrejoinPageEnabled(state) && state['features/prejoin']?.showPrejoin;
}
+
+/**
+ * Returns true if we should auto-knock in case lobby is enabled for the room.
+ *
+ * @param {Object} state - The state of the app.
+ * @returns {boolean}
+ */
+export function shouldAutoKnock(state: Object): boolean {
+ const { iAmRecorder, iAmSipGateway } = state['features/base/config'];
+
+ return (isPrejoinPageEnabled(state) || (iAmRecorder && iAmSipGateway))
+ && !state['features/lobby'].knocking;
+}