@signalwire/js 4.0.0-beta.10 → 4.0.0-beta.12
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/dist/browser.mjs +6004 -1063
- package/dist/browser.mjs.map +1 -1
- package/dist/browser.umd.js +6015 -1063
- package/dist/browser.umd.js.map +1 -1
- package/dist/index.cjs +5588 -743
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2024 -256
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2023 -255
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5568 -734
- package/dist/index.mjs.map +1 -1
- package/dist/operators/index.cjs +1 -1
- package/dist/operators/index.mjs +1 -1
- package/dist/{operators-uT_fb8ba.mjs → operators-CX_lCCJm.mjs} +118 -13
- package/dist/operators-CX_lCCJm.mjs.map +1 -0
- package/dist/{operators-mm21prWr.cjs → operators-D6a2J1KA.cjs} +177 -12
- package/dist/operators-D6a2J1KA.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/operators-mm21prWr.cjs.map +0 -1
- package/dist/operators-uT_fb8ba.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -3,79 +3,8 @@ import * as rxjs0 from "rxjs";
|
|
|
3
3
|
import { BehaviorSubject, Observable, Observer, ReplaySubject, Subject, Subscription } from "rxjs";
|
|
4
4
|
import { URL as URL$1 } from "node:url";
|
|
5
5
|
|
|
6
|
-
//#region src/behaviors/Destroyable.d.ts
|
|
7
|
-
declare abstract class Destroyable {
|
|
8
|
-
protected subscriptions: Subscription[];
|
|
9
|
-
protected subjects: Subject<unknown>[];
|
|
10
|
-
protected _destroyed$: Subject<void>;
|
|
11
|
-
private _observableCache?;
|
|
12
|
-
destroy(): void;
|
|
13
|
-
protected cachedObservable<T>(key: string, factory: () => Observable<T>): Observable<T>;
|
|
14
|
-
/**
|
|
15
|
-
* Like `cachedObservable`, but defers emissions to the microtask queue
|
|
16
|
-
* via `observeOn(asapScheduler)`.
|
|
17
|
-
*
|
|
18
|
-
* Use ONLY for public-facing observable getters that external consumers
|
|
19
|
-
* subscribe to. Prevents a class of bugs where `BehaviorSubject` or
|
|
20
|
-
* `ReplaySubject` replays synchronously during `subscribe()`, before
|
|
21
|
-
* the subscription variable is assigned in the caller's scope.
|
|
22
|
-
*
|
|
23
|
-
* Do NOT use for observables consumed internally by the SDK — internal
|
|
24
|
-
* code using `subscribeTo()`, `firstValueFrom()`, or `withLatestFrom()`
|
|
25
|
-
* depends on synchronous emission delivery.
|
|
26
|
-
*/
|
|
27
|
-
protected publicCachedObservable<T>(key: string, factory: () => Observable<T>): Observable<T>;
|
|
28
|
-
/**
|
|
29
|
-
* Wraps an observable so emissions are deferred to the microtask queue.
|
|
30
|
-
*
|
|
31
|
-
* Use ONLY for public-facing getters that expose a subject via
|
|
32
|
-
* `.asObservable()` without going through `cachedObservable`.
|
|
33
|
-
*
|
|
34
|
-
* Do NOT use for observables consumed internally by the SDK.
|
|
35
|
-
*/
|
|
36
|
-
protected deferEmission<T>(observable: Observable<T>): Observable<T>;
|
|
37
|
-
protected subscribeTo<T>(observable: Observable<T>, observerOrNext: Partial<Observer<T>> | ((value: T) => void) | undefined): void;
|
|
38
|
-
protected createSubject<T>(): Subject<T>;
|
|
39
|
-
protected createReplaySubject<T>(bufferSize?: number, windowTime?: number): ReplaySubject<T>;
|
|
40
|
-
protected createBehaviorSubject<T>(initialValue: T): BehaviorSubject<T>;
|
|
41
|
-
get $(): Observable<this>;
|
|
42
|
-
/**
|
|
43
|
-
* Observable that emits when the instance is destroyed
|
|
44
|
-
*/
|
|
45
|
-
get destroyed$(): Observable<void>;
|
|
46
|
-
}
|
|
47
|
-
//#endregion
|
|
48
|
-
//#region src/core/types/media.types.d.ts
|
|
49
|
-
/** WebRTC transceiver direction for a single media kind. */
|
|
50
|
-
type MediaDirection = RTCRtpTransceiverDirection;
|
|
51
|
-
/** Audio and video directions "inactive" | "recvonly" | "sendonly" | "sendrecv" | "stopped" */
|
|
52
|
-
interface MediaDirections {
|
|
53
|
-
/** Audio direction */
|
|
54
|
-
audio: MediaDirection;
|
|
55
|
-
/** Video direction */
|
|
56
|
-
video: MediaDirection;
|
|
57
|
-
}
|
|
58
|
-
/** Options controlling which media tracks to send and receive. */
|
|
59
|
-
interface MediaOptions {
|
|
60
|
-
/** Enable audio input. */
|
|
61
|
-
audio?: boolean;
|
|
62
|
-
/** Enable video input. */
|
|
63
|
-
video?: boolean;
|
|
64
|
-
/** Custom constraints for the audio input track. */
|
|
65
|
-
inputAudioDeviceConstraints?: MediaTrackConstraints;
|
|
66
|
-
/** Custom constraints for the video input track. */
|
|
67
|
-
inputVideoDeviceConstraints?: MediaTrackConstraints;
|
|
68
|
-
/** Pre-existing audio stream to use instead of `getUserMedia`. */
|
|
69
|
-
inputAudioStream?: MediaStream;
|
|
70
|
-
/** Pre-existing video stream to use instead of `getUserMedia`. */
|
|
71
|
-
inputVideoStream?: MediaStream;
|
|
72
|
-
/** Whether to receive remote audio. */
|
|
73
|
-
receiveAudio?: boolean;
|
|
74
|
-
/** Whether to receive remote video. */
|
|
75
|
-
receiveVideo?: boolean;
|
|
76
|
-
}
|
|
77
|
-
//#endregion
|
|
78
6
|
//#region src/core/types/common.types.d.ts
|
|
7
|
+
/** JSON-compatible value type for serializable data structures. */
|
|
79
8
|
interface JSONSerializable {
|
|
80
9
|
[key: string]: JSONSerializable | string | number | boolean | null | undefined | JSONSerializable[];
|
|
81
10
|
}
|
|
@@ -124,6 +53,7 @@ interface HTTPResponse<T extends HttpBody = string> {
|
|
|
124
53
|
/** Final URL after any redirects */
|
|
125
54
|
url: string;
|
|
126
55
|
}
|
|
56
|
+
/** Browser-compatible WebSocket client interface. */
|
|
127
57
|
interface WebSocketClient {
|
|
128
58
|
addEventListener: WebSocket['addEventListener'];
|
|
129
59
|
removeEventListener: WebSocket['removeEventListener'];
|
|
@@ -131,6 +61,7 @@ interface WebSocketClient {
|
|
|
131
61
|
close: WebSocket['close'];
|
|
132
62
|
readyState: WebSocket['readyState'];
|
|
133
63
|
}
|
|
64
|
+
/** Node.js WebSocket client interface with event listener overloads. */
|
|
134
65
|
interface NodeSocketClient extends WebSocketClient {
|
|
135
66
|
addEventListener(method: 'open' | 'close' | 'error' | 'message', cb: (event: unknown) => void, options?: unknown): void;
|
|
136
67
|
removeEventListener(method: 'open' | 'close' | 'error' | 'message', cb: (event: unknown) => void): void;
|
|
@@ -147,24 +78,52 @@ interface NodeSocketAdapter {
|
|
|
147
78
|
}
|
|
148
79
|
/** Browser-compatible WebSocket constructor type. */
|
|
149
80
|
type WebSocketAdapter = new (url: string | URL, protocols?: string | string[]) => WebSocketClient;
|
|
150
|
-
/**
|
|
81
|
+
/**
|
|
82
|
+
* Authentication credentials for the SDK.
|
|
83
|
+
*
|
|
84
|
+
* At least one of `token` or `authorizationState` must be provided.
|
|
85
|
+
*/
|
|
151
86
|
interface SDKCredential {
|
|
152
|
-
/** JWT
|
|
87
|
+
/** JWT user access token (SAT). */
|
|
153
88
|
token?: string;
|
|
154
89
|
/** Pre-authorized session state (alternative to token). */
|
|
155
90
|
authorizationState?: string;
|
|
156
|
-
/** Token expiry timestamp in milliseconds since epoch. */
|
|
91
|
+
/** Token expiry timestamp in milliseconds since epoch. When set, the SDK attempts credential refresh before expiry. */
|
|
157
92
|
expiry_at?: number;
|
|
158
93
|
}
|
|
159
94
|
/** Types of addressable resources in the fabric. */
|
|
160
95
|
type ResourceType = 'app' | 'call' | 'room' | 'subscriber';
|
|
161
96
|
//#endregion
|
|
162
97
|
//#region src/dependencies/interfaces.d.ts
|
|
98
|
+
/** Persistence scope: browser `localStorage` or `sessionStorage`. */
|
|
163
99
|
type StorageScope = 'local' | 'session';
|
|
100
|
+
/** Key-value storage interface for persisting SDK preferences and state. */
|
|
164
101
|
interface Storage {
|
|
165
102
|
setItem(key: string, value: string | null, scope: StorageScope): Promise<void>;
|
|
166
103
|
getItem(key: string, scope: StorageScope): Promise<string | null>;
|
|
167
104
|
removeItem(key: string, scope: StorageScope): Promise<void>;
|
|
105
|
+
/** Clears all keys in the given scope. Implementations may scope the clear to SDK keys only. */
|
|
106
|
+
clear(scope: StorageScope): Promise<void>;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Context provided by the SDK when calling {@link CredentialProvider.authenticate}.
|
|
110
|
+
*
|
|
111
|
+
* Contains optional parameters the SDK generates internally (e.g., DPoP fingerprint)
|
|
112
|
+
* that the implementor can forward to their server-side token endpoint.
|
|
113
|
+
*/
|
|
114
|
+
interface AuthenticateContext {
|
|
115
|
+
/**
|
|
116
|
+
* JWK Thumbprint (RFC 7638) of the SDK's ephemeral DPoP key pair.
|
|
117
|
+
*
|
|
118
|
+
* When present, the implementor should forward this value as the `fingerprint`
|
|
119
|
+
* parameter to the server-side SAT issuance endpoint alongside `scope: "sat:refresh"`.
|
|
120
|
+
* This enables the server to bind the SAT to the SDK's key pair, allowing
|
|
121
|
+
* automatic Client Bound SAT refresh without developer intervention.
|
|
122
|
+
*
|
|
123
|
+
* When absent (e.g., Web Crypto API not available), the implementor should
|
|
124
|
+
* proceed without DPoP binding.
|
|
125
|
+
*/
|
|
126
|
+
fingerprint?: string;
|
|
168
127
|
}
|
|
169
128
|
/**
|
|
170
129
|
* Provides authentication credentials to the SDK.
|
|
@@ -185,12 +144,14 @@ interface CredentialProvider {
|
|
|
185
144
|
* Implementor responsibilities:
|
|
186
145
|
* - Resolve with a valid {@link SDKCredential} on success.
|
|
187
146
|
* - Reject (throw) on failure — this will cause client initialization to fail.
|
|
147
|
+
* - When `context.fingerprint` is provided, forward it to the server-side token
|
|
148
|
+
* endpoint with `scope: "sat:refresh"` to enable automatic token refresh.
|
|
188
149
|
*
|
|
189
150
|
* SDK behavior:
|
|
190
151
|
* - Awaits this method before establishing the WebSocket connection.
|
|
191
152
|
* - On rejection, propagates the error to the caller of `SignalWire()`.
|
|
192
153
|
*/
|
|
193
|
-
authenticate(): Promise<SDKCredential>;
|
|
154
|
+
authenticate(context?: AuthenticateContext): Promise<SDKCredential>;
|
|
194
155
|
/**
|
|
195
156
|
* Obtains fresh credentials before the current ones expire. Optional.
|
|
196
157
|
*
|
|
@@ -203,7 +164,10 @@ interface CredentialProvider {
|
|
|
203
164
|
* - Scheduled automatically before expiry; implementors do not need to manage timing.
|
|
204
165
|
* - On rejection, the refresh schedule stops and the session continues with the
|
|
205
166
|
* current credentials until they expire.
|
|
206
|
-
* - When not provided
|
|
167
|
+
* - When not provided and the SAT includes a `sat:refresh` scope, the SDK
|
|
168
|
+
* automatically refreshes via Client Bound SAT (DPoP) without developer intervention.
|
|
169
|
+
* - When not provided and no refresh scope is present, the SDK uses the initial
|
|
170
|
+
* credentials for the entire session lifetime.
|
|
207
171
|
*/
|
|
208
172
|
refresh?: () => Promise<SDKCredential>;
|
|
209
173
|
}
|
|
@@ -285,6 +249,82 @@ declare class StorageManager {
|
|
|
285
249
|
* @throws Error from underlying storage implementation
|
|
286
250
|
*/
|
|
287
251
|
removeItem(key: string, scope?: StorageScope): Promise<void>;
|
|
252
|
+
/**
|
|
253
|
+
* Clears all SDK keys from both 'local' and 'session' scopes.
|
|
254
|
+
* @throws StorageWriteError if clearing fails
|
|
255
|
+
*/
|
|
256
|
+
clearAll(): Promise<void>;
|
|
257
|
+
}
|
|
258
|
+
//#endregion
|
|
259
|
+
//#region src/behaviors/Destroyable.d.ts
|
|
260
|
+
declare abstract class Destroyable {
|
|
261
|
+
protected subscriptions: Subscription[];
|
|
262
|
+
protected subjects: Subject<unknown>[];
|
|
263
|
+
protected _destroyed$: Subject<void>;
|
|
264
|
+
private _observableCache?;
|
|
265
|
+
destroy(): void;
|
|
266
|
+
protected cachedObservable<T>(key: string, factory: () => Observable<T>): Observable<T>;
|
|
267
|
+
/**
|
|
268
|
+
* Like `cachedObservable`, but defers emissions to the microtask queue
|
|
269
|
+
* via `observeOn(asapScheduler)`.
|
|
270
|
+
*
|
|
271
|
+
* Use ONLY for public-facing observable getters that external consumers
|
|
272
|
+
* subscribe to. Prevents a class of bugs where `BehaviorSubject` or
|
|
273
|
+
* `ReplaySubject` replays synchronously during `subscribe()`, before
|
|
274
|
+
* the subscription variable is assigned in the caller's scope.
|
|
275
|
+
*
|
|
276
|
+
* Do NOT use for observables consumed internally by the SDK — internal
|
|
277
|
+
* code using `subscribeTo()`, `firstValueFrom()`, or `withLatestFrom()`
|
|
278
|
+
* depends on synchronous emission delivery.
|
|
279
|
+
*/
|
|
280
|
+
protected publicCachedObservable<T>(key: string, factory: () => Observable<T>): Observable<T>;
|
|
281
|
+
/**
|
|
282
|
+
* Wraps an observable so emissions are deferred to the microtask queue.
|
|
283
|
+
*
|
|
284
|
+
* Use ONLY for public-facing getters that expose a subject via
|
|
285
|
+
* `.asObservable()` without going through `cachedObservable`.
|
|
286
|
+
*
|
|
287
|
+
* Do NOT use for observables consumed internally by the SDK.
|
|
288
|
+
*/
|
|
289
|
+
protected deferEmission<T>(observable: Observable<T>): Observable<T>;
|
|
290
|
+
protected subscribeTo<T>(observable: Observable<T>, observerOrNext: Partial<Observer<T>> | ((value: T) => void) | undefined): void;
|
|
291
|
+
protected createSubject<T>(): Subject<T>;
|
|
292
|
+
protected createReplaySubject<T>(bufferSize?: number, windowTime?: number): ReplaySubject<T>;
|
|
293
|
+
protected createBehaviorSubject<T>(initialValue: T): BehaviorSubject<T>;
|
|
294
|
+
/**
|
|
295
|
+
* Observable that emits when the instance is destroyed
|
|
296
|
+
*/
|
|
297
|
+
get destroyed$(): Observable<void>;
|
|
298
|
+
}
|
|
299
|
+
//#endregion
|
|
300
|
+
//#region src/core/types/media.types.d.ts
|
|
301
|
+
/** WebRTC transceiver direction for a single media kind. */
|
|
302
|
+
type MediaDirection = RTCRtpTransceiverDirection;
|
|
303
|
+
/** Audio and video directions "inactive" | "recvonly" | "sendonly" | "sendrecv" | "stopped" */
|
|
304
|
+
interface MediaDirections {
|
|
305
|
+
/** Audio direction */
|
|
306
|
+
audio: MediaDirection;
|
|
307
|
+
/** Video direction */
|
|
308
|
+
video: MediaDirection;
|
|
309
|
+
}
|
|
310
|
+
/** Options controlling which media tracks to send and receive. */
|
|
311
|
+
interface MediaOptions {
|
|
312
|
+
/** Enable audio input. Defaults to `true` when not specified. */
|
|
313
|
+
audio?: boolean;
|
|
314
|
+
/** Enable video input. Defaults to `false` when not specified. */
|
|
315
|
+
video?: boolean;
|
|
316
|
+
/** Custom constraints for the audio input track. */
|
|
317
|
+
inputAudioDeviceConstraints?: MediaTrackConstraints;
|
|
318
|
+
/** Custom constraints for the video input track. */
|
|
319
|
+
inputVideoDeviceConstraints?: MediaTrackConstraints;
|
|
320
|
+
/** Pre-existing audio stream to use instead of `getUserMedia`. */
|
|
321
|
+
inputAudioStream?: MediaStream;
|
|
322
|
+
/** Pre-existing video stream to use instead of `getUserMedia`. */
|
|
323
|
+
inputVideoStream?: MediaStream;
|
|
324
|
+
/** Whether to receive remote audio. */
|
|
325
|
+
receiveAudio?: boolean;
|
|
326
|
+
/** Whether to receive remote video. */
|
|
327
|
+
receiveVideo?: boolean;
|
|
288
328
|
}
|
|
289
329
|
//#endregion
|
|
290
330
|
//#region src/containers/PreferencesContainer.d.ts
|
|
@@ -364,6 +404,108 @@ declare class ClientPreferences {
|
|
|
364
404
|
/** Custom user variables attached to calls. */
|
|
365
405
|
get userVariables(): Record<string, unknown>;
|
|
366
406
|
set userVariables(value: Record<string, unknown>);
|
|
407
|
+
/** Stats polling interval in milliseconds. */
|
|
408
|
+
get statsPollingInterval(): number;
|
|
409
|
+
set statsPollingInterval(value: number);
|
|
410
|
+
/** Number of baseline samples for stats monitoring. */
|
|
411
|
+
get statsBaselineSamples(): number;
|
|
412
|
+
set statsBaselineSamples(value: number);
|
|
413
|
+
/** Duration in ms with no inbound packets before a critical issue is emitted. */
|
|
414
|
+
get statsNoPacketThreshold(): number;
|
|
415
|
+
set statsNoPacketThreshold(value: number);
|
|
416
|
+
/** Multiplier for RTT spike detection relative to baseline. */
|
|
417
|
+
get statsRttSpikeMultiplier(): number;
|
|
418
|
+
set statsRttSpikeMultiplier(value: number);
|
|
419
|
+
/** Packet loss fraction threshold (0-1) for issue detection. */
|
|
420
|
+
get statsPacketLossThreshold(): number;
|
|
421
|
+
set statsPacketLossThreshold(value: number);
|
|
422
|
+
/** Multiplier for jitter spike detection relative to baseline. */
|
|
423
|
+
get statsJitterSpikeMultiplier(): number;
|
|
424
|
+
set statsJitterSpikeMultiplier(value: number);
|
|
425
|
+
/** Number of seconds of metrics history to retain. */
|
|
426
|
+
get statsHistorySize(): number;
|
|
427
|
+
set statsHistorySize(value: number);
|
|
428
|
+
/** Maximum keyframe requests in a burst window. */
|
|
429
|
+
get keyframeMaxBurst(): number;
|
|
430
|
+
set keyframeMaxBurst(value: number);
|
|
431
|
+
/** Keyframe burst window duration in milliseconds. */
|
|
432
|
+
get keyframeBurstWindow(): number;
|
|
433
|
+
set keyframeBurstWindow(value: number);
|
|
434
|
+
/** Cooldown period in ms after keyframe burst limit is reached. */
|
|
435
|
+
get keyframeCooldown(): number;
|
|
436
|
+
set keyframeCooldown(value: number);
|
|
437
|
+
/** Minimum time in ms between re-INVITE attempts. */
|
|
438
|
+
get reinviteDebounceTime(): number;
|
|
439
|
+
set reinviteDebounceTime(value: number);
|
|
440
|
+
/** Maximum re-INVITE attempts per call. */
|
|
441
|
+
get reinviteMaxAttempts(): number;
|
|
442
|
+
set reinviteMaxAttempts(value: number);
|
|
443
|
+
/** Timeout in ms for a single re-INVITE attempt. */
|
|
444
|
+
get reinviteTimeout(): number;
|
|
445
|
+
set reinviteTimeout(value: number);
|
|
446
|
+
/** Recovery signal debounce window in seconds. */
|
|
447
|
+
get recoveryDebounceTime(): number;
|
|
448
|
+
set recoveryDebounceTime(seconds: number);
|
|
449
|
+
/** Cooldown period between recovery attempts in seconds. */
|
|
450
|
+
get recoveryCooldown(): number;
|
|
451
|
+
set recoveryCooldown(seconds: number);
|
|
452
|
+
/** Grace period before treating ICE 'disconnected' as failure, in seconds. */
|
|
453
|
+
get iceDisconnectedGracePeriod(): number;
|
|
454
|
+
set iceDisconnectedGracePeriod(seconds: number);
|
|
455
|
+
/** Timeout for a single ICE restart attempt in seconds. */
|
|
456
|
+
get iceRestartTimeout(): number;
|
|
457
|
+
set iceRestartTimeout(seconds: number);
|
|
458
|
+
/** Maximum recovery attempts before giving up. */
|
|
459
|
+
get maxRecoveryAttempts(): number;
|
|
460
|
+
set maxRecoveryAttempts(value: number);
|
|
461
|
+
/** Whether relay-only escalation is enabled as a last-resort recovery tier. */
|
|
462
|
+
get enableRelayFallback(): boolean;
|
|
463
|
+
set enableRelayFallback(value: boolean);
|
|
464
|
+
/** Whether browser network change detection (online/offline) is enabled. */
|
|
465
|
+
get enableNetworkChangeDetection(): boolean;
|
|
466
|
+
set enableNetworkChangeDetection(value: boolean);
|
|
467
|
+
/** Whether server-sent media-timeout hangups are intercepted for recovery. */
|
|
468
|
+
get enableServerHangupInterception(): boolean;
|
|
469
|
+
set enableServerHangupInterception(value: boolean);
|
|
470
|
+
/** Whether device selections are persisted to storage. */
|
|
471
|
+
get persistDeviceSelection(): boolean;
|
|
472
|
+
set persistDeviceSelection(value: boolean);
|
|
473
|
+
/** Whether device changes are auto-applied to active calls. */
|
|
474
|
+
get syncDevicesToActiveCalls(): boolean;
|
|
475
|
+
set syncDevicesToActiveCalls(value: boolean);
|
|
476
|
+
/** Whether to auto-mute video when the tab becomes hidden. */
|
|
477
|
+
get autoMuteVideoOnHidden(): boolean;
|
|
478
|
+
set autoMuteVideoOnHidden(value: boolean);
|
|
479
|
+
/** Whether to re-enumerate devices when the page becomes visible. */
|
|
480
|
+
get refreshDevicesOnVisible(): boolean;
|
|
481
|
+
set refreshDevicesOnVisible(value: boolean);
|
|
482
|
+
/** Whether to check peer connection health when the page becomes visible. */
|
|
483
|
+
get checkConnectionOnVisible(): boolean;
|
|
484
|
+
set checkConnectionOnVisible(value: boolean);
|
|
485
|
+
/** Default audio track constraints applied when no explicit constraints are provided. */
|
|
486
|
+
get defaultAudioConstraints(): MediaTrackConstraints | undefined;
|
|
487
|
+
set defaultAudioConstraints(value: MediaTrackConstraints | undefined);
|
|
488
|
+
/** Default video track constraints applied when video is enabled without explicit constraints. */
|
|
489
|
+
get defaultVideoConstraints(): MediaTrackConstraints | undefined;
|
|
490
|
+
set defaultVideoConstraints(value: MediaTrackConstraints | undefined);
|
|
491
|
+
/** Whether stereo Opus is enabled globally. */
|
|
492
|
+
get stereoAudio(): boolean;
|
|
493
|
+
set stereoAudio(value: boolean);
|
|
494
|
+
/** Whether automatic video degradation on low bandwidth is enabled. */
|
|
495
|
+
get enableAutoDegradation(): boolean;
|
|
496
|
+
set enableAutoDegradation(value: boolean);
|
|
497
|
+
/** Bitrate in kbps below which video is automatically disabled. */
|
|
498
|
+
get degradationBitrateThreshold(): number;
|
|
499
|
+
set degradationBitrateThreshold(value: number);
|
|
500
|
+
/** Bitrate in kbps above which video is automatically re-enabled. */
|
|
501
|
+
get degradationRecoveryThreshold(): number;
|
|
502
|
+
set degradationRecoveryThreshold(value: number);
|
|
503
|
+
/** Preferred video codecs in priority order. */
|
|
504
|
+
get preferredVideoCodecs(): string[];
|
|
505
|
+
set preferredVideoCodecs(value: string[]);
|
|
506
|
+
/** Preferred audio codecs in priority order. */
|
|
507
|
+
get preferredAudioCodecs(): string[];
|
|
508
|
+
set preferredAudioCodecs(value: string[]);
|
|
367
509
|
/** Saves current preferences to storage (fire-and-forget). */
|
|
368
510
|
private _saveToStorage;
|
|
369
511
|
/** Loads preferences from storage and applies them to the container. */
|
|
@@ -378,13 +520,15 @@ interface HTTPRequestControllerOptions {
|
|
|
378
520
|
retryDelayMax?: number;
|
|
379
521
|
requestTimeout?: number;
|
|
380
522
|
}
|
|
381
|
-
declare class HTTPRequestController {
|
|
523
|
+
declare class HTTPRequestController extends Destroyable {
|
|
382
524
|
private baseURL;
|
|
383
|
-
private
|
|
525
|
+
private readonly getCredential;
|
|
384
526
|
private static readonly defaultMaxRetries;
|
|
385
527
|
private static readonly defaultRetryDelayMinMs;
|
|
386
528
|
private static readonly defaultRetryDelayMaxMs;
|
|
387
529
|
private static readonly defaultRequestTimeoutMs;
|
|
530
|
+
/** Sensitive field names to mask in debug logs. */
|
|
531
|
+
private static readonly SENSITIVE_BODY_FIELDS;
|
|
388
532
|
private readonly maxRetries;
|
|
389
533
|
private readonly retryDelayMin;
|
|
390
534
|
private readonly retryDelayMax;
|
|
@@ -392,7 +536,7 @@ declare class HTTPRequestController {
|
|
|
392
536
|
private _responses$;
|
|
393
537
|
private _errors$;
|
|
394
538
|
private _status$;
|
|
395
|
-
constructor(baseURL: string,
|
|
539
|
+
constructor(baseURL: string, getCredential: () => SDKCredential, options?: HTTPRequestControllerOptions);
|
|
396
540
|
get status$(): Observable<HTTPRequestStatus>;
|
|
397
541
|
get status(): HTTPRequestStatus;
|
|
398
542
|
get responses$(): Observable<HTTPResponse>;
|
|
@@ -402,6 +546,10 @@ declare class HTTPRequestController {
|
|
|
402
546
|
private executeRequest;
|
|
403
547
|
private buildURL;
|
|
404
548
|
private buildHeaders;
|
|
549
|
+
/**
|
|
550
|
+
* Sanitizes a request body for debug logging by masking sensitive fields.
|
|
551
|
+
*/
|
|
552
|
+
private sanitizeBody;
|
|
405
553
|
private convertResponse;
|
|
406
554
|
}
|
|
407
555
|
//#endregion
|
|
@@ -420,54 +568,115 @@ declare abstract class Fetchable<T = unknown> extends Destroyable {
|
|
|
420
568
|
* Pure address-related types (no implementation dependencies)
|
|
421
569
|
* Types that reference model implementations are in interfaces.ts
|
|
422
570
|
*/
|
|
571
|
+
/** Raw address response from the SignalWire Fabric API. */
|
|
423
572
|
interface GetAddressResponse {
|
|
573
|
+
/** Unique address identifier. */
|
|
424
574
|
id: string;
|
|
575
|
+
/** Human-readable display name. */
|
|
425
576
|
display_name: string;
|
|
577
|
+
/** Resource name (used as a URI for dialing). */
|
|
426
578
|
name: string;
|
|
579
|
+
/** URL for an avatar or preview image. */
|
|
427
580
|
preview_url?: string;
|
|
581
|
+
/** URL for a cover image. */
|
|
428
582
|
cover_url?: string;
|
|
583
|
+
/** Underlying resource identifier. */
|
|
429
584
|
resource_id: string;
|
|
585
|
+
/** Type of the underlying resource. */
|
|
430
586
|
type: ResourceType;
|
|
587
|
+
/** Available communication channels for this address. */
|
|
431
588
|
channels: {
|
|
589
|
+
/** Audio-only channel URI. */
|
|
432
590
|
audio?: string;
|
|
591
|
+
/** Messaging channel URI. */
|
|
433
592
|
messaging?: string;
|
|
593
|
+
/** Video channel URI. */
|
|
434
594
|
video?: string;
|
|
435
595
|
};
|
|
596
|
+
/** Whether the address resource is currently locked. */
|
|
436
597
|
locked: boolean;
|
|
598
|
+
/** ISO 8601 timestamp when the address was created. */
|
|
437
599
|
created_at: string;
|
|
438
600
|
}
|
|
439
601
|
//#endregion
|
|
440
|
-
//#region src/core/types/
|
|
441
|
-
|
|
602
|
+
//#region src/core/types/crypto.types.d.ts
|
|
603
|
+
/** Parameters for creating an HTTP DPoP proof (for Prime API endpoints). */
|
|
604
|
+
interface DPoPHttpProofParams {
|
|
605
|
+
/** HTTP method (e.g., "POST"). */
|
|
606
|
+
readonly method: string;
|
|
607
|
+
/** Request URI — should be the full URL per RFC 9449 (e.g., "https://fabric.signalwire.com/api/..."). */
|
|
608
|
+
readonly uri: string;
|
|
609
|
+
/** Access token to bind via `ath` claim (SHA-256 hash). Used for resource endpoints, not token endpoints. */
|
|
610
|
+
readonly accessToken?: string;
|
|
611
|
+
}
|
|
612
|
+
/** Parameters for creating an RPC DPoP proof (for switchblade WebSocket methods). */
|
|
613
|
+
interface DPoPRpcProofParams {
|
|
614
|
+
/** RPC method name (e.g., "signalwire.connect" or "signalwire.reauthenticate"). */
|
|
615
|
+
readonly method: string;
|
|
616
|
+
}
|
|
617
|
+
/** SAT claims returned by /api/fabric/subscriber/info. */
|
|
618
|
+
interface SATClaims {
|
|
619
|
+
/** Token scopes (e.g., ["sat:refresh"]). */
|
|
620
|
+
scope?: string[];
|
|
621
|
+
/** Confirmation claim binding the token to a key. */
|
|
622
|
+
cnf?: {
|
|
623
|
+
jkt: string;
|
|
624
|
+
};
|
|
625
|
+
/** Token expiry timestamp in seconds since epoch. */
|
|
626
|
+
expires_at?: number;
|
|
627
|
+
}
|
|
628
|
+
//#endregion
|
|
629
|
+
//#region src/core/types/user.types.d.ts
|
|
630
|
+
/** Raw user profile response from the SignalWire Fabric API. */
|
|
631
|
+
interface GetUserInfoResponse {
|
|
632
|
+
/** Unique user identifier. */
|
|
442
633
|
id: string;
|
|
634
|
+
/** User's email address. */
|
|
443
635
|
email: string;
|
|
636
|
+
/** User's first name. */
|
|
444
637
|
first_name?: string;
|
|
638
|
+
/** User's last name. */
|
|
445
639
|
last_name?: string;
|
|
640
|
+
/** User's display name. */
|
|
446
641
|
display_name?: string;
|
|
642
|
+
/** User's job title. */
|
|
447
643
|
job_title?: string;
|
|
644
|
+
/** User's time zone offset. */
|
|
448
645
|
time_zone?: number;
|
|
646
|
+
/** User's country. */
|
|
449
647
|
country?: string;
|
|
648
|
+
/** User's region or state. */
|
|
450
649
|
region?: string;
|
|
650
|
+
/** User's company name. */
|
|
451
651
|
company_name?: string;
|
|
652
|
+
/** Key for push notification delivery. */
|
|
452
653
|
push_notification_key: string;
|
|
654
|
+
/** Application-level settings for this user. */
|
|
453
655
|
app_settings?: {
|
|
656
|
+
/** Display name configured at the application level. */
|
|
454
657
|
display_name: string;
|
|
658
|
+
/** Permission scopes granted to this user. */
|
|
455
659
|
scopes: string[];
|
|
456
660
|
};
|
|
661
|
+
/** Fabric addresses associated with this user. */
|
|
457
662
|
fabric_addresses: GetAddressResponse[];
|
|
663
|
+
/** Filtered SAT claims (scope, cnf, expires_at) returned when the token has special capabilities. */
|
|
664
|
+
sat_claims?: SATClaims;
|
|
458
665
|
}
|
|
459
666
|
//#endregion
|
|
460
|
-
//#region src/core/entities/
|
|
667
|
+
//#region src/core/entities/User.d.ts
|
|
668
|
+
/** User online presence state. */
|
|
669
|
+
type UserPresence = 'online' | 'offline' | 'busy';
|
|
461
670
|
/**
|
|
462
|
-
* Authenticated
|
|
671
|
+
* Authenticated user profile.
|
|
463
672
|
*
|
|
464
673
|
* Fetched automatically when a {@link SignalWire} connects.
|
|
465
674
|
* Contains identity, contact, and organization details.
|
|
466
675
|
*/
|
|
467
|
-
declare class
|
|
468
|
-
/** Unique
|
|
676
|
+
declare class User extends Fetchable<GetUserInfoResponse> {
|
|
677
|
+
/** Unique user identifier. */
|
|
469
678
|
id: string;
|
|
470
|
-
/**
|
|
679
|
+
/** User email address. */
|
|
471
680
|
email: string;
|
|
472
681
|
/** First name. */
|
|
473
682
|
firstName?: string;
|
|
@@ -492,39 +701,86 @@ declare class Subscriber extends Fetchable<GetSubscriberInfoResponse> {
|
|
|
492
701
|
displayName: string;
|
|
493
702
|
scopes: string[];
|
|
494
703
|
};
|
|
495
|
-
/** Fabric addresses associated with this
|
|
704
|
+
/** Fabric addresses associated with this user. */
|
|
496
705
|
addresses: GetAddressResponse[];
|
|
706
|
+
/** Filtered SAT claims when the token has special capabilities (e.g., refresh scope). */
|
|
707
|
+
satClaims?: SATClaims;
|
|
497
708
|
constructor(http: HTTPRequestController);
|
|
498
|
-
protected populateInstance(data:
|
|
709
|
+
protected populateInstance(data: GetUserInfoResponse): void;
|
|
499
710
|
}
|
|
500
711
|
//#endregion
|
|
501
712
|
//#region src/core/types/call.types.d.ts
|
|
713
|
+
/** SDP role for the peer connection negotiation. */
|
|
502
714
|
type RTCPeerConnectionType = 'offer' | 'answer';
|
|
715
|
+
/** Purpose of the peer connection (primary call, screen share, or additional device). */
|
|
503
716
|
type RTCPeerConnectionPropose = 'main' | 'screenshare' | 'additional-device';
|
|
717
|
+
/** States during call connection establishment. */
|
|
504
718
|
type CallConnectStates = 'connecting' | 'connected';
|
|
719
|
+
/** Lifecycle states of the signaling protocol for a call. */
|
|
505
720
|
type SignalingCallStates = 'created' | 'ringing' | 'answered' | 'ending' | 'ended';
|
|
721
|
+
/** Whether the call is inbound (received) or outbound (initiated). */
|
|
506
722
|
type CallDirection = 'inbound' | 'outbound';
|
|
723
|
+
/** Playback state of media being played into a call. */
|
|
507
724
|
type CallPlayState = 'playing' | 'paused' | 'finished';
|
|
725
|
+
/** Common parameters shared by all call device types. */
|
|
508
726
|
interface CallDeviceCommonParams {
|
|
727
|
+
/** Optional SIP headers to include in the call setup. */
|
|
509
728
|
headers?: unknown[];
|
|
510
729
|
}
|
|
730
|
+
/** Parameters for a WebRTC or SIP call device. */
|
|
511
731
|
interface CallDeviceWebRTCOrSIPParams extends CallDeviceCommonParams {
|
|
732
|
+
/** Source address or URI for the call. */
|
|
512
733
|
from: string;
|
|
734
|
+
/** Destination address or URI for the call. */
|
|
513
735
|
to: string;
|
|
514
736
|
}
|
|
737
|
+
/** Parameters for a phone (PSTN) call device. */
|
|
515
738
|
interface CallDevicePhoneParams extends CallDeviceCommonParams {
|
|
739
|
+
/** Caller phone number (E.164 format). */
|
|
516
740
|
from_number: string;
|
|
741
|
+
/** Destination phone number (E.164 format). */
|
|
517
742
|
to_number: string;
|
|
518
743
|
}
|
|
744
|
+
/** A WebRTC or SIP call device descriptor. */
|
|
519
745
|
interface CallDeviceWebRTCOrSIP {
|
|
746
|
+
/** Transport type for the device. */
|
|
520
747
|
type: 'webrtc' | 'sip';
|
|
748
|
+
/** Connection parameters for the device. */
|
|
521
749
|
params: CallDeviceWebRTCOrSIPParams;
|
|
522
750
|
}
|
|
751
|
+
/** A phone (PSTN) call device descriptor. */
|
|
523
752
|
interface CallDevicePhone {
|
|
753
|
+
/** Transport type for the device. */
|
|
524
754
|
type: 'phone';
|
|
755
|
+
/** Connection parameters for the device. */
|
|
525
756
|
params: CallDevicePhoneParams;
|
|
526
757
|
}
|
|
758
|
+
/** Discriminated union of call device types (WebRTC, SIP, or phone). */
|
|
527
759
|
type CallDevice = CallDeviceWebRTCOrSIP | CallDevicePhone;
|
|
760
|
+
/**
|
|
761
|
+
* Feature capability string that controls what actions a participant can perform.
|
|
762
|
+
*
|
|
763
|
+
* Capabilities are organized into categories:
|
|
764
|
+
* - **self.\*** — Actions the local participant can perform on themselves (mute, deaf, volume, position, meta).
|
|
765
|
+
* - **member.\*** — Actions that can be performed on other participants.
|
|
766
|
+
* - **layout.\*** — Layout management for the video canvas.
|
|
767
|
+
* - **digit.\*** — DTMF digit sending.
|
|
768
|
+
* - **vmuted.\*** — Visibility control for muted video participants.
|
|
769
|
+
* - **lock.\*** — Room lock/unlock control.
|
|
770
|
+
* - **device** / **screenshare** — Device and screen share capabilities.
|
|
771
|
+
* - **end** — Permission to end the call or room.
|
|
772
|
+
*/
|
|
773
|
+
type Capability = 'self' | 'self.mute' | 'self.mute.audio' | 'self.mute.audio.on' | 'self.mute.audio.off' | 'self.mute.video' | 'self.mute.video.on' | 'self.mute.video.off' | 'self.deaf' | 'self.deaf.on' | 'self.deaf.off' | 'self.microphone' | 'self.microphone.volume.set' | 'self.microphone.sensitivity.set' | 'self.speaker' | 'self.speaker.volume.set' | 'self.position.set' | 'self.meta' | 'self.audioflags.set' | 'member' | 'member.mute' | 'member.mute.audio' | 'member.mute.audio.on' | 'member.mute.audio.off' | 'member.mute.video' | 'member.mute.video.on' | 'member.mute.video.off' | 'member.deaf' | 'member.deaf.on' | 'member.deaf.off' | 'member.microphone' | 'member.microphone.volume.set' | 'member.microphone.sensitivity.set' | 'member.speaker' | 'member.speaker.volume.set' | 'member.position.set' | 'member.meta' | 'member.audioflags.set' | 'layout' | 'layout.set' | 'digit' | 'digit.send' | 'vmuted' | 'vmuted.hide' | 'vmuted.hide.on' | 'vmuted.hide.off' | 'lock' | 'lock.on' | 'lock.off' | 'device' | 'screenshare' | 'end';
|
|
774
|
+
/**
|
|
775
|
+
* Position of a participant's video within the layout canvas.
|
|
776
|
+
*
|
|
777
|
+
* - `'auto'` — Automatically positioned by the layout engine.
|
|
778
|
+
* - `` `reserved-${number}` `` — A reserved slot in the layout (e.g., `'reserved-0'`).
|
|
779
|
+
* - `` `standard-${number}` `` — A standard slot in the layout (e.g., `'standard-1'`).
|
|
780
|
+
* - `'off-canvas'` — Participant is not visible in the layout.
|
|
781
|
+
* - `'playback'` — Playback position for media streams.
|
|
782
|
+
* - `'full-screen'` — Participant occupies the entire canvas.
|
|
783
|
+
*/
|
|
528
784
|
type VideoPosition = 'auto' | `reserved-${number}` | `standard-${number}` | 'off-canvas' | 'playback' | 'full-screen';
|
|
529
785
|
//#endregion
|
|
530
786
|
//#region src/core/RPCMessages/types/common.d.ts
|
|
@@ -674,6 +930,11 @@ interface CallUpdatedPayload {
|
|
|
674
930
|
room_id: string;
|
|
675
931
|
room_session_id: string;
|
|
676
932
|
}
|
|
933
|
+
interface RoomUpdatedPayload {
|
|
934
|
+
room_session: RoomSession;
|
|
935
|
+
room_id: string;
|
|
936
|
+
room_session_id: string;
|
|
937
|
+
}
|
|
677
938
|
interface CallStatePayload {
|
|
678
939
|
call_id: string;
|
|
679
940
|
node_id: string;
|
|
@@ -749,17 +1010,17 @@ declare class EntityCollection<T extends Entity = Entity> extends Destroyable im
|
|
|
749
1010
|
private fetchController;
|
|
750
1011
|
private update$;
|
|
751
1012
|
private readonly onError?;
|
|
752
|
-
loading$: rxjs0.BehaviorSubject<boolean>;
|
|
753
|
-
values$: ReplaySubject<T[]>;
|
|
754
1013
|
hasMore$: Observable<boolean>;
|
|
755
1014
|
private collectionData;
|
|
756
1015
|
private observablesRegistry;
|
|
757
|
-
private updateSubscription;
|
|
758
1016
|
private upsertData;
|
|
1017
|
+
private _loading$;
|
|
1018
|
+
private _values$;
|
|
759
1019
|
private _hasMore$;
|
|
760
|
-
private _destroy$;
|
|
761
1020
|
constructor(fetchController: FetchController<T>, update$: Observable<Partial<T>>, onError?: ((error: Error) => void) | undefined);
|
|
1021
|
+
get loading$(): Observable<boolean>;
|
|
762
1022
|
get loading(): boolean;
|
|
1023
|
+
get values$(): Observable<T[]>;
|
|
763
1024
|
get hasMore(): boolean;
|
|
764
1025
|
get updated$(): Observable<void>;
|
|
765
1026
|
get values(): T[];
|
|
@@ -789,6 +1050,35 @@ declare class EntityCollectionTransformed<O extends Entity = Entity, T extends E
|
|
|
789
1050
|
destroy(): void;
|
|
790
1051
|
}
|
|
791
1052
|
//#endregion
|
|
1053
|
+
//#region src/core/entities/types/participant.types.d.ts
|
|
1054
|
+
/** Options for selecting a media device. */
|
|
1055
|
+
interface SelectDeviceOptions {
|
|
1056
|
+
savePreference?: boolean;
|
|
1057
|
+
}
|
|
1058
|
+
//#endregion
|
|
1059
|
+
//#region src/controllers/RTCStatsMonitor.d.ts
|
|
1060
|
+
interface NetworkIssue {
|
|
1061
|
+
type: 'no_inbound_audio' | 'no_inbound_video' | 'high_rtt' | 'high_packet_loss' | 'high_jitter' | 'ice_disconnected';
|
|
1062
|
+
severity: 'warning' | 'critical';
|
|
1063
|
+
timestamp: number;
|
|
1064
|
+
value?: number;
|
|
1065
|
+
threshold?: number;
|
|
1066
|
+
}
|
|
1067
|
+
interface NetworkMetrics {
|
|
1068
|
+
timestamp: number;
|
|
1069
|
+
audio: {
|
|
1070
|
+
packetsReceived: number;
|
|
1071
|
+
packetsLost: number;
|
|
1072
|
+
jitter: number;
|
|
1073
|
+
};
|
|
1074
|
+
video: {
|
|
1075
|
+
packetsReceived: number;
|
|
1076
|
+
packetsLost: number;
|
|
1077
|
+
};
|
|
1078
|
+
roundTripTime: number;
|
|
1079
|
+
availableOutgoingBitrate?: number;
|
|
1080
|
+
}
|
|
1081
|
+
//#endregion
|
|
792
1082
|
//#region src/managers/types/verto-manager.types.d.ts
|
|
793
1083
|
type ScreenShareStatus = 'none' | 'starting' | 'started' | 'stopping';
|
|
794
1084
|
type SignalingStatus = Extract<CallStatus, 'trying' | 'ringing' | 'connecting' | 'connected' | 'disconnected' | 'failed'>;
|
|
@@ -861,19 +1151,306 @@ declare class MediaTrackError extends Error {
|
|
|
861
1151
|
originalError: unknown;
|
|
862
1152
|
constructor(operation: string, kind: string, originalError: unknown);
|
|
863
1153
|
}
|
|
1154
|
+
declare class DPoPInitError extends Error {
|
|
1155
|
+
originalError: unknown;
|
|
1156
|
+
constructor(originalError: unknown, message?: string);
|
|
1157
|
+
}
|
|
1158
|
+
/**
|
|
1159
|
+
* Error thrown when a recovery attempt fails.
|
|
1160
|
+
*
|
|
1161
|
+
* Carries the recovery action and attempt number for diagnostic purposes.
|
|
1162
|
+
*/
|
|
1163
|
+
declare class RecoveryError extends Error {
|
|
1164
|
+
action: string;
|
|
1165
|
+
attempt: number;
|
|
1166
|
+
originalError?: unknown | undefined;
|
|
1167
|
+
constructor(action: string, attempt: number, originalError?: unknown | undefined);
|
|
1168
|
+
}
|
|
1169
|
+
/**
|
|
1170
|
+
* Error thrown when getUserMedia fails with OverconstrainedError
|
|
1171
|
+
* and all fallback levels have been exhausted.
|
|
1172
|
+
*/
|
|
1173
|
+
declare class OverconstrainedFallbackError extends Error {
|
|
1174
|
+
deviceKind: string;
|
|
1175
|
+
originalError?: unknown | undefined;
|
|
1176
|
+
constructor(deviceKind: string, originalError?: unknown | undefined);
|
|
1177
|
+
}
|
|
1178
|
+
/**
|
|
1179
|
+
* Error thrown when the preflight connectivity test fails.
|
|
1180
|
+
*/
|
|
1181
|
+
declare class PreflightError extends Error {
|
|
1182
|
+
phase: string;
|
|
1183
|
+
originalError?: unknown | undefined;
|
|
1184
|
+
constructor(phase: string, originalError?: unknown | undefined);
|
|
1185
|
+
}
|
|
1186
|
+
declare class DeviceTokenError extends Error {
|
|
1187
|
+
originalError?: unknown | undefined;
|
|
1188
|
+
constructor(message: string, originalError?: unknown | undefined);
|
|
1189
|
+
}
|
|
1190
|
+
declare class TokenRefreshError extends Error {
|
|
1191
|
+
originalError?: unknown | undefined;
|
|
1192
|
+
constructor(message: string, originalError?: unknown | undefined);
|
|
1193
|
+
}
|
|
1194
|
+
//#endregion
|
|
1195
|
+
//#region src/core/types/resilience.types.d.ts
|
|
1196
|
+
/**
|
|
1197
|
+
* Types for SDK resilience, recovery, diagnostics, and quality monitoring.
|
|
1198
|
+
*
|
|
1199
|
+
* These types support:
|
|
1200
|
+
* - WebRTC stats monitoring (Section 1)
|
|
1201
|
+
* - Tiered recovery system (Section 2)
|
|
1202
|
+
* - Device recovery events (Section 5)
|
|
1203
|
+
* - Tab visibility handling (Section 4)
|
|
1204
|
+
* - Audio/video constraint management (Section 16)
|
|
1205
|
+
* - Network resilience & recovery pipeline (Section 19)
|
|
1206
|
+
* - Preflight connectivity test (Section 20)
|
|
1207
|
+
* - Call quality score (Section 21)
|
|
1208
|
+
* - Graceful degradation (Section 22)
|
|
1209
|
+
* - Platform capability detection (Section 24)
|
|
1210
|
+
* - Structured diagnostic log export (Section 26)
|
|
1211
|
+
*/
|
|
1212
|
+
/** Simplified quality level for UI indicators, derived from MOS score. */
|
|
1213
|
+
type QualityLevel = 'excellent' | 'good' | 'fair' | 'poor' | 'critical';
|
|
1214
|
+
/**
|
|
1215
|
+
* Extended call status that includes the 'recovering' state.
|
|
1216
|
+
*
|
|
1217
|
+
* Used when the SDK is attempting to recover a call after a network
|
|
1218
|
+
* disruption or media failure.
|
|
1219
|
+
*/
|
|
1220
|
+
type ResilienceCallStatus = 'new' | 'trying' | 'ringing' | 'connecting' | 'connected' | 'recovering' | 'disconnecting' | 'disconnected' | 'failed' | 'destroyed';
|
|
1221
|
+
type NetworkMetrics$1 = NetworkMetrics;
|
|
1222
|
+
/** Event emitted when a recovery action is taken on a call. */
|
|
1223
|
+
interface RecoveryEvent {
|
|
1224
|
+
/** The recovery action that was taken. */
|
|
1225
|
+
readonly action: 'keyframe_requested' | 'reinvite_started' | 'reinvite_succeeded' | 'reinvite_failed' | 'reinvite_timeout' | 'max_attempts_reached' | 'call_recovering' | 'call_recovered' | 'call_recovery_failed' | 'signal_reconnect' | 'full_reconnect' | 'video_disabled' | 'video_restored';
|
|
1226
|
+
/** Human-readable description of why recovery was triggered. */
|
|
1227
|
+
readonly reason: string;
|
|
1228
|
+
/** Current attempt number (for multi-attempt recoveries). */
|
|
1229
|
+
readonly attempt?: number;
|
|
1230
|
+
/** Maximum number of attempts allowed. */
|
|
1231
|
+
readonly maxAttempts?: number;
|
|
1232
|
+
/** Timestamp when the event occurred (epoch ms). */
|
|
1233
|
+
readonly timestamp: number;
|
|
1234
|
+
}
|
|
1235
|
+
/** State of the recovery pipeline state machine (Section 19.7). */
|
|
1236
|
+
type RecoveryState = 'idle' | 'debouncing' | 'recovering' | 'cooldown';
|
|
1237
|
+
/** Event emitted when the SDK auto-switches a device. */
|
|
1238
|
+
interface DeviceRecoveryEvent {
|
|
1239
|
+
/** The kind of device that was switched. */
|
|
1240
|
+
readonly kind: 'audioinput' | 'audiooutput' | 'videoinput';
|
|
1241
|
+
/** The device that was previously selected (null if none). */
|
|
1242
|
+
readonly previousDevice: MediaDeviceInfo | null;
|
|
1243
|
+
/** The device that was selected as a replacement (null if none available). */
|
|
1244
|
+
readonly newDevice: MediaDeviceInfo | null;
|
|
1245
|
+
/** The reason for the device switch. */
|
|
1246
|
+
readonly reason: 'device_disconnected' | 'device_reconnected' | 'session_restored' | 'fallback_to_default' | 'default_changed' | 'ambiguous_match';
|
|
1247
|
+
}
|
|
1248
|
+
/**
|
|
1249
|
+
* Serializable subset of MediaDeviceInfo for persistence.
|
|
1250
|
+
*
|
|
1251
|
+
* The browser's MediaDeviceInfo interface is not serializable.
|
|
1252
|
+
* This stores the fields needed for device recovery across sessions.
|
|
1253
|
+
*/
|
|
1254
|
+
interface StoredDevicePreference {
|
|
1255
|
+
/** The device ID. */
|
|
1256
|
+
readonly deviceId: string;
|
|
1257
|
+
/** The human-readable label. */
|
|
1258
|
+
readonly label: string;
|
|
1259
|
+
/** The device kind. */
|
|
1260
|
+
readonly kind: MediaDeviceKind;
|
|
1261
|
+
/** The group ID (identifies the physical device). */
|
|
1262
|
+
readonly groupId: string;
|
|
1263
|
+
}
|
|
1264
|
+
/** Result of a media permissions request (Section 5.10). */
|
|
1265
|
+
interface PermissionResult {
|
|
1266
|
+
/** Whether audio permission was granted. */
|
|
1267
|
+
readonly audio: boolean;
|
|
1268
|
+
/** Whether video permission was granted. */
|
|
1269
|
+
readonly video: boolean;
|
|
1270
|
+
/** The audio device the user selected in the browser picker, if any. */
|
|
1271
|
+
readonly selectedAudioDevice?: MediaDeviceInfo;
|
|
1272
|
+
/** The video device the user selected in the browser picker, if any. */
|
|
1273
|
+
readonly selectedVideoDevice?: MediaDeviceInfo;
|
|
1274
|
+
}
|
|
1275
|
+
/** Event emitted when getUserMedia falls back to looser constraints. */
|
|
1276
|
+
interface ConstraintFallbackEvent {
|
|
1277
|
+
/** The kind of input device. */
|
|
1278
|
+
readonly kind: 'audioinput' | 'videoinput';
|
|
1279
|
+
/** The device that was originally requested. */
|
|
1280
|
+
readonly requestedDevice: MediaDeviceInfo | null;
|
|
1281
|
+
/** The device that the browser actually provided. */
|
|
1282
|
+
readonly actualDevice: MediaDeviceInfo | null;
|
|
1283
|
+
/** The constraint level that succeeded. */
|
|
1284
|
+
readonly fallbackLevel: 'exact' | 'preferred' | 'default';
|
|
1285
|
+
}
|
|
1286
|
+
/** Browser/platform WebRTC capability flags. */
|
|
1287
|
+
interface PlatformCapabilities {
|
|
1288
|
+
/** Whether screen sharing is supported. */
|
|
1289
|
+
readonly screenShare: boolean;
|
|
1290
|
+
/** Whether screen share can include system audio (Chrome-only). */
|
|
1291
|
+
readonly screenShareAudio: boolean;
|
|
1292
|
+
/** Whether simulcast is supported. */
|
|
1293
|
+
readonly simulcast: boolean;
|
|
1294
|
+
/** Whether insertable streams / encoded transforms are available. */
|
|
1295
|
+
readonly insertableStreams: boolean;
|
|
1296
|
+
/** Whether setSinkId (audio output selection) is supported. */
|
|
1297
|
+
readonly audioOutputSelection: boolean;
|
|
1298
|
+
/** List of supported video codecs. */
|
|
1299
|
+
readonly videoCodecs: readonly string[];
|
|
1300
|
+
/** List of supported audio codecs. */
|
|
1301
|
+
readonly audioCodecs: readonly string[];
|
|
1302
|
+
/** Whether the browser supports WebRTC at all. */
|
|
1303
|
+
readonly webrtc: boolean;
|
|
1304
|
+
/** Whether getUserMedia is available. */
|
|
1305
|
+
readonly getUserMedia: boolean;
|
|
1306
|
+
/** Whether getDisplayMedia is available. */
|
|
1307
|
+
readonly getDisplayMedia: boolean;
|
|
1308
|
+
}
|
|
1309
|
+
/** Options for the preflight connectivity test. */
|
|
1310
|
+
interface PreflightOptions {
|
|
1311
|
+
/** How long to run the media test in seconds (default: 10). */
|
|
1312
|
+
readonly duration?: number;
|
|
1313
|
+
/** Skip the media/bandwidth test, only test signaling + TURN + devices. */
|
|
1314
|
+
readonly skipMediaTest?: boolean;
|
|
1315
|
+
/** Test a specific audio device instead of the currently selected one. */
|
|
1316
|
+
readonly audioDevice?: MediaDeviceInfo;
|
|
1317
|
+
/** Test a specific video device instead of the currently selected one. */
|
|
1318
|
+
readonly videoDevice?: MediaDeviceInfo;
|
|
1319
|
+
}
|
|
1320
|
+
/** Results of a preflight connectivity test. */
|
|
1321
|
+
interface PreflightResult {
|
|
1322
|
+
/** Overall pass/fail. */
|
|
1323
|
+
readonly ok: boolean;
|
|
1324
|
+
/** Signaling server reachability. */
|
|
1325
|
+
readonly signaling: {
|
|
1326
|
+
readonly reachable: boolean;
|
|
1327
|
+
readonly rttMs: number;
|
|
1328
|
+
};
|
|
1329
|
+
/** ICE/TURN connectivity. */
|
|
1330
|
+
readonly connectivity: {
|
|
1331
|
+
/** 'direct' = host/srflx worked, 'relay' = only TURN relay, 'failed' = nothing. */
|
|
1332
|
+
readonly type: 'direct' | 'relay' | 'failed';
|
|
1333
|
+
/** Whether TURN servers are reachable. */
|
|
1334
|
+
readonly turnReachable: boolean;
|
|
1335
|
+
/** Whether STUN servers are reachable. */
|
|
1336
|
+
readonly stunReachable: boolean;
|
|
1337
|
+
/** RTT to media server in ms. */
|
|
1338
|
+
readonly rttMs: number;
|
|
1339
|
+
};
|
|
1340
|
+
/** Bandwidth estimation (null if skipMediaTest). */
|
|
1341
|
+
readonly bandwidth: {
|
|
1342
|
+
readonly uploadKbps: number;
|
|
1343
|
+
readonly downloadKbps: number;
|
|
1344
|
+
} | null;
|
|
1345
|
+
/** Device test results. */
|
|
1346
|
+
readonly devices: {
|
|
1347
|
+
readonly audioInput: {
|
|
1348
|
+
readonly working: boolean;
|
|
1349
|
+
readonly device: MediaDeviceInfo | null;
|
|
1350
|
+
};
|
|
1351
|
+
readonly videoInput: {
|
|
1352
|
+
readonly working: boolean;
|
|
1353
|
+
readonly device: MediaDeviceInfo | null;
|
|
1354
|
+
};
|
|
1355
|
+
readonly audioOutput: {
|
|
1356
|
+
readonly available: boolean;
|
|
1357
|
+
readonly device: MediaDeviceInfo | null;
|
|
1358
|
+
};
|
|
1359
|
+
};
|
|
1360
|
+
/** Human-readable warnings. */
|
|
1361
|
+
readonly warnings: readonly string[];
|
|
1362
|
+
}
|
|
1363
|
+
/** Event emitted when audio constraints change on a call. */
|
|
1364
|
+
interface AudioConstraintsEvent {
|
|
1365
|
+
/** The new constraints applied. */
|
|
1366
|
+
readonly constraints: MediaTrackConstraints;
|
|
1367
|
+
/** How the constraints were applied. */
|
|
1368
|
+
readonly method: 'applyConstraints' | 'trackReplacement';
|
|
1369
|
+
/** Timestamp when the event occurred (epoch ms). */
|
|
1370
|
+
readonly timestamp: number;
|
|
1371
|
+
}
|
|
1372
|
+
/** Event emitted when server-pushed media params are applied. */
|
|
1373
|
+
interface MediaParamsEvent {
|
|
1374
|
+
/** Audio constraints pushed by the server, if any. */
|
|
1375
|
+
readonly audio?: MediaTrackConstraints;
|
|
1376
|
+
/** Video constraints pushed by the server, if any. */
|
|
1377
|
+
readonly video?: MediaTrackConstraints;
|
|
1378
|
+
/** Timestamp when the event occurred (epoch ms). */
|
|
1379
|
+
readonly timestamp: number;
|
|
1380
|
+
}
|
|
1381
|
+
/** Structured diagnostic bundle for a session. */
|
|
1382
|
+
interface SessionDiagnostics {
|
|
1383
|
+
/** SDK version. */
|
|
1384
|
+
readonly sdkVersion: string;
|
|
1385
|
+
/** Browser/platform user agent string. */
|
|
1386
|
+
readonly userAgent: string;
|
|
1387
|
+
/** Platform capabilities detected at construction time. */
|
|
1388
|
+
readonly capabilities: PlatformCapabilities;
|
|
1389
|
+
/** Timeline of significant events during the session. */
|
|
1390
|
+
readonly events: readonly DiagnosticEvent[];
|
|
1391
|
+
/** Quality summary per call. */
|
|
1392
|
+
readonly calls: readonly CallDiagnosticSummary[];
|
|
1393
|
+
/** Device changes that occurred during the session. */
|
|
1394
|
+
readonly deviceChanges: readonly DeviceRecoveryEvent[];
|
|
1395
|
+
/** Current device list snapshot. */
|
|
1396
|
+
readonly devices: {
|
|
1397
|
+
readonly audioInput: readonly MediaDeviceInfo[];
|
|
1398
|
+
readonly audioOutput: readonly MediaDeviceInfo[];
|
|
1399
|
+
readonly videoInput: readonly MediaDeviceInfo[];
|
|
1400
|
+
};
|
|
1401
|
+
}
|
|
1402
|
+
/** A single diagnostic event in the session timeline. */
|
|
1403
|
+
interface DiagnosticEvent {
|
|
1404
|
+
/** Timestamp when the event occurred (epoch ms). */
|
|
1405
|
+
readonly timestamp: number;
|
|
1406
|
+
/** Category of the event. */
|
|
1407
|
+
readonly category: 'connection' | 'call' | 'device' | 'recovery' | 'error';
|
|
1408
|
+
/** Event description string. */
|
|
1409
|
+
readonly event: string;
|
|
1410
|
+
/** Additional details about the event. */
|
|
1411
|
+
readonly details?: Readonly<Record<string, unknown>>;
|
|
1412
|
+
}
|
|
1413
|
+
/** Quality summary for a single call in the diagnostic bundle. */
|
|
1414
|
+
interface CallDiagnosticSummary {
|
|
1415
|
+
/** Unique call ID. */
|
|
1416
|
+
readonly callId: string;
|
|
1417
|
+
/** Whether the call was inbound or outbound. */
|
|
1418
|
+
readonly direction: 'inbound' | 'outbound';
|
|
1419
|
+
/** The destination dialed, if outbound. */
|
|
1420
|
+
readonly destination?: string;
|
|
1421
|
+
/** Total call duration in seconds. */
|
|
1422
|
+
readonly duration: number;
|
|
1423
|
+
/** Final call status. */
|
|
1424
|
+
readonly status: string;
|
|
1425
|
+
/** Average MOS quality score over the call. */
|
|
1426
|
+
readonly avgQualityScore: number;
|
|
1427
|
+
/** Worst (minimum) MOS quality score during the call. */
|
|
1428
|
+
readonly minQualityScore: number;
|
|
1429
|
+
/** Number of recovery attempts made during the call. */
|
|
1430
|
+
readonly recoveryAttempts: number;
|
|
1431
|
+
/** ICE candidate types that were used. */
|
|
1432
|
+
readonly iceCandidateTypes: readonly string[];
|
|
1433
|
+
/** Final network metrics snapshot at call end. */
|
|
1434
|
+
readonly finalMetrics: NetworkMetrics$1;
|
|
1435
|
+
}
|
|
864
1436
|
//#endregion
|
|
865
1437
|
//#region src/core/RPCMessages/RPCConnect.d.ts
|
|
866
1438
|
interface Authorization {
|
|
867
1439
|
jti: string;
|
|
868
1440
|
project_id: string;
|
|
1441
|
+
data_zone?: string;
|
|
1442
|
+
scope?: string[];
|
|
869
1443
|
fabric_subscriber: {
|
|
870
1444
|
version: number;
|
|
871
1445
|
expires_at: number;
|
|
872
1446
|
subscriber_id: string;
|
|
873
|
-
application_id: string;
|
|
1447
|
+
application_id: string | null;
|
|
874
1448
|
project_id: string;
|
|
875
1449
|
space_id: string;
|
|
876
1450
|
};
|
|
1451
|
+
cnf?: {
|
|
1452
|
+
jkt: string;
|
|
1453
|
+
};
|
|
877
1454
|
}
|
|
878
1455
|
//#endregion
|
|
879
1456
|
//#region src/core/utils.d.ts
|
|
@@ -1000,40 +1577,107 @@ declare class SelfCapabilities extends Destroyable {
|
|
|
1000
1577
|
get state(): CallCapabilitiesState;
|
|
1001
1578
|
}
|
|
1002
1579
|
//#endregion
|
|
1003
|
-
//#region src/core/entities/types/participant.types.d.ts
|
|
1004
|
-
interface SelectDeviceOptions {
|
|
1005
|
-
savePreference?: boolean;
|
|
1006
|
-
}
|
|
1007
|
-
//#endregion
|
|
1008
1580
|
//#region src/interfaces/DeviceController.d.ts
|
|
1009
1581
|
/**
|
|
1010
|
-
*
|
|
1011
|
-
*
|
|
1582
|
+
* Interface for media device management.
|
|
1583
|
+
*
|
|
1584
|
+
* Provides reactive access to available media devices, device selection,
|
|
1585
|
+
* and monitoring for device changes (connect/disconnect).
|
|
1012
1586
|
*/
|
|
1013
1587
|
interface DeviceController {
|
|
1588
|
+
/** Observable list of available audio input (microphone) devices. */
|
|
1014
1589
|
readonly audioInputDevices$: Observable<MediaDeviceInfo[]>;
|
|
1590
|
+
/** Observable list of available audio output (speaker) devices. */
|
|
1015
1591
|
readonly audioOutputDevices$: Observable<MediaDeviceInfo[]>;
|
|
1592
|
+
/** Observable list of available video input (camera) devices. */
|
|
1016
1593
|
readonly videoInputDevices$: Observable<MediaDeviceInfo[]>;
|
|
1594
|
+
/** Observable of the currently selected audio input device, or `null` if none. */
|
|
1017
1595
|
readonly selectedAudioInputDevice$: Observable<MediaDeviceInfo | null>;
|
|
1596
|
+
/** Observable of the currently selected audio output device, or `null` if none. */
|
|
1018
1597
|
readonly selectedAudioOutputDevice$: Observable<MediaDeviceInfo | null>;
|
|
1598
|
+
/** Observable of the currently selected video input device, or `null` if none. */
|
|
1019
1599
|
readonly selectedVideoInputDevice$: Observable<MediaDeviceInfo | null>;
|
|
1600
|
+
/** Currently selected audio input device, or `null` if none. */
|
|
1020
1601
|
readonly selectedAudioInputDevice: MediaDeviceInfo | null;
|
|
1602
|
+
/** Currently selected audio output device, or `null` if none. */
|
|
1021
1603
|
readonly selectedAudioOutputDevice: MediaDeviceInfo | null;
|
|
1604
|
+
/** Currently selected video input device, or `null` if none. */
|
|
1022
1605
|
readonly selectedVideoInputDevice: MediaDeviceInfo | null;
|
|
1606
|
+
/** Current snapshot of available audio input devices. */
|
|
1023
1607
|
readonly audioInputDevices: MediaDeviceInfo[];
|
|
1608
|
+
/** Current snapshot of available audio output devices. */
|
|
1024
1609
|
readonly audioOutputDevices: MediaDeviceInfo[];
|
|
1610
|
+
/** Current snapshot of available video input devices. */
|
|
1025
1611
|
readonly videoInputDevices: MediaDeviceInfo[];
|
|
1026
|
-
|
|
1027
|
-
readonly
|
|
1612
|
+
/** Media track constraints for the selected audio input device. Returns `false` when disabled. */
|
|
1613
|
+
readonly selectedAudioInputDeviceConstraints: MediaTrackConstraints | boolean;
|
|
1614
|
+
/** Media track constraints for the selected video input device. Returns `false` when disabled. */
|
|
1615
|
+
readonly selectedVideoInputDeviceConstraints: MediaTrackConstraints | boolean;
|
|
1616
|
+
/**
|
|
1617
|
+
* Converts a {@link MediaDeviceInfo} to track constraints suitable for `getUserMedia`.
|
|
1618
|
+
* @param deviceInfo - The device to convert, or `null` for default constraints.
|
|
1619
|
+
*/
|
|
1028
1620
|
deviceInfoToConstraints(deviceInfo: MediaDeviceInfo | null): MediaTrackConstraints;
|
|
1621
|
+
/**
|
|
1622
|
+
* Sets the preferred audio input device for future calls.
|
|
1623
|
+
* @param device - The device to select, or `null` to use the system default.
|
|
1624
|
+
*/
|
|
1029
1625
|
selectAudioInputDevice(device: MediaDeviceInfo | null): void;
|
|
1626
|
+
/**
|
|
1627
|
+
* Sets the preferred video input device for future calls.
|
|
1628
|
+
* @param device - The device to select, or `null` to use the system default.
|
|
1629
|
+
*/
|
|
1030
1630
|
selectVideoInputDevice(device: MediaDeviceInfo | null): void;
|
|
1631
|
+
/**
|
|
1632
|
+
* Sets the preferred audio output device for future calls.
|
|
1633
|
+
* @param device - The device to select, or `null` to use the system default.
|
|
1634
|
+
*/
|
|
1031
1635
|
selectAudioOutputDevice(device: MediaDeviceInfo | null): void;
|
|
1636
|
+
/** Starts monitoring for media device changes (connect/disconnect). */
|
|
1032
1637
|
enableDeviceMonitoring(): void;
|
|
1638
|
+
/** Stops monitoring for media device changes. */
|
|
1033
1639
|
disableDeviceMonitoring(): void;
|
|
1640
|
+
/**
|
|
1641
|
+
* Returns the capabilities of a media device.
|
|
1642
|
+
* @param deviceInfo - The device to query.
|
|
1643
|
+
* @returns The device capabilities, or `null` if unavailable.
|
|
1644
|
+
*/
|
|
1034
1645
|
getDeviceCapabilities(deviceInfo: MediaDeviceInfo): Promise<MediaTrackCapabilities | null>;
|
|
1646
|
+
/**
|
|
1647
|
+
* Checks whether a device is still available and usable.
|
|
1648
|
+
* @param deviceInfo - The device to validate, or `null`.
|
|
1649
|
+
* @returns `true` if the device is valid and available. Returns `false` for `null`, audio output devices, or unavailable devices.
|
|
1650
|
+
*/
|
|
1035
1651
|
isValidDevice(deviceInfo: MediaDeviceInfo | null): Promise<boolean>;
|
|
1652
|
+
/** Observable stream of errors from device enumeration and monitoring. */
|
|
1036
1653
|
readonly errors$: Observable<Error>;
|
|
1654
|
+
/**
|
|
1655
|
+
* Observable that emits when the SDK auto-switches a device due to
|
|
1656
|
+
* disconnect, reconnect, or recovery.
|
|
1657
|
+
*/
|
|
1658
|
+
readonly deviceRecovered$: Observable<DeviceRecoveryEvent>;
|
|
1659
|
+
/** Disables audio input (receive-only mode). No track will be acquired. */
|
|
1660
|
+
disableAudioInput(): void;
|
|
1661
|
+
/** Re-enables audio input, restoring the last selection or auto-selecting. */
|
|
1662
|
+
enableAudioInput(): void;
|
|
1663
|
+
/** Disables video input (receive-only mode). No track will be acquired. */
|
|
1664
|
+
disableVideoInput(): void;
|
|
1665
|
+
/** Re-enables video input, restoring the last selection or auto-selecting. */
|
|
1666
|
+
enableVideoInput(): void;
|
|
1667
|
+
/** Observable that emits `true` when video input is disabled (receive-only). */
|
|
1668
|
+
readonly videoInputDisabled$: Observable<boolean>;
|
|
1669
|
+
/** Observable that emits `true` when audio input is disabled (receive-only). */
|
|
1670
|
+
readonly audioInputDisabled$: Observable<boolean>;
|
|
1671
|
+
/** Whether video input is currently disabled. */
|
|
1672
|
+
readonly videoInputDisabled: boolean;
|
|
1673
|
+
/** Whether audio input is currently disabled. */
|
|
1674
|
+
readonly audioInputDisabled: boolean;
|
|
1675
|
+
/** Injects the storage manager for device persistence. */
|
|
1676
|
+
setStorageManager(storageManager: StorageManager): void;
|
|
1677
|
+
/** Clears all device state (history, selections, persisted prefs) and re-enumerates. */
|
|
1678
|
+
clearDeviceState(): Promise<void>;
|
|
1679
|
+
/** Force a device re-enumeration. */
|
|
1680
|
+
enumerateDevices(): Promise<void>;
|
|
1037
1681
|
}
|
|
1038
1682
|
//#endregion
|
|
1039
1683
|
//#region src/interfaces/VertoManager.d.ts
|
|
@@ -1085,45 +1729,65 @@ declare class Participant extends Destroyable implements CallParticipant {
|
|
|
1085
1729
|
/** @internal */
|
|
1086
1730
|
upnext(data: Partial<ParticipantState>): void;
|
|
1087
1731
|
/** Observable of the participant's display name. */
|
|
1088
|
-
get name$(): Observable<string>;
|
|
1732
|
+
get name$(): Observable<string | undefined>;
|
|
1089
1733
|
/** Observable of the participant type (e.g. `'member'`, `'screen'`). */
|
|
1090
|
-
get type$(): Observable<string>;
|
|
1734
|
+
get type$(): Observable<string | undefined>;
|
|
1091
1735
|
/** Observable indicating whether the participant has raised their hand. */
|
|
1092
|
-
get handraised$(): Observable<boolean>;
|
|
1736
|
+
get handraised$(): Observable<boolean | undefined>;
|
|
1093
1737
|
/** Observable indicating whether the participant is visible in the layout. */
|
|
1094
|
-
get visible$(): Observable<boolean>;
|
|
1738
|
+
get visible$(): Observable<boolean | undefined>;
|
|
1095
1739
|
/** Observable indicating whether the participant's audio is muted. */
|
|
1096
|
-
get audioMuted$(): Observable<boolean>;
|
|
1740
|
+
get audioMuted$(): Observable<boolean | undefined>;
|
|
1097
1741
|
/** Observable indicating whether the participant's video is muted. */
|
|
1098
|
-
get videoMuted$(): Observable<boolean>;
|
|
1742
|
+
get videoMuted$(): Observable<boolean | undefined>;
|
|
1099
1743
|
/** Observable indicating whether the participant is deafened. */
|
|
1100
|
-
get deaf$(): Observable<boolean>;
|
|
1101
|
-
/**
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1744
|
+
get deaf$(): Observable<boolean | undefined>;
|
|
1745
|
+
/**
|
|
1746
|
+
* Observable of the participant's **server-side** microphone input volume
|
|
1747
|
+
* as reported by the mix engine. This is gain applied on the bridged audio
|
|
1748
|
+
* leg (FreeSWITCH channel read volume), NOT the local browser mic. For a
|
|
1749
|
+
* local PC mic control, see {@link Call.setLocalMicrophoneGain}.
|
|
1750
|
+
*
|
|
1751
|
+
* @see {@link setAudioInputVolume}
|
|
1752
|
+
*/
|
|
1753
|
+
get inputVolume$(): Observable<number | undefined>;
|
|
1754
|
+
/**
|
|
1755
|
+
* Observable of the participant's **server-side** speaker output volume as
|
|
1756
|
+
* reported by the mix engine (FreeSWITCH channel write volume). NOT the
|
|
1757
|
+
* local HTML `<audio>` element volume — set that on your own element.
|
|
1758
|
+
*
|
|
1759
|
+
* @see {@link setAudioOutputVolume}
|
|
1760
|
+
*/
|
|
1761
|
+
get outputVolume$(): Observable<number | undefined>;
|
|
1762
|
+
/**
|
|
1763
|
+
* Observable of the **conference-only** microphone energy/gate sensitivity
|
|
1764
|
+
* level for this member. Routes through the conferencing mix engine and has
|
|
1765
|
+
* no effect on 1:1 WebRTC calls. Populated from `member.updated` events for
|
|
1766
|
+
* conference members.
|
|
1767
|
+
*
|
|
1768
|
+
* @see {@link setAudioInputSensitivity}
|
|
1769
|
+
*/
|
|
1770
|
+
get inputSensitivity$(): Observable<number | undefined>;
|
|
1107
1771
|
/** Observable indicating whether echo cancellation is enabled. */
|
|
1108
|
-
get echoCancellation$(): Observable<boolean>;
|
|
1772
|
+
get echoCancellation$(): Observable<boolean | undefined>;
|
|
1109
1773
|
/** Observable indicating whether auto-gain control is enabled. */
|
|
1110
|
-
get autoGain$(): Observable<boolean>;
|
|
1774
|
+
get autoGain$(): Observable<boolean | undefined>;
|
|
1111
1775
|
/** Observable indicating whether noise suppression is enabled. */
|
|
1112
|
-
get noiseSuppression$(): Observable<boolean>;
|
|
1776
|
+
get noiseSuppression$(): Observable<boolean | undefined>;
|
|
1113
1777
|
/** Observable indicating whether low-bitrate mode is active. */
|
|
1114
|
-
get lowbitrate$(): Observable<boolean>;
|
|
1778
|
+
get lowbitrate$(): Observable<boolean | undefined>;
|
|
1115
1779
|
/** Observable indicating whether noise reduction is active. */
|
|
1116
|
-
get denoise$(): Observable<boolean>;
|
|
1780
|
+
get denoise$(): Observable<boolean | undefined>;
|
|
1117
1781
|
/** Observable of custom metadata for this participant. */
|
|
1118
|
-
get meta$(): Observable<Record<string, unknown
|
|
1119
|
-
/** Observable of the participant's
|
|
1120
|
-
get
|
|
1782
|
+
get meta$(): Observable<Record<string, unknown> | undefined>;
|
|
1783
|
+
/** Observable of the participant's user ID. */
|
|
1784
|
+
get userId$(): Observable<string | undefined>;
|
|
1121
1785
|
/** Observable of the participant's address ID. */
|
|
1122
|
-
get addressId$(): Observable<string>;
|
|
1786
|
+
get addressId$(): Observable<string | undefined>;
|
|
1123
1787
|
/** Observable of the server node ID for this participant. */
|
|
1124
|
-
get nodeId$(): Observable<string>;
|
|
1788
|
+
get nodeId$(): Observable<string | undefined>;
|
|
1125
1789
|
/** Observable indicating whether the participant is currently speaking. */
|
|
1126
|
-
get isTalking$(): Observable<boolean>;
|
|
1790
|
+
get isTalking$(): Observable<boolean | undefined>;
|
|
1127
1791
|
/** Whether the participant is currently speaking. */
|
|
1128
1792
|
get isTalking(): boolean;
|
|
1129
1793
|
/** Observable of the participant's layout position. */
|
|
@@ -1136,22 +1800,49 @@ declare class Participant extends Destroyable implements CallParticipant {
|
|
|
1136
1800
|
get name(): string | undefined;
|
|
1137
1801
|
/** Participant type (e.g. `'member'`, `'screen'`). */
|
|
1138
1802
|
get type(): string | undefined;
|
|
1803
|
+
/** Whether the participant has raised their hand. */
|
|
1139
1804
|
get handraised(): boolean;
|
|
1805
|
+
/** Whether the participant is visible in the layout. */
|
|
1140
1806
|
get visible(): boolean;
|
|
1807
|
+
/** Whether the participant's audio is muted. */
|
|
1141
1808
|
get audioMuted(): boolean;
|
|
1809
|
+
/** Whether the participant's video is muted. */
|
|
1142
1810
|
get videoMuted(): boolean;
|
|
1811
|
+
/** Whether the participant is deafened (incoming audio muted). */
|
|
1143
1812
|
get deaf(): boolean;
|
|
1813
|
+
/**
|
|
1814
|
+
* Current **server-side** microphone input volume as reported by the mix
|
|
1815
|
+
* engine, or `undefined` if not set. Not the local PC mic — see
|
|
1816
|
+
* {@link Call.setLocalMicrophoneGain} for browser-side control.
|
|
1817
|
+
*/
|
|
1144
1818
|
get inputVolume(): number | undefined;
|
|
1819
|
+
/**
|
|
1820
|
+
* Current **server-side** speaker output volume from the mix engine, or
|
|
1821
|
+
* `undefined` if not set. Not the local `<audio>` element volume.
|
|
1822
|
+
*/
|
|
1145
1823
|
get outputVolume(): number | undefined;
|
|
1824
|
+
/**
|
|
1825
|
+
* Current **conference-only** microphone sensitivity/gate level, or
|
|
1826
|
+
* `undefined` if not set. Applies only to conference members.
|
|
1827
|
+
*/
|
|
1146
1828
|
get inputSensitivity(): number | undefined;
|
|
1829
|
+
/** Whether echo cancellation is enabled. */
|
|
1147
1830
|
get echoCancellation(): boolean;
|
|
1831
|
+
/** Whether automatic gain control is enabled. */
|
|
1148
1832
|
get autoGain(): boolean;
|
|
1833
|
+
/** Whether noise suppression is enabled. */
|
|
1149
1834
|
get noiseSuppression(): boolean;
|
|
1835
|
+
/** Whether low-bitrate mode is active. */
|
|
1150
1836
|
get lowbitrate(): boolean;
|
|
1837
|
+
/** Whether noise reduction (denoise) is active. */
|
|
1151
1838
|
get denoise(): boolean;
|
|
1839
|
+
/** Custom metadata for this participant, or `undefined` if not set. */
|
|
1152
1840
|
get meta(): Record<string, unknown> | undefined;
|
|
1153
|
-
|
|
1841
|
+
/** User ID of this participant, or `undefined` if not available. */
|
|
1842
|
+
get userId(): string | undefined;
|
|
1843
|
+
/** Address ID of this participant, or `undefined` if not available. */
|
|
1154
1844
|
get addressId(): string | undefined;
|
|
1845
|
+
/** Server node ID for this participant, or `undefined` if not available. */
|
|
1155
1846
|
get nodeId(): string | undefined;
|
|
1156
1847
|
/** @internal */
|
|
1157
1848
|
get value(): Partial<Member>;
|
|
@@ -1178,20 +1869,65 @@ declare class Participant extends Destroyable implements CallParticipant {
|
|
|
1178
1869
|
/** Toggles noise suppression on the audio input. */
|
|
1179
1870
|
toggleNoiseSuppression(): Promise<void>;
|
|
1180
1871
|
toggleLowbitrate(): Promise<void>;
|
|
1181
|
-
/**
|
|
1872
|
+
/**
|
|
1873
|
+
* Adjusts the **conference-only** microphone energy gate / sensitivity level
|
|
1874
|
+
* for this member. Routes through the conferencing mix engine
|
|
1875
|
+
* (`signalwire.conferencing member.set_input_sensitivity`) and has no effect
|
|
1876
|
+
* on 1:1 WebRTC calls — for those, use browser audio constraints via
|
|
1877
|
+
* {@link Call.setNoiseSuppression} / {@link Call.setAutoGainControl}.
|
|
1878
|
+
*
|
|
1879
|
+
* This is **not** a local PC mic gain control; it only changes how the
|
|
1880
|
+
* server-side mixer decides to open the mic gate on this participant.
|
|
1881
|
+
*
|
|
1882
|
+
* @param value - Sensitivity level as understood by the conference engine
|
|
1883
|
+
* (integer, larger values are more sensitive).
|
|
1884
|
+
*/
|
|
1182
1885
|
setAudioInputSensitivity(value: number): Promise<void>;
|
|
1183
|
-
/**
|
|
1886
|
+
/**
|
|
1887
|
+
* Sets the **server-side** microphone volume on this participant's bridged
|
|
1888
|
+
* call leg. Applies a multiplier to the audio flowing through the mix
|
|
1889
|
+
* engine (FreeSWITCH channel read volume) — changes what other participants
|
|
1890
|
+
* hear, not what the local browser captures.
|
|
1891
|
+
*
|
|
1892
|
+
* For local PC mic gain, use {@link Call.setLocalMicrophoneGain} instead.
|
|
1893
|
+
*
|
|
1894
|
+
* @param value - Volume level (0-100).
|
|
1895
|
+
*/
|
|
1184
1896
|
setAudioInputVolume(value: number): Promise<void>;
|
|
1185
|
-
/**
|
|
1897
|
+
/**
|
|
1898
|
+
* Sets the **server-side** speaker volume on this participant's bridged call
|
|
1899
|
+
* leg (FreeSWITCH channel write volume) — what this participant hears from
|
|
1900
|
+
* the mix before it reaches their client.
|
|
1901
|
+
*
|
|
1902
|
+
* For local playback volume (the `<audio>` element the consumer attaches
|
|
1903
|
+
* `remoteStream` to), set `audioElement.volume` directly in the consumer's
|
|
1904
|
+
* code.
|
|
1905
|
+
*
|
|
1906
|
+
* @param value - Volume level (0-100).
|
|
1907
|
+
*/
|
|
1186
1908
|
setAudioOutputVolume(value: number): Promise<void>;
|
|
1187
|
-
/**
|
|
1909
|
+
/**
|
|
1910
|
+
* Sets the participant's position in the video layout.
|
|
1911
|
+
* @param value - The {@link VideoPosition} to assign (e.g. `'auto'`, `'reserved-0'`).
|
|
1912
|
+
*/
|
|
1188
1913
|
setPosition(value: VideoPosition): Promise<void>;
|
|
1189
1914
|
/** Removes this participant from the call. */
|
|
1190
1915
|
remove(): Promise<void>;
|
|
1191
1916
|
/** Ends the call for this participant. */
|
|
1192
1917
|
end(): Promise<void>;
|
|
1918
|
+
/**
|
|
1919
|
+
* Replaces custom metadata for this participant.
|
|
1920
|
+
* @param _meta - Metadata object to set.
|
|
1921
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
1922
|
+
*/
|
|
1193
1923
|
setMeta(_meta: Record<string, unknown>): Promise<void>;
|
|
1924
|
+
/**
|
|
1925
|
+
* Merges values into custom metadata (unlike {@link setMeta} which replaces).
|
|
1926
|
+
* @param _meta - Metadata to merge.
|
|
1927
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
1928
|
+
*/
|
|
1194
1929
|
updateMeta(_meta: Record<string, unknown>): Promise<void>;
|
|
1930
|
+
/** Destroys the participant, releasing all subscriptions and references. */
|
|
1195
1931
|
destroy(): void;
|
|
1196
1932
|
}
|
|
1197
1933
|
/**
|
|
@@ -1207,8 +1943,29 @@ declare class SelfParticipant extends Participant implements CallSelfParticipant
|
|
|
1207
1943
|
* Contains all capability flags as both observables and values.
|
|
1208
1944
|
*/
|
|
1209
1945
|
readonly capabilities: SelfCapabilities;
|
|
1946
|
+
/**
|
|
1947
|
+
* Studio audio mode state. When enabled, all audio processing
|
|
1948
|
+
* (echo cancellation, noise suppression, auto gain control) is disabled
|
|
1949
|
+
* to provide raw/unprocessed audio for musicians, podcasters, etc.
|
|
1950
|
+
*/
|
|
1951
|
+
private _studioAudio$;
|
|
1952
|
+
/** @internal */
|
|
1210
1953
|
constructor(id: string, executeMethod: ExecuteMethod, vertoManager: VertoManager, deviceController: DeviceController);
|
|
1211
1954
|
destroy(): void;
|
|
1955
|
+
/** Observable indicating whether studio audio (raw/unprocessed audio) mode is enabled. */
|
|
1956
|
+
get studioAudio$(): Observable<boolean>;
|
|
1957
|
+
/** Whether studio audio (raw/unprocessed audio) mode is currently enabled. */
|
|
1958
|
+
get studioAudio(): boolean;
|
|
1959
|
+
/**
|
|
1960
|
+
* Enables studio audio mode by disabling all audio processing.
|
|
1961
|
+
* Sets echoCancellation, noiseSuppression, and autoGainControl to false.
|
|
1962
|
+
*/
|
|
1963
|
+
enableStudioAudio(): Promise<void>;
|
|
1964
|
+
/**
|
|
1965
|
+
* Disables studio audio mode by restoring all audio processing to enabled.
|
|
1966
|
+
* Sets echoCancellation, noiseSuppression, and autoGainControl to true.
|
|
1967
|
+
*/
|
|
1968
|
+
disableStudioAudio(): Promise<void>;
|
|
1212
1969
|
/** Starts sharing the local screen. */
|
|
1213
1970
|
startScreenShare(): Promise<void>;
|
|
1214
1971
|
/** Observable of the current screen share status. */
|
|
@@ -1254,9 +2011,24 @@ declare class SelfParticipant extends Participant implements CallSelfParticipant
|
|
|
1254
2011
|
setVideoInputDeviceConstraints(constraints: MediaTrackConstraints): Promise<void>;
|
|
1255
2012
|
/** Selects the audio output device. Optionally saves as a preference. */
|
|
1256
2013
|
selectAudioOutputDevice(device: MediaDeviceInfo, options?: SelectDeviceOptions): void;
|
|
2014
|
+
/**
|
|
2015
|
+
* Exits studio audio mode without restoring defaults.
|
|
2016
|
+
* Called internally before individual audio flag toggles.
|
|
2017
|
+
*/
|
|
2018
|
+
private exitStudioModeIfActive;
|
|
2019
|
+
/** Toggles echo cancellation. Exits studio mode if active. */
|
|
2020
|
+
toggleEchoCancellation(): Promise<void>;
|
|
2021
|
+
/** Toggles automatic gain control. Exits studio mode if active. */
|
|
2022
|
+
toggleAudioInputAutoGain(): Promise<void>;
|
|
2023
|
+
/** Toggles noise suppression. Exits studio mode if active. */
|
|
2024
|
+
toggleNoiseSuppression(): Promise<void>;
|
|
2025
|
+
/** Mutes local audio. Falls back to local device mute if the server RPC fails. */
|
|
1257
2026
|
mute(): Promise<void>;
|
|
2027
|
+
/** Unmutes local audio. Falls back to local device unmute if the server RPC fails. */
|
|
1258
2028
|
unmute(): Promise<void>;
|
|
2029
|
+
/** Mutes local video. Falls back to local device mute if the server RPC fails. */
|
|
1259
2030
|
muteVideo(): Promise<void>;
|
|
2031
|
+
/** Unmutes local video. Falls back to local device unmute if the server RPC fails. */
|
|
1260
2032
|
unmuteVideo(): Promise<void>;
|
|
1261
2033
|
}
|
|
1262
2034
|
/** Type guard that checks if a participant is the local {@link SelfParticipant}. */
|
|
@@ -1269,26 +2041,26 @@ declare const isSelfParticipant: (participant: Participant) => participant is Se
|
|
|
1269
2041
|
*/
|
|
1270
2042
|
interface CallParticipant {
|
|
1271
2043
|
readonly id: string;
|
|
1272
|
-
readonly name$: Observable<string>;
|
|
1273
|
-
readonly type$: Observable<string>;
|
|
1274
|
-
readonly handraised$: Observable<boolean>;
|
|
1275
|
-
readonly visible$: Observable<boolean>;
|
|
1276
|
-
readonly audioMuted$: Observable<boolean>;
|
|
1277
|
-
readonly videoMuted$: Observable<boolean>;
|
|
1278
|
-
readonly deaf$: Observable<boolean>;
|
|
1279
|
-
readonly inputVolume$: Observable<number>;
|
|
1280
|
-
readonly outputVolume$: Observable<number>;
|
|
1281
|
-
readonly inputSensitivity$: Observable<number>;
|
|
1282
|
-
readonly echoCancellation$: Observable<boolean>;
|
|
1283
|
-
readonly autoGain$: Observable<boolean>;
|
|
1284
|
-
readonly noiseSuppression$: Observable<boolean>;
|
|
1285
|
-
readonly lowbitrate$: Observable<boolean>;
|
|
1286
|
-
readonly denoise$: Observable<boolean>;
|
|
1287
|
-
readonly meta$: Observable<Record<string, unknown
|
|
1288
|
-
readonly
|
|
1289
|
-
readonly addressId$: Observable<string>;
|
|
1290
|
-
readonly nodeId$: Observable<string>;
|
|
1291
|
-
readonly isTalking$: Observable<boolean>;
|
|
2044
|
+
readonly name$: Observable<string | undefined>;
|
|
2045
|
+
readonly type$: Observable<string | undefined>;
|
|
2046
|
+
readonly handraised$: Observable<boolean | undefined>;
|
|
2047
|
+
readonly visible$: Observable<boolean | undefined>;
|
|
2048
|
+
readonly audioMuted$: Observable<boolean | undefined>;
|
|
2049
|
+
readonly videoMuted$: Observable<boolean | undefined>;
|
|
2050
|
+
readonly deaf$: Observable<boolean | undefined>;
|
|
2051
|
+
readonly inputVolume$: Observable<number | undefined>;
|
|
2052
|
+
readonly outputVolume$: Observable<number | undefined>;
|
|
2053
|
+
readonly inputSensitivity$: Observable<number | undefined>;
|
|
2054
|
+
readonly echoCancellation$: Observable<boolean | undefined>;
|
|
2055
|
+
readonly autoGain$: Observable<boolean | undefined>;
|
|
2056
|
+
readonly noiseSuppression$: Observable<boolean | undefined>;
|
|
2057
|
+
readonly lowbitrate$: Observable<boolean | undefined>;
|
|
2058
|
+
readonly denoise$: Observable<boolean | undefined>;
|
|
2059
|
+
readonly meta$: Observable<Record<string, unknown> | undefined>;
|
|
2060
|
+
readonly userId$: Observable<string | undefined>;
|
|
2061
|
+
readonly addressId$: Observable<string | undefined>;
|
|
2062
|
+
readonly nodeId$: Observable<string | undefined>;
|
|
2063
|
+
readonly isTalking$: Observable<boolean | undefined>;
|
|
1292
2064
|
readonly position$: Observable<LayoutLayer | undefined>;
|
|
1293
2065
|
readonly name: string | undefined;
|
|
1294
2066
|
readonly type: string | undefined;
|
|
@@ -1306,7 +2078,7 @@ interface CallParticipant {
|
|
|
1306
2078
|
readonly lowbitrate: boolean;
|
|
1307
2079
|
readonly denoise: boolean;
|
|
1308
2080
|
readonly meta: Record<string, unknown> | undefined;
|
|
1309
|
-
readonly
|
|
2081
|
+
readonly userId: string | undefined;
|
|
1310
2082
|
readonly addressId: string | undefined;
|
|
1311
2083
|
readonly nodeId: string | undefined;
|
|
1312
2084
|
readonly isTalking: boolean;
|
|
@@ -1338,13 +2110,34 @@ interface CallParticipant {
|
|
|
1338
2110
|
* Extends CallParticipant with methods for controlling the local participant
|
|
1339
2111
|
*/
|
|
1340
2112
|
interface CallSelfParticipant extends CallParticipant {
|
|
1341
|
-
readonly screenShareStatus$: Observable<
|
|
1342
|
-
readonly screenShareStatus:
|
|
2113
|
+
readonly screenShareStatus$: Observable<ScreenShareStatus>;
|
|
2114
|
+
readonly screenShareStatus: ScreenShareStatus;
|
|
2115
|
+
readonly studioAudio$: Observable<boolean>;
|
|
2116
|
+
readonly studioAudio: boolean;
|
|
2117
|
+
enableStudioAudio(): Promise<void>;
|
|
2118
|
+
disableStudioAudio(): Promise<void>;
|
|
1343
2119
|
startScreenShare(): Promise<void>;
|
|
1344
2120
|
stopScreenShare(): Promise<void>;
|
|
1345
|
-
selectAudioInputDevice(device: MediaDeviceInfo): void;
|
|
1346
|
-
selectVideoInputDevice(device: MediaDeviceInfo): void;
|
|
1347
|
-
selectAudioOutputDevice(device: MediaDeviceInfo): void;
|
|
2121
|
+
selectAudioInputDevice(device: MediaDeviceInfo, options?: SelectDeviceOptions): void;
|
|
2122
|
+
selectVideoInputDevice(device: MediaDeviceInfo, options?: SelectDeviceOptions): void;
|
|
2123
|
+
selectAudioOutputDevice(device: MediaDeviceInfo, options?: SelectDeviceOptions): void;
|
|
2124
|
+
addAdditionalDevice(options: MediaOptions): Promise<void>;
|
|
2125
|
+
removeAdditionalDevice(id: string): Promise<void>;
|
|
2126
|
+
addAudioInputDevice(options?: {
|
|
2127
|
+
constraints?: MediaTrackConstraints;
|
|
2128
|
+
stream?: MediaStream;
|
|
2129
|
+
}): Promise<void>;
|
|
2130
|
+
addVideoInputDevice(options?: {
|
|
2131
|
+
constraints?: MediaTrackConstraints;
|
|
2132
|
+
stream?: MediaStream;
|
|
2133
|
+
}): Promise<void>;
|
|
2134
|
+
addInputDevices(options?: MediaOptions): Promise<void>;
|
|
2135
|
+
setAudioInputDeviceConstraints(constraints: MediaTrackConstraints): Promise<void>;
|
|
2136
|
+
setVideoInputDeviceConstraints(constraints: MediaTrackConstraints): Promise<void>;
|
|
2137
|
+
setInputDevicesConstraints(constraints: {
|
|
2138
|
+
audio: MediaTrackConstraints;
|
|
2139
|
+
video: MediaTrackConstraints;
|
|
2140
|
+
}): Promise<void>;
|
|
1348
2141
|
}
|
|
1349
2142
|
/**
|
|
1350
2143
|
* Minimal interface for a collection with pagination
|
|
@@ -1366,10 +2159,15 @@ interface CallAddress {
|
|
|
1366
2159
|
readonly textMessages$: Observable<CallTextMessageCollection | undefined>;
|
|
1367
2160
|
}
|
|
1368
2161
|
/** Lifecycle status of a call. */
|
|
1369
|
-
type CallStatus = 'new' | 'trying' | 'ringing' | 'connecting' | 'connected' | 'disconnecting' | 'disconnected' | 'failed' | 'destroyed';
|
|
2162
|
+
type CallStatus = 'new' | 'trying' | 'ringing' | 'connecting' | 'connected' | 'recovering' | 'disconnecting' | 'disconnected' | 'failed' | 'destroyed';
|
|
1370
2163
|
/** Configuration options for creating a call. */
|
|
1371
2164
|
interface CallOptions extends MediaOptions {
|
|
1372
|
-
/**
|
|
2165
|
+
/**
|
|
2166
|
+
* Optional. Hint to the cluster about which node should host this call.
|
|
2167
|
+
* Used by reattach to pin to the original node; on fresh dials acts as a
|
|
2168
|
+
* steering preference (the server may ignore for placement reasons).
|
|
2169
|
+
* Leave undefined for normal load-balanced placement.
|
|
2170
|
+
*/
|
|
1373
2171
|
readonly nodeId?: string;
|
|
1374
2172
|
/** Pre-assigned call ID (used for reattach). */
|
|
1375
2173
|
readonly callId?: string;
|
|
@@ -1389,6 +2187,12 @@ interface CallOptions extends MediaOptions {
|
|
|
1389
2187
|
readonly displayDirection?: string;
|
|
1390
2188
|
/** Custom user variables sent with the call invite. */
|
|
1391
2189
|
readonly userVariables?: Record<string, unknown>;
|
|
2190
|
+
/** Preferred video codecs for this call (overrides global preferences). */
|
|
2191
|
+
readonly preferredVideoCodecs?: string[];
|
|
2192
|
+
/** Preferred audio codecs for this call (overrides global preferences). */
|
|
2193
|
+
readonly preferredAudioCodecs?: string[];
|
|
2194
|
+
/** Enable stereo Opus for this call (overrides global preferences). */
|
|
2195
|
+
readonly stereo?: boolean;
|
|
1392
2196
|
}
|
|
1393
2197
|
/** Observable state of a call (status, recording, participants, etc.). */
|
|
1394
2198
|
interface CallState {
|
|
@@ -1417,23 +2221,29 @@ interface CallState {
|
|
|
1417
2221
|
* and control actions (hangup, mute, transfer, etc.).
|
|
1418
2222
|
*/
|
|
1419
2223
|
interface Call extends CallState {
|
|
1420
|
-
readonly capabilities$: Observable<
|
|
1421
|
-
readonly capabilities:
|
|
2224
|
+
readonly capabilities$: Observable<Capability[]>;
|
|
2225
|
+
readonly capabilities: Capability[];
|
|
1422
2226
|
readonly mediaDirections$: Observable<MediaDirections>;
|
|
1423
2227
|
readonly mediaDirections: MediaDirections;
|
|
1424
2228
|
readonly self$: Observable<CallSelfParticipant | null>;
|
|
1425
2229
|
readonly self: CallSelfParticipant | null;
|
|
1426
2230
|
readonly to?: string;
|
|
1427
|
-
readonly
|
|
2231
|
+
readonly toName?: string;
|
|
2232
|
+
readonly from?: string;
|
|
2233
|
+
readonly fromName?: string;
|
|
2234
|
+
readonly direction: CallDirection;
|
|
1428
2235
|
readonly layouts$: Observable<string[]>;
|
|
1429
2236
|
readonly layouts: string[];
|
|
1430
2237
|
readonly layout$: Observable<string>;
|
|
1431
2238
|
readonly layout?: string;
|
|
1432
2239
|
readonly layoutLayers$: Observable<LayoutLayer[]>;
|
|
1433
2240
|
readonly layoutLayers: LayoutLayer[];
|
|
1434
|
-
|
|
2241
|
+
/** Observable that emits only non-null MediaStreams (waits until the stream exists). */
|
|
2242
|
+
readonly localStream$: Observable<MediaStream>;
|
|
2243
|
+
/** Sync getter — returns null before the stream is created. */
|
|
1435
2244
|
readonly localStream: MediaStream | null;
|
|
1436
|
-
|
|
2245
|
+
/** Observable that emits only non-null MediaStreams (waits until the stream exists). */
|
|
2246
|
+
readonly remoteStream$: Observable<MediaStream>;
|
|
1437
2247
|
readonly remoteStream: MediaStream | null;
|
|
1438
2248
|
readonly rtcPeerConnection: RTCPeerConnection | undefined;
|
|
1439
2249
|
readonly errors$: Observable<CallError>;
|
|
@@ -1442,6 +2252,21 @@ interface Call extends CallState {
|
|
|
1442
2252
|
readonly address$: Observable<CallAddress | undefined>;
|
|
1443
2253
|
userVariables?: Record<string, unknown>;
|
|
1444
2254
|
readonly userVariables$: Observable<Record<string, unknown>>;
|
|
2255
|
+
readonly networkIssues$: Observable<NetworkIssue[]>;
|
|
2256
|
+
readonly networkIssues: NetworkIssue[];
|
|
2257
|
+
readonly isNetworkHealthy$: Observable<boolean>;
|
|
2258
|
+
readonly isNetworkHealthy: boolean;
|
|
2259
|
+
readonly networkMetrics$: Observable<NetworkMetrics[]>;
|
|
2260
|
+
readonly networkMetrics: NetworkMetrics[];
|
|
2261
|
+
readonly qualityScore$: Observable<number>;
|
|
2262
|
+
readonly qualityLevel$: Observable<QualityLevel>;
|
|
2263
|
+
readonly recoveryState$: Observable<RecoveryState>;
|
|
2264
|
+
readonly recoveryEvent$: Observable<RecoveryEvent>;
|
|
2265
|
+
readonly bandwidthConstrained$: Observable<boolean>;
|
|
2266
|
+
readonly mediaParamsUpdated$: Observable<MediaParamsEvent>;
|
|
2267
|
+
requestKeyframe(): void;
|
|
2268
|
+
requestIceRestart(): Promise<void>;
|
|
2269
|
+
subscribe(eventType: string): Observable<Record<string, unknown>>;
|
|
1445
2270
|
hangup(): Promise<void>;
|
|
1446
2271
|
toggleLock(): Promise<void>;
|
|
1447
2272
|
toggleHold(): Promise<void>;
|
|
@@ -1463,9 +2288,6 @@ interface Call extends CallState {
|
|
|
1463
2288
|
*/
|
|
1464
2289
|
interface CallManager extends Call {
|
|
1465
2290
|
readonly options: CallOptions;
|
|
1466
|
-
readonly fromName?: string;
|
|
1467
|
-
readonly from?: string;
|
|
1468
|
-
readonly toName?: string;
|
|
1469
2291
|
readonly selfId$: Observable<string | null>;
|
|
1470
2292
|
readonly selfId: string | null;
|
|
1471
2293
|
readonly nodeId$: Observable<string | null>;
|
|
@@ -1493,7 +2315,7 @@ interface CallManager extends Call {
|
|
|
1493
2315
|
* This interface breaks the circular dependency between Address and Directory
|
|
1494
2316
|
* by providing a minimal contract that Address needs from the Directory.
|
|
1495
2317
|
*
|
|
1496
|
-
* @
|
|
2318
|
+
* @template TAddress - The Address type, defaults to never to enforce explicit typing
|
|
1497
2319
|
*
|
|
1498
2320
|
* @remarks
|
|
1499
2321
|
* Uses a generic type parameter to maintain type safety while avoiding
|
|
@@ -1514,7 +2336,7 @@ interface AddressProvider<TAddress = never> {
|
|
|
1514
2336
|
* Address history entry from conversation messages
|
|
1515
2337
|
* Contains a reference to the sender address as an observable
|
|
1516
2338
|
*
|
|
1517
|
-
* @
|
|
2339
|
+
* @template TAddress - The Address type, provided by the implementation
|
|
1518
2340
|
*
|
|
1519
2341
|
* @remarks
|
|
1520
2342
|
* Uses a generic type parameter to maintain type safety while avoiding
|
|
@@ -1532,7 +2354,7 @@ interface AddressHistory<TAddress = never> {
|
|
|
1532
2354
|
* Text message from conversation
|
|
1533
2355
|
* Contains a reference to the sender address as an observable
|
|
1534
2356
|
*
|
|
1535
|
-
* @
|
|
2357
|
+
* @template TAddress - The Address type, provided by the implementation
|
|
1536
2358
|
*
|
|
1537
2359
|
* @remarks
|
|
1538
2360
|
* Uses a generic type parameter to maintain type safety while avoiding
|
|
@@ -1675,11 +2497,35 @@ declare class Address extends Destroyable {
|
|
|
1675
2497
|
get locked(): boolean;
|
|
1676
2498
|
/** Observable indicating whether the address (room) is locked. */
|
|
1677
2499
|
get locked$(): Observable<boolean>;
|
|
1678
|
-
/**
|
|
2500
|
+
/**
|
|
2501
|
+
* Sends a text message to this address.
|
|
2502
|
+
*
|
|
2503
|
+
* @param text - The message text to send.
|
|
2504
|
+
*
|
|
2505
|
+
* @example
|
|
2506
|
+
* ```ts
|
|
2507
|
+
* await address.sendText('Hello!');
|
|
2508
|
+
* ```
|
|
2509
|
+
*/
|
|
1679
2510
|
sendText(text: string): Promise<void>;
|
|
1680
|
-
/**
|
|
2511
|
+
/**
|
|
2512
|
+
* Collection of text messages for this address, with pagination support.
|
|
2513
|
+
*
|
|
2514
|
+
* Returns `undefined` until {@link textMessages$} has been subscribed to (lazy-loaded).
|
|
2515
|
+
* Filters to `'chat'` subtype messages from the conversation.
|
|
2516
|
+
*
|
|
2517
|
+
* @see {@link textMessages$} to trigger lazy loading.
|
|
2518
|
+
* @see {@link sendText} to send a new message.
|
|
2519
|
+
*/
|
|
1681
2520
|
get textMessage(): EntityCollectionTransformed<GetConversationMessageResponse, TextMessage<Address>> | undefined;
|
|
1682
|
-
/**
|
|
2521
|
+
/**
|
|
2522
|
+
* Collection of call history entries for this address, with pagination support.
|
|
2523
|
+
*
|
|
2524
|
+
* Returns `undefined` until {@link history$} has been subscribed to (lazy-loaded).
|
|
2525
|
+
* Filters to `'log'` subtype messages including kind, status, start/end times.
|
|
2526
|
+
*
|
|
2527
|
+
* @see {@link history$} to trigger lazy loading.
|
|
2528
|
+
*/
|
|
1683
2529
|
get history(): EntityCollectionTransformed<GetConversationMessageResponse, AddressHistory<Address>> | undefined;
|
|
1684
2530
|
/** Observable of active call states for this address. @throws {UnimplementedError} Requires presence support. */
|
|
1685
2531
|
get activity$(): Observable<CallState[]>;
|
|
@@ -1692,26 +2538,72 @@ interface AttachableCall {
|
|
|
1692
2538
|
id: string;
|
|
1693
2539
|
to?: string;
|
|
1694
2540
|
mediaDirections: MediaDirections;
|
|
2541
|
+
nodeId?: string;
|
|
1695
2542
|
}
|
|
1696
2543
|
interface OutboundCallProvider {
|
|
1697
2544
|
createOutboundCall(destination: string | Address, options?: CallOptions): Promise<Call>;
|
|
1698
2545
|
}
|
|
2546
|
+
interface Attachment {
|
|
2547
|
+
destination: string;
|
|
2548
|
+
mediaDirections: MediaDirections;
|
|
2549
|
+
audioInputDevice: MediaDeviceInfo | null;
|
|
2550
|
+
videoInputDevice: MediaDeviceInfo | null;
|
|
2551
|
+
nodeId?: string;
|
|
2552
|
+
attachedAt: number;
|
|
2553
|
+
}
|
|
1699
2554
|
declare class AttachManager {
|
|
1700
2555
|
private readonly storage;
|
|
1701
2556
|
private readonly deviceController;
|
|
1702
2557
|
private readonly reconnectCallsTimeout;
|
|
1703
2558
|
private attachKey;
|
|
1704
2559
|
private session;
|
|
2560
|
+
private writeQueue;
|
|
1705
2561
|
constructor(storage: StorageManager, deviceController: DeviceController, reconnectCallsTimeout: number, attachKey: string);
|
|
1706
2562
|
detachAll(): Promise<void>;
|
|
1707
2563
|
setSession(session: OutboundCallProvider): void;
|
|
1708
2564
|
private readAttached;
|
|
1709
2565
|
private writeAttached;
|
|
2566
|
+
/**
|
|
2567
|
+
* Serialize a read-modify-write operation against the attached-calls
|
|
2568
|
+
* storage. The mutator receives the current state and returns the new
|
|
2569
|
+
* state. Concurrent calls queue behind the in-flight one so writes never
|
|
2570
|
+
* interleave.
|
|
2571
|
+
*/
|
|
2572
|
+
private mutate;
|
|
1710
2573
|
attach(call: AttachableCall): Promise<void>;
|
|
1711
2574
|
detach(call: AttachableCall): Promise<void>;
|
|
1712
2575
|
flush(): Promise<void>;
|
|
2576
|
+
/**
|
|
2577
|
+
* Reattach to previously active calls by sending verto.invite with
|
|
2578
|
+
* reattaching: true.
|
|
2579
|
+
*
|
|
2580
|
+
* NOTE: This currently fails with INVALID_CALL_REFERENCE because the
|
|
2581
|
+
* server's jsock UUID check rejects the new connection's UUID. A
|
|
2582
|
+
* server-side fix is needed: when reattaching: true is explicitly set
|
|
2583
|
+
* in dialogParams, FreeSWITCH's attempt_reattach() should update the
|
|
2584
|
+
* call's jsock reference to the new connection's UUID instead of
|
|
2585
|
+
* rejecting. Once that fix is deployed, this will work for both
|
|
2586
|
+
* page reloads and WebSocket reconnects.
|
|
2587
|
+
*
|
|
2588
|
+
* Failed reattach attempts are handled gracefully — the stale call
|
|
2589
|
+
* reference is cleaned up from storage.
|
|
2590
|
+
*/
|
|
1713
2591
|
reattachCalls(): Promise<void>;
|
|
1714
|
-
|
|
2592
|
+
/**
|
|
2593
|
+
* Build CallOptions from stored attachment data for a call being reattached.
|
|
2594
|
+
* Also used by the session-level verto.attach handler.
|
|
2595
|
+
*/
|
|
2596
|
+
buildCallOptions(attachment: Attachment): CallOptions;
|
|
2597
|
+
/**
|
|
2598
|
+
* Look up stored attachment data for a call id and return CallOptions
|
|
2599
|
+
* suitable for rehydrating a reattached call. Returns undefined when no
|
|
2600
|
+
* matching entry exists in storage.
|
|
2601
|
+
*
|
|
2602
|
+
* Used by the session-level verto.attach handler when the server pushes
|
|
2603
|
+
* an attach event for a call the client doesn't have an object for yet
|
|
2604
|
+
* (e.g. after a reload).
|
|
2605
|
+
*/
|
|
2606
|
+
consumePendingAttachment(callId: string): Promise<CallOptions | undefined>;
|
|
1715
2607
|
private detachExpired;
|
|
1716
2608
|
}
|
|
1717
2609
|
//#endregion
|
|
@@ -1720,22 +2612,6 @@ declare class TransportManager extends Destroyable {
|
|
|
1720
2612
|
private readonly storage;
|
|
1721
2613
|
private readonly protocolKey;
|
|
1722
2614
|
private readonly onError?;
|
|
1723
|
-
/**
|
|
1724
|
-
* Normalise a server event timestamp to epoch seconds.
|
|
1725
|
-
*
|
|
1726
|
-
* The server uses two formats:
|
|
1727
|
-
* - `webrtc.message`: float epoch seconds (e.g. 1774372099.022817)
|
|
1728
|
-
* - all other events: int epoch microseconds (e.g. 1774372099925857)
|
|
1729
|
-
*
|
|
1730
|
-
* Values above 1e12 are treated as microseconds and divided by 1e6.
|
|
1731
|
-
*/
|
|
1732
|
-
private static toEpochSeconds;
|
|
1733
|
-
/**
|
|
1734
|
-
* Extract the event timestamp from a signalwire.event message.
|
|
1735
|
-
* Returns `null` for messages that have no timestamp
|
|
1736
|
-
* (e.g. signalwire.authorization.state, RPC responses).
|
|
1737
|
-
*/
|
|
1738
|
-
private static extractEventTimestamp;
|
|
1739
2615
|
private initialized$;
|
|
1740
2616
|
protocol$: rxjs0.ReplaySubject<string | undefined>;
|
|
1741
2617
|
private isConnecting;
|
|
@@ -1743,29 +2619,21 @@ declare class TransportManager extends Destroyable {
|
|
|
1743
2619
|
private ackEvent;
|
|
1744
2620
|
private replySignalwirePing;
|
|
1745
2621
|
/**
|
|
1746
|
-
* Filter that drops events
|
|
2622
|
+
* Filter that drops events from a previous session after reconnect.
|
|
1747
2623
|
*
|
|
1748
|
-
*
|
|
1749
|
-
*
|
|
1750
|
-
*
|
|
1751
|
-
*
|
|
1752
|
-
*
|
|
1753
|
-
* Events without a timestamp (e.g. signalwire.authorization.state) and
|
|
1754
|
-
* non-event messages (RPC responses) always pass through.
|
|
2624
|
+
* Compares the event's `event_channel` against the current protocol.
|
|
2625
|
+
* Events whose channel doesn't contain the current protocol are from
|
|
2626
|
+
* a stale session and are discarded. Events without an event_channel
|
|
2627
|
+
* (auth state events, RPC responses) always pass through.
|
|
1755
2628
|
*/
|
|
1756
2629
|
private discardStaleEvents;
|
|
1757
|
-
private
|
|
2630
|
+
private _currentProtocol;
|
|
1758
2631
|
private _outgoingMessages$;
|
|
1759
2632
|
private _webSocketConnections;
|
|
1760
2633
|
private _jsonRPCMessage$;
|
|
1761
2634
|
private _jsonRPCResponse$;
|
|
1762
2635
|
private _incomingEvent$;
|
|
1763
2636
|
constructor(storage: StorageManager, protocolKey: string, webSocketConstructor: WebSocketAdapter | NodeSocketAdapter, relayHost: string, onError?: ((error: Error) => void) | undefined);
|
|
1764
|
-
/**
|
|
1765
|
-
* Reset the session epoch. Call this before each signalwire.connect
|
|
1766
|
-
* so that the first event after authentication establishes the new baseline.
|
|
1767
|
-
*/
|
|
1768
|
-
resetSessionEpoch(): void;
|
|
1769
2637
|
setProtocol(protocol: string | undefined): Promise<void>;
|
|
1770
2638
|
get incomingEvent$(): Observable<JSONRPCRequest | JSONRPCResponse>;
|
|
1771
2639
|
get connectionStatus$(): Observable<string>;
|
|
@@ -1780,6 +2648,101 @@ declare class TransportManager extends Destroyable {
|
|
|
1780
2648
|
private _init;
|
|
1781
2649
|
}
|
|
1782
2650
|
//#endregion
|
|
2651
|
+
//#region src/controllers/CryptoController.d.ts
|
|
2652
|
+
/**
|
|
2653
|
+
* Controls DPoP (Demonstrating Proof-of-Possession) cryptographic operations.
|
|
2654
|
+
*
|
|
2655
|
+
* Generates an RSA-2048 key pair where the private key is non-extractable,
|
|
2656
|
+
* computes the JWK Thumbprint (RFC 7638) as the fingerprint, and creates
|
|
2657
|
+
* signed DPoP proof JWTs for both HTTP API requests and WebSocket RPC calls.
|
|
2658
|
+
*
|
|
2659
|
+
* The key pair is persisted in IndexedDB so the same fingerprint survives
|
|
2660
|
+
* page reloads. This keeps the Client Bound SAT and stored authorization_state
|
|
2661
|
+
* valid across reloads without needing to re-authenticate.
|
|
2662
|
+
*
|
|
2663
|
+
* @example
|
|
2664
|
+
* ```typescript
|
|
2665
|
+
* const crypto = new CryptoController();
|
|
2666
|
+
* await crypto.init();
|
|
2667
|
+
*
|
|
2668
|
+
* // Get fingerprint for SAT issuance
|
|
2669
|
+
* const fingerprint = crypto.fingerprint;
|
|
2670
|
+
*
|
|
2671
|
+
* // Create proof for HTTP endpoint
|
|
2672
|
+
* const httpProof = await crypto.createHttpProof({
|
|
2673
|
+
* method: 'POST',
|
|
2674
|
+
* uri: '/api/fabric/subscriber/devices/token'
|
|
2675
|
+
* });
|
|
2676
|
+
*
|
|
2677
|
+
* // Create proof for RPC call
|
|
2678
|
+
* const rpcProof = await crypto.createRpcProof({
|
|
2679
|
+
* method: 'signalwire.connect'
|
|
2680
|
+
* });
|
|
2681
|
+
* ```
|
|
2682
|
+
*/
|
|
2683
|
+
declare class CryptoController {
|
|
2684
|
+
private _keyPair;
|
|
2685
|
+
private _publicJwk;
|
|
2686
|
+
private _fingerprint;
|
|
2687
|
+
private _initialized;
|
|
2688
|
+
/**
|
|
2689
|
+
* Initializes the DPoP key pair. Loads an existing key from IndexedDB
|
|
2690
|
+
* if available, otherwise generates a new one and persists it.
|
|
2691
|
+
*
|
|
2692
|
+
* The private key is non-extractable — IndexedDB stores the CryptoKey
|
|
2693
|
+
* handle via the structured clone algorithm without exposing key material.
|
|
2694
|
+
*
|
|
2695
|
+
* @returns The JWK Thumbprint (fingerprint) for the key.
|
|
2696
|
+
*/
|
|
2697
|
+
init(): Promise<string>;
|
|
2698
|
+
/**
|
|
2699
|
+
* The JWK Thumbprint (RFC 7638) of the public key.
|
|
2700
|
+
* Used as the `fingerprint` parameter when requesting scoped SATs.
|
|
2701
|
+
*
|
|
2702
|
+
* @throws {DPoPInitError} If {@link init} has not been called.
|
|
2703
|
+
*/
|
|
2704
|
+
get fingerprint(): string;
|
|
2705
|
+
/**
|
|
2706
|
+
* Whether the controller has been initialized with a key pair.
|
|
2707
|
+
*/
|
|
2708
|
+
get initialized(): boolean;
|
|
2709
|
+
/**
|
|
2710
|
+
* Creates a DPoP proof JWT for an HTTP API request.
|
|
2711
|
+
*
|
|
2712
|
+
* Used for Prime API endpoints like `/api/fabric/subscriber/devices/token`
|
|
2713
|
+
* and `/api/fabric/subscriber/devices/refresh`.
|
|
2714
|
+
*
|
|
2715
|
+
* @param params - HTTP method and URI for the proof.
|
|
2716
|
+
* @returns Signed DPoP proof JWT string.
|
|
2717
|
+
*/
|
|
2718
|
+
createHttpProof(params: DPoPHttpProofParams): Promise<string>;
|
|
2719
|
+
/**
|
|
2720
|
+
* Creates a DPoP proof JWT for a WebSocket RPC call.
|
|
2721
|
+
*
|
|
2722
|
+
* Used for switchblade RPC methods like `signalwire.connect` and
|
|
2723
|
+
* `signalwire.reauthenticate`.
|
|
2724
|
+
*
|
|
2725
|
+
* @param params - RPC method name for the proof.
|
|
2726
|
+
* @returns Signed DPoP proof JWT string.
|
|
2727
|
+
*/
|
|
2728
|
+
createRpcProof(params: DPoPRpcProofParams): Promise<string>;
|
|
2729
|
+
/**
|
|
2730
|
+
* Releases the key pair references and removes the persisted key from IndexedDB.
|
|
2731
|
+
* After calling destroy, the controller must be re-initialized to be used again.
|
|
2732
|
+
*/
|
|
2733
|
+
destroy(): void;
|
|
2734
|
+
private get publicJwk();
|
|
2735
|
+
private get privateKey();
|
|
2736
|
+
private signProof;
|
|
2737
|
+
}
|
|
2738
|
+
//#endregion
|
|
2739
|
+
//#region src/controllers/NetworkMonitor.d.ts
|
|
2740
|
+
interface NetworkChangeEvent {
|
|
2741
|
+
type: 'online' | 'offline' | 'connection_change';
|
|
2742
|
+
timestamp: number;
|
|
2743
|
+
networkType?: string;
|
|
2744
|
+
}
|
|
2745
|
+
//#endregion
|
|
1783
2746
|
//#region src/core/entities/Directory.d.ts
|
|
1784
2747
|
/**
|
|
1785
2748
|
* Directory interface for managing addresses
|
|
@@ -1853,6 +2816,12 @@ interface ClientSession {
|
|
|
1853
2816
|
* Used by VertoManager to configure RTCPeerConnection
|
|
1854
2817
|
*/
|
|
1855
2818
|
readonly iceServers: RTCIceServer[] | undefined;
|
|
2819
|
+
/**
|
|
2820
|
+
* Emits true when the session is authenticated, false when not.
|
|
2821
|
+
* Used by Call to detect WebSocket reconnections (skip(1) + filter(true)
|
|
2822
|
+
* indicates a re-authentication after the initial connect).
|
|
2823
|
+
*/
|
|
2824
|
+
readonly authenticated$: Observable<boolean>;
|
|
1856
2825
|
}
|
|
1857
2826
|
//#endregion
|
|
1858
2827
|
//#region src/interfaces/SessionState.d.ts
|
|
@@ -1886,15 +2855,31 @@ interface SessionState extends ClientSession {
|
|
|
1886
2855
|
* and `false` after disconnect.
|
|
1887
2856
|
*/
|
|
1888
2857
|
readonly authenticated$: Observable<boolean>;
|
|
2858
|
+
/**
|
|
2859
|
+
* Current authentication state.
|
|
2860
|
+
* Returns `true` if the session is currently authenticated.
|
|
2861
|
+
*/
|
|
2862
|
+
readonly authenticated: boolean;
|
|
1889
2863
|
}
|
|
1890
2864
|
//#endregion
|
|
1891
2865
|
//#region src/managers/ClientSessionManager.d.ts
|
|
2866
|
+
/**
|
|
2867
|
+
* Discriminated union for session authentication state.
|
|
2868
|
+
* clientBound is tracked separately via _wasClientBound (sticky flag)
|
|
2869
|
+
* to avoid dual sources of truth.
|
|
2870
|
+
*/
|
|
2871
|
+
type SessionAuthState = {
|
|
2872
|
+
kind: 'unauthenticated';
|
|
2873
|
+
} | {
|
|
2874
|
+
kind: 'authenticated';
|
|
2875
|
+
};
|
|
1892
2876
|
declare class ClientSessionManager extends Destroyable implements SessionState {
|
|
1893
|
-
private
|
|
2877
|
+
private readonly getCredential;
|
|
1894
2878
|
private readonly transport;
|
|
1895
2879
|
private readonly storage;
|
|
1896
2880
|
private readonly authorizationStateKey;
|
|
1897
2881
|
private readonly attachManager;
|
|
2882
|
+
private readonly dpopManager?;
|
|
1898
2883
|
private callFactory;
|
|
1899
2884
|
private callCreateTimeout;
|
|
1900
2885
|
private readonly agent;
|
|
@@ -1902,18 +2887,26 @@ declare class ClientSessionManager extends Destroyable implements SessionState {
|
|
|
1902
2887
|
initialized$: Observable<boolean>;
|
|
1903
2888
|
private authorizationState$;
|
|
1904
2889
|
private connectVersion;
|
|
2890
|
+
/**
|
|
2891
|
+
* Optional hook called before a fresh connect on reconnect.
|
|
2892
|
+
* Used by SignalWire to refresh expired credentials before re-authenticating.
|
|
2893
|
+
* @internal
|
|
2894
|
+
*/
|
|
2895
|
+
onBeforeReconnect?: () => Promise<void>;
|
|
1905
2896
|
private _authorization$;
|
|
1906
2897
|
private _errors$;
|
|
1907
2898
|
private _directory?;
|
|
1908
|
-
private
|
|
1909
|
-
|
|
2899
|
+
private _authState$;
|
|
2900
|
+
/** Sticky flag — once true, stays true for the session lifetime. */
|
|
2901
|
+
private _wasClientBound;
|
|
2902
|
+
private _userInfo$;
|
|
1910
2903
|
private _calls$;
|
|
1911
2904
|
private _iceServers$;
|
|
1912
|
-
constructor(
|
|
2905
|
+
constructor(getCredential: () => SDKCredential, transport: TransportManager, storage: StorageManager, authorizationStateKey: string, deviceController: DeviceController, attachManager: AttachManager, webRTCApiProvider: WebRTCApiProvider, dpopManager?: CryptoController | undefined, networkChange$?: Observable<NetworkChangeEvent>);
|
|
1913
2906
|
get incomingCalls$(): Observable<Call[]>;
|
|
1914
2907
|
get incomingCalls(): Call[];
|
|
1915
|
-
get
|
|
1916
|
-
get
|
|
2908
|
+
get userInfo$(): Observable<Address | null>;
|
|
2909
|
+
get userInfo(): Address | null;
|
|
1917
2910
|
get calls$(): Observable<Call[]>;
|
|
1918
2911
|
get calls(): Call[];
|
|
1919
2912
|
get iceServers(): RTCIceServer[] | undefined;
|
|
@@ -1922,6 +2915,15 @@ declare class ClientSessionManager extends Destroyable implements SessionState {
|
|
|
1922
2915
|
get errors$(): Observable<Error>;
|
|
1923
2916
|
get authenticated$(): Observable<boolean>;
|
|
1924
2917
|
get authenticated(): boolean;
|
|
2918
|
+
/**
|
|
2919
|
+
* Whether this session is client-bound (using a Client Bound SAT).
|
|
2920
|
+
* When client-bound, DPoP proof creation failures are treated as
|
|
2921
|
+
* authentication errors rather than silently degraded.
|
|
2922
|
+
* @internal
|
|
2923
|
+
*/
|
|
2924
|
+
get clientBound(): boolean;
|
|
2925
|
+
/** @internal Current auth state for debugging/testing. */
|
|
2926
|
+
get authState(): SessionAuthState;
|
|
1925
2927
|
/**
|
|
1926
2928
|
* Set the directory instance
|
|
1927
2929
|
* Called by SignalWire after directory is created
|
|
@@ -2010,6 +3012,16 @@ declare class ClientSessionManager extends Destroyable implements SessionState {
|
|
|
2010
3012
|
params: CallConnectPayload;
|
|
2011
3013
|
}, "event_channel"> & {
|
|
2012
3014
|
event_channel: string;
|
|
3015
|
+
}) | (Omit<{
|
|
3016
|
+
event_type: "room.updated";
|
|
3017
|
+
event_channel: EventChannel;
|
|
3018
|
+
timestamp: number;
|
|
3019
|
+
project_id?: string;
|
|
3020
|
+
node_id?: string;
|
|
3021
|
+
is_author?: boolean;
|
|
3022
|
+
params: RoomUpdatedPayload;
|
|
3023
|
+
}, "event_channel"> & {
|
|
3024
|
+
event_channel: string;
|
|
2013
3025
|
}) | Omit<{
|
|
2014
3026
|
event_type: "member.updated";
|
|
2015
3027
|
event_channel: EventChannel;
|
|
@@ -2076,6 +3088,7 @@ declare class ClientSessionManager extends Destroyable implements SessionState {
|
|
|
2076
3088
|
is_author: boolean;
|
|
2077
3089
|
})>;
|
|
2078
3090
|
private get vertoInvite$();
|
|
3091
|
+
private get vertoAttach$();
|
|
2079
3092
|
private get contexts();
|
|
2080
3093
|
private get eventing();
|
|
2081
3094
|
private get topics();
|
|
@@ -2084,10 +3097,22 @@ declare class ClientSessionManager extends Destroyable implements SessionState {
|
|
|
2084
3097
|
private handleAuthenticationError;
|
|
2085
3098
|
cleanupStoredConnectionParams(): Promise<void>;
|
|
2086
3099
|
protected updateAuthState(authorization_state: string): Promise<void>;
|
|
2087
|
-
reauthenticate(token: string
|
|
3100
|
+
reauthenticate(token: string, dpopToken?: string, options?: {
|
|
3101
|
+
clientBound?: boolean;
|
|
3102
|
+
}): Promise<void>;
|
|
2088
3103
|
private authenticate;
|
|
2089
3104
|
disconnect(): Promise<void>;
|
|
2090
3105
|
private createInboundCall;
|
|
3106
|
+
/**
|
|
3107
|
+
* Handle a server-pushed verto.attach event at the session level.
|
|
3108
|
+
*
|
|
3109
|
+
* On page reload the server detects the reconnected session and pushes
|
|
3110
|
+
* verto.attach for any active calls. If a call object already exists
|
|
3111
|
+
* (network blip, no reload), the per-call handler in VertoManager deals
|
|
3112
|
+
* with it. This method only creates a new call object when no existing
|
|
3113
|
+
* one matches the callID.
|
|
3114
|
+
*/
|
|
3115
|
+
private handleVertoAttach;
|
|
2091
3116
|
createOutboundCall(destination: string | Address, options?: CallOptions): Promise<Call>;
|
|
2092
3117
|
private createCall;
|
|
2093
3118
|
destroy(): void;
|
|
@@ -2172,6 +3197,16 @@ declare class ClientSessionWrapper implements SessionState {
|
|
|
2172
3197
|
params: CallConnectPayload;
|
|
2173
3198
|
}, "event_channel"> & {
|
|
2174
3199
|
event_channel: string;
|
|
3200
|
+
}) | (Omit<{
|
|
3201
|
+
event_type: "room.updated";
|
|
3202
|
+
event_channel: EventChannel;
|
|
3203
|
+
timestamp: number;
|
|
3204
|
+
project_id?: string;
|
|
3205
|
+
node_id?: string;
|
|
3206
|
+
is_author?: boolean;
|
|
3207
|
+
params: RoomUpdatedPayload;
|
|
3208
|
+
}, "event_channel"> & {
|
|
3209
|
+
event_channel: string;
|
|
2175
3210
|
}) | Omit<{
|
|
2176
3211
|
event_type: "member.updated";
|
|
2177
3212
|
event_channel: EventChannel;
|
|
@@ -2245,12 +3280,61 @@ declare class ClientSessionWrapper implements SessionState {
|
|
|
2245
3280
|
get calls(): Call[];
|
|
2246
3281
|
}
|
|
2247
3282
|
//#endregion
|
|
3283
|
+
//#region src/utils/logger.d.ts
|
|
3284
|
+
/** Log level names supported by the SDK. */
|
|
3285
|
+
type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
3286
|
+
/**
|
|
3287
|
+
* Logger interface that consumers can implement to replace the built-in logger.
|
|
3288
|
+
* All methods accept variadic arguments matching the browser console API.
|
|
3289
|
+
*/
|
|
3290
|
+
interface SDKLogger {
|
|
3291
|
+
error(...args: unknown[]): void;
|
|
3292
|
+
warn(...args: unknown[]): void;
|
|
3293
|
+
info(...args: unknown[]): void;
|
|
3294
|
+
debug(...args: unknown[]): void;
|
|
3295
|
+
trace(...args: unknown[]): void;
|
|
3296
|
+
}
|
|
3297
|
+
/** Options for WebSocket traffic logging. */
|
|
3298
|
+
interface WsTrafficOptions {
|
|
3299
|
+
type: 'send' | 'recv' | 'http';
|
|
3300
|
+
/** Parsed object or raw string — will be JSON.stringify'd for display if an object. */
|
|
3301
|
+
payload: unknown;
|
|
3302
|
+
}
|
|
3303
|
+
/**
|
|
3304
|
+
* Options for WebSocket traffic logging using raw strings.
|
|
3305
|
+
* The string is only parsed when logging is enabled, avoiding
|
|
3306
|
+
* unnecessary JSON.parse on every message.
|
|
3307
|
+
*/
|
|
3308
|
+
interface WsTrafficRawOptions {
|
|
3309
|
+
type: 'send' | 'recv';
|
|
3310
|
+
raw: string;
|
|
3311
|
+
}
|
|
3312
|
+
/** Debug options that control verbose SDK logging. */
|
|
3313
|
+
interface DebugOptions {
|
|
3314
|
+
/** Log all WebSocket send/recv traffic to the console. */
|
|
3315
|
+
logWsTraffic?: boolean;
|
|
3316
|
+
}
|
|
3317
|
+
/** Extended logger with SDK-internal helpers (wsTraffic). */
|
|
3318
|
+
interface InternalSDKLogger extends SDKLogger {
|
|
3319
|
+
wsTraffic: (options: WsTrafficOptions | WsTrafficRawOptions) => void;
|
|
3320
|
+
}
|
|
3321
|
+
/** Replace the built-in logger with a custom implementation. Pass `null` to restore defaults. */
|
|
3322
|
+
declare const setLogger: (logger: SDKLogger | null) => void;
|
|
3323
|
+
/** Configure debug options (e.g., `{ logWsTraffic: true }`). */
|
|
3324
|
+
declare const setDebugOptions: (options: DebugOptions | null) => void;
|
|
3325
|
+
/**
|
|
3326
|
+
* Set the log level for the built-in logger.
|
|
3327
|
+
* Has no effect when a custom logger is set via `setLogger()`.
|
|
3328
|
+
*/
|
|
3329
|
+
declare const setLogLevel: (level: LogLevel) => void;
|
|
3330
|
+
declare const getLogger: () => InternalSDKLogger;
|
|
3331
|
+
//#endregion
|
|
2248
3332
|
//#region src/clients/SignalWire.d.ts
|
|
2249
3333
|
/** Options for constructing a {@link SignalWire}. */
|
|
2250
3334
|
interface SignalWireOptions {
|
|
2251
3335
|
/** Skip automatic WebSocket connection on construction. */
|
|
2252
3336
|
skipConnection?: boolean;
|
|
2253
|
-
/** Skip automatic
|
|
3337
|
+
/** Skip automatic user registration on construction. */
|
|
2254
3338
|
skipRegister?: boolean;
|
|
2255
3339
|
/** Skip monitoring media device changes. */
|
|
2256
3340
|
skipDeviceMonitoring?: boolean;
|
|
@@ -2258,15 +3342,62 @@ interface SignalWireOptions {
|
|
|
2258
3342
|
reconnectAttachedCalls?: boolean;
|
|
2259
3343
|
/** Whether to save preferences. */
|
|
2260
3344
|
savePreferences?: boolean;
|
|
3345
|
+
/**
|
|
3346
|
+
* Persist the session across page reloads.
|
|
3347
|
+
*
|
|
3348
|
+
* When `true`, credential, authorization state, and protocol are stored in
|
|
3349
|
+
* `localStorage` (survives reload). The DPoP key pair is persisted in
|
|
3350
|
+
* IndexedDB. On reload, the SDK restores the session from cache
|
|
3351
|
+
* without calling `credentialProvider.authenticate()`.
|
|
3352
|
+
*
|
|
3353
|
+
* When `false` (default), session data lives in `sessionStorage` and is
|
|
3354
|
+
* lost on reload.
|
|
3355
|
+
*
|
|
3356
|
+
* Call {@link SignalWire.destroy | destroy()} to clear all persisted state
|
|
3357
|
+
* (explicit logout).
|
|
3358
|
+
*/
|
|
3359
|
+
persistSession?: boolean;
|
|
2261
3360
|
/** Custom storage implementation for persistence. */
|
|
2262
3361
|
storageImplementation?: Storage;
|
|
2263
3362
|
/** Custom WebSocket constructor */
|
|
2264
3363
|
webSocketConstructor?: WebSocketAdapter | NodeSocketAdapter;
|
|
2265
3364
|
/** Custom WebRTC API provider */
|
|
2266
3365
|
webRTCApiProvider?: WebRTCApiProvider;
|
|
3366
|
+
/**
|
|
3367
|
+
* Custom logger implementation. Must implement the {@link SDKLogger} interface.
|
|
3368
|
+
* Pass `null` to restore the built-in logger.
|
|
3369
|
+
*
|
|
3370
|
+
* **Note:** Logger configuration is global — setting it on one instance affects all instances.
|
|
3371
|
+
*/
|
|
3372
|
+
logger?: SDKLogger | null;
|
|
3373
|
+
/**
|
|
3374
|
+
* Log level for the built-in logger.
|
|
3375
|
+
* Default: `'warn'`. Set to `'debug'` for verbose SDK output.
|
|
3376
|
+
* Has no effect when a custom `logger` is provided.
|
|
3377
|
+
*
|
|
3378
|
+
* **Note:** Logger configuration is global — setting it on one instance affects all instances.
|
|
3379
|
+
*/
|
|
3380
|
+
logLevel?: LogLevel;
|
|
3381
|
+
/** Debug options for verbose SDK diagnostics (e.g., `{ logWsTraffic: true }`). */
|
|
3382
|
+
debug?: DebugOptions;
|
|
2267
3383
|
}
|
|
2268
3384
|
/** Options for {@link SignalWire.dial}. Extends {@link MediaOptions} with dial-specific settings. */
|
|
2269
|
-
interface DialOptions extends MediaOptions {
|
|
3385
|
+
interface DialOptions extends MediaOptions {
|
|
3386
|
+
/** Preferred video codecs for this call (overrides global preferences). */
|
|
3387
|
+
preferredVideoCodecs?: string[];
|
|
3388
|
+
/** Preferred audio codecs for this call (overrides global preferences). */
|
|
3389
|
+
preferredAudioCodecs?: string[];
|
|
3390
|
+
/** Enable stereo Opus for this call (overrides global preferences). */
|
|
3391
|
+
stereo?: boolean;
|
|
3392
|
+
/** Optional node ID for routing the call */
|
|
3393
|
+
nodeId?: string;
|
|
3394
|
+
/**
|
|
3395
|
+
* Custom variables sent with the Verto invite. Merged with
|
|
3396
|
+
* `client.preferences.userVariables` and any query-string variables on the
|
|
3397
|
+
* destination URI; values here take precedence.
|
|
3398
|
+
*/
|
|
3399
|
+
userVariables?: Record<string, unknown>;
|
|
3400
|
+
}
|
|
2270
3401
|
/**
|
|
2271
3402
|
* Main entry point for the SignalWire Browser SDK.
|
|
2272
3403
|
*
|
|
@@ -2282,7 +3413,7 @@ interface DialOptions extends MediaOptions {}
|
|
|
2282
3413
|
declare class SignalWire extends Destroyable implements DeviceController {
|
|
2283
3414
|
/** Global SDK preferences (timeouts, ICE config, media defaults). */
|
|
2284
3415
|
preferences: ClientPreferences;
|
|
2285
|
-
private
|
|
3416
|
+
private _user$;
|
|
2286
3417
|
private _directory$;
|
|
2287
3418
|
private _transport;
|
|
2288
3419
|
private _clientSession;
|
|
@@ -2294,9 +3425,43 @@ declare class SignalWire extends Destroyable implements DeviceController {
|
|
|
2294
3425
|
private _errors$;
|
|
2295
3426
|
private _options;
|
|
2296
3427
|
private _refreshTimerId?;
|
|
3428
|
+
private _dpopManager?;
|
|
3429
|
+
private _deviceTokenManager?;
|
|
3430
|
+
private _credentialProvider?;
|
|
2297
3431
|
private _deps;
|
|
2298
|
-
|
|
3432
|
+
private _networkMonitor?;
|
|
3433
|
+
private _visibilityController?;
|
|
3434
|
+
private _diagnosticsCollector?;
|
|
3435
|
+
private _platformCapabilities?;
|
|
3436
|
+
/**
|
|
3437
|
+
* Creates a new SignalWire client and begins connecting.
|
|
3438
|
+
*
|
|
3439
|
+
* @param credentialProvider - Provider that supplies authentication credentials.
|
|
3440
|
+
* @param options - Configuration options (connection, device monitoring, preferences).
|
|
3441
|
+
*/
|
|
3442
|
+
constructor(credentialProvider: CredentialProvider | undefined, options?: SignalWireOptions);
|
|
3443
|
+
/**
|
|
3444
|
+
* Initializes DPoP if not already set up. Returns the fingerprint on success.
|
|
3445
|
+
*/
|
|
3446
|
+
private initDPoP;
|
|
3447
|
+
/**
|
|
3448
|
+
* Resolves credentials using cache-first strategy when persistSession is enabled.
|
|
3449
|
+
*
|
|
3450
|
+
* 1. If persistSession → check localStorage for cached credential
|
|
3451
|
+
* 2. If cached and not expired → use it (skip provider.authenticate())
|
|
3452
|
+
* 3. If no cache or expired → call provider.authenticate()
|
|
3453
|
+
* 4. If no provider AND no cache → throw
|
|
3454
|
+
*/
|
|
3455
|
+
private resolveCredentials;
|
|
2299
3456
|
private validateCredentials;
|
|
3457
|
+
/**
|
|
3458
|
+
* Schedules credential refresh with exponential backoff retry on failure.
|
|
3459
|
+
* On success, resets attempt counter and schedules the next refresh.
|
|
3460
|
+
* After exhausting retries, emits TokenRefreshError and disconnects.
|
|
3461
|
+
*/
|
|
3462
|
+
private scheduleCredentialRefresh;
|
|
3463
|
+
/** Persist credential to localStorage when persistSession is enabled. */
|
|
3464
|
+
private persistCredential;
|
|
2300
3465
|
private init;
|
|
2301
3466
|
private handleAttachments;
|
|
2302
3467
|
/**
|
|
@@ -2309,9 +3474,9 @@ declare class SignalWire extends Destroyable implements DeviceController {
|
|
|
2309
3474
|
* unexpectedly (e.g. network change, server restart). Reconnection uses an
|
|
2310
3475
|
* **exponential back-off** strategy:
|
|
2311
3476
|
*
|
|
2312
|
-
* - First retry after `reconnectDelayMin` (default **1 s**).
|
|
3477
|
+
* - First retry after `reconnectDelayMin` (default **0.1 s**).
|
|
2313
3478
|
* - Each subsequent retry doubles the delay up to `reconnectDelayMax`
|
|
2314
|
-
* (default **
|
|
3479
|
+
* (default **3 s**).
|
|
2315
3480
|
* - The delay resets to `reconnectDelayMin` once a connection succeeds.
|
|
2316
3481
|
* - A per-attempt `connectionTimeout` (default **10 s**) aborts the
|
|
2317
3482
|
* attempt and schedules the next retry if the server does not respond.
|
|
@@ -2338,19 +3503,19 @@ declare class SignalWire extends Destroyable implements DeviceController {
|
|
|
2338
3503
|
*/
|
|
2339
3504
|
connect(): Promise<void>;
|
|
2340
3505
|
/**
|
|
2341
|
-
* Observable that emits the {@link
|
|
3506
|
+
* Observable that emits the {@link User} profile once fetched,
|
|
2342
3507
|
* or `undefined` before authentication completes.
|
|
2343
3508
|
*
|
|
2344
3509
|
* @example
|
|
2345
3510
|
* ```ts
|
|
2346
|
-
* client.
|
|
2347
|
-
* if (
|
|
3511
|
+
* client.user$.subscribe(u => {
|
|
3512
|
+
* if (u) console.log('Logged in as', u.email);
|
|
2348
3513
|
* });
|
|
2349
3514
|
* ```
|
|
2350
3515
|
*/
|
|
2351
|
-
get
|
|
2352
|
-
/** Current
|
|
2353
|
-
get
|
|
3516
|
+
get user$(): Observable<User | undefined>;
|
|
3517
|
+
/** Current user snapshot, or `undefined` if not yet authenticated. */
|
|
3518
|
+
get user(): User | undefined;
|
|
2354
3519
|
/**
|
|
2355
3520
|
* Observable that emits the {@link Directory} instance once the client is connected,
|
|
2356
3521
|
* or `undefined` while disconnected. Subscribe to this to safely wait for the directory
|
|
@@ -2369,9 +3534,9 @@ declare class SignalWire extends Destroyable implements DeviceController {
|
|
|
2369
3534
|
* Prefer {@link directory$} when you need to react to the directory becoming available.
|
|
2370
3535
|
*/
|
|
2371
3536
|
get directory(): Directory | undefined;
|
|
2372
|
-
/** Observable that emits when the
|
|
3537
|
+
/** Observable that emits when the user registration state changes. */
|
|
2373
3538
|
get isRegistered$(): Observable<boolean>;
|
|
2374
|
-
/** Whether the
|
|
3539
|
+
/** Whether the user is currently registered. */
|
|
2375
3540
|
get isRegistered(): boolean;
|
|
2376
3541
|
/** Whether the client is currently connected. */
|
|
2377
3542
|
get isConnected(): boolean;
|
|
@@ -2381,20 +3546,94 @@ declare class SignalWire extends Destroyable implements DeviceController {
|
|
|
2381
3546
|
get ready$(): Observable<boolean>;
|
|
2382
3547
|
/** Observable stream of errors from transport, authentication, and devices. */
|
|
2383
3548
|
get errors$(): Observable<Error>;
|
|
2384
|
-
/**
|
|
3549
|
+
/** Platform WebRTC capabilities detected at construction time. */
|
|
3550
|
+
get platformCapabilities(): PlatformCapabilities;
|
|
3551
|
+
/** Observable that emits when the SDK auto-switches a device. */
|
|
3552
|
+
get deviceRecovered$(): Observable<DeviceRecoveryEvent>;
|
|
3553
|
+
/**
|
|
3554
|
+
* Export a structured diagnostic bundle for support/debugging.
|
|
3555
|
+
* Includes connection events, call summaries, and device changes.
|
|
3556
|
+
*/
|
|
3557
|
+
exportDiagnostics(): SessionDiagnostics;
|
|
3558
|
+
/**
|
|
3559
|
+
* Initialize resilience subsystems. Non-fatal: any failure is logged and
|
|
3560
|
+
* the SDK continues working without the failing subsystem.
|
|
3561
|
+
*/
|
|
3562
|
+
private initResilienceSubsystems;
|
|
3563
|
+
/**
|
|
3564
|
+
* Disconnects the WebSocket and tears down the current session.
|
|
3565
|
+
*
|
|
3566
|
+
* The client can be reconnected by calling {@link connect} again,
|
|
3567
|
+
* which creates a fresh transport and session.
|
|
3568
|
+
*/
|
|
2385
3569
|
disconnect(): Promise<void>;
|
|
3570
|
+
/**
|
|
3571
|
+
* Tear down the current transport / session / attach manager. Safe to call
|
|
3572
|
+
* when nothing has been initialized yet (e.g. first connect()).
|
|
3573
|
+
*/
|
|
3574
|
+
private teardownTransportAndSession;
|
|
2386
3575
|
private waitAuthentication;
|
|
2387
|
-
/**
|
|
3576
|
+
/**
|
|
3577
|
+
* Registers the user as online to receive inbound calls and events.
|
|
3578
|
+
*
|
|
3579
|
+
* Waits for authentication to complete before sending the registration.
|
|
3580
|
+
* If the initial attempt fails, reauthentication is attempted automatically.
|
|
3581
|
+
*
|
|
3582
|
+
* @throws {InvalidCredentialsError} If registration and reauthentication both fail.
|
|
3583
|
+
*/
|
|
2388
3584
|
register(): Promise<void>;
|
|
2389
|
-
/**
|
|
3585
|
+
/**
|
|
3586
|
+
* Unregisters the user, going offline for inbound calls.
|
|
3587
|
+
*
|
|
3588
|
+
* The WebSocket connection remains open; use {@link disconnect} to fully close it.
|
|
3589
|
+
*/
|
|
2390
3590
|
unregister(): Promise<void>;
|
|
2391
3591
|
/**
|
|
2392
3592
|
* Places an outbound call to the given destination.
|
|
2393
|
-
*
|
|
2394
|
-
*
|
|
3593
|
+
*
|
|
3594
|
+
* Waits for authentication before dialing. Media options are merged from
|
|
3595
|
+
* saved preferences, destination query parameters (e.g. `?channel=video`),
|
|
3596
|
+
* and the provided `options` (highest priority).
|
|
3597
|
+
*
|
|
3598
|
+
* Returns a {@link Call} in `'ringing'` state. Subscribe to {@link Call.status$}
|
|
3599
|
+
* to track progression through `'connected'` → `'disconnected'`.
|
|
3600
|
+
*
|
|
3601
|
+
* @param destination - Address URI string (e.g. `'/public/my-room'`) or {@link Address} instance.
|
|
3602
|
+
* @param options - Media and dial options (audio/video, device constraints). Overrides defaults.
|
|
2395
3603
|
* @returns The created {@link Call} instance.
|
|
3604
|
+
* @throws {Error} If authentication is not complete or call creation fails.
|
|
3605
|
+
*
|
|
3606
|
+
* @example
|
|
3607
|
+
* ```ts
|
|
3608
|
+
* const call = await client.dial('/public/conference', {
|
|
3609
|
+
* audio: true,
|
|
3610
|
+
* video: true,
|
|
3611
|
+
* });
|
|
3612
|
+
* call.status$.subscribe(status => console.log('Call:', status));
|
|
3613
|
+
* ```
|
|
2396
3614
|
*/
|
|
2397
3615
|
dial(destination: string | Address, options?: DialOptions): Promise<Call>;
|
|
3616
|
+
/**
|
|
3617
|
+
* Runs a multi-phase connectivity test against the given destination.
|
|
3618
|
+
*
|
|
3619
|
+
* The test checks:
|
|
3620
|
+
* 1. **Signaling** -- WebSocket connected, RTT measurement
|
|
3621
|
+
* 2. **Devices** -- getUserMedia succeeds with selected (or specified) devices
|
|
3622
|
+
* 3. **ICE/TURN** -- gathers ICE candidates to verify STUN/TURN reachability
|
|
3623
|
+
* 4. **Media/bandwidth** (unless `skipMediaTest`) -- dials the destination,
|
|
3624
|
+
* collects getStats() for `duration` seconds, computes bandwidth estimates
|
|
3625
|
+
*
|
|
3626
|
+
* @param destination - A destination to dial for the media test (e.g. `'/private/network-test'`).
|
|
3627
|
+
* @param options - Preflight options (duration, skipMediaTest, device overrides).
|
|
3628
|
+
* @returns A {@link PreflightResult} describing connectivity health.
|
|
3629
|
+
*
|
|
3630
|
+
* @example
|
|
3631
|
+
* ```ts
|
|
3632
|
+
* const result = await client.preflight('/private/network-test', { duration: 5 });
|
|
3633
|
+
* if (!result.ok) console.warn('Connectivity issues:', result.warnings);
|
|
3634
|
+
* ```
|
|
3635
|
+
*/
|
|
3636
|
+
preflight(destination: string, options?: PreflightOptions): Promise<PreflightResult>;
|
|
2398
3637
|
/** The underlying client session for advanced RPC operations. */
|
|
2399
3638
|
get session(): ClientSessionWrapper;
|
|
2400
3639
|
/** Observable list of available audio input (microphone) devices. */
|
|
@@ -2421,10 +3660,10 @@ declare class SignalWire extends Destroyable implements DeviceController {
|
|
|
2421
3660
|
get selectedAudioOutputDevice(): MediaDeviceInfo | null;
|
|
2422
3661
|
/** Currently selected video input device, or `null` if none. */
|
|
2423
3662
|
get selectedVideoInputDevice(): MediaDeviceInfo | null;
|
|
2424
|
-
/** Media track constraints for the selected audio input device. */
|
|
2425
|
-
get selectedAudioInputDeviceConstraints(): MediaTrackConstraints;
|
|
2426
|
-
/** Media track constraints for the selected video input device. */
|
|
2427
|
-
get selectedVideoInputDeviceConstraints(): MediaTrackConstraints;
|
|
3663
|
+
/** Media track constraints for the selected audio input device. Returns `false` when disabled. */
|
|
3664
|
+
get selectedAudioInputDeviceConstraints(): MediaTrackConstraints | boolean;
|
|
3665
|
+
/** Media track constraints for the selected video input device. Returns `false` when disabled. */
|
|
3666
|
+
get selectedVideoInputDeviceConstraints(): MediaTrackConstraints | boolean;
|
|
2428
3667
|
/** Converts a `MediaDeviceInfo` to track constraints suitable for `getUserMedia`. */
|
|
2429
3668
|
deviceInfoToConstraints(deviceInfo: MediaDeviceInfo | null): MediaTrackConstraints;
|
|
2430
3669
|
/** Sets the preferred audio input device. */
|
|
@@ -2433,12 +3672,79 @@ declare class SignalWire extends Destroyable implements DeviceController {
|
|
|
2433
3672
|
selectVideoInputDevice(device: MediaDeviceInfo | null): void;
|
|
2434
3673
|
/** Sets the preferred audio output device. */
|
|
2435
3674
|
selectAudioOutputDevice(device: MediaDeviceInfo | null): void;
|
|
3675
|
+
/**
|
|
3676
|
+
* Apply the currently selected audio output device to an HTMLMediaElement
|
|
3677
|
+
* (e.g. the `<audio>` or `<video>` element the consumer attached the
|
|
3678
|
+
* remote stream to). Uses `HTMLMediaElement.setSinkId` under the hood.
|
|
3679
|
+
* Returns a `Promise<boolean>`: `true` if the sink was applied,
|
|
3680
|
+
* `false` if the browser doesn't support `setSinkId` or no device is
|
|
3681
|
+
* selected.
|
|
3682
|
+
*
|
|
3683
|
+
* @example
|
|
3684
|
+
* ```ts
|
|
3685
|
+
* audioEl.srcObject = call.remoteStream;
|
|
3686
|
+
* await client.applySelectedAudioOutputDevice(audioEl);
|
|
3687
|
+
* ```
|
|
3688
|
+
*/
|
|
3689
|
+
applySelectedAudioOutputDevice(element: HTMLMediaElement): Promise<boolean>;
|
|
2436
3690
|
/** Starts monitoring for media device changes (connect/disconnect). */
|
|
2437
3691
|
enableDeviceMonitoring(): void;
|
|
2438
3692
|
/** Stops monitoring for media device changes. */
|
|
2439
3693
|
disableDeviceMonitoring(): void;
|
|
3694
|
+
/**
|
|
3695
|
+
* Returns the capabilities of a media device.
|
|
3696
|
+
* @param deviceInfo - The device to query.
|
|
3697
|
+
* @returns The device capabilities, or `null` if unavailable.
|
|
3698
|
+
*/
|
|
2440
3699
|
getDeviceCapabilities(deviceInfo: MediaDeviceInfo): Promise<MediaTrackCapabilities | null>;
|
|
3700
|
+
/**
|
|
3701
|
+
* Checks whether a device is still available and usable.
|
|
3702
|
+
* @param deviceInfo - The device to validate, or `null`.
|
|
3703
|
+
* @returns `true` if the device is valid and available. Returns `false` for `null`, audio output devices, or unavailable devices.
|
|
3704
|
+
*/
|
|
2441
3705
|
isValidDevice(deviceInfo: MediaDeviceInfo | null): Promise<boolean>;
|
|
3706
|
+
/** Injects a storage manager into the device controller for persistence. */
|
|
3707
|
+
setStorageManager(storageManager: StorageManager): void;
|
|
3708
|
+
/** Clears all device state and re-enumerates. */
|
|
3709
|
+
clearDeviceState(): Promise<void>;
|
|
3710
|
+
/** Forces a device re-enumeration. */
|
|
3711
|
+
enumerateDevices(): Promise<void>;
|
|
3712
|
+
/** Disables audio input (receive-only mode). No audio track will be acquired. */
|
|
3713
|
+
disableAudioInput(): void;
|
|
3714
|
+
/** Re-enables audio input, restoring the last selection or auto-selecting. */
|
|
3715
|
+
enableAudioInput(): void;
|
|
3716
|
+
/** Disables video input (receive-only mode). No video track will be acquired. */
|
|
3717
|
+
disableVideoInput(): void;
|
|
3718
|
+
/** Re-enables video input, restoring the last selection or auto-selecting. */
|
|
3719
|
+
enableVideoInput(): void;
|
|
3720
|
+
/** Observable that emits `true` when video input is disabled (receive-only). */
|
|
3721
|
+
get videoInputDisabled$(): Observable<boolean>;
|
|
3722
|
+
/** Observable that emits `true` when audio input is disabled (receive-only). */
|
|
3723
|
+
get audioInputDisabled$(): Observable<boolean>;
|
|
3724
|
+
/** Whether video input is currently disabled. */
|
|
3725
|
+
get videoInputDisabled(): boolean;
|
|
3726
|
+
/** Whether audio input is currently disabled. */
|
|
3727
|
+
get audioInputDisabled(): boolean;
|
|
3728
|
+
/**
|
|
3729
|
+
* Triggers the browser's media permission dialog and captures the user's device selections.
|
|
3730
|
+
*
|
|
3731
|
+
* @param options - Which permissions to request.
|
|
3732
|
+
* @param options.audio - Whether to request audio permission.
|
|
3733
|
+
* @param options.video - Whether to request video permission.
|
|
3734
|
+
* @returns The permission result with selected devices.
|
|
3735
|
+
*/
|
|
3736
|
+
requestMediaPermissions(options?: {
|
|
3737
|
+
audio?: boolean;
|
|
3738
|
+
video?: boolean;
|
|
3739
|
+
}): Promise<PermissionResult>;
|
|
3740
|
+
/**
|
|
3741
|
+
* Clears all SDK-persisted state and resets to defaults.
|
|
3742
|
+
*
|
|
3743
|
+
* This clears device preferences, device history, authorization state,
|
|
3744
|
+
* attached call IDs, and all SDK storage keys, then re-enumerates devices.
|
|
3745
|
+
*/
|
|
3746
|
+
resetToDefaults(): Promise<void>;
|
|
3747
|
+
/** Destroys the client, clearing timers and releasing all resources. */
|
|
2442
3748
|
destroy(): void;
|
|
2443
3749
|
}
|
|
2444
3750
|
//#endregion
|
|
@@ -2481,6 +3787,126 @@ declare class StaticCredentialProvider implements CredentialProvider {
|
|
|
2481
3787
|
authenticate(): Promise<SDKCredential>;
|
|
2482
3788
|
}
|
|
2483
3789
|
//#endregion
|
|
3790
|
+
//#region src/dependencies/EmbedTokenCredentialProvider.d.ts
|
|
3791
|
+
/** Credential provider that exchanges an embed token for a SAT via the host's token endpoint. */
|
|
3792
|
+
declare class EmbedTokenCredentialProvider implements CredentialProvider {
|
|
3793
|
+
private host;
|
|
3794
|
+
private embedToken;
|
|
3795
|
+
constructor(host: string, embedToken: string);
|
|
3796
|
+
private fetchSAT;
|
|
3797
|
+
authenticate(): Promise<{
|
|
3798
|
+
token: string;
|
|
3799
|
+
expiry_at: number;
|
|
3800
|
+
}>;
|
|
3801
|
+
refresh(): Promise<{
|
|
3802
|
+
token: string;
|
|
3803
|
+
expiry_at: number;
|
|
3804
|
+
}>;
|
|
3805
|
+
}
|
|
3806
|
+
//#endregion
|
|
3807
|
+
//#region src/controllers/LocalAudioPipeline.d.ts
|
|
3808
|
+
/**
|
|
3809
|
+
* Options for {@link LocalAudioPipeline}.
|
|
3810
|
+
*/
|
|
3811
|
+
interface LocalAudioPipelineOptions {
|
|
3812
|
+
/** Factory for AudioContext — override for tests. Defaults to `new AudioContext()`. */
|
|
3813
|
+
audioContextFactory?: () => AudioContext;
|
|
3814
|
+
/** Initial gain (0..2, where 1 is unity). Defaults to 1. */
|
|
3815
|
+
initialGain?: number;
|
|
3816
|
+
/** RMS level [0..1] above which speaking$ emits true. Defaults to {@link VAD_THRESHOLD}. */
|
|
3817
|
+
speakingThreshold?: number;
|
|
3818
|
+
/**
|
|
3819
|
+
* Milliseconds of silence below the threshold before speaking$ flips back to
|
|
3820
|
+
* false. Prevents flicker on normal speech gaps. Defaults to {@link VAD_HOLD_MS}.
|
|
3821
|
+
*/
|
|
3822
|
+
speakingHoldMs?: number;
|
|
3823
|
+
/** Polling interval for level$. Defaults to {@link AUDIO_LEVEL_POLL_INTERVAL_MS}. */
|
|
3824
|
+
pollIntervalMs?: number;
|
|
3825
|
+
}
|
|
3826
|
+
/**
|
|
3827
|
+
* Web Audio pipeline for the local microphone stream.
|
|
3828
|
+
*
|
|
3829
|
+
* Wraps the raw mic `MediaStreamTrack` in a graph of:
|
|
3830
|
+
*
|
|
3831
|
+
* ```
|
|
3832
|
+
* MediaStreamAudioSourceNode → GainNode → AnalyserNode → MediaStreamAudioDestinationNode
|
|
3833
|
+
* ```
|
|
3834
|
+
*
|
|
3835
|
+
* The {@link outputTrack} from the destination node is what callers should
|
|
3836
|
+
* attach to the `RTCRtpSender` in place of the raw mic track. The same
|
|
3837
|
+
* destination track is reused across input changes (device switch, mute /
|
|
3838
|
+
* unmute track replacement) so the sender reference stays stable — only the
|
|
3839
|
+
* source end of the graph is rebuilt.
|
|
3840
|
+
*
|
|
3841
|
+
* The pipeline owns a single {@link AudioContext}. Callers must invoke
|
|
3842
|
+
* {@link destroy} to release it when the call ends.
|
|
3843
|
+
*/
|
|
3844
|
+
declare class LocalAudioPipeline extends Destroyable {
|
|
3845
|
+
private readonly _audioContext;
|
|
3846
|
+
private readonly _gainNode;
|
|
3847
|
+
private readonly _analyser;
|
|
3848
|
+
private readonly _destination;
|
|
3849
|
+
private readonly _analyserBuffer;
|
|
3850
|
+
private readonly _speakingThreshold;
|
|
3851
|
+
private readonly _speakingHoldMs;
|
|
3852
|
+
private readonly _pollIntervalMs;
|
|
3853
|
+
private _inputSource;
|
|
3854
|
+
private _inputStream;
|
|
3855
|
+
private _lastSpokeAt;
|
|
3856
|
+
private _gain$;
|
|
3857
|
+
/** 1 when audio should pass through, 0 when silenced by PTT. */
|
|
3858
|
+
private _pttMultiplier;
|
|
3859
|
+
constructor(options?: LocalAudioPipelineOptions);
|
|
3860
|
+
/** Observable of the current gain value (0..2). */
|
|
3861
|
+
get gain$(): Observable<number>;
|
|
3862
|
+
/** Current gain value (0..2). */
|
|
3863
|
+
get gain(): number;
|
|
3864
|
+
/**
|
|
3865
|
+
* Processed output track to attach to the RTCRtpSender. Stable reference
|
|
3866
|
+
* across input changes, so `sender.replaceTrack(pipeline.outputTrack)` only
|
|
3867
|
+
* needs to be called once.
|
|
3868
|
+
*/
|
|
3869
|
+
get outputTrack(): MediaStreamTrack;
|
|
3870
|
+
/**
|
|
3871
|
+
* Root-mean-square audio level of the input signal, 0..1. Emits on a fixed
|
|
3872
|
+
* interval (~30fps by default).
|
|
3873
|
+
*/
|
|
3874
|
+
get level$(): Observable<number>;
|
|
3875
|
+
/**
|
|
3876
|
+
* Boolean VAD derived from {@link level$}. True while level ≥ threshold or
|
|
3877
|
+
* during the hold window after the last frame that crossed the threshold.
|
|
3878
|
+
*/
|
|
3879
|
+
get speaking$(): Observable<boolean>;
|
|
3880
|
+
/**
|
|
3881
|
+
* Set gain multiplier applied to the input signal. 0 = silence,
|
|
3882
|
+
* 1 = unity, 2 = 2x. Values are clamped to [0, 2]. The effective gain on
|
|
3883
|
+
* the graph also respects the current PTT state.
|
|
3884
|
+
*/
|
|
3885
|
+
setGain(value: number): void;
|
|
3886
|
+
/**
|
|
3887
|
+
* Silence the graph when `active = false`, otherwise restore the configured
|
|
3888
|
+
* gain. Use this from a PTT handler: released → `false`, held → `true`.
|
|
3889
|
+
* Orthogonal to {@link setGain} — once PTT returns to active, the last
|
|
3890
|
+
* configured gain reappears.
|
|
3891
|
+
*/
|
|
3892
|
+
setPTTActive(active: boolean): void;
|
|
3893
|
+
private applyEffectiveGain;
|
|
3894
|
+
/**
|
|
3895
|
+
* Wire a new raw mic track as the pipeline's input. Replaces any previous
|
|
3896
|
+
* input source and reconnects the graph so {@link outputTrack} continues
|
|
3897
|
+
* to emit the processed audio. Pass `null` to disconnect the input (the
|
|
3898
|
+
* output track stays alive but emits silence).
|
|
3899
|
+
*
|
|
3900
|
+
* Also resumes the underlying AudioContext on attach — Chrome creates it
|
|
3901
|
+
* in a suspended state and the graph won't process (the destination
|
|
3902
|
+
* track emits silence) until resume() succeeds.
|
|
3903
|
+
*/
|
|
3904
|
+
setInputTrack(track: MediaStreamTrack | null): void;
|
|
3905
|
+
destroy(): void;
|
|
3906
|
+
private computeLevel;
|
|
3907
|
+
private evaluateSpeaking;
|
|
3908
|
+
}
|
|
3909
|
+
//#endregion
|
|
2484
3910
|
//#region src/controllers/RTCPeerConnectionController.d.ts
|
|
2485
3911
|
interface RTCPeerConnectionControllerOptions extends MediaOptions {
|
|
2486
3912
|
callId?: string;
|
|
@@ -2495,6 +3921,12 @@ interface RTCPeerConnectionControllerOptions extends MediaOptions {
|
|
|
2495
3921
|
iceCandidateTimeout?: number;
|
|
2496
3922
|
iceGatheringTimeout?: number;
|
|
2497
3923
|
webRTCApiProvider?: WebRTCApiProvider;
|
|
3924
|
+
/** Per-call preferred video codecs (overrides global preferences). */
|
|
3925
|
+
preferredVideoCodecs?: string[];
|
|
3926
|
+
/** Per-call preferred audio codecs (overrides global preferences). */
|
|
3927
|
+
preferredAudioCodecs?: string[];
|
|
3928
|
+
/** Per-call stereo Opus setting (overrides global preferences). */
|
|
3929
|
+
stereo?: boolean;
|
|
2498
3930
|
}
|
|
2499
3931
|
type RTCPeerConnectionControllerOptionsPartial = Partial<RTCPeerConnectionControllerOptions>;
|
|
2500
3932
|
interface UpdateSDPStatusParams {
|
|
@@ -2535,6 +3967,7 @@ declare class RTCPeerConnectionController extends Destroyable {
|
|
|
2535
3967
|
private _remoteDescription$;
|
|
2536
3968
|
private _remoteStream$;
|
|
2537
3969
|
private _remoteOfferMediaDirections;
|
|
3970
|
+
private _localAudioPipeline;
|
|
2538
3971
|
constructor(options?: RTCPeerConnectionControllerOptionsPartial, remoteSessionDescription?: string, deviceController?: DeviceController);
|
|
2539
3972
|
private get iceGatheringController();
|
|
2540
3973
|
private get shouldEmitLocalDescription();
|
|
@@ -2622,7 +4055,22 @@ declare class RTCPeerConnectionController extends Destroyable {
|
|
|
2622
4055
|
*/
|
|
2623
4056
|
private setupEventListeners;
|
|
2624
4057
|
private negotiationEnded;
|
|
2625
|
-
|
|
4058
|
+
/**
|
|
4059
|
+
* Trigger an ICE restart through the existing negotiation pipeline.
|
|
4060
|
+
*
|
|
4061
|
+
* This creates an offer with iceRestart: true and goes through the full
|
|
4062
|
+
* SDP pipeline (setLocalDescription → ICE gathering → localDescription$ emission).
|
|
4063
|
+
* The caller should NOT send the SDP manually — the existing
|
|
4064
|
+
* setupLocalDescriptionHandler in VertoManager will pick up the emission
|
|
4065
|
+
* from localDescription$ and send it as a verto.modify.
|
|
4066
|
+
*
|
|
4067
|
+
* Unlike calling pc.createOffer/setLocalDescription directly, this method:
|
|
4068
|
+
* - Sets _isNegotiating$ so ICEGatheringController arms its timers
|
|
4069
|
+
* - Waits for ICE gathering to complete before localDescription$ emits
|
|
4070
|
+
* - Goes through setLocalDescriptionBefore() for any SDP munging
|
|
4071
|
+
*/
|
|
4072
|
+
triggerIceRestart(relayOnly?: boolean): Promise<void>;
|
|
4073
|
+
private restoreIceTransportPolicy;
|
|
2626
4074
|
/**
|
|
2627
4075
|
* Setup track handling for remote tracks.
|
|
2628
4076
|
*/
|
|
@@ -2632,6 +4080,17 @@ declare class RTCPeerConnectionController extends Destroyable {
|
|
|
2632
4080
|
private getDisplayMedia;
|
|
2633
4081
|
private setupRemoteTracks;
|
|
2634
4082
|
restoreTrackSender(kind: 'audio' | 'video' | 'both'): Promise<void>;
|
|
4083
|
+
/**
|
|
4084
|
+
* Return the lazily-created {@link LocalAudioPipeline}, constructing it on
|
|
4085
|
+
* first access. On creation the current audio sender's track is routed
|
|
4086
|
+
* through the pipeline (input → gain → analyser → destination) and the
|
|
4087
|
+
* sender is switched to emit the processed track. Returns `null` when no
|
|
4088
|
+
* audio sender exists yet (pre-negotiation).
|
|
4089
|
+
*/
|
|
4090
|
+
ensureLocalAudioPipeline(): LocalAudioPipeline | null;
|
|
4091
|
+
/** The active LocalAudioPipeline, or null if it hasn't been created yet. */
|
|
4092
|
+
get localAudioPipeline(): LocalAudioPipeline | null;
|
|
4093
|
+
private applyLocalAudioPipelineToSender;
|
|
2635
4094
|
/**
|
|
2636
4095
|
* Add a local media track to the peer connection.
|
|
2637
4096
|
* @param track - The MediaStreamTrack to add
|
|
@@ -2649,6 +4108,13 @@ declare class RTCPeerConnectionController extends Destroyable {
|
|
|
2649
4108
|
*/
|
|
2650
4109
|
setLocalTrack(track: MediaStreamTrack): void;
|
|
2651
4110
|
updateSendersConstraints(kind: 'audio' | 'video', constraints?: MediaTrackConstraints): Promise<void>;
|
|
4111
|
+
/**
|
|
4112
|
+
* Replace the current audio track with a new one using the given constraints.
|
|
4113
|
+
* Used for server-pushed audio constraint changes where applyConstraints
|
|
4114
|
+
* fails on iOS Safari. Stops the current track, acquires a new one via
|
|
4115
|
+
* getUserMedia, and replaces the sender track.
|
|
4116
|
+
*/
|
|
4117
|
+
replaceAudioTrackWithConstraints(constraints: MediaTrackConstraints): Promise<void>;
|
|
2652
4118
|
/**
|
|
2653
4119
|
* Clean up resources and close the peer connection.
|
|
2654
4120
|
* Completes all observables to prevent memory leaks.
|
|
@@ -2687,10 +4153,23 @@ interface WebRTCVerto extends VertoManager {
|
|
|
2687
4153
|
unhold(): Promise<void>;
|
|
2688
4154
|
destroy(): void;
|
|
2689
4155
|
transfer(options: TransferOptions): Promise<void>;
|
|
4156
|
+
/** Request a video keyframe via verto.modify. */
|
|
4157
|
+
requestKeyframe?: () => void;
|
|
4158
|
+
/** Request an ICE restart via verto.modify with iceRestart offer. */
|
|
4159
|
+
requestIceRestart?: (relayOnly?: boolean) => Promise<void>;
|
|
4160
|
+
/** Request an ICE restart on all active peer connections (multi-leg). */
|
|
4161
|
+
requestIceRestartAll?: (relayOnly?: boolean) => Promise<void>;
|
|
4162
|
+
/** Request keyframes on all video-receiving legs (skips send-only screen share). */
|
|
4163
|
+
requestKeyframeAll?: () => void;
|
|
4164
|
+
/** Lazily create (or return) the local audio pipeline for the main peer connection. */
|
|
4165
|
+
ensureLocalAudioPipeline(): LocalAudioPipeline | null;
|
|
4166
|
+
/** Current local audio pipeline, or null if it has not been created yet. */
|
|
4167
|
+
readonly localAudioPipeline: LocalAudioPipeline | null;
|
|
2690
4168
|
}
|
|
2691
4169
|
//#endregion
|
|
2692
4170
|
//#region src/managers/CallEventsManager.d.ts
|
|
2693
4171
|
interface WebRTCCallEventManagerOptions {}
|
|
4172
|
+
/** @internal */
|
|
2694
4173
|
declare class CallEventsManager extends Destroyable {
|
|
2695
4174
|
protected webRtcCallSession: CallManager;
|
|
2696
4175
|
protected options: WebRTCCallEventManagerOptions;
|
|
@@ -2716,7 +4195,7 @@ declare class CallEventsManager extends Destroyable {
|
|
|
2716
4195
|
get raiseHandPriority$(): Observable<boolean>;
|
|
2717
4196
|
get locked$(): Observable<boolean>;
|
|
2718
4197
|
get meta$(): Observable<Record<string, unknown>>;
|
|
2719
|
-
get capabilities$(): Observable<
|
|
4198
|
+
get capabilities$(): Observable<Capability[]>;
|
|
2720
4199
|
get layout$(): Observable<string>;
|
|
2721
4200
|
get layouts$(): Observable<string[]>;
|
|
2722
4201
|
get layoutLayers$(): Observable<LayoutLayer[]>;
|
|
@@ -2729,7 +4208,7 @@ declare class CallEventsManager extends Destroyable {
|
|
|
2729
4208
|
get meta(): Record<string, unknown>;
|
|
2730
4209
|
get layout(): string | undefined;
|
|
2731
4210
|
get layouts(): string[];
|
|
2732
|
-
get capabilities():
|
|
4211
|
+
get capabilities(): Capability[];
|
|
2733
4212
|
isSessionEvent(id: string): boolean;
|
|
2734
4213
|
protected initSubscriptions(): void;
|
|
2735
4214
|
private updateParticipantPositions;
|
|
@@ -2742,6 +4221,27 @@ declare class CallEventsManager extends Destroyable {
|
|
|
2742
4221
|
destroy(): void;
|
|
2743
4222
|
}
|
|
2744
4223
|
//#endregion
|
|
4224
|
+
//#region src/managers/CallRecoveryManager.d.ts
|
|
4225
|
+
type RecoveryState$1 = 'idle' | 'debouncing' | 'recovering' | 'cooldown';
|
|
4226
|
+
interface RecoveryEvent$1 {
|
|
4227
|
+
action: 'keyframe_requested' | 'reinvite_started' | 'reinvite_succeeded' | 'reinvite_failed' | 'reinvite_timeout' | 'max_attempts_reached' | 'signal_reconnect' | 'full_reconnect' | 'video_disabled' | 'video_restored';
|
|
4228
|
+
reason: string;
|
|
4229
|
+
attempt?: number;
|
|
4230
|
+
maxAttempts?: number;
|
|
4231
|
+
timestamp: number;
|
|
4232
|
+
}
|
|
4233
|
+
//#endregion
|
|
4234
|
+
//#region src/utils/qualityScore.d.ts
|
|
4235
|
+
/**
|
|
4236
|
+
* MOS (Mean Opinion Score) quality computation based on the simplified
|
|
4237
|
+
* ITU-T G.107 E-model.
|
|
4238
|
+
*
|
|
4239
|
+
* Provides a single 1-5 number that applications can use for a
|
|
4240
|
+
* green / yellow / red quality indicator without understanding raw
|
|
4241
|
+
* jitter and packet-loss values.
|
|
4242
|
+
*/
|
|
4243
|
+
type QualityLevel$1 = 'excellent' | 'good' | 'fair' | 'poor' | 'critical';
|
|
4244
|
+
//#endregion
|
|
2745
4245
|
//#region src/core/entities/Call.d.ts
|
|
2746
4246
|
/**
|
|
2747
4247
|
* Manager instances returned by initialization callback
|
|
@@ -2769,6 +4269,10 @@ interface CallInitialization {
|
|
|
2769
4269
|
* Device controller for media device access
|
|
2770
4270
|
*/
|
|
2771
4271
|
deviceController: DeviceController;
|
|
4272
|
+
/**
|
|
4273
|
+
* Network change events for feeding recovery pipeline
|
|
4274
|
+
*/
|
|
4275
|
+
networkChange$?: Observable<NetworkChangeEvent>;
|
|
2772
4276
|
}
|
|
2773
4277
|
/**
|
|
2774
4278
|
* Concrete WebRTC call implementation.
|
|
@@ -2795,6 +4299,21 @@ declare class WebRTCCall extends Destroyable implements CallManager {
|
|
|
2795
4299
|
private _answerMediaOptions?;
|
|
2796
4300
|
private _holdState;
|
|
2797
4301
|
private _userVariables$;
|
|
4302
|
+
private _statsMonitor?;
|
|
4303
|
+
private _recoveryManager?;
|
|
4304
|
+
private _networkChange$?;
|
|
4305
|
+
private _networkIssues$;
|
|
4306
|
+
private _networkMetrics$;
|
|
4307
|
+
private _isNetworkHealthy$;
|
|
4308
|
+
private _qualityScore$;
|
|
4309
|
+
private _qualityLevel$;
|
|
4310
|
+
private _recoveryState$;
|
|
4311
|
+
private _recoveryEvent$;
|
|
4312
|
+
private _bandwidthConstrained$;
|
|
4313
|
+
private _mediaParamsUpdated$;
|
|
4314
|
+
private _customSubscriptions;
|
|
4315
|
+
private _pushToTalkEnabled;
|
|
4316
|
+
private _remoteAudioMeter;
|
|
2798
4317
|
constructor(clientSession: ClientSession, options: CallOptions, initialization: CallInitialization, address?: Address | undefined);
|
|
2799
4318
|
/** Observable stream of errors from media, signaling, and peer connection layers. */
|
|
2800
4319
|
get errors$(): Observable<CallError>;
|
|
@@ -2803,6 +4322,8 @@ declare class WebRTCCall extends Destroyable implements CallManager {
|
|
|
2803
4322
|
* Fatal errors automatically transition the call to `'failed'` and destroy it.
|
|
2804
4323
|
*/
|
|
2805
4324
|
emitError(callError: CallError): void;
|
|
4325
|
+
/** Notify the recovery manager that a verto.modify signaling exchange failed. */
|
|
4326
|
+
notifyModifyFailed(): void;
|
|
2806
4327
|
/** Whether this call is `'inbound'` or `'outbound'`. */
|
|
2807
4328
|
get direction(): CallDirection;
|
|
2808
4329
|
/** Observable of the address associated with this call. */
|
|
@@ -2820,22 +4341,50 @@ declare class WebRTCCall extends Destroyable implements CallManager {
|
|
|
2820
4341
|
/** @internal Registers an additional call ID for event routing. */
|
|
2821
4342
|
addCallId(callId: string): void;
|
|
2822
4343
|
/** List of capabilities available in the current call. */
|
|
2823
|
-
get capabilities():
|
|
4344
|
+
get capabilities(): Capability[];
|
|
2824
4345
|
/** Current snapshot of all participants in the call. */
|
|
2825
4346
|
get participants(): CallParticipant[];
|
|
2826
4347
|
/** The local participant, or `null` if not yet joined. */
|
|
2827
4348
|
get self(): CallSelfParticipant | null;
|
|
4349
|
+
/** Toggles the call lock state, preventing or allowing new participants from joining. */
|
|
2828
4350
|
toggleLock(): Promise<void>;
|
|
4351
|
+
/**
|
|
4352
|
+
* Toggles the hold state of the call (pauses/resumes local media transmission).
|
|
4353
|
+
*
|
|
4354
|
+
* Distinct from {@link Participant.toggleMute} which mutes individual tracks.
|
|
4355
|
+
*/
|
|
2829
4356
|
toggleHold(): Promise<void>;
|
|
4357
|
+
/** @throws {UnimplementedError} Not yet implemented. Status tracked via {@link recording$}. */
|
|
2830
4358
|
startRecording(): Promise<void>;
|
|
4359
|
+
/** @throws {UnimplementedError} Not yet implemented. Status tracked via {@link streaming$}. */
|
|
2831
4360
|
startStreaming(): Promise<void>;
|
|
4361
|
+
/**
|
|
4362
|
+
* Replaces the call's custom metadata.
|
|
4363
|
+
* @param _meta - Metadata object to set.
|
|
4364
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
4365
|
+
*/
|
|
2832
4366
|
setMeta(_meta: Record<string, unknown>): Promise<void>;
|
|
4367
|
+
/**
|
|
4368
|
+
* Merges values into the call's custom metadata (unlike {@link setMeta} which replaces).
|
|
4369
|
+
* @param _meta - Metadata to merge.
|
|
4370
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
4371
|
+
*/
|
|
2833
4372
|
updateMeta(_meta: Record<string, unknown>): Promise<void>;
|
|
2834
4373
|
/** Observable of layout layer positions for all participants. */
|
|
2835
4374
|
get layoutLayers$(): Observable<LayoutLayer[]>;
|
|
2836
4375
|
/** Current snapshot of layout layers. */
|
|
2837
4376
|
get layoutLayers(): LayoutLayer[];
|
|
2838
|
-
/**
|
|
4377
|
+
/**
|
|
4378
|
+
* Executes a Verto RPC method targeting a specific participant.
|
|
4379
|
+
*
|
|
4380
|
+
* Constructs call context (node_id, call_id, member_id) and sends the RPC request.
|
|
4381
|
+
*
|
|
4382
|
+
* @param target - Target member ID string, or a {@link MemberTarget} object.
|
|
4383
|
+
* @param method - Verto method name (e.g. `'call.mute'`, `'call.member.remove'`).
|
|
4384
|
+
* @param args - Parameters for the RPC method.
|
|
4385
|
+
* @returns The RPC response.
|
|
4386
|
+
* @throws {JSONRPCError} If the RPC call returns an error.
|
|
4387
|
+
*/
|
|
2839
4388
|
executeMethod<T extends JSONRPCResponse = JSONRPCResponse>(target: string | MemberTarget, method: string, args: Record<string, unknown>): Promise<T>;
|
|
2840
4389
|
private buildMethodParams;
|
|
2841
4390
|
/** Observable of the current call status (e.g. `'ringing'`, `'connected'`). */
|
|
@@ -2855,7 +4404,7 @@ declare class WebRTCCall extends Destroyable implements CallManager {
|
|
|
2855
4404
|
/** Observable of custom metadata associated with the call. */
|
|
2856
4405
|
get meta$(): Observable<Record<string, unknown>>;
|
|
2857
4406
|
/** Observable of the call's capability flags. */
|
|
2858
|
-
get capabilities$(): Observable<
|
|
4407
|
+
get capabilities$(): Observable<Capability[]>;
|
|
2859
4408
|
/** Observable of the current layout name. */
|
|
2860
4409
|
get layout$(): Observable<string>;
|
|
2861
4410
|
/** Current call status. */
|
|
@@ -2890,6 +4439,59 @@ declare class WebRTCCall extends Destroyable implements CallManager {
|
|
|
2890
4439
|
get userVariables(): Record<string, unknown>;
|
|
2891
4440
|
/** Merge current custom user variables of the call. */
|
|
2892
4441
|
set userVariables(variables: Record<string, unknown>);
|
|
4442
|
+
/** Observable of current network health issues (empty array = healthy). */
|
|
4443
|
+
get networkIssues$(): Observable<NetworkIssue[]>;
|
|
4444
|
+
/** Current snapshot of network issues. */
|
|
4445
|
+
get networkIssues(): NetworkIssue[];
|
|
4446
|
+
/** Simple boolean health indicator derived from stats monitor. */
|
|
4447
|
+
get isNetworkHealthy$(): Observable<boolean>;
|
|
4448
|
+
/** Whether the network is currently healthy. */
|
|
4449
|
+
get isNetworkHealthy(): boolean;
|
|
4450
|
+
/** Rolling history of raw network metrics (RTT, jitter, packet loss, bitrate). */
|
|
4451
|
+
get networkMetrics$(): Observable<NetworkMetrics[]>;
|
|
4452
|
+
/** Current snapshot of the metrics rolling window. */
|
|
4453
|
+
get networkMetrics(): NetworkMetrics[];
|
|
4454
|
+
/** Observable of MOS quality score (1-5) computed from stats metrics. */
|
|
4455
|
+
get qualityScore$(): Observable<number>;
|
|
4456
|
+
/** Observable of simplified quality level (excellent/good/fair/poor/critical). */
|
|
4457
|
+
get qualityLevel$(): Observable<QualityLevel$1>;
|
|
4458
|
+
/** Observable of the recovery pipeline state machine. */
|
|
4459
|
+
get recoveryState$(): Observable<RecoveryState$1>;
|
|
4460
|
+
/** Observable of recovery events (keyframe requested, ICE restart, etc.). */
|
|
4461
|
+
get recoveryEvent$(): Observable<RecoveryEvent$1>;
|
|
4462
|
+
/** Observable indicating whether the call is bandwidth-constrained. */
|
|
4463
|
+
get bandwidthConstrained$(): Observable<boolean>;
|
|
4464
|
+
/** Observable that emits when server-pushed media params are applied. */
|
|
4465
|
+
get mediaParamsUpdated$(): Observable<MediaParamsEvent>;
|
|
4466
|
+
/**
|
|
4467
|
+
* @internal Emit a media params update event.
|
|
4468
|
+
* Called by the VertoManager when server-pushed media params are applied.
|
|
4469
|
+
*/
|
|
4470
|
+
emitMediaParamsUpdated(event: MediaParamsEvent): void;
|
|
4471
|
+
/** Request a video keyframe via RTCP PLI/FIR. */
|
|
4472
|
+
requestKeyframe(): void;
|
|
4473
|
+
/** Force an ICE restart / re-INVITE. */
|
|
4474
|
+
requestIceRestart(): Promise<void>;
|
|
4475
|
+
/**
|
|
4476
|
+
* @internal Initialize resilience subsystems when the call reaches 'connected'.
|
|
4477
|
+
* Called from within the status subscription to wire stats and recovery.
|
|
4478
|
+
*/
|
|
4479
|
+
private initResilienceSubsystems;
|
|
4480
|
+
/**
|
|
4481
|
+
* Wait for the underlying RTCPeerConnection to reach 'connected' after
|
|
4482
|
+
* triggering an ICE restart. Resolves true on success, false on failure
|
|
4483
|
+
* or if the state doesn't transition within the configured timeout.
|
|
4484
|
+
*
|
|
4485
|
+
* Polls connectionState directly because the recovery manager already
|
|
4486
|
+
* wraps this call in its own withTimeout(); a separate listener-based
|
|
4487
|
+
* implementation would race the outer timeout in subtle ways.
|
|
4488
|
+
*/
|
|
4489
|
+
private waitForPeerConnectionConnected;
|
|
4490
|
+
/**
|
|
4491
|
+
* @internal Stop and destroy resilience subsystems (on disconnect/destroy).
|
|
4492
|
+
* Clears references so they can be re-created on reconnect.
|
|
4493
|
+
*/
|
|
4494
|
+
private stopResilienceSubsystems;
|
|
2893
4495
|
/** @internal */
|
|
2894
4496
|
createParticipant(memberId: string, selfId?: string | null): Participant | SelfParticipant;
|
|
2895
4497
|
/** Observable of the current audio/video send/receive directions. */
|
|
@@ -2897,7 +4499,16 @@ declare class WebRTCCall extends Destroyable implements CallManager {
|
|
|
2897
4499
|
/** Current audio/video send/receive directions. */
|
|
2898
4500
|
get mediaDirections(): MediaDirections;
|
|
2899
4501
|
protected get participantsId$(): Observable<string[]>;
|
|
2900
|
-
/**
|
|
4502
|
+
/**
|
|
4503
|
+
* Executes a raw JSON-RPC request on the client session.
|
|
4504
|
+
*
|
|
4505
|
+
* Lower-level than {@link executeMethod} — allows full control over the RPC request structure.
|
|
4506
|
+
*
|
|
4507
|
+
* @param request - Complete JSON-RPC request object.
|
|
4508
|
+
* @param options - Optional RPC execution options (timeout, etc.).
|
|
4509
|
+
* @returns The RPC response.
|
|
4510
|
+
* @throws {JSONRPCError} If the RPC call returns an error response.
|
|
4511
|
+
*/
|
|
2901
4512
|
execute<T extends JSONRPCResponse = JSONRPCResponse>(request: JSONRPCRequest, options?: PendingRPCOptions): Promise<T>;
|
|
2902
4513
|
/** Observable of the local participant's member ID. */
|
|
2903
4514
|
get selfId$(): Observable<string | null>;
|
|
@@ -2911,9 +4522,9 @@ declare class WebRTCCall extends Destroyable implements CallManager {
|
|
|
2911
4522
|
private get callSessionEvents$();
|
|
2912
4523
|
/** Observable of call-updated events. */
|
|
2913
4524
|
get callUpdated$(): Observable<CallUpdatedPayload>;
|
|
2914
|
-
/** Observable of member-joined events. */
|
|
4525
|
+
/** Observable of member-joined events, emitted when a remote participant joins the call. */
|
|
2915
4526
|
get memberJoined$(): Observable<MemberJoinedPayload>;
|
|
2916
|
-
/** Observable of member-left events. */
|
|
4527
|
+
/** Observable of member-left events, emitted when a participant leaves the call. */
|
|
2917
4528
|
get memberLeft$(): Observable<MemberLeftPayload>;
|
|
2918
4529
|
/** Observable of member-updated events (mute, volume, etc.). */
|
|
2919
4530
|
get memberUpdated$(): Observable<MemberUpdatedPayload>;
|
|
@@ -2927,34 +4538,191 @@ declare class WebRTCCall extends Destroyable implements CallManager {
|
|
|
2927
4538
|
get rtcPeerConnection(): RTCPeerConnection | undefined;
|
|
2928
4539
|
/** Observable of raw signaling events as plain objects. */
|
|
2929
4540
|
get signalingEvent$(): Observable<Record<string, unknown>>;
|
|
2930
|
-
/**
|
|
4541
|
+
/**
|
|
4542
|
+
* Subscribe to a custom signaling event type on this call.
|
|
4543
|
+
*
|
|
4544
|
+
* Returns a cached observable that filters `callSessionEvents$` for events
|
|
4545
|
+
* whose `event_type` matches the given string. The observable completes
|
|
4546
|
+
* when the call is destroyed.
|
|
4547
|
+
*
|
|
4548
|
+
* Unlike `signalingEvent$` (which only emits known call-level event types),
|
|
4549
|
+
* this method also matches custom/user-defined event types.
|
|
4550
|
+
*
|
|
4551
|
+
* The SDK does not validate event type strings --- the server decides
|
|
4552
|
+
* whether a given type is valid.
|
|
4553
|
+
*
|
|
4554
|
+
* @param eventType - The event type to subscribe to (e.g. `'my.custom.event'`).
|
|
4555
|
+
* @returns An observable that emits matching signaling events.
|
|
4556
|
+
*
|
|
4557
|
+
* @example
|
|
4558
|
+
* ```ts
|
|
4559
|
+
* call.subscribe('my.custom.event').subscribe(event => {
|
|
4560
|
+
* console.log('Custom event:', event);
|
|
4561
|
+
* });
|
|
4562
|
+
* ```
|
|
4563
|
+
*/
|
|
4564
|
+
subscribe(eventType: string): Observable<Record<string, unknown>>;
|
|
2931
4565
|
get webrtcMessages$(): Observable<WebrtcMessagePayload>;
|
|
2932
|
-
|
|
2933
|
-
get callEvent$(): Observable<WebrtcMessagePayload | CallJoinedPayload | CallLeftPayload | CallUpdatedPayload | CallStatePayload | CallPlayPayload | CallConnectPayload | MemberUpdatedPayload | MemberJoinedPayload | MemberLeftPayload | MemberTalkingPayload | LayoutChangedPayload | ConversationMessagePayload>;
|
|
2934
|
-
/** Observable of layout-changed signaling events. */
|
|
4566
|
+
get callEvent$(): Observable<WebrtcMessagePayload | CallJoinedPayload | CallLeftPayload | CallUpdatedPayload | CallStatePayload | CallPlayPayload | CallConnectPayload | RoomUpdatedPayload | MemberUpdatedPayload | MemberJoinedPayload | MemberLeftPayload | MemberTalkingPayload | LayoutChangedPayload | ConversationMessagePayload>;
|
|
2935
4567
|
get layoutEvent$(): Observable<LayoutChangedPayload>;
|
|
2936
|
-
/**
|
|
4568
|
+
/**
|
|
4569
|
+
* Hangs up the call and releases all resources.
|
|
4570
|
+
*
|
|
4571
|
+
* Sends a Verto `bye` to the server, transitions status to `'disconnecting'`,
|
|
4572
|
+
* then destroys the call. After this, the call instance is no longer usable.
|
|
4573
|
+
*
|
|
4574
|
+
* @example
|
|
4575
|
+
* ```ts
|
|
4576
|
+
* await call.hangup();
|
|
4577
|
+
* ```
|
|
4578
|
+
*/
|
|
2937
4579
|
hangup(): Promise<void>;
|
|
2938
|
-
/**
|
|
4580
|
+
/**
|
|
4581
|
+
* Sends DTMF digits on the call.
|
|
4582
|
+
*
|
|
4583
|
+
* @param dtmf - The digit string to send (e.g. `'1234#'`).
|
|
4584
|
+
*
|
|
4585
|
+
* @example
|
|
4586
|
+
* ```ts
|
|
4587
|
+
* await call.sendDigits('1234#');
|
|
4588
|
+
* ```
|
|
4589
|
+
*/
|
|
2939
4590
|
sendDigits(dtmf: string): Promise<void>;
|
|
2940
|
-
/**
|
|
4591
|
+
/** Observable of WebRTC-specific signaling messages. */
|
|
4592
|
+
/** Observable of call-level signaling events. */
|
|
4593
|
+
/** Observable of layout-changed signaling events. */
|
|
4594
|
+
/**
|
|
4595
|
+
* Accepts an inbound call, optionally overriding media options for the answer.
|
|
4596
|
+
*
|
|
4597
|
+
* @param options - Optional media constraints for the answer (audio/video).
|
|
4598
|
+
*
|
|
4599
|
+
* @example
|
|
4600
|
+
* ```ts
|
|
4601
|
+
* // Accept with defaults
|
|
4602
|
+
* call.answer();
|
|
4603
|
+
*
|
|
4604
|
+
* // Accept audio-only
|
|
4605
|
+
* call.answer({ audio: true, video: false });
|
|
4606
|
+
* ```
|
|
4607
|
+
* @see {@link reject} to decline the call instead.
|
|
4608
|
+
* @see {@link answered$} to observe the acceptance state.
|
|
4609
|
+
*/
|
|
2941
4610
|
answer(options?: MediaOptions): void;
|
|
2942
4611
|
/** Media options provided when answering. Used internally by the VertoManager. */
|
|
2943
4612
|
get answerMediaOptions(): MediaOptions | undefined;
|
|
2944
|
-
/**
|
|
4613
|
+
/**
|
|
4614
|
+
* Rejects an inbound call, preventing media negotiation.
|
|
4615
|
+
*
|
|
4616
|
+
* @see {@link answer} to accept the call instead.
|
|
4617
|
+
* @see {@link answered$} to observe the rejection state.
|
|
4618
|
+
*/
|
|
2945
4619
|
reject(): void;
|
|
2946
4620
|
/** Observable that emits `true` when answered, `false` when rejected. */
|
|
2947
4621
|
get answered$(): Observable<boolean>;
|
|
2948
4622
|
/**
|
|
2949
4623
|
* Sets the call layout and participant positions.
|
|
4624
|
+
*
|
|
2950
4625
|
* @param layout - Layout name (must be one of {@link layouts}).
|
|
2951
|
-
* @param positions - Map of member IDs to
|
|
4626
|
+
* @param positions - Map of member IDs to {@link VideoPosition} values.
|
|
4627
|
+
* @throws {InvalidParams} If the layout is not in the available {@link layouts}.
|
|
4628
|
+
*
|
|
4629
|
+
* @example
|
|
4630
|
+
* ```ts
|
|
4631
|
+
* await call.setLayout('grid-responsive', {
|
|
4632
|
+
* [participantId]: 'reserved-0',
|
|
4633
|
+
* });
|
|
4634
|
+
* ```
|
|
2952
4635
|
*/
|
|
2953
4636
|
setLayout(layout: string, positions: Record<string, VideoPosition>): Promise<void>;
|
|
2954
|
-
/**
|
|
4637
|
+
/**
|
|
4638
|
+
* Transfers the call to another destination.
|
|
4639
|
+
*
|
|
4640
|
+
* @param options - Transfer configuration including the target destination.
|
|
4641
|
+
* @see {@link status$} to observe the transfer progress.
|
|
4642
|
+
*/
|
|
2955
4643
|
transfer(options: TransferOptions): Promise<void>;
|
|
4644
|
+
/**
|
|
4645
|
+
* Set the local microphone gain as a percentage applied before transmission.
|
|
4646
|
+
*
|
|
4647
|
+
* - `0` = silent
|
|
4648
|
+
* - `100` = unity (no change, default)
|
|
4649
|
+
* - `200` = 2× digital boost (max; expect clipping / noise amplification)
|
|
4650
|
+
*
|
|
4651
|
+
* Values are clamped to [0, 200]. Engages the local audio pipeline on
|
|
4652
|
+
* first use (one-time cost).
|
|
4653
|
+
*
|
|
4654
|
+
* Note: this is a **digital** multiplier applied in a Web Audio GainNode
|
|
4655
|
+
* between your mic track and the RTCRtpSender — it does not change the
|
|
4656
|
+
* physical mic's hardware sensitivity. Browsers' autoGainControl can
|
|
4657
|
+
* fight the setting; call {@link setAutoGainControl}(false) for
|
|
4658
|
+
* predictable behaviour.
|
|
4659
|
+
*
|
|
4660
|
+
* @param value - Gain percentage (0..200; 100 = unity).
|
|
4661
|
+
*/
|
|
4662
|
+
setLocalMicrophoneGain(value: number): void;
|
|
4663
|
+
/** Observable of the current local microphone gain (0..200, where 100 = unity). */
|
|
4664
|
+
get localMicrophoneGain$(): Observable<number>;
|
|
4665
|
+
/**
|
|
4666
|
+
* Observable of the RMS audio level of the local microphone, 0..1.
|
|
4667
|
+
* Emits at ~30fps while a mic track is active. Engages the local audio
|
|
4668
|
+
* pipeline on first subscription.
|
|
4669
|
+
*/
|
|
4670
|
+
get localAudioLevel$(): Observable<number>;
|
|
4671
|
+
/**
|
|
4672
|
+
* Observable that is `true` while the local participant is speaking
|
|
4673
|
+
* (RMS level above the VAD threshold, with hold time to avoid flicker).
|
|
4674
|
+
*/
|
|
4675
|
+
get localSpeaking$(): Observable<boolean>;
|
|
4676
|
+
/**
|
|
4677
|
+
* Enable push-to-talk: while {@link setPushToTalkActive} has been called
|
|
4678
|
+
* with `false`, the microphone gain is forced to 0; calling
|
|
4679
|
+
* {@link setPushToTalkActive} with `true` restores the configured gain.
|
|
4680
|
+
* Use this instead of mute/unmute for instant talk/silence transitions
|
|
4681
|
+
* because it doesn't rebuild the track.
|
|
4682
|
+
*
|
|
4683
|
+
* This method installs the pipeline but does not attach any keyboard
|
|
4684
|
+
* listener — consumers bind the key themselves and call
|
|
4685
|
+
* {@link setPushToTalkActive} on keydown/keyup.
|
|
4686
|
+
*/
|
|
4687
|
+
enablePushToTalk(): void;
|
|
4688
|
+
/** Disable push-to-talk; mic gain returns to the configured value. */
|
|
4689
|
+
disablePushToTalk(): void;
|
|
4690
|
+
/**
|
|
4691
|
+
* While push-to-talk is enabled, sets the talk state. `true` = transmitting,
|
|
4692
|
+
* `false` = silent. No-op if push-to-talk has not been enabled.
|
|
4693
|
+
*/
|
|
4694
|
+
setPushToTalkActive(active: boolean): void;
|
|
4695
|
+
/**
|
|
4696
|
+
* Toggle echo cancellation on the local mic at runtime. Applied via
|
|
4697
|
+
* `track.applyConstraints`; browsers that don't honour runtime constraints
|
|
4698
|
+
* (notably iOS Safari) fall back to re-acquiring the track with the new
|
|
4699
|
+
* constraint set and plumbing the replacement through the local audio
|
|
4700
|
+
* pipeline if one is active.
|
|
4701
|
+
*/
|
|
4702
|
+
setEchoCancellation(enabled: boolean): Promise<void>;
|
|
4703
|
+
/** Toggle browser noise suppression on the local mic at runtime. */
|
|
4704
|
+
setNoiseSuppression(enabled: boolean): Promise<void>;
|
|
4705
|
+
/** Toggle browser automatic gain control on the local mic at runtime. */
|
|
4706
|
+
setAutoGainControl(enabled: boolean): Promise<void>;
|
|
4707
|
+
/**
|
|
4708
|
+
* Observable of the aggregate remote audio level, 0..1 RMS. The server
|
|
4709
|
+
* delivers a single mixed audio stream for all remote participants — this
|
|
4710
|
+
* meter reports that mix. Per-participant audio is not available client-side.
|
|
4711
|
+
*
|
|
4712
|
+
* Engages a shared AudioContext on first subscription (cheap — one
|
|
4713
|
+
* AnalyserNode, no GainNode, no destination) so it does not affect the
|
|
4714
|
+
* caller's audio element playback.
|
|
4715
|
+
*/
|
|
4716
|
+
get remoteAudioLevel$(): Observable<number>;
|
|
2956
4717
|
/** Destroys the call, releasing all resources and subscriptions. */
|
|
2957
4718
|
destroy(): void;
|
|
4719
|
+
/**
|
|
4720
|
+
* @internal Send a verto.subscribe message to add an event type to the
|
|
4721
|
+
* server's subscription list for this call. Returns the underlying RPC
|
|
4722
|
+
* promise so callers can decide whether to cache the observable on success
|
|
4723
|
+
* or retry on failure.
|
|
4724
|
+
*/
|
|
4725
|
+
private _sendVertoSubscribe;
|
|
2958
4726
|
}
|
|
2959
4727
|
//#endregion
|
|
2960
4728
|
//#region src/index.d.ts
|
|
@@ -2969,5 +4737,5 @@ declare const version: string;
|
|
|
2969
4737
|
*/
|
|
2970
4738
|
declare const ready: boolean;
|
|
2971
4739
|
//#endregion
|
|
2972
|
-
export { Address, type AddressHistory, type Call, type CallAddress, type CallCapabilitiesState, CallCreateError, type CallError, type CallErrorKind, type CallOptions, type CallParticipant, type CallSelfParticipant, type CallState, type CallStatus, ClientPreferences, CollectionFetchError, type CredentialProvider, type DeviceController, type DialOptions, type Directory, type ExecuteMethod, InvalidCredentialsError, type JSONRPCErrorResponse, type JSONRPCRequest, type JSONRPCResponse, type JSONRPCSuccessResponse, type LayoutLayer, type MediaDirection, type MediaDirections, type MediaOptions, MediaTrackError, type MemberCapabilities, MessageParseError, type NodeSocketAdapter, type OnOffCapability, Participant, type PendingRPCOptions, type SDKCredential, SelfCapabilities, SelfParticipant, type SessionState, SignalWire, type SignalWireOptions, StaticCredentialProvider, type Storage,
|
|
4740
|
+
export { Address, type AddressHistory, type AudioConstraintsEvent, type AuthenticateContext, type Call, type CallAddress, type CallCapabilitiesState, CallCreateError, type CallDiagnosticSummary, type CallDirection, type CallError, type CallErrorKind, type NetworkIssue as CallNetworkIssue, type NetworkIssue, type NetworkMetrics as CallNetworkMetrics, type NetworkMetrics, type CallOptions, type CallParticipant, type CallSelfParticipant, type CallState, type CallStatus, type Capability, ClientPreferences, CollectionFetchError, type ConstraintFallbackEvent, type CredentialProvider, DPoPInitError, type DebugOptions, type DeviceController, type DeviceRecoveryEvent, DeviceTokenError, type DiagnosticEvent, type DialOptions, type Directory, EmbedTokenCredentialProvider, type ExecuteMethod, InvalidCredentialsError, type JSONRPCErrorResponse, type JSONRPCRequest, type JSONRPCResponse, type JSONRPCSuccessResponse, type LayoutLayer, type LogLevel, type MediaDirection, type MediaDirections, type MediaOptions, type MediaParamsEvent, MediaTrackError, type MemberCapabilities, MessageParseError, type NodeSocketAdapter, type OnOffCapability, OverconstrainedFallbackError, Participant, type PendingRPCOptions, type PermissionResult, type PlatformCapabilities, PreflightError, type PreflightOptions, type PreflightResult, type QualityLevel, RecoveryError, type RecoveryEvent, type RecoveryState, type ResilienceCallStatus, type SATClaims, type SDKCredential, type SDKLogger, type ScreenShareStatus, type SelectDeviceOptions, SelfCapabilities, SelfParticipant, type SessionDiagnostics, type SessionState, SignalWire, type SignalWireOptions, StaticCredentialProvider, type Storage, type StoredDevicePreference, type TextMessage, TokenRefreshError, type TransferOptions, UnexpectedError, User, type UserPresence, VertoPongError, type VideoPosition, type WebRTCApiProvider, WebRTCCall, type WebRTCMediaDevices, type WebSocketAdapter, embeddableCall, getLogger, isSelfParticipant, ready, setDebugOptions, setLogLevel, setLogger, version };
|
|
2973
4741
|
//# sourceMappingURL=index.d.mts.map
|