feat(sip): Added auto-knocking for sip gateway if lobby is enabled

Co-authored-by: Gabriel Imre <gabriel.lucaci@8x8.com>
This commit is contained in:
Gabriel Imre 2021-02-24 11:35:32 +02:00 committed by GitHub
parent 41e6af3464
commit d22792c9e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View File

@ -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());
}

View File

@ -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;
}