diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 7ae2f7a70f2..d5b76383b47 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1398,6 +1398,7 @@ "element_call_video_rooms": "Element Call video rooms", "experimental_description": "Feeling experimental? Try out our latest ideas in development. These features are not finalised; they may be unstable, may change, or may be dropped altogether. Learn more.", "experimental_section": "Early previews", + "feature_disable_call_per_sender_encryption": "Disable per-sender encryption for Element Call", "feature_wysiwyg_composer_description": "Use rich text instead of Markdown in the message composer.", "group_calls": "New group call experience", "group_developer": "Developer", diff --git a/src/models/Call.ts b/src/models/Call.ts index ecf1cbab665..9a841eb9d75 100644 --- a/src/models/Call.ts +++ b/src/models/Call.ts @@ -661,9 +661,11 @@ export class ElementCall extends Call { analyticsID, }); - if (client.isRoomEncrypted(roomId)) params.append("perParticipantE2EE", ""); - if (SettingsStore.getValue("fallbackICEServerAllowed")) params.append("allowIceFallback", ""); - if (SettingsStore.getValue("feature_allow_screen_share_only_mode")) params.append("allowVoipWithNoMedia", ""); + if (client.isRoomEncrypted(roomId) && !SettingsStore.getValue("feature_disable_call_per_sender_encryption")) + params.append("perParticipantE2EE", "true"); + if (SettingsStore.getValue("fallbackICEServerAllowed")) params.append("allowIceFallback", "true"); + if (SettingsStore.getValue("feature_allow_screen_share_only_mode")) + params.append("allowVoipWithNoMedia", "true"); // Set custom fonts if (SettingsStore.getValue("useSystemFont")) { diff --git a/src/settings/Settings.tsx b/src/settings/Settings.tsx index 7f92f0413fc..4f000f300c5 100644 --- a/src/settings/Settings.tsx +++ b/src/settings/Settings.tsx @@ -404,6 +404,13 @@ export const SETTINGS: { [setting: string]: ISetting } = { controller: new ReloadOnChangeController(), default: false, }, + "feature_disable_call_per_sender_encryption": { + isFeature: true, + supportedLevels: LEVELS_FEATURE, + labsGroup: LabGroup.VoiceAndVideo, + displayName: _td("labs|feature_disable_call_per_sender_encryption"), + default: false, + }, "feature_allow_screen_share_only_mode": { isFeature: true, supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG, diff --git a/test/models/Call-test.ts b/test/models/Call-test.ts index bd394e628bb..cbf1df0ffa4 100644 --- a/test/models/Call-test.ts +++ b/test/models/Call-test.ts @@ -925,6 +925,30 @@ describe("ElementCall", () => { call.destroy(); expect(destroyPersistentWidgetSpy).toHaveBeenCalled(); }); + + it("the perParticipantE2EE url flag is used in encrypted rooms while respecting the feature_disable_call_per_sender_encryption flag", async () => { + // We destroy the call created in beforeEach because we test the call creation process. + call.destroy(); + const addWidgetSpy = jest.spyOn(WidgetStore.instance, "addVirtualWidget"); + // If a room is not encrypted we will never add the perParticipantE2EE flag. + client.isRoomEncrypted.mockReturnValue(true); + + // should create call with perParticipantE2EE flag + ElementCall.create(room); + + expect(addWidgetSpy.mock.calls[0][0].url).toContain("perParticipantE2EE=true"); + ElementCall.get(room)?.destroy(); + + // should create call without perParticipantE2EE flag + enabledSettings.add("feature_disable_call_per_sender_encryption"); + await ElementCall.create(room); + enabledSettings.delete("feature_disable_call_per_sender_encryption"); + + expect(addWidgetSpy.mock.calls[1][0].url).not.toContain("perParticipantE2EE=true"); + + client.isRoomEncrypted.mockClear(); + addWidgetSpy.mockRestore(); + }); }); describe("instance in a video room", () => {