diff --git a/react/features/invite/_utils.ts b/react/features/invite/_utils.ts index a238f7c22b80..09c132fe0615 100644 --- a/react/features/invite/_utils.ts +++ b/react/features/invite/_utils.ts @@ -70,10 +70,15 @@ export function getDialInConferenceID( * phone number strings, as the second one should not be used and is deprecated. */ export function getDialInNumbers( - url: string, - roomName: string, - mucURL: string + url?: string, + roomName?: string, + mucURL?: string ): Promise { + + if (!url || !roomName || !mucURL) { + return Promise.resolve(); + } + const separator = url.includes('?') ? '&' : '?'; // when roomName and mucURL are available diff --git a/react/features/invite/actions.any.ts b/react/features/invite/actions.any.ts index 43bd90199220..ae35122660c8 100644 --- a/react/features/invite/actions.any.ts +++ b/react/features/invite/actions.any.ts @@ -16,7 +16,8 @@ import { import { INVITE_TYPES } from './constants'; import { invitePeopleAndChatRooms, - inviteSipEndpoints + inviteSipEndpoints, + isDialInEnabled } from './functions'; import logger from './logger'; import { IInvitee } from './types'; @@ -210,7 +211,7 @@ export function updateDialInNumbers() { const { numbersFetched } = state['features/invite']; const mucURL = hosts?.muc; - if (numbersFetched || !dialInConfCodeUrl || !dialInNumbersUrl || !mucURL) { + if (numbersFetched || !isDialInEnabled(state)) { // URLs for fetching dial in numbers not defined return; } diff --git a/react/features/invite/functions.ts b/react/features/invite/functions.ts index b677547cac38..7ba590709502 100644 --- a/react/features/invite/functions.ts +++ b/react/features/invite/functions.ts @@ -496,6 +496,26 @@ export function isDialOutEnabled(state: IReduxState): boolean { return isJwtFeatureEnabled(state, MEET_FEATURES.OUTBOUND_CALL, false) && conference?.isSIPCallingSupported(); } +/** + * Determines if dial out is currently enabled or not. + * + * @param {IReduxState} state - Current state. + * @returns {boolean} Indication of whether dial out is currently enabled. + */ +export function isDialInEnabled(state: IReduxState): boolean { + const dialInDisabled = state['features/base/conference'] + .conference?.getMetadataHandler()?.getMetadata()?.dialinEnabled === false; + + if (dialInDisabled) { + return false; + } + + const { dialInConfCodeUrl, dialInNumbersUrl, hosts } = state['features/base/config']; + const mucURL = hosts?.muc; + + return Boolean(dialInConfCodeUrl && dialInNumbersUrl && mucURL); +} + /** * Determines if inviting sip endpoints is enabled or not. * @@ -634,7 +654,7 @@ export function getShareInfoText( const { locationURL = {} } = state['features/base/connection']; const mucURL = hosts?.muc; - if (skipDialIn || !dialInConfCodeUrl || !dialInNumbersUrl || !mucURL) { + if (skipDialIn || !isDialInEnabled(state)) { // URLs for fetching dial in numbers not defined. return Promise.resolve(infoText); }