Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/matrixrtc/MatrixRTCSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import {
} from "./RoomAndToDeviceKeyTransport.ts";
import { TypedReEmitter } from "../ReEmitter.ts";
import { ToDeviceKeyTransport } from "./ToDeviceKeyTransport.ts";
import { M_TEXT } from "matrix-events-sdk";

/**
* Events emitted by MatrixRTCSession
Expand Down Expand Up @@ -98,6 +99,11 @@ export interface SessionConfig {
* Determines the kind of call this will be.
*/
callIntent?: RTCCallIntent;

/**
* An optional URL to be provided to allow guests to join the call via fallbacks.
*/
guestUrl?: () => string;
}

/**
Expand Down Expand Up @@ -754,13 +760,20 @@ export class MatrixRTCSession extends TypedEventEmitter<
response: ISendEventResponse;
content: IRTCNotificationContent;
}> => {
const guestUrl = this.joinConfig?.guestUrl?.() ?? "";
const content: IRTCNotificationContent = {
"m.mentions": { user_ids: [], room: true },
"notification_type": notificationType,
"m.relates_to": {
event_id: parentEventId,
rel_type: RelationType.Reference,
},
[M_TEXT.name]: [{
body: `Starting a new ${callIntent === "voice" ? "voice": "video"} call.` + (guestUrl && `Join via ${guestUrl}`),
}, {
body: `Starting a new ${callIntent === "voice" ? "voice": "video"}</b> call.` + (guestUrl && `<a href="${guestUrl}">Click here to join</a>`),
mimetype: "text/html"
}],
"sender_ts": Date.now(),
"lifetime": 30_000, // 30 seconds
};
Expand Down
4 changes: 3 additions & 1 deletion src/matrixrtc/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
import type { IMentions } from "../matrix.ts";
import type { IMentions, M_HTML, M_TEXT } from "../matrix.ts";

Check failure on line 16 in src/matrixrtc/types.ts

View workflow job for this annotation

GitHub Actions / ESLint

'M_HTML' is declared but never used.

Check failure on line 16 in src/matrixrtc/types.ts

View workflow job for this annotation

GitHub Actions / Typescript Syntax Check

'M_HTML' is declared but never used.

Check failure on line 16 in src/matrixrtc/types.ts

View workflow job for this annotation

GitHub Actions / Node.js example

'M_HTML' is declared but never used.

Check failure on line 16 in src/matrixrtc/types.ts

View workflow job for this annotation

GitHub Actions / Workflow Lint

'M_HTML' is declared but never used.

Check failure on line 16 in src/matrixrtc/types.ts

View workflow job for this annotation

GitHub Actions / Analyse Dead Code

'M_HTML' is declared but never used.

Check failure on line 16 in src/matrixrtc/types.ts

View workflow job for this annotation

GitHub Actions / JSDoc Checker

'M_HTML' is declared but never used.

Check failure on line 16 in src/matrixrtc/types.ts

View workflow job for this annotation

GitHub Actions / Jest [integ] (Node lts/*)

'M_HTML' is declared but never used.

Check failure on line 16 in src/matrixrtc/types.ts

View workflow job for this annotation

GitHub Actions / Jest [unit] (Node lts/*)

'M_HTML' is declared but never used.

Check failure on line 16 in src/matrixrtc/types.ts

View workflow job for this annotation

GitHub Actions / Jest [integ] (Node 22)

'M_HTML' is declared but never used.

Check failure on line 16 in src/matrixrtc/types.ts

View workflow job for this annotation

GitHub Actions / Jest [unit] (Node 22)

'M_HTML' is declared but never used.
import type { RelationEvent } from "../types.ts";
import type { CallMembership } from "./CallMembership.ts";

Expand Down Expand Up @@ -112,6 +112,8 @@
"m.call.intent"?: RTCCallIntent;
"sender_ts": number;
"lifetime": number;
// Extensible event types
[M_TEXT.name]: {body: string, mimetype?: string}[];
}

/**
Expand Down
Loading