feat(calls): mint a LiveKit join token into the native VoIP call payload (inc 1)

Increment 1 server side. Move livekitToken() into server/livekit.js (shared by routes.js
and calls.js). calls.js now mints a per-callee LiveKit join token and calls.js/push.js
put {livekitUrl, livekitToken} in the VoIP invite payload, so the native plugin can
connect the LiveKit room immediately on answer — even from a killed state, before the
WebView loads. No behaviour change while CALLKIT_ENABLED=0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-30 16:11:21 +05:30
parent c4ffe2a4e9
commit aae663ccea
4 changed files with 32 additions and 18 deletions
+3
View File
@@ -144,6 +144,9 @@ async function sendCallNotification(userId, data) {
callUUID: data.callUUID, room: data.room, kind: data.kind,
callerId: data.callerId || '', callerName: data.callerName || 'Incoming call',
groupId: data.groupId || '', groupName: data.groupName || '', hasVideo: !!data.hasVideo,
// LiveKit join credentials so the native plugin can connect the room immediately on answer — even
// from a killed state, before the WebView has loaded.
livekitUrl: data.livekitUrl || '', livekitToken: data.livekitToken || '',
};
for (const t of voip) {
try { const r = await sendApnsVoip(t.token, payload); if (r && r.dead) { try { await R.deviceTokens.removeByToken(t.token); } catch (_) {} } } catch (_) {}