@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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,46 @@
|
|
|
2
2
|
|
|
3
3
|
Formerly `@poolse/react-native-calls` (0.x).
|
|
4
4
|
|
|
5
|
+
## [3.10.0] - 2026-11-23
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Agents in calls (AGENTS_IN_CALLS.md): `participants` lists agents in the
|
|
10
|
+
call with `isAgent`, `agentLabel` and `agentMode` (token metadata `agent:
|
|
11
|
+
true`); they never keep a call alive (the alone check skips them) and an
|
|
12
|
+
agent joining is not someone answering.
|
|
13
|
+
- Escalations from the lock screen: Android posts the `agent_escalation`
|
|
14
|
+
data push natively with Approve / Decline / Answer (RemoteInput); iOS
|
|
15
|
+
registers the `poolse_agent_escalation` category (Approve, Decline and a
|
|
16
|
+
`UNTextInputNotificationAction` Answer). Both reply natively — `POST
|
|
17
|
+
/v1/agent-escalations/:id/reply` with the push's `reply_token`, no
|
|
18
|
+
session, no JS — and report through `onNotificationAction` with `action:
|
|
19
|
+
"escalation"` (`escalationId`, `decision`, `ok`, `error`); new
|
|
20
|
+
`onEscalationAction`. `messageReplyRequiresUnlock` covers these actions
|
|
21
|
+
too.
|
|
22
|
+
|
|
23
|
+
- Meeting rings (CA4): a ring push with `ring_type: "meeting"` and
|
|
24
|
+
`meeting_title` shows "Weekly sync is starting" on CallKit and on the
|
|
25
|
+
Android ring notification and screen, with Join / Not now buttons on
|
|
26
|
+
Android. `RingContext` gains `ringType`, `meetingTitle` and `meetingId`
|
|
27
|
+
(defaulted). Snapshots and `waiting` carry `ringType` and `meetingTitle`.
|
|
28
|
+
Custom Android ring activities get `EXTRA_RING_TYPE`, `EXTRA_MEETING_TITLE`
|
|
29
|
+
and `EXTRA_TITLE`.
|
|
30
|
+
- Meeting notices (MEETINGS.md §11.3). Android posts `type: "meeting"` data
|
|
31
|
+
pushes (`starting` with Join, `brief`) on a new "Meetings" channel. iOS
|
|
32
|
+
registers the `poolse_meeting` category with a Join action. A tap and Join
|
|
33
|
+
reach JS as a `CallAction` of type `open` / `join_meeting`, with the new
|
|
34
|
+
`scheduledMeetingId`. `takeCallAction` and `onCallAction` now work on iOS
|
|
35
|
+
too, for meeting notices.
|
|
36
|
+
- Noise suppression and background blur (CL7): `setNoiseSuppression`,
|
|
37
|
+
`noiseSuppressionSupported`, `setBackgroundBlur` and
|
|
38
|
+
`backgroundBlurSupported`. Snapshots carry `noiseSuppression` and
|
|
39
|
+
`backgroundBlur`. Blur works on iOS 15+ (LiveKit's
|
|
40
|
+
BackgroundBlurVideoProcessor). It is not available on Android yet.
|
|
41
|
+
- Move a call to this device (CL11): `moveCallHere(callId, options)`. The
|
|
42
|
+
device that lost the call gets `movedElsewhere: true` and ends with the new
|
|
43
|
+
reason `'moved'`, detected from LiveKit's duplicate-identity disconnect.
|
|
44
|
+
|
|
5
45
|
## 3.9.0 — 2026-11-22
|
|
6
46
|
|
|
7
47
|
- Recording and transcripts (server docs/RECORDING.md). poolse's transcript
|
package/README.md
CHANGED
|
@@ -151,6 +151,59 @@ server), the core:
|
|
|
151
151
|
const off = calls.onCanPublishChange((allowed) => setListenOnly(!allowed));
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
+
## Meetings: scheduled rings, background and noise, moving a call
|
|
155
|
+
|
|
156
|
+
**A meeting starting rings.** When a scheduled meeting is set to ring
|
|
157
|
+
everyone, the server sends the usual ring push with `ring_type: "meeting"`
|
|
158
|
+
and `meeting_title` (also `meeting_id`, `starts_at`). CallKit and the
|
|
159
|
+
Android ring screen then read "Weekly sync is starting" (with the
|
|
160
|
+
workspace, "Weekly sync is starting · Acme", when several are signed in),
|
|
161
|
+
and the Android buttons read Join / Not now. Answering joins the meeting's
|
|
162
|
+
room like any call. The snapshot says so too: `ringType: 'meeting'` and
|
|
163
|
+
`meetingTitle`, so the call screen can name the meeting.
|
|
164
|
+
|
|
165
|
+
**Meeting notices.** The server's "is starting" notice (for meetings set to
|
|
166
|
+
notify rather than ring) and the brief a few minutes before
|
|
167
|
+
(MEETINGS.md §11.3) are shown with the app closed. On Android the core posts
|
|
168
|
+
the `type: "meeting"` data push itself, on a "Meetings" channel, with the
|
|
169
|
+
workspace as subtext when several are signed in. "Starting" has a Join
|
|
170
|
+
button. A brief is replaced by that meeting's "starting" notice, and a
|
|
171
|
+
redelivered push is not posted twice. On iOS the server sends an alert push
|
|
172
|
+
with category `poolse_meeting`, and the core registers that category with a
|
|
173
|
+
Join action (`poolse_meeting_join`). On both platforms the tap and Join reach
|
|
174
|
+
the app as a `CallAction`: `{ type: 'open' | 'join_meeting', conversationId,
|
|
175
|
+
callId, media, serverId, scheduledMeetingId }`, through `takeCallAction()`
|
|
176
|
+
on a cold start and `onCallAction` while running. On Join, join the room
|
|
177
|
+
(`rooms.start(conversationId, media)` joins what is live). The core never
|
|
178
|
+
joins by itself.
|
|
179
|
+
|
|
180
|
+
**Noise suppression and background blur.**
|
|
181
|
+
`setNoiseSuppression(on)` / `noiseSuppressionSupported()`: on by default.
|
|
182
|
+
Android switches WebRTC's noise suppression on the microphone (echo
|
|
183
|
+
cancellation stays on). iOS uses Apple's voice processing, which does echo
|
|
184
|
+
cancellation and noise suppression together, so off bypasses both: offer
|
|
185
|
+
"off" only for headphones. `setBackgroundBlur(on)` /
|
|
186
|
+
`backgroundBlurSupported()`: iOS 15+ blurs behind you with Vision person
|
|
187
|
+
segmentation, kept across camera flips. Android has no blur yet: it needs an
|
|
188
|
+
ML Kit segmentation model, so it is planned for later, and
|
|
189
|
+
`backgroundBlurSupported()` is `false` there. Background pictures are not
|
|
190
|
+
available on native yet. The snapshot carries `noiseSuppression` and
|
|
191
|
+
`backgroundBlur`.
|
|
192
|
+
|
|
193
|
+
**Keep the call while you work.** Picture-in-picture for video calls is
|
|
194
|
+
`setPictureInPictureEnabled(true)` while a video call shows someone, and a
|
|
195
|
+
`<CallVideoView pictureInPicture>` on the main picture (iOS 15+); on Android
|
|
196
|
+
the whole activity floats (the plugin's `pictureInPicture` option), so draw
|
|
197
|
+
a compact layout while `isInPictureInPicture()`.
|
|
198
|
+
|
|
199
|
+
**Move a call to this device.**
|
|
200
|
+
`moveCallHere(callId, { conversationId, sessionToken, serverId? })` joins a
|
|
201
|
+
call you are on elsewhere from this device. The server keeps one device per
|
|
202
|
+
person in a call, so the other device is let go. Its snapshot gets
|
|
203
|
+
`movedElsewhere: true` and ends with `reason: 'moved'`: show "Moved to your
|
|
204
|
+
other device", not "Call ended". Offer it where `liveCalls` shows you already
|
|
205
|
+
in the call.
|
|
206
|
+
|
|
154
207
|
## Ringtone
|
|
155
208
|
|
|
156
209
|
```json
|
|
@@ -230,15 +283,18 @@ The ring notification's full-screen intent and heads-up tap start it with
|
|
|
230
283
|
`FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TOP` and these extras (constants
|
|
231
284
|
on `dev.poolse.callcore.android.PoolseIncomingCall`):
|
|
232
285
|
|
|
233
|
-
| Extra | Key | Type
|
|
234
|
-
| ------------------------- | -------------------------- |
|
|
235
|
-
| `EXTRA_CALL_ID` | `poolse_call_id` | String
|
|
236
|
-
| `EXTRA_CONVERSATION_ID` | `poolse_conversation_id` | String
|
|
237
|
-
| `EXTRA_CONVERSATION_NAME` | `poolse_conversation_name` | String, may be null
|
|
238
|
-
| `EXTRA_CALLER_NAME` | `poolse_caller_name` | String, may be null
|
|
239
|
-
| `EXTRA_CALLER_AVATAR_URL` | `poolse_caller_avatar_url` | String, may be null
|
|
240
|
-
| `EXTRA_MEDIA` | `poolse_media` | `"audio"` or `"video"`
|
|
241
|
-
| `EXTRA_RING_DEADLINE` | `poolse_ring_deadline` | Long, epoch ms
|
|
286
|
+
| Extra | Key | Type |
|
|
287
|
+
| ------------------------- | -------------------------- | --------------------------------------------------------------------- |
|
|
288
|
+
| `EXTRA_CALL_ID` | `poolse_call_id` | String |
|
|
289
|
+
| `EXTRA_CONVERSATION_ID` | `poolse_conversation_id` | String |
|
|
290
|
+
| `EXTRA_CONVERSATION_NAME` | `poolse_conversation_name` | String, may be null |
|
|
291
|
+
| `EXTRA_CALLER_NAME` | `poolse_caller_name` | String, may be null |
|
|
292
|
+
| `EXTRA_CALLER_AVATAR_URL` | `poolse_caller_avatar_url` | String, may be null |
|
|
293
|
+
| `EXTRA_MEDIA` | `poolse_media` | `"audio"` or `"video"` |
|
|
294
|
+
| `EXTRA_RING_DEADLINE` | `poolse_ring_deadline` | Long, epoch ms |
|
|
295
|
+
| `EXTRA_RING_TYPE` | `poolse_ring_type` | `"call"` or `"meeting"` |
|
|
296
|
+
| `EXTRA_MEETING_TITLE` | `poolse_meeting_title` | String or null |
|
|
297
|
+
| `EXTRA_TITLE` | `poolse_title` | The headline: "Weekly sync is starting", or the conversation / caller |
|
|
242
298
|
|
|
243
299
|
plus an opaque `poolse_ring` bundle that the functions below read; pass them
|
|
244
300
|
the Intent you were started with (and the new one in `onNewIntent`):
|
|
@@ -322,6 +378,35 @@ expo-notifications also hands these responses to its own JS listeners: in
|
|
|
322
378
|
`addNotificationResponseReceivedListener`, ignore an `actionIdentifier` of
|
|
323
379
|
`reply` or `mark_read` (only the default tap should open the chat).
|
|
324
380
|
|
|
381
|
+
## Agents in calls and escalations
|
|
382
|
+
|
|
383
|
+
`participants` lists agents in the call (server docs/AGENTS_IN_CALLS.md)
|
|
384
|
+
with `isAgent: true`, `agentLabel` ("Scout", "Jasir's agent") and
|
|
385
|
+
`agentMode`; show them with the Agent badge, never as a person. They never
|
|
386
|
+
keep a call alive.
|
|
387
|
+
|
|
388
|
+
Your agent attending a meeting for you asks by push (`type:
|
|
389
|
+
"agent_escalation"`). The core shows it with **Approve**, **Decline** and
|
|
390
|
+
**Answer** (a text field) and replies natively — from the lock screen, app
|
|
391
|
+
closed, no session — with the push's `reply_token` to `POST
|
|
392
|
+
/v1/agent-escalations/:id/reply` on the push's server.
|
|
393
|
+
|
|
394
|
+
- **Android**: the data push is posted on the "Questions from your agent"
|
|
395
|
+
channel; it times out at `expires_at`. After a reply it reads "Approved —
|
|
396
|
+
your agent will say so." and goes; a failure says why and keeps the
|
|
397
|
+
actions while trying again can work.
|
|
398
|
+
- **iOS**: an alert push with category `poolse_agent_escalation`
|
|
399
|
+
(time-sensitive); the core registers the category (actions
|
|
400
|
+
`poolse_escalation_approve`, `poolse_escalation_decline`,
|
|
401
|
+
`poolse_escalation_answer`) beside `poolse_message`. A failure posts
|
|
402
|
+
"Couldn't send your answer" with the same actions. In
|
|
403
|
+
`addNotificationResponseReceivedListener`, ignore those action ids.
|
|
404
|
+
|
|
405
|
+
Results arrive as `onNotificationAction` (or `onEscalationAction`) with
|
|
406
|
+
`action: 'escalation'`, `escalationId`, `decision`, `ok`, `error`. The
|
|
407
|
+
token works once: a reply is retried only when no answer came back.
|
|
408
|
+
`messageReplyRequiresUnlock` makes these actions ask for the unlock too.
|
|
409
|
+
|
|
325
410
|
## Signed in to several workspaces
|
|
326
411
|
|
|
327
412
|
The core can serve several API servers at once — one per workspace the user
|
|
@@ -30,6 +30,10 @@
|
|
|
30
30
|
android:name="dev.poolse.callcore.android.MessageActionReceiver"
|
|
31
31
|
android:exported="false" />
|
|
32
32
|
|
|
33
|
+
<receiver
|
|
34
|
+
android:name="dev.poolse.callcore.android.EscalationActionReceiver"
|
|
35
|
+
android:exported="false" />
|
|
36
|
+
|
|
33
37
|
<service
|
|
34
38
|
android:name="dev.poolse.callcore.android.CallForegroundService"
|
|
35
39
|
android:exported="false"
|
|
@@ -146,7 +146,27 @@ data class RingContext(
|
|
|
146
146
|
val serverId: String? = null,
|
|
147
147
|
/** The push's `workspace_name`, for "Ana · Acme" when several servers are signed in. */
|
|
148
148
|
val workspaceName: String? = null,
|
|
149
|
-
|
|
149
|
+
/**
|
|
150
|
+
* The push's `ring_type`: `"meeting"` for a scheduled meeting starting
|
|
151
|
+
* (CA4), `"call"` (or null, older servers) for a person calling.
|
|
152
|
+
*/
|
|
153
|
+
val ringType: String? = null,
|
|
154
|
+
/** The push's `meeting_title` ("Weekly sync"), meeting rings only. */
|
|
155
|
+
val meetingTitle: String? = null,
|
|
156
|
+
/** The push's `meeting_id`, meeting rings only. */
|
|
157
|
+
val meetingId: String? = null,
|
|
158
|
+
) {
|
|
159
|
+
/** A scheduled meeting starting, not a person calling. */
|
|
160
|
+
val isMeeting: Boolean get() = ringType == "meeting"
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* What the ring surface names, before any workspace suffix: "Weekly
|
|
164
|
+
* sync is starting" for a meeting, else the conversation or caller.
|
|
165
|
+
*/
|
|
166
|
+
val displayTitle: String?
|
|
167
|
+
get() = if (isMeeting) "${meetingTitle ?: conversationName ?: "Meeting"} is starting"
|
|
168
|
+
else conversationName ?: callerName
|
|
169
|
+
}
|
|
150
170
|
|
|
151
171
|
/** Android: the phoneCall foreground service. iOS: the CallKit session. */
|
|
152
172
|
interface CallSessionPort {
|
|
@@ -130,7 +130,7 @@ internal class AndroidRingSurface(
|
|
|
130
130
|
val answer = incomingActivity(autoAnswer = true, requestOffset = 2)
|
|
131
131
|
|
|
132
132
|
val caller = Person.Builder()
|
|
133
|
-
.setName(ServerRegistry.ringTitle(context, ring, ring.
|
|
133
|
+
.setName(ServerRegistry.ringTitle(context, ring, ring.displayTitle) ?: "Incoming call")
|
|
134
134
|
.setImportant(true)
|
|
135
135
|
.build()
|
|
136
136
|
|
|
@@ -210,14 +210,14 @@ internal class AndroidRingSurface(
|
|
|
210
210
|
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE,
|
|
211
211
|
)
|
|
212
212
|
|
|
213
|
-
val who = ServerRegistry.ringTitle(context, ring, ring.
|
|
213
|
+
val who = ServerRegistry.ringTitle(context, ring, ring.displayTitle) ?: "Someone"
|
|
214
214
|
val what = if (ring.media == "video") "video call" else "call"
|
|
215
215
|
val notification = NotificationCompat.Builder(context, WAITING_CHANNEL_ID)
|
|
216
216
|
.setSmallIcon(config.smallIcon)
|
|
217
217
|
.setCategory(NotificationCompat.CATEGORY_CALL)
|
|
218
218
|
.setPriority(NotificationCompat.PRIORITY_HIGH)
|
|
219
219
|
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
|
|
220
|
-
.setContentTitle("$who — incoming $what")
|
|
220
|
+
.setContentTitle(if (ring.isMeeting) who else "$who — incoming $what")
|
|
221
221
|
.setContentText("You're on a call. Answering ends it.")
|
|
222
222
|
.setOngoing(true)
|
|
223
223
|
.setAutoCancel(false)
|
|
@@ -91,6 +91,15 @@ class CallCore private constructor(context: Context) {
|
|
|
91
91
|
private var videoPaused = false
|
|
92
92
|
/** False while the server holds our media back (recording consent). */
|
|
93
93
|
private var canPublish = true
|
|
94
|
+
/** Capture processing (CL7): per process, not per call. */
|
|
95
|
+
private var noiseSuppression = true
|
|
96
|
+
private var backgroundBlur = false
|
|
97
|
+
/**
|
|
98
|
+
* This call was taken over by the same user on another device (CL11):
|
|
99
|
+
* the SFU replaced our participant (duplicate identity). The end that
|
|
100
|
+
* follows reads `reason: 'moved'`.
|
|
101
|
+
*/
|
|
102
|
+
private var movedElsewhere = false
|
|
94
103
|
|
|
95
104
|
/** Last snapshot emitted; read by the bridge's getCallState from any thread. */
|
|
96
105
|
@Volatile private var lastSnapshot: Map<String, Any?>? = null
|
|
@@ -108,6 +117,9 @@ class CallCore private constructor(context: Context) {
|
|
|
108
117
|
/** The push's `workspace_name` per ringing call. */
|
|
109
118
|
private val ringWorkspaces = java.util.concurrent.ConcurrentHashMap<String, String>()
|
|
110
119
|
|
|
120
|
+
/** Meeting rings (CA4) per call: the meeting's title, "" when it has none. Absent: a person calling. */
|
|
121
|
+
private val ringMeetings = java.util.concurrent.ConcurrentHashMap<String, String>()
|
|
122
|
+
|
|
111
123
|
/**
|
|
112
124
|
* A ring arrived — from FCM (closed app) or the socket (open app).
|
|
113
125
|
* Bound to its server before the runtime sees it: a busy-decline runs
|
|
@@ -124,6 +136,10 @@ class CallCore private constructor(context: Context) {
|
|
|
124
136
|
if (ringWorkspaces.size > 16) ringWorkspaces.clear()
|
|
125
137
|
ringWorkspaces[ring.callId] = it
|
|
126
138
|
}
|
|
139
|
+
if (ring.isMeeting) {
|
|
140
|
+
if (ringMeetings.size > 16) ringMeetings.clear()
|
|
141
|
+
ringMeetings[ring.callId] = ring.meetingTitle ?: ""
|
|
142
|
+
}
|
|
127
143
|
}
|
|
128
144
|
|
|
129
145
|
/**
|
|
@@ -255,6 +271,34 @@ class CallCore private constructor(context: Context) {
|
|
|
255
271
|
return true
|
|
256
272
|
}
|
|
257
273
|
|
|
274
|
+
/**
|
|
275
|
+
* Noise suppression on the microphone (CL7), on by default. Kept
|
|
276
|
+
* across calls for this process. False when the engine can't change
|
|
277
|
+
* it (the signalling-only build).
|
|
278
|
+
*/
|
|
279
|
+
fun setNoiseSuppression(on: Boolean): Boolean {
|
|
280
|
+
val source = media as? CaptureProcessingSource ?: return false
|
|
281
|
+
// On the runtime's (main) thread: the media port only touches its room there.
|
|
282
|
+
runtime.post { noiseSuppression = on; source.setNoiseSuppression(on) }
|
|
283
|
+
runtime.reemit()
|
|
284
|
+
return true
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/** Background blur on the camera (CL7); a no-op where unsupported. */
|
|
288
|
+
fun setBackgroundBlur(on: Boolean): Boolean {
|
|
289
|
+
val source = media as? CaptureProcessingSource ?: return false
|
|
290
|
+
if (!source.backgroundBlurSupported) return false
|
|
291
|
+
runtime.post { backgroundBlur = on; source.setBackgroundBlur(on) }
|
|
292
|
+
runtime.reemit()
|
|
293
|
+
return true
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
val noiseSuppressionSupported: Boolean
|
|
297
|
+
get() = (media as? CaptureProcessingSource)?.noiseSuppressionSupported ?: false
|
|
298
|
+
|
|
299
|
+
val backgroundBlurSupported: Boolean
|
|
300
|
+
get() = (media as? CaptureProcessingSource)?.backgroundBlurSupported ?: false
|
|
301
|
+
|
|
258
302
|
/** Whether this build's media engine can share the screen. */
|
|
259
303
|
val screenShareSupported: Boolean get() = media is ScreenShareSource
|
|
260
304
|
|
|
@@ -328,15 +372,20 @@ class CallCore private constructor(context: Context) {
|
|
|
328
372
|
conversationName = conversationName,
|
|
329
373
|
kind = callKind,
|
|
330
374
|
participants = roster.map {
|
|
331
|
-
|
|
332
|
-
"userId"
|
|
333
|
-
"externalId"
|
|
334
|
-
"speaking"
|
|
335
|
-
"muted"
|
|
336
|
-
"cameraOn"
|
|
337
|
-
"screenSharing"
|
|
338
|
-
"connectionQuality"
|
|
339
|
-
|
|
375
|
+
buildMap<String, Any> {
|
|
376
|
+
put("userId", it.identity)
|
|
377
|
+
put("externalId", it.externalId)
|
|
378
|
+
put("speaking", it.speaking)
|
|
379
|
+
put("muted", it.muted)
|
|
380
|
+
put("cameraOn", it.cameraOn)
|
|
381
|
+
put("screenSharing", it.screenSharing)
|
|
382
|
+
put("connectionQuality", it.connectionQuality)
|
|
383
|
+
if (it.isAgent) {
|
|
384
|
+
put("isAgent", true)
|
|
385
|
+
it.agentLabel?.let { label -> put("agentLabel", label) }
|
|
386
|
+
it.agentMode?.let { mode -> put("agentMode", mode) }
|
|
387
|
+
}
|
|
388
|
+
}
|
|
340
389
|
},
|
|
341
390
|
audioRoute = audioRoute ?: if (loud(state)) "speaker" else "earpiece",
|
|
342
391
|
audioOutputs = audioOutputs.map { mapOf("id" to it.id, "kind" to it.kind, "name" to it.name) },
|
|
@@ -368,6 +417,16 @@ class CallCore private constructor(context: Context) {
|
|
|
368
417
|
val out = snap.toMutableMap()
|
|
369
418
|
out["serverId"] = serverId
|
|
370
419
|
out["workspaceName"] = state.callId?.let { ringWorkspaces[it] } ?: servers.get(serverId)?.name
|
|
420
|
+
// A scheduled meeting that rang this device (CA4).
|
|
421
|
+
val meeting = state.callId?.let { ringMeetings[it] }
|
|
422
|
+
out["ringType"] = if (meeting != null) "meeting" else "call"
|
|
423
|
+
out["meetingTitle"] = meeting?.ifEmpty { null }
|
|
424
|
+
out["noiseSuppression"] = noiseSuppression
|
|
425
|
+
out["backgroundBlur"] = backgroundBlur
|
|
426
|
+
out["movedElsewhere"] = movedElsewhere
|
|
427
|
+
// Taken over by another of this user's devices: the machine ends it
|
|
428
|
+
// as `left` (CALL_CONTRACT.md §9); the app is told why.
|
|
429
|
+
if (movedElsewhere && state.phase == Phase.ENDED) out["reason"] = "moved"
|
|
371
430
|
val waiting = snap["waiting"] as? Map<*, *>
|
|
372
431
|
val ring = runtime.waitingRing
|
|
373
432
|
if (waiting != null && ring != null) {
|
|
@@ -375,6 +434,8 @@ class CallCore private constructor(context: Context) {
|
|
|
375
434
|
out["waiting"] = waiting.entries.associate { (k, v) -> k.toString() to v } + mapOf(
|
|
376
435
|
"serverId" to waitingServer,
|
|
377
436
|
"workspaceName" to (ring.workspaceName ?: servers.get(waitingServer)?.name),
|
|
437
|
+
"ringType" to (if (ring.isMeeting) "meeting" else "call"),
|
|
438
|
+
"meetingTitle" to ring.meetingTitle,
|
|
378
439
|
)
|
|
379
440
|
}
|
|
380
441
|
return out
|
|
@@ -391,6 +452,7 @@ class CallCore private constructor(context: Context) {
|
|
|
391
452
|
roster = emptyList()
|
|
392
453
|
conversationName = null
|
|
393
454
|
callKind = "call"
|
|
455
|
+
movedElsewhere = false
|
|
394
456
|
mutedSelf = false
|
|
395
457
|
// Reported by the media adapter once the camera is really published.
|
|
396
458
|
cameraOn = false
|
|
@@ -457,7 +519,8 @@ class CallCore private constructor(context: Context) {
|
|
|
457
519
|
override fun onRemoteJoined() = runtime.onRemoteJoined()
|
|
458
520
|
override fun onParticipants(participants: List<MediaParticipant>) {
|
|
459
521
|
runtime.post { roster = participants }
|
|
460
|
-
|
|
522
|
+
// An agent keeps nobody company: a call left with only agents is over.
|
|
523
|
+
runtime.onRemoteCount(participants.count { !it.isAgent })
|
|
461
524
|
runtime.reemit()
|
|
462
525
|
}
|
|
463
526
|
override fun onAudioRoute(route: String) {
|
|
@@ -484,6 +547,9 @@ class CallCore private constructor(context: Context) {
|
|
|
484
547
|
runtime.post { connectionQuality = quality; this@CallCore.videoPaused = videoPaused }
|
|
485
548
|
runtime.reemit()
|
|
486
549
|
}
|
|
550
|
+
override fun onMovedElsewhere() {
|
|
551
|
+
runtime.post { movedElsewhere = true }
|
|
552
|
+
}
|
|
487
553
|
}
|
|
488
554
|
|
|
489
555
|
private fun bringAppToFront(callId: String, from: Context?): Boolean {
|
|
@@ -747,6 +813,12 @@ interface MediaEvents {
|
|
|
747
813
|
* given yet, docs/RECORDING.md §5). Sent on every change.
|
|
748
814
|
*/
|
|
749
815
|
fun onCanPublish(allowed: Boolean) {}
|
|
816
|
+
/**
|
|
817
|
+
* The SFU replaced us with the same user joining from another device
|
|
818
|
+
* ("move call to this device", CALL_CONTRACT.md §9). Sent just before
|
|
819
|
+
* [onLost].
|
|
820
|
+
*/
|
|
821
|
+
fun onMovedElsewhere() {}
|
|
750
822
|
}
|
|
751
823
|
|
|
752
824
|
/** One place call audio can play — a snapshot `audioOutputs[]` entry. */
|
|
@@ -772,4 +844,13 @@ data class MediaParticipant(
|
|
|
772
844
|
val externalId: String = identity,
|
|
773
845
|
/** Their link to the SFU: `good` | `poor` | `lost` (dropped, coming back) | `unknown`. */
|
|
774
846
|
val connectionQuality: String = "unknown",
|
|
847
|
+
/**
|
|
848
|
+
* An agent in the call (AGENTS_IN_CALLS.md §1): shown with the Agent
|
|
849
|
+
* badge, named [agentLabel], never counted as someone keeping the call up.
|
|
850
|
+
*/
|
|
851
|
+
val isAgent: Boolean = false,
|
|
852
|
+
/** "Scout" / "Jasir's agent" — the agent token's `label`. */
|
|
853
|
+
val agentLabel: String? = null,
|
|
854
|
+
/** `notetaker` | `assistant` | `delegate`. */
|
|
855
|
+
val agentMode: String? = null,
|
|
775
856
|
)
|
|
@@ -14,7 +14,9 @@ import dev.poolse.callcore.RingContext
|
|
|
14
14
|
*
|
|
15
15
|
* Contract: data-only messages — rings with `type: "call"`, control
|
|
16
16
|
* pushes (`ring_ended`, `finished`) and the missed-call notification
|
|
17
|
-
* (`missed`) with `type: "call_event"` (CALL_CONTRACT.md §5)
|
|
17
|
+
* (`missed`) with `type: "call_event"` (CALL_CONTRACT.md §5); meeting
|
|
18
|
+
* notices with `type: "meeting"` (MEETINGS.md §11.3); an agent's question
|
|
19
|
+
* with `type: "agent_escalation"` (AGENTS_IN_CALLS.md §5).
|
|
18
20
|
*/
|
|
19
21
|
class CallMessagingService : FirebaseMessagingService() {
|
|
20
22
|
|
|
@@ -46,6 +48,20 @@ class CallMessagingService : FirebaseMessagingService() {
|
|
|
46
48
|
}
|
|
47
49
|
return
|
|
48
50
|
}
|
|
51
|
+
if (type == "meeting") {
|
|
52
|
+
// Scheduled-meeting notices (MEETINGS.md §11.3): "starting" with
|
|
53
|
+
// Join, and the brief. Always shown, even for the open chat.
|
|
54
|
+
if (CallCore.getOrNull(this) == null) return
|
|
55
|
+
MeetingNotification.show(this, data, CallCore.smallIcon(this))
|
|
56
|
+
return
|
|
57
|
+
}
|
|
58
|
+
if (type == "agent_escalation") {
|
|
59
|
+
// Your agent, attending a meeting for you, asks something
|
|
60
|
+
// (AGENTS_IN_CALLS.md §5): Approve / Decline / Answer from here.
|
|
61
|
+
if (CallCore.getOrNull(this) == null) return
|
|
62
|
+
EscalationNotification.show(this, data, CallCore.smallIcon(this))
|
|
63
|
+
return
|
|
64
|
+
}
|
|
49
65
|
if (type != "call" && type != "call_event") {
|
|
50
66
|
forwardToHost { it.onMessageReceived(message) }
|
|
51
67
|
return
|
|
@@ -103,6 +119,10 @@ class CallMessagingService : FirebaseMessagingService() {
|
|
|
103
119
|
// declined) on the server of its tenant.
|
|
104
120
|
serverId = ServerRegistry.resolve(this@CallMessagingService, this["tenant_id"])?.id,
|
|
105
121
|
workspaceName = this["workspace_name"]?.ifEmpty { null },
|
|
122
|
+
// A scheduled meeting starting (CA4): "Weekly sync is starting".
|
|
123
|
+
ringType = this["ring_type"]?.ifEmpty { null },
|
|
124
|
+
meetingTitle = this["meeting_title"]?.ifEmpty { null },
|
|
125
|
+
meetingId = this["meeting_id"]?.ifEmpty { null },
|
|
106
126
|
)
|
|
107
127
|
}
|
|
108
128
|
|
|
@@ -27,6 +27,20 @@ interface ScreenShareSource {
|
|
|
27
27
|
fun setScreenShare(on: Boolean, permission: android.content.Intent?)
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Capture processing (CL7), for a media port that can change it mid-call.
|
|
32
|
+
* Noise suppression is the platform's (WebRTC's NS with echo
|
|
33
|
+
* cancellation kept on); background blur needs a video processor.
|
|
34
|
+
*/
|
|
35
|
+
interface CaptureProcessingSource {
|
|
36
|
+
val noiseSuppressionSupported: Boolean get() = true
|
|
37
|
+
val backgroundBlurSupported: Boolean get() = false
|
|
38
|
+
/** On by default. Applies to the published microphone at once. */
|
|
39
|
+
fun setNoiseSuppression(on: Boolean)
|
|
40
|
+
/** A no-op where [backgroundBlurSupported] is false. */
|
|
41
|
+
fun setBackgroundBlur(on: Boolean) {}
|
|
42
|
+
}
|
|
43
|
+
|
|
30
44
|
/** One on-screen video slot, bound to a participant's camera or shared screen. */
|
|
31
45
|
interface CallVideoSurface {
|
|
32
46
|
/** The Android view to host; it fills its parent. */
|