@poolse/native 3.9.0 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/README.md +94 -9
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/dev/poolse/callcore/Ports.kt +21 -1
- package/android/src/main/java/dev/poolse/callcore/android/AndroidRingSurface.kt +3 -3
- package/android/src/main/java/dev/poolse/callcore/android/CallCore.kt +91 -10
- package/android/src/main/java/dev/poolse/callcore/android/CallMessagingService.kt +21 -1
- package/android/src/main/java/dev/poolse/callcore/android/CallVideo.kt +14 -0
- package/android/src/main/java/dev/poolse/callcore/android/EscalationNotification.kt +475 -0
- package/android/src/main/java/dev/poolse/callcore/android/IncomingCallActivity.kt +9 -4
- package/android/src/main/java/dev/poolse/callcore/android/MeetingNotification.kt +127 -0
- package/android/src/main/java/dev/poolse/callcore/android/PoolseIncomingCall.kt +9 -0
- package/android/src/main/java/dev/poolse/callcore/android/RingBundle.kt +9 -0
- package/android/src/main/java/expo/modules/poolsecalls/PoolseCallsModule.kt +15 -1
- package/android/src/main/livekit/java/dev/poolse/callcore/livekit/LiveKitMediaPort.kt +82 -6
- package/dist/index.cjs +18 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +133 -23
- package/dist/index.d.ts +133 -23
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/ios/Core/Ports.swift +22 -1
- package/ios/Core/SnapshotEncoding.swift +22 -3
- package/ios/Module/PoolseCallsModule.swift +26 -1
- package/ios/Platform/CallCore.swift +52 -1
- package/ios/Platform/CallKitController.swift +1 -1
- package/ios/Platform/EscalationNotifications.swift +195 -0
- package/ios/Platform/LiveKitMediaPort.swift +77 -3
- package/ios/Platform/MessageNotifications.swift +60 -1
- package/ios/Platform/VoipPush.swift +11 -2
- package/package.json +1 -1
- package/src/index.ts +154 -23
package/src/index.ts
CHANGED
|
@@ -37,12 +37,19 @@ export interface Snapshot {
|
|
|
37
37
|
| 'no_answer'
|
|
38
38
|
| 'cancelled'
|
|
39
39
|
| 'connection_lost'
|
|
40
|
-
| 'failed'
|
|
40
|
+
| 'failed'
|
|
41
|
+
/**
|
|
42
|
+
* You took this call on another of your devices (`moveCallHere`
|
|
43
|
+
* there): it goes on without this one. Say "Moved to your other
|
|
44
|
+
* device", not "Call ended". Absent before 3.10.
|
|
45
|
+
*/
|
|
46
|
+
| 'moved';
|
|
41
47
|
/**
|
|
42
48
|
* REMOTE people only; `userId` is the LiveKit identity. poolse's
|
|
43
49
|
* transcript assistant (`poolse:…`, kind agent) and the recorder
|
|
44
50
|
* (LiveKit Egress, `EG_…`) are never listed — nor counted when the core
|
|
45
|
-
* ends a call left alone. Phone (SIP) participants are listed.
|
|
51
|
+
* ends a call left alone. Phone (SIP) participants are listed. Agents
|
|
52
|
+
* invited into the call are listed with `isAgent` (last), never counted.
|
|
46
53
|
*/
|
|
47
54
|
participants: Array<{
|
|
48
55
|
userId: string;
|
|
@@ -62,6 +69,16 @@ export interface Snapshot {
|
|
|
62
69
|
* Absent before 0.11.0.
|
|
63
70
|
*/
|
|
64
71
|
connectionQuality?: ConnectionQuality;
|
|
72
|
+
/**
|
|
73
|
+
* An agent in the call (server docs/AGENTS_IN_CALLS.md): show it with
|
|
74
|
+
* the Agent badge, named `agentLabel` — never as a person, never with
|
|
75
|
+
* a camera placeholder. Absent for people and before 3.10.
|
|
76
|
+
*/
|
|
77
|
+
isAgent?: boolean;
|
|
78
|
+
/** "Scout", or "Jasir's agent" for one attending on someone's behalf. */
|
|
79
|
+
agentLabel?: string | null;
|
|
80
|
+
/** `notetaker` (silent) | `assistant` (answers when named) | `delegate`. */
|
|
81
|
+
agentMode?: 'notetaker' | 'assistant' | 'delegate' | null;
|
|
65
82
|
}>;
|
|
66
83
|
/** The kind of output playing now — the short answer to "where is the audio". */
|
|
67
84
|
audioRoute: AudioOutputKind;
|
|
@@ -132,6 +149,24 @@ export interface Snapshot {
|
|
|
132
149
|
recording?: CallRecordingState | null;
|
|
133
150
|
/** The live transcript's state, the same way (`transcript:*` on the socket). Absent before 3.9. */
|
|
134
151
|
transcription?: CallTranscriptionState | null;
|
|
152
|
+
/**
|
|
153
|
+
* `meeting`: a scheduled meeting rang this device as it started (the
|
|
154
|
+
* push's `ring_type`), so the ring reads "Weekly sync is starting" and
|
|
155
|
+
* the call screen should name the meeting. `call` otherwise. Absent
|
|
156
|
+
* before 3.10.
|
|
157
|
+
*/
|
|
158
|
+
ringType?: 'call' | 'meeting';
|
|
159
|
+
/** The meeting's title for a `meeting` ring; null otherwise. Absent before 3.10. */
|
|
160
|
+
meetingTitle?: string | null;
|
|
161
|
+
/** Noise suppression on the microphone (on by default; `setNoiseSuppression`). Absent before 3.10. */
|
|
162
|
+
noiseSuppression?: boolean;
|
|
163
|
+
/** Background blur on the camera (`setBackgroundBlur`). Absent before 3.10. */
|
|
164
|
+
backgroundBlur?: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* This call was taken over by your other device (`moveCallHere`
|
|
167
|
+
* there); the end that follows has `reason: 'moved'`. Absent before 3.10.
|
|
168
|
+
*/
|
|
169
|
+
movedElsewhere?: boolean;
|
|
135
170
|
}
|
|
136
171
|
|
|
137
172
|
/** The CallSummary's `recording` object, as the server sent it (docs/CALL_CONTRACT.md §4.2). */
|
|
@@ -175,6 +210,10 @@ export interface WaitingCall {
|
|
|
175
210
|
serverId?: string | null;
|
|
176
211
|
/** That workspace's name ("Ana · Acme"). Absent before 3.8. */
|
|
177
212
|
workspaceName?: string | null;
|
|
213
|
+
/** `meeting` when a scheduled meeting is starting rather than a person calling. Absent before 3.10. */
|
|
214
|
+
ringType?: 'call' | 'meeting';
|
|
215
|
+
/** The meeting's title for a `meeting` ring. Absent before 3.10. */
|
|
216
|
+
meetingTitle?: string | null;
|
|
178
217
|
}
|
|
179
218
|
|
|
180
219
|
/** One place call audio can play. */
|
|
@@ -289,34 +328,47 @@ export interface CallServer {
|
|
|
289
328
|
}
|
|
290
329
|
|
|
291
330
|
/**
|
|
292
|
-
* What the user tapped on a missed-call notification: the
|
|
293
|
-
* itself (`open` the conversation)
|
|
294
|
-
* — place a call on the conversation with `media`)
|
|
331
|
+
* What the user tapped on a missed-call or meeting notification: the
|
|
332
|
+
* notification itself (`open` the conversation), a missed call's Call
|
|
333
|
+
* back (`call_back` — place a call on the conversation with `media`), or
|
|
334
|
+
* a starting meeting's Join (`join_meeting` — join the room `callId` in
|
|
335
|
+
* the conversation, e.g. `poolse.rooms.start(conversationId, media)`,
|
|
336
|
+
* which joins what is live).
|
|
295
337
|
*/
|
|
296
338
|
export interface CallAction {
|
|
297
|
-
type: 'open' | 'call_back';
|
|
339
|
+
type: 'open' | 'call_back' | 'join_meeting';
|
|
298
340
|
conversationId: string;
|
|
299
341
|
callId: string | null;
|
|
300
342
|
media: 'audio' | 'video';
|
|
301
343
|
/** The server (workspace) it belongs to — open that one. Absent before 3.8. */
|
|
302
344
|
serverId?: string | null;
|
|
345
|
+
/** A meeting notice's scheduled meeting; null for missed calls. Absent before 3.10. */
|
|
346
|
+
scheduledMeetingId?: string | null;
|
|
303
347
|
}
|
|
304
348
|
|
|
305
349
|
/**
|
|
306
|
-
* A Reply or Mark as read the user did from a chat notification
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
350
|
+
* A Reply or Mark as read the user did from a chat notification — or an
|
|
351
|
+
* answer to an agent's question (`escalation`: Approve / Decline / Answer
|
|
352
|
+
* on an `agent_escalation` push) — after the native core sent it (or gave
|
|
353
|
+
* up). The server has already posted the reply and marked the
|
|
354
|
+
* conversation read, or passed the answer to the agent in the call; use
|
|
355
|
+
* this to refresh what the app shows without waiting for the socket, or
|
|
356
|
+
* to tell the user it did not go out.
|
|
311
357
|
*/
|
|
312
358
|
export interface NotificationActionResult {
|
|
313
|
-
action: 'reply' | 'mark_read';
|
|
359
|
+
action: 'reply' | 'mark_read' | 'escalation';
|
|
360
|
+
/** The conversation (for `escalation`: the call's; `""` when the push had none). */
|
|
314
361
|
conversationId: string;
|
|
362
|
+
/** `escalation` only: which question, and how it was answered. Absent before 3.10. */
|
|
363
|
+
escalationId?: string;
|
|
364
|
+
decision?: 'approve' | 'decline' | 'answer';
|
|
365
|
+
/** `escalation` only: the call the agent is in. */
|
|
366
|
+
callId?: string | null;
|
|
315
367
|
/** The server (workspace) the conversation is on. Absent before 3.8. */
|
|
316
368
|
serverId?: string;
|
|
317
369
|
/** Whether the server accepted it. */
|
|
318
370
|
ok: boolean;
|
|
319
|
-
/** Reply
|
|
371
|
+
/** Reply (and an escalation's `answer`): what the user typed. */
|
|
320
372
|
text?: string;
|
|
321
373
|
/** Reply only: the idempotency id sent with it — the message's id once posted. */
|
|
322
374
|
clientId?: string;
|
|
@@ -327,7 +379,8 @@ export interface NotificationActionResult {
|
|
|
327
379
|
* `device_signed_out`, `user_blocked`, `forbidden`, `not_found`,
|
|
328
380
|
* `mau_cap_exceeded`, `validation_failed`, `rate_limited`), or
|
|
329
381
|
* `network`, `no_grant` (the push carried no reply grant),
|
|
330
|
-
* `not_configured` (never `configure`d), `http_<status>`.
|
|
382
|
+
* `not_configured` (never `configure`d), `http_<status>`. An
|
|
383
|
+
* escalation: `not_pending`, `expired`, `invalid_token`, `no_token`.
|
|
331
384
|
*/
|
|
332
385
|
error?: string;
|
|
333
386
|
/** The HTTP status when the server answered with an error. */
|
|
@@ -369,6 +422,10 @@ interface PoolseCallsNative {
|
|
|
369
422
|
startScreenShare?(): Promise<boolean>;
|
|
370
423
|
stopScreenShare?(): void;
|
|
371
424
|
setSpeaker(on: boolean): void;
|
|
425
|
+
noiseSuppressionSupported?(): boolean;
|
|
426
|
+
setNoiseSuppression?(on: boolean): boolean;
|
|
427
|
+
backgroundBlurSupported?(): boolean;
|
|
428
|
+
setBackgroundBlur?(on: boolean): boolean;
|
|
372
429
|
setAudioOutput?(id: string): void;
|
|
373
430
|
republish?(): void;
|
|
374
431
|
callControl?(): Promise<{
|
|
@@ -526,6 +583,29 @@ export function join(
|
|
|
526
583
|
return native?.join(callId, conversationId, sessionToken, serverId ?? null) ?? Promise.resolve();
|
|
527
584
|
}
|
|
528
585
|
|
|
586
|
+
/** What {@link moveCallHere} needs besides the call id. */
|
|
587
|
+
export interface MoveCallOptions {
|
|
588
|
+
conversationId: string;
|
|
589
|
+
/** The user's session token on the call's server. */
|
|
590
|
+
sessionToken: string;
|
|
591
|
+
/** The call's server (an `addServer` id); leave it out for the default one. */
|
|
592
|
+
serverId?: string;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* "Move call to this device" (CL11): take a call you are on elsewhere
|
|
597
|
+
* — your desktop, your other phone — over to this one without hanging
|
|
598
|
+
* up. This device joins the same call; the server lets one device per
|
|
599
|
+
* person carry it (CALL_CONTRACT.md §9), so the other one is let go and
|
|
600
|
+
* its snapshot ends with `reason: 'moved'`. Offer it from the Join
|
|
601
|
+
* banner when `liveCalls` says you are already in the call.
|
|
602
|
+
*
|
|
603
|
+
* The camera follows the call's media on this device; mute starts off.
|
|
604
|
+
*/
|
|
605
|
+
export function moveCallHere(callId: string, options: MoveCallOptions): Promise<void> {
|
|
606
|
+
return join(callId, options.conversationId, options.sessionToken, options.serverId);
|
|
607
|
+
}
|
|
608
|
+
|
|
529
609
|
export interface StartRoomResult {
|
|
530
610
|
/** The room's call id — what the Join banner and `call:*` events carry. */
|
|
531
611
|
callId: string;
|
|
@@ -656,6 +736,41 @@ export const startScreenShare = async (): Promise<boolean> =>
|
|
|
656
736
|
(await native?.startScreenShare?.()) ?? false;
|
|
657
737
|
|
|
658
738
|
export const stopScreenShare = (): void => native?.stopScreenShare?.();
|
|
739
|
+
// ── capture processing (CL7) ──────────────────────────────────────────
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* Whether noise suppression can be switched. On by default on both
|
|
743
|
+
* platforms; the snapshot's `noiseSuppression` says what is in effect.
|
|
744
|
+
*/
|
|
745
|
+
export const noiseSuppressionSupported = (): boolean =>
|
|
746
|
+
native?.noiseSuppressionSupported?.() ?? false;
|
|
747
|
+
|
|
748
|
+
/**
|
|
749
|
+
* Noise suppression on or off, for this and later calls (until the app
|
|
750
|
+
* restarts). Android: WebRTC's noise suppression on the microphone
|
|
751
|
+
* (echo cancellation stays on; the mic track is republished, a short
|
|
752
|
+
* gap). iOS: Apple's voice processing does echo cancellation and noise
|
|
753
|
+
* suppression as one, so off bypasses both — offer "off" for
|
|
754
|
+
* headphones only. Returns false when the build can't.
|
|
755
|
+
*/
|
|
756
|
+
export const setNoiseSuppression = (on: boolean): boolean =>
|
|
757
|
+
native?.setNoiseSuppression?.(on) ?? false;
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* Whether this build can blur the background behind you. iOS 15+: yes
|
|
761
|
+
* (Vision person segmentation). Android: not yet — it needs an ML Kit
|
|
762
|
+
* segmentation model, planned as a later addition. Hide the toggle when
|
|
763
|
+
* false.
|
|
764
|
+
*/
|
|
765
|
+
export const backgroundBlurSupported = (): boolean => native?.backgroundBlurSupported?.() ?? false;
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* Blur the background on your camera, kept across camera flips and
|
|
769
|
+
* calls. A no-op returning false where unsupported. Background
|
|
770
|
+
* pictures (replacement) are not offered on native yet.
|
|
771
|
+
*/
|
|
772
|
+
export const setBackgroundBlur = (on: boolean): boolean => native?.setBackgroundBlur?.(on) ?? false;
|
|
773
|
+
|
|
659
774
|
/** Route call audio to the loudspeaker (`true`) or back to earpiece / headset (`false`). */
|
|
660
775
|
export const setSpeaker = (on: boolean): void => native?.setSpeaker(on);
|
|
661
776
|
|
|
@@ -738,24 +853,28 @@ export function setShowOnLockscreen(enabled: boolean): void {
|
|
|
738
853
|
}
|
|
739
854
|
}
|
|
740
855
|
|
|
741
|
-
// ── missed-call notifications
|
|
856
|
+
// ── missed-call and meeting notifications ───────────────────────────────
|
|
742
857
|
|
|
743
858
|
/**
|
|
744
|
-
*
|
|
745
|
-
*
|
|
746
|
-
*
|
|
747
|
-
*
|
|
859
|
+
* The notification action the app was LAUNCHED with, once — read it on
|
|
860
|
+
* mount. `null` when the app opened any other way.
|
|
861
|
+
*
|
|
862
|
+
* Android: missed calls and meeting notices (`starting` with Join, and
|
|
863
|
+
* the brief; server docs/MEETINGS.md §11.3), both posted by the native
|
|
864
|
+
* core from the push so they work with the app closed.
|
|
748
865
|
*
|
|
749
|
-
* iOS
|
|
750
|
-
*
|
|
751
|
-
*
|
|
866
|
+
* iOS: meeting notices (the alert push's category `poolse_meeting`, Join
|
|
867
|
+
* `poolse_meeting_join`), whose tap and Join arrive here as `open` /
|
|
868
|
+
* `join_meeting`. Missed calls there are an ordinary alert push (to the
|
|
869
|
+
* token you register with `kind: 'alert'`); read its taps with your
|
|
870
|
+
* notification library — its `type` is `call_missed`, the category
|
|
752
871
|
* `poolse_missed_call`, the Call back action `call_back`.
|
|
753
872
|
*/
|
|
754
873
|
export function takeCallAction(): CallAction | null {
|
|
755
874
|
return native?.takeCallAction?.() ?? null;
|
|
756
875
|
}
|
|
757
876
|
|
|
758
|
-
/**
|
|
877
|
+
/** A missed-call (Android) or meeting notification (both) tapped while the app is running. */
|
|
759
878
|
export function onCallAction(cb: (action: CallAction) => void): Unsubscribe {
|
|
760
879
|
if (!native || !native.takeCallAction) return () => undefined;
|
|
761
880
|
const sub = native.addListener('onCallAction', cb);
|
|
@@ -838,6 +957,18 @@ export function onNotificationReply(cb: (result: NotificationActionResult) => vo
|
|
|
838
957
|
});
|
|
839
958
|
}
|
|
840
959
|
|
|
960
|
+
/**
|
|
961
|
+
* `onNotificationAction`, agent escalations only (AG16): Approve / Decline
|
|
962
|
+
* / Answer on an `agent_escalation` push, answered natively from the lock
|
|
963
|
+
* screen. Feed `ok` ones to `poolse.escalations.list()` (or let
|
|
964
|
+
* `agent:escalation` do it) so an open card updates.
|
|
965
|
+
*/
|
|
966
|
+
export function onEscalationAction(cb: (result: NotificationActionResult) => void): Unsubscribe {
|
|
967
|
+
return onNotificationAction((result) => {
|
|
968
|
+
if (result.action === 'escalation') cb(result);
|
|
969
|
+
});
|
|
970
|
+
}
|
|
971
|
+
|
|
841
972
|
/**
|
|
842
973
|
* The notification actions that finished while no `onNotificationAction`
|
|
843
974
|
* listener was attached (usually: the app was not running), oldest
|