Skip to content

Commit 4d19d85

Browse files
committed
introduce new m.rtc.notification event alongside m.call.notify
1 parent 46d38a9 commit 4d19d85

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

src/@types/event.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ import {
5151
type SDPStreamMetadata,
5252
type SDPStreamMetadataKey,
5353
} from "../webrtc/callEventTypes.ts";
54-
import { type EncryptionKeysEventContent, type ICallNotifyContent } from "../matrixrtc/types.ts";
54+
import {
55+
type IRTCNotificationContent,
56+
type EncryptionKeysEventContent,
57+
type ICallNotifyContent,
58+
} from "../matrixrtc/types.ts";
5559
import { type M_POLL_END, type M_POLL_START, type PollEndEventContent, type PollStartEventContent } from "./polls.ts";
5660
import { type SessionMembershipData } from "../matrixrtc/CallMembership.ts";
5761
import { type LocalNotificationSettings } from "./local_notifications.ts";
@@ -147,6 +151,7 @@ export enum EventType {
147151

148152
// MatrixRTC events
149153
CallNotify = "org.matrix.msc4075.call.notify",
154+
RTCNotification = "org.matrix.msc4075.rtc.notification",
150155
}
151156

152157
export enum RelationType {
@@ -158,6 +163,8 @@ export enum RelationType {
158163
// moreover, our tests currently use the unstable prefix. Use THREAD_RELATION_TYPE.name.
159164
// Once we support *only* the stable prefix, THREAD_RELATION_TYPE can die and we can switch to this.
160165
Thread = "m.thread",
166+
unstable_RTCParentEvent = "org.matrix.msc4075.rtc.parent_event",
167+
unstable_RTCDecline = "org.matrix.msc4075.rtc.decline",
161168
}
162169

163170
export enum MsgType {
@@ -325,6 +332,7 @@ export interface TimelineEvents {
325332
[EventType.CallSDPStreamMetadataChangedPrefix]: MCallBase & { [SDPStreamMetadataKey]: SDPStreamMetadata };
326333
[EventType.CallEncryptionKeysPrefix]: EncryptionKeysEventContent;
327334
[EventType.CallNotify]: ICallNotifyContent;
335+
[EventType.RTCNotification]: IRTCNotificationContent;
328336
[M_BEACON.name]: MBeaconEventContent;
329337
[M_POLL_START.name]: PollStartEventContent;
330338
[M_POLL_END.name]: PollEndEventContent;

src/matrixrtc/types.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616
import type { IMentions } from "../matrix.ts";
17+
import type { RelationEvent } from "../types.ts";
1718
import type { CallMembership } from "./CallMembership.ts";
1819

1920
export type ParticipantId = string;
@@ -80,16 +81,29 @@ export interface EncryptionKeysToDeviceEventContent {
8081
// Why is this needed?
8182
sent_ts?: number;
8283
}
83-
84+
/**
85+
* @deprecated Use `RTCNotificationType` instead.
86+
*/
8487
export type CallNotifyType = "ring" | "notify";
85-
88+
/**
89+
* @deprecated Use `IRTCNotificationContent` instead.
90+
*/
8691
export interface ICallNotifyContent {
8792
"application": string;
8893
"m.mentions": IMentions;
8994
"notify_type": CallNotifyType;
9095
"call_id": string;
9196
}
9297

98+
export type RTCNotificationType = "ring" | "notification" | "decline";
99+
export interface IRTCNotificationContent extends RelationEvent {
100+
"m.mentions": IMentions;
101+
"decline_reason"?: string;
102+
"notification_type": RTCNotificationType;
103+
"sender_ts": number;
104+
"lifetime": number;
105+
}
106+
93107
export enum Status {
94108
Disconnected = "Disconnected",
95109
Connecting = "Connecting",

0 commit comments

Comments
 (0)