Skip to content
25 changes: 23 additions & 2 deletions src/matrixrtc/MatrixRTCSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,22 @@ export interface SessionConfig {
* Determines the kind of call this will be.
*/
callIntent?: RTCCallIntent;
}

/**
* How long (in milliseconds) the callee's client should keep ringing/waiting for an
* answer before the sender gives up and the call notification is considered timed out.
*
* This is sent as the `lifetime` field of the `m.rtc.notification` (MSC4075) event, and is
* also used locally to time out the ring attempt on the sender's side (see
* `MatrixRTCSessionEvent.DidSendCallNotification`).
*
* Note: the receiving homeserver / client caps this value at 90000ms (1.5 minutes), see
* {@link parseCallNotificationContent}.
*
* @default 60000 (60 seconds)
*/
notificationLifetimeMs?: number;
Comment thread
Johennes marked this conversation as resolved.
Outdated
}
Comment thread
Johennes marked this conversation as resolved.
Outdated

// The names follow these principles:
// - we use the technical term delay if the option is related to delayed events.
Expand Down Expand Up @@ -227,6 +242,12 @@ interface SessionMembershipsForSlotOpts {
*/
listenForMemberStateEvents: boolean;
}
/**
* Default lifetime (in milliseconds) advertised in the `lifetime` field of an outgoing
* `m.rtc.notification` (MSC4075) "ring" event. See {@link SessionConfig.notificationLifetimeMs}.
*/
const DEFAULT_NOTIFICATION_LIFETIME_MS = 60_000;
Comment thread
Johennes marked this conversation as resolved.
Outdated


const DEFAULT_SESSION_MEMBERSHIPS_FOR_SLOT_OPTS: SessionMembershipsForSlotOpts = {
listenForStickyEvents: true,
Expand Down Expand Up @@ -687,7 +708,7 @@ export class MatrixRTCSession extends TypedEventEmitter<
rel_type: RelationType.Reference,
},
"sender_ts": Date.now(),
"lifetime": 30_000, // 30 seconds
"lifetime": lifetime,
};
if (callIntent) {
content["m.call.intent"] = callIntent;
Expand Down
Loading