diff --git a/src/LegacyCallHandler.tsx b/src/LegacyCallHandler.tsx index 226cb63797..f509710518 100644 --- a/src/LegacyCallHandler.tsx +++ b/src/LegacyCallHandler.tsx @@ -59,6 +59,7 @@ import { SdkContextClass } from "./contexts/SDKContext"; import { showCantStartACallDialog } from "./voice-broadcast/utils/showCantStartACallDialog"; import { isNotNull } from "./Typeguards"; import { BackgroundAudio } from "./audio/BackgroundAudio"; +import { Jitsi } from "./widgets/Jitsi.ts"; export const PROTOCOL_PSTN = "m.protocol.pstn"; export const PROTOCOL_PSTN_PREFIXED = "im.vector.protocol.pstn"; @@ -908,12 +909,12 @@ export default class LegacyCallHandler extends EventEmitter { Modal.createDialog(ErrorDialog, { description: _t("voip|cannot_call_yourself_description"), }); - } else if (members.length === 2) { + } else if (members.length === 2 && !Jitsi.getInstance().useFor1To1Calls) { logger.info(`Place ${type} call in ${roomId}`); await this.placeMatrixCall(roomId, type, transferee); } else { - // > 2 + // > 2 || useFor1To1Calls await this.placeJitsiCall(roomId, type); } } diff --git a/src/widgets/Jitsi.ts b/src/widgets/Jitsi.ts index fe2ad92589..b1972b06a4 100644 --- a/src/widgets/Jitsi.ts +++ b/src/widgets/Jitsi.ts @@ -12,7 +12,8 @@ import { ClientEvent, IClientWellKnown } from "matrix-js-sdk/src/matrix"; import SdkConfig from "../SdkConfig"; import { MatrixClientPeg } from "../MatrixClientPeg"; -const JITSI_WK_PROPERTY = "im.vector.riot.jitsi"; +const JITSI_WK_PROPERTY_LEGACY = "im.vector.riot.jitsi"; +const JITSI_WK_PROPERTY = "io.element.jitsi"; export interface JitsiWidgetData { conferenceId: string; @@ -24,11 +25,16 @@ export class Jitsi { private static instance: Jitsi; private domain?: string; + private _useFor1To1Calls = false; public get preferredDomain(): string { return this.domain || "meet.element.io"; } + public get useFor1To1Calls(): boolean { + return this._useFor1To1Calls; + } + /** * Checks for auth needed by looking up a well-known file * @@ -65,12 +71,16 @@ export class Jitsi { let domain = SdkConfig.getObject("jitsi")?.get("preferred_domain") || "meet.element.io"; logger.log("Attempting to get Jitsi conference information from homeserver"); - const wkPreferredDomain = discoveryResponse?.[JITSI_WK_PROPERTY]?.["preferredDomain"]; + const wkJitsiConfig = discoveryResponse?.[JITSI_WK_PROPERTY] ?? discoveryResponse?.[JITSI_WK_PROPERTY_LEGACY]; + + const wkPreferredDomain = wkJitsiConfig?.["preferredDomain"]; if (wkPreferredDomain) domain = wkPreferredDomain; // Put the result into memory for us to use later this.domain = domain; logger.log("Jitsi conference domain:", this.preferredDomain); + this._useFor1To1Calls = wkJitsiConfig?.["useFor1To1Calls"] || false; + logger.log("Jitsi use for 1:1 calls:", this.useFor1To1Calls); }; /**