Skip to content

Commit 2f1d654

Browse files
authored
MatrixRTC: Add RTC decline event (#4978)
* Add decline event Signed-off-by: Timo K <[email protected]> * add `client.sendRtcDecline`. Signed-off-by: Timo K <[email protected]> * remove `decline.reason` field. Signed-off-by: Timo K <[email protected]> --------- Signed-off-by: Timo K <[email protected]>
1 parent c4c7f94 commit 2f1d654

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

src/@types/event.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ import {
5353
} from "../webrtc/callEventTypes.ts";
5454
import {
5555
type IRTCNotificationContent,
56+
type IRTCDeclineContent,
5657
type EncryptionKeysEventContent,
5758
type ICallNotifyContent,
5859
} from "../matrixrtc/types.ts";
@@ -152,6 +153,7 @@ export enum EventType {
152153
// MatrixRTC events
153154
CallNotify = "org.matrix.msc4075.call.notify",
154155
RTCNotification = "org.matrix.msc4075.rtc.notification",
156+
RTCDecline = "org.matrix.msc4310.rtc.decline",
155157
}
156158

157159
export enum RelationType {
@@ -332,6 +334,7 @@ export interface TimelineEvents {
332334
[EventType.CallEncryptionKeysPrefix]: EncryptionKeysEventContent;
333335
[EventType.CallNotify]: ICallNotifyContent;
334336
[EventType.RTCNotification]: IRTCNotificationContent;
337+
[EventType.RTCDecline]: IRTCDeclineContent;
335338
[M_BEACON.name]: MBeaconEventContent;
336339
[M_POLL_START.name]: PollStartEventContent;
337340
[M_POLL_END.name]: PollEndEventContent;

src/client.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3589,6 +3589,12 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
35893589
return await this.setRoomReadMarkersHttpRequest(roomId, rmEventId, rrEventId, rpEventId);
35903590
}
35913591

3592+
public sendRtcDecline(roomId: string, notificationEventId: string): Promise<ISendEventResponse> {
3593+
return this.sendEvent(roomId, EventType.RTCDecline, {
3594+
"m.relates_to": { event_id: notificationEventId, rel_type: RelationType.Reference },
3595+
});
3596+
}
3597+
35923598
/**
35933599
* Get a preview of the given URL as of (roughly) the given point in time,
35943600
* described as an object with OpenGraph keys and associated values.

src/matrixrtc/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ export interface IRTCNotificationContent extends RelationEvent {
104104
"lifetime": number;
105105
}
106106

107+
/**
108+
* MSC4310 decline event content for `org.matrix.msc4310.rtc.decline`.
109+
* Sent as a standard m.reference relation to an `org.matrix.msc4075.rtc.notification` event.
110+
*/
111+
export interface IRTCDeclineContent extends RelationEvent {}
112+
107113
export enum Status {
108114
Disconnected = "Disconnected",
109115
Connecting = "Connecting",

0 commit comments

Comments
 (0)