Share the mapping from parameters to call view model options

The SDK stopped sending join notifications: it threaded callIntent into
createCallViewModel$ but not its pair sendNotificationType, which
enterRTCSession used to read for itself, so an explicit
?sendNotificationType=ring — or an intent that implies one — no longer
reached joinRTCSession.

The mechanism is worth fixing rather than the instance. The defaults on
CallViewModelOptions describe a standalone Element Call, so a widget
caller that misses a field gets standalone behaviour rather than an error,
and the SDK is only ever a widget. Give both callers one shared mapping so
they cannot drift, and cover the whole chain from URL to options in tests.

autoLeaveWhenOthersLeft and waitForCallPickup stay out of it: the view
model never read those from the parameters, so enabling them for the SDK
would be a change in its behaviour rather than a fix.
This commit is contained in:
Valere
2026-09-02 19:26:33 +02:00
parent 182be8676d
commit 6b5f396e1e
4 changed files with 87 additions and 24 deletions
+7 -4
View File
@@ -46,7 +46,10 @@ import {
// Can this be done in the tsconfig.json
import { type TextStreamInfo } from "../node_modules/livekit-client/dist/src/room/types";
import { type Behavior, constant } from "../src/state/Behavior";
import { createCallViewModel$ } from "../src/state/CallViewModel/CallViewModel";
import {
callViewModelOptionsFromParams,
createCallViewModel$,
} from "../src/state/CallViewModel/CallViewModel";
import { ObservableScope } from "../src/state/ObservableScope";
import { getUrlParams } from "../src/UrlParams";
import { MuteStates } from "../src/state/MuteStates";
@@ -113,7 +116,8 @@ export async function createMatrixRTCSdk(
logger.info("client created");
// url params
const { roomId, controlledAudioDevices, callIntent } = getUrlParams();
const urlParams = getUrlParams();
const { roomId, controlledAudioDevices, callIntent } = urlParams;
if (roomId === null) throw Error("could not get roomId from url params");
const room = client.getRoom(roomId);
if (room === null) throw Error("could not get room from client");
@@ -144,10 +148,9 @@ export async function createMatrixRTCSdk(
mediaDevices,
muteStates,
{
...callViewModelOptionsFromParams(urlParams),
encryptionSystem: { kind: E2eeType.PER_PARTICIPANT },
hostBridge,
controlledAudioDevices,
callIntent,
},
of({}),
of({}),