farvex 0.2.0 → 1.0.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 +12 -1
- package/README.md +292 -175
- package/dist/index.cjs +991 -2468
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +989 -2461
- package/dist/index.js.map +1 -1
- package/dist/livekit/index.cjs +4 -24
- package/dist/livekit/index.d.cts +2 -2
- package/dist/livekit/index.d.ts +2 -2
- package/dist/livekit/index.js +1 -1
- package/dist/react/index.cjs +89 -3287
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +17 -84
- package/dist/react/index.d.ts +17 -84
- package/dist/react/index.js +88 -3276
- package/dist/react/index.js.map +1 -1
- package/dist/types-DhJEeeui.d.cts +206 -0
- package/dist/types-DhJEeeui.d.ts +206 -0
- package/package.json +52 -71
- package/dist/core/index.cjs +0 -2917
- package/dist/core/index.cjs.map +0 -1
- package/dist/core/index.d.cts +0 -1417
- package/dist/core/index.d.ts +0 -1417
- package/dist/core/index.js +0 -2902
- package/dist/core/index.js.map +0 -1
- package/dist/mock/index.cjs +0 -3267
- package/dist/mock/index.cjs.map +0 -1
- package/dist/mock/index.d.cts +0 -31
- package/dist/mock/index.d.ts +0 -31
- package/dist/mock/index.js +0 -3263
- package/dist/mock/index.js.map +0 -1
package/dist/core/index.d.cts
DELETED
|
@@ -1,1417 +0,0 @@
|
|
|
1
|
-
import { Room } from 'livekit-client';
|
|
2
|
-
|
|
3
|
-
type Nullable<T> = T | null;
|
|
4
|
-
type JsonPrimitive = string | number | boolean | null;
|
|
5
|
-
type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
|
6
|
-
type JsonObject = {
|
|
7
|
-
[key: string]: JsonValue;
|
|
8
|
-
};
|
|
9
|
-
type JsonArray = JsonValue[];
|
|
10
|
-
type Unsubscribe = () => void;
|
|
11
|
-
|
|
12
|
-
type CallpadErrorKind = "validation" | "unauth" | "forbidden" | "notfound" | "precondition" | "conflict" | "internal" | "unavailable" | "timeout" | "network" | "rate_limited" | "media_device" | "media_unavailable" | "disposed";
|
|
13
|
-
interface CallpadErrorIssue {
|
|
14
|
-
readonly path: string;
|
|
15
|
-
readonly detail: string;
|
|
16
|
-
readonly code?: string;
|
|
17
|
-
}
|
|
18
|
-
interface CallpadError {
|
|
19
|
-
readonly kind: CallpadErrorKind;
|
|
20
|
-
readonly code: string;
|
|
21
|
-
readonly title: string;
|
|
22
|
-
readonly detail?: string;
|
|
23
|
-
readonly retryable: boolean;
|
|
24
|
-
readonly issues?: readonly CallpadErrorIssue[];
|
|
25
|
-
readonly status?: number;
|
|
26
|
-
readonly cause?: Error;
|
|
27
|
-
}
|
|
28
|
-
type Overrides = {
|
|
29
|
-
detail?: string;
|
|
30
|
-
issues?: readonly CallpadErrorIssue[];
|
|
31
|
-
status?: number;
|
|
32
|
-
cause?: Error;
|
|
33
|
-
};
|
|
34
|
-
declare const callpadError: {
|
|
35
|
-
validation: (code: string, title: string, ov?: Overrides) => CallpadError;
|
|
36
|
-
unauth: (code: string, title: string, ov?: Overrides) => CallpadError;
|
|
37
|
-
forbidden: (code: string, title: string, ov?: Overrides) => CallpadError;
|
|
38
|
-
notfound: (code: string, title: string, ov?: Overrides) => CallpadError;
|
|
39
|
-
precondition: (code: string, title: string, ov?: Overrides) => CallpadError;
|
|
40
|
-
conflict: (code: string, title: string, ov?: Overrides) => CallpadError;
|
|
41
|
-
internal: (code: string, title: string, ov?: Overrides) => CallpadError;
|
|
42
|
-
unavailable: (code: string, title: string, ov?: Overrides) => CallpadError;
|
|
43
|
-
timeout: (code: string, title: string, ov?: Overrides) => CallpadError;
|
|
44
|
-
network: (code: string, title: string, ov?: Overrides) => CallpadError;
|
|
45
|
-
rateLimited: (code: string, title: string, ov?: Overrides) => CallpadError;
|
|
46
|
-
mediaDevice: (code: string, title: string, ov?: Overrides) => CallpadError;
|
|
47
|
-
mediaUnavailable: (code: string, title: string, ov?: Overrides) => CallpadError;
|
|
48
|
-
disposed: () => CallpadError;
|
|
49
|
-
fromUnknown: (cause: unknown, context?: Nullable<string>) => CallpadError;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
type Result<T, E = CallpadError> = {
|
|
53
|
-
ok: true;
|
|
54
|
-
value: T;
|
|
55
|
-
} | {
|
|
56
|
-
ok: false;
|
|
57
|
-
error: E;
|
|
58
|
-
};
|
|
59
|
-
declare function ok<T>(value: T): Result<T, never>;
|
|
60
|
-
declare function err<E>(error: E): Result<never, E>;
|
|
61
|
-
declare function isOk<T, E>(r: Result<T, E>): r is {
|
|
62
|
-
ok: true;
|
|
63
|
-
value: T;
|
|
64
|
-
};
|
|
65
|
-
declare function isErr<T, E>(r: Result<T, E>): r is {
|
|
66
|
-
ok: false;
|
|
67
|
-
error: E;
|
|
68
|
-
};
|
|
69
|
-
declare function unwrap<T, E>(r: Result<T, E>): T;
|
|
70
|
-
|
|
71
|
-
interface LogFields {
|
|
72
|
-
[key: string]: JsonValue | Error | undefined;
|
|
73
|
-
}
|
|
74
|
-
interface Logger {
|
|
75
|
-
debug(fields: LogFields, msg: string): void;
|
|
76
|
-
info(fields: LogFields, msg: string): void;
|
|
77
|
-
warn(fields: LogFields, msg: string): void;
|
|
78
|
-
error(fields: LogFields, msg: string): void;
|
|
79
|
-
child(bindings: LogFields): Logger;
|
|
80
|
-
}
|
|
81
|
-
declare const noopLogger: Logger;
|
|
82
|
-
|
|
83
|
-
type GetApiV1PulseGrantsResponses = {
|
|
84
|
-
/**
|
|
85
|
-
* connect grant
|
|
86
|
-
*/
|
|
87
|
-
200: {
|
|
88
|
-
url: string;
|
|
89
|
-
path: string;
|
|
90
|
-
namespace: '/';
|
|
91
|
-
token: string;
|
|
92
|
-
expiresAt: string;
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
type GetApiV1VendorsBySlugPresenceResponses = {
|
|
96
|
-
/**
|
|
97
|
-
* presence
|
|
98
|
-
*/
|
|
99
|
-
200: {
|
|
100
|
-
items: Array<{
|
|
101
|
-
id: string;
|
|
102
|
-
availability: 'available' | 'busy' | 'away' | 'on_break' | 'dnd' | 'recovering' | 'offline';
|
|
103
|
-
connectivity: 'online' | 'offline';
|
|
104
|
-
lastSeenAt: string;
|
|
105
|
-
}>;
|
|
106
|
-
};
|
|
107
|
-
};
|
|
108
|
-
type PutApiV1VendorsBySlugPresenceStatusData = {
|
|
109
|
-
body?: {
|
|
110
|
-
status: 'available' | 'away' | 'on_break' | 'dnd';
|
|
111
|
-
note?: string;
|
|
112
|
-
};
|
|
113
|
-
path: {
|
|
114
|
-
slug: string;
|
|
115
|
-
};
|
|
116
|
-
query?: never;
|
|
117
|
-
url: '/api/v1/vendors/{slug}/presence/status';
|
|
118
|
-
};
|
|
119
|
-
type GetApiV1SessionsResponses = {
|
|
120
|
-
/**
|
|
121
|
-
* visible sessions
|
|
122
|
-
*/
|
|
123
|
-
200: {
|
|
124
|
-
items: Array<{
|
|
125
|
-
id: string;
|
|
126
|
-
callId: string;
|
|
127
|
-
vendorId: number;
|
|
128
|
-
version: number;
|
|
129
|
-
name: string;
|
|
130
|
-
direction: 'inbound' | 'outbound';
|
|
131
|
-
channel: 'webrtc' | 'sip' | 'mixed';
|
|
132
|
-
mediaType: 'audio' | 'video';
|
|
133
|
-
state: 'ringing' | 'active' | 'on_hold' | 'ended';
|
|
134
|
-
room: {
|
|
135
|
-
name: string;
|
|
136
|
-
sid: string;
|
|
137
|
-
};
|
|
138
|
-
hostAgentId: string;
|
|
139
|
-
createdAt: string;
|
|
140
|
-
activatedAt: string;
|
|
141
|
-
endedAt: string;
|
|
142
|
-
endReason: 'completed' | 'declined' | 'cancelled' | 'failed' | 'transferred' | 'voicemail' | 'timeout' | 'policy';
|
|
143
|
-
route: {
|
|
144
|
-
sourceKind: 'direct' | 'inbound_trunk' | 'queue' | 'ivr' | 'voicemail';
|
|
145
|
-
teamId: string;
|
|
146
|
-
queueId: string;
|
|
147
|
-
ivrPath: Array<string>;
|
|
148
|
-
};
|
|
149
|
-
participants: Array<{
|
|
150
|
-
id: string;
|
|
151
|
-
ref: {
|
|
152
|
-
kind: 'agent';
|
|
153
|
-
agentId: string;
|
|
154
|
-
} | {
|
|
155
|
-
kind: 'customer';
|
|
156
|
-
userId: number;
|
|
157
|
-
} | {
|
|
158
|
-
kind: 'contact';
|
|
159
|
-
contactId: string;
|
|
160
|
-
} | {
|
|
161
|
-
kind: 'phone';
|
|
162
|
-
phoneNumber: string;
|
|
163
|
-
};
|
|
164
|
-
info: {
|
|
165
|
-
kind: 'agent';
|
|
166
|
-
agentId: string;
|
|
167
|
-
userId: number;
|
|
168
|
-
firstName: string;
|
|
169
|
-
lastName: string;
|
|
170
|
-
avatarUrl: string;
|
|
171
|
-
phoneNumber: string;
|
|
172
|
-
} | {
|
|
173
|
-
kind: 'customer';
|
|
174
|
-
userId: number;
|
|
175
|
-
firstName: string;
|
|
176
|
-
lastName: string;
|
|
177
|
-
avatarUrl: string;
|
|
178
|
-
phoneNumber: string;
|
|
179
|
-
} | {
|
|
180
|
-
kind: 'contact';
|
|
181
|
-
contactId: string;
|
|
182
|
-
firstName: string;
|
|
183
|
-
lastName: string;
|
|
184
|
-
avatarUrl: string;
|
|
185
|
-
phoneNumber: string;
|
|
186
|
-
} | {
|
|
187
|
-
kind: 'phone';
|
|
188
|
-
phoneNumber: string;
|
|
189
|
-
firstName: string;
|
|
190
|
-
lastName: string;
|
|
191
|
-
avatarUrl: string;
|
|
192
|
-
};
|
|
193
|
-
role: 'host' | 'participant';
|
|
194
|
-
capabilities: Array<'update_session' | 'invite_participant' | 'remove_participant' | 'hold_session' | 'end_session' | 'start_recording' | 'stop_recording'>;
|
|
195
|
-
transport: 'webrtc' | 'sip';
|
|
196
|
-
state: 'invited' | 'accepted' | 'joined' | 'left' | 'declined' | 'removed' | 'withdrawn' | 'failed';
|
|
197
|
-
participantIdentity: string;
|
|
198
|
-
participantSid: string;
|
|
199
|
-
lastSignalAt: string;
|
|
200
|
-
invitedAt: string;
|
|
201
|
-
acceptedAt: string;
|
|
202
|
-
joinedAt: string;
|
|
203
|
-
endedAt: string;
|
|
204
|
-
leftReason: 'left' | 'session_ended' | 'policy';
|
|
205
|
-
failureReason: 'connection_aborted' | 'timeout' | 'busy' | 'unreachable' | 'provider_error' | 'unknown';
|
|
206
|
-
operations: Array<{
|
|
207
|
-
id: string;
|
|
208
|
-
kind: 'app_invite';
|
|
209
|
-
state: 'pending' | 'accepted' | 'rejected' | 'expired' | 'withdrawn';
|
|
210
|
-
createdAt: string;
|
|
211
|
-
completedAt: string;
|
|
212
|
-
expiresAt: string;
|
|
213
|
-
dispatchId: string;
|
|
214
|
-
recipient: {
|
|
215
|
-
kind: 'agent';
|
|
216
|
-
vendorId: number;
|
|
217
|
-
agentId: string;
|
|
218
|
-
userId: number;
|
|
219
|
-
} | {
|
|
220
|
-
kind: 'user';
|
|
221
|
-
vendorId: number;
|
|
222
|
-
userId: number;
|
|
223
|
-
};
|
|
224
|
-
inviterParticipantId: string;
|
|
225
|
-
} | {
|
|
226
|
-
id: string;
|
|
227
|
-
kind: 'sip_leg';
|
|
228
|
-
state: 'dialing' | 'ringing' | 'active' | 'ended' | 'failed';
|
|
229
|
-
direction: 'inbound' | 'outbound';
|
|
230
|
-
createdAt: string;
|
|
231
|
-
ringingAt: string;
|
|
232
|
-
activeAt: string;
|
|
233
|
-
endedAt: string;
|
|
234
|
-
localPhoneNumber: string;
|
|
235
|
-
remotePhoneNumber: string;
|
|
236
|
-
provider: {
|
|
237
|
-
livekitSipCallId: string;
|
|
238
|
-
providerSipCallId: string;
|
|
239
|
-
livekitSipTrunkId: string;
|
|
240
|
-
livekitDispatchRuleId: string;
|
|
241
|
-
vendorPhoneNumberId: string;
|
|
242
|
-
sipExtension: string;
|
|
243
|
-
};
|
|
244
|
-
failureReason: 'cancelled' | 'timeout' | 'busy' | 'rejected' | 'unreachable' | 'provider_error' | 'unknown';
|
|
245
|
-
sipStatusCode: number;
|
|
246
|
-
providerError: string;
|
|
247
|
-
}>;
|
|
248
|
-
}>;
|
|
249
|
-
dispatches: Array<{
|
|
250
|
-
id: string;
|
|
251
|
-
kind: 'ring_group';
|
|
252
|
-
source: {
|
|
253
|
-
kind: 'team';
|
|
254
|
-
teamId: string;
|
|
255
|
-
} | {
|
|
256
|
-
kind: 'queue';
|
|
257
|
-
queueId: string;
|
|
258
|
-
} | {
|
|
259
|
-
kind: 'manual';
|
|
260
|
-
};
|
|
261
|
-
strategy: 'parallel' | 'sequential';
|
|
262
|
-
state: 'active' | 'resolved' | 'expired' | 'cancelled';
|
|
263
|
-
candidateParticipantIds: Array<string>;
|
|
264
|
-
winnerParticipantId: string;
|
|
265
|
-
startedAt: string;
|
|
266
|
-
resolvedAt: string;
|
|
267
|
-
timeoutAt: string;
|
|
268
|
-
}>;
|
|
269
|
-
recordings: Array<{
|
|
270
|
-
id: string;
|
|
271
|
-
target: {
|
|
272
|
-
kind: 'session';
|
|
273
|
-
} | {
|
|
274
|
-
kind: 'participant';
|
|
275
|
-
participantId: string;
|
|
276
|
-
};
|
|
277
|
-
policy: 'manual' | 'automatic' | 'compliance';
|
|
278
|
-
state: 'requested' | 'active' | 'stopped' | 'failed';
|
|
279
|
-
livekitEgressId: string;
|
|
280
|
-
requestedAt: string;
|
|
281
|
-
startedAt: string;
|
|
282
|
-
stoppedAt: string;
|
|
283
|
-
failureReason: string;
|
|
284
|
-
}>;
|
|
285
|
-
}>;
|
|
286
|
-
nextCursor: string;
|
|
287
|
-
};
|
|
288
|
-
};
|
|
289
|
-
type PostApiV1SessionsData = {
|
|
290
|
-
body?: {
|
|
291
|
-
target: {
|
|
292
|
-
type: 'agent';
|
|
293
|
-
agentId: string;
|
|
294
|
-
} | {
|
|
295
|
-
type: 'user';
|
|
296
|
-
userId: number;
|
|
297
|
-
} | {
|
|
298
|
-
type: 'contact';
|
|
299
|
-
contactId: string;
|
|
300
|
-
} | {
|
|
301
|
-
type: 'phone';
|
|
302
|
-
phone: string;
|
|
303
|
-
};
|
|
304
|
-
mediaType?: 'audio' | 'video';
|
|
305
|
-
name?: string;
|
|
306
|
-
};
|
|
307
|
-
path?: never;
|
|
308
|
-
query: {
|
|
309
|
-
vendor: string;
|
|
310
|
-
};
|
|
311
|
-
url: '/api/v1/sessions';
|
|
312
|
-
};
|
|
313
|
-
type PostApiV1SessionsResponses = {
|
|
314
|
-
/**
|
|
315
|
-
* created session
|
|
316
|
-
*/
|
|
317
|
-
201: {
|
|
318
|
-
id: string;
|
|
319
|
-
callId: string;
|
|
320
|
-
vendorId: number;
|
|
321
|
-
version: number;
|
|
322
|
-
name: string;
|
|
323
|
-
direction: 'inbound' | 'outbound';
|
|
324
|
-
channel: 'webrtc' | 'sip' | 'mixed';
|
|
325
|
-
mediaType: 'audio' | 'video';
|
|
326
|
-
state: 'ringing' | 'active' | 'on_hold' | 'ended';
|
|
327
|
-
room: {
|
|
328
|
-
name: string;
|
|
329
|
-
sid: string;
|
|
330
|
-
};
|
|
331
|
-
hostAgentId: string;
|
|
332
|
-
createdAt: string;
|
|
333
|
-
activatedAt: string;
|
|
334
|
-
endedAt: string;
|
|
335
|
-
endReason: 'completed' | 'declined' | 'cancelled' | 'failed' | 'transferred' | 'voicemail' | 'timeout' | 'policy';
|
|
336
|
-
route: {
|
|
337
|
-
sourceKind: 'direct' | 'inbound_trunk' | 'queue' | 'ivr' | 'voicemail';
|
|
338
|
-
teamId: string;
|
|
339
|
-
queueId: string;
|
|
340
|
-
ivrPath: Array<string>;
|
|
341
|
-
};
|
|
342
|
-
participants: Array<{
|
|
343
|
-
id: string;
|
|
344
|
-
ref: {
|
|
345
|
-
kind: 'agent';
|
|
346
|
-
agentId: string;
|
|
347
|
-
} | {
|
|
348
|
-
kind: 'customer';
|
|
349
|
-
userId: number;
|
|
350
|
-
} | {
|
|
351
|
-
kind: 'contact';
|
|
352
|
-
contactId: string;
|
|
353
|
-
} | {
|
|
354
|
-
kind: 'phone';
|
|
355
|
-
phoneNumber: string;
|
|
356
|
-
};
|
|
357
|
-
info: {
|
|
358
|
-
kind: 'agent';
|
|
359
|
-
agentId: string;
|
|
360
|
-
userId: number;
|
|
361
|
-
firstName: string;
|
|
362
|
-
lastName: string;
|
|
363
|
-
avatarUrl: string;
|
|
364
|
-
phoneNumber: string;
|
|
365
|
-
} | {
|
|
366
|
-
kind: 'customer';
|
|
367
|
-
userId: number;
|
|
368
|
-
firstName: string;
|
|
369
|
-
lastName: string;
|
|
370
|
-
avatarUrl: string;
|
|
371
|
-
phoneNumber: string;
|
|
372
|
-
} | {
|
|
373
|
-
kind: 'contact';
|
|
374
|
-
contactId: string;
|
|
375
|
-
firstName: string;
|
|
376
|
-
lastName: string;
|
|
377
|
-
avatarUrl: string;
|
|
378
|
-
phoneNumber: string;
|
|
379
|
-
} | {
|
|
380
|
-
kind: 'phone';
|
|
381
|
-
phoneNumber: string;
|
|
382
|
-
firstName: string;
|
|
383
|
-
lastName: string;
|
|
384
|
-
avatarUrl: string;
|
|
385
|
-
};
|
|
386
|
-
role: 'host' | 'participant';
|
|
387
|
-
capabilities: Array<'update_session' | 'invite_participant' | 'remove_participant' | 'hold_session' | 'end_session' | 'start_recording' | 'stop_recording'>;
|
|
388
|
-
transport: 'webrtc' | 'sip';
|
|
389
|
-
state: 'invited' | 'accepted' | 'joined' | 'left' | 'declined' | 'removed' | 'withdrawn' | 'failed';
|
|
390
|
-
participantIdentity: string;
|
|
391
|
-
participantSid: string;
|
|
392
|
-
lastSignalAt: string;
|
|
393
|
-
invitedAt: string;
|
|
394
|
-
acceptedAt: string;
|
|
395
|
-
joinedAt: string;
|
|
396
|
-
endedAt: string;
|
|
397
|
-
leftReason: 'left' | 'session_ended' | 'policy';
|
|
398
|
-
failureReason: 'connection_aborted' | 'timeout' | 'busy' | 'unreachable' | 'provider_error' | 'unknown';
|
|
399
|
-
operations: Array<{
|
|
400
|
-
id: string;
|
|
401
|
-
kind: 'app_invite';
|
|
402
|
-
state: 'pending' | 'accepted' | 'rejected' | 'expired' | 'withdrawn';
|
|
403
|
-
createdAt: string;
|
|
404
|
-
completedAt: string;
|
|
405
|
-
expiresAt: string;
|
|
406
|
-
dispatchId: string;
|
|
407
|
-
recipient: {
|
|
408
|
-
kind: 'agent';
|
|
409
|
-
vendorId: number;
|
|
410
|
-
agentId: string;
|
|
411
|
-
userId: number;
|
|
412
|
-
} | {
|
|
413
|
-
kind: 'user';
|
|
414
|
-
vendorId: number;
|
|
415
|
-
userId: number;
|
|
416
|
-
};
|
|
417
|
-
inviterParticipantId: string;
|
|
418
|
-
} | {
|
|
419
|
-
id: string;
|
|
420
|
-
kind: 'sip_leg';
|
|
421
|
-
state: 'dialing' | 'ringing' | 'active' | 'ended' | 'failed';
|
|
422
|
-
direction: 'inbound' | 'outbound';
|
|
423
|
-
createdAt: string;
|
|
424
|
-
ringingAt: string;
|
|
425
|
-
activeAt: string;
|
|
426
|
-
endedAt: string;
|
|
427
|
-
localPhoneNumber: string;
|
|
428
|
-
remotePhoneNumber: string;
|
|
429
|
-
provider: {
|
|
430
|
-
livekitSipCallId: string;
|
|
431
|
-
providerSipCallId: string;
|
|
432
|
-
livekitSipTrunkId: string;
|
|
433
|
-
livekitDispatchRuleId: string;
|
|
434
|
-
vendorPhoneNumberId: string;
|
|
435
|
-
sipExtension: string;
|
|
436
|
-
};
|
|
437
|
-
failureReason: 'cancelled' | 'timeout' | 'busy' | 'rejected' | 'unreachable' | 'provider_error' | 'unknown';
|
|
438
|
-
sipStatusCode: number;
|
|
439
|
-
providerError: string;
|
|
440
|
-
}>;
|
|
441
|
-
}>;
|
|
442
|
-
dispatches: Array<{
|
|
443
|
-
id: string;
|
|
444
|
-
kind: 'ring_group';
|
|
445
|
-
source: {
|
|
446
|
-
kind: 'team';
|
|
447
|
-
teamId: string;
|
|
448
|
-
} | {
|
|
449
|
-
kind: 'queue';
|
|
450
|
-
queueId: string;
|
|
451
|
-
} | {
|
|
452
|
-
kind: 'manual';
|
|
453
|
-
};
|
|
454
|
-
strategy: 'parallel' | 'sequential';
|
|
455
|
-
state: 'active' | 'resolved' | 'expired' | 'cancelled';
|
|
456
|
-
candidateParticipantIds: Array<string>;
|
|
457
|
-
winnerParticipantId: string;
|
|
458
|
-
startedAt: string;
|
|
459
|
-
resolvedAt: string;
|
|
460
|
-
timeoutAt: string;
|
|
461
|
-
}>;
|
|
462
|
-
recordings: Array<{
|
|
463
|
-
id: string;
|
|
464
|
-
target: {
|
|
465
|
-
kind: 'session';
|
|
466
|
-
} | {
|
|
467
|
-
kind: 'participant';
|
|
468
|
-
participantId: string;
|
|
469
|
-
};
|
|
470
|
-
policy: 'manual' | 'automatic' | 'compliance';
|
|
471
|
-
state: 'requested' | 'active' | 'stopped' | 'failed';
|
|
472
|
-
livekitEgressId: string;
|
|
473
|
-
requestedAt: string;
|
|
474
|
-
startedAt: string;
|
|
475
|
-
stoppedAt: string;
|
|
476
|
-
failureReason: string;
|
|
477
|
-
}>;
|
|
478
|
-
};
|
|
479
|
-
};
|
|
480
|
-
type GetApiV1SessionsInvitesResponses = {
|
|
481
|
-
/**
|
|
482
|
-
* pending invites
|
|
483
|
-
*/
|
|
484
|
-
200: Array<{
|
|
485
|
-
id: string;
|
|
486
|
-
sessionId: string;
|
|
487
|
-
callId: string;
|
|
488
|
-
state: 'pending' | 'accepted' | 'rejected' | 'expired' | 'withdrawn';
|
|
489
|
-
createdAt: string;
|
|
490
|
-
expiresAt: string;
|
|
491
|
-
completedAt: string;
|
|
492
|
-
dispatchId: string;
|
|
493
|
-
recipient: {
|
|
494
|
-
kind: 'agent';
|
|
495
|
-
vendorId: number;
|
|
496
|
-
agentId: string;
|
|
497
|
-
userId: number;
|
|
498
|
-
} | {
|
|
499
|
-
kind: 'user';
|
|
500
|
-
vendorId: number;
|
|
501
|
-
userId: number;
|
|
502
|
-
};
|
|
503
|
-
participantId: string;
|
|
504
|
-
inviterParticipantId: string;
|
|
505
|
-
session: {
|
|
506
|
-
id: string;
|
|
507
|
-
callId: string;
|
|
508
|
-
vendorId: number;
|
|
509
|
-
version: number;
|
|
510
|
-
name: string;
|
|
511
|
-
direction: 'inbound' | 'outbound';
|
|
512
|
-
channel: 'webrtc' | 'sip' | 'mixed';
|
|
513
|
-
mediaType: 'audio' | 'video';
|
|
514
|
-
state: 'ringing' | 'active' | 'on_hold' | 'ended';
|
|
515
|
-
room: {
|
|
516
|
-
name: string;
|
|
517
|
-
sid: string;
|
|
518
|
-
};
|
|
519
|
-
hostAgentId: string;
|
|
520
|
-
createdAt: string;
|
|
521
|
-
activatedAt: string;
|
|
522
|
-
endedAt: string;
|
|
523
|
-
endReason: 'completed' | 'declined' | 'cancelled' | 'failed' | 'transferred' | 'voicemail' | 'timeout' | 'policy';
|
|
524
|
-
route: {
|
|
525
|
-
sourceKind: 'direct' | 'inbound_trunk' | 'queue' | 'ivr' | 'voicemail';
|
|
526
|
-
teamId: string;
|
|
527
|
-
queueId: string;
|
|
528
|
-
ivrPath: Array<string>;
|
|
529
|
-
};
|
|
530
|
-
participants: Array<{
|
|
531
|
-
id: string;
|
|
532
|
-
ref: {
|
|
533
|
-
kind: 'agent';
|
|
534
|
-
agentId: string;
|
|
535
|
-
} | {
|
|
536
|
-
kind: 'customer';
|
|
537
|
-
userId: number;
|
|
538
|
-
} | {
|
|
539
|
-
kind: 'contact';
|
|
540
|
-
contactId: string;
|
|
541
|
-
} | {
|
|
542
|
-
kind: 'phone';
|
|
543
|
-
phoneNumber: string;
|
|
544
|
-
};
|
|
545
|
-
info: {
|
|
546
|
-
kind: 'agent';
|
|
547
|
-
agentId: string;
|
|
548
|
-
userId: number;
|
|
549
|
-
firstName: string;
|
|
550
|
-
lastName: string;
|
|
551
|
-
avatarUrl: string;
|
|
552
|
-
phoneNumber: string;
|
|
553
|
-
} | {
|
|
554
|
-
kind: 'customer';
|
|
555
|
-
userId: number;
|
|
556
|
-
firstName: string;
|
|
557
|
-
lastName: string;
|
|
558
|
-
avatarUrl: string;
|
|
559
|
-
phoneNumber: string;
|
|
560
|
-
} | {
|
|
561
|
-
kind: 'contact';
|
|
562
|
-
contactId: string;
|
|
563
|
-
firstName: string;
|
|
564
|
-
lastName: string;
|
|
565
|
-
avatarUrl: string;
|
|
566
|
-
phoneNumber: string;
|
|
567
|
-
} | {
|
|
568
|
-
kind: 'phone';
|
|
569
|
-
phoneNumber: string;
|
|
570
|
-
firstName: string;
|
|
571
|
-
lastName: string;
|
|
572
|
-
avatarUrl: string;
|
|
573
|
-
};
|
|
574
|
-
role: 'host' | 'participant';
|
|
575
|
-
capabilities: Array<'update_session' | 'invite_participant' | 'remove_participant' | 'hold_session' | 'end_session' | 'start_recording' | 'stop_recording'>;
|
|
576
|
-
transport: 'webrtc' | 'sip';
|
|
577
|
-
state: 'invited' | 'accepted' | 'joined' | 'left' | 'declined' | 'removed' | 'withdrawn' | 'failed';
|
|
578
|
-
participantIdentity: string;
|
|
579
|
-
participantSid: string;
|
|
580
|
-
lastSignalAt: string;
|
|
581
|
-
invitedAt: string;
|
|
582
|
-
acceptedAt: string;
|
|
583
|
-
joinedAt: string;
|
|
584
|
-
endedAt: string;
|
|
585
|
-
leftReason: 'left' | 'session_ended' | 'policy';
|
|
586
|
-
failureReason: 'connection_aborted' | 'timeout' | 'busy' | 'unreachable' | 'provider_error' | 'unknown';
|
|
587
|
-
operations: Array<{
|
|
588
|
-
id: string;
|
|
589
|
-
kind: 'app_invite';
|
|
590
|
-
state: 'pending' | 'accepted' | 'rejected' | 'expired' | 'withdrawn';
|
|
591
|
-
createdAt: string;
|
|
592
|
-
completedAt: string;
|
|
593
|
-
expiresAt: string;
|
|
594
|
-
dispatchId: string;
|
|
595
|
-
recipient: {
|
|
596
|
-
kind: 'agent';
|
|
597
|
-
vendorId: number;
|
|
598
|
-
agentId: string;
|
|
599
|
-
userId: number;
|
|
600
|
-
} | {
|
|
601
|
-
kind: 'user';
|
|
602
|
-
vendorId: number;
|
|
603
|
-
userId: number;
|
|
604
|
-
};
|
|
605
|
-
inviterParticipantId: string;
|
|
606
|
-
} | {
|
|
607
|
-
id: string;
|
|
608
|
-
kind: 'sip_leg';
|
|
609
|
-
state: 'dialing' | 'ringing' | 'active' | 'ended' | 'failed';
|
|
610
|
-
direction: 'inbound' | 'outbound';
|
|
611
|
-
createdAt: string;
|
|
612
|
-
ringingAt: string;
|
|
613
|
-
activeAt: string;
|
|
614
|
-
endedAt: string;
|
|
615
|
-
localPhoneNumber: string;
|
|
616
|
-
remotePhoneNumber: string;
|
|
617
|
-
provider: {
|
|
618
|
-
livekitSipCallId: string;
|
|
619
|
-
providerSipCallId: string;
|
|
620
|
-
livekitSipTrunkId: string;
|
|
621
|
-
livekitDispatchRuleId: string;
|
|
622
|
-
vendorPhoneNumberId: string;
|
|
623
|
-
sipExtension: string;
|
|
624
|
-
};
|
|
625
|
-
failureReason: 'cancelled' | 'timeout' | 'busy' | 'rejected' | 'unreachable' | 'provider_error' | 'unknown';
|
|
626
|
-
sipStatusCode: number;
|
|
627
|
-
providerError: string;
|
|
628
|
-
}>;
|
|
629
|
-
}>;
|
|
630
|
-
dispatches: Array<{
|
|
631
|
-
id: string;
|
|
632
|
-
kind: 'ring_group';
|
|
633
|
-
source: {
|
|
634
|
-
kind: 'team';
|
|
635
|
-
teamId: string;
|
|
636
|
-
} | {
|
|
637
|
-
kind: 'queue';
|
|
638
|
-
queueId: string;
|
|
639
|
-
} | {
|
|
640
|
-
kind: 'manual';
|
|
641
|
-
};
|
|
642
|
-
strategy: 'parallel' | 'sequential';
|
|
643
|
-
state: 'active' | 'resolved' | 'expired' | 'cancelled';
|
|
644
|
-
candidateParticipantIds: Array<string>;
|
|
645
|
-
winnerParticipantId: string;
|
|
646
|
-
startedAt: string;
|
|
647
|
-
resolvedAt: string;
|
|
648
|
-
timeoutAt: string;
|
|
649
|
-
}>;
|
|
650
|
-
recordings: Array<{
|
|
651
|
-
id: string;
|
|
652
|
-
target: {
|
|
653
|
-
kind: 'session';
|
|
654
|
-
} | {
|
|
655
|
-
kind: 'participant';
|
|
656
|
-
participantId: string;
|
|
657
|
-
};
|
|
658
|
-
policy: 'manual' | 'automatic' | 'compliance';
|
|
659
|
-
state: 'requested' | 'active' | 'stopped' | 'failed';
|
|
660
|
-
livekitEgressId: string;
|
|
661
|
-
requestedAt: string;
|
|
662
|
-
startedAt: string;
|
|
663
|
-
stoppedAt: string;
|
|
664
|
-
failureReason: string;
|
|
665
|
-
}>;
|
|
666
|
-
};
|
|
667
|
-
}>;
|
|
668
|
-
};
|
|
669
|
-
type PatchApiV1SessionsBySessionIdData = {
|
|
670
|
-
body?: {
|
|
671
|
-
name: string;
|
|
672
|
-
};
|
|
673
|
-
path: {
|
|
674
|
-
sessionId: string;
|
|
675
|
-
};
|
|
676
|
-
query?: {
|
|
677
|
-
vendor?: string;
|
|
678
|
-
};
|
|
679
|
-
url: '/api/v1/sessions/{sessionId}';
|
|
680
|
-
};
|
|
681
|
-
type PostApiV1SessionsBySessionIdJoinResponses = {
|
|
682
|
-
/**
|
|
683
|
-
* join grant
|
|
684
|
-
*/
|
|
685
|
-
200: {
|
|
686
|
-
url: string;
|
|
687
|
-
roomName: string;
|
|
688
|
-
token: string;
|
|
689
|
-
participantIdentity: string;
|
|
690
|
-
participantId: string;
|
|
691
|
-
};
|
|
692
|
-
};
|
|
693
|
-
type PostApiV1SessionsBySessionIdParticipantsData = {
|
|
694
|
-
body?: {
|
|
695
|
-
target: {
|
|
696
|
-
type: 'agent';
|
|
697
|
-
agentId: string;
|
|
698
|
-
} | {
|
|
699
|
-
type: 'user';
|
|
700
|
-
userId: number;
|
|
701
|
-
} | {
|
|
702
|
-
type: 'contact';
|
|
703
|
-
contactId: string;
|
|
704
|
-
} | {
|
|
705
|
-
type: 'phone';
|
|
706
|
-
phone: string;
|
|
707
|
-
};
|
|
708
|
-
};
|
|
709
|
-
path: {
|
|
710
|
-
sessionId: string;
|
|
711
|
-
};
|
|
712
|
-
query?: {
|
|
713
|
-
vendor?: string;
|
|
714
|
-
};
|
|
715
|
-
url: '/api/v1/sessions/{sessionId}/participants';
|
|
716
|
-
};
|
|
717
|
-
type PostApiV1SessionsBySessionIdRecordingsResponses = {
|
|
718
|
-
/**
|
|
719
|
-
* requested recording
|
|
720
|
-
*/
|
|
721
|
-
202: {
|
|
722
|
-
id: string;
|
|
723
|
-
target: {
|
|
724
|
-
kind: 'session';
|
|
725
|
-
} | {
|
|
726
|
-
kind: 'participant';
|
|
727
|
-
participantId: string;
|
|
728
|
-
};
|
|
729
|
-
policy: 'manual' | 'automatic' | 'compliance';
|
|
730
|
-
state: 'requested' | 'active' | 'stopped' | 'failed';
|
|
731
|
-
livekitEgressId: string;
|
|
732
|
-
requestedAt: string;
|
|
733
|
-
startedAt: string;
|
|
734
|
-
stoppedAt: string;
|
|
735
|
-
failureReason: string;
|
|
736
|
-
};
|
|
737
|
-
};
|
|
738
|
-
|
|
739
|
-
type SessionView = PostApiV1SessionsResponses[201];
|
|
740
|
-
type SessionPage = GetApiV1SessionsResponses[200];
|
|
741
|
-
type SessionJoinGrant = PostApiV1SessionsBySessionIdJoinResponses[200];
|
|
742
|
-
type SessionInviteView = GetApiV1SessionsInvitesResponses[200][number];
|
|
743
|
-
type RecordingView = PostApiV1SessionsBySessionIdRecordingsResponses[202];
|
|
744
|
-
type PulseConnectGrant = GetApiV1PulseGrantsResponses[200];
|
|
745
|
-
type PresenceResponse = GetApiV1VendorsBySlugPresenceResponses[200];
|
|
746
|
-
type PresenceItem = PresenceResponse["items"][number];
|
|
747
|
-
type SessionParticipantView = SessionView["participants"][number];
|
|
748
|
-
type SessionParticipantOperationView = SessionParticipantView["operations"][number];
|
|
749
|
-
type SessionAppInviteView = Extract<SessionParticipantOperationView, {
|
|
750
|
-
kind: "app_invite";
|
|
751
|
-
}>;
|
|
752
|
-
type SessionSipLegView = Extract<SessionParticipantOperationView, {
|
|
753
|
-
kind: "sip_leg";
|
|
754
|
-
}>;
|
|
755
|
-
type SessionDispatchView = SessionView["dispatches"][number];
|
|
756
|
-
type SessionRecordingView = SessionView["recordings"][number];
|
|
757
|
-
type SessionState = SessionView["state"];
|
|
758
|
-
type SessionChannel = SessionView["channel"];
|
|
759
|
-
type SessionMediaType = SessionView["mediaType"];
|
|
760
|
-
type SessionDirection = SessionView["direction"];
|
|
761
|
-
type SessionEndReason = SessionView["endReason"];
|
|
762
|
-
type SessionParticipantRole = SessionParticipantView["role"];
|
|
763
|
-
type SessionParticipantTransport = SessionParticipantView["transport"];
|
|
764
|
-
type SessionParticipantState = SessionParticipantView["state"];
|
|
765
|
-
type SessionParticipantCapability = SessionParticipantView["capabilities"][number];
|
|
766
|
-
type SessionParticipantLeftReason = SessionParticipantView["leftReason"];
|
|
767
|
-
type SessionParticipantFailureReason = SessionParticipantView["failureReason"];
|
|
768
|
-
type SessionInviteOperationState = SessionAppInviteView["state"];
|
|
769
|
-
type SessionSipLegState = SessionSipLegView["state"];
|
|
770
|
-
type SessionSipLegDirection = SessionSipLegView["direction"];
|
|
771
|
-
type SessionSipLegFailureReason = SessionSipLegView["failureReason"];
|
|
772
|
-
type SessionDispatchState = SessionDispatchView["state"];
|
|
773
|
-
type SessionDispatchStrategy = SessionDispatchView["strategy"];
|
|
774
|
-
type SessionDispatchSource = SessionDispatchView["source"];
|
|
775
|
-
type SessionRecordingState = SessionRecordingView["state"];
|
|
776
|
-
type SessionRecordingPolicy = SessionRecordingView["policy"];
|
|
777
|
-
type SessionRecordingTarget = SessionRecordingView["target"];
|
|
778
|
-
type SessionPartyRef = SessionParticipantView["ref"];
|
|
779
|
-
type SessionPartyInfo = SessionParticipantView["info"];
|
|
780
|
-
type SessionAccessRef = SessionAppInviteView["recipient"];
|
|
781
|
-
type SessionRouteContext = SessionView["route"];
|
|
782
|
-
type InviteState = SessionInviteView["state"];
|
|
783
|
-
type CreateSessionBody = NonNullable<PostApiV1SessionsData["body"]>;
|
|
784
|
-
type CreateSessionTarget = CreateSessionBody["target"];
|
|
785
|
-
type CreateSessionTargetType = CreateSessionTarget["type"];
|
|
786
|
-
type InviteParticipantBody = NonNullable<PostApiV1SessionsBySessionIdParticipantsData["body"]>;
|
|
787
|
-
type UpdateSessionBody = NonNullable<PatchApiV1SessionsBySessionIdData["body"]>;
|
|
788
|
-
type SetPresenceStatusBody = NonNullable<PutApiV1VendorsBySlugPresenceStatusData["body"]>;
|
|
789
|
-
type PresenceAvailability = PresenceItem["availability"];
|
|
790
|
-
type PresenceConnectivity = PresenceItem["connectivity"];
|
|
791
|
-
type PresenceMode = NonNullable<SetPresenceStatusBody["status"]>;
|
|
792
|
-
|
|
793
|
-
interface Dispatch {
|
|
794
|
-
readonly id: string;
|
|
795
|
-
readonly source: SessionDispatchSource;
|
|
796
|
-
readonly strategy: SessionDispatchStrategy;
|
|
797
|
-
readonly state: SessionDispatchState;
|
|
798
|
-
readonly candidateParticipantIds: readonly string[];
|
|
799
|
-
readonly winnerParticipantId: Nullable<string>;
|
|
800
|
-
readonly startedAt: string;
|
|
801
|
-
readonly resolvedAt: Nullable<string>;
|
|
802
|
-
readonly timeoutAt: Nullable<string>;
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
type PulseStatus = "idle" | "connecting" | "connected" | "recovering" | "disconnected";
|
|
806
|
-
interface PulseEventMap {
|
|
807
|
-
"session.upsert": SessionView;
|
|
808
|
-
"session.remove": {
|
|
809
|
-
sessionId: string;
|
|
810
|
-
version: number;
|
|
811
|
-
};
|
|
812
|
-
"session.invite.upsert": SessionInviteView;
|
|
813
|
-
"session.invite.remove": {
|
|
814
|
-
inviteId: string;
|
|
815
|
-
sessionId: string;
|
|
816
|
-
participantId: string;
|
|
817
|
-
state: Exclude<InviteState, "pending">;
|
|
818
|
-
};
|
|
819
|
-
"status.changed": {
|
|
820
|
-
status: PulseStatus;
|
|
821
|
-
previous: PulseStatus;
|
|
822
|
-
};
|
|
823
|
-
error: {
|
|
824
|
-
error: CallpadError;
|
|
825
|
-
};
|
|
826
|
-
}
|
|
827
|
-
type GrantFetcher = () => Promise<Result<PulseConnectGrant>>;
|
|
828
|
-
interface PulseTransportOptions {
|
|
829
|
-
grantFetcher: GrantFetcher;
|
|
830
|
-
logger: Logger;
|
|
831
|
-
rotateLeadMs?: number;
|
|
832
|
-
}
|
|
833
|
-
declare class PulseTransport {
|
|
834
|
-
private socket;
|
|
835
|
-
private grant;
|
|
836
|
-
private rotateTimer;
|
|
837
|
-
private status;
|
|
838
|
-
private disposed;
|
|
839
|
-
private readonly bus;
|
|
840
|
-
private readonly rotateLeadMs;
|
|
841
|
-
private readonly logger;
|
|
842
|
-
private readonly grantFetcher;
|
|
843
|
-
constructor(opts: PulseTransportOptions);
|
|
844
|
-
getStatus(): PulseStatus;
|
|
845
|
-
on<K extends keyof PulseEventMap>(type: K, handler: (payload: PulseEventMap[K]) => void): Unsubscribe;
|
|
846
|
-
connect(): Promise<Result<void>>;
|
|
847
|
-
disconnect(): Promise<void>;
|
|
848
|
-
dispose(): Promise<void>;
|
|
849
|
-
private setStatus;
|
|
850
|
-
private openSocket;
|
|
851
|
-
private closeSocket;
|
|
852
|
-
private scheduleRotate;
|
|
853
|
-
private scheduleRotateRetry;
|
|
854
|
-
private clearRotate;
|
|
855
|
-
private rotateGrant;
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
type MediaConnectionState = "unconnected" | "connecting" | "connected" | "reconnecting" | "disconnected";
|
|
859
|
-
interface MediaParticipantState {
|
|
860
|
-
identity: string;
|
|
861
|
-
isSpeaking: boolean;
|
|
862
|
-
audioLevel: number;
|
|
863
|
-
micPublished: boolean;
|
|
864
|
-
micMuted: boolean;
|
|
865
|
-
cameraPublished: boolean;
|
|
866
|
-
cameraMuted: boolean;
|
|
867
|
-
screenShareActive: boolean;
|
|
868
|
-
connectionQuality: "excellent" | "good" | "poor" | "lost" | "unknown";
|
|
869
|
-
}
|
|
870
|
-
interface MediaEventMap {
|
|
871
|
-
"state.changed": {
|
|
872
|
-
state: MediaConnectionState;
|
|
873
|
-
previous: MediaConnectionState;
|
|
874
|
-
};
|
|
875
|
-
"participant.changed": {
|
|
876
|
-
identity: string;
|
|
877
|
-
snapshot: MediaParticipantState;
|
|
878
|
-
};
|
|
879
|
-
"active_speakers.changed": {
|
|
880
|
-
identities: readonly string[];
|
|
881
|
-
};
|
|
882
|
-
error: {
|
|
883
|
-
error: CallpadError;
|
|
884
|
-
};
|
|
885
|
-
}
|
|
886
|
-
interface MediaRoomConnectOptions {
|
|
887
|
-
url: string;
|
|
888
|
-
token: string;
|
|
889
|
-
video?: boolean;
|
|
890
|
-
}
|
|
891
|
-
declare class MediaRoomAdapter {
|
|
892
|
-
private readonly room;
|
|
893
|
-
private readonly bus;
|
|
894
|
-
private readonly logger;
|
|
895
|
-
private readonly snapshots;
|
|
896
|
-
private state;
|
|
897
|
-
private disposed;
|
|
898
|
-
constructor(logger: Logger);
|
|
899
|
-
getRoom(): Room;
|
|
900
|
-
getState(): MediaConnectionState;
|
|
901
|
-
getSnapshot(identity: string): MediaParticipantState | undefined;
|
|
902
|
-
listSnapshots(): ReadonlyMap<string, MediaParticipantState>;
|
|
903
|
-
on<K extends keyof MediaEventMap>(type: K, handler: (payload: MediaEventMap[K]) => void): Unsubscribe;
|
|
904
|
-
connect(opts: MediaRoomConnectOptions): Promise<Result<void>>;
|
|
905
|
-
disconnect(): Promise<void>;
|
|
906
|
-
dispose(): Promise<void>;
|
|
907
|
-
private setState;
|
|
908
|
-
private wireRoomEvents;
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
interface ParticipantMediaState {
|
|
912
|
-
readonly micPublished: boolean;
|
|
913
|
-
readonly micMuted: boolean;
|
|
914
|
-
readonly cameraPublished: boolean;
|
|
915
|
-
readonly cameraMuted: boolean;
|
|
916
|
-
readonly screenShareActive: boolean;
|
|
917
|
-
}
|
|
918
|
-
type ConnectionQualityLabel = "excellent" | "good" | "poor" | "lost" | "unknown";
|
|
919
|
-
interface Participant {
|
|
920
|
-
readonly id: string;
|
|
921
|
-
readonly ref: SessionPartyRef;
|
|
922
|
-
readonly info: SessionPartyInfo;
|
|
923
|
-
readonly role: SessionParticipantRole;
|
|
924
|
-
readonly capabilities: readonly SessionParticipantCapability[];
|
|
925
|
-
readonly transport: SessionParticipantTransport;
|
|
926
|
-
readonly state: SessionParticipantState;
|
|
927
|
-
readonly participantIdentity: string;
|
|
928
|
-
readonly participantSid: Nullable<string>;
|
|
929
|
-
readonly invitedAt: string;
|
|
930
|
-
readonly acceptedAt: Nullable<string>;
|
|
931
|
-
readonly joinedAt: Nullable<string>;
|
|
932
|
-
readonly endedAt: Nullable<string>;
|
|
933
|
-
readonly leftReason: Nullable<SessionParticipantLeftReason>;
|
|
934
|
-
readonly failureReason: Nullable<SessionParticipantFailureReason>;
|
|
935
|
-
readonly isSelf: boolean;
|
|
936
|
-
readonly isSpeaking: boolean;
|
|
937
|
-
readonly audioLevel: number;
|
|
938
|
-
readonly connectionQuality: ConnectionQualityLabel;
|
|
939
|
-
readonly media: ParticipantMediaState;
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
interface Recording {
|
|
943
|
-
readonly id: string;
|
|
944
|
-
readonly target: SessionRecordingTarget;
|
|
945
|
-
readonly policy: SessionRecordingPolicy;
|
|
946
|
-
readonly state: SessionRecordingState;
|
|
947
|
-
readonly livekitEgressId: Nullable<string>;
|
|
948
|
-
readonly requestedAt: string;
|
|
949
|
-
readonly startedAt: Nullable<string>;
|
|
950
|
-
readonly stoppedAt: Nullable<string>;
|
|
951
|
-
readonly failureReason: Nullable<string>;
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
interface TelephonyLeg {
|
|
955
|
-
readonly id: string;
|
|
956
|
-
readonly participantId: string;
|
|
957
|
-
readonly participantIdentity: string;
|
|
958
|
-
readonly direction: SessionSipLegDirection;
|
|
959
|
-
readonly state: SessionSipLegState;
|
|
960
|
-
readonly remotePhoneNumber: string;
|
|
961
|
-
readonly localPhoneNumber: Nullable<string>;
|
|
962
|
-
readonly livekitSipCallId: Nullable<string>;
|
|
963
|
-
readonly providerSipCallId: Nullable<string>;
|
|
964
|
-
readonly livekitSipTrunkId: Nullable<string>;
|
|
965
|
-
readonly vendorPhoneNumberId: Nullable<string>;
|
|
966
|
-
readonly sipExtension: Nullable<string>;
|
|
967
|
-
readonly createdAt: string;
|
|
968
|
-
readonly ringingAt: Nullable<string>;
|
|
969
|
-
readonly activeAt: Nullable<string>;
|
|
970
|
-
readonly endedAt: Nullable<string>;
|
|
971
|
-
readonly failureReason: Nullable<SessionSipLegFailureReason>;
|
|
972
|
-
readonly sipStatusCode: Nullable<number>;
|
|
973
|
-
readonly providerError: Nullable<string>;
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
interface SessionCommandContext {
|
|
977
|
-
readonly session: Session;
|
|
978
|
-
readonly media: MediaRoomAdapter;
|
|
979
|
-
applyView(view: SessionView): void;
|
|
980
|
-
}
|
|
981
|
-
interface SessionCommand<Args = void, Ret = void> {
|
|
982
|
-
readonly name: string;
|
|
983
|
-
execute(ctx: SessionCommandContext, args: Args): Promise<Result<Ret>>;
|
|
984
|
-
}
|
|
985
|
-
interface SessionCommandMap {
|
|
986
|
-
hold: {
|
|
987
|
-
args: void;
|
|
988
|
-
ret: void;
|
|
989
|
-
};
|
|
990
|
-
unhold: {
|
|
991
|
-
args: void;
|
|
992
|
-
ret: void;
|
|
993
|
-
};
|
|
994
|
-
cancel: {
|
|
995
|
-
args: void;
|
|
996
|
-
ret: void;
|
|
997
|
-
};
|
|
998
|
-
end: {
|
|
999
|
-
args: void;
|
|
1000
|
-
ret: void;
|
|
1001
|
-
};
|
|
1002
|
-
leave: {
|
|
1003
|
-
args: void;
|
|
1004
|
-
ret: void;
|
|
1005
|
-
};
|
|
1006
|
-
invite: {
|
|
1007
|
-
args: CreateSessionTarget;
|
|
1008
|
-
ret: void;
|
|
1009
|
-
};
|
|
1010
|
-
removeParticipant: {
|
|
1011
|
-
args: string;
|
|
1012
|
-
ret: void;
|
|
1013
|
-
};
|
|
1014
|
-
updateName: {
|
|
1015
|
-
args: string;
|
|
1016
|
-
ret: void;
|
|
1017
|
-
};
|
|
1018
|
-
startRecording: {
|
|
1019
|
-
args: void;
|
|
1020
|
-
ret: void;
|
|
1021
|
-
};
|
|
1022
|
-
stopRecording: {
|
|
1023
|
-
args: string;
|
|
1024
|
-
ret: void;
|
|
1025
|
-
};
|
|
1026
|
-
}
|
|
1027
|
-
type SessionCommandName = keyof SessionCommandMap;
|
|
1028
|
-
type SessionCommandArgs<K extends SessionCommandName> = SessionCommandMap[K]["args"];
|
|
1029
|
-
type SessionCommandRet<K extends SessionCommandName> = SessionCommandMap[K]["ret"];
|
|
1030
|
-
type SessionCommandRegistry = Map<string, SessionCommand<unknown, unknown>>;
|
|
1031
|
-
type DispatchArgs<K extends SessionCommandName> = SessionCommandArgs<K> extends void ? [] : [args: SessionCommandArgs<K>];
|
|
1032
|
-
|
|
1033
|
-
type SessionMediaStatus = MediaConnectionState;
|
|
1034
|
-
interface SessionEventMap {
|
|
1035
|
-
"view.changed": {
|
|
1036
|
-
view: SessionView;
|
|
1037
|
-
previous: Nullable<SessionView>;
|
|
1038
|
-
};
|
|
1039
|
-
"state.changed": {
|
|
1040
|
-
state: SessionState;
|
|
1041
|
-
previous: SessionState;
|
|
1042
|
-
};
|
|
1043
|
-
"participant.invited": {
|
|
1044
|
-
participant: Participant;
|
|
1045
|
-
};
|
|
1046
|
-
"participant.accepted": {
|
|
1047
|
-
participant: Participant;
|
|
1048
|
-
};
|
|
1049
|
-
"participant.joined": {
|
|
1050
|
-
participant: Participant;
|
|
1051
|
-
isFirstJoin: boolean;
|
|
1052
|
-
};
|
|
1053
|
-
"participant.left": {
|
|
1054
|
-
participant: Participant;
|
|
1055
|
-
reason: SessionParticipantLeftReason;
|
|
1056
|
-
};
|
|
1057
|
-
"participant.declined": {
|
|
1058
|
-
participant: Participant;
|
|
1059
|
-
};
|
|
1060
|
-
"participant.withdrawn": {
|
|
1061
|
-
participant: Participant;
|
|
1062
|
-
};
|
|
1063
|
-
"participant.removed": {
|
|
1064
|
-
participant: Participant;
|
|
1065
|
-
};
|
|
1066
|
-
"participant.failed": {
|
|
1067
|
-
participant: Participant;
|
|
1068
|
-
reason: SessionParticipantFailureReason;
|
|
1069
|
-
/**
|
|
1070
|
-
* If the failure came from a SIP leg on this participant, the normalised
|
|
1071
|
-
* leg reason ("busy" | "rejected" | "timeout" | "cancelled" | ...).
|
|
1072
|
-
* Null for non-SIP participant failures.
|
|
1073
|
-
*/
|
|
1074
|
-
legFailureReason: Nullable<SessionSipLegFailureReason>;
|
|
1075
|
-
/** Raw SIP status code when the upstream carrier returned one. */
|
|
1076
|
-
sipStatusCode: Nullable<number>;
|
|
1077
|
-
};
|
|
1078
|
-
"participant.updated": {
|
|
1079
|
-
participant: Participant;
|
|
1080
|
-
};
|
|
1081
|
-
"telephony_leg.updated": {
|
|
1082
|
-
leg: TelephonyLeg;
|
|
1083
|
-
};
|
|
1084
|
-
"dispatch.started": {
|
|
1085
|
-
dispatch: Dispatch;
|
|
1086
|
-
};
|
|
1087
|
-
"dispatch.resolved": {
|
|
1088
|
-
dispatch: Dispatch;
|
|
1089
|
-
};
|
|
1090
|
-
"dispatch.cancelled": {
|
|
1091
|
-
dispatch: Dispatch;
|
|
1092
|
-
};
|
|
1093
|
-
"dispatch.expired": {
|
|
1094
|
-
dispatch: Dispatch;
|
|
1095
|
-
};
|
|
1096
|
-
"recording.requested": {
|
|
1097
|
-
recording: Recording;
|
|
1098
|
-
};
|
|
1099
|
-
"recording.started": {
|
|
1100
|
-
recording: Recording;
|
|
1101
|
-
};
|
|
1102
|
-
"recording.stopped": {
|
|
1103
|
-
recording: Recording;
|
|
1104
|
-
};
|
|
1105
|
-
"recording.failed": {
|
|
1106
|
-
recording: Recording;
|
|
1107
|
-
reason: Nullable<string>;
|
|
1108
|
-
};
|
|
1109
|
-
"session.held": {
|
|
1110
|
-
heldAt: string;
|
|
1111
|
-
};
|
|
1112
|
-
"session.unheld": {
|
|
1113
|
-
unheldAt: string;
|
|
1114
|
-
};
|
|
1115
|
-
"session.ended": {
|
|
1116
|
-
reason: SessionEndReason;
|
|
1117
|
-
endedAt: string;
|
|
1118
|
-
};
|
|
1119
|
-
"media.status.changed": {
|
|
1120
|
-
status: SessionMediaStatus;
|
|
1121
|
-
};
|
|
1122
|
-
error: {
|
|
1123
|
-
error: ReturnType<typeof callpadError.internal>;
|
|
1124
|
-
};
|
|
1125
|
-
}
|
|
1126
|
-
interface SessionOptions {
|
|
1127
|
-
vendor: string;
|
|
1128
|
-
view: SessionView;
|
|
1129
|
-
logger: Logger;
|
|
1130
|
-
selfParticipantId: Nullable<string>;
|
|
1131
|
-
commands: SessionCommandRegistry;
|
|
1132
|
-
}
|
|
1133
|
-
declare class Session {
|
|
1134
|
-
private view;
|
|
1135
|
-
private readonly vendor;
|
|
1136
|
-
private readonly logger;
|
|
1137
|
-
private readonly bus;
|
|
1138
|
-
private readonly media;
|
|
1139
|
-
private readonly commands;
|
|
1140
|
-
private readonly ctx;
|
|
1141
|
-
private mediaStatus;
|
|
1142
|
-
private selfParticipantId;
|
|
1143
|
-
private disposed;
|
|
1144
|
-
private cachedGrant;
|
|
1145
|
-
private cachedParticipants;
|
|
1146
|
-
private cachedTelephonyLegs;
|
|
1147
|
-
private cachedRecordings;
|
|
1148
|
-
private cachedDispatches;
|
|
1149
|
-
constructor(opts: SessionOptions);
|
|
1150
|
-
get id(): string;
|
|
1151
|
-
get callId(): string;
|
|
1152
|
-
get vendorId(): number;
|
|
1153
|
-
get vendorSlug(): string;
|
|
1154
|
-
get mediaType(): SessionMediaType;
|
|
1155
|
-
get state(): SessionState;
|
|
1156
|
-
get version(): number;
|
|
1157
|
-
get route(): SessionRouteContext;
|
|
1158
|
-
get viewSnapshot(): SessionView;
|
|
1159
|
-
get mediaStatusSnapshot(): SessionMediaStatus;
|
|
1160
|
-
get mediaRoom(): Room;
|
|
1161
|
-
get participants(): readonly Participant[];
|
|
1162
|
-
get telephonyLegs(): readonly TelephonyLeg[];
|
|
1163
|
-
get dispatches(): readonly Dispatch[];
|
|
1164
|
-
get recordings(): readonly Recording[];
|
|
1165
|
-
get activeRecording(): Nullable<Recording>;
|
|
1166
|
-
get self(): Nullable<Participant>;
|
|
1167
|
-
capabilitiesOf(participantId?: string): readonly SessionParticipantCapability[];
|
|
1168
|
-
on<K extends keyof SessionEventMap>(type: K, handler: (payload: SessionEventMap[K]) => void): Unsubscribe;
|
|
1169
|
-
applyView(next: SessionView): void;
|
|
1170
|
-
dispatch<K extends SessionCommandName>(name: K, ...rest: DispatchArgs<K>): Promise<Result<SessionCommandRet<K>>>;
|
|
1171
|
-
join(): Promise<Result<void>>;
|
|
1172
|
-
joinWithGrant(grant: SessionJoinGrant): Promise<Result<void>>;
|
|
1173
|
-
private isEnded;
|
|
1174
|
-
leave(): Promise<Result<SessionCommandMap["leave"]["ret"]>>;
|
|
1175
|
-
cancel(): Promise<Result<SessionCommandMap["cancel"]["ret"]>>;
|
|
1176
|
-
end(): Promise<Result<SessionCommandMap["end"]["ret"]>>;
|
|
1177
|
-
hold(): Promise<Result<SessionCommandMap["hold"]["ret"]>>;
|
|
1178
|
-
unhold(): Promise<Result<SessionCommandMap["unhold"]["ret"]>>;
|
|
1179
|
-
startRecording(): Promise<Result<SessionCommandMap["startRecording"]["ret"]>>;
|
|
1180
|
-
stopRecording(recordingId: string): Promise<Result<SessionCommandMap["stopRecording"]["ret"]>>;
|
|
1181
|
-
invite(target: CreateSessionTarget): Promise<Result<SessionCommandMap["invite"]["ret"]>>;
|
|
1182
|
-
removeParticipant(participantId: string): Promise<Result<SessionCommandMap["removeParticipant"]["ret"]>>;
|
|
1183
|
-
updateName(name: string): Promise<Result<SessionCommandMap["updateName"]["ret"]>>;
|
|
1184
|
-
mediaGrant(): Nullable<SessionJoinGrant>;
|
|
1185
|
-
dispose(): Promise<void>;
|
|
1186
|
-
private requestGrant;
|
|
1187
|
-
private invalidateCaches;
|
|
1188
|
-
private wireMedia;
|
|
1189
|
-
private diffParticipants;
|
|
1190
|
-
private diffTelephonyLegs;
|
|
1191
|
-
private diffDispatches;
|
|
1192
|
-
private diffRecordings;
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1195
|
-
interface SessionManagerEventMap {
|
|
1196
|
-
"session.added": {
|
|
1197
|
-
session: Session;
|
|
1198
|
-
};
|
|
1199
|
-
"session.removed": {
|
|
1200
|
-
sessionId: string;
|
|
1201
|
-
};
|
|
1202
|
-
}
|
|
1203
|
-
interface SessionManagerOptions {
|
|
1204
|
-
vendor: string;
|
|
1205
|
-
logger: Logger;
|
|
1206
|
-
pulse: PulseTransport;
|
|
1207
|
-
selfParticipantId: Nullable<string>;
|
|
1208
|
-
commands: SessionCommandRegistry;
|
|
1209
|
-
}
|
|
1210
|
-
declare class SessionManager {
|
|
1211
|
-
private readonly sessions;
|
|
1212
|
-
private readonly vendor;
|
|
1213
|
-
private readonly logger;
|
|
1214
|
-
private readonly pulse;
|
|
1215
|
-
private readonly commands;
|
|
1216
|
-
private selfParticipantId;
|
|
1217
|
-
private readonly bus;
|
|
1218
|
-
private readonly unsubs;
|
|
1219
|
-
private cachedList;
|
|
1220
|
-
private disposed;
|
|
1221
|
-
constructor(opts: SessionManagerOptions);
|
|
1222
|
-
list(): readonly Session[];
|
|
1223
|
-
get(id: string): Nullable<Session>;
|
|
1224
|
-
active(): Nullable<Session>;
|
|
1225
|
-
activeId(): Nullable<string>;
|
|
1226
|
-
on<K extends keyof SessionManagerEventMap>(type: K, handler: (payload: SessionManagerEventMap[K]) => void): Unsubscribe;
|
|
1227
|
-
prime(): Promise<Result<void>>;
|
|
1228
|
-
create(body: CreateSessionBody): Promise<Result<Session>>;
|
|
1229
|
-
fetchById(id: string): Promise<Result<Session>>;
|
|
1230
|
-
onAcceptedInvite(view: SessionView): Session;
|
|
1231
|
-
private onUpsert;
|
|
1232
|
-
private onRemove;
|
|
1233
|
-
dispose(): Promise<void>;
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1236
|
-
type InviteAcceptPayload = {
|
|
1237
|
-
session: SessionView;
|
|
1238
|
-
joinGrant: SessionJoinGrant;
|
|
1239
|
-
};
|
|
1240
|
-
type InviteAcceptHandler = (payload: InviteAcceptPayload) => Promise<Result<void>>;
|
|
1241
|
-
declare class Invite {
|
|
1242
|
-
private view;
|
|
1243
|
-
private readonly vendor;
|
|
1244
|
-
private readonly onAccept;
|
|
1245
|
-
private disposed;
|
|
1246
|
-
constructor(view: SessionInviteView, vendor: string, onAccept: InviteAcceptHandler);
|
|
1247
|
-
get id(): string;
|
|
1248
|
-
get sessionId(): string;
|
|
1249
|
-
get callId(): string;
|
|
1250
|
-
get state(): InviteState;
|
|
1251
|
-
get createdAt(): string;
|
|
1252
|
-
get expiresAt(): Nullable<string>;
|
|
1253
|
-
get completedAt(): Nullable<string>;
|
|
1254
|
-
get dispatchId(): Nullable<string>;
|
|
1255
|
-
get recipient(): SessionAccessRef;
|
|
1256
|
-
get participantId(): string;
|
|
1257
|
-
get inviterParticipantId(): Nullable<string>;
|
|
1258
|
-
get session(): SessionView;
|
|
1259
|
-
applyView(next: SessionInviteView): void;
|
|
1260
|
-
accept(): Promise<Result<void>>;
|
|
1261
|
-
reject(): Promise<Result<void>>;
|
|
1262
|
-
dispose(): void;
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
interface InviteManagerEventMap {
|
|
1266
|
-
"invite.added": {
|
|
1267
|
-
invite: Invite;
|
|
1268
|
-
};
|
|
1269
|
-
"invite.updated": {
|
|
1270
|
-
invite: Invite;
|
|
1271
|
-
};
|
|
1272
|
-
"invite.removed": {
|
|
1273
|
-
inviteId: string;
|
|
1274
|
-
};
|
|
1275
|
-
}
|
|
1276
|
-
interface InviteManagerOptions {
|
|
1277
|
-
vendor: string;
|
|
1278
|
-
pulse: PulseTransport;
|
|
1279
|
-
onAccept: InviteAcceptHandler;
|
|
1280
|
-
}
|
|
1281
|
-
declare class InviteManager {
|
|
1282
|
-
private readonly invites;
|
|
1283
|
-
private readonly sessionIndex;
|
|
1284
|
-
private readonly vendor;
|
|
1285
|
-
private readonly pulse;
|
|
1286
|
-
private readonly onAccept;
|
|
1287
|
-
private readonly bus;
|
|
1288
|
-
private readonly unsubs;
|
|
1289
|
-
private cachedList;
|
|
1290
|
-
private disposed;
|
|
1291
|
-
constructor(opts: InviteManagerOptions);
|
|
1292
|
-
list(): readonly Invite[];
|
|
1293
|
-
get(id: string): Nullable<Invite>;
|
|
1294
|
-
first(): Nullable<Invite>;
|
|
1295
|
-
on<K extends keyof InviteManagerEventMap>(type: K, handler: (payload: InviteManagerEventMap[K]) => void): Unsubscribe;
|
|
1296
|
-
prime(): Promise<Result<void>>;
|
|
1297
|
-
private onUpsert;
|
|
1298
|
-
private onRemove;
|
|
1299
|
-
private dropBySession;
|
|
1300
|
-
private trackSession;
|
|
1301
|
-
private untrackSession;
|
|
1302
|
-
dispose(): Promise<void>;
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
|
-
interface PresenceRef {
|
|
1306
|
-
readonly kind: "agent" | "user";
|
|
1307
|
-
readonly id: string;
|
|
1308
|
-
}
|
|
1309
|
-
interface PresenceSnapshot {
|
|
1310
|
-
readonly id: string;
|
|
1311
|
-
readonly availability: Nullable<PresenceAvailability>;
|
|
1312
|
-
readonly connectivity: Nullable<PresenceConnectivity>;
|
|
1313
|
-
readonly lastSeenAt: Nullable<string>;
|
|
1314
|
-
}
|
|
1315
|
-
|
|
1316
|
-
interface PresenceManagerEventMap {
|
|
1317
|
-
"presence.updated": {
|
|
1318
|
-
snapshot: PresenceSnapshot;
|
|
1319
|
-
};
|
|
1320
|
-
}
|
|
1321
|
-
interface PresenceManagerOptions {
|
|
1322
|
-
vendor: string;
|
|
1323
|
-
}
|
|
1324
|
-
declare class PresenceManager {
|
|
1325
|
-
private readonly vendor;
|
|
1326
|
-
private readonly bus;
|
|
1327
|
-
private disposed;
|
|
1328
|
-
constructor(opts: PresenceManagerOptions);
|
|
1329
|
-
on<K extends keyof PresenceManagerEventMap>(type: K, handler: (payload: PresenceManagerEventMap[K]) => void): Unsubscribe;
|
|
1330
|
-
get(refs: readonly PresenceRef[]): Promise<Result<ReadonlyMap<string, PresenceSnapshot>>>;
|
|
1331
|
-
setMyStatus(mode: PresenceMode, note?: Nullable<string>): Promise<Result<void>>;
|
|
1332
|
-
clearMyStatus(): Promise<Result<void>>;
|
|
1333
|
-
dispose(): Promise<void>;
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1336
|
-
interface PluginContext {
|
|
1337
|
-
readonly logger: Logger;
|
|
1338
|
-
readonly pulse: PulseTransport;
|
|
1339
|
-
readonly sessions: SessionManager;
|
|
1340
|
-
readonly invites: InviteManager;
|
|
1341
|
-
readonly presence: PresenceManager;
|
|
1342
|
-
registerSessionCommand<A, R>(cmd: SessionCommand<A, R>): void;
|
|
1343
|
-
readonly onSessionCreated: (handler: (session: Session) => void) => Unsubscribe;
|
|
1344
|
-
readonly onSessionDisposed: (handler: (sessionId: string) => void) => Unsubscribe;
|
|
1345
|
-
}
|
|
1346
|
-
interface PluginHandle {
|
|
1347
|
-
dispose(): Promise<void> | void;
|
|
1348
|
-
}
|
|
1349
|
-
interface CallpadPlugin {
|
|
1350
|
-
readonly name: string;
|
|
1351
|
-
readonly version: string;
|
|
1352
|
-
install(ctx: PluginContext): PluginHandle | Promise<PluginHandle>;
|
|
1353
|
-
}
|
|
1354
|
-
|
|
1355
|
-
type ClientStatus = "idle" | "connecting" | "ready" | "degraded" | "offline" | "disposed";
|
|
1356
|
-
interface AuthConfig {
|
|
1357
|
-
getAccessToken: () => Promise<string>;
|
|
1358
|
-
onUnauthorized?: () => void;
|
|
1359
|
-
}
|
|
1360
|
-
interface CallpadConfig {
|
|
1361
|
-
apiBaseUrl: string;
|
|
1362
|
-
vendor: string;
|
|
1363
|
-
auth: AuthConfig;
|
|
1364
|
-
logger?: Logger;
|
|
1365
|
-
}
|
|
1366
|
-
interface ClientEventMap {
|
|
1367
|
-
"status.changed": {
|
|
1368
|
-
status: ClientStatus;
|
|
1369
|
-
previous: ClientStatus;
|
|
1370
|
-
};
|
|
1371
|
-
"session.added": {
|
|
1372
|
-
session: Session;
|
|
1373
|
-
};
|
|
1374
|
-
"session.removed": {
|
|
1375
|
-
sessionId: string;
|
|
1376
|
-
};
|
|
1377
|
-
"invite.added": {
|
|
1378
|
-
inviteId: string;
|
|
1379
|
-
};
|
|
1380
|
-
"invite.removed": {
|
|
1381
|
-
inviteId: string;
|
|
1382
|
-
};
|
|
1383
|
-
error: {
|
|
1384
|
-
error: CallpadError;
|
|
1385
|
-
};
|
|
1386
|
-
}
|
|
1387
|
-
declare class CallpadClient {
|
|
1388
|
-
private readonly config;
|
|
1389
|
-
private readonly logger;
|
|
1390
|
-
private readonly bus;
|
|
1391
|
-
private readonly pluginHost;
|
|
1392
|
-
private readonly sessionCommands;
|
|
1393
|
-
private pulseTransport;
|
|
1394
|
-
private sessions;
|
|
1395
|
-
private invites;
|
|
1396
|
-
private presence;
|
|
1397
|
-
private responseInterceptorId;
|
|
1398
|
-
private status;
|
|
1399
|
-
private disposed;
|
|
1400
|
-
constructor(config: CallpadConfig);
|
|
1401
|
-
registerSessionCommand<A, R>(cmd: SessionCommand<A, R>): void;
|
|
1402
|
-
getStatus(): ClientStatus;
|
|
1403
|
-
getSessions(): SessionManager;
|
|
1404
|
-
getInvites(): InviteManager;
|
|
1405
|
-
getPresence(): PresenceManager;
|
|
1406
|
-
on<K extends keyof ClientEventMap>(type: K, handler: (payload: ClientEventMap[K]) => void): Unsubscribe;
|
|
1407
|
-
connect(): Promise<Result<void>>;
|
|
1408
|
-
dispose(): Promise<void>;
|
|
1409
|
-
createSession(body: CreateSessionBody): Promise<Result<Session>>;
|
|
1410
|
-
use(plugin: CallpadPlugin): Promise<Result<void>>;
|
|
1411
|
-
private configureApiClient;
|
|
1412
|
-
private fetchPulseGrant;
|
|
1413
|
-
private setStatus;
|
|
1414
|
-
}
|
|
1415
|
-
declare function createCallpadClient(config: CallpadConfig): CallpadClient;
|
|
1416
|
-
|
|
1417
|
-
export { type AuthConfig, CallpadClient, type CallpadConfig, type CallpadError, type CallpadErrorIssue, type CallpadErrorKind, type CallpadPlugin, type ClientEventMap, type ClientStatus, type ConnectionQualityLabel, type CreateSessionBody, type CreateSessionTarget, type CreateSessionTargetType, type Dispatch, Invite, type InviteAcceptHandler, InviteManager, type InviteManagerEventMap, type InviteManagerOptions, type InviteParticipantBody, type InviteState, type LogFields, type Logger, type Nullable, type Participant, type ParticipantMediaState, type PluginContext, type PluginHandle, type PresenceAvailability, type PresenceConnectivity, type PresenceItem, PresenceManager, type PresenceManagerEventMap, type PresenceManagerOptions, type PresenceMode, type PresenceRef, type PresenceResponse, type PresenceSnapshot, type PulseConnectGrant, type Recording, type RecordingView, type Result, Session, type SessionAccessRef, type SessionAppInviteView, type SessionChannel, type SessionCommand, type SessionCommandArgs, type SessionCommandContext, type SessionCommandMap, type SessionCommandName, type SessionCommandRet, type SessionDirection, type SessionDispatchSource, type SessionDispatchState, type SessionDispatchStrategy, type SessionDispatchView, type SessionEndReason, type SessionEventMap, type SessionInviteOperationState, type SessionInviteView, type SessionJoinGrant, SessionManager, type SessionManagerEventMap, type SessionManagerOptions, type SessionMediaStatus, type SessionMediaType, type SessionPage, type SessionParticipantCapability, type SessionParticipantFailureReason, type SessionParticipantLeftReason, type SessionParticipantOperationView, type SessionParticipantRole, type SessionParticipantState, type SessionParticipantTransport, type SessionParticipantView, type SessionPartyInfo, type SessionPartyRef, type SessionRecordingPolicy, type SessionRecordingState, type SessionRecordingTarget, type SessionRecordingView, type SessionRouteContext, type SessionSipLegDirection, type SessionSipLegFailureReason, type SessionSipLegState, type SessionSipLegView, type SessionState, type SessionView, type SetPresenceStatusBody, type TelephonyLeg, type Unsubscribe, type UpdateSessionBody, callpadError, createCallpadClient, err, isErr, isOk, noopLogger, ok, unwrap };
|