diff --git a/src/stores/widgets/StopGapWidgetDriver.ts b/src/stores/widgets/StopGapWidgetDriver.ts index 248c520ddd5..f6bffca3d29 100644 --- a/src/stores/widgets/StopGapWidgetDriver.ts +++ b/src/stores/widgets/StopGapWidgetDriver.ts @@ -144,13 +144,31 @@ export class StopGapWidgetDriver extends WidgetDriver { this.allowedCapabilities.add( WidgetEventCapability.forStateEvent(EventDirection.Receive, EventType.RoomEncryption).raw, ); + const clientUserId = MatrixClientPeg.safeGet().getSafeUserId(); + // For the legacy membership type this.allowedCapabilities.add( - WidgetEventCapability.forStateEvent( - EventDirection.Send, - "org.matrix.msc3401.call.member", - MatrixClientPeg.safeGet().getSafeUserId(), - ).raw, + WidgetEventCapability.forStateEvent(EventDirection.Send, "org.matrix.msc3401.call.member", clientUserId) + .raw, ); + const clientDeviceId = MatrixClientPeg.safeGet().getDeviceId(); + if (clientDeviceId !== null) { + // For the session membership type compliant with MSC4143 + this.allowedCapabilities.add( + WidgetEventCapability.forStateEvent( + EventDirection.Send, + "org.matrix.msc3401.call.member", + `_${clientUserId}_${clientDeviceId}`, + ).raw, + ); + // MSC3779 version, with no leading underscore + this.allowedCapabilities.add( + WidgetEventCapability.forStateEvent( + EventDirection.Send, + "org.matrix.msc3401.call.member", + `${clientUserId}_${clientDeviceId}`, + ).raw, + ); + } this.allowedCapabilities.add( WidgetEventCapability.forStateEvent(EventDirection.Receive, "org.matrix.msc3401.call.member").raw, ); diff --git a/test/stores/widgets/StopGapWidgetDriver-test.ts b/test/stores/widgets/StopGapWidgetDriver-test.ts index 6e51d4ae980..5ba95d901dd 100644 --- a/test/stores/widgets/StopGapWidgetDriver-test.ts +++ b/test/stores/widgets/StopGapWidgetDriver-test.ts @@ -99,6 +99,8 @@ describe("StopGapWidgetDriver", () => { "org.matrix.msc2762.receive.state_event:org.matrix.msc3401.call", "org.matrix.msc2762.send.state_event:org.matrix.msc3401.call.member#@alice:example.org", "org.matrix.msc2762.receive.state_event:org.matrix.msc3401.call.member", + `org.matrix.msc2762.send.state_event:org.matrix.msc3401.call.member#_@alice:example.org_${client.deviceId}`, + `org.matrix.msc2762.send.state_event:org.matrix.msc3401.call.member#@alice:example.org_${client.deviceId}`, "org.matrix.msc3819.send.to_device:m.call.invite", "org.matrix.msc3819.receive.to_device:m.call.invite", "org.matrix.msc3819.send.to_device:m.call.candidates",