From 2f1d654f14be8dd03896e9e76f12017b6f9eec1c Mon Sep 17 00:00:00 2001 From: Timo <16718859+toger5@users.noreply.github.com> Date: Tue, 26 Aug 2025 17:21:40 +0200 Subject: [PATCH] MatrixRTC: Add RTC decline event (#4978) * Add decline event Signed-off-by: Timo K * add `client.sendRtcDecline`. Signed-off-by: Timo K * remove `decline.reason` field. Signed-off-by: Timo K --------- Signed-off-by: Timo K --- src/@types/event.ts | 3 +++ src/client.ts | 6 ++++++ src/matrixrtc/types.ts | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/src/@types/event.ts b/src/@types/event.ts index fd906266e..1416a0b71 100644 --- a/src/@types/event.ts +++ b/src/@types/event.ts @@ -53,6 +53,7 @@ import { } from "../webrtc/callEventTypes.ts"; import { type IRTCNotificationContent, + type IRTCDeclineContent, type EncryptionKeysEventContent, type ICallNotifyContent, } from "../matrixrtc/types.ts"; @@ -152,6 +153,7 @@ export enum EventType { // MatrixRTC events CallNotify = "org.matrix.msc4075.call.notify", RTCNotification = "org.matrix.msc4075.rtc.notification", + RTCDecline = "org.matrix.msc4310.rtc.decline", } export enum RelationType { @@ -332,6 +334,7 @@ export interface TimelineEvents { [EventType.CallEncryptionKeysPrefix]: EncryptionKeysEventContent; [EventType.CallNotify]: ICallNotifyContent; [EventType.RTCNotification]: IRTCNotificationContent; + [EventType.RTCDecline]: IRTCDeclineContent; [M_BEACON.name]: MBeaconEventContent; [M_POLL_START.name]: PollStartEventContent; [M_POLL_END.name]: PollEndEventContent; diff --git a/src/client.ts b/src/client.ts index f30b9ca0b..07cf8547c 100644 --- a/src/client.ts +++ b/src/client.ts @@ -3589,6 +3589,12 @@ export class MatrixClient extends TypedEventEmitter { + return this.sendEvent(roomId, EventType.RTCDecline, { + "m.relates_to": { event_id: notificationEventId, rel_type: RelationType.Reference }, + }); + } + /** * Get a preview of the given URL as of (roughly) the given point in time, * described as an object with OpenGraph keys and associated values. diff --git a/src/matrixrtc/types.ts b/src/matrixrtc/types.ts index 73c5a0170..1f7bbe3a6 100644 --- a/src/matrixrtc/types.ts +++ b/src/matrixrtc/types.ts @@ -104,6 +104,12 @@ export interface IRTCNotificationContent extends RelationEvent { "lifetime": number; } +/** + * MSC4310 decline event content for `org.matrix.msc4310.rtc.decline`. + * Sent as a standard m.reference relation to an `org.matrix.msc4075.rtc.notification` event. + */ +export interface IRTCDeclineContent extends RelationEvent {} + export enum Status { Disconnected = "Disconnected", Connecting = "Connecting",