@signalwire/js 4.0.0-rc.2 → 4.0.0-rc.3
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 +1638 -446
- package/dist/browser.mjs.map +1 -1
- package/dist/browser.umd.js +1642 -445
- package/dist/browser.umd.js.map +1 -1
- package/dist/index.cjs +1538 -430
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2312 -1835
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2312 -1835
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1534 -431
- package/dist/index.mjs.map +1 -1
- package/dist/operators/index.cjs +1 -1
- package/dist/operators/index.mjs +1 -1
- package/dist/{operators-B8ipd4Xl.cjs → operators-BJ6QW1VP.cjs} +144 -1
- package/dist/operators-BJ6QW1VP.cjs.map +1 -0
- package/dist/{operators-BlUtq-t0.mjs → operators-BVxi3KpN.mjs} +91 -2
- package/dist/operators-BVxi3KpN.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/operators-B8ipd4Xl.cjs.map +0 -1
- package/dist/operators-BlUtq-t0.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -324,6 +324,17 @@ interface MediaDirections {
|
|
|
324
324
|
/** Video direction */
|
|
325
325
|
video: MediaDirection;
|
|
326
326
|
}
|
|
327
|
+
/** Options for starting a screen share. */
|
|
328
|
+
interface ScreenShareOptions {
|
|
329
|
+
/**
|
|
330
|
+
* Request the shared surface's audio. Defaults to `false`.
|
|
331
|
+
*
|
|
332
|
+
* Whether audio can actually be captured depends on the browser, the OS and
|
|
333
|
+
* the surface the user picks — Chrome offers it for tabs and windows, and a
|
|
334
|
+
* share the user grants without audio yields a video-only stream.
|
|
335
|
+
*/
|
|
336
|
+
audio?: boolean;
|
|
337
|
+
}
|
|
327
338
|
/** Options controlling which media tracks to send and receive. */
|
|
328
339
|
interface MediaOptions {
|
|
329
340
|
/** Enable audio input. Defaults to `true` when not specified. */
|
|
@@ -1166,6 +1177,14 @@ interface CallError {
|
|
|
1166
1177
|
readonly error: Error;
|
|
1167
1178
|
/** ID of the call that produced this error. */
|
|
1168
1179
|
readonly callId: string;
|
|
1180
|
+
/**
|
|
1181
|
+
* Which peer connection failed. Auxiliary legs are never fatal, so a consumer
|
|
1182
|
+
* can surface "screen share failed, call continues". Absent for call- and
|
|
1183
|
+
* session-level errors.
|
|
1184
|
+
*/
|
|
1185
|
+
readonly leg?: RTCPeerConnectionPropose;
|
|
1186
|
+
/** `callId` is always the call's id, never the leg's. Use this for the leg. */
|
|
1187
|
+
readonly legId?: string;
|
|
1169
1188
|
}
|
|
1170
1189
|
declare class CallCreateError extends Error {
|
|
1171
1190
|
message: string;
|
|
@@ -1173,6 +1192,14 @@ declare class CallCreateError extends Error {
|
|
|
1173
1192
|
direction: 'inbound' | 'outbound';
|
|
1174
1193
|
constructor(message: string, error?: unknown, direction?: 'inbound' | 'outbound', options?: ErrorOptions);
|
|
1175
1194
|
}
|
|
1195
|
+
declare class CallNotReadyError extends Error {
|
|
1196
|
+
callId: string;
|
|
1197
|
+
constructor(callId: string, options?: ErrorOptions);
|
|
1198
|
+
}
|
|
1199
|
+
declare class ParticipantNotReadyError extends Error {
|
|
1200
|
+
memberId: string;
|
|
1201
|
+
constructor(memberId: string, options?: ErrorOptions);
|
|
1202
|
+
}
|
|
1176
1203
|
declare class VertoPongError extends Error {
|
|
1177
1204
|
originalError: unknown;
|
|
1178
1205
|
constructor(originalError: unknown);
|
|
@@ -1186,6 +1213,26 @@ declare class CollectionFetchError extends Error {
|
|
|
1186
1213
|
originalError: unknown;
|
|
1187
1214
|
constructor(operation: string, originalError: unknown);
|
|
1188
1215
|
}
|
|
1216
|
+
/**
|
|
1217
|
+
* An auxiliary leg did not connect within its budget. Typed rather than a bare
|
|
1218
|
+
* RxJS `TimeoutError` so the leg and cause survive.
|
|
1219
|
+
*/
|
|
1220
|
+
declare class AuxiliaryLegTimeoutError extends Error {
|
|
1221
|
+
readonly leg: RTCPeerConnectionPropose;
|
|
1222
|
+
readonly originalError?: Error | undefined;
|
|
1223
|
+
constructor(leg: RTCPeerConnectionPropose, originalError?: Error | undefined);
|
|
1224
|
+
}
|
|
1225
|
+
/**
|
|
1226
|
+
* An auxiliary leg was removed before it finished connecting.
|
|
1227
|
+
*
|
|
1228
|
+
* Typed rather than a bare resolve so a caller awaiting the start can tell a
|
|
1229
|
+
* cancel apart from a share that actually came up — the public methods return
|
|
1230
|
+
* `void`, so the promise is the only signal they have.
|
|
1231
|
+
*/
|
|
1232
|
+
declare class AuxiliaryLegCancelledError extends Error {
|
|
1233
|
+
readonly leg: RTCPeerConnectionPropose;
|
|
1234
|
+
constructor(leg: RTCPeerConnectionPropose);
|
|
1235
|
+
}
|
|
1189
1236
|
declare class MediaTrackError extends Error {
|
|
1190
1237
|
operation: string;
|
|
1191
1238
|
kind: string;
|
|
@@ -1218,6 +1265,21 @@ declare class MediaAccessError extends Error {
|
|
|
1218
1265
|
/** True when the underlying failure is a permission denial (user or policy). */
|
|
1219
1266
|
get denied(): boolean;
|
|
1220
1267
|
}
|
|
1268
|
+
/**
|
|
1269
|
+
* Thrown by `startScreenShare()` when the call is already sharing a screen.
|
|
1270
|
+
*
|
|
1271
|
+
* A call carries at most one screen share. Accepting a second one would
|
|
1272
|
+
* overwrite the only reference the SDK holds to the first, leaving it
|
|
1273
|
+
* capturing and sending with no way to stop it — so the second request is
|
|
1274
|
+
* rejected and the live share is left untouched. Call `stopScreenShare()`
|
|
1275
|
+
* first to replace it.
|
|
1276
|
+
*/
|
|
1277
|
+
declare class ScreenShareAlreadyActiveError extends Error {
|
|
1278
|
+
/** Id of the screen share leg that is already active. */
|
|
1279
|
+
readonly screenShareId: string;
|
|
1280
|
+
constructor(/** Id of the screen share leg that is already active. */
|
|
1281
|
+
screenShareId: string, options?: ErrorOptions);
|
|
1282
|
+
}
|
|
1221
1283
|
declare class DPoPInitError extends Error {
|
|
1222
1284
|
originalError: unknown;
|
|
1223
1285
|
constructor(originalError: unknown, message?: string);
|
|
@@ -1436,7 +1498,7 @@ interface AudioConstraintsEvent {
|
|
|
1436
1498
|
/** Timestamp when the event occurred (epoch ms). */
|
|
1437
1499
|
readonly timestamp: number;
|
|
1438
1500
|
}
|
|
1439
|
-
/** Event emitted when server
|
|
1501
|
+
/** Event emitted when the server pushes media params. */
|
|
1440
1502
|
interface MediaParamsEvent {
|
|
1441
1503
|
/** Audio constraints pushed by the server, if any. */
|
|
1442
1504
|
readonly audio?: MediaTrackConstraints;
|
|
@@ -1444,6 +1506,15 @@ interface MediaParamsEvent {
|
|
|
1444
1506
|
readonly video?: MediaTrackConstraints;
|
|
1445
1507
|
/** Timestamp when the event occurred (epoch ms). */
|
|
1446
1508
|
readonly timestamp: number;
|
|
1509
|
+
/**
|
|
1510
|
+
* `false` when the constraints did not reach every sender of a pushed kind:
|
|
1511
|
+
* the sender carries media the SDK did not capture, the browser refused the
|
|
1512
|
+
* constraints and re-acquisition failed, or the leg sends no media of that
|
|
1513
|
+
* kind at all. The event is emitted whether or not they were applied, but a
|
|
1514
|
+
* push naming a leg this call does not hold emits nothing at all — the event
|
|
1515
|
+
* carries no leg identity to report it against.
|
|
1516
|
+
*/
|
|
1517
|
+
readonly applied: boolean;
|
|
1447
1518
|
}
|
|
1448
1519
|
/** Structured diagnostic bundle for a session. */
|
|
1449
1520
|
interface SessionDiagnostics {
|
|
@@ -1757,7 +1828,7 @@ interface DeviceController {
|
|
|
1757
1828
|
interface VertoManager {
|
|
1758
1829
|
readonly screenShareStatus$: Observable<ScreenShareStatus>;
|
|
1759
1830
|
readonly screenShareStatus: ScreenShareStatus;
|
|
1760
|
-
addScreenMedia(): Promise<void>;
|
|
1831
|
+
addScreenMedia(options?: ScreenShareOptions): Promise<void>;
|
|
1761
1832
|
removeScreenMedia(): Promise<void>;
|
|
1762
1833
|
addInputDevice(options?: MediaOptions): Promise<string | undefined>;
|
|
1763
1834
|
removeInputDevices(id: string): Promise<void>;
|
|
@@ -1765,7 +1836,7 @@ interface VertoManager {
|
|
|
1765
1836
|
updateMediaConstraints(options?: {
|
|
1766
1837
|
audio?: MediaTrackConstraints;
|
|
1767
1838
|
video?: MediaTrackConstraints;
|
|
1768
|
-
}): Promise<
|
|
1839
|
+
}): Promise<boolean>;
|
|
1769
1840
|
muteMainAudioInputDevice(): void;
|
|
1770
1841
|
unmuteMainAudioInputDevice(): Promise<void>;
|
|
1771
1842
|
muteMainVideoInputDevice(): void;
|
|
@@ -1789,12 +1860,12 @@ type ParticipantState = Member & {
|
|
|
1789
1860
|
* the local participant with additional device control.
|
|
1790
1861
|
*/
|
|
1791
1862
|
declare class Participant extends Destroyable implements CallParticipant {
|
|
1792
|
-
|
|
1863
|
+
private callExecuteMethod;
|
|
1793
1864
|
protected deviceController: DeviceController;
|
|
1794
1865
|
/** Unique member ID of this participant. */
|
|
1795
1866
|
readonly id: string;
|
|
1796
1867
|
private _state$;
|
|
1797
|
-
constructor(id: string,
|
|
1868
|
+
constructor(id: string, callExecuteMethod: ExecuteMethod, deviceController: DeviceController);
|
|
1798
1869
|
/** @internal */
|
|
1799
1870
|
upnext(data: Partial<ParticipantState>): void;
|
|
1800
1871
|
/** Observable of the participant's display name. */
|
|
@@ -1917,6 +1988,30 @@ declare class Participant extends Destroyable implements CallParticipant {
|
|
|
1917
1988
|
get callId(): string | undefined;
|
|
1918
1989
|
/** @internal */
|
|
1919
1990
|
get value(): Partial<Member>;
|
|
1991
|
+
/**
|
|
1992
|
+
* Target triple for member RPCs, built from the participant's own state.
|
|
1993
|
+
* The backend locates the member's session by the target `call_id`/`node_id`,
|
|
1994
|
+
* so this must always be the participant's own call context — never the
|
|
1995
|
+
* local call's id (issue #19400).
|
|
1996
|
+
*
|
|
1997
|
+
* Reading it doubles as a readiness probe: it throws until the first full
|
|
1998
|
+
* member event (`member.joined`/`member.updated` or the `call.joined`
|
|
1999
|
+
* roster) arrives, and never regresses afterwards.
|
|
2000
|
+
*
|
|
2001
|
+
* @throws {ParticipantNotReadyError} If the member state has not been
|
|
2002
|
+
* received yet (e.g. a participant first seen via `member.talking`) — an
|
|
2003
|
+
* empty call context can never address the member, so fail fast instead of
|
|
2004
|
+
* sending a doomed RPC.
|
|
2005
|
+
*/
|
|
2006
|
+
get target(): MemberTarget;
|
|
2007
|
+
/**
|
|
2008
|
+
* Executes a member RPC against this participant, injecting its own
|
|
2009
|
+
* {@link target} as the target.
|
|
2010
|
+
*
|
|
2011
|
+
* @throws {ParticipantNotReadyError} Via {@link target}, when the
|
|
2012
|
+
* member state has not been received yet.
|
|
2013
|
+
*/
|
|
2014
|
+
protected executeMethod(method: string, args: Record<string, unknown>): Promise<JSONRPCResponse>;
|
|
1920
2015
|
/** Toggles the deafened state (mutes/unmutes incoming audio). */
|
|
1921
2016
|
toggleDeaf(): Promise<void>;
|
|
1922
2017
|
/** Toggles the hand-raised state. */
|
|
@@ -1981,12 +2076,10 @@ declare class Participant extends Destroyable implements CallParticipant {
|
|
|
1981
2076
|
/**
|
|
1982
2077
|
* Sets the participant's position in the video layout.
|
|
1983
2078
|
*
|
|
1984
|
-
* Requires the `member.position` capability. The gateway
|
|
1985
|
-
*
|
|
1986
|
-
*
|
|
1987
|
-
*
|
|
1988
|
-
* guarantee a visible change: the backend silently returns `200` (no-op) for
|
|
1989
|
-
* non-conference targets.
|
|
2079
|
+
* Requires the `member.position` capability. The gateway requires a
|
|
2080
|
+
* `targets` array of `{ target, position }` entries (issue #19400). A
|
|
2081
|
+
* resolved promise does not guarantee a visible change: the backend silently
|
|
2082
|
+
* returns `200` (no-op) for non-conference targets.
|
|
1990
2083
|
*
|
|
1991
2084
|
* @param value - The {@link VideoPosition} to assign (e.g. `'auto'`, `'reserved-0'`).
|
|
1992
2085
|
*/
|
|
@@ -2030,7 +2123,7 @@ declare class SelfParticipant extends Participant implements CallSelfParticipant
|
|
|
2030
2123
|
*/
|
|
2031
2124
|
private _studioAudio$;
|
|
2032
2125
|
/** @internal */
|
|
2033
|
-
constructor(id: string,
|
|
2126
|
+
constructor(id: string, callExecuteMethod: ExecuteMethod, vertoManager: VertoManager, deviceController: DeviceController);
|
|
2034
2127
|
destroy(): void;
|
|
2035
2128
|
/** Observable indicating whether studio audio (raw/unprocessed audio) mode is enabled. */
|
|
2036
2129
|
get studioAudio$(): Observable<boolean>;
|
|
@@ -2049,13 +2142,22 @@ declare class SelfParticipant extends Participant implements CallSelfParticipant
|
|
|
2049
2142
|
/**
|
|
2050
2143
|
* Starts sharing the local screen.
|
|
2051
2144
|
*
|
|
2145
|
+
* A call carries at most one screen share. Read `screenShareStatus` before
|
|
2146
|
+
* calling and treat `'starting'`/`'stopping'` as busy.
|
|
2147
|
+
*
|
|
2052
2148
|
* The call is unaffected when acquisition fails.
|
|
2053
2149
|
*
|
|
2150
|
+
* @param options - Pass `{ audio: true }` to also request the shared
|
|
2151
|
+
* surface's audio. Defaults to video only.
|
|
2152
|
+
* @throws {ScreenShareAlreadyActiveError} When this call is already
|
|
2153
|
+
* sharing a screen. Call {@link stopScreenShare} before starting another.
|
|
2154
|
+
* @throws {AuxiliaryLegCancelledError} When {@link stopScreenShare} removes
|
|
2155
|
+
* the share before its leg finishes connecting.
|
|
2054
2156
|
* @throws The raw `getDisplayMedia` error. A dismissed picker or a
|
|
2055
2157
|
* permission denial rejects with a `NotAllowedError` `DOMException` —
|
|
2056
2158
|
* inspect `error.name` to tell benign cancels apart from real failures.
|
|
2057
2159
|
*/
|
|
2058
|
-
startScreenShare(): Promise<void>;
|
|
2160
|
+
startScreenShare(options?: ScreenShareOptions): Promise<void>;
|
|
2059
2161
|
/** Observable of the current screen share status. */
|
|
2060
2162
|
get screenShareStatus$(): Observable<ScreenShareStatus>;
|
|
2061
2163
|
/** Current screen share status. */
|
|
@@ -2067,8 +2169,11 @@ declare class SelfParticipant extends Participant implements CallSelfParticipant
|
|
|
2067
2169
|
*
|
|
2068
2170
|
* The call is unaffected when acquisition fails.
|
|
2069
2171
|
*
|
|
2172
|
+
* @throws {AuxiliaryLegCancelledError} When {@link removeAdditionalDevice}
|
|
2173
|
+
* removes the device before its leg finishes connecting.
|
|
2070
2174
|
* @throws The raw `getUserMedia` error (e.g. `NotAllowedError` on
|
|
2071
|
-
* permission denial) — inspect `error.name` to decide how to react
|
|
2175
|
+
* permission denial) — inspect `error.name` to decide how to react — or
|
|
2176
|
+
* `AuxiliaryLegTimeoutError` if the leg does not connect in time.
|
|
2072
2177
|
*/
|
|
2073
2178
|
addAdditionalDevice(options: MediaOptions): Promise<void>;
|
|
2074
2179
|
/** Removes an additional media input device by ID. */
|
|
@@ -2093,17 +2198,26 @@ declare class SelfParticipant extends Participant implements CallSelfParticipant
|
|
|
2093
2198
|
addInputDevices(options?: MediaOptions): Promise<void>;
|
|
2094
2199
|
/** Selects the audio input device for future calls. Optionally saves as a preference. */
|
|
2095
2200
|
selectAudioInputDevice(device: MediaDeviceInfo, options?: SelectDeviceOptions): void;
|
|
2096
|
-
/**
|
|
2097
|
-
|
|
2098
|
-
|
|
2201
|
+
/**
|
|
2202
|
+
* Updates the audio input track constraints for the active call.
|
|
2203
|
+
* @returns whether the constraints reached the media the call is sending.
|
|
2204
|
+
*/
|
|
2205
|
+
setAudioInputDeviceConstraints(constraints: MediaTrackConstraints): Promise<boolean>;
|
|
2206
|
+
/**
|
|
2207
|
+
* Updates both audio and video input track constraints for the active call.
|
|
2208
|
+
* @returns whether both kinds took the constraints.
|
|
2209
|
+
*/
|
|
2099
2210
|
setInputDevicesConstraints(constraints: {
|
|
2100
2211
|
audio: MediaTrackConstraints;
|
|
2101
2212
|
video: MediaTrackConstraints;
|
|
2102
|
-
}): Promise<
|
|
2213
|
+
}): Promise<boolean>;
|
|
2103
2214
|
/** Selects the video input device for future calls. Optionally saves as a preference. */
|
|
2104
2215
|
selectVideoInputDevice(device: MediaDeviceInfo, options?: SelectDeviceOptions): void;
|
|
2105
|
-
/**
|
|
2106
|
-
|
|
2216
|
+
/**
|
|
2217
|
+
* Updates the video input track constraints for the active call.
|
|
2218
|
+
* @returns whether the constraints reached the media the call is sending.
|
|
2219
|
+
*/
|
|
2220
|
+
setVideoInputDeviceConstraints(constraints: MediaTrackConstraints): Promise<boolean>;
|
|
2107
2221
|
/** Selects the audio output device. Optionally saves as a preference. */
|
|
2108
2222
|
selectAudioOutputDevice(device: MediaDeviceInfo, options?: SelectDeviceOptions): void;
|
|
2109
2223
|
/**
|
|
@@ -2177,6 +2291,9 @@ interface CallParticipant {
|
|
|
2177
2291
|
readonly addressId: string | undefined;
|
|
2178
2292
|
readonly nodeId: string | undefined;
|
|
2179
2293
|
readonly callId: string | undefined;
|
|
2294
|
+
/** The member's own RPC target triple. Throws `ParticipantNotReadyError`
|
|
2295
|
+
* until the member's call context has been received. */
|
|
2296
|
+
readonly target: MemberTarget;
|
|
2180
2297
|
readonly isTalking: boolean;
|
|
2181
2298
|
readonly position: LayoutLayer | undefined;
|
|
2182
2299
|
readonly isAudience: boolean;
|
|
@@ -2212,7 +2329,7 @@ interface CallSelfParticipant extends CallParticipant {
|
|
|
2212
2329
|
readonly studioAudio: boolean;
|
|
2213
2330
|
enableStudioAudio(): Promise<void>;
|
|
2214
2331
|
disableStudioAudio(): Promise<void>;
|
|
2215
|
-
startScreenShare(): Promise<void>;
|
|
2332
|
+
startScreenShare(options?: ScreenShareOptions): Promise<void>;
|
|
2216
2333
|
stopScreenShare(): Promise<void>;
|
|
2217
2334
|
selectAudioInputDevice(device: MediaDeviceInfo, options?: SelectDeviceOptions): void;
|
|
2218
2335
|
selectVideoInputDevice(device: MediaDeviceInfo, options?: SelectDeviceOptions): void;
|
|
@@ -2228,12 +2345,12 @@ interface CallSelfParticipant extends CallParticipant {
|
|
|
2228
2345
|
stream?: MediaStream;
|
|
2229
2346
|
}): Promise<void>;
|
|
2230
2347
|
addInputDevices(options?: MediaOptions): Promise<void>;
|
|
2231
|
-
setAudioInputDeviceConstraints(constraints: MediaTrackConstraints): Promise<
|
|
2232
|
-
setVideoInputDeviceConstraints(constraints: MediaTrackConstraints): Promise<
|
|
2348
|
+
setAudioInputDeviceConstraints(constraints: MediaTrackConstraints): Promise<boolean>;
|
|
2349
|
+
setVideoInputDeviceConstraints(constraints: MediaTrackConstraints): Promise<boolean>;
|
|
2233
2350
|
setInputDevicesConstraints(constraints: {
|
|
2234
2351
|
audio: MediaTrackConstraints;
|
|
2235
2352
|
video: MediaTrackConstraints;
|
|
2236
|
-
}): Promise<
|
|
2353
|
+
}): Promise<boolean>;
|
|
2237
2354
|
}
|
|
2238
2355
|
/**
|
|
2239
2356
|
* Minimal interface for a collection with pagination
|
|
@@ -2321,7 +2438,8 @@ interface Call extends CallState {
|
|
|
2321
2438
|
readonly capabilities: Capability[];
|
|
2322
2439
|
readonly mediaDirections$: Observable<MediaDirections>;
|
|
2323
2440
|
readonly mediaDirections: MediaDirections;
|
|
2324
|
-
|
|
2441
|
+
/** Withholds emission until self exists, so it never emits `null` — unlike {@link Call.self}. */
|
|
2442
|
+
readonly self$: Observable<CallSelfParticipant>;
|
|
2325
2443
|
readonly self: CallSelfParticipant | null;
|
|
2326
2444
|
readonly to?: string;
|
|
2327
2445
|
readonly toName?: string;
|
|
@@ -2375,6 +2493,17 @@ interface Call extends CallState {
|
|
|
2375
2493
|
answer(options?: MediaOptions): void;
|
|
2376
2494
|
reject(): void;
|
|
2377
2495
|
sendDigits(digits: string): Promise<void>;
|
|
2496
|
+
readonly localAudioLevel$: Observable<number>;
|
|
2497
|
+
readonly localSpeaking$: Observable<boolean>;
|
|
2498
|
+
readonly remoteAudioLevel$: Observable<number>;
|
|
2499
|
+
readonly localMicrophoneGain$: Observable<number>;
|
|
2500
|
+
setLocalMicrophoneGain(value: number): void;
|
|
2501
|
+
enablePushToTalk(): void;
|
|
2502
|
+
disablePushToTalk(): void;
|
|
2503
|
+
setPushToTalkActive(active: boolean): void;
|
|
2504
|
+
setEchoCancellation(enabled: boolean): Promise<boolean>;
|
|
2505
|
+
setNoiseSuppression(enabled: boolean): Promise<boolean>;
|
|
2506
|
+
setAutoGainControl(enabled: boolean): Promise<boolean>;
|
|
2378
2507
|
executeMethod<T extends JSONRPCResponse = JSONRPCResponse>(target: string, method: string, args: Record<string, unknown>): Promise<T>;
|
|
2379
2508
|
execute<T extends JSONRPCResponse = JSONRPCResponse>(request: JSONRPCRequest, options?: PendingRPCOptions): Promise<T>;
|
|
2380
2509
|
}
|
|
@@ -2652,9 +2781,27 @@ declare class AttachManager {
|
|
|
2652
2781
|
private readonly deviceController;
|
|
2653
2782
|
private readonly reconnectCallsTimeout;
|
|
2654
2783
|
private attachKey;
|
|
2784
|
+
/**
|
|
2785
|
+
* Whether a credential recovery has been verified on this client — the
|
|
2786
|
+
* session reauthenticated with a fresh token AND the operation that
|
|
2787
|
+
* reauthentication was meant to unblock then succeeded. Gates attach-record
|
|
2788
|
+
* discard together with the failure kind: a record is dropped only when
|
|
2789
|
+
* this is true AND the reattach refusal was NOT a credential refusal
|
|
2790
|
+
* (-32003). See {@link reattachCalls}.
|
|
2791
|
+
*/
|
|
2792
|
+
private readonly credentialRecovered;
|
|
2655
2793
|
private session;
|
|
2656
2794
|
private writeQueue;
|
|
2657
|
-
constructor(storage: StorageManager, deviceController: DeviceController, reconnectCallsTimeout: number, attachKey: string
|
|
2795
|
+
constructor(storage: StorageManager, deviceController: DeviceController, reconnectCallsTimeout: number, attachKey: string,
|
|
2796
|
+
/**
|
|
2797
|
+
* Whether a credential recovery has been verified on this client — the
|
|
2798
|
+
* session reauthenticated with a fresh token AND the operation that
|
|
2799
|
+
* reauthentication was meant to unblock then succeeded. Gates attach-record
|
|
2800
|
+
* discard together with the failure kind: a record is dropped only when
|
|
2801
|
+
* this is true AND the reattach refusal was NOT a credential refusal
|
|
2802
|
+
* (-32003). See {@link reattachCalls}.
|
|
2803
|
+
*/
|
|
2804
|
+
credentialRecovered: () => boolean);
|
|
2658
2805
|
detachAll(): Promise<void>;
|
|
2659
2806
|
setSession(session: OutboundCallProvider): void;
|
|
2660
2807
|
private readAttached;
|
|
@@ -2667,6 +2814,19 @@ declare class AttachManager {
|
|
|
2667
2814
|
*/
|
|
2668
2815
|
private mutate;
|
|
2669
2816
|
attach(call: AttachableCall): Promise<void>;
|
|
2817
|
+
/**
|
|
2818
|
+
* Keep an already-stored call's reference alive and current — the periodic
|
|
2819
|
+
* refresh the `verto.ping` keepalive drives.
|
|
2820
|
+
*
|
|
2821
|
+
* Only ever updates: a call with no record is one nothing wants reattached,
|
|
2822
|
+
* and re-creating it here would undo a `detach`. That matters because a ping
|
|
2823
|
+
* can land in the window between `bye()` detaching and the call being torn
|
|
2824
|
+
* down, and a record revived there survives the hangup — so the next page
|
|
2825
|
+
* load dials a call nobody is on. The existence check and the write share
|
|
2826
|
+
* one {@link mutate} turn, so a concurrent detach cannot slip between them.
|
|
2827
|
+
*/
|
|
2828
|
+
refresh(call: AttachableCall): Promise<void>;
|
|
2829
|
+
private buildAttachment;
|
|
2670
2830
|
detach(call: AttachableCall): Promise<void>;
|
|
2671
2831
|
flush(): Promise<void>;
|
|
2672
2832
|
/**
|
|
@@ -2681,8 +2841,14 @@ declare class AttachManager {
|
|
|
2681
2841
|
* rejecting. Once that fix is deployed, this will work for both
|
|
2682
2842
|
* page reloads and WebSocket reconnects.
|
|
2683
2843
|
*
|
|
2684
|
-
*
|
|
2685
|
-
*
|
|
2844
|
+
* A failed reattach does NOT generally cost the stored reference. It is
|
|
2845
|
+
* discarded only when the server denied the reattach on a session whose
|
|
2846
|
+
* credential it had already accepted — a verified reauthentication followed
|
|
2847
|
+
* by a refusal is the server saying the call is gone, and that is the one
|
|
2848
|
+
* refusal worth acting on. Until then the credential may be what is being
|
|
2849
|
+
* refused, and the record is the only way a later reload can try again;
|
|
2850
|
+
* keeping it costs nothing, since `detachExpired` reaps it once it is older
|
|
2851
|
+
* than `reconnectCallsTimeout`.
|
|
2686
2852
|
*/
|
|
2687
2853
|
reattachCalls(): Promise<void>;
|
|
2688
2854
|
/**
|
|
@@ -2839,56 +3005,6 @@ interface NetworkChangeEvent {
|
|
|
2839
3005
|
networkType?: string;
|
|
2840
3006
|
}
|
|
2841
3007
|
//#endregion
|
|
2842
|
-
//#region src/core/entities/Directory.d.ts
|
|
2843
|
-
/**
|
|
2844
|
-
* Directory interface for managing addresses
|
|
2845
|
-
*
|
|
2846
|
-
* This is the public API contract for address directory functionality.
|
|
2847
|
-
* It provides access to addresses, loading capabilities, and search functionality.
|
|
2848
|
-
*
|
|
2849
|
-
* @public
|
|
2850
|
-
*/
|
|
2851
|
-
interface Directory extends AddressProvider<Address> {
|
|
2852
|
-
/**
|
|
2853
|
-
* Observable stream of all addresses in the directory
|
|
2854
|
-
* Emits a new array whenever addresses are added, removed, or updated
|
|
2855
|
-
*/
|
|
2856
|
-
readonly addresses$: Observable<Address[]>;
|
|
2857
|
-
/**
|
|
2858
|
-
* Current snapshot of all addresses in the directory
|
|
2859
|
-
*/
|
|
2860
|
-
readonly addresses: Address[];
|
|
2861
|
-
/**
|
|
2862
|
-
* Observable indicating whether more addresses can be loaded from the server
|
|
2863
|
-
*/
|
|
2864
|
-
readonly hasMore$: Observable<boolean>;
|
|
2865
|
-
/**
|
|
2866
|
-
* Observable indicating the current loading state
|
|
2867
|
-
* Emits `true` when loading, `false` when idle
|
|
2868
|
-
*/
|
|
2869
|
-
readonly loading$: Observable<boolean>;
|
|
2870
|
-
readonly loading: boolean;
|
|
2871
|
-
/**
|
|
2872
|
-
* Load more addresses from the server
|
|
2873
|
-
* Only loads if `hasMore` is true
|
|
2874
|
-
*/
|
|
2875
|
-
loadMore(): void;
|
|
2876
|
-
/**
|
|
2877
|
-
* Get a specific address by ID
|
|
2878
|
-
*
|
|
2879
|
-
* @param addressId - The address ID to retrieve
|
|
2880
|
-
* @returns The address instance, or undefined if not found
|
|
2881
|
-
*/
|
|
2882
|
-
get(addressId: string): Address | undefined;
|
|
2883
|
-
/**
|
|
2884
|
-
* Find an address ID by searching for a name
|
|
2885
|
-
*
|
|
2886
|
-
* @param uri - The address name to search for
|
|
2887
|
-
* @returns Promise resolving to the address ID, or undefined if not found
|
|
2888
|
-
*/
|
|
2889
|
-
findAddressIdByURI(uri: string): Promise<string | undefined>;
|
|
2890
|
-
}
|
|
2891
|
-
//#endregion
|
|
2892
3008
|
//#region src/interfaces/ClientSession.d.ts
|
|
2893
3009
|
/**
|
|
2894
3010
|
* Minimal interface for what Call needs from session management
|
|
@@ -2918,2045 +3034,2406 @@ interface ClientSession {
|
|
|
2918
3034
|
* indicates a re-authentication after the initial connect).
|
|
2919
3035
|
*/
|
|
2920
3036
|
readonly authenticated$: Observable<boolean>;
|
|
3037
|
+
/**
|
|
3038
|
+
* Control transport for every call in this session: `'routed'` (default) sends
|
|
3039
|
+
* call.* verbs on the client's session channel; `'in-dialog'` carries them on
|
|
3040
|
+
* each call's own signaling channel via `verto.info`. Set once as a client
|
|
3041
|
+
* config ({@link SignalWireOptions.callControl}) — it is session-wide, so a
|
|
3042
|
+
* reattached call reads it here rather than restoring it from persisted state.
|
|
3043
|
+
* Read by {@link Call.executeMethod}.
|
|
3044
|
+
*/
|
|
3045
|
+
readonly callControl: 'routed' | 'in-dialog';
|
|
2921
3046
|
}
|
|
2922
3047
|
//#endregion
|
|
2923
|
-
//#region src/
|
|
3048
|
+
//#region src/controllers/LocalAudioPipeline.d.ts
|
|
2924
3049
|
/**
|
|
2925
|
-
*
|
|
2926
|
-
|
|
3050
|
+
* Options for {@link LocalAudioPipeline}.
|
|
3051
|
+
*/
|
|
3052
|
+
interface LocalAudioPipelineOptions {
|
|
3053
|
+
/** Factory for AudioContext — override for tests. Defaults to `new AudioContext()`. */
|
|
3054
|
+
audioContextFactory?: () => AudioContext;
|
|
3055
|
+
/** Initial gain (0..2, where 1 is unity). Defaults to 1. */
|
|
3056
|
+
initialGain?: number;
|
|
3057
|
+
/** RMS level [0..1] above which speaking$ emits true. Defaults to {@link VAD_THRESHOLD}. */
|
|
3058
|
+
speakingThreshold?: number;
|
|
3059
|
+
/**
|
|
3060
|
+
* Milliseconds of silence below the threshold before speaking$ flips back to
|
|
3061
|
+
* false. Prevents flicker on normal speech gaps. Defaults to {@link VAD_HOLD_MS}.
|
|
3062
|
+
*/
|
|
3063
|
+
speakingHoldMs?: number;
|
|
3064
|
+
/** Polling interval for level$. Defaults to {@link AUDIO_LEVEL_POLL_INTERVAL_MS}. */
|
|
3065
|
+
pollIntervalMs?: number;
|
|
3066
|
+
}
|
|
3067
|
+
/**
|
|
3068
|
+
* Web Audio pipeline for the local microphone stream.
|
|
2927
3069
|
*
|
|
2928
|
-
*
|
|
2929
|
-
*
|
|
3070
|
+
* Wraps the raw mic `MediaStreamTrack` in a graph of:
|
|
3071
|
+
*
|
|
3072
|
+
* ```
|
|
3073
|
+
* MediaStreamAudioSourceNode → GainNode → AnalyserNode → MediaStreamAudioDestinationNode
|
|
3074
|
+
* ```
|
|
3075
|
+
*
|
|
3076
|
+
* The {@link outputTrack} from the destination node is what callers should
|
|
3077
|
+
* attach to the `RTCRtpSender` in place of the raw mic track. The same
|
|
3078
|
+
* destination track is reused across input changes (device switch, mute /
|
|
3079
|
+
* unmute track replacement) so the sender reference stays stable — only the
|
|
3080
|
+
* source end of the graph is rebuilt.
|
|
3081
|
+
*
|
|
3082
|
+
* The pipeline owns a single {@link AudioContext}. Callers must invoke
|
|
3083
|
+
* {@link destroy} to release it when the call ends.
|
|
2930
3084
|
*/
|
|
2931
|
-
|
|
3085
|
+
declare class LocalAudioPipeline extends Destroyable {
|
|
3086
|
+
private readonly _audioContext;
|
|
3087
|
+
private readonly _gainNode;
|
|
3088
|
+
private readonly _analyser;
|
|
3089
|
+
private readonly _destination;
|
|
3090
|
+
private readonly _analyserBuffer;
|
|
3091
|
+
private readonly _speakingThreshold;
|
|
3092
|
+
private readonly _speakingHoldMs;
|
|
3093
|
+
private readonly _pollIntervalMs;
|
|
3094
|
+
private _inputSource;
|
|
3095
|
+
private _inputStream;
|
|
3096
|
+
private _lastSpokeAt;
|
|
3097
|
+
private _gain$;
|
|
3098
|
+
/** 1 when audio should pass through, 0 when silenced by PTT. */
|
|
3099
|
+
private _pttMultiplier;
|
|
3100
|
+
constructor(options?: LocalAudioPipelineOptions);
|
|
3101
|
+
/** Observable of the current gain value (0..2). */
|
|
3102
|
+
get gain$(): Observable<number>;
|
|
3103
|
+
/** Current gain value (0..2). */
|
|
3104
|
+
get gain(): number;
|
|
2932
3105
|
/**
|
|
2933
|
-
*
|
|
2934
|
-
*
|
|
3106
|
+
* Processed output track to attach to the RTCRtpSender. Stable reference
|
|
3107
|
+
* across input changes, so `sender.replaceTrack(pipeline.outputTrack)` only
|
|
3108
|
+
* needs to be called once.
|
|
2935
3109
|
*/
|
|
2936
|
-
|
|
3110
|
+
get outputTrack(): MediaStreamTrack;
|
|
2937
3111
|
/**
|
|
2938
|
-
*
|
|
3112
|
+
* Root-mean-square audio level of the input signal, 0..1. Emits on a fixed
|
|
3113
|
+
* interval (~30fps by default).
|
|
2939
3114
|
*/
|
|
2940
|
-
|
|
3115
|
+
get level$(): Observable<number>;
|
|
2941
3116
|
/**
|
|
2942
|
-
*
|
|
3117
|
+
* Boolean VAD derived from {@link level$}. True while level ≥ threshold or
|
|
3118
|
+
* during the hold window after the last frame that crossed the threshold.
|
|
2943
3119
|
*/
|
|
2944
|
-
|
|
3120
|
+
get speaking$(): Observable<boolean>;
|
|
2945
3121
|
/**
|
|
2946
|
-
*
|
|
3122
|
+
* Set gain multiplier applied to the input signal. 0 = silence,
|
|
3123
|
+
* 1 = unity, 2 = 2x. Values are clamped to [0, 2]. The effective gain on
|
|
3124
|
+
* the graph also respects the current PTT state.
|
|
2947
3125
|
*/
|
|
2948
|
-
|
|
3126
|
+
setGain(value: number): void;
|
|
2949
3127
|
/**
|
|
2950
|
-
*
|
|
2951
|
-
*
|
|
3128
|
+
* Silence the graph when `active = false`, otherwise restore the configured
|
|
3129
|
+
* gain. Use this from a PTT handler: released → `false`, held → `true`.
|
|
3130
|
+
* Orthogonal to {@link setGain} — once PTT returns to active, the last
|
|
3131
|
+
* configured gain reappears.
|
|
2952
3132
|
*/
|
|
2953
|
-
|
|
3133
|
+
setPTTActive(active: boolean): void;
|
|
3134
|
+
private applyEffectiveGain;
|
|
2954
3135
|
/**
|
|
2955
|
-
*
|
|
2956
|
-
*
|
|
3136
|
+
* Wire a new raw mic track as the pipeline's input. Replaces any previous
|
|
3137
|
+
* input source and reconnects the graph so {@link outputTrack} continues
|
|
3138
|
+
* to emit the processed audio. Pass `null` to disconnect the input (the
|
|
3139
|
+
* output track stays alive but emits silence).
|
|
3140
|
+
*
|
|
3141
|
+
* Also resumes the underlying AudioContext on attach — Chrome creates it
|
|
3142
|
+
* in a suspended state and the graph won't process (the destination
|
|
3143
|
+
* track emits silence) until resume() succeeds.
|
|
2957
3144
|
*/
|
|
2958
|
-
|
|
3145
|
+
setInputTrack(track: MediaStreamTrack | null): void;
|
|
3146
|
+
destroy(): void;
|
|
3147
|
+
private computeLevel;
|
|
3148
|
+
private evaluateSpeaking;
|
|
2959
3149
|
}
|
|
2960
3150
|
//#endregion
|
|
2961
|
-
//#region src/
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
private readonly agent;
|
|
2982
|
-
private readonly eventAcks;
|
|
2983
|
-
initialized$: Observable<boolean>;
|
|
2984
|
-
private authorizationState$;
|
|
2985
|
-
private connectVersion;
|
|
3151
|
+
//#region src/controllers/RTCPeerConnectionController.d.ts
|
|
3152
|
+
interface RTCPeerConnectionControllerOptions extends MediaOptions {
|
|
3153
|
+
callId?: string;
|
|
3154
|
+
rtcConfiguration?: RTCConfiguration;
|
|
3155
|
+
simulcast?: boolean;
|
|
3156
|
+
sfu?: boolean;
|
|
3157
|
+
msStreamsNumber?: number;
|
|
3158
|
+
propose: RTCPeerConnectionPropose;
|
|
3159
|
+
iceServers?: RTCIceServer[];
|
|
3160
|
+
disableUdpIceServers?: boolean;
|
|
3161
|
+
relayOnly?: boolean;
|
|
3162
|
+
iceCandidateTimeout?: number;
|
|
3163
|
+
iceGatheringTimeout?: number;
|
|
3164
|
+
webRTCApiProvider?: WebRTCApiProvider;
|
|
3165
|
+
/** Per-call preferred video codecs (overrides global preferences). */
|
|
3166
|
+
preferredVideoCodecs?: string[];
|
|
3167
|
+
/** Per-call preferred audio codecs (overrides global preferences). */
|
|
3168
|
+
preferredAudioCodecs?: string[];
|
|
3169
|
+
/** Per-call stereo Opus setting (overrides global preferences). */
|
|
3170
|
+
stereo?: boolean;
|
|
2986
3171
|
/**
|
|
2987
|
-
*
|
|
2988
|
-
*
|
|
2989
|
-
* @internal
|
|
3172
|
+
* Request the shared surface's audio on a `'screenshare'` connection. Kept
|
|
3173
|
+
* apart from `audio`, which selects a microphone the share must not inherit.
|
|
2990
3174
|
*/
|
|
2991
|
-
|
|
2992
|
-
|
|
3175
|
+
screenShareAudio?: boolean;
|
|
3176
|
+
}
|
|
3177
|
+
type RTCPeerConnectionControllerOptionsPartial = Partial<RTCPeerConnectionControllerOptions>;
|
|
3178
|
+
interface UpdateSDPStatusParams {
|
|
3179
|
+
status: 'received' | 'sent' | 'failed';
|
|
3180
|
+
sdp?: string;
|
|
3181
|
+
}
|
|
3182
|
+
declare class RTCPeerConnectionController extends Destroyable {
|
|
3183
|
+
protected options: RTCPeerConnectionControllerOptionsPartial;
|
|
3184
|
+
readonly id: string;
|
|
3185
|
+
firstSDPExchangeCompleted: boolean;
|
|
3186
|
+
sdpInit?: RTCSessionDescriptionInit;
|
|
3187
|
+
private negotiationNeeded$;
|
|
3188
|
+
private deviceController;
|
|
3189
|
+
private localStreamController;
|
|
3190
|
+
private transceiverController?;
|
|
3191
|
+
readonly localDescription$: Observable<RTCSessionDescription | null>;
|
|
3192
|
+
peerConnection?: RTCPeerConnection;
|
|
3193
|
+
private initPromise?;
|
|
3194
|
+
private connectionTimeout;
|
|
3195
|
+
private connectionTimer?;
|
|
3196
|
+
private oniceconnectionstatechangeHandler;
|
|
3197
|
+
private onconnectionstatechangeHandler;
|
|
3198
|
+
private onsignalingstatechangeHandler;
|
|
3199
|
+
private onicegatheringstatechangeHandler;
|
|
3200
|
+
private onnegotiationneededHandler;
|
|
3201
|
+
private updateSelectedInputDevice;
|
|
3202
|
+
private _isNegotiating$;
|
|
3203
|
+
private _iceGatheringController?;
|
|
3204
|
+
private _memberId;
|
|
3205
|
+
private _nodeId;
|
|
3206
|
+
private _type;
|
|
3207
|
+
private _iceConnectionState$;
|
|
3208
|
+
private _connectionState$;
|
|
3209
|
+
private _signalingState$;
|
|
3210
|
+
private _iceGatheringState$;
|
|
2993
3211
|
private _errors$;
|
|
2994
|
-
private
|
|
2995
|
-
private _authState$;
|
|
2996
|
-
/** Sticky flag — once true, stays true for the session lifetime. */
|
|
2997
|
-
private _wasClientBound;
|
|
2998
|
-
private _userInfo$;
|
|
2999
|
-
private _calls$;
|
|
3000
|
-
private _iceServers$;
|
|
3001
|
-
constructor(getCredential: () => SDKCredential, transport: TransportManager, storage: StorageManager, authorizationStateKey: string, deviceController: DeviceController, attachManager: AttachManager, webRTCApiProvider: WebRTCApiProvider, dpopManager?: CryptoController | undefined, networkChange$?: Observable<NetworkChangeEvent>);
|
|
3002
|
-
get incomingCalls$(): Observable<Call[]>;
|
|
3003
|
-
get incomingCalls(): Call[];
|
|
3004
|
-
get userInfo$(): Observable<Address | null>;
|
|
3005
|
-
get userInfo(): Address | null;
|
|
3006
|
-
get calls$(): Observable<Call[]>;
|
|
3007
|
-
get calls(): Call[];
|
|
3008
|
-
get iceServers(): RTCIceServer[] | undefined;
|
|
3009
|
-
get authorization$(): Observable<Authorization | undefined>;
|
|
3010
|
-
get authorization(): Authorization | undefined;
|
|
3011
|
-
get errors$(): Observable<Error>;
|
|
3012
|
-
get authenticated$(): Observable<boolean>;
|
|
3013
|
-
get authenticated(): boolean;
|
|
3212
|
+
private _iceCandidates$;
|
|
3014
3213
|
/**
|
|
3015
|
-
*
|
|
3016
|
-
*
|
|
3017
|
-
*
|
|
3018
|
-
*
|
|
3214
|
+
* Emits once local media is settled: acquired, intentionally receive-only, or
|
|
3215
|
+
* failed and degraded. Separates the media and signalling phases of call
|
|
3216
|
+
* creation. Not `localStream$` — the receive-only paths never build a stream,
|
|
3217
|
+
* so that would hang exactly the calls with nothing to acquire.
|
|
3019
3218
|
*/
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3219
|
+
private _localMediaSettled$;
|
|
3220
|
+
private _initialized$;
|
|
3221
|
+
private _remoteDescription$;
|
|
3222
|
+
private _remoteStream$;
|
|
3223
|
+
private _remoteOfferMediaDirections;
|
|
3224
|
+
private _localAudioPipeline;
|
|
3225
|
+
constructor(options?: RTCPeerConnectionControllerOptionsPartial, remoteSessionDescription?: string, deviceController?: DeviceController);
|
|
3226
|
+
private get iceGatheringController();
|
|
3227
|
+
private get shouldEmitLocalDescription();
|
|
3228
|
+
private removeConnectionTimer;
|
|
3229
|
+
setMemberId(memberId: string | null): void;
|
|
3230
|
+
get memberId(): string | null;
|
|
3231
|
+
/** The node this leg's invite landed on — auxiliary legs are placed independently. */
|
|
3232
|
+
setNodeId(nodeId: string | null): void;
|
|
3233
|
+
get nodeId(): string | null;
|
|
3234
|
+
stopTrackSender(kind: 'audio' | 'video' | 'both', options?: {
|
|
3235
|
+
updateTransceiverDirection: boolean;
|
|
3236
|
+
}): void;
|
|
3237
|
+
private stopRawAudioInputForPipeline;
|
|
3238
|
+
get isNegotiating$(): Observable<boolean>;
|
|
3239
|
+
get isNegotiating(): boolean;
|
|
3240
|
+
updateMediaDevicesOptions(options: MediaOptions): void;
|
|
3241
|
+
get iceGatheringState$(): Observable<RTCIceGatheringState>;
|
|
3242
|
+
get mediaTrackEnded$(): Observable<MediaStreamTrack>;
|
|
3243
|
+
get errors$(): Observable<Error>;
|
|
3244
|
+
get iceCandidates$(): Observable<RTCIceCandidate[]>;
|
|
3245
|
+
get initialized$(): Observable<boolean>;
|
|
3246
|
+
get remoteDescription$(): Observable<RTCSessionDescription | null>;
|
|
3247
|
+
/** Emits once local media is settled — acquired, or knowingly receive-only. */
|
|
3248
|
+
get localMediaSettled$(): Observable<void>;
|
|
3249
|
+
get localStream$(): Observable<MediaStream | null>;
|
|
3250
|
+
get remoteStream$(): Observable<MediaStream | null>;
|
|
3251
|
+
get localAudioTracks$(): Observable<MediaStreamTrack[]>;
|
|
3252
|
+
get localVideoTracks$(): Observable<MediaStreamTrack[]>;
|
|
3253
|
+
get iceConnectionState$(): Observable<RTCIceConnectionState>;
|
|
3254
|
+
get connectionState$(): Observable<RTCPeerConnectionState>;
|
|
3255
|
+
get signalingState$(): Observable<RTCSignalingState>;
|
|
3256
|
+
get type(): RTCPeerConnectionType;
|
|
3257
|
+
get propose(): RTCPeerConnectionPropose;
|
|
3258
|
+
get connectionState(): RTCPeerConnectionState | undefined;
|
|
3259
|
+
get isAdditionalDevice(): boolean;
|
|
3260
|
+
get isMainDevice(): boolean;
|
|
3261
|
+
get isScreenShare(): boolean;
|
|
3262
|
+
protected get iceServers(): RTCIceServer[];
|
|
3263
|
+
private get rtcConfiguration();
|
|
3264
|
+
get receiveVideo(): boolean;
|
|
3265
|
+
get receiveAudio(): boolean;
|
|
3266
|
+
get localStream(): MediaStream | null;
|
|
3267
|
+
get remoteStream(): MediaStream | null;
|
|
3268
|
+
private get inputAudioDeviceConstraints();
|
|
3269
|
+
private get inputVideoDeviceConstraints();
|
|
3270
|
+
private get WebRTCPeerConnectionConstructor();
|
|
3271
|
+
private get offerOptions();
|
|
3272
|
+
private get answerOptions();
|
|
3023
3273
|
/**
|
|
3024
|
-
*
|
|
3025
|
-
* Called
|
|
3026
|
-
*
|
|
3274
|
+
* Initialize the RTCPeerConnection and setup event listeners.
|
|
3275
|
+
* Called automatically when localDescription$ is subscribed to (deferred pattern).
|
|
3276
|
+
* Uses Promise memoization to ensure initialization only happens once,
|
|
3277
|
+
* even if called concurrently.
|
|
3027
3278
|
*/
|
|
3028
|
-
setDirectory(directory: Directory): void;
|
|
3029
|
-
execute<T extends JSONRPCResponse = JSONRPCResponse>(request: JSONRPCRequest, options?: PendingRPCOptions): Promise<T>;
|
|
3030
|
-
send(message: JSONSerializable): void;
|
|
3031
3279
|
private init;
|
|
3032
|
-
private setupMessageHandlers;
|
|
3033
|
-
private loadAuthorizationStateFromStorage;
|
|
3034
|
-
private updateAuthorizationStateInStorage;
|
|
3035
|
-
private get authStateEvent$();
|
|
3036
|
-
get signalingEvent$(): Observable<(Omit<{
|
|
3037
|
-
event_type: "webrtc.message";
|
|
3038
|
-
event_channel: EventChannel;
|
|
3039
|
-
timestamp: number;
|
|
3040
|
-
project_id?: string;
|
|
3041
|
-
node_id?: string;
|
|
3042
|
-
is_author?: boolean;
|
|
3043
|
-
params: WebrtcMessagePayload;
|
|
3044
|
-
}, "event_channel" | "project_id" | "node_id"> & {
|
|
3045
|
-
event_channel: string;
|
|
3046
|
-
project_id: string;
|
|
3047
|
-
node_id: string;
|
|
3048
|
-
}) | {
|
|
3049
|
-
event_type: "signalwire.authorization.state";
|
|
3050
|
-
params: SignalwireAuthorizationStatePayload;
|
|
3051
|
-
} | (Omit<{
|
|
3052
|
-
event_type: "call.joined";
|
|
3053
|
-
event_channel: EventChannel;
|
|
3054
|
-
timestamp: number;
|
|
3055
|
-
project_id?: string;
|
|
3056
|
-
node_id?: string;
|
|
3057
|
-
is_author?: boolean;
|
|
3058
|
-
params: CallJoinedPayload;
|
|
3059
|
-
}, "event_channel"> & {
|
|
3060
|
-
event_channel: string;
|
|
3061
|
-
}) | (Omit<{
|
|
3062
|
-
event_type: "call.left";
|
|
3063
|
-
event_channel: EventChannel;
|
|
3064
|
-
timestamp: number;
|
|
3065
|
-
project_id?: string;
|
|
3066
|
-
node_id?: string;
|
|
3067
|
-
is_author?: boolean;
|
|
3068
|
-
params: CallLeftPayload;
|
|
3069
|
-
}, "event_channel"> & {
|
|
3070
|
-
event_channel: string;
|
|
3071
|
-
}) | (Omit<{
|
|
3072
|
-
event_type: "call.updated";
|
|
3073
|
-
event_channel: EventChannel;
|
|
3074
|
-
timestamp: number;
|
|
3075
|
-
project_id?: string;
|
|
3076
|
-
node_id?: string;
|
|
3077
|
-
is_author?: boolean;
|
|
3078
|
-
params: CallUpdatedPayload;
|
|
3079
|
-
}, "event_channel"> & {
|
|
3080
|
-
event_channel: string;
|
|
3081
|
-
}) | (Omit<{
|
|
3082
|
-
event_type: "call.state";
|
|
3083
|
-
event_channel: EventChannel;
|
|
3084
|
-
timestamp: number;
|
|
3085
|
-
project_id?: string;
|
|
3086
|
-
node_id?: string;
|
|
3087
|
-
is_author?: boolean;
|
|
3088
|
-
params: CallStatePayload;
|
|
3089
|
-
}, "event_channel"> & {
|
|
3090
|
-
event_channel: string;
|
|
3091
|
-
}) | (Omit<{
|
|
3092
|
-
event_type: "call.play";
|
|
3093
|
-
event_channel: EventChannel;
|
|
3094
|
-
timestamp: number;
|
|
3095
|
-
project_id?: string;
|
|
3096
|
-
node_id?: string;
|
|
3097
|
-
is_author?: boolean;
|
|
3098
|
-
params: CallPlayPayload;
|
|
3099
|
-
}, "event_channel"> & {
|
|
3100
|
-
event_channel: string;
|
|
3101
|
-
}) | (Omit<{
|
|
3102
|
-
event_type: "call.connect";
|
|
3103
|
-
event_channel: EventChannel;
|
|
3104
|
-
timestamp: number;
|
|
3105
|
-
project_id?: string;
|
|
3106
|
-
node_id?: string;
|
|
3107
|
-
is_author?: boolean;
|
|
3108
|
-
params: CallConnectPayload;
|
|
3109
|
-
}, "event_channel"> & {
|
|
3110
|
-
event_channel: string;
|
|
3111
|
-
}) | (Omit<{
|
|
3112
|
-
event_type: "room.updated";
|
|
3113
|
-
event_channel: EventChannel;
|
|
3114
|
-
timestamp: number;
|
|
3115
|
-
project_id?: string;
|
|
3116
|
-
node_id?: string;
|
|
3117
|
-
is_author?: boolean;
|
|
3118
|
-
params: RoomUpdatedPayload;
|
|
3119
|
-
}, "event_channel"> & {
|
|
3120
|
-
event_channel: string;
|
|
3121
|
-
}) | Omit<{
|
|
3122
|
-
event_type: "member.updated";
|
|
3123
|
-
event_channel: EventChannel;
|
|
3124
|
-
timestamp: number;
|
|
3125
|
-
project_id?: string;
|
|
3126
|
-
node_id?: string;
|
|
3127
|
-
is_author?: boolean;
|
|
3128
|
-
params: MemberUpdatedPayload;
|
|
3129
|
-
}, never> | Omit<{
|
|
3130
|
-
event_type: "member.joined";
|
|
3131
|
-
event_channel: EventChannel;
|
|
3132
|
-
timestamp: number;
|
|
3133
|
-
project_id?: string;
|
|
3134
|
-
node_id?: string;
|
|
3135
|
-
is_author?: boolean;
|
|
3136
|
-
params: MemberJoinedPayload;
|
|
3137
|
-
}, never> | Omit<{
|
|
3138
|
-
event_type: "member.left";
|
|
3139
|
-
event_channel: EventChannel;
|
|
3140
|
-
timestamp: number;
|
|
3141
|
-
project_id?: string;
|
|
3142
|
-
node_id?: string;
|
|
3143
|
-
is_author?: boolean;
|
|
3144
|
-
params: MemberLeftPayload;
|
|
3145
|
-
}, never> | Omit<{
|
|
3146
|
-
event_type: "member.talking";
|
|
3147
|
-
event_channel: EventChannel;
|
|
3148
|
-
timestamp: number;
|
|
3149
|
-
project_id?: string;
|
|
3150
|
-
node_id?: string;
|
|
3151
|
-
is_author?: boolean;
|
|
3152
|
-
params: MemberTalkingPayload;
|
|
3153
|
-
}, never> | Omit<{
|
|
3154
|
-
event_type: "layout.changed";
|
|
3155
|
-
event_channel: EventChannel;
|
|
3156
|
-
timestamp: number;
|
|
3157
|
-
project_id?: string;
|
|
3158
|
-
node_id?: string;
|
|
3159
|
-
is_author?: boolean;
|
|
3160
|
-
params: LayoutChangedPayload;
|
|
3161
|
-
}, never> | (Omit<{
|
|
3162
|
-
event_type: "conversation.message";
|
|
3163
|
-
event_channel: EventChannel;
|
|
3164
|
-
timestamp: number;
|
|
3165
|
-
project_id?: string;
|
|
3166
|
-
node_id?: string;
|
|
3167
|
-
is_author?: boolean;
|
|
3168
|
-
params: ConversationMessagePayload;
|
|
3169
|
-
}, "event_channel" | "timestamp" | "is_author"> & {
|
|
3170
|
-
event_channel: string;
|
|
3171
|
-
timestamp: string;
|
|
3172
|
-
is_author: boolean;
|
|
3173
|
-
}) | (Omit<{
|
|
3174
|
-
event_type: "conversation.message.updated";
|
|
3175
|
-
event_channel: EventChannel;
|
|
3176
|
-
timestamp: number;
|
|
3177
|
-
project_id?: string;
|
|
3178
|
-
node_id?: string;
|
|
3179
|
-
is_author?: boolean;
|
|
3180
|
-
params: ConversationMessagePayload;
|
|
3181
|
-
}, "event_channel" | "timestamp" | "is_author"> & {
|
|
3182
|
-
event_channel: string;
|
|
3183
|
-
timestamp: string;
|
|
3184
|
-
is_author: boolean;
|
|
3185
|
-
})>;
|
|
3186
|
-
private get vertoInvite$();
|
|
3187
|
-
private get vertoAttach$();
|
|
3188
|
-
private get contexts();
|
|
3189
|
-
private get eventing();
|
|
3190
|
-
private get topics();
|
|
3191
|
-
private get authentication();
|
|
3192
|
-
connect(): Promise<void>;
|
|
3193
|
-
private handleAuthenticationError;
|
|
3194
3280
|
/**
|
|
3195
|
-
*
|
|
3281
|
+
* Internal initialization implementation.
|
|
3282
|
+
* Should only be called via init() to ensure single execution.
|
|
3283
|
+
*/
|
|
3284
|
+
private doInit;
|
|
3285
|
+
private setupPeerConnection;
|
|
3286
|
+
private startNegotiation;
|
|
3287
|
+
/**
|
|
3288
|
+
* Create an SDP offer and set it as local description.
|
|
3289
|
+
*/
|
|
3290
|
+
private createOffer;
|
|
3291
|
+
updateAnswerStatus({
|
|
3292
|
+
status,
|
|
3293
|
+
sdp
|
|
3294
|
+
}: UpdateSDPStatusParams): Promise<void>;
|
|
3295
|
+
updateOfferStatus({
|
|
3296
|
+
status,
|
|
3297
|
+
sdp
|
|
3298
|
+
}: UpdateSDPStatusParams): Promise<void>;
|
|
3299
|
+
/**
|
|
3300
|
+
* Accept an inbound call by creating the SDP answer.
|
|
3301
|
+
* Optionally override media options before the answer is generated.
|
|
3302
|
+
* Must be called after initialization for inbound (answer-type) connections.
|
|
3303
|
+
*/
|
|
3304
|
+
acceptInbound(mediaOverrides?: MediaOptions): Promise<void>;
|
|
3305
|
+
private handleOfferReceived;
|
|
3306
|
+
private readyToConnect;
|
|
3307
|
+
private setRemoteDescriptionBefore;
|
|
3308
|
+
protected setLocalDescription(params: RTCSessionDescriptionInit): Promise<void>;
|
|
3309
|
+
setLocalDescriptionBefore(sdp?: string): Promise<string>;
|
|
3310
|
+
/**
|
|
3311
|
+
* Create an SDP answer and set it as local description.
|
|
3312
|
+
*/
|
|
3313
|
+
private createAnswer;
|
|
3314
|
+
/**
|
|
3315
|
+
* Setup event listeners on RTCPeerConnection for state changes.
|
|
3316
|
+
*/
|
|
3317
|
+
private setupEventListeners;
|
|
3318
|
+
private negotiationEnded;
|
|
3319
|
+
/**
|
|
3320
|
+
* Trigger an ICE restart through the existing negotiation pipeline.
|
|
3196
3321
|
*
|
|
3197
|
-
* This
|
|
3198
|
-
*
|
|
3199
|
-
*
|
|
3200
|
-
*
|
|
3201
|
-
*
|
|
3322
|
+
* This creates an offer with iceRestart: true and goes through the full
|
|
3323
|
+
* SDP pipeline (setLocalDescription → ICE gathering → localDescription$ emission).
|
|
3324
|
+
* The caller should NOT send the SDP manually — the existing
|
|
3325
|
+
* setupLocalDescriptionHandler in VertoManager will pick up the emission
|
|
3326
|
+
* from localDescription$ and send it as a verto.modify.
|
|
3327
|
+
*
|
|
3328
|
+
* Unlike calling pc.createOffer/setLocalDescription directly, this method:
|
|
3329
|
+
* - Sets _isNegotiating$ so ICEGatheringController arms its timers
|
|
3330
|
+
* - Waits for ICE gathering to complete before localDescription$ emits
|
|
3331
|
+
* - Goes through setLocalDescriptionBefore() for any SDP munging
|
|
3332
|
+
*/
|
|
3333
|
+
triggerIceRestart(relayOnly?: boolean): Promise<void>;
|
|
3334
|
+
private restoreIceTransportPolicy;
|
|
3335
|
+
/**
|
|
3336
|
+
* Setup track handling for remote tracks.
|
|
3337
|
+
*
|
|
3338
|
+
* @returns `false` when the connection went away while local media was being
|
|
3339
|
+
* acquired — see {@link setupLocalTracks}.
|
|
3340
|
+
*/
|
|
3341
|
+
private setupTrackHandling;
|
|
3342
|
+
/**
|
|
3343
|
+
* @returns `false` when the connection was torn down while getUserMedia was
|
|
3344
|
+
* in flight. The acquisition is not cancellable, so the caller must stop
|
|
3345
|
+
* rather than go on to touch a peer connection that is closed or gone.
|
|
3346
|
+
*/
|
|
3347
|
+
private setupLocalTracks;
|
|
3348
|
+
/** True for a main connection with no local media to send. */
|
|
3349
|
+
private hasNoLocalMediaToSend;
|
|
3350
|
+
/** The media kinds this connection wants to send: 'audiovideo' | 'video' | 'audio'. */
|
|
3351
|
+
private get requestedMediaKinds();
|
|
3352
|
+
/**
|
|
3353
|
+
* Handle a local media acquisition failure with a typed, semantically
|
|
3354
|
+
* accurate MediaAccessError created at the acquisition site:
|
|
3355
|
+
* - Auxiliary connections (screenshare / additional-device) throw a
|
|
3356
|
+
* non-fatal error — VertoManager surfaces it and the call is unaffected.
|
|
3357
|
+
* - The main connection degrades to receive-only when allowed (default),
|
|
3358
|
+
* otherwise fails with a fatal error.
|
|
3359
|
+
*/
|
|
3360
|
+
private handleLocalMediaFailure;
|
|
3361
|
+
/**
|
|
3362
|
+
* Negotiate receive-only m-lines when there are no local tracks to send.
|
|
3363
|
+
* Only offer-type connections add transceivers — answer-type connections
|
|
3364
|
+
* reuse the transceivers created from the remote offer.
|
|
3365
|
+
*/
|
|
3366
|
+
private setupReceiveOnlyTransceivers;
|
|
3367
|
+
private getUserMedia;
|
|
3368
|
+
private getDisplayMedia;
|
|
3369
|
+
private setupRemoteTracks;
|
|
3370
|
+
restoreTrackSender(kind: 'audio' | 'video' | 'both'): Promise<void>;
|
|
3371
|
+
private restoreRawAudioInputForPipeline;
|
|
3372
|
+
/**
|
|
3373
|
+
* Capture the newly selected device, leaving the current capture running.
|
|
3202
3374
|
*
|
|
3203
|
-
*
|
|
3204
|
-
*
|
|
3375
|
+
* A rejection must leave the current track sending, so nothing is released
|
|
3376
|
+
* until the replacement is in hand. The one exception is hardware that admits
|
|
3377
|
+
* a single opener — a phone's front and back cameras, typically — which
|
|
3378
|
+
* rejects the second capture until the first is closed.
|
|
3205
3379
|
*/
|
|
3206
|
-
|
|
3380
|
+
private acquireInputTrack;
|
|
3381
|
+
private captureTrack;
|
|
3382
|
+
/** Best-effort return to the device that was released for an exclusive retry. */
|
|
3383
|
+
private restorePreviousInputTrack;
|
|
3384
|
+
private attachInputTrack;
|
|
3207
3385
|
/**
|
|
3208
|
-
*
|
|
3209
|
-
*
|
|
3210
|
-
*
|
|
3211
|
-
*
|
|
3212
|
-
*
|
|
3213
|
-
* within the session identified by the resume state, so ending the
|
|
3214
|
-
* session must clear both. Clearing one without the other strands records
|
|
3215
|
-
* no future session can honor (disconnect) or revives a session the
|
|
3216
|
-
* developer explicitly ended (destroy).
|
|
3217
|
-
*
|
|
3218
|
-
* Distinct from {@link cleanupStoredConnectionParams}, which keeps the
|
|
3219
|
-
* attach records for the stale-auth-state recovery path.
|
|
3386
|
+
* Return the lazily-created {@link LocalAudioPipeline}, constructing it on
|
|
3387
|
+
* first access. On creation the current audio sender's track is routed
|
|
3388
|
+
* through the pipeline (input → gain → analyser → destination) and the
|
|
3389
|
+
* sender is switched to emit the processed track. Returns `null` when no
|
|
3390
|
+
* audio sender exists yet (pre-negotiation).
|
|
3220
3391
|
*/
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
}): Promise<void>;
|
|
3226
|
-
private authenticate;
|
|
3227
|
-
disconnect(): Promise<void>;
|
|
3228
|
-
private createInboundCall;
|
|
3392
|
+
ensureLocalAudioPipeline(): LocalAudioPipeline | null;
|
|
3393
|
+
/** The active LocalAudioPipeline, or null if it hasn't been created yet. */
|
|
3394
|
+
get localAudioPipeline(): LocalAudioPipeline | null;
|
|
3395
|
+
private applyLocalAudioPipelineToSender;
|
|
3229
3396
|
/**
|
|
3230
|
-
*
|
|
3397
|
+
* Add a local media track to the peer connection.
|
|
3398
|
+
* @param track - The MediaStreamTrack to add
|
|
3399
|
+
*/
|
|
3400
|
+
addLocalTrack(track: MediaStreamTrack): void;
|
|
3401
|
+
/**
|
|
3402
|
+
* Remove a local media track from the peer connection.
|
|
3403
|
+
* @param trackId - The ID of the track to remove
|
|
3404
|
+
*/
|
|
3405
|
+
removeLocalTrack(trackId: string): void;
|
|
3406
|
+
/**
|
|
3407
|
+
* Replace all existing media tracks with a new media track.
|
|
3408
|
+
* Convenience method for single-track scenarios.
|
|
3409
|
+
* @param track - The MediaStreamTrack to set
|
|
3410
|
+
*/
|
|
3411
|
+
setLocalTrack(track: MediaStreamTrack): void;
|
|
3412
|
+
/**
|
|
3413
|
+
* @returns whether the constraints reached the media the leg is sending.
|
|
3231
3414
|
*
|
|
3232
|
-
*
|
|
3233
|
-
*
|
|
3234
|
-
*
|
|
3235
|
-
*
|
|
3236
|
-
*
|
|
3415
|
+
* With the pipeline engaged the audio sender carries the processed
|
|
3416
|
+
* destination track, so the sender scan would find nothing it may touch and
|
|
3417
|
+
* every audio constraint API would silently no-op. The constraints belong to
|
|
3418
|
+
* the pipeline's device source, which is the capture that sender ultimately
|
|
3419
|
+
* carries.
|
|
3420
|
+
*/
|
|
3421
|
+
updateSendersConstraints(kind: 'audio' | 'video', constraints?: MediaTrackConstraints): Promise<boolean>;
|
|
3422
|
+
/**
|
|
3423
|
+
* Mirror of the sender path for a piped audio leg: same merge, same fallback
|
|
3424
|
+
* ladder, same device-capture invariant — but the swap target is the pipeline
|
|
3425
|
+
* input, so the sender keeps emitting the pipeline's output track and its
|
|
3426
|
+
* identity survives the change.
|
|
3427
|
+
*/
|
|
3428
|
+
private applyPipelineSourceConstraints;
|
|
3429
|
+
/**
|
|
3430
|
+
* Clean up resources and close the peer connection.
|
|
3431
|
+
* Completes all observables to prevent memory leaks.
|
|
3237
3432
|
*/
|
|
3238
|
-
private handleVertoAttach;
|
|
3239
|
-
createOutboundCall(destination: string | Address, options?: CallOptions): Promise<Call>;
|
|
3240
|
-
private createCall;
|
|
3241
3433
|
destroy(): void;
|
|
3434
|
+
private removeAllListeners;
|
|
3435
|
+
private stopRemoteTracks;
|
|
3436
|
+
get mediaDirections(): {
|
|
3437
|
+
audio: RTCRtpTransceiverDirection;
|
|
3438
|
+
video: RTCRtpTransceiverDirection;
|
|
3439
|
+
};
|
|
3440
|
+
protected _setRemoteDescription(params: RTCSessionDescriptionInit): Promise<void>;
|
|
3242
3441
|
}
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
constructor(clientSessionManager: ClientSessionManager);
|
|
3246
|
-
get authenticated$(): Observable<boolean>;
|
|
3247
|
-
get authenticated(): boolean;
|
|
3248
|
-
get signalingEvent$(): Observable<(Omit<{
|
|
3249
|
-
event_type: "webrtc.message";
|
|
3250
|
-
event_channel: EventChannel;
|
|
3251
|
-
timestamp: number;
|
|
3252
|
-
project_id?: string;
|
|
3253
|
-
node_id?: string;
|
|
3254
|
-
is_author?: boolean;
|
|
3255
|
-
params: WebrtcMessagePayload;
|
|
3256
|
-
}, "event_channel" | "project_id" | "node_id"> & {
|
|
3257
|
-
event_channel: string;
|
|
3258
|
-
project_id: string;
|
|
3259
|
-
node_id: string;
|
|
3260
|
-
}) | {
|
|
3261
|
-
event_type: "signalwire.authorization.state";
|
|
3262
|
-
params: SignalwireAuthorizationStatePayload;
|
|
3263
|
-
} | (Omit<{
|
|
3264
|
-
event_type: "call.joined";
|
|
3265
|
-
event_channel: EventChannel;
|
|
3266
|
-
timestamp: number;
|
|
3267
|
-
project_id?: string;
|
|
3268
|
-
node_id?: string;
|
|
3269
|
-
is_author?: boolean;
|
|
3270
|
-
params: CallJoinedPayload;
|
|
3271
|
-
}, "event_channel"> & {
|
|
3272
|
-
event_channel: string;
|
|
3273
|
-
}) | (Omit<{
|
|
3274
|
-
event_type: "call.left";
|
|
3275
|
-
event_channel: EventChannel;
|
|
3276
|
-
timestamp: number;
|
|
3277
|
-
project_id?: string;
|
|
3278
|
-
node_id?: string;
|
|
3279
|
-
is_author?: boolean;
|
|
3280
|
-
params: CallLeftPayload;
|
|
3281
|
-
}, "event_channel"> & {
|
|
3282
|
-
event_channel: string;
|
|
3283
|
-
}) | (Omit<{
|
|
3284
|
-
event_type: "call.updated";
|
|
3285
|
-
event_channel: EventChannel;
|
|
3286
|
-
timestamp: number;
|
|
3287
|
-
project_id?: string;
|
|
3288
|
-
node_id?: string;
|
|
3289
|
-
is_author?: boolean;
|
|
3290
|
-
params: CallUpdatedPayload;
|
|
3291
|
-
}, "event_channel"> & {
|
|
3292
|
-
event_channel: string;
|
|
3293
|
-
}) | (Omit<{
|
|
3294
|
-
event_type: "call.state";
|
|
3295
|
-
event_channel: EventChannel;
|
|
3296
|
-
timestamp: number;
|
|
3297
|
-
project_id?: string;
|
|
3298
|
-
node_id?: string;
|
|
3299
|
-
is_author?: boolean;
|
|
3300
|
-
params: CallStatePayload;
|
|
3301
|
-
}, "event_channel"> & {
|
|
3302
|
-
event_channel: string;
|
|
3303
|
-
}) | (Omit<{
|
|
3304
|
-
event_type: "call.play";
|
|
3305
|
-
event_channel: EventChannel;
|
|
3306
|
-
timestamp: number;
|
|
3307
|
-
project_id?: string;
|
|
3308
|
-
node_id?: string;
|
|
3309
|
-
is_author?: boolean;
|
|
3310
|
-
params: CallPlayPayload;
|
|
3311
|
-
}, "event_channel"> & {
|
|
3312
|
-
event_channel: string;
|
|
3313
|
-
}) | (Omit<{
|
|
3314
|
-
event_type: "call.connect";
|
|
3315
|
-
event_channel: EventChannel;
|
|
3316
|
-
timestamp: number;
|
|
3317
|
-
project_id?: string;
|
|
3318
|
-
node_id?: string;
|
|
3319
|
-
is_author?: boolean;
|
|
3320
|
-
params: CallConnectPayload;
|
|
3321
|
-
}, "event_channel"> & {
|
|
3322
|
-
event_channel: string;
|
|
3323
|
-
}) | (Omit<{
|
|
3324
|
-
event_type: "room.updated";
|
|
3325
|
-
event_channel: EventChannel;
|
|
3326
|
-
timestamp: number;
|
|
3327
|
-
project_id?: string;
|
|
3328
|
-
node_id?: string;
|
|
3329
|
-
is_author?: boolean;
|
|
3330
|
-
params: RoomUpdatedPayload;
|
|
3331
|
-
}, "event_channel"> & {
|
|
3332
|
-
event_channel: string;
|
|
3333
|
-
}) | Omit<{
|
|
3334
|
-
event_type: "member.updated";
|
|
3335
|
-
event_channel: EventChannel;
|
|
3336
|
-
timestamp: number;
|
|
3337
|
-
project_id?: string;
|
|
3338
|
-
node_id?: string;
|
|
3339
|
-
is_author?: boolean;
|
|
3340
|
-
params: MemberUpdatedPayload;
|
|
3341
|
-
}, never> | Omit<{
|
|
3342
|
-
event_type: "member.joined";
|
|
3343
|
-
event_channel: EventChannel;
|
|
3344
|
-
timestamp: number;
|
|
3345
|
-
project_id?: string;
|
|
3346
|
-
node_id?: string;
|
|
3347
|
-
is_author?: boolean;
|
|
3348
|
-
params: MemberJoinedPayload;
|
|
3349
|
-
}, never> | Omit<{
|
|
3350
|
-
event_type: "member.left";
|
|
3351
|
-
event_channel: EventChannel;
|
|
3352
|
-
timestamp: number;
|
|
3353
|
-
project_id?: string;
|
|
3354
|
-
node_id?: string;
|
|
3355
|
-
is_author?: boolean;
|
|
3356
|
-
params: MemberLeftPayload;
|
|
3357
|
-
}, never> | Omit<{
|
|
3358
|
-
event_type: "member.talking";
|
|
3359
|
-
event_channel: EventChannel;
|
|
3360
|
-
timestamp: number;
|
|
3361
|
-
project_id?: string;
|
|
3362
|
-
node_id?: string;
|
|
3363
|
-
is_author?: boolean;
|
|
3364
|
-
params: MemberTalkingPayload;
|
|
3365
|
-
}, never> | Omit<{
|
|
3366
|
-
event_type: "layout.changed";
|
|
3367
|
-
event_channel: EventChannel;
|
|
3368
|
-
timestamp: number;
|
|
3369
|
-
project_id?: string;
|
|
3370
|
-
node_id?: string;
|
|
3371
|
-
is_author?: boolean;
|
|
3372
|
-
params: LayoutChangedPayload;
|
|
3373
|
-
}, never> | (Omit<{
|
|
3374
|
-
event_type: "conversation.message";
|
|
3375
|
-
event_channel: EventChannel;
|
|
3376
|
-
timestamp: number;
|
|
3377
|
-
project_id?: string;
|
|
3378
|
-
node_id?: string;
|
|
3379
|
-
is_author?: boolean;
|
|
3380
|
-
params: ConversationMessagePayload;
|
|
3381
|
-
}, "event_channel" | "timestamp" | "is_author"> & {
|
|
3382
|
-
event_channel: string;
|
|
3383
|
-
timestamp: string;
|
|
3384
|
-
is_author: boolean;
|
|
3385
|
-
}) | (Omit<{
|
|
3386
|
-
event_type: "conversation.message.updated";
|
|
3387
|
-
event_channel: EventChannel;
|
|
3388
|
-
timestamp: number;
|
|
3389
|
-
project_id?: string;
|
|
3390
|
-
node_id?: string;
|
|
3391
|
-
is_author?: boolean;
|
|
3392
|
-
params: ConversationMessagePayload;
|
|
3393
|
-
}, "event_channel" | "timestamp" | "is_author"> & {
|
|
3394
|
-
event_channel: string;
|
|
3395
|
-
timestamp: string;
|
|
3396
|
-
is_author: boolean;
|
|
3397
|
-
})>;
|
|
3398
|
-
get iceServers(): RTCIceServer[] | undefined;
|
|
3399
|
-
execute<T extends JSONRPCResponse = JSONRPCResponse>(request: JSONRPCRequest, options?: PendingRPCOptions): Promise<T>;
|
|
3400
|
-
get incomingCalls$(): Observable<Call[]>;
|
|
3401
|
-
get incomingCalls(): Call[];
|
|
3402
|
-
get calls$(): Observable<Call[]>;
|
|
3403
|
-
get calls(): Call[];
|
|
3404
|
-
}
|
|
3405
|
-
//#endregion
|
|
3406
|
-
//#region src/core/types/warnings.types.d.ts
|
|
3407
|
-
/**
|
|
3408
|
-
* Non-fatal warning emitted via {@link SignalWire.warnings$ | client.warnings$}.
|
|
3409
|
-
*
|
|
3410
|
-
* Use to detect SDK behaviors that affect session liveness or developer-facing
|
|
3411
|
-
* contracts but do not warrant disconnection. Discriminated by `code`.
|
|
3412
|
-
*
|
|
3413
|
-
* Existing consumers of `errors$` are NOT notified — `warnings$` is a separate
|
|
3414
|
-
* channel so application code can react to warnings without triggering
|
|
3415
|
-
* error-handling code paths (e.g., disconnect cascades, user-facing toasts).
|
|
3416
|
-
*/
|
|
3417
|
-
type SDKWarning = CredentialRefreshFallbackWarning | CredentialNoRefreshHandlerWarning;
|
|
3418
|
-
/**
|
|
3419
|
-
* Diagnostic detail for {@link CredentialRefreshFallbackWarning}. Stable
|
|
3420
|
-
* values, but treat unknown strings as "fell back for an unspecified cause" —
|
|
3421
|
-
* do not branch on this value for control flow. New values may be added in
|
|
3422
|
-
* future releases.
|
|
3423
|
-
*/
|
|
3424
|
-
type CredentialRefreshFallbackReason = 'no-scope' | 'no-dpop-support' | 'endpoint-failed' | 'activation-timeout' | (string & {});
|
|
3442
|
+
//#endregion
|
|
3443
|
+
//#region src/interfaces/WebRTCVerto.d.ts
|
|
3425
3444
|
/**
|
|
3426
|
-
*
|
|
3427
|
-
*
|
|
3428
|
-
* could not take over.
|
|
3429
|
-
*
|
|
3430
|
-
* Common causes:
|
|
3431
|
-
* - The minted SAT lacks `sat:refresh` scope (`reason: 'no-scope'`).
|
|
3432
|
-
* - The `/devices/token` exchange failed transiently (`reason: 'endpoint-failed'`).
|
|
3433
|
-
*
|
|
3434
|
-
* Subscribe to this warning to detect:
|
|
3435
|
-
* - SDKs running with plain SATs that rely on developer-managed refresh
|
|
3436
|
-
* - Deployments expected to use bound tokens that silently downgraded to bearer
|
|
3437
|
-
* (a security-relevant signal for fleet observability)
|
|
3445
|
+
* Extended interface for WebRTC Verto Manager
|
|
3446
|
+
* Includes WebRTC-specific state and peer connection management
|
|
3438
3447
|
*/
|
|
3439
|
-
interface
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3448
|
+
interface WebRTCVerto extends VertoManager {
|
|
3449
|
+
readonly selfId$: Observable<string | null>;
|
|
3450
|
+
/** Separates the media phase of call creation from the signalling phase. */
|
|
3451
|
+
readonly localMediaSettled$: Observable<void>;
|
|
3452
|
+
readonly selfId: string | null;
|
|
3453
|
+
readonly nodeId$: Observable<string | null>;
|
|
3454
|
+
readonly nodeId: string | null;
|
|
3455
|
+
readonly localStream$: Observable<MediaStream>;
|
|
3456
|
+
readonly localStream: MediaStream | null;
|
|
3457
|
+
readonly remoteStream$: Observable<MediaStream>;
|
|
3458
|
+
readonly remoteStream: MediaStream | null;
|
|
3459
|
+
readonly mediaDirections$: Observable<MediaDirections>;
|
|
3460
|
+
readonly mediaDirections: MediaDirections;
|
|
3461
|
+
readonly signalingStatus$: Observable<SignalingStatus>;
|
|
3462
|
+
readonly mainPeerConnection: RTCPeerConnectionController;
|
|
3463
|
+
bye(cause?: string): Promise<void>;
|
|
3464
|
+
sendDigits(dtmf: string): Promise<void>;
|
|
3465
|
+
/**
|
|
3466
|
+
* Send a member-control op in-dialog via verto.info (no self/target member
|
|
3467
|
+
* tuple). The payload rides in the verto.info `params.command` body — a
|
|
3468
|
+
* sibling of `dialogParams`, same level as `dtmf` — matched to this call's
|
|
3469
|
+
* channel by `dialogParams.callID`, so control lands on the call's own channel
|
|
3470
|
+
* without relying on the {node_id,call_id,member_id} addressing the routed
|
|
3471
|
+
* transport uses.
|
|
3472
|
+
*/
|
|
3473
|
+
sendCallControl(method: string, params: Record<string, unknown>): Promise<unknown>;
|
|
3474
|
+
hold(): Promise<void>;
|
|
3475
|
+
unhold(): Promise<void>;
|
|
3476
|
+
destroy(): void;
|
|
3477
|
+
transfer(options: TransferOptions): Promise<void>;
|
|
3478
|
+
/** Request a video keyframe via verto.modify. */
|
|
3479
|
+
requestKeyframe?: () => void;
|
|
3480
|
+
/** Request an ICE restart via verto.modify with iceRestart offer. */
|
|
3481
|
+
requestIceRestart?: (relayOnly?: boolean) => Promise<void>;
|
|
3482
|
+
/** Request an ICE restart on all active peer connections (multi-leg). */
|
|
3483
|
+
requestIceRestartAll?: (relayOnly?: boolean) => Promise<void>;
|
|
3484
|
+
/** Request keyframes on all video-receiving legs (skips send-only screen share). */
|
|
3485
|
+
requestKeyframeAll?: () => void;
|
|
3486
|
+
/** Lazily create (or return) the local audio pipeline for the main peer connection. */
|
|
3487
|
+
ensureLocalAudioPipeline(): LocalAudioPipeline | null;
|
|
3488
|
+
/** Current local audio pipeline, or null if it has not been created yet. */
|
|
3489
|
+
readonly localAudioPipeline: LocalAudioPipeline | null;
|
|
3490
|
+
}
|
|
3491
|
+
//#endregion
|
|
3492
|
+
//#region src/managers/CallEventsManager.d.ts
|
|
3493
|
+
interface WebRTCCallEventManagerOptions {}
|
|
3494
|
+
/** @internal */
|
|
3495
|
+
declare class CallEventsManager extends Destroyable {
|
|
3496
|
+
protected webRtcCallSession: CallManager;
|
|
3497
|
+
protected options: WebRTCCallEventManagerOptions;
|
|
3498
|
+
private selfId?;
|
|
3499
|
+
private originCallId?;
|
|
3500
|
+
private callIds;
|
|
3501
|
+
private roomSessionIds;
|
|
3502
|
+
private _participants$;
|
|
3503
|
+
private _self$;
|
|
3504
|
+
private _sessionState$;
|
|
3505
|
+
constructor(webRtcCallSession: CallManager, options?: WebRTCCallEventManagerOptions);
|
|
3506
|
+
get participants$(): Observable<CallParticipant[]>;
|
|
3507
|
+
get participants(): CallParticipant[];
|
|
3508
|
+
get self$(): Observable<CallSelfParticipant>;
|
|
3509
|
+
isRoomSessionIdValid(roomSessionId: string): boolean;
|
|
3510
|
+
addCallId(callId: string): void;
|
|
3511
|
+
isCallIdValid(callId: string): boolean;
|
|
3512
|
+
get recording$(): Observable<boolean>;
|
|
3513
|
+
get recordings$(): Observable<Record<string, unknown>[]>;
|
|
3514
|
+
get streaming$(): Observable<boolean>;
|
|
3515
|
+
get streams$(): Observable<Record<string, unknown>[]>;
|
|
3516
|
+
get playbacks$(): Observable<Record<string, unknown>[]>;
|
|
3517
|
+
get raiseHandPriority$(): Observable<boolean>;
|
|
3518
|
+
get locked$(): Observable<boolean>;
|
|
3519
|
+
get meta$(): Observable<Record<string, unknown>>;
|
|
3520
|
+
get capabilities$(): Observable<Capability[]>;
|
|
3521
|
+
get layout$(): Observable<string>;
|
|
3522
|
+
get layouts$(): Observable<string[]>;
|
|
3523
|
+
get layoutLayers$(): Observable<LayoutLayer[]>;
|
|
3524
|
+
get self(): CallSelfParticipant | null;
|
|
3525
|
+
get layoutLayers(): LayoutLayer[];
|
|
3526
|
+
get recording(): boolean;
|
|
3527
|
+
get streaming(): boolean;
|
|
3528
|
+
get raiseHandPriority(): boolean;
|
|
3529
|
+
get locked(): boolean;
|
|
3530
|
+
get meta(): Record<string, unknown>;
|
|
3531
|
+
get layout(): string | undefined;
|
|
3532
|
+
get layouts(): string[];
|
|
3533
|
+
get capabilities(): Capability[];
|
|
3534
|
+
isSessionEvent(id: string): boolean;
|
|
3535
|
+
protected initSubscriptions(): void;
|
|
3536
|
+
private updateParticipantPositions;
|
|
3537
|
+
updateLayouts(): void;
|
|
3538
|
+
private updateParticipants;
|
|
3539
|
+
private upsertParticipant;
|
|
3540
|
+
private get callJoinedEvent$();
|
|
3541
|
+
private get layoutChangedEvent$();
|
|
3542
|
+
private get memberUpdates$();
|
|
3543
|
+
destroy(): void;
|
|
3544
|
+
}
|
|
3545
|
+
//#endregion
|
|
3546
|
+
//#region src/managers/CallRecoveryManager.d.ts
|
|
3547
|
+
type RecoveryState$1 = 'idle' | 'debouncing' | 'recovering' | 'cooldown';
|
|
3548
|
+
interface RecoveryEvent$1 {
|
|
3549
|
+
action: 'keyframe_requested' | 'reinvite_started' | 'reinvite_succeeded' | 'reinvite_failed' | 'reinvite_timeout' | 'max_attempts_reached' | 'signal_reconnect' | 'full_reconnect' | 'video_disabled' | 'video_restored';
|
|
3550
|
+
reason: string;
|
|
3551
|
+
attempt?: number;
|
|
3552
|
+
maxAttempts?: number;
|
|
3553
|
+
timestamp: number;
|
|
3444
3554
|
}
|
|
3555
|
+
//#endregion
|
|
3556
|
+
//#region src/utils/qualityScore.d.ts
|
|
3445
3557
|
/**
|
|
3446
|
-
*
|
|
3447
|
-
*
|
|
3558
|
+
* MOS (Mean Opinion Score) quality computation based on the simplified
|
|
3559
|
+
* ITU-T G.107 E-model.
|
|
3448
3560
|
*
|
|
3449
|
-
*
|
|
3450
|
-
*
|
|
3561
|
+
* Provides a single 1-5 number that applications can use for a
|
|
3562
|
+
* green / yellow / red quality indicator without understanding raw
|
|
3563
|
+
* jitter and packet-loss values.
|
|
3451
3564
|
*/
|
|
3452
|
-
|
|
3453
|
-
code: 'credential_no_refresh_handler';
|
|
3454
|
-
source: 'CredentialProvider';
|
|
3455
|
-
message: string;
|
|
3456
|
-
/** Token expiry timestamp (epoch milliseconds). */
|
|
3457
|
-
expiresAt: number;
|
|
3458
|
-
}
|
|
3565
|
+
type QualityLevel$1 = 'excellent' | 'good' | 'fair' | 'poor' | 'critical';
|
|
3459
3566
|
//#endregion
|
|
3460
|
-
//#region src/
|
|
3461
|
-
/** Log level names supported by the SDK. */
|
|
3462
|
-
type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
3567
|
+
//#region src/core/entities/Call.d.ts
|
|
3463
3568
|
/**
|
|
3464
|
-
*
|
|
3465
|
-
* All methods accept variadic arguments matching the browser console API.
|
|
3569
|
+
* Manager instances returned by initialization callback
|
|
3466
3570
|
*/
|
|
3467
|
-
interface
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
info(...args: unknown[]): void;
|
|
3471
|
-
debug(...args: unknown[]): void;
|
|
3472
|
-
trace(...args: unknown[]): void;
|
|
3473
|
-
}
|
|
3474
|
-
/** Options for WebSocket traffic logging. */
|
|
3475
|
-
interface WsTrafficOptions {
|
|
3476
|
-
type: 'send' | 'recv' | 'http';
|
|
3477
|
-
/** Parsed object or raw string — will be JSON.stringify'd for display if an object. */
|
|
3478
|
-
payload: unknown;
|
|
3571
|
+
interface CallManagers {
|
|
3572
|
+
vertoManager: WebRTCVerto;
|
|
3573
|
+
callEventsManager: CallEventsManager;
|
|
3479
3574
|
}
|
|
3480
3575
|
/**
|
|
3481
|
-
*
|
|
3482
|
-
*
|
|
3483
|
-
*
|
|
3576
|
+
* Initialization callback that creates managers for a Call instance
|
|
3577
|
+
* @param call - The WebRTCCall instance being initialized
|
|
3578
|
+
* @returns Manager instances for the call
|
|
3484
3579
|
*/
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
}
|
|
3489
|
-
|
|
3490
|
-
interface
|
|
3491
|
-
/**
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3580
|
+
type ManagerInitializer = (call: WebRTCCall) => CallManagers;
|
|
3581
|
+
/**
|
|
3582
|
+
* Required initialization configuration for Call constructor.
|
|
3583
|
+
* Calls must be created via {@link CallFactory} which provides these dependencies.
|
|
3584
|
+
*/
|
|
3585
|
+
interface CallInitialization {
|
|
3586
|
+
/**
|
|
3587
|
+
* Callback function that creates and wires manager instances
|
|
3588
|
+
*/
|
|
3589
|
+
initializeManagers: ManagerInitializer;
|
|
3590
|
+
/**
|
|
3591
|
+
* Device controller for media device access
|
|
3592
|
+
*/
|
|
3593
|
+
deviceController: DeviceController;
|
|
3594
|
+
/**
|
|
3595
|
+
* Network change events for feeding recovery pipeline
|
|
3596
|
+
*/
|
|
3597
|
+
networkChange$?: Observable<NetworkChangeEvent>;
|
|
3497
3598
|
}
|
|
3498
|
-
/** Replace the built-in logger with a custom implementation. Pass `null` to restore defaults. */
|
|
3499
|
-
declare const setLogger: (logger: SDKLogger | null) => void;
|
|
3500
|
-
/** Configure debug options (e.g., `{ logWsTraffic: true }`). */
|
|
3501
|
-
declare const setDebugOptions: (options: DebugOptions | null) => void;
|
|
3502
3599
|
/**
|
|
3503
|
-
*
|
|
3504
|
-
*
|
|
3600
|
+
* Concrete WebRTC call implementation.
|
|
3601
|
+
*
|
|
3602
|
+
* Manages the full lifecycle of a call including signaling, media streams,
|
|
3603
|
+
* participants, layout, and event routing. Created via {@link SignalWire.dial}
|
|
3604
|
+
* or received as an inbound call.
|
|
3505
3605
|
*/
|
|
3506
|
-
declare
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
/**
|
|
3511
|
-
|
|
3512
|
-
/**
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3606
|
+
declare class WebRTCCall extends Destroyable implements CallManager, Call {
|
|
3607
|
+
clientSession: ClientSession;
|
|
3608
|
+
options: CallOptions;
|
|
3609
|
+
address?: Address | undefined;
|
|
3610
|
+
/** Unique identifier for this call. */
|
|
3611
|
+
readonly id: string;
|
|
3612
|
+
/** Destination URI this call was placed to. */
|
|
3613
|
+
to?: string;
|
|
3614
|
+
private vertoManager;
|
|
3615
|
+
private callEventsManager;
|
|
3616
|
+
private participantFactory;
|
|
3617
|
+
private _errors$;
|
|
3618
|
+
private _status$;
|
|
3619
|
+
private _lastMergedStatus;
|
|
3620
|
+
private _answered$;
|
|
3621
|
+
private _answerMediaOptions?;
|
|
3622
|
+
private _holdState;
|
|
3623
|
+
private _userVariables$;
|
|
3624
|
+
private _statsMonitor?;
|
|
3625
|
+
private _recoveryManager?;
|
|
3626
|
+
private _networkChange$?;
|
|
3627
|
+
private _networkIssues$;
|
|
3628
|
+
private _networkMetrics$;
|
|
3629
|
+
private _isNetworkHealthy$;
|
|
3630
|
+
private _qualityScore$;
|
|
3631
|
+
private _qualityLevel$;
|
|
3632
|
+
private _recoveryState$;
|
|
3633
|
+
private _recoveryEvent$;
|
|
3634
|
+
private _bandwidthConstrained$;
|
|
3635
|
+
private _mediaParamsUpdated$;
|
|
3636
|
+
private _customSubscriptions;
|
|
3637
|
+
private _pushToTalkEnabled;
|
|
3638
|
+
private _remoteAudioMeter;
|
|
3639
|
+
constructor(clientSession: ClientSession, options: CallOptions, initialization: CallInitialization, address?: Address | undefined);
|
|
3640
|
+
/** Observable stream of errors from media, signaling, and peer connection layers. */
|
|
3641
|
+
get errors$(): Observable<CallError>;
|
|
3522
3642
|
/**
|
|
3523
|
-
*
|
|
3643
|
+
* @internal Push an error to the call's error stream.
|
|
3644
|
+
* Fatal errors automatically transition the call to `'failed'` and destroy it.
|
|
3645
|
+
*/
|
|
3646
|
+
emitError(callError: CallError): void;
|
|
3647
|
+
/** Notify the recovery manager that a verto.modify signaling exchange failed. */
|
|
3648
|
+
notifyModifyFailed(): void;
|
|
3649
|
+
/** Whether this call is `'inbound'` or `'outbound'`. */
|
|
3650
|
+
get direction(): CallDirection;
|
|
3651
|
+
/** Observable of the address associated with this call. */
|
|
3652
|
+
get address$(): Observable<Address | undefined>;
|
|
3653
|
+
/** Display name of the caller. */
|
|
3654
|
+
get fromName(): string | undefined;
|
|
3655
|
+
/** Address URI of the caller. */
|
|
3656
|
+
get from(): string | undefined;
|
|
3657
|
+
/** Display name of the callee. */
|
|
3658
|
+
get toName(): string | undefined;
|
|
3659
|
+
/** Toggles whether incoming video is received. @throws {UnimplementedError} Not yet implemented. */
|
|
3660
|
+
toggleIncomingVideo(): Promise<void>;
|
|
3661
|
+
/** Toggles whether incoming audio is received. @throws {UnimplementedError} Not yet implemented. */
|
|
3662
|
+
toggleIncomingAudio(): Promise<void>;
|
|
3663
|
+
/** @internal Registers an additional call ID for event routing. */
|
|
3664
|
+
addCallId(callId: string): void;
|
|
3665
|
+
/** List of capabilities available in the current call. */
|
|
3666
|
+
get capabilities(): Capability[];
|
|
3667
|
+
/** Current snapshot of all participants in the call. */
|
|
3668
|
+
get participants(): CallParticipant[];
|
|
3669
|
+
/** The local participant, or `null` if not yet joined. */
|
|
3670
|
+
get self(): CallSelfParticipant | null;
|
|
3671
|
+
/** Toggles the call lock state, preventing or allowing new participants from joining. */
|
|
3672
|
+
toggleLock(): Promise<void>;
|
|
3673
|
+
/**
|
|
3674
|
+
* Toggles the hold state of the call (pauses/resumes local media transmission).
|
|
3524
3675
|
*
|
|
3525
|
-
*
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3676
|
+
* Distinct from {@link Participant.toggleMute} which mutes individual tracks.
|
|
3677
|
+
*/
|
|
3678
|
+
toggleHold(): Promise<void>;
|
|
3679
|
+
/** @throws {UnimplementedError} Not yet implemented. Status tracked via {@link recording$}. */
|
|
3680
|
+
startRecording(): Promise<void>;
|
|
3681
|
+
/** @throws {UnimplementedError} Not yet implemented. Status tracked via {@link streaming$}. */
|
|
3682
|
+
startStreaming(): Promise<void>;
|
|
3683
|
+
/**
|
|
3684
|
+
* Replaces the call's custom metadata.
|
|
3685
|
+
* @param _meta - Metadata object to set.
|
|
3686
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
3687
|
+
*/
|
|
3688
|
+
setMeta(_meta: Record<string, unknown>): Promise<void>;
|
|
3689
|
+
/**
|
|
3690
|
+
* Merges values into the call's custom metadata (unlike {@link setMeta} which replaces).
|
|
3691
|
+
* @param _meta - Metadata to merge.
|
|
3692
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
3693
|
+
*/
|
|
3694
|
+
updateMeta(_meta: Record<string, unknown>): Promise<void>;
|
|
3695
|
+
/** Observable of layout layer positions for all participants. */
|
|
3696
|
+
get layoutLayers$(): Observable<LayoutLayer[]>;
|
|
3697
|
+
/** Current snapshot of layout layers. */
|
|
3698
|
+
get layoutLayers(): LayoutLayer[];
|
|
3699
|
+
/**
|
|
3700
|
+
* Executes a Verto RPC method targeting a specific participant.
|
|
3529
3701
|
*
|
|
3530
|
-
*
|
|
3531
|
-
* lost on reload.
|
|
3702
|
+
* Constructs call context (node_id, call_id, member_id) and sends the RPC request.
|
|
3532
3703
|
*
|
|
3533
|
-
*
|
|
3534
|
-
*
|
|
3535
|
-
*
|
|
3536
|
-
*
|
|
3537
|
-
*
|
|
3538
|
-
*
|
|
3704
|
+
* @param target - Target {@link MemberTarget} triple, or the local member's
|
|
3705
|
+
* ID string for self-operations (any other string is rejected — a bare
|
|
3706
|
+
* member id cannot carry the remote member's own call context).
|
|
3707
|
+
* @param method - Verto method name (e.g. `'call.mute'`, `'call.member.remove'`).
|
|
3708
|
+
* @param args - Parameters for the RPC method.
|
|
3709
|
+
* @returns The RPC response.
|
|
3710
|
+
* @throws {CallNotReadyError} If the call has no self member context yet.
|
|
3711
|
+
* @throws {InvalidParams} If a string target is not the local member's ID.
|
|
3712
|
+
* @throws {JSONRPCError} If the RPC call returns an error.
|
|
3539
3713
|
*/
|
|
3540
|
-
|
|
3541
|
-
/** Custom storage implementation for persistence. */
|
|
3542
|
-
storageImplementation?: Storage;
|
|
3543
|
-
/** Custom WebSocket constructor */
|
|
3544
|
-
webSocketConstructor?: WebSocketAdapter | NodeSocketAdapter;
|
|
3545
|
-
/** Custom WebRTC API provider */
|
|
3546
|
-
webRTCApiProvider?: WebRTCApiProvider;
|
|
3714
|
+
executeMethod<T extends JSONRPCResponse = JSONRPCResponse>(target: string | MemberTarget, method: string, args: Record<string, unknown>): Promise<T>;
|
|
3547
3715
|
/**
|
|
3548
|
-
*
|
|
3549
|
-
* Pass `null` to restore the built-in logger.
|
|
3716
|
+
* `executeMethod` for a call opened with `callControl: 'in-dialog'`.
|
|
3550
3717
|
*
|
|
3551
|
-
*
|
|
3718
|
+
* Translates the routed transport's calling convention into the in-dialog one. No
|
|
3719
|
+
* `self` tuple is sent, but a `target` is — the same {call_id, member_id} the routed
|
|
3720
|
+
* transport puts in `target` (minus node_id), for self-ops and cross-member ops alike.
|
|
3721
|
+
*
|
|
3722
|
+
* Target shapes are per-verb and irregular, so they are centralised here rather
|
|
3723
|
+
* than left to callers: most verbs take a singular `target`, `call.member.remove`
|
|
3724
|
+
* takes a plural `targets` array, and `call.member.position.set` takes a flat
|
|
3725
|
+
* `targets` of `{call_id, position}` — the one verb keyed on call_id rather than
|
|
3726
|
+
* member_id, so the member triple `Participant.setPosition` built is unwrapped.
|
|
3552
3727
|
*/
|
|
3553
|
-
|
|
3728
|
+
private executeMethodInDialog;
|
|
3554
3729
|
/**
|
|
3555
|
-
*
|
|
3556
|
-
*
|
|
3557
|
-
* Has no effect when a custom `logger` is provided.
|
|
3730
|
+
* Sends a `call.*` control verb **in-dialog** via `verto.info`, as an alternative
|
|
3731
|
+
* to the routed {@link executeMethod} transport.
|
|
3558
3732
|
*
|
|
3559
|
-
*
|
|
3733
|
+
* Why both exist: `executeMethod` addresses the member with an explicit
|
|
3734
|
+
* `{node_id, call_id, member_id}` tuple, which does not resolve for every conference,
|
|
3735
|
+
* so the op can fail. An in-dialog frame carries the verb on the member's own
|
|
3736
|
+
* signaling channel instead, so control works without the client needing to know how
|
|
3737
|
+
* the conference is hosted.
|
|
3738
|
+
*
|
|
3739
|
+
* The trade-off is reach: the in-dialog transport is only accepted for calls that
|
|
3740
|
+
* join a conference over SWML (e.g. an SWML `join_conference`); use the routed
|
|
3741
|
+
* default otherwise.
|
|
3742
|
+
*
|
|
3743
|
+
* `params` are sent verbatim — nothing is built for you, which includes the target.
|
|
3744
|
+
* **A self-directed op still needs one**, or it is refused; name yourself explicitly:
|
|
3745
|
+
*
|
|
3746
|
+
* ```ts
|
|
3747
|
+
* const { call_id, member_id } = call.self.target;
|
|
3748
|
+
* await call.sendCommand('call.mute', { channels: ['audio'], target: { call_id, member_id } });
|
|
3749
|
+
* ```
|
|
3750
|
+
*
|
|
3751
|
+
* Never include `node_id` — only the two ids. The shapes are per-verb: most take a
|
|
3752
|
+
* singular `target`, `call.member.remove` takes a plural `targets` array, and
|
|
3753
|
+
* `call.member.position.set` takes a flat `targets: [{call_id, position}]` (the one
|
|
3754
|
+
* verb keyed on `call_id` rather than `member_id`). Verbs that act on the call as a
|
|
3755
|
+
* whole, or that the SDK does not wrap at all, take no target.
|
|
3756
|
+
*
|
|
3757
|
+
* For the typed alternative that handles all of this, create the client with
|
|
3758
|
+
* `callControl: 'in-dialog'` and use the ordinary `Call`/`Participant` methods.
|
|
3759
|
+
*
|
|
3760
|
+
* @internal Not part of the supported surface while the in-dialog transport is still
|
|
3761
|
+
* rolling out. `WebRTCCall` is exported from the package entry, so without this tag
|
|
3762
|
+
* TypeDoc publishes the method — and the example above — as public API.
|
|
3763
|
+
*
|
|
3764
|
+
* @param method - A `call.*` method name (e.g. `'call.mute'`).
|
|
3765
|
+
* @param params - Method parameters, sent verbatim.
|
|
3766
|
+
* @returns The method's own reply, unwrapped from the `verto.info` envelope.
|
|
3767
|
+
* @throws {JSONRPCError} If the control op fails.
|
|
3560
3768
|
*/
|
|
3561
|
-
|
|
3562
|
-
/** Debug options for verbose SDK diagnostics (e.g., `{ logWsTraffic: true }`). */
|
|
3563
|
-
debug?: DebugOptions;
|
|
3564
|
-
}
|
|
3565
|
-
/** Options for {@link SignalWire.dial}. Extends {@link MediaOptions} with dial-specific settings. */
|
|
3566
|
-
interface DialOptions extends MediaOptions {
|
|
3567
|
-
/** Preferred video codecs for this call (overrides global preferences). */
|
|
3568
|
-
preferredVideoCodecs?: string[];
|
|
3569
|
-
/** Preferred audio codecs for this call (overrides global preferences). */
|
|
3570
|
-
preferredAudioCodecs?: string[];
|
|
3571
|
-
/** Enable stereo Opus for this call (overrides global preferences). */
|
|
3572
|
-
stereo?: boolean;
|
|
3573
|
-
/** Optional node ID for routing the call */
|
|
3574
|
-
nodeId?: string;
|
|
3769
|
+
sendCommand<T extends JSONRPCResponse = JSONRPCResponse>(method: string, params?: Record<string, unknown>): Promise<T>;
|
|
3575
3770
|
/**
|
|
3576
|
-
*
|
|
3577
|
-
* `
|
|
3578
|
-
*
|
|
3771
|
+
* The local leg's member triple — sent as `self` in every member RPC
|
|
3772
|
+
* envelope, and as the `target` of call-scoped self-operations (e.g. lock,
|
|
3773
|
+
* layout).
|
|
3774
|
+
*
|
|
3775
|
+
* @throws {CallNotReadyError} Before `call.joined` delivers the self member
|
|
3776
|
+
* context (`selfId`/`nodeId`) — an RPC without it cannot be routed, so fail
|
|
3777
|
+
* fast instead of sending a doomed request.
|
|
3579
3778
|
*/
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
*/
|
|
3594
|
-
|
|
3595
|
-
/**
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3779
|
+
private get callSelf();
|
|
3780
|
+
/** Observable of the current call status (e.g. `'ringing'`, `'connected'`). */
|
|
3781
|
+
get status$(): Observable<CallStatus>;
|
|
3782
|
+
/** Observable of the participants list, emits on join/leave/update. */
|
|
3783
|
+
get participants$(): Observable<CallParticipant[]>;
|
|
3784
|
+
/** Observable of the local (self) participant. */
|
|
3785
|
+
get self$(): Observable<CallSelfParticipant>;
|
|
3786
|
+
/** Observable indicating whether the call is being recorded. */
|
|
3787
|
+
get recording$(): Observable<boolean>;
|
|
3788
|
+
/** Observable indicating whether the call is being streamed. */
|
|
3789
|
+
get streaming$(): Observable<boolean>;
|
|
3790
|
+
/** Observable indicating whether raise-hand priority is active. */
|
|
3791
|
+
get raiseHandPriority$(): Observable<boolean>;
|
|
3792
|
+
/** Observable indicating whether the call room is locked. */
|
|
3793
|
+
get locked$(): Observable<boolean>;
|
|
3794
|
+
/** Observable of custom metadata associated with the call. */
|
|
3795
|
+
get meta$(): Observable<Record<string, unknown>>;
|
|
3796
|
+
/** Observable of the call's capability flags. */
|
|
3797
|
+
get capabilities$(): Observable<Capability[]>;
|
|
3798
|
+
/** Observable of the current layout name. */
|
|
3799
|
+
get layout$(): Observable<string>;
|
|
3800
|
+
/** Current call status. */
|
|
3801
|
+
get status(): CallStatus;
|
|
3802
|
+
/** Whether the call is currently being recorded. */
|
|
3803
|
+
get recording(): boolean;
|
|
3804
|
+
/** Whether the call is currently being streamed. */
|
|
3805
|
+
get streaming(): boolean;
|
|
3806
|
+
/** Whether raise-hand priority is active. */
|
|
3807
|
+
get raiseHandPriority(): boolean;
|
|
3808
|
+
/** Whether the call room is locked. */
|
|
3809
|
+
get locked(): boolean;
|
|
3810
|
+
/** Current custom metadata of the call. */
|
|
3811
|
+
get meta(): Record<string, unknown>;
|
|
3812
|
+
/** Current layout name, or `undefined` if not set. */
|
|
3813
|
+
get layout(): string | undefined;
|
|
3814
|
+
/** Observable of available layout names. */
|
|
3815
|
+
get layouts$(): Observable<string[]>;
|
|
3816
|
+
/** Current snapshot of available layout names. */
|
|
3817
|
+
get layouts(): string[];
|
|
3818
|
+
/** Observable of the local media stream (camera/microphone). */
|
|
3819
|
+
get localStream$(): Observable<MediaStream>;
|
|
3820
|
+
/** Current local media stream, or `null` if not available. */
|
|
3821
|
+
get localStream(): MediaStream | null;
|
|
3822
|
+
/** Observable of the remote media stream from the far end. */
|
|
3823
|
+
get remoteStream$(): Observable<MediaStream>;
|
|
3824
|
+
/** Current remote media stream, or `null` if not available. */
|
|
3825
|
+
get remoteStream(): MediaStream | null;
|
|
3826
|
+
/** Observable of custom user variables associated with the call. */
|
|
3827
|
+
get userVariables$(): Observable<Record<string, unknown>>;
|
|
3828
|
+
/** a copy of the current custom user variables of the call. */
|
|
3829
|
+
get userVariables(): Record<string, unknown>;
|
|
3830
|
+
/** Merge current custom user variables of the call. */
|
|
3831
|
+
set userVariables(variables: Record<string, unknown>);
|
|
3832
|
+
/** Observable of current network health issues (empty array = healthy). */
|
|
3833
|
+
get networkIssues$(): Observable<NetworkIssue[]>;
|
|
3834
|
+
/** Current snapshot of network issues. */
|
|
3835
|
+
get networkIssues(): NetworkIssue[];
|
|
3836
|
+
/** Simple boolean health indicator derived from stats monitor. */
|
|
3837
|
+
get isNetworkHealthy$(): Observable<boolean>;
|
|
3838
|
+
/** Whether the network is currently healthy. */
|
|
3839
|
+
get isNetworkHealthy(): boolean;
|
|
3840
|
+
/** Rolling history of raw network metrics (RTT, jitter, packet loss, bitrate). */
|
|
3841
|
+
get networkMetrics$(): Observable<NetworkMetrics[]>;
|
|
3842
|
+
/** Current snapshot of the metrics rolling window. */
|
|
3843
|
+
get networkMetrics(): NetworkMetrics[];
|
|
3844
|
+
/** Observable of MOS quality score (1-5) computed from stats metrics. */
|
|
3845
|
+
get qualityScore$(): Observable<number>;
|
|
3846
|
+
/** Observable of simplified quality level (excellent/good/fair/poor/critical). */
|
|
3847
|
+
get qualityLevel$(): Observable<QualityLevel$1>;
|
|
3848
|
+
/** Observable of the recovery pipeline state machine. */
|
|
3849
|
+
get recoveryState$(): Observable<RecoveryState$1>;
|
|
3850
|
+
/** Observable of recovery events (keyframe requested, ICE restart, etc.). */
|
|
3851
|
+
get recoveryEvent$(): Observable<RecoveryEvent$1>;
|
|
3852
|
+
/** Observable indicating whether the call is bandwidth-constrained. */
|
|
3853
|
+
get bandwidthConstrained$(): Observable<boolean>;
|
|
3854
|
+
/** Observable that emits when the server pushes media params. */
|
|
3855
|
+
get mediaParamsUpdated$(): Observable<MediaParamsEvent>;
|
|
3617
3856
|
/**
|
|
3618
|
-
*
|
|
3619
|
-
*
|
|
3620
|
-
* @param credentialProvider - Provider that supplies authentication credentials.
|
|
3621
|
-
* @param options - Configuration options (connection, device monitoring, preferences).
|
|
3857
|
+
* @internal Emit a media params update event.
|
|
3858
|
+
* Called by the VertoManager when the server pushes media params.
|
|
3622
3859
|
*/
|
|
3623
|
-
|
|
3860
|
+
emitMediaParamsUpdated(event: MediaParamsEvent): void;
|
|
3861
|
+
/** Request a video keyframe via RTCP PLI/FIR. */
|
|
3862
|
+
requestKeyframe(): void;
|
|
3863
|
+
/** Force an ICE restart / re-INVITE. */
|
|
3864
|
+
requestIceRestart(): Promise<void>;
|
|
3624
3865
|
/**
|
|
3625
|
-
*
|
|
3866
|
+
* @internal Initialize resilience subsystems when the call reaches 'connected'.
|
|
3867
|
+
* Called from within the status subscription to wire stats and recovery.
|
|
3868
|
+
*/
|
|
3869
|
+
private initResilienceSubsystems;
|
|
3870
|
+
/**
|
|
3871
|
+
* Wait for the underlying RTCPeerConnection to reach 'connected' after
|
|
3872
|
+
* triggering an ICE restart. Resolves true on success, false on failure
|
|
3873
|
+
* or if the state doesn't transition within the configured timeout.
|
|
3874
|
+
*
|
|
3875
|
+
* Polls connectionState directly because the recovery manager already
|
|
3876
|
+
* wraps this call in its own withTimeout(); a separate listener-based
|
|
3877
|
+
* implementation would race the outer timeout in subtle ways.
|
|
3626
3878
|
*/
|
|
3627
|
-
private
|
|
3879
|
+
private waitForPeerConnectionConnected;
|
|
3628
3880
|
/**
|
|
3629
|
-
*
|
|
3630
|
-
*
|
|
3631
|
-
* 1. If persistSession → check localStorage for cached credential
|
|
3632
|
-
* 2. If cached and not expired → use it (skip provider.authenticate())
|
|
3633
|
-
* 3. If no cache or expired → call provider.authenticate()
|
|
3634
|
-
* 4. If no provider AND no cache → throw
|
|
3881
|
+
* @internal Stop and destroy resilience subsystems (on disconnect/destroy).
|
|
3882
|
+
* Clears references so they can be re-created on reconnect.
|
|
3635
3883
|
*/
|
|
3636
|
-
private
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3884
|
+
private stopResilienceSubsystems;
|
|
3885
|
+
/** @internal */
|
|
3886
|
+
createParticipant(memberId: string, selfId?: string | null): Participant | SelfParticipant;
|
|
3887
|
+
/** Observable of the current audio/video send/receive directions. */
|
|
3888
|
+
get mediaDirections$(): Observable<MediaDirections>;
|
|
3889
|
+
/** Current audio/video send/receive directions. */
|
|
3890
|
+
get mediaDirections(): MediaDirections;
|
|
3891
|
+
protected get participantsId$(): Observable<string[]>;
|
|
3642
3892
|
/**
|
|
3643
|
-
*
|
|
3644
|
-
*
|
|
3645
|
-
* ## Reconnection behavior
|
|
3646
|
-
*
|
|
3647
|
-
* After a successful connection the underlying {@link WebSocketController}
|
|
3648
|
-
* automatically attempts to reconnect whenever the socket closes
|
|
3649
|
-
* unexpectedly (e.g. network change, server restart). Reconnection uses an
|
|
3650
|
-
* **exponential back-off** strategy:
|
|
3893
|
+
* Executes a raw JSON-RPC request on the client session.
|
|
3651
3894
|
*
|
|
3652
|
-
* -
|
|
3653
|
-
* - Each subsequent retry doubles the delay up to `reconnectDelayMax`
|
|
3654
|
-
* (default **3 s**).
|
|
3655
|
-
* - The delay resets to `reconnectDelayMin` once a connection succeeds.
|
|
3656
|
-
* - A per-attempt `connectionTimeout` (default **10 s**) aborts the
|
|
3657
|
-
* attempt and schedules the next retry if the server does not respond.
|
|
3895
|
+
* Lower-level than {@link executeMethod} — allows full control over the RPC request structure.
|
|
3658
3896
|
*
|
|
3659
|
-
*
|
|
3897
|
+
* @param request - Complete JSON-RPC request object.
|
|
3898
|
+
* @param options - Optional RPC execution options (timeout, etc.).
|
|
3899
|
+
* @returns The RPC response.
|
|
3900
|
+
* @throws {JSONRPCError} If the RPC call returns an error response.
|
|
3901
|
+
*/
|
|
3902
|
+
execute<T extends JSONRPCResponse = JSONRPCResponse>(request: JSONRPCRequest, options?: PendingRPCOptions): Promise<T>;
|
|
3903
|
+
/** Observable of the local participant's member ID. */
|
|
3904
|
+
get selfId$(): Observable<string | null>;
|
|
3905
|
+
/** @internal Lets call creation bound the media and signalling phases apart. */
|
|
3906
|
+
get localMediaSettled$(): Observable<void>;
|
|
3907
|
+
/** Local participant's member ID, or `null` if not joined. */
|
|
3908
|
+
get selfId(): string | null;
|
|
3909
|
+
/** Observable of the server node ID handling this call. */
|
|
3910
|
+
get nodeId$(): Observable<string | null>;
|
|
3911
|
+
/** Server node ID handling this call, or `null`. */
|
|
3912
|
+
get nodeId(): string | null;
|
|
3913
|
+
private isCallSessionEvent;
|
|
3914
|
+
private get callSessionEvents$();
|
|
3915
|
+
/** Observable of call-updated events. */
|
|
3916
|
+
get callUpdated$(): Observable<CallUpdatedPayload>;
|
|
3917
|
+
/** Observable of member-joined events, emitted when a remote participant joins the call. */
|
|
3918
|
+
get memberJoined$(): Observable<MemberJoinedPayload>;
|
|
3919
|
+
/** Observable of member-left events, emitted when a participant leaves the call. */
|
|
3920
|
+
get memberLeft$(): Observable<MemberLeftPayload>;
|
|
3921
|
+
/** Observable of member-updated events (mute, volume, etc.). */
|
|
3922
|
+
get memberUpdated$(): Observable<MemberUpdatedPayload>;
|
|
3923
|
+
/** Observable of member-talking events (speech start/stop). */
|
|
3924
|
+
get memberTalking$(): Observable<MemberTalkingPayload>;
|
|
3925
|
+
/** Observable of call state-change events. */
|
|
3926
|
+
get callStates$(): Observable<CallStatePayload>;
|
|
3927
|
+
/** Observable of layout-changed events. */
|
|
3928
|
+
get layoutUpdates$(): Observable<LayoutChangedPayload>;
|
|
3929
|
+
/** Underlying `RTCPeerConnection`, for advanced use cases. */
|
|
3930
|
+
get rtcPeerConnection(): RTCPeerConnection | undefined;
|
|
3931
|
+
/** Observable of raw signaling events as plain objects. */
|
|
3932
|
+
get signalingEvent$(): Observable<Record<string, unknown>>;
|
|
3933
|
+
/**
|
|
3934
|
+
* Subscribe to a custom signaling event type on this call.
|
|
3660
3935
|
*
|
|
3661
|
-
*
|
|
3936
|
+
* Returns a cached observable that filters `callSessionEvents$` for events
|
|
3937
|
+
* whose `event_type` matches the given string. The observable completes
|
|
3938
|
+
* when the call is destroyed.
|
|
3662
3939
|
*
|
|
3663
|
-
*
|
|
3664
|
-
*
|
|
3665
|
-
* re-established the queue is flushed in order so no outgoing RPC call is
|
|
3666
|
-
* lost.
|
|
3940
|
+
* Unlike `signalingEvent$` (which only emits known call-level event types),
|
|
3941
|
+
* this method also matches custom/user-defined event types.
|
|
3667
3942
|
*
|
|
3668
|
-
*
|
|
3669
|
-
*
|
|
3670
|
-
* re-delivered by the server after the session is re-authenticated.
|
|
3671
|
-
* Active RPC calls that were awaiting a response will time out
|
|
3672
|
-
* (default **5 s**) and reject with an `RPCTimeoutError`; callers should
|
|
3673
|
-
* handle this and retry if appropriate.
|
|
3943
|
+
* The SDK does not validate event type strings --- the server decides
|
|
3944
|
+
* whether a given type is valid.
|
|
3674
3945
|
*
|
|
3675
|
-
*
|
|
3676
|
-
*
|
|
3677
|
-
* `'reconnecting'`, `'disconnecting'`, or `'disconnected'`.
|
|
3678
|
-
*/
|
|
3679
|
-
connect(): Promise<void>;
|
|
3680
|
-
/**
|
|
3681
|
-
* Observable that emits the {@link User} profile once fetched,
|
|
3682
|
-
* or `undefined` before authentication completes.
|
|
3946
|
+
* @param eventType - The event type to subscribe to (e.g. `'my.custom.event'`).
|
|
3947
|
+
* @returns An observable that emits matching signaling events.
|
|
3683
3948
|
*
|
|
3684
3949
|
* @example
|
|
3685
3950
|
* ```ts
|
|
3686
|
-
*
|
|
3687
|
-
*
|
|
3951
|
+
* call.subscribe('my.custom.event').subscribe(event => {
|
|
3952
|
+
* console.log('Custom event:', event);
|
|
3688
3953
|
* });
|
|
3689
3954
|
* ```
|
|
3690
3955
|
*/
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
get
|
|
3956
|
+
subscribe(eventType: string): Observable<Record<string, unknown>>;
|
|
3957
|
+
get webrtcMessages$(): Observable<WebrtcMessagePayload>;
|
|
3958
|
+
get callEvent$(): Observable<WebrtcMessagePayload | CallJoinedPayload | CallLeftPayload | CallUpdatedPayload | CallStatePayload | CallPlayPayload | CallConnectPayload | RoomUpdatedPayload | MemberUpdatedPayload | MemberJoinedPayload | MemberLeftPayload | MemberTalkingPayload | LayoutChangedPayload | ConversationMessagePayload>;
|
|
3959
|
+
get layoutEvent$(): Observable<LayoutChangedPayload>;
|
|
3694
3960
|
/**
|
|
3695
|
-
*
|
|
3696
|
-
*
|
|
3697
|
-
* to
|
|
3961
|
+
* Hangs up the call and releases all resources.
|
|
3962
|
+
*
|
|
3963
|
+
* Sends a Verto `bye` to the server, transitions status to `'disconnecting'`,
|
|
3964
|
+
* then destroys the call. After this, the call instance is no longer usable.
|
|
3698
3965
|
*
|
|
3699
3966
|
* @example
|
|
3700
3967
|
* ```ts
|
|
3701
|
-
*
|
|
3702
|
-
* if (dir) dir.addresses$.subscribe(console.log);
|
|
3703
|
-
* });
|
|
3968
|
+
* await call.hangup();
|
|
3704
3969
|
* ```
|
|
3705
3970
|
*/
|
|
3706
|
-
|
|
3707
|
-
/**
|
|
3708
|
-
* Current directory snapshot, or `undefined` if the client is not yet connected.
|
|
3709
|
-
* Prefer {@link directory$} when you need to react to the directory becoming available.
|
|
3710
|
-
*/
|
|
3711
|
-
get directory(): Directory | undefined;
|
|
3712
|
-
/** Observable that emits when the user registration state changes. */
|
|
3713
|
-
get isRegistered$(): Observable<boolean>;
|
|
3714
|
-
/** Whether the user is currently registered. */
|
|
3715
|
-
get isRegistered(): boolean;
|
|
3716
|
-
/** Whether the client is currently connected. */
|
|
3717
|
-
get isConnected(): boolean;
|
|
3718
|
-
/** Observable that emits when the connection state changes. */
|
|
3719
|
-
get isConnected$(): Observable<boolean>;
|
|
3720
|
-
/** Observable that emits `true` when the client is both connected and authenticated. */
|
|
3721
|
-
get ready$(): Observable<boolean>;
|
|
3722
|
-
/** Observable stream of errors from transport, authentication, and devices. */
|
|
3723
|
-
get errors$(): Observable<Error>;
|
|
3971
|
+
hangup(): Promise<void>;
|
|
3724
3972
|
/**
|
|
3725
|
-
*
|
|
3973
|
+
* Sends DTMF digits on the call.
|
|
3726
3974
|
*
|
|
3727
|
-
*
|
|
3728
|
-
* contracts but do not warrant disconnection — e.g., a fallback from Client Bound SAT
|
|
3729
|
-
* refresh to the developer-provided `refresh()` because the SAT lacks `sat:refresh`
|
|
3730
|
-
* scope. Discriminated by `code`.
|
|
3975
|
+
* @param dtmf - The digit string to send (e.g. `'1234#'`).
|
|
3731
3976
|
*
|
|
3732
|
-
*
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
get platformCapabilities(): PlatformCapabilities;
|
|
3737
|
-
/** Observable that emits when the SDK auto-switches a device. */
|
|
3738
|
-
get deviceRecovered$(): Observable<DeviceRecoveryEvent>;
|
|
3739
|
-
/**
|
|
3740
|
-
* Export a structured diagnostic bundle for support/debugging.
|
|
3741
|
-
* Includes connection events, call summaries, and device changes.
|
|
3742
|
-
*/
|
|
3743
|
-
exportDiagnostics(): SessionDiagnostics;
|
|
3744
|
-
/**
|
|
3745
|
-
* Initialize resilience subsystems. Non-fatal: any failure is logged and
|
|
3746
|
-
* the SDK continues working without the failing subsystem.
|
|
3977
|
+
* @example
|
|
3978
|
+
* ```ts
|
|
3979
|
+
* await call.sendDigits('1234#');
|
|
3980
|
+
* ```
|
|
3747
3981
|
*/
|
|
3748
|
-
|
|
3982
|
+
sendDigits(dtmf: string): Promise<void>;
|
|
3983
|
+
/** Observable of WebRTC-specific signaling messages. */
|
|
3984
|
+
/** Observable of call-level signaling events. */
|
|
3985
|
+
/** Observable of layout-changed signaling events. */
|
|
3749
3986
|
/**
|
|
3750
|
-
*
|
|
3751
|
-
*
|
|
3752
|
-
* Ends the session identified by the protocol and clears its persisted
|
|
3753
|
-
* resume state (`authorization_state` + protocol) and attach records
|
|
3754
|
-
* together — a later {@link connect} with the same credentials starts a
|
|
3755
|
-
* fresh session and cannot reattach to the ended session's calls.
|
|
3756
|
-
* Credentials and device preferences are preserved. To temporarily stop
|
|
3757
|
-
* receiving inbound calls while keeping the session alive, use
|
|
3758
|
-
* `unregister()` instead.
|
|
3987
|
+
* Accepts an inbound call, optionally overriding media options for the answer.
|
|
3759
3988
|
*
|
|
3760
|
-
*
|
|
3761
|
-
* which creates a fresh transport and session.
|
|
3762
|
-
*/
|
|
3763
|
-
disconnect(): Promise<void>;
|
|
3764
|
-
/**
|
|
3765
|
-
* Tear down the current transport / session / attach manager. Safe to call
|
|
3766
|
-
* when nothing has been initialized yet (e.g. first connect()).
|
|
3767
|
-
*/
|
|
3768
|
-
private teardownTransportAndSession;
|
|
3769
|
-
private waitAuthentication;
|
|
3770
|
-
/**
|
|
3771
|
-
* Registers the user as online to receive inbound calls and events.
|
|
3989
|
+
* @param options - Optional media constraints for the answer (audio/video).
|
|
3772
3990
|
*
|
|
3773
|
-
*
|
|
3774
|
-
*
|
|
3991
|
+
* @example
|
|
3992
|
+
* ```ts
|
|
3993
|
+
* // Accept with defaults
|
|
3994
|
+
* call.answer();
|
|
3775
3995
|
*
|
|
3776
|
-
*
|
|
3996
|
+
* // Accept audio-only
|
|
3997
|
+
* call.answer({ audio: true, video: false });
|
|
3998
|
+
* ```
|
|
3999
|
+
* @see {@link reject} to decline the call instead.
|
|
4000
|
+
* @see {@link answered$} to observe the acceptance state.
|
|
3777
4001
|
*/
|
|
3778
|
-
|
|
4002
|
+
answer(options?: MediaOptions): void;
|
|
4003
|
+
/** Media options provided when answering. Used internally by the VertoManager. */
|
|
4004
|
+
get answerMediaOptions(): MediaOptions | undefined;
|
|
3779
4005
|
/**
|
|
3780
|
-
*
|
|
4006
|
+
* Rejects an inbound call, preventing media negotiation.
|
|
3781
4007
|
*
|
|
3782
|
-
*
|
|
4008
|
+
* @see {@link answer} to accept the call instead.
|
|
4009
|
+
* @see {@link answered$} to observe the rejection state.
|
|
3783
4010
|
*/
|
|
3784
|
-
|
|
4011
|
+
reject(): void;
|
|
4012
|
+
/** Observable that emits `true` when answered, `false` when rejected. */
|
|
4013
|
+
get answered$(): Observable<boolean>;
|
|
3785
4014
|
/**
|
|
3786
|
-
*
|
|
3787
|
-
*
|
|
3788
|
-
* Waits for authentication before dialing. Media options are merged from
|
|
3789
|
-
* saved preferences, destination query parameters (e.g. `?channel=video`),
|
|
3790
|
-
* and the provided `options` (highest priority).
|
|
3791
|
-
*
|
|
3792
|
-
* Returns a {@link Call} in `'ringing'` state. Subscribe to {@link Call.status$}
|
|
3793
|
-
* to track progression through `'connected'` → `'disconnected'`.
|
|
3794
|
-
*
|
|
3795
|
-
* @param destination - Address URI string (e.g. `'/public/my-room'`) or {@link Address} instance.
|
|
3796
|
-
* @param options - Media and dial options (audio/video, device constraints). Overrides defaults.
|
|
3797
|
-
* @returns The created {@link Call} instance.
|
|
3798
|
-
* @throws {Error} If authentication is not complete or call creation fails.
|
|
4015
|
+
* Sets the call layout and, optionally, individual participant positions.
|
|
3799
4016
|
*
|
|
3800
|
-
*
|
|
3801
|
-
*
|
|
3802
|
-
*
|
|
3803
|
-
*
|
|
3804
|
-
*
|
|
3805
|
-
* });
|
|
3806
|
-
* call.status$.subscribe(status => console.log('Call:', status));
|
|
3807
|
-
* ```
|
|
3808
|
-
*/
|
|
3809
|
-
dial(destination: string | Address, options?: DialOptions): Promise<Call>;
|
|
3810
|
-
/**
|
|
3811
|
-
* Runs a multi-phase connectivity test against the given destination.
|
|
4017
|
+
* The gateway `call.layout.set` DTO has **no** `positions` member, so when
|
|
4018
|
+
* `positions` is provided this method issues a `call.member.position.set`
|
|
4019
|
+
* request per member (via {@link Participant.setPosition}, which keys each
|
|
4020
|
+
* position by that member's own call context) alongside `call.layout.set`
|
|
4021
|
+
* (issue #19400, Flag #6).
|
|
3812
4022
|
*
|
|
3813
|
-
* The
|
|
3814
|
-
*
|
|
3815
|
-
*
|
|
3816
|
-
*
|
|
3817
|
-
*
|
|
3818
|
-
*
|
|
4023
|
+
* **These operations are NOT atomic.** The layout is applied first, then each
|
|
4024
|
+
* member position sequentially, so members may briefly flash into their
|
|
4025
|
+
* default slots before being moved to the requested positions. Targeted
|
|
4026
|
+
* members are validated upfront, though: when any of them has no
|
|
4027
|
+
* {@link Participant.target | member call context} yet, the whole call
|
|
4028
|
+
* rejects before any request is sent and the layout is left unchanged.
|
|
3819
4029
|
*
|
|
3820
|
-
* @param
|
|
3821
|
-
* @param
|
|
3822
|
-
*
|
|
4030
|
+
* @param layout - Layout name (must be one of {@link layouts}).
|
|
4031
|
+
* @param positions - Optional map of member IDs to {@link VideoPosition} values.
|
|
4032
|
+
* When omitted or empty, only the layout is changed.
|
|
4033
|
+
* @throws {InvalidParams} If the layout is not in the available {@link layouts}.
|
|
4034
|
+
* @throws {ParticipantNotReadyError} If a targeted member's call context has
|
|
4035
|
+
* not been received yet — thrown before any request is sent.
|
|
3823
4036
|
*
|
|
3824
4037
|
* @example
|
|
3825
4038
|
* ```ts
|
|
3826
|
-
*
|
|
3827
|
-
*
|
|
4039
|
+
* await call.setLayout('grid-responsive', {
|
|
4040
|
+
* [participantId]: 'reserved-0',
|
|
4041
|
+
* });
|
|
3828
4042
|
* ```
|
|
3829
4043
|
*/
|
|
3830
|
-
|
|
3831
|
-
/** The underlying client session for advanced RPC operations. */
|
|
3832
|
-
get session(): ClientSessionWrapper;
|
|
3833
|
-
/** Observable list of available audio input (microphone) devices. */
|
|
3834
|
-
get audioInputDevices$(): Observable<MediaDeviceInfo[]>;
|
|
3835
|
-
/** Current snapshot of available audio input devices. */
|
|
3836
|
-
get audioInputDevices(): MediaDeviceInfo[];
|
|
3837
|
-
/** Observable list of available audio output (speaker) devices. */
|
|
3838
|
-
get audioOutputDevices$(): Observable<MediaDeviceInfo[]>;
|
|
3839
|
-
/** Current snapshot of available audio output devices. */
|
|
3840
|
-
get audioOutputDevices(): MediaDeviceInfo[];
|
|
3841
|
-
/** Observable list of available video input (camera) devices. */
|
|
3842
|
-
get videoInputDevices$(): Observable<MediaDeviceInfo[]>;
|
|
3843
|
-
/** Current snapshot of available video input devices. */
|
|
3844
|
-
get videoInputDevices(): MediaDeviceInfo[];
|
|
3845
|
-
/** Observable of the currently selected audio input device. */
|
|
3846
|
-
get selectedAudioInputDevice$(): Observable<MediaDeviceInfo | null>;
|
|
3847
|
-
/** Observable of the currently selected audio output device. */
|
|
3848
|
-
get selectedAudioOutputDevice$(): Observable<MediaDeviceInfo | null>;
|
|
3849
|
-
/** Observable of the currently selected video input device. */
|
|
3850
|
-
get selectedVideoInputDevice$(): Observable<MediaDeviceInfo | null>;
|
|
3851
|
-
/** Currently selected audio input device, or `null` if none. */
|
|
3852
|
-
get selectedAudioInputDevice(): MediaDeviceInfo | null;
|
|
3853
|
-
/** Currently selected audio output device, or `null` if none. */
|
|
3854
|
-
get selectedAudioOutputDevice(): MediaDeviceInfo | null;
|
|
3855
|
-
/** Currently selected video input device, or `null` if none. */
|
|
3856
|
-
get selectedVideoInputDevice(): MediaDeviceInfo | null;
|
|
3857
|
-
/** Media track constraints for the selected audio input device. Returns `false` when disabled. */
|
|
3858
|
-
get selectedAudioInputDeviceConstraints(): MediaTrackConstraints | boolean;
|
|
3859
|
-
/** Media track constraints for the selected video input device. Returns `false` when disabled. */
|
|
3860
|
-
get selectedVideoInputDeviceConstraints(): MediaTrackConstraints | boolean;
|
|
3861
|
-
/** Converts a `MediaDeviceInfo` to track constraints suitable for `getUserMedia`. */
|
|
3862
|
-
deviceInfoToConstraints(deviceInfo: MediaDeviceInfo | null): MediaTrackConstraints;
|
|
3863
|
-
/** Sets the preferred audio input device. */
|
|
3864
|
-
selectAudioInputDevice(device: MediaDeviceInfo | null): void;
|
|
3865
|
-
/** Sets the preferred video input device. */
|
|
3866
|
-
selectVideoInputDevice(device: MediaDeviceInfo | null): void;
|
|
3867
|
-
/** Sets the preferred audio output device. */
|
|
3868
|
-
selectAudioOutputDevice(device: MediaDeviceInfo | null): void;
|
|
4044
|
+
setLayout(layout: string, positions?: Record<string, VideoPosition>): Promise<void>;
|
|
3869
4045
|
/**
|
|
3870
|
-
*
|
|
3871
|
-
* (e.g. the `<audio>` or `<video>` element the consumer attached the
|
|
3872
|
-
* remote stream to). Uses `HTMLMediaElement.setSinkId` under the hood.
|
|
3873
|
-
* Returns a `Promise<boolean>`: `true` if the sink was applied,
|
|
3874
|
-
* `false` if the browser doesn't support `setSinkId` or no device is
|
|
3875
|
-
* selected.
|
|
4046
|
+
* Transfers the call to another destination.
|
|
3876
4047
|
*
|
|
3877
|
-
* @
|
|
3878
|
-
*
|
|
3879
|
-
* audioEl.srcObject = call.remoteStream;
|
|
3880
|
-
* await client.applySelectedAudioOutputDevice(audioEl);
|
|
3881
|
-
* ```
|
|
4048
|
+
* @param options - Transfer configuration including the target destination.
|
|
4049
|
+
* @see {@link status$} to observe the transfer progress.
|
|
3882
4050
|
*/
|
|
3883
|
-
|
|
3884
|
-
/** Starts monitoring for media device changes (connect/disconnect). */
|
|
3885
|
-
enableDeviceMonitoring(): void;
|
|
3886
|
-
/** Stops monitoring for media device changes. */
|
|
3887
|
-
disableDeviceMonitoring(): void;
|
|
4051
|
+
transfer(options: TransferOptions): Promise<void>;
|
|
3888
4052
|
/**
|
|
3889
|
-
*
|
|
3890
|
-
*
|
|
3891
|
-
*
|
|
4053
|
+
* Set the local microphone gain as a percentage applied before transmission.
|
|
4054
|
+
*
|
|
4055
|
+
* - `0` = silent
|
|
4056
|
+
* - `100` = unity (no change, default)
|
|
4057
|
+
* - `200` = 2× digital boost (max; expect clipping / noise amplification)
|
|
4058
|
+
*
|
|
4059
|
+
* Values are clamped to [0, 200]. Engages the local audio pipeline on
|
|
4060
|
+
* first use (one-time cost).
|
|
4061
|
+
*
|
|
4062
|
+
* Note: this is a **digital** multiplier applied in a Web Audio GainNode
|
|
4063
|
+
* between your mic track and the RTCRtpSender — it does not change the
|
|
4064
|
+
* physical mic's hardware sensitivity. Browsers' autoGainControl can
|
|
4065
|
+
* fight the setting; call {@link setAutoGainControl}(false) for
|
|
4066
|
+
* predictable behaviour.
|
|
4067
|
+
*
|
|
4068
|
+
* @param value - Gain percentage (0..200; 100 = unity).
|
|
3892
4069
|
*/
|
|
3893
|
-
|
|
4070
|
+
setLocalMicrophoneGain(value: number): void;
|
|
4071
|
+
/** Observable of the current local microphone gain (0..200, where 100 = unity). */
|
|
4072
|
+
get localMicrophoneGain$(): Observable<number>;
|
|
3894
4073
|
/**
|
|
3895
|
-
*
|
|
3896
|
-
*
|
|
3897
|
-
*
|
|
4074
|
+
* Observable of the RMS audio level of the local microphone, 0..1.
|
|
4075
|
+
* Emits at ~30fps while a mic track is active. Engages the local audio
|
|
4076
|
+
* pipeline on first subscription.
|
|
3898
4077
|
*/
|
|
3899
|
-
|
|
3900
|
-
/** Injects a storage manager into the device controller for persistence. */
|
|
3901
|
-
setStorageManager(storageManager: StorageManager): void;
|
|
3902
|
-
/** Clears all device state and re-enumerates. */
|
|
3903
|
-
clearDeviceState(): Promise<void>;
|
|
3904
|
-
/** Forces a device re-enumeration. */
|
|
3905
|
-
enumerateDevices(): Promise<void>;
|
|
3906
|
-
/** Disables audio input (receive-only mode). No audio track will be acquired. */
|
|
3907
|
-
disableAudioInput(): void;
|
|
3908
|
-
/** Re-enables audio input, restoring the last selection or auto-selecting. */
|
|
3909
|
-
enableAudioInput(): void;
|
|
3910
|
-
/** Disables video input (receive-only mode). No video track will be acquired. */
|
|
3911
|
-
disableVideoInput(): void;
|
|
3912
|
-
/** Re-enables video input, restoring the last selection or auto-selecting. */
|
|
3913
|
-
enableVideoInput(): void;
|
|
3914
|
-
/** Observable that emits `true` when video input is disabled (receive-only). */
|
|
3915
|
-
get videoInputDisabled$(): Observable<boolean>;
|
|
3916
|
-
/** Observable that emits `true` when audio input is disabled (receive-only). */
|
|
3917
|
-
get audioInputDisabled$(): Observable<boolean>;
|
|
3918
|
-
/** Whether video input is currently disabled. */
|
|
3919
|
-
get videoInputDisabled(): boolean;
|
|
3920
|
-
/** Whether audio input is currently disabled. */
|
|
3921
|
-
get audioInputDisabled(): boolean;
|
|
4078
|
+
get localAudioLevel$(): Observable<number>;
|
|
3922
4079
|
/**
|
|
3923
|
-
*
|
|
3924
|
-
*
|
|
3925
|
-
* @param options - Which permissions to request.
|
|
3926
|
-
* @param options.audio - Whether to request audio permission.
|
|
3927
|
-
* @param options.video - Whether to request video permission.
|
|
3928
|
-
* @returns The permission result with selected devices.
|
|
4080
|
+
* Observable that is `true` while the local participant is speaking
|
|
4081
|
+
* (RMS level above the VAD threshold, with hold time to avoid flicker).
|
|
3929
4082
|
*/
|
|
3930
|
-
|
|
3931
|
-
audio?: boolean;
|
|
3932
|
-
video?: boolean;
|
|
3933
|
-
}): Promise<PermissionResult>;
|
|
4083
|
+
get localSpeaking$(): Observable<boolean>;
|
|
3934
4084
|
/**
|
|
3935
|
-
*
|
|
4085
|
+
* Enable push-to-talk: while {@link setPushToTalkActive} has been called
|
|
4086
|
+
* with `false`, the microphone gain is forced to 0; calling
|
|
4087
|
+
* {@link setPushToTalkActive} with `true` restores the configured gain.
|
|
4088
|
+
* Use this instead of mute/unmute for instant talk/silence transitions
|
|
4089
|
+
* because it doesn't rebuild the track.
|
|
3936
4090
|
*
|
|
3937
|
-
* This
|
|
3938
|
-
*
|
|
4091
|
+
* This method installs the pipeline but does not attach any keyboard
|
|
4092
|
+
* listener — consumers bind the key themselves and call
|
|
4093
|
+
* {@link setPushToTalkActive} on keydown/keyup.
|
|
3939
4094
|
*/
|
|
3940
|
-
|
|
4095
|
+
enablePushToTalk(): void;
|
|
4096
|
+
/** Disable push-to-talk; mic gain returns to the configured value. */
|
|
4097
|
+
disablePushToTalk(): void;
|
|
3941
4098
|
/**
|
|
3942
|
-
*
|
|
4099
|
+
* While push-to-talk is enabled, sets the talk state. `true` = transmitting,
|
|
4100
|
+
* `false` = silent. No-op if push-to-talk has not been enabled.
|
|
4101
|
+
*/
|
|
4102
|
+
setPushToTalkActive(active: boolean): void;
|
|
4103
|
+
/**
|
|
4104
|
+
* Toggle echo cancellation on the local mic at runtime. Applied via
|
|
4105
|
+
* `track.applyConstraints`; browsers that don't honour runtime constraints
|
|
4106
|
+
* (notably iOS Safari) fall back to re-acquiring the track with the new
|
|
4107
|
+
* constraint set and plumbing the replacement through the local audio
|
|
4108
|
+
* pipeline if one is active.
|
|
3943
4109
|
*
|
|
3944
|
-
*
|
|
3945
|
-
*
|
|
3946
|
-
*
|
|
3947
|
-
*
|
|
3948
|
-
* inbound calls while keeping the session alive, use `unregister()`.
|
|
4110
|
+
* @returns whether the constraint reached the microphone. `false` is an
|
|
4111
|
+
* outcome rather than an error — a leg sending media the SDK did not capture
|
|
4112
|
+
* is left alone — so a UI that reflects the toggle must read it. Any failure
|
|
4113
|
+
* behind a `false` is also reported on {@link errors$}.
|
|
3949
4114
|
*/
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
/**
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
//#region src/dependencies/StaticCredentialProvider.d.ts
|
|
3974
|
-
/**
|
|
3975
|
-
* Credential provider that returns a fixed set of credentials.
|
|
3976
|
-
*
|
|
3977
|
-
* Use when the token is already available (e.g. from a backend endpoint).
|
|
3978
|
-
*
|
|
3979
|
-
* @example
|
|
3980
|
-
* ```ts
|
|
3981
|
-
* const provider = new StaticCredentialProvider({ token: 'my-sat-token' });
|
|
3982
|
-
* const client = new SignalWire(provider);
|
|
3983
|
-
* ```
|
|
3984
|
-
*/
|
|
3985
|
-
declare class StaticCredentialProvider implements CredentialProvider {
|
|
3986
|
-
private credentials;
|
|
3987
|
-
constructor(credentials: SDKCredential);
|
|
3988
|
-
/** Returns the static credentials. */
|
|
3989
|
-
authenticate(): Promise<SDKCredential>;
|
|
3990
|
-
}
|
|
3991
|
-
//#endregion
|
|
3992
|
-
//#region src/dependencies/EmbedTokenCredentialProvider.d.ts
|
|
3993
|
-
/** Credential provider that exchanges an embed token for a SAT via the host's token endpoint. */
|
|
3994
|
-
declare class EmbedTokenCredentialProvider implements CredentialProvider {
|
|
3995
|
-
private host;
|
|
3996
|
-
private embedToken;
|
|
3997
|
-
constructor(host: string, embedToken: string);
|
|
3998
|
-
private fetchSAT;
|
|
3999
|
-
authenticate(): Promise<{
|
|
4000
|
-
token: string;
|
|
4001
|
-
expiry_at: number;
|
|
4002
|
-
}>;
|
|
4003
|
-
refresh(): Promise<{
|
|
4004
|
-
token: string;
|
|
4005
|
-
expiry_at: number;
|
|
4006
|
-
}>;
|
|
4007
|
-
}
|
|
4008
|
-
//#endregion
|
|
4009
|
-
//#region src/controllers/LocalAudioPipeline.d.ts
|
|
4010
|
-
/**
|
|
4011
|
-
* Options for {@link LocalAudioPipeline}.
|
|
4012
|
-
*/
|
|
4013
|
-
interface LocalAudioPipelineOptions {
|
|
4014
|
-
/** Factory for AudioContext — override for tests. Defaults to `new AudioContext()`. */
|
|
4015
|
-
audioContextFactory?: () => AudioContext;
|
|
4016
|
-
/** Initial gain (0..2, where 1 is unity). Defaults to 1. */
|
|
4017
|
-
initialGain?: number;
|
|
4018
|
-
/** RMS level [0..1] above which speaking$ emits true. Defaults to {@link VAD_THRESHOLD}. */
|
|
4019
|
-
speakingThreshold?: number;
|
|
4115
|
+
setEchoCancellation(enabled: boolean): Promise<boolean>;
|
|
4116
|
+
/**
|
|
4117
|
+
* Toggle browser noise suppression on the local mic at runtime.
|
|
4118
|
+
* @returns whether the constraint reached the microphone.
|
|
4119
|
+
*/
|
|
4120
|
+
setNoiseSuppression(enabled: boolean): Promise<boolean>;
|
|
4121
|
+
/**
|
|
4122
|
+
* Toggle browser automatic gain control on the local mic at runtime.
|
|
4123
|
+
* @returns whether the constraint reached the microphone.
|
|
4124
|
+
*/
|
|
4125
|
+
setAutoGainControl(enabled: boolean): Promise<boolean>;
|
|
4126
|
+
/**
|
|
4127
|
+
* Observable of the aggregate remote audio level, 0..1 RMS. The server
|
|
4128
|
+
* delivers a single mixed audio stream for all remote participants — this
|
|
4129
|
+
* meter reports that mix. Per-participant audio is not available client-side.
|
|
4130
|
+
*
|
|
4131
|
+
* Engages a shared AudioContext on first subscription (cheap — one
|
|
4132
|
+
* AnalyserNode, no GainNode, no destination) so it does not affect the
|
|
4133
|
+
* caller's audio element playback.
|
|
4134
|
+
*/
|
|
4135
|
+
get remoteAudioLevel$(): Observable<number>;
|
|
4136
|
+
/** Destroys the call, releasing all resources and subscriptions. */
|
|
4137
|
+
destroy(): void;
|
|
4020
4138
|
/**
|
|
4021
|
-
*
|
|
4022
|
-
*
|
|
4139
|
+
* @internal Send a verto.subscribe message to add an event type to the
|
|
4140
|
+
* server's subscription list for this call. Returns the underlying RPC
|
|
4141
|
+
* promise so callers can decide whether to cache the observable on success
|
|
4142
|
+
* or retry on failure.
|
|
4023
4143
|
*/
|
|
4024
|
-
|
|
4025
|
-
/** Polling interval for level$. Defaults to {@link AUDIO_LEVEL_POLL_INTERVAL_MS}. */
|
|
4026
|
-
pollIntervalMs?: number;
|
|
4144
|
+
private _sendVertoSubscribe;
|
|
4027
4145
|
}
|
|
4146
|
+
//#endregion
|
|
4147
|
+
//#region src/core/entities/Directory.d.ts
|
|
4028
4148
|
/**
|
|
4029
|
-
*
|
|
4030
|
-
*
|
|
4031
|
-
* Wraps the raw mic `MediaStreamTrack` in a graph of:
|
|
4032
|
-
*
|
|
4033
|
-
* ```
|
|
4034
|
-
* MediaStreamAudioSourceNode → GainNode → AnalyserNode → MediaStreamAudioDestinationNode
|
|
4035
|
-
* ```
|
|
4149
|
+
* Directory interface for managing addresses
|
|
4036
4150
|
*
|
|
4037
|
-
*
|
|
4038
|
-
*
|
|
4039
|
-
* destination track is reused across input changes (device switch, mute /
|
|
4040
|
-
* unmute track replacement) so the sender reference stays stable — only the
|
|
4041
|
-
* source end of the graph is rebuilt.
|
|
4151
|
+
* This is the public API contract for address directory functionality.
|
|
4152
|
+
* It provides access to addresses, loading capabilities, and search functionality.
|
|
4042
4153
|
*
|
|
4043
|
-
*
|
|
4044
|
-
* {@link destroy} to release it when the call ends.
|
|
4154
|
+
* @public
|
|
4045
4155
|
*/
|
|
4046
|
-
|
|
4047
|
-
private readonly _audioContext;
|
|
4048
|
-
private readonly _gainNode;
|
|
4049
|
-
private readonly _analyser;
|
|
4050
|
-
private readonly _destination;
|
|
4051
|
-
private readonly _analyserBuffer;
|
|
4052
|
-
private readonly _speakingThreshold;
|
|
4053
|
-
private readonly _speakingHoldMs;
|
|
4054
|
-
private readonly _pollIntervalMs;
|
|
4055
|
-
private _inputSource;
|
|
4056
|
-
private _inputStream;
|
|
4057
|
-
private _lastSpokeAt;
|
|
4058
|
-
private _gain$;
|
|
4059
|
-
/** 1 when audio should pass through, 0 when silenced by PTT. */
|
|
4060
|
-
private _pttMultiplier;
|
|
4061
|
-
constructor(options?: LocalAudioPipelineOptions);
|
|
4062
|
-
/** Observable of the current gain value (0..2). */
|
|
4063
|
-
get gain$(): Observable<number>;
|
|
4064
|
-
/** Current gain value (0..2). */
|
|
4065
|
-
get gain(): number;
|
|
4156
|
+
interface Directory extends AddressProvider<Address> {
|
|
4066
4157
|
/**
|
|
4067
|
-
*
|
|
4068
|
-
*
|
|
4069
|
-
* needs to be called once.
|
|
4158
|
+
* Observable stream of all addresses in the directory
|
|
4159
|
+
* Emits a new array whenever addresses are added, removed, or updated
|
|
4070
4160
|
*/
|
|
4071
|
-
|
|
4161
|
+
readonly addresses$: Observable<Address[]>;
|
|
4072
4162
|
/**
|
|
4073
|
-
*
|
|
4074
|
-
* interval (~30fps by default).
|
|
4163
|
+
* Current snapshot of all addresses in the directory
|
|
4075
4164
|
*/
|
|
4076
|
-
|
|
4165
|
+
readonly addresses: Address[];
|
|
4077
4166
|
/**
|
|
4078
|
-
*
|
|
4079
|
-
* during the hold window after the last frame that crossed the threshold.
|
|
4167
|
+
* Observable indicating whether more addresses can be loaded from the server
|
|
4080
4168
|
*/
|
|
4081
|
-
|
|
4169
|
+
readonly hasMore$: Observable<boolean>;
|
|
4082
4170
|
/**
|
|
4083
|
-
*
|
|
4084
|
-
*
|
|
4085
|
-
* the graph also respects the current PTT state.
|
|
4171
|
+
* Observable indicating the current loading state
|
|
4172
|
+
* Emits `true` when loading, `false` when idle
|
|
4086
4173
|
*/
|
|
4087
|
-
|
|
4174
|
+
readonly loading$: Observable<boolean>;
|
|
4175
|
+
readonly loading: boolean;
|
|
4088
4176
|
/**
|
|
4089
|
-
*
|
|
4090
|
-
*
|
|
4091
|
-
* Orthogonal to {@link setGain} — once PTT returns to active, the last
|
|
4092
|
-
* configured gain reappears.
|
|
4177
|
+
* Load more addresses from the server
|
|
4178
|
+
* Only loads if `hasMore` is true
|
|
4093
4179
|
*/
|
|
4094
|
-
|
|
4095
|
-
private applyEffectiveGain;
|
|
4180
|
+
loadMore(): void;
|
|
4096
4181
|
/**
|
|
4097
|
-
*
|
|
4098
|
-
* input source and reconnects the graph so {@link outputTrack} continues
|
|
4099
|
-
* to emit the processed audio. Pass `null` to disconnect the input (the
|
|
4100
|
-
* output track stays alive but emits silence).
|
|
4182
|
+
* Get a specific address by ID
|
|
4101
4183
|
*
|
|
4102
|
-
*
|
|
4103
|
-
*
|
|
4104
|
-
* track emits silence) until resume() succeeds.
|
|
4105
|
-
*/
|
|
4106
|
-
setInputTrack(track: MediaStreamTrack | null): void;
|
|
4107
|
-
destroy(): void;
|
|
4108
|
-
private computeLevel;
|
|
4109
|
-
private evaluateSpeaking;
|
|
4110
|
-
}
|
|
4111
|
-
//#endregion
|
|
4112
|
-
//#region src/controllers/RTCPeerConnectionController.d.ts
|
|
4113
|
-
interface RTCPeerConnectionControllerOptions extends MediaOptions {
|
|
4114
|
-
callId?: string;
|
|
4115
|
-
rtcConfiguration?: RTCConfiguration;
|
|
4116
|
-
simulcast?: boolean;
|
|
4117
|
-
sfu?: boolean;
|
|
4118
|
-
msStreamsNumber?: number;
|
|
4119
|
-
propose: RTCPeerConnectionPropose;
|
|
4120
|
-
iceServers?: RTCIceServer[];
|
|
4121
|
-
disableUdpIceServers?: boolean;
|
|
4122
|
-
relayOnly?: boolean;
|
|
4123
|
-
iceCandidateTimeout?: number;
|
|
4124
|
-
iceGatheringTimeout?: number;
|
|
4125
|
-
webRTCApiProvider?: WebRTCApiProvider;
|
|
4126
|
-
/** Per-call preferred video codecs (overrides global preferences). */
|
|
4127
|
-
preferredVideoCodecs?: string[];
|
|
4128
|
-
/** Per-call preferred audio codecs (overrides global preferences). */
|
|
4129
|
-
preferredAudioCodecs?: string[];
|
|
4130
|
-
/** Per-call stereo Opus setting (overrides global preferences). */
|
|
4131
|
-
stereo?: boolean;
|
|
4132
|
-
}
|
|
4133
|
-
type RTCPeerConnectionControllerOptionsPartial = Partial<RTCPeerConnectionControllerOptions>;
|
|
4134
|
-
interface UpdateSDPStatusParams {
|
|
4135
|
-
status: 'received' | 'sent' | 'failed';
|
|
4136
|
-
sdp?: string;
|
|
4137
|
-
}
|
|
4138
|
-
declare class RTCPeerConnectionController extends Destroyable {
|
|
4139
|
-
protected options: RTCPeerConnectionControllerOptionsPartial;
|
|
4140
|
-
readonly id: string;
|
|
4141
|
-
firstSDPExchangeCompleted: boolean;
|
|
4142
|
-
sdpInit?: RTCSessionDescriptionInit;
|
|
4143
|
-
private negotiationNeeded$;
|
|
4144
|
-
private deviceController;
|
|
4145
|
-
private localStreamController;
|
|
4146
|
-
private transceiverController?;
|
|
4147
|
-
readonly localDescription$: Observable<RTCSessionDescription | null>;
|
|
4148
|
-
peerConnection?: RTCPeerConnection;
|
|
4149
|
-
private initPromise?;
|
|
4150
|
-
private connectionTimeout;
|
|
4151
|
-
private connectionTimer?;
|
|
4152
|
-
private oniceconnectionstatechangeHandler;
|
|
4153
|
-
private onconnectionstatechangeHandler;
|
|
4154
|
-
private onsignalingstatechangeHandler;
|
|
4155
|
-
private onicegatheringstatechangeHandler;
|
|
4156
|
-
private onnegotiationneededHandler;
|
|
4157
|
-
private updateSelectedInputDevice;
|
|
4158
|
-
private _isNegotiating$;
|
|
4159
|
-
private _iceGatheringController?;
|
|
4160
|
-
private _memberId;
|
|
4161
|
-
private _type;
|
|
4162
|
-
private _iceConnectionState$;
|
|
4163
|
-
private _connectionState$;
|
|
4164
|
-
private _signalingState$;
|
|
4165
|
-
private _iceGatheringState$;
|
|
4166
|
-
private _errors$;
|
|
4167
|
-
private _iceCandidates$;
|
|
4168
|
-
private _initialized$;
|
|
4169
|
-
private _remoteDescription$;
|
|
4170
|
-
private _remoteStream$;
|
|
4171
|
-
private _remoteOfferMediaDirections;
|
|
4172
|
-
private _localAudioPipeline;
|
|
4173
|
-
constructor(options?: RTCPeerConnectionControllerOptionsPartial, remoteSessionDescription?: string, deviceController?: DeviceController);
|
|
4174
|
-
private get iceGatheringController();
|
|
4175
|
-
private get shouldEmitLocalDescription();
|
|
4176
|
-
private removeConnectionTimer;
|
|
4177
|
-
setMemberId(memberId: string | null): void;
|
|
4178
|
-
get memberId(): string | null;
|
|
4179
|
-
stopTrackSender(kind: 'audio' | 'video' | 'both', options?: {
|
|
4180
|
-
updateTransceiverDirection: boolean;
|
|
4181
|
-
}): void;
|
|
4182
|
-
private stopRawAudioInputForPipeline;
|
|
4183
|
-
get isNegotiating$(): Observable<boolean>;
|
|
4184
|
-
get isNegotiating(): boolean;
|
|
4185
|
-
updateMediaDevicesOptions(options: MediaOptions): void;
|
|
4186
|
-
get iceGatheringState$(): Observable<RTCIceGatheringState>;
|
|
4187
|
-
get mediaTrackEnded$(): Observable<MediaStreamTrack>;
|
|
4188
|
-
get errors$(): Observable<Error>;
|
|
4189
|
-
get iceCandidates$(): Observable<RTCIceCandidate[]>;
|
|
4190
|
-
get initialized$(): Observable<boolean>;
|
|
4191
|
-
get remoteDescription$(): Observable<RTCSessionDescription | null>;
|
|
4192
|
-
get localStream$(): Observable<MediaStream | null>;
|
|
4193
|
-
get remoteStream$(): Observable<MediaStream | null>;
|
|
4194
|
-
get localAudioTracks$(): Observable<MediaStreamTrack[]>;
|
|
4195
|
-
get localVideoTracks$(): Observable<MediaStreamTrack[]>;
|
|
4196
|
-
get iceConnectionState$(): Observable<RTCIceConnectionState>;
|
|
4197
|
-
get connectionState$(): Observable<RTCPeerConnectionState>;
|
|
4198
|
-
get signalingState$(): Observable<RTCSignalingState>;
|
|
4199
|
-
get type(): RTCPeerConnectionType;
|
|
4200
|
-
get propose(): RTCPeerConnectionPropose;
|
|
4201
|
-
get isAdditionalDevice(): boolean;
|
|
4202
|
-
get isMainDevice(): boolean;
|
|
4203
|
-
get isScreenShare(): boolean;
|
|
4204
|
-
protected get iceServers(): RTCIceServer[];
|
|
4205
|
-
private get rtcConfiguration();
|
|
4206
|
-
get receiveVideo(): boolean;
|
|
4207
|
-
get receiveAudio(): boolean;
|
|
4208
|
-
get localStream(): MediaStream | null;
|
|
4209
|
-
get remoteStream(): MediaStream | null;
|
|
4210
|
-
private get inputAudioDeviceConstraints();
|
|
4211
|
-
private get inputVideoDeviceConstraints();
|
|
4212
|
-
private get WebRTCPeerConnectionConstructor();
|
|
4213
|
-
private get offerOptions();
|
|
4214
|
-
private get answerOptions();
|
|
4215
|
-
/**
|
|
4216
|
-
* Initialize the RTCPeerConnection and setup event listeners.
|
|
4217
|
-
* Called automatically when localDescription$ is subscribed to (deferred pattern).
|
|
4218
|
-
* Uses Promise memoization to ensure initialization only happens once,
|
|
4219
|
-
* even if called concurrently.
|
|
4184
|
+
* @param addressId - The address ID to retrieve
|
|
4185
|
+
* @returns The address instance, or undefined if not found
|
|
4220
4186
|
*/
|
|
4221
|
-
|
|
4187
|
+
get(addressId: string): Address | undefined;
|
|
4222
4188
|
/**
|
|
4223
|
-
*
|
|
4224
|
-
*
|
|
4189
|
+
* Find an address ID by searching for a name
|
|
4190
|
+
*
|
|
4191
|
+
* @param uri - The address name to search for
|
|
4192
|
+
* @returns Promise resolving to the address ID, or undefined if not found
|
|
4225
4193
|
*/
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4194
|
+
findAddressIdByURI(uri: string): Promise<string | undefined>;
|
|
4195
|
+
}
|
|
4196
|
+
//#endregion
|
|
4197
|
+
//#region src/interfaces/SessionState.d.ts
|
|
4198
|
+
/**
|
|
4199
|
+
* Extended session interface that adds call management and authentication
|
|
4200
|
+
* state on top of the narrow ClientSession contract.
|
|
4201
|
+
*
|
|
4202
|
+
* Accessible via `client.session`. Call and CallFactory continue to depend
|
|
4203
|
+
* only on the narrow ClientSession interface.
|
|
4204
|
+
*/
|
|
4205
|
+
interface SessionState extends ClientSession {
|
|
4229
4206
|
/**
|
|
4230
|
-
*
|
|
4207
|
+
* Observable stream of currently active inbound calls.
|
|
4208
|
+
* Filters `calls$` to only include calls with `direction === 'inbound'`.
|
|
4231
4209
|
*/
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
sdp
|
|
4236
|
-
}: UpdateSDPStatusParams): Promise<void>;
|
|
4237
|
-
updateOfferStatus({
|
|
4238
|
-
status,
|
|
4239
|
-
sdp
|
|
4240
|
-
}: UpdateSDPStatusParams): Promise<void>;
|
|
4241
|
-
/**
|
|
4242
|
-
* Accept an inbound call by creating the SDP answer.
|
|
4243
|
-
* Optionally override media options before the answer is generated.
|
|
4244
|
-
* Must be called after initialization for inbound (answer-type) connections.
|
|
4210
|
+
readonly incomingCalls$: Observable<Call[]>;
|
|
4211
|
+
/**
|
|
4212
|
+
* Current snapshot of active inbound calls.
|
|
4245
4213
|
*/
|
|
4246
|
-
|
|
4247
|
-
private handleOfferReceived;
|
|
4248
|
-
private readyToConnect;
|
|
4249
|
-
private setRemoteDescriptionBefore;
|
|
4250
|
-
protected setLocalDescription(params: RTCSessionDescriptionInit): Promise<void>;
|
|
4251
|
-
setLocalDescriptionBefore(sdp?: string): Promise<string>;
|
|
4214
|
+
readonly incomingCalls: Call[];
|
|
4252
4215
|
/**
|
|
4253
|
-
*
|
|
4216
|
+
* Observable stream of all currently active calls (both inbound and outbound).
|
|
4254
4217
|
*/
|
|
4255
|
-
|
|
4218
|
+
readonly calls$: Observable<Call[]>;
|
|
4256
4219
|
/**
|
|
4257
|
-
*
|
|
4220
|
+
* Current snapshot of all active calls.
|
|
4258
4221
|
*/
|
|
4259
|
-
|
|
4260
|
-
private negotiationEnded;
|
|
4222
|
+
readonly calls: Call[];
|
|
4261
4223
|
/**
|
|
4262
|
-
*
|
|
4263
|
-
*
|
|
4264
|
-
* This creates an offer with iceRestart: true and goes through the full
|
|
4265
|
-
* SDP pipeline (setLocalDescription → ICE gathering → localDescription$ emission).
|
|
4266
|
-
* The caller should NOT send the SDP manually — the existing
|
|
4267
|
-
* setupLocalDescriptionHandler in VertoManager will pick up the emission
|
|
4268
|
-
* from localDescription$ and send it as a verto.modify.
|
|
4269
|
-
*
|
|
4270
|
-
* Unlike calling pc.createOffer/setLocalDescription directly, this method:
|
|
4271
|
-
* - Sets _isNegotiating$ so ICEGatheringController arms its timers
|
|
4272
|
-
* - Waits for ICE gathering to complete before localDescription$ emits
|
|
4273
|
-
* - Goes through setLocalDescriptionBefore() for any SDP munging
|
|
4224
|
+
* Observable that emits `true` once the session has been authenticated,
|
|
4225
|
+
* and `false` after disconnect.
|
|
4274
4226
|
*/
|
|
4275
|
-
|
|
4276
|
-
private restoreIceTransportPolicy;
|
|
4227
|
+
readonly authenticated$: Observable<boolean>;
|
|
4277
4228
|
/**
|
|
4278
|
-
*
|
|
4229
|
+
* Current authentication state.
|
|
4230
|
+
* Returns `true` if the session is currently authenticated.
|
|
4279
4231
|
*/
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4232
|
+
readonly authenticated: boolean;
|
|
4233
|
+
}
|
|
4234
|
+
//#endregion
|
|
4235
|
+
//#region src/managers/ClientSessionManager.d.ts
|
|
4236
|
+
/**
|
|
4237
|
+
* Discriminated union for session authentication state.
|
|
4238
|
+
* clientBound is tracked separately via _wasClientBound (sticky flag)
|
|
4239
|
+
* to avoid dual sources of truth.
|
|
4240
|
+
*/
|
|
4241
|
+
type SessionAuthState = {
|
|
4242
|
+
kind: 'unauthenticated';
|
|
4243
|
+
} | {
|
|
4244
|
+
kind: 'authenticated';
|
|
4245
|
+
};
|
|
4246
|
+
declare class ClientSessionManager extends Destroyable implements SessionState {
|
|
4247
|
+
private readonly getCredential;
|
|
4248
|
+
private readonly transport;
|
|
4249
|
+
private readonly storage;
|
|
4250
|
+
private readonly authorizationStateKey;
|
|
4251
|
+
private readonly attachManager;
|
|
4252
|
+
private readonly dpopManager?;
|
|
4253
|
+
private callFactory;
|
|
4254
|
+
private readonly agent;
|
|
4255
|
+
private readonly eventAcks;
|
|
4256
|
+
initialized$: Observable<boolean>;
|
|
4257
|
+
private authorizationState$;
|
|
4258
|
+
private connectVersion;
|
|
4286
4259
|
/**
|
|
4287
|
-
*
|
|
4288
|
-
*
|
|
4289
|
-
*
|
|
4290
|
-
* non-fatal error — VertoManager surfaces it and the call is unaffected.
|
|
4291
|
-
* - The main connection degrades to receive-only when allowed (default),
|
|
4292
|
-
* otherwise fails with a fatal error.
|
|
4260
|
+
* Optional hook called before a fresh connect on reconnect.
|
|
4261
|
+
* Used by SignalWire to refresh expired credentials before re-authenticating.
|
|
4262
|
+
* @internal
|
|
4293
4263
|
*/
|
|
4294
|
-
|
|
4264
|
+
onBeforeReconnect?: () => Promise<void>;
|
|
4295
4265
|
/**
|
|
4296
|
-
*
|
|
4297
|
-
*
|
|
4298
|
-
*
|
|
4266
|
+
* Session-wide call control transport (see {@link ClientSession.callControl}).
|
|
4267
|
+
* Set from {@link SignalWireOptions.callControl} by SignalWire after construction;
|
|
4268
|
+
* defaults to `'routed'`. Read by every Call, so it needs no per-call persistence.
|
|
4299
4269
|
*/
|
|
4300
|
-
|
|
4301
|
-
private
|
|
4302
|
-
private
|
|
4303
|
-
private
|
|
4304
|
-
|
|
4305
|
-
|
|
4270
|
+
callControl: 'routed' | 'in-dialog';
|
|
4271
|
+
private _authorization$;
|
|
4272
|
+
private _errors$;
|
|
4273
|
+
private _directory?;
|
|
4274
|
+
private _authState$;
|
|
4275
|
+
/** Sticky flag — once true, stays true for the session lifetime. */
|
|
4276
|
+
private _wasClientBound;
|
|
4277
|
+
private _userInfo$;
|
|
4278
|
+
private _calls$;
|
|
4279
|
+
private _iceServers$;
|
|
4280
|
+
constructor(getCredential: () => SDKCredential, transport: TransportManager, storage: StorageManager, authorizationStateKey: string, deviceController: DeviceController, attachManager: AttachManager, webRTCApiProvider: WebRTCApiProvider, dpopManager?: CryptoController | undefined, networkChange$?: Observable<NetworkChangeEvent>);
|
|
4281
|
+
get incomingCalls$(): Observable<Call[]>;
|
|
4282
|
+
get incomingCalls(): Call[];
|
|
4283
|
+
get userInfo$(): Observable<Address | null>;
|
|
4284
|
+
get userInfo(): Address | null;
|
|
4285
|
+
get calls$(): Observable<Call[]>;
|
|
4286
|
+
get calls(): Call[];
|
|
4287
|
+
get iceServers(): RTCIceServer[] | undefined;
|
|
4288
|
+
get authorization$(): Observable<Authorization | undefined>;
|
|
4289
|
+
get authorization(): Authorization | undefined;
|
|
4290
|
+
get errors$(): Observable<Error>;
|
|
4291
|
+
get authenticated$(): Observable<boolean>;
|
|
4292
|
+
get authenticated(): boolean;
|
|
4306
4293
|
/**
|
|
4307
|
-
*
|
|
4308
|
-
*
|
|
4309
|
-
*
|
|
4310
|
-
*
|
|
4311
|
-
* audio sender exists yet (pre-negotiation).
|
|
4294
|
+
* Whether this session is client-bound (using a Client Bound SAT).
|
|
4295
|
+
* When client-bound, DPoP proof creation failures are treated as
|
|
4296
|
+
* authentication errors rather than silently degraded.
|
|
4297
|
+
* @internal
|
|
4312
4298
|
*/
|
|
4313
|
-
|
|
4314
|
-
/**
|
|
4315
|
-
get
|
|
4316
|
-
private applyLocalAudioPipelineToSender;
|
|
4299
|
+
get clientBound(): boolean;
|
|
4300
|
+
/** @internal Current auth state for debugging/testing. */
|
|
4301
|
+
get authState(): SessionAuthState;
|
|
4317
4302
|
/**
|
|
4318
|
-
*
|
|
4319
|
-
*
|
|
4303
|
+
* Set the directory instance
|
|
4304
|
+
* Called by SignalWire after directory is created
|
|
4305
|
+
* @internal
|
|
4320
4306
|
*/
|
|
4321
|
-
|
|
4307
|
+
setDirectory(directory: Directory): void;
|
|
4308
|
+
execute<T extends JSONRPCResponse = JSONRPCResponse>(request: JSONRPCRequest, options?: PendingRPCOptions): Promise<T>;
|
|
4309
|
+
send(message: JSONSerializable): void;
|
|
4310
|
+
private init;
|
|
4311
|
+
private setupMessageHandlers;
|
|
4312
|
+
private loadAuthorizationStateFromStorage;
|
|
4313
|
+
private updateAuthorizationStateInStorage;
|
|
4314
|
+
private get authStateEvent$();
|
|
4315
|
+
get signalingEvent$(): Observable<(Omit<{
|
|
4316
|
+
event_type: "webrtc.message";
|
|
4317
|
+
event_channel: EventChannel;
|
|
4318
|
+
timestamp: number;
|
|
4319
|
+
project_id?: string;
|
|
4320
|
+
node_id?: string;
|
|
4321
|
+
is_author?: boolean;
|
|
4322
|
+
params: WebrtcMessagePayload;
|
|
4323
|
+
}, "event_channel" | "project_id" | "node_id"> & {
|
|
4324
|
+
event_channel: string;
|
|
4325
|
+
project_id: string;
|
|
4326
|
+
node_id: string;
|
|
4327
|
+
}) | {
|
|
4328
|
+
event_type: "signalwire.authorization.state";
|
|
4329
|
+
params: SignalwireAuthorizationStatePayload;
|
|
4330
|
+
} | (Omit<{
|
|
4331
|
+
event_type: "call.joined";
|
|
4332
|
+
event_channel: EventChannel;
|
|
4333
|
+
timestamp: number;
|
|
4334
|
+
project_id?: string;
|
|
4335
|
+
node_id?: string;
|
|
4336
|
+
is_author?: boolean;
|
|
4337
|
+
params: CallJoinedPayload;
|
|
4338
|
+
}, "event_channel"> & {
|
|
4339
|
+
event_channel: string;
|
|
4340
|
+
}) | (Omit<{
|
|
4341
|
+
event_type: "call.left";
|
|
4342
|
+
event_channel: EventChannel;
|
|
4343
|
+
timestamp: number;
|
|
4344
|
+
project_id?: string;
|
|
4345
|
+
node_id?: string;
|
|
4346
|
+
is_author?: boolean;
|
|
4347
|
+
params: CallLeftPayload;
|
|
4348
|
+
}, "event_channel"> & {
|
|
4349
|
+
event_channel: string;
|
|
4350
|
+
}) | (Omit<{
|
|
4351
|
+
event_type: "call.updated";
|
|
4352
|
+
event_channel: EventChannel;
|
|
4353
|
+
timestamp: number;
|
|
4354
|
+
project_id?: string;
|
|
4355
|
+
node_id?: string;
|
|
4356
|
+
is_author?: boolean;
|
|
4357
|
+
params: CallUpdatedPayload;
|
|
4358
|
+
}, "event_channel"> & {
|
|
4359
|
+
event_channel: string;
|
|
4360
|
+
}) | (Omit<{
|
|
4361
|
+
event_type: "call.state";
|
|
4362
|
+
event_channel: EventChannel;
|
|
4363
|
+
timestamp: number;
|
|
4364
|
+
project_id?: string;
|
|
4365
|
+
node_id?: string;
|
|
4366
|
+
is_author?: boolean;
|
|
4367
|
+
params: CallStatePayload;
|
|
4368
|
+
}, "event_channel"> & {
|
|
4369
|
+
event_channel: string;
|
|
4370
|
+
}) | (Omit<{
|
|
4371
|
+
event_type: "call.play";
|
|
4372
|
+
event_channel: EventChannel;
|
|
4373
|
+
timestamp: number;
|
|
4374
|
+
project_id?: string;
|
|
4375
|
+
node_id?: string;
|
|
4376
|
+
is_author?: boolean;
|
|
4377
|
+
params: CallPlayPayload;
|
|
4378
|
+
}, "event_channel"> & {
|
|
4379
|
+
event_channel: string;
|
|
4380
|
+
}) | (Omit<{
|
|
4381
|
+
event_type: "call.connect";
|
|
4382
|
+
event_channel: EventChannel;
|
|
4383
|
+
timestamp: number;
|
|
4384
|
+
project_id?: string;
|
|
4385
|
+
node_id?: string;
|
|
4386
|
+
is_author?: boolean;
|
|
4387
|
+
params: CallConnectPayload;
|
|
4388
|
+
}, "event_channel"> & {
|
|
4389
|
+
event_channel: string;
|
|
4390
|
+
}) | (Omit<{
|
|
4391
|
+
event_type: "room.updated";
|
|
4392
|
+
event_channel: EventChannel;
|
|
4393
|
+
timestamp: number;
|
|
4394
|
+
project_id?: string;
|
|
4395
|
+
node_id?: string;
|
|
4396
|
+
is_author?: boolean;
|
|
4397
|
+
params: RoomUpdatedPayload;
|
|
4398
|
+
}, "event_channel"> & {
|
|
4399
|
+
event_channel: string;
|
|
4400
|
+
}) | Omit<{
|
|
4401
|
+
event_type: "member.updated";
|
|
4402
|
+
event_channel: EventChannel;
|
|
4403
|
+
timestamp: number;
|
|
4404
|
+
project_id?: string;
|
|
4405
|
+
node_id?: string;
|
|
4406
|
+
is_author?: boolean;
|
|
4407
|
+
params: MemberUpdatedPayload;
|
|
4408
|
+
}, never> | Omit<{
|
|
4409
|
+
event_type: "member.joined";
|
|
4410
|
+
event_channel: EventChannel;
|
|
4411
|
+
timestamp: number;
|
|
4412
|
+
project_id?: string;
|
|
4413
|
+
node_id?: string;
|
|
4414
|
+
is_author?: boolean;
|
|
4415
|
+
params: MemberJoinedPayload;
|
|
4416
|
+
}, never> | Omit<{
|
|
4417
|
+
event_type: "member.left";
|
|
4418
|
+
event_channel: EventChannel;
|
|
4419
|
+
timestamp: number;
|
|
4420
|
+
project_id?: string;
|
|
4421
|
+
node_id?: string;
|
|
4422
|
+
is_author?: boolean;
|
|
4423
|
+
params: MemberLeftPayload;
|
|
4424
|
+
}, never> | Omit<{
|
|
4425
|
+
event_type: "member.talking";
|
|
4426
|
+
event_channel: EventChannel;
|
|
4427
|
+
timestamp: number;
|
|
4428
|
+
project_id?: string;
|
|
4429
|
+
node_id?: string;
|
|
4430
|
+
is_author?: boolean;
|
|
4431
|
+
params: MemberTalkingPayload;
|
|
4432
|
+
}, never> | Omit<{
|
|
4433
|
+
event_type: "layout.changed";
|
|
4434
|
+
event_channel: EventChannel;
|
|
4435
|
+
timestamp: number;
|
|
4436
|
+
project_id?: string;
|
|
4437
|
+
node_id?: string;
|
|
4438
|
+
is_author?: boolean;
|
|
4439
|
+
params: LayoutChangedPayload;
|
|
4440
|
+
}, never> | (Omit<{
|
|
4441
|
+
event_type: "conversation.message";
|
|
4442
|
+
event_channel: EventChannel;
|
|
4443
|
+
timestamp: number;
|
|
4444
|
+
project_id?: string;
|
|
4445
|
+
node_id?: string;
|
|
4446
|
+
is_author?: boolean;
|
|
4447
|
+
params: ConversationMessagePayload;
|
|
4448
|
+
}, "event_channel" | "timestamp" | "is_author"> & {
|
|
4449
|
+
event_channel: string;
|
|
4450
|
+
timestamp: string;
|
|
4451
|
+
is_author: boolean;
|
|
4452
|
+
}) | (Omit<{
|
|
4453
|
+
event_type: "conversation.message.updated";
|
|
4454
|
+
event_channel: EventChannel;
|
|
4455
|
+
timestamp: number;
|
|
4456
|
+
project_id?: string;
|
|
4457
|
+
node_id?: string;
|
|
4458
|
+
is_author?: boolean;
|
|
4459
|
+
params: ConversationMessagePayload;
|
|
4460
|
+
}, "event_channel" | "timestamp" | "is_author"> & {
|
|
4461
|
+
event_channel: string;
|
|
4462
|
+
timestamp: string;
|
|
4463
|
+
is_author: boolean;
|
|
4464
|
+
})>;
|
|
4465
|
+
private get vertoInvite$();
|
|
4466
|
+
private get vertoAttach$();
|
|
4467
|
+
private get contexts();
|
|
4468
|
+
private get eventing();
|
|
4469
|
+
private get topics();
|
|
4470
|
+
private get authentication();
|
|
4471
|
+
connect(): Promise<void>;
|
|
4472
|
+
private handleAuthenticationError;
|
|
4322
4473
|
/**
|
|
4323
|
-
*
|
|
4324
|
-
*
|
|
4474
|
+
* Clear the resume state (authorization_state + protocol) and ask the
|
|
4475
|
+
* transport to reconnect. The `connected` event re-triggers
|
|
4476
|
+
* `authenticate()`, which now has no stored state and so performs a fresh
|
|
4477
|
+
* connect.
|
|
4478
|
+
*
|
|
4479
|
+
* This is the stale-auth-state recovery helper used by handleAuthError:
|
|
4480
|
+
* the server rejected a reconnect, so the resume state is discarded and a
|
|
4481
|
+
* fresh connect follows. Attach records are deliberately preserved — the
|
|
4482
|
+
* session lives on through the reconnect and reattachCalls() needs the
|
|
4483
|
+
* stored call references afterwards. Do NOT add detachAll() here.
|
|
4484
|
+
*
|
|
4485
|
+
* Connect-time recovery only. A *request* refused on an already
|
|
4486
|
+
* authenticated session is never healed here: dropping the resume state
|
|
4487
|
+
* destroys the association between the socket and the previous session,
|
|
4488
|
+
* which is what reattach depends on. That path mints a fresh credential and
|
|
4489
|
+
* reauthenticates instead (see `SignalWire.recoverAndRetry`).
|
|
4490
|
+
*
|
|
4491
|
+
* For public teardown (disconnect/destroy), use {@link teardownSessionState}
|
|
4492
|
+
* instead, which clears the attach records as well.
|
|
4325
4493
|
*/
|
|
4326
|
-
|
|
4494
|
+
private discardResumeStateAndReconnect;
|
|
4495
|
+
cleanupStoredConnectionParams(): Promise<void>;
|
|
4327
4496
|
/**
|
|
4328
|
-
*
|
|
4329
|
-
*
|
|
4330
|
-
*
|
|
4497
|
+
* Public-teardown helper for disconnect()/destroy(). Clears the resume
|
|
4498
|
+
* state (authorization_state + protocol) AND the attach records as one
|
|
4499
|
+
* atomic unit.
|
|
4500
|
+
*
|
|
4501
|
+
* The two stores are coupled: the backend only honors attach records
|
|
4502
|
+
* within the session identified by the resume state, so ending the
|
|
4503
|
+
* session must clear both. Clearing one without the other strands records
|
|
4504
|
+
* no future session can honor (disconnect) or revives a session the
|
|
4505
|
+
* developer explicitly ended (destroy).
|
|
4506
|
+
*
|
|
4507
|
+
* Distinct from {@link cleanupStoredConnectionParams}, which keeps the
|
|
4508
|
+
* attach records for the stale-auth-state recovery path.
|
|
4331
4509
|
*/
|
|
4332
|
-
|
|
4333
|
-
|
|
4510
|
+
teardownSessionState(): Promise<void>;
|
|
4511
|
+
protected updateAuthState(authorization_state: string): Promise<void>;
|
|
4512
|
+
reauthenticate(token: string, dpopToken?: string, options?: {
|
|
4513
|
+
clientBound?: boolean;
|
|
4514
|
+
}): Promise<void>;
|
|
4515
|
+
private authenticate;
|
|
4516
|
+
disconnect(): Promise<void>;
|
|
4517
|
+
private createInboundCall;
|
|
4334
4518
|
/**
|
|
4335
|
-
*
|
|
4336
|
-
*
|
|
4337
|
-
*
|
|
4338
|
-
*
|
|
4519
|
+
* Handle a server-pushed verto.attach event at the session level.
|
|
4520
|
+
*
|
|
4521
|
+
* On page reload the server detects the reconnected session and pushes
|
|
4522
|
+
* verto.attach for any active calls. If a call object already exists
|
|
4523
|
+
* (network blip, no reload), the per-call handler in VertoManager deals
|
|
4524
|
+
* with it. This method only creates a new call object when no existing
|
|
4525
|
+
* one matches the callID.
|
|
4339
4526
|
*/
|
|
4340
|
-
|
|
4527
|
+
private handleVertoAttach;
|
|
4528
|
+
createOutboundCall(destination: string | Address, options?: CallOptions): Promise<Call>;
|
|
4529
|
+
private createCall;
|
|
4530
|
+
destroy(): void;
|
|
4531
|
+
}
|
|
4532
|
+
declare class ClientSessionWrapper implements SessionState {
|
|
4533
|
+
private clientSessionManager;
|
|
4534
|
+
constructor(clientSessionManager: ClientSessionManager);
|
|
4535
|
+
get authenticated$(): Observable<boolean>;
|
|
4536
|
+
get authenticated(): boolean;
|
|
4341
4537
|
/**
|
|
4342
|
-
*
|
|
4343
|
-
*
|
|
4538
|
+
* Whether the session is using a Client Bound SAT (DPoP). Sticky — set
|
|
4539
|
+
* when the binding is established or restored from a resumed session's
|
|
4540
|
+
* server authorization.
|
|
4344
4541
|
*/
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4542
|
+
get clientBound(): boolean;
|
|
4543
|
+
get signalingEvent$(): Observable<(Omit<{
|
|
4544
|
+
event_type: "webrtc.message";
|
|
4545
|
+
event_channel: EventChannel;
|
|
4546
|
+
timestamp: number;
|
|
4547
|
+
project_id?: string;
|
|
4548
|
+
node_id?: string;
|
|
4549
|
+
is_author?: boolean;
|
|
4550
|
+
params: WebrtcMessagePayload;
|
|
4551
|
+
}, "event_channel" | "project_id" | "node_id"> & {
|
|
4552
|
+
event_channel: string;
|
|
4553
|
+
project_id: string;
|
|
4554
|
+
node_id: string;
|
|
4555
|
+
}) | {
|
|
4556
|
+
event_type: "signalwire.authorization.state";
|
|
4557
|
+
params: SignalwireAuthorizationStatePayload;
|
|
4558
|
+
} | (Omit<{
|
|
4559
|
+
event_type: "call.joined";
|
|
4560
|
+
event_channel: EventChannel;
|
|
4561
|
+
timestamp: number;
|
|
4562
|
+
project_id?: string;
|
|
4563
|
+
node_id?: string;
|
|
4564
|
+
is_author?: boolean;
|
|
4565
|
+
params: CallJoinedPayload;
|
|
4566
|
+
}, "event_channel"> & {
|
|
4567
|
+
event_channel: string;
|
|
4568
|
+
}) | (Omit<{
|
|
4569
|
+
event_type: "call.left";
|
|
4570
|
+
event_channel: EventChannel;
|
|
4571
|
+
timestamp: number;
|
|
4572
|
+
project_id?: string;
|
|
4573
|
+
node_id?: string;
|
|
4574
|
+
is_author?: boolean;
|
|
4575
|
+
params: CallLeftPayload;
|
|
4576
|
+
}, "event_channel"> & {
|
|
4577
|
+
event_channel: string;
|
|
4578
|
+
}) | (Omit<{
|
|
4579
|
+
event_type: "call.updated";
|
|
4580
|
+
event_channel: EventChannel;
|
|
4581
|
+
timestamp: number;
|
|
4582
|
+
project_id?: string;
|
|
4583
|
+
node_id?: string;
|
|
4584
|
+
is_author?: boolean;
|
|
4585
|
+
params: CallUpdatedPayload;
|
|
4586
|
+
}, "event_channel"> & {
|
|
4587
|
+
event_channel: string;
|
|
4588
|
+
}) | (Omit<{
|
|
4589
|
+
event_type: "call.state";
|
|
4590
|
+
event_channel: EventChannel;
|
|
4591
|
+
timestamp: number;
|
|
4592
|
+
project_id?: string;
|
|
4593
|
+
node_id?: string;
|
|
4594
|
+
is_author?: boolean;
|
|
4595
|
+
params: CallStatePayload;
|
|
4596
|
+
}, "event_channel"> & {
|
|
4597
|
+
event_channel: string;
|
|
4598
|
+
}) | (Omit<{
|
|
4599
|
+
event_type: "call.play";
|
|
4600
|
+
event_channel: EventChannel;
|
|
4601
|
+
timestamp: number;
|
|
4602
|
+
project_id?: string;
|
|
4603
|
+
node_id?: string;
|
|
4604
|
+
is_author?: boolean;
|
|
4605
|
+
params: CallPlayPayload;
|
|
4606
|
+
}, "event_channel"> & {
|
|
4607
|
+
event_channel: string;
|
|
4608
|
+
}) | (Omit<{
|
|
4609
|
+
event_type: "call.connect";
|
|
4610
|
+
event_channel: EventChannel;
|
|
4611
|
+
timestamp: number;
|
|
4612
|
+
project_id?: string;
|
|
4613
|
+
node_id?: string;
|
|
4614
|
+
is_author?: boolean;
|
|
4615
|
+
params: CallConnectPayload;
|
|
4616
|
+
}, "event_channel"> & {
|
|
4617
|
+
event_channel: string;
|
|
4618
|
+
}) | (Omit<{
|
|
4619
|
+
event_type: "room.updated";
|
|
4620
|
+
event_channel: EventChannel;
|
|
4621
|
+
timestamp: number;
|
|
4622
|
+
project_id?: string;
|
|
4623
|
+
node_id?: string;
|
|
4624
|
+
is_author?: boolean;
|
|
4625
|
+
params: RoomUpdatedPayload;
|
|
4626
|
+
}, "event_channel"> & {
|
|
4627
|
+
event_channel: string;
|
|
4628
|
+
}) | Omit<{
|
|
4629
|
+
event_type: "member.updated";
|
|
4630
|
+
event_channel: EventChannel;
|
|
4631
|
+
timestamp: number;
|
|
4632
|
+
project_id?: string;
|
|
4633
|
+
node_id?: string;
|
|
4634
|
+
is_author?: boolean;
|
|
4635
|
+
params: MemberUpdatedPayload;
|
|
4636
|
+
}, never> | Omit<{
|
|
4637
|
+
event_type: "member.joined";
|
|
4638
|
+
event_channel: EventChannel;
|
|
4639
|
+
timestamp: number;
|
|
4640
|
+
project_id?: string;
|
|
4641
|
+
node_id?: string;
|
|
4642
|
+
is_author?: boolean;
|
|
4643
|
+
params: MemberJoinedPayload;
|
|
4644
|
+
}, never> | Omit<{
|
|
4645
|
+
event_type: "member.left";
|
|
4646
|
+
event_channel: EventChannel;
|
|
4647
|
+
timestamp: number;
|
|
4648
|
+
project_id?: string;
|
|
4649
|
+
node_id?: string;
|
|
4650
|
+
is_author?: boolean;
|
|
4651
|
+
params: MemberLeftPayload;
|
|
4652
|
+
}, never> | Omit<{
|
|
4653
|
+
event_type: "member.talking";
|
|
4654
|
+
event_channel: EventChannel;
|
|
4655
|
+
timestamp: number;
|
|
4656
|
+
project_id?: string;
|
|
4657
|
+
node_id?: string;
|
|
4658
|
+
is_author?: boolean;
|
|
4659
|
+
params: MemberTalkingPayload;
|
|
4660
|
+
}, never> | Omit<{
|
|
4661
|
+
event_type: "layout.changed";
|
|
4662
|
+
event_channel: EventChannel;
|
|
4663
|
+
timestamp: number;
|
|
4664
|
+
project_id?: string;
|
|
4665
|
+
node_id?: string;
|
|
4666
|
+
is_author?: boolean;
|
|
4667
|
+
params: LayoutChangedPayload;
|
|
4668
|
+
}, never> | (Omit<{
|
|
4669
|
+
event_type: "conversation.message";
|
|
4670
|
+
event_channel: EventChannel;
|
|
4671
|
+
timestamp: number;
|
|
4672
|
+
project_id?: string;
|
|
4673
|
+
node_id?: string;
|
|
4674
|
+
is_author?: boolean;
|
|
4675
|
+
params: ConversationMessagePayload;
|
|
4676
|
+
}, "event_channel" | "timestamp" | "is_author"> & {
|
|
4677
|
+
event_channel: string;
|
|
4678
|
+
timestamp: string;
|
|
4679
|
+
is_author: boolean;
|
|
4680
|
+
}) | (Omit<{
|
|
4681
|
+
event_type: "conversation.message.updated";
|
|
4682
|
+
event_channel: EventChannel;
|
|
4683
|
+
timestamp: number;
|
|
4684
|
+
project_id?: string;
|
|
4685
|
+
node_id?: string;
|
|
4686
|
+
is_author?: boolean;
|
|
4687
|
+
params: ConversationMessagePayload;
|
|
4688
|
+
}, "event_channel" | "timestamp" | "is_author"> & {
|
|
4689
|
+
event_channel: string;
|
|
4690
|
+
timestamp: string;
|
|
4691
|
+
is_author: boolean;
|
|
4692
|
+
})>;
|
|
4693
|
+
get iceServers(): RTCIceServer[] | undefined;
|
|
4694
|
+
get callControl(): 'routed' | 'in-dialog';
|
|
4695
|
+
execute<T extends JSONRPCResponse = JSONRPCResponse>(request: JSONRPCRequest, options?: PendingRPCOptions): Promise<T>;
|
|
4696
|
+
get incomingCalls$(): Observable<Call[]>;
|
|
4697
|
+
get incomingCalls(): Call[];
|
|
4698
|
+
get calls$(): Observable<Call[]>;
|
|
4699
|
+
get calls(): Call[];
|
|
4353
4700
|
}
|
|
4354
4701
|
//#endregion
|
|
4355
|
-
//#region src/
|
|
4702
|
+
//#region src/core/types/warnings.types.d.ts
|
|
4356
4703
|
/**
|
|
4357
|
-
*
|
|
4358
|
-
*
|
|
4704
|
+
* Non-fatal warning emitted via {@link SignalWire.warnings$ | client.warnings$}.
|
|
4705
|
+
*
|
|
4706
|
+
* Use to detect SDK behaviors that affect session liveness or developer-facing
|
|
4707
|
+
* contracts but do not warrant disconnection. Discriminated by `code`.
|
|
4708
|
+
*
|
|
4709
|
+
* Existing consumers of `errors$` are NOT notified — `warnings$` is a separate
|
|
4710
|
+
* channel so application code can react to warnings without triggering
|
|
4711
|
+
* error-handling code paths (e.g., disconnect cascades, user-facing toasts).
|
|
4359
4712
|
*/
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
/** Lazily create (or return) the local audio pipeline for the main peer connection. */
|
|
4388
|
-
ensureLocalAudioPipeline(): LocalAudioPipeline | null;
|
|
4389
|
-
/** Current local audio pipeline, or null if it has not been created yet. */
|
|
4390
|
-
readonly localAudioPipeline: LocalAudioPipeline | null;
|
|
4391
|
-
}
|
|
4392
|
-
//#endregion
|
|
4393
|
-
//#region src/managers/CallEventsManager.d.ts
|
|
4394
|
-
interface WebRTCCallEventManagerOptions {}
|
|
4395
|
-
/** @internal */
|
|
4396
|
-
declare class CallEventsManager extends Destroyable {
|
|
4397
|
-
protected webRtcCallSession: CallManager;
|
|
4398
|
-
protected options: WebRTCCallEventManagerOptions;
|
|
4399
|
-
private selfId?;
|
|
4400
|
-
private originCallId?;
|
|
4401
|
-
private callIds;
|
|
4402
|
-
private roomSessionIds;
|
|
4403
|
-
private _participants$;
|
|
4404
|
-
private _self$;
|
|
4405
|
-
private _sessionState$;
|
|
4406
|
-
constructor(webRtcCallSession: CallManager, options?: WebRTCCallEventManagerOptions);
|
|
4407
|
-
get participants$(): Observable<CallParticipant[]>;
|
|
4408
|
-
get participants(): CallParticipant[];
|
|
4409
|
-
get self$(): Observable<CallSelfParticipant>;
|
|
4410
|
-
isRoomSessionIdValid(roomSessionId: string): boolean;
|
|
4411
|
-
addCallId(callId: string): void;
|
|
4412
|
-
isCallIdValid(callId: string): boolean;
|
|
4413
|
-
get recording$(): Observable<boolean>;
|
|
4414
|
-
get recordings$(): Observable<Record<string, unknown>[]>;
|
|
4415
|
-
get streaming$(): Observable<boolean>;
|
|
4416
|
-
get streams$(): Observable<Record<string, unknown>[]>;
|
|
4417
|
-
get playbacks$(): Observable<Record<string, unknown>[]>;
|
|
4418
|
-
get raiseHandPriority$(): Observable<boolean>;
|
|
4419
|
-
get locked$(): Observable<boolean>;
|
|
4420
|
-
get meta$(): Observable<Record<string, unknown>>;
|
|
4421
|
-
get capabilities$(): Observable<Capability[]>;
|
|
4422
|
-
get layout$(): Observable<string>;
|
|
4423
|
-
get layouts$(): Observable<string[]>;
|
|
4424
|
-
get layoutLayers$(): Observable<LayoutLayer[]>;
|
|
4425
|
-
get self(): CallSelfParticipant | null;
|
|
4426
|
-
get layoutLayers(): LayoutLayer[];
|
|
4427
|
-
get recording(): boolean;
|
|
4428
|
-
get streaming(): boolean;
|
|
4429
|
-
get raiseHandPriority(): boolean;
|
|
4430
|
-
get locked(): boolean;
|
|
4431
|
-
get meta(): Record<string, unknown>;
|
|
4432
|
-
get layout(): string | undefined;
|
|
4433
|
-
get layouts(): string[];
|
|
4434
|
-
get capabilities(): Capability[];
|
|
4435
|
-
isSessionEvent(id: string): boolean;
|
|
4436
|
-
protected initSubscriptions(): void;
|
|
4437
|
-
private updateParticipantPositions;
|
|
4438
|
-
updateLayouts(): void;
|
|
4439
|
-
private updateParticipants;
|
|
4440
|
-
private upsertParticipant;
|
|
4441
|
-
private get callJoinedEvent$();
|
|
4442
|
-
private get layoutChangedEvent$();
|
|
4443
|
-
private get memberUpdates$();
|
|
4444
|
-
destroy(): void;
|
|
4445
|
-
}
|
|
4446
|
-
//#endregion
|
|
4447
|
-
//#region src/managers/CallRecoveryManager.d.ts
|
|
4448
|
-
type RecoveryState$1 = 'idle' | 'debouncing' | 'recovering' | 'cooldown';
|
|
4449
|
-
interface RecoveryEvent$1 {
|
|
4450
|
-
action: 'keyframe_requested' | 'reinvite_started' | 'reinvite_succeeded' | 'reinvite_failed' | 'reinvite_timeout' | 'max_attempts_reached' | 'signal_reconnect' | 'full_reconnect' | 'video_disabled' | 'video_restored';
|
|
4451
|
-
reason: string;
|
|
4452
|
-
attempt?: number;
|
|
4453
|
-
maxAttempts?: number;
|
|
4454
|
-
timestamp: number;
|
|
4713
|
+
type SDKWarning = CredentialRefreshFallbackWarning | CredentialNoRefreshHandlerWarning;
|
|
4714
|
+
/**
|
|
4715
|
+
* Diagnostic detail for {@link CredentialRefreshFallbackWarning}. Stable
|
|
4716
|
+
* values, but treat unknown strings as "fell back for an unspecified cause" —
|
|
4717
|
+
* do not branch on this value for control flow. New values may be added in
|
|
4718
|
+
* future releases.
|
|
4719
|
+
*/
|
|
4720
|
+
type CredentialRefreshFallbackReason = 'no-scope' | 'no-dpop-support' | 'endpoint-failed' | 'activation-timeout' | (string & {});
|
|
4721
|
+
/**
|
|
4722
|
+
* Emitted when the SDK falls back to the developer-provided
|
|
4723
|
+
* {@link CredentialProvider.refresh} because the Client Bound SAT path
|
|
4724
|
+
* could not take over.
|
|
4725
|
+
*
|
|
4726
|
+
* Common causes:
|
|
4727
|
+
* - The minted SAT lacks `sat:refresh` scope (`reason: 'no-scope'`).
|
|
4728
|
+
* - The `/devices/token` exchange failed transiently (`reason: 'endpoint-failed'`).
|
|
4729
|
+
*
|
|
4730
|
+
* Subscribe to this warning to detect:
|
|
4731
|
+
* - SDKs running with plain SATs that rely on developer-managed refresh
|
|
4732
|
+
* - Deployments expected to use bound tokens that silently downgraded to bearer
|
|
4733
|
+
* (a security-relevant signal for fleet observability)
|
|
4734
|
+
*/
|
|
4735
|
+
interface CredentialRefreshFallbackWarning {
|
|
4736
|
+
code: 'credential_refresh_fallback';
|
|
4737
|
+
source: 'CredentialProvider';
|
|
4738
|
+
reason: CredentialRefreshFallbackReason;
|
|
4739
|
+
message: string;
|
|
4455
4740
|
}
|
|
4456
|
-
//#endregion
|
|
4457
|
-
//#region src/utils/qualityScore.d.ts
|
|
4458
4741
|
/**
|
|
4459
|
-
*
|
|
4460
|
-
*
|
|
4742
|
+
* Emitted when a credential has an `expiry_at` but the provider supplies no
|
|
4743
|
+
* `refresh()` handler. The session will terminate at expiry with no fallback.
|
|
4461
4744
|
*
|
|
4462
|
-
*
|
|
4463
|
-
*
|
|
4464
|
-
* jitter and packet-loss values.
|
|
4745
|
+
* Implementors who want long-lived sessions must provide a `refresh()` handler
|
|
4746
|
+
* or mint tokens with the `sat:refresh` scope (Client Bound SAT path).
|
|
4465
4747
|
*/
|
|
4466
|
-
|
|
4748
|
+
interface CredentialNoRefreshHandlerWarning {
|
|
4749
|
+
code: 'credential_no_refresh_handler';
|
|
4750
|
+
source: 'CredentialProvider';
|
|
4751
|
+
message: string;
|
|
4752
|
+
/** Token expiry timestamp (epoch milliseconds). */
|
|
4753
|
+
expiresAt: number;
|
|
4754
|
+
}
|
|
4467
4755
|
//#endregion
|
|
4468
|
-
//#region src/
|
|
4756
|
+
//#region src/utils/logger.d.ts
|
|
4757
|
+
/** Log level names supported by the SDK. */
|
|
4758
|
+
type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
4469
4759
|
/**
|
|
4470
|
-
*
|
|
4760
|
+
* Logger interface that consumers can implement to replace the built-in logger.
|
|
4761
|
+
* All methods accept variadic arguments matching the browser console API.
|
|
4471
4762
|
*/
|
|
4472
|
-
interface
|
|
4473
|
-
|
|
4474
|
-
|
|
4763
|
+
interface SDKLogger {
|
|
4764
|
+
error(...args: unknown[]): void;
|
|
4765
|
+
warn(...args: unknown[]): void;
|
|
4766
|
+
info(...args: unknown[]): void;
|
|
4767
|
+
debug(...args: unknown[]): void;
|
|
4768
|
+
trace(...args: unknown[]): void;
|
|
4769
|
+
}
|
|
4770
|
+
/** Options for WebSocket traffic logging. */
|
|
4771
|
+
interface WsTrafficOptions {
|
|
4772
|
+
type: 'send' | 'recv' | 'http';
|
|
4773
|
+
/** Parsed object or raw string — will be JSON.stringify'd for display if an object. */
|
|
4774
|
+
payload: unknown;
|
|
4475
4775
|
}
|
|
4476
4776
|
/**
|
|
4477
|
-
*
|
|
4478
|
-
*
|
|
4479
|
-
*
|
|
4777
|
+
* Options for WebSocket traffic logging using raw strings.
|
|
4778
|
+
* The string is only parsed when logging is enabled, avoiding
|
|
4779
|
+
* unnecessary JSON.parse on every message.
|
|
4480
4780
|
*/
|
|
4481
|
-
|
|
4781
|
+
interface WsTrafficRawOptions {
|
|
4782
|
+
type: 'send' | 'recv';
|
|
4783
|
+
raw: string;
|
|
4784
|
+
}
|
|
4785
|
+
/** Debug options that control verbose SDK logging. */
|
|
4786
|
+
interface DebugOptions {
|
|
4787
|
+
/** Log all WebSocket send/recv traffic to the console. */
|
|
4788
|
+
logWsTraffic?: boolean;
|
|
4789
|
+
}
|
|
4790
|
+
/** Extended logger with SDK-internal helpers (wsTraffic). */
|
|
4791
|
+
interface InternalSDKLogger extends SDKLogger {
|
|
4792
|
+
wsTraffic: (options: WsTrafficOptions | WsTrafficRawOptions) => void;
|
|
4793
|
+
}
|
|
4794
|
+
/** Replace the built-in logger with a custom implementation. Pass `null` to restore defaults. */
|
|
4795
|
+
declare const setLogger: (logger: SDKLogger | null) => void;
|
|
4796
|
+
/** Configure debug options (e.g., `{ logWsTraffic: true }`). */
|
|
4797
|
+
declare const setDebugOptions: (options: DebugOptions | null) => void;
|
|
4482
4798
|
/**
|
|
4483
|
-
*
|
|
4484
|
-
*
|
|
4799
|
+
* Set the log level for the built-in logger.
|
|
4800
|
+
* Has no effect when a custom logger is set via `setLogger()`.
|
|
4485
4801
|
*/
|
|
4486
|
-
|
|
4802
|
+
declare const setLogLevel: (level: LogLevel) => void;
|
|
4803
|
+
declare const getLogger: () => InternalSDKLogger;
|
|
4804
|
+
//#endregion
|
|
4805
|
+
//#region src/clients/SignalWire.d.ts
|
|
4806
|
+
/** Options for constructing a {@link SignalWire}. */
|
|
4807
|
+
interface SignalWireOptions {
|
|
4808
|
+
/** Skip automatic WebSocket connection on construction. */
|
|
4809
|
+
skipConnection?: boolean;
|
|
4810
|
+
/** Skip automatic user registration on construction. */
|
|
4811
|
+
skipRegister?: boolean;
|
|
4812
|
+
/** Skip monitoring media device changes. */
|
|
4813
|
+
skipDeviceMonitoring?: boolean;
|
|
4814
|
+
/** Whether to reconnect to previously attached calls. */
|
|
4815
|
+
reconnectAttachedCalls?: boolean;
|
|
4816
|
+
/** Whether to save preferences. */
|
|
4817
|
+
savePreferences?: boolean;
|
|
4818
|
+
/**
|
|
4819
|
+
* Persist the session across page reloads.
|
|
4820
|
+
*
|
|
4821
|
+
* When `true`, credential, authorization state, and protocol are stored in
|
|
4822
|
+
* `localStorage` (survives reload). The DPoP key pair is persisted in
|
|
4823
|
+
* IndexedDB. On reload, the SDK restores the session from cache
|
|
4824
|
+
* without calling `credentialProvider.authenticate()`.
|
|
4825
|
+
*
|
|
4826
|
+
* When `false` (default), session data lives in `sessionStorage` and is
|
|
4827
|
+
* lost on reload.
|
|
4828
|
+
*
|
|
4829
|
+
* Both {@link SignalWire.disconnect | disconnect()} and
|
|
4830
|
+
* {@link SignalWire.destroy | destroy()} end the session and clear the
|
|
4831
|
+
* persisted resume state and attach records; credentials and device
|
|
4832
|
+
* preferences survive. Use `resetToDefaults()` for a full wipe, or
|
|
4833
|
+
* `unregister()` to temporarily stop receiving inbound calls while keeping
|
|
4834
|
+
* the session alive.
|
|
4835
|
+
*/
|
|
4836
|
+
persistSession?: boolean;
|
|
4837
|
+
/** Custom storage implementation for persistence. */
|
|
4838
|
+
storageImplementation?: Storage;
|
|
4839
|
+
/** Custom WebSocket constructor */
|
|
4840
|
+
webSocketConstructor?: WebSocketAdapter | NodeSocketAdapter;
|
|
4841
|
+
/** Custom WebRTC API provider */
|
|
4842
|
+
webRTCApiProvider?: WebRTCApiProvider;
|
|
4487
4843
|
/**
|
|
4488
|
-
*
|
|
4844
|
+
* Custom logger implementation. Must implement the {@link SDKLogger} interface.
|
|
4845
|
+
* Pass `null` to restore the built-in logger.
|
|
4846
|
+
*
|
|
4847
|
+
* **Note:** Logger configuration is global — setting it on one instance affects all instances.
|
|
4489
4848
|
*/
|
|
4490
|
-
|
|
4849
|
+
logger?: SDKLogger | null;
|
|
4491
4850
|
/**
|
|
4492
|
-
*
|
|
4851
|
+
* Log level for the built-in logger.
|
|
4852
|
+
* Default: `'warn'`. Set to `'debug'` for verbose SDK output.
|
|
4853
|
+
* Has no effect when a custom `logger` is provided.
|
|
4854
|
+
*
|
|
4855
|
+
* **Note:** Logger configuration is global — setting it on one instance affects all instances.
|
|
4493
4856
|
*/
|
|
4494
|
-
|
|
4857
|
+
logLevel?: LogLevel;
|
|
4858
|
+
/** Debug options for verbose SDK diagnostics (e.g., `{ logWsTraffic: true }`). */
|
|
4859
|
+
debug?: DebugOptions;
|
|
4495
4860
|
/**
|
|
4496
|
-
*
|
|
4861
|
+
* Control transport for `call.*` verbs across ALL calls in this session:
|
|
4862
|
+
* - `'routed'` (default) sends them on the client's session channel.
|
|
4863
|
+
* - `'in-dialog'` carries them on each call's own signaling channel via `verto.info`,
|
|
4864
|
+
* so control works without the client needing to know how the conference is hosted.
|
|
4865
|
+
*
|
|
4866
|
+
* `'in-dialog'` is opt-in because it does not reach everywhere `'routed'` does: use it
|
|
4867
|
+
* only for calls that join a conference over SWML (e.g. an SWML `join_conference`).
|
|
4868
|
+
*
|
|
4869
|
+
* It is a client-wide setting rather than per-`dial()` because the SDK issues some
|
|
4870
|
+
* control RPCs itself (fetching the layout list on join, for example), and those must
|
|
4871
|
+
* travel the same way as the app's own, or reads and writes land on different transports.
|
|
4872
|
+
*
|
|
4873
|
+
* @experimental A rollout switch, not a long-term part of the API. Expected to
|
|
4874
|
+
* disappear once `'in-dialog'` becomes the only transport, so it carries no semver
|
|
4875
|
+
* promise and application code should not depend on it.
|
|
4497
4876
|
*/
|
|
4498
|
-
|
|
4877
|
+
callControl?: 'routed' | 'in-dialog';
|
|
4878
|
+
}
|
|
4879
|
+
/** Options for {@link SignalWire.dial}. Extends {@link MediaOptions} with dial-specific settings. */
|
|
4880
|
+
interface DialOptions extends MediaOptions {
|
|
4881
|
+
/** Preferred video codecs for this call (overrides global preferences). */
|
|
4882
|
+
preferredVideoCodecs?: string[];
|
|
4883
|
+
/** Preferred audio codecs for this call (overrides global preferences). */
|
|
4884
|
+
preferredAudioCodecs?: string[];
|
|
4885
|
+
/** Enable stereo Opus for this call (overrides global preferences). */
|
|
4886
|
+
stereo?: boolean;
|
|
4887
|
+
/** Optional node ID for routing the call */
|
|
4888
|
+
nodeId?: string;
|
|
4889
|
+
/**
|
|
4890
|
+
* Custom variables sent with the Verto invite. Merged with
|
|
4891
|
+
* `client.preferences.userVariables` and any query-string variables on the
|
|
4892
|
+
* destination URI; values here take precedence.
|
|
4893
|
+
*/
|
|
4894
|
+
userVariables?: Record<string, unknown>;
|
|
4499
4895
|
}
|
|
4500
4896
|
/**
|
|
4501
|
-
*
|
|
4897
|
+
* Main entry point for the SignalWire Browser SDK.
|
|
4502
4898
|
*
|
|
4503
|
-
* Manages
|
|
4504
|
-
*
|
|
4505
|
-
*
|
|
4899
|
+
* Manages authentication, WebSocket transport, call creation, and media devices.
|
|
4900
|
+
*
|
|
4901
|
+
* @example
|
|
4902
|
+
* ```ts
|
|
4903
|
+
* const client = new SignalWire(credentialProvider);
|
|
4904
|
+
* client.isConnected$.subscribe(connected => console.log('Connected:', connected));
|
|
4905
|
+
* const call = await client.dial('/public/my-room');
|
|
4906
|
+
* ```
|
|
4506
4907
|
*/
|
|
4507
|
-
declare class
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
private
|
|
4516
|
-
private
|
|
4517
|
-
private participantFactory;
|
|
4518
|
-
private _errors$;
|
|
4519
|
-
private _status$;
|
|
4520
|
-
private _lastMergedStatus;
|
|
4521
|
-
private _answered$;
|
|
4522
|
-
private _answerMediaOptions?;
|
|
4523
|
-
private _holdState;
|
|
4524
|
-
private _userVariables$;
|
|
4525
|
-
private _statsMonitor?;
|
|
4526
|
-
private _recoveryManager?;
|
|
4527
|
-
private _networkChange$?;
|
|
4528
|
-
private _networkIssues$;
|
|
4529
|
-
private _networkMetrics$;
|
|
4530
|
-
private _isNetworkHealthy$;
|
|
4531
|
-
private _qualityScore$;
|
|
4532
|
-
private _qualityLevel$;
|
|
4533
|
-
private _recoveryState$;
|
|
4534
|
-
private _recoveryEvent$;
|
|
4535
|
-
private _bandwidthConstrained$;
|
|
4536
|
-
private _mediaParamsUpdated$;
|
|
4537
|
-
private _customSubscriptions;
|
|
4538
|
-
private _pushToTalkEnabled;
|
|
4539
|
-
private _remoteAudioMeter;
|
|
4540
|
-
constructor(clientSession: ClientSession, options: CallOptions, initialization: CallInitialization, address?: Address | undefined);
|
|
4541
|
-
/** Observable stream of errors from media, signaling, and peer connection layers. */
|
|
4542
|
-
get errors$(): Observable<CallError>;
|
|
4908
|
+
declare class SignalWire extends Destroyable implements DeviceController {
|
|
4909
|
+
/** Global SDK preferences (timeouts, ICE config, media defaults). */
|
|
4910
|
+
preferences: ClientPreferences;
|
|
4911
|
+
private _user$;
|
|
4912
|
+
private _directory$;
|
|
4913
|
+
private _transport;
|
|
4914
|
+
private _clientSession;
|
|
4915
|
+
private _publicSession;
|
|
4916
|
+
private _deviceController;
|
|
4917
|
+
private _attachManager?;
|
|
4543
4918
|
/**
|
|
4544
|
-
*
|
|
4545
|
-
*
|
|
4919
|
+
* Set once a credential recovery has been *verified* — reauthenticated and
|
|
4920
|
+
* then proven by the operation it was meant to unblock. Read by the attach
|
|
4921
|
+
* path, which may only discard an attach record when a reattach is refused
|
|
4922
|
+
* on a credential the server has already accepted.
|
|
4546
4923
|
*/
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
addCallId(callId: string): void;
|
|
4566
|
-
/** List of capabilities available in the current call. */
|
|
4567
|
-
get capabilities(): Capability[];
|
|
4568
|
-
/** Current snapshot of all participants in the call. */
|
|
4569
|
-
get participants(): CallParticipant[];
|
|
4570
|
-
/** The local participant, or `null` if not yet joined. */
|
|
4571
|
-
get self(): CallSelfParticipant | null;
|
|
4572
|
-
/** Toggles the call lock state, preventing or allowing new participants from joining. */
|
|
4573
|
-
toggleLock(): Promise<void>;
|
|
4924
|
+
private _credentialRecovered;
|
|
4925
|
+
private _isConnected$;
|
|
4926
|
+
private _isRegistered$;
|
|
4927
|
+
private _errors$;
|
|
4928
|
+
private _warnings$;
|
|
4929
|
+
private _options;
|
|
4930
|
+
private _dpopManager?;
|
|
4931
|
+
private _refreshCoordinator?;
|
|
4932
|
+
/** The refresh path's own HTTP controller — see resolveCredentials. */
|
|
4933
|
+
private _refreshHttp?;
|
|
4934
|
+
/** Host `_refreshHttp` was built against, so it can be rebuilt when the token's `ch` changes. */
|
|
4935
|
+
private _refreshHttpHost?;
|
|
4936
|
+
private _credentialProvider?;
|
|
4937
|
+
private _deps;
|
|
4938
|
+
private _networkMonitor?;
|
|
4939
|
+
private _visibilityController?;
|
|
4940
|
+
private _diagnosticsCollector?;
|
|
4941
|
+
private _platformCapabilities?;
|
|
4574
4942
|
/**
|
|
4575
|
-
*
|
|
4943
|
+
* Creates a new SignalWire client and begins connecting.
|
|
4576
4944
|
*
|
|
4577
|
-
*
|
|
4945
|
+
* @param credentialProvider - Provider that supplies authentication credentials.
|
|
4946
|
+
* @param options - Configuration options (connection, device monitoring, preferences).
|
|
4578
4947
|
*/
|
|
4579
|
-
|
|
4580
|
-
/** @throws {UnimplementedError} Not yet implemented. Status tracked via {@link recording$}. */
|
|
4581
|
-
startRecording(): Promise<void>;
|
|
4582
|
-
/** @throws {UnimplementedError} Not yet implemented. Status tracked via {@link streaming$}. */
|
|
4583
|
-
startStreaming(): Promise<void>;
|
|
4948
|
+
constructor(credentialProvider: CredentialProvider | undefined, options?: SignalWireOptions);
|
|
4584
4949
|
/**
|
|
4585
|
-
*
|
|
4586
|
-
*
|
|
4587
|
-
*
|
|
4950
|
+
* Build the refresh path's own HTTP controller, against whatever host is current.
|
|
4951
|
+
*
|
|
4952
|
+
* Called on first use rather than up front, so `apiHost` already reflects the
|
|
4953
|
+
* token's `ch` claim. Same credential source as the container's controller — only
|
|
4954
|
+
* the instance, and therefore its observable streams, is separate.
|
|
4588
4955
|
*/
|
|
4589
|
-
|
|
4956
|
+
private createRefreshHttpController;
|
|
4590
4957
|
/**
|
|
4591
|
-
*
|
|
4592
|
-
* @param _meta - Metadata to merge.
|
|
4593
|
-
* @throws {UnimplementedError} Not yet implemented.
|
|
4958
|
+
* Initializes DPoP if not already set up. Returns the fingerprint on success.
|
|
4594
4959
|
*/
|
|
4595
|
-
|
|
4596
|
-
/** Observable of layout layer positions for all participants. */
|
|
4597
|
-
get layoutLayers$(): Observable<LayoutLayer[]>;
|
|
4598
|
-
/** Current snapshot of layout layers. */
|
|
4599
|
-
get layoutLayers(): LayoutLayer[];
|
|
4960
|
+
private initDPoP;
|
|
4600
4961
|
/**
|
|
4601
|
-
*
|
|
4602
|
-
*
|
|
4603
|
-
* Constructs call context (node_id, call_id, member_id) and sends the RPC request.
|
|
4962
|
+
* Resolves credentials using cache-first strategy when persistSession is enabled.
|
|
4604
4963
|
*
|
|
4605
|
-
*
|
|
4606
|
-
*
|
|
4607
|
-
*
|
|
4608
|
-
*
|
|
4609
|
-
* @throws {JSONRPCError} If the RPC call returns an error.
|
|
4964
|
+
* 1. If persistSession → check localStorage for cached credential
|
|
4965
|
+
* 2. If cached and not expired → use it (skip provider.authenticate())
|
|
4966
|
+
* 3. If no cache or expired → call provider.authenticate()
|
|
4967
|
+
* 4. If no provider AND no cache → throw
|
|
4610
4968
|
*/
|
|
4611
|
-
|
|
4612
|
-
private
|
|
4613
|
-
/** Observable of the current call status (e.g. `'ringing'`, `'connected'`). */
|
|
4614
|
-
get status$(): Observable<CallStatus>;
|
|
4615
|
-
/** Observable of the participants list, emits on join/leave/update. */
|
|
4616
|
-
get participants$(): Observable<CallParticipant[]>;
|
|
4617
|
-
/** Observable of the local (self) participant. */
|
|
4618
|
-
get self$(): Observable<CallSelfParticipant>;
|
|
4619
|
-
/** Observable indicating whether the call is being recorded. */
|
|
4620
|
-
get recording$(): Observable<boolean>;
|
|
4621
|
-
/** Observable indicating whether the call is being streamed. */
|
|
4622
|
-
get streaming$(): Observable<boolean>;
|
|
4623
|
-
/** Observable indicating whether raise-hand priority is active. */
|
|
4624
|
-
get raiseHandPriority$(): Observable<boolean>;
|
|
4625
|
-
/** Observable indicating whether the call room is locked. */
|
|
4626
|
-
get locked$(): Observable<boolean>;
|
|
4627
|
-
/** Observable of custom metadata associated with the call. */
|
|
4628
|
-
get meta$(): Observable<Record<string, unknown>>;
|
|
4629
|
-
/** Observable of the call's capability flags. */
|
|
4630
|
-
get capabilities$(): Observable<Capability[]>;
|
|
4631
|
-
/** Observable of the current layout name. */
|
|
4632
|
-
get layout$(): Observable<string>;
|
|
4633
|
-
/** Current call status. */
|
|
4634
|
-
get status(): CallStatus;
|
|
4635
|
-
/** Whether the call is currently being recorded. */
|
|
4636
|
-
get recording(): boolean;
|
|
4637
|
-
/** Whether the call is currently being streamed. */
|
|
4638
|
-
get streaming(): boolean;
|
|
4639
|
-
/** Whether raise-hand priority is active. */
|
|
4640
|
-
get raiseHandPriority(): boolean;
|
|
4641
|
-
/** Whether the call room is locked. */
|
|
4642
|
-
get locked(): boolean;
|
|
4643
|
-
/** Current custom metadata of the call. */
|
|
4644
|
-
get meta(): Record<string, unknown>;
|
|
4645
|
-
/** Current layout name, or `undefined` if not set. */
|
|
4646
|
-
get layout(): string | undefined;
|
|
4647
|
-
/** Observable of available layout names. */
|
|
4648
|
-
get layouts$(): Observable<string[]>;
|
|
4649
|
-
/** Current snapshot of available layout names. */
|
|
4650
|
-
get layouts(): string[];
|
|
4651
|
-
/** Observable of the local media stream (camera/microphone). */
|
|
4652
|
-
get localStream$(): Observable<MediaStream>;
|
|
4653
|
-
/** Current local media stream, or `null` if not available. */
|
|
4654
|
-
get localStream(): MediaStream | null;
|
|
4655
|
-
/** Observable of the remote media stream from the far end. */
|
|
4656
|
-
get remoteStream$(): Observable<MediaStream>;
|
|
4657
|
-
/** Current remote media stream, or `null` if not available. */
|
|
4658
|
-
get remoteStream(): MediaStream | null;
|
|
4659
|
-
/** Observable of custom user variables associated with the call. */
|
|
4660
|
-
get userVariables$(): Observable<Record<string, unknown>>;
|
|
4661
|
-
/** a copy of the current custom user variables of the call. */
|
|
4662
|
-
get userVariables(): Record<string, unknown>;
|
|
4663
|
-
/** Merge current custom user variables of the call. */
|
|
4664
|
-
set userVariables(variables: Record<string, unknown>);
|
|
4665
|
-
/** Observable of current network health issues (empty array = healthy). */
|
|
4666
|
-
get networkIssues$(): Observable<NetworkIssue[]>;
|
|
4667
|
-
/** Current snapshot of network issues. */
|
|
4668
|
-
get networkIssues(): NetworkIssue[];
|
|
4669
|
-
/** Simple boolean health indicator derived from stats monitor. */
|
|
4670
|
-
get isNetworkHealthy$(): Observable<boolean>;
|
|
4671
|
-
/** Whether the network is currently healthy. */
|
|
4672
|
-
get isNetworkHealthy(): boolean;
|
|
4673
|
-
/** Rolling history of raw network metrics (RTT, jitter, packet loss, bitrate). */
|
|
4674
|
-
get networkMetrics$(): Observable<NetworkMetrics[]>;
|
|
4675
|
-
/** Current snapshot of the metrics rolling window. */
|
|
4676
|
-
get networkMetrics(): NetworkMetrics[];
|
|
4677
|
-
/** Observable of MOS quality score (1-5) computed from stats metrics. */
|
|
4678
|
-
get qualityScore$(): Observable<number>;
|
|
4679
|
-
/** Observable of simplified quality level (excellent/good/fair/poor/critical). */
|
|
4680
|
-
get qualityLevel$(): Observable<QualityLevel$1>;
|
|
4681
|
-
/** Observable of the recovery pipeline state machine. */
|
|
4682
|
-
get recoveryState$(): Observable<RecoveryState$1>;
|
|
4683
|
-
/** Observable of recovery events (keyframe requested, ICE restart, etc.). */
|
|
4684
|
-
get recoveryEvent$(): Observable<RecoveryEvent$1>;
|
|
4685
|
-
/** Observable indicating whether the call is bandwidth-constrained. */
|
|
4686
|
-
get bandwidthConstrained$(): Observable<boolean>;
|
|
4687
|
-
/** Observable that emits when server-pushed media params are applied. */
|
|
4688
|
-
get mediaParamsUpdated$(): Observable<MediaParamsEvent>;
|
|
4969
|
+
private resolveCredentials;
|
|
4970
|
+
private validateCredentials;
|
|
4689
4971
|
/**
|
|
4690
|
-
*
|
|
4691
|
-
*
|
|
4972
|
+
* Reauthenticate the currently-open session with a freshly obtained
|
|
4973
|
+
* credential so the new token takes effect on the live socket immediately —
|
|
4974
|
+
* not just on the next reconnect. No-op when the session is not
|
|
4975
|
+
* connected/authenticated or the credential carries no token (e.g. an
|
|
4976
|
+
* authorization-state-only refresh). Non-fatal: reauth failures surface on
|
|
4977
|
+
* `errors$` without aborting the refresh that triggered this.
|
|
4692
4978
|
*/
|
|
4693
|
-
|
|
4694
|
-
/** Request a video keyframe via RTCP PLI/FIR. */
|
|
4695
|
-
requestKeyframe(): void;
|
|
4696
|
-
/** Force an ICE restart / re-INVITE. */
|
|
4697
|
-
requestIceRestart(): Promise<void>;
|
|
4979
|
+
private reauthenticateLiveSession;
|
|
4698
4980
|
/**
|
|
4699
|
-
*
|
|
4700
|
-
*
|
|
4981
|
+
* Recover a session the server is refusing: mint a fresh credential,
|
|
4982
|
+
* reauthenticate the live session with it, and retry the operation.
|
|
4983
|
+
*
|
|
4984
|
+
* The connection is deliberately kept. A reload authenticates the new socket
|
|
4985
|
+
* against the persisted `authorization_state`, and that handshake is what
|
|
4986
|
+
* associates the socket with the previous session — the association reattach
|
|
4987
|
+
* depends on. `signalwire.reauthenticate` swaps the credential *on that same
|
|
4988
|
+
* session*, so recovery never touches the resume state. Discarding it would
|
|
4989
|
+
* heal the credential by destroying the very thing the caller is trying to
|
|
4990
|
+
* get back to.
|
|
4991
|
+
*
|
|
4992
|
+
* The operation is still the verdict, never the RPC. Reauthenticating with
|
|
4993
|
+
* the in-memory token is accepted by a resume even while requests stay
|
|
4994
|
+
* refused, because the persisted `authorization_state` short-circuits token
|
|
4995
|
+
* validation — and `signalwire.reauthenticate` with a *freshly minted* token
|
|
4996
|
+
* has also been observed accepted while `subscriber.online` keeps being
|
|
4997
|
+
* refused (staging run 33826974634). Both look like success and are not.
|
|
4998
|
+
*
|
|
4999
|
+
* @returns the operation's value, or the reason recovery could not deliver
|
|
5000
|
+
* one. `error` is undefined when there was no way to mint at all.
|
|
4701
5001
|
*/
|
|
4702
|
-
private
|
|
5002
|
+
private recoverAndRetry;
|
|
4703
5003
|
/**
|
|
4704
|
-
*
|
|
4705
|
-
* triggering an ICE restart. Resolves true on success, false on failure
|
|
4706
|
-
* or if the state doesn't transition within the configured timeout.
|
|
5004
|
+
* Re-mint a credential and adopt it only if the live session accepts it.
|
|
4707
5005
|
*
|
|
4708
|
-
*
|
|
4709
|
-
*
|
|
4710
|
-
*
|
|
5006
|
+
* The mechanism follows the binding: a client-bound session re-mints a bound
|
|
5007
|
+
* base SAT through `authenticate()` with the DPoP fingerprint, because the
|
|
5008
|
+
* developer refresh handler would hand back an unbound token and silently
|
|
5009
|
+
* degrade the session. An unbound session uses the refresh handler. Rotation
|
|
5010
|
+
* cost is not a reason to skip this — the only reason is having no mechanism.
|
|
5011
|
+
*
|
|
5012
|
+
* @returns whether the session is now running on a freshly accepted credential.
|
|
5013
|
+
*/
|
|
5014
|
+
private remintAndReauthenticate;
|
|
5015
|
+
/**
|
|
5016
|
+
* Re-mint a credential via `provider.refresh()`, routed through the
|
|
5017
|
+
* coordinator's shared in-flight guard so concurrent re-mint paths (a
|
|
5018
|
+
* scheduled/resume refresh, -32003 recovery, and reconnect) never fire a
|
|
5019
|
+
* second `provider.refresh()` in parallel — which rotating one-time-use
|
|
5020
|
+
* refresh tokens reject. Falls back to a direct call only if the coordinator
|
|
5021
|
+
* has not been constructed yet.
|
|
5022
|
+
*/
|
|
5023
|
+
private remintCredential;
|
|
5024
|
+
/**
|
|
5025
|
+
* Re-mint credentials before a fresh (re)connect (`onBeforeReconnect` hook).
|
|
5026
|
+
* The session invokes this only when it is client-bound OR the in-memory
|
|
5027
|
+
* token is expired. The re-mint mechanism depends on the binding:
|
|
5028
|
+
* - Client-bound: `authenticate()` with the DPoP fingerprint to obtain a
|
|
5029
|
+
* fresh base SAT the upcoming reconnect can re-bind (the
|
|
5030
|
+
* DeviceTokenManager re-activates afterwards).
|
|
5031
|
+
* - Unbound: the developer's non-interactive `refresh()` handler.
|
|
5032
|
+
* `authenticate()` is deliberately NOT used here — it may be interactive
|
|
5033
|
+
* (a login prompt) and must not fire on a background reconnect.
|
|
5034
|
+
*
|
|
5035
|
+
* Rejects on failure so the session aborts the reconnect rather than
|
|
5036
|
+
* replaying a stale token.
|
|
4711
5037
|
*/
|
|
4712
|
-
private
|
|
5038
|
+
private refreshCredentialForReconnect;
|
|
5039
|
+
/** Persist credential to localStorage when persistSession is enabled. */
|
|
5040
|
+
private persistCredential;
|
|
4713
5041
|
/**
|
|
4714
|
-
*
|
|
4715
|
-
*
|
|
5042
|
+
* Persist whether the session is client-bound, mirroring the credential's
|
|
5043
|
+
* storage scopes so it survives a reload. The preflight recovery reads it
|
|
5044
|
+
* before any session exists to decide whether to re-bind via `authenticate()`
|
|
5045
|
+
* or refresh an unbound token; the marker tracks the latest binding, so an
|
|
5046
|
+
* unbound reconnect clears a stale marker from an earlier client-bound login.
|
|
4716
5047
|
*/
|
|
4717
|
-
private
|
|
4718
|
-
/** @
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
/** Current audio/video send/receive directions. */
|
|
4723
|
-
get mediaDirections(): MediaDirections;
|
|
4724
|
-
protected get participantsId$(): Observable<string[]>;
|
|
5048
|
+
private persistClientBoundMarker;
|
|
5049
|
+
/** Read the persisted client-bound marker (see {@link persistClientBoundMarker}). */
|
|
5050
|
+
private wasClientBound;
|
|
5051
|
+
private init;
|
|
5052
|
+
private handleAttachments;
|
|
4725
5053
|
/**
|
|
4726
|
-
*
|
|
5054
|
+
* Fetch the authenticated user profile, recovering a stale credential.
|
|
4727
5055
|
*
|
|
4728
|
-
*
|
|
4729
|
-
*
|
|
4730
|
-
*
|
|
4731
|
-
*
|
|
4732
|
-
*
|
|
4733
|
-
*
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
get selfId(): string | null;
|
|
4740
|
-
/** Observable of the server node ID handling this call. */
|
|
4741
|
-
get nodeId$(): Observable<string | null>;
|
|
4742
|
-
/** Server node ID handling this call, or `null`. */
|
|
4743
|
-
get nodeId(): string | null;
|
|
4744
|
-
private isCallSessionEvent;
|
|
4745
|
-
private get callSessionEvents$();
|
|
4746
|
-
/** Observable of call-updated events. */
|
|
4747
|
-
get callUpdated$(): Observable<CallUpdatedPayload>;
|
|
4748
|
-
/** Observable of member-joined events, emitted when a remote participant joins the call. */
|
|
4749
|
-
get memberJoined$(): Observable<MemberJoinedPayload>;
|
|
4750
|
-
/** Observable of member-left events, emitted when a participant leaves the call. */
|
|
4751
|
-
get memberLeft$(): Observable<MemberLeftPayload>;
|
|
4752
|
-
/** Observable of member-updated events (mute, volume, etc.). */
|
|
4753
|
-
get memberUpdated$(): Observable<MemberUpdatedPayload>;
|
|
4754
|
-
/** Observable of member-talking events (speech start/stop). */
|
|
4755
|
-
get memberTalking$(): Observable<MemberTalkingPayload>;
|
|
4756
|
-
/** Observable of call state-change events. */
|
|
4757
|
-
get callStates$(): Observable<CallStatePayload>;
|
|
4758
|
-
/** Observable of layout-changed events. */
|
|
4759
|
-
get layoutUpdates$(): Observable<LayoutChangedPayload>;
|
|
4760
|
-
/** Underlying `RTCPeerConnection`, for advanced use cases. */
|
|
4761
|
-
get rtcPeerConnection(): RTCPeerConnection | undefined;
|
|
4762
|
-
/** Observable of raw signaling events as plain objects. */
|
|
4763
|
-
get signalingEvent$(): Observable<Record<string, unknown>>;
|
|
5056
|
+
* On a reload the persisted credential can be expired. Unlike the WS resume —
|
|
5057
|
+
* which the server accepts against the persisted `authorization_state` even
|
|
5058
|
+
* with an expired token — this REST preflight has no such short-circuit and is
|
|
5059
|
+
* refused (401). There is no session yet to reauthenticate, so recovery
|
|
5060
|
+
* re-mints the credential through the provider ({@link refreshCredentialForReconnect})
|
|
5061
|
+
* and retries with a FRESH {@link User}: Fetchable memoizes its result
|
|
5062
|
+
* (shareReplay), so reusing the instance would replay the 401 instead of
|
|
5063
|
+
* re-fetching with the new token. Without the user id the transport/session —
|
|
5064
|
+
* and the reattach a reload is trying to preserve — cannot even be addressed.
|
|
5065
|
+
*/
|
|
5066
|
+
private fetchUserOrRecover;
|
|
4764
5067
|
/**
|
|
4765
|
-
*
|
|
5068
|
+
* Establishes the WebSocket connection and authenticates the session.
|
|
4766
5069
|
*
|
|
4767
|
-
*
|
|
4768
|
-
* whose `event_type` matches the given string. The observable completes
|
|
4769
|
-
* when the call is destroyed.
|
|
5070
|
+
* ## Reconnection behavior
|
|
4770
5071
|
*
|
|
4771
|
-
*
|
|
4772
|
-
*
|
|
5072
|
+
* After a successful connection the underlying {@link WebSocketController}
|
|
5073
|
+
* automatically attempts to reconnect whenever the socket closes
|
|
5074
|
+
* unexpectedly (e.g. network change, server restart). Reconnection uses an
|
|
5075
|
+
* **exponential back-off** strategy:
|
|
4773
5076
|
*
|
|
4774
|
-
*
|
|
4775
|
-
*
|
|
5077
|
+
* - First retry after `reconnectDelayMin` (default **0.1 s**).
|
|
5078
|
+
* - Each subsequent retry doubles the delay up to `reconnectDelayMax`
|
|
5079
|
+
* (default **3 s**).
|
|
5080
|
+
* - The delay resets to `reconnectDelayMin` once a connection succeeds.
|
|
5081
|
+
* - A per-attempt `connectionTimeout` (default **10 s**) aborts the
|
|
5082
|
+
* attempt and schedules the next retry if the server does not respond.
|
|
4776
5083
|
*
|
|
4777
|
-
* @
|
|
4778
|
-
*
|
|
5084
|
+
* Calling {@link disconnect} stops the reconnection loop entirely.
|
|
5085
|
+
*
|
|
5086
|
+
* ## Message handling during temporary disconnections
|
|
5087
|
+
*
|
|
5088
|
+
* While the socket is not in the `connected` state, **outgoing messages
|
|
5089
|
+
* are queued** in an internal buffer. Once the connection is
|
|
5090
|
+
* re-established the queue is flushed in order so no outgoing RPC call is
|
|
5091
|
+
* lost.
|
|
5092
|
+
*
|
|
5093
|
+
* **Incoming** server-to-client messages that arrive while the socket is
|
|
5094
|
+
* down are *not* buffered by the SDK — they are expected to be
|
|
5095
|
+
* re-delivered by the server after the session is re-authenticated.
|
|
5096
|
+
* Active RPC calls that were awaiting a response will time out
|
|
5097
|
+
* (default **5 s**) and reject with an `RPCTimeoutError`; callers should
|
|
5098
|
+
* handle this and retry if appropriate.
|
|
5099
|
+
*
|
|
5100
|
+
* The connection status can be observed via the `status$` observable on
|
|
5101
|
+
* the transport layer, which emits `'connecting'`, `'connected'`,
|
|
5102
|
+
* `'reconnecting'`, `'disconnecting'`, or `'disconnected'`.
|
|
5103
|
+
*/
|
|
5104
|
+
connect(): Promise<void>;
|
|
5105
|
+
/**
|
|
5106
|
+
* Observable that emits the {@link User} profile once fetched,
|
|
5107
|
+
* or `undefined` before authentication completes.
|
|
4779
5108
|
*
|
|
4780
5109
|
* @example
|
|
4781
5110
|
* ```ts
|
|
4782
|
-
*
|
|
4783
|
-
* console.log('
|
|
5111
|
+
* client.user$.subscribe(u => {
|
|
5112
|
+
* if (u) console.log('Logged in as', u.email);
|
|
4784
5113
|
* });
|
|
4785
5114
|
* ```
|
|
4786
5115
|
*/
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
get
|
|
4790
|
-
get layoutEvent$(): Observable<LayoutChangedPayload>;
|
|
5116
|
+
get user$(): Observable<User | undefined>;
|
|
5117
|
+
/** Current user snapshot, or `undefined` if not yet authenticated. */
|
|
5118
|
+
get user(): User | undefined;
|
|
4791
5119
|
/**
|
|
4792
|
-
*
|
|
4793
|
-
*
|
|
4794
|
-
*
|
|
4795
|
-
* then destroys the call. After this, the call instance is no longer usable.
|
|
5120
|
+
* Observable that emits the {@link Directory} instance once the client is connected,
|
|
5121
|
+
* or `undefined` while disconnected. Subscribe to this to safely wait for the directory
|
|
5122
|
+
* to become available without risking an error.
|
|
4796
5123
|
*
|
|
4797
5124
|
* @example
|
|
4798
5125
|
* ```ts
|
|
4799
|
-
*
|
|
5126
|
+
* client.directory$.subscribe(dir => {
|
|
5127
|
+
* if (dir) dir.addresses$.subscribe(console.log);
|
|
5128
|
+
* });
|
|
4800
5129
|
* ```
|
|
4801
5130
|
*/
|
|
4802
|
-
|
|
5131
|
+
get directory$(): Observable<Directory | undefined>;
|
|
4803
5132
|
/**
|
|
4804
|
-
*
|
|
5133
|
+
* Current directory snapshot, or `undefined` if the client is not yet connected.
|
|
5134
|
+
* Prefer {@link directory$} when you need to react to the directory becoming available.
|
|
5135
|
+
*/
|
|
5136
|
+
get directory(): Directory | undefined;
|
|
5137
|
+
/** Observable that emits when the user registration state changes. */
|
|
5138
|
+
get isRegistered$(): Observable<boolean>;
|
|
5139
|
+
/** Whether the user is currently registered. */
|
|
5140
|
+
get isRegistered(): boolean;
|
|
5141
|
+
/** Whether the client is currently connected. */
|
|
5142
|
+
get isConnected(): boolean;
|
|
5143
|
+
/** Observable that emits when the connection state changes. */
|
|
5144
|
+
get isConnected$(): Observable<boolean>;
|
|
5145
|
+
/** Observable that emits `true` when the client is both connected and authenticated. */
|
|
5146
|
+
get ready$(): Observable<boolean>;
|
|
5147
|
+
/** Observable stream of errors from transport, authentication, and devices. */
|
|
5148
|
+
get errors$(): Observable<Error>;
|
|
5149
|
+
/**
|
|
5150
|
+
* Observable stream of non-fatal SDK warnings.
|
|
4805
5151
|
*
|
|
4806
|
-
*
|
|
5152
|
+
* Subscribe to detect SDK behaviors that affect session liveness or developer-facing
|
|
5153
|
+
* contracts but do not warrant disconnection — e.g., a fallback from Client Bound SAT
|
|
5154
|
+
* refresh to the developer-provided `refresh()` because the SAT lacks `sat:refresh`
|
|
5155
|
+
* scope. Discriminated by `code`.
|
|
4807
5156
|
*
|
|
4808
|
-
* @
|
|
4809
|
-
* ```ts
|
|
4810
|
-
* await call.sendDigits('1234#');
|
|
4811
|
-
* ```
|
|
5157
|
+
* Independent from {@link errors$}: existing error consumers are not notified.
|
|
4812
5158
|
*/
|
|
4813
|
-
|
|
4814
|
-
/**
|
|
4815
|
-
|
|
4816
|
-
/** Observable
|
|
5159
|
+
get warnings$(): Observable<SDKWarning>;
|
|
5160
|
+
/** Platform WebRTC capabilities detected at construction time. */
|
|
5161
|
+
get platformCapabilities(): PlatformCapabilities;
|
|
5162
|
+
/** Observable that emits when the SDK auto-switches a device. */
|
|
5163
|
+
get deviceRecovered$(): Observable<DeviceRecoveryEvent>;
|
|
4817
5164
|
/**
|
|
4818
|
-
*
|
|
5165
|
+
* Export a structured diagnostic bundle for support/debugging.
|
|
5166
|
+
* Includes connection events, call summaries, and device changes.
|
|
5167
|
+
*/
|
|
5168
|
+
exportDiagnostics(): SessionDiagnostics;
|
|
5169
|
+
/**
|
|
5170
|
+
* Initialize resilience subsystems. Non-fatal: any failure is logged and
|
|
5171
|
+
* the SDK continues working without the failing subsystem.
|
|
5172
|
+
*/
|
|
5173
|
+
private initResilienceSubsystems;
|
|
5174
|
+
/**
|
|
5175
|
+
* Disconnects the WebSocket and tears down the current session.
|
|
4819
5176
|
*
|
|
4820
|
-
*
|
|
5177
|
+
* Ends the session identified by the protocol and clears its persisted
|
|
5178
|
+
* resume state (`authorization_state` + protocol) and attach records
|
|
5179
|
+
* together — a later {@link connect} with the same credentials starts a
|
|
5180
|
+
* fresh session and cannot reattach to the ended session's calls.
|
|
5181
|
+
* Credentials and device preferences are preserved. To temporarily stop
|
|
5182
|
+
* receiving inbound calls while keeping the session alive, use
|
|
5183
|
+
* `unregister()` instead.
|
|
4821
5184
|
*
|
|
4822
|
-
* @
|
|
4823
|
-
*
|
|
4824
|
-
|
|
4825
|
-
|
|
5185
|
+
* The client can be reconnected by calling {@link connect} again,
|
|
5186
|
+
* which creates a fresh transport and session.
|
|
5187
|
+
*/
|
|
5188
|
+
disconnect(): Promise<void>;
|
|
5189
|
+
/**
|
|
5190
|
+
* Tear down the current transport / session / attach manager. Safe to call
|
|
5191
|
+
* when nothing has been initialized yet (e.g. first connect()).
|
|
5192
|
+
*/
|
|
5193
|
+
private teardownTransportAndSession;
|
|
5194
|
+
private waitAuthentication;
|
|
5195
|
+
/**
|
|
5196
|
+
* Registers the user as online to receive inbound calls and events.
|
|
4826
5197
|
*
|
|
4827
|
-
*
|
|
4828
|
-
*
|
|
4829
|
-
*
|
|
4830
|
-
* @
|
|
4831
|
-
* @see {@link answered$} to observe the acceptance state.
|
|
5198
|
+
* Waits for authentication to complete before sending the registration.
|
|
5199
|
+
* If the initial attempt fails, reauthentication is attempted automatically.
|
|
5200
|
+
*
|
|
5201
|
+
* @throws {InvalidCredentialsError} If registration and reauthentication both fail.
|
|
4832
5202
|
*/
|
|
4833
|
-
|
|
4834
|
-
/** Media options provided when answering. Used internally by the VertoManager. */
|
|
4835
|
-
get answerMediaOptions(): MediaOptions | undefined;
|
|
5203
|
+
register(): Promise<void>;
|
|
4836
5204
|
/**
|
|
4837
|
-
*
|
|
5205
|
+
* Unregisters the user, going offline for inbound calls.
|
|
4838
5206
|
*
|
|
4839
|
-
*
|
|
4840
|
-
* @see {@link answered$} to observe the rejection state.
|
|
5207
|
+
* The WebSocket connection remains open; use {@link disconnect} to fully close it.
|
|
4841
5208
|
*/
|
|
4842
|
-
|
|
4843
|
-
/** Observable that emits `true` when answered, `false` when rejected. */
|
|
4844
|
-
get answered$(): Observable<boolean>;
|
|
5209
|
+
unregister(): Promise<void>;
|
|
4845
5210
|
/**
|
|
4846
|
-
*
|
|
5211
|
+
* Places an outbound call to the given destination.
|
|
4847
5212
|
*
|
|
4848
|
-
*
|
|
4849
|
-
*
|
|
4850
|
-
*
|
|
4851
|
-
* position by that member's own call context) alongside `call.layout.set`
|
|
4852
|
-
* (issue #19400, Flag #6).
|
|
5213
|
+
* Waits for authentication before dialing. Media options are merged from
|
|
5214
|
+
* saved preferences, destination query parameters (e.g. `?channel=video`),
|
|
5215
|
+
* and the provided `options` (highest priority).
|
|
4853
5216
|
*
|
|
4854
|
-
*
|
|
4855
|
-
*
|
|
4856
|
-
* default slots before being moved to the requested positions.
|
|
5217
|
+
* Returns a {@link Call} in `'ringing'` state. Subscribe to {@link Call.status$}
|
|
5218
|
+
* to track progression through `'connected'` → `'disconnected'`.
|
|
4857
5219
|
*
|
|
4858
|
-
*
|
|
4859
|
-
*
|
|
4860
|
-
*
|
|
4861
|
-
*
|
|
5220
|
+
* Local media acquisition is deliberately unbounded: an unanswered permission
|
|
5221
|
+
* prompt leaves this promise pending indefinitely, so apply your own bound if
|
|
5222
|
+
* your UI needs one. The 12 s signaling budget starts only once acquisition
|
|
5223
|
+
* settles.
|
|
5224
|
+
*
|
|
5225
|
+
* @param destination - Address URI string (e.g. `'/public/my-room'`) or {@link Address} instance.
|
|
5226
|
+
* @param options - Media and dial options (audio/video, device constraints). Overrides defaults.
|
|
5227
|
+
* @returns The created {@link Call} instance.
|
|
5228
|
+
* @throws {Error} If authentication is not complete or call creation fails.
|
|
4862
5229
|
*
|
|
4863
5230
|
* @example
|
|
4864
5231
|
* ```ts
|
|
4865
|
-
* await
|
|
4866
|
-
*
|
|
5232
|
+
* const call = await client.dial('/public/conference', {
|
|
5233
|
+
* audio: true,
|
|
5234
|
+
* video: true,
|
|
4867
5235
|
* });
|
|
5236
|
+
* call.status$.subscribe(status => console.log('Call:', status));
|
|
4868
5237
|
* ```
|
|
4869
5238
|
*/
|
|
4870
|
-
|
|
4871
|
-
/**
|
|
4872
|
-
* Transfers the call to another destination.
|
|
4873
|
-
*
|
|
4874
|
-
* @param options - Transfer configuration including the target destination.
|
|
4875
|
-
* @see {@link status$} to observe the transfer progress.
|
|
4876
|
-
*/
|
|
4877
|
-
transfer(options: TransferOptions): Promise<void>;
|
|
5239
|
+
dial(destination: string | Address, options?: DialOptions): Promise<Call>;
|
|
4878
5240
|
/**
|
|
4879
|
-
*
|
|
4880
|
-
*
|
|
4881
|
-
* - `0` = silent
|
|
4882
|
-
* - `100` = unity (no change, default)
|
|
4883
|
-
* - `200` = 2× digital boost (max; expect clipping / noise amplification)
|
|
5241
|
+
* Runs a multi-phase connectivity test against the given destination.
|
|
4884
5242
|
*
|
|
4885
|
-
*
|
|
4886
|
-
*
|
|
5243
|
+
* The test checks:
|
|
5244
|
+
* 1. **Signaling** -- WebSocket connected, RTT measurement
|
|
5245
|
+
* 2. **Devices** -- getUserMedia succeeds with selected (or specified) devices
|
|
5246
|
+
* 3. **ICE/TURN** -- gathers ICE candidates to verify STUN/TURN reachability
|
|
5247
|
+
* 4. **Media/bandwidth** (unless `skipMediaTest`) -- dials the destination,
|
|
5248
|
+
* collects getStats() for `duration` seconds, computes bandwidth estimates
|
|
4887
5249
|
*
|
|
4888
|
-
*
|
|
4889
|
-
*
|
|
4890
|
-
*
|
|
4891
|
-
* fight the setting; call {@link setAutoGainControl}(false) for
|
|
4892
|
-
* predictable behaviour.
|
|
5250
|
+
* @param destination - A destination to dial for the media test (e.g. `'/private/network-test'`).
|
|
5251
|
+
* @param options - Preflight options (duration, skipMediaTest, device overrides).
|
|
5252
|
+
* @returns A {@link PreflightResult} describing connectivity health.
|
|
4893
5253
|
*
|
|
4894
|
-
* @
|
|
5254
|
+
* @example
|
|
5255
|
+
* ```ts
|
|
5256
|
+
* const result = await client.preflight('/private/network-test', { duration: 5 });
|
|
5257
|
+
* if (!result.ok) console.warn('Connectivity issues:', result.warnings);
|
|
5258
|
+
* ```
|
|
4895
5259
|
*/
|
|
4896
|
-
|
|
4897
|
-
/**
|
|
4898
|
-
get
|
|
5260
|
+
preflight(destination: string, options?: PreflightOptions): Promise<PreflightResult>;
|
|
5261
|
+
/** The underlying client session for advanced RPC operations. */
|
|
5262
|
+
get session(): ClientSessionWrapper;
|
|
5263
|
+
/** Observable list of available audio input (microphone) devices. */
|
|
5264
|
+
get audioInputDevices$(): Observable<MediaDeviceInfo[]>;
|
|
5265
|
+
/** Current snapshot of available audio input devices. */
|
|
5266
|
+
get audioInputDevices(): MediaDeviceInfo[];
|
|
5267
|
+
/** Observable list of available audio output (speaker) devices. */
|
|
5268
|
+
get audioOutputDevices$(): Observable<MediaDeviceInfo[]>;
|
|
5269
|
+
/** Current snapshot of available audio output devices. */
|
|
5270
|
+
get audioOutputDevices(): MediaDeviceInfo[];
|
|
5271
|
+
/** Observable list of available video input (camera) devices. */
|
|
5272
|
+
get videoInputDevices$(): Observable<MediaDeviceInfo[]>;
|
|
5273
|
+
/** Current snapshot of available video input devices. */
|
|
5274
|
+
get videoInputDevices(): MediaDeviceInfo[];
|
|
5275
|
+
/** Observable of the currently selected audio input device. */
|
|
5276
|
+
get selectedAudioInputDevice$(): Observable<MediaDeviceInfo | null>;
|
|
5277
|
+
/** Observable of the currently selected audio output device. */
|
|
5278
|
+
get selectedAudioOutputDevice$(): Observable<MediaDeviceInfo | null>;
|
|
5279
|
+
/** Observable of the currently selected video input device. */
|
|
5280
|
+
get selectedVideoInputDevice$(): Observable<MediaDeviceInfo | null>;
|
|
5281
|
+
/** Currently selected audio input device, or `null` if none. */
|
|
5282
|
+
get selectedAudioInputDevice(): MediaDeviceInfo | null;
|
|
5283
|
+
/** Currently selected audio output device, or `null` if none. */
|
|
5284
|
+
get selectedAudioOutputDevice(): MediaDeviceInfo | null;
|
|
5285
|
+
/** Currently selected video input device, or `null` if none. */
|
|
5286
|
+
get selectedVideoInputDevice(): MediaDeviceInfo | null;
|
|
5287
|
+
/** Media track constraints for the selected audio input device. Returns `false` when disabled. */
|
|
5288
|
+
get selectedAudioInputDeviceConstraints(): MediaTrackConstraints | boolean;
|
|
5289
|
+
/** Media track constraints for the selected video input device. Returns `false` when disabled. */
|
|
5290
|
+
get selectedVideoInputDeviceConstraints(): MediaTrackConstraints | boolean;
|
|
5291
|
+
/** Converts a `MediaDeviceInfo` to track constraints suitable for `getUserMedia`. */
|
|
5292
|
+
deviceInfoToConstraints(deviceInfo: MediaDeviceInfo | null): MediaTrackConstraints;
|
|
5293
|
+
/** Sets the preferred audio input device. */
|
|
5294
|
+
selectAudioInputDevice(device: MediaDeviceInfo | null): void;
|
|
5295
|
+
/** Sets the preferred video input device. */
|
|
5296
|
+
selectVideoInputDevice(device: MediaDeviceInfo | null): void;
|
|
5297
|
+
/** Sets the preferred audio output device. */
|
|
5298
|
+
selectAudioOutputDevice(device: MediaDeviceInfo | null): void;
|
|
4899
5299
|
/**
|
|
4900
|
-
*
|
|
4901
|
-
*
|
|
4902
|
-
*
|
|
5300
|
+
* Apply the currently selected audio output device to an HTMLMediaElement
|
|
5301
|
+
* (e.g. the `<audio>` or `<video>` element the consumer attached the
|
|
5302
|
+
* remote stream to). Uses `HTMLMediaElement.setSinkId` under the hood.
|
|
5303
|
+
* Returns a `Promise<boolean>`: `true` if the sink was applied,
|
|
5304
|
+
* `false` if the browser doesn't support `setSinkId` or no device is
|
|
5305
|
+
* selected.
|
|
5306
|
+
*
|
|
5307
|
+
* @example
|
|
5308
|
+
* ```ts
|
|
5309
|
+
* audioEl.srcObject = call.remoteStream;
|
|
5310
|
+
* await client.applySelectedAudioOutputDevice(audioEl);
|
|
5311
|
+
* ```
|
|
4903
5312
|
*/
|
|
4904
|
-
|
|
5313
|
+
applySelectedAudioOutputDevice(element: HTMLMediaElement): Promise<boolean>;
|
|
5314
|
+
/** Starts monitoring for media device changes (connect/disconnect). */
|
|
5315
|
+
enableDeviceMonitoring(): void;
|
|
5316
|
+
/** Stops monitoring for media device changes. */
|
|
5317
|
+
disableDeviceMonitoring(): void;
|
|
4905
5318
|
/**
|
|
4906
|
-
*
|
|
4907
|
-
*
|
|
5319
|
+
* Returns the capabilities of a media device.
|
|
5320
|
+
* @param deviceInfo - The device to query.
|
|
5321
|
+
* @returns The device capabilities, or `null` if unavailable.
|
|
4908
5322
|
*/
|
|
4909
|
-
|
|
5323
|
+
getDeviceCapabilities(deviceInfo: MediaDeviceInfo): Promise<MediaTrackCapabilities | null>;
|
|
4910
5324
|
/**
|
|
4911
|
-
*
|
|
4912
|
-
*
|
|
4913
|
-
*
|
|
4914
|
-
* Use this instead of mute/unmute for instant talk/silence transitions
|
|
4915
|
-
* because it doesn't rebuild the track.
|
|
4916
|
-
*
|
|
4917
|
-
* This method installs the pipeline but does not attach any keyboard
|
|
4918
|
-
* listener — consumers bind the key themselves and call
|
|
4919
|
-
* {@link setPushToTalkActive} on keydown/keyup.
|
|
5325
|
+
* Checks whether a device is still available and usable.
|
|
5326
|
+
* @param deviceInfo - The device to validate, or `null`.
|
|
5327
|
+
* @returns `true` if the device is valid and available. Returns `false` for `null`, audio output devices, or unavailable devices.
|
|
4920
5328
|
*/
|
|
4921
|
-
|
|
4922
|
-
/**
|
|
4923
|
-
|
|
5329
|
+
isValidDevice(deviceInfo: MediaDeviceInfo | null): Promise<boolean>;
|
|
5330
|
+
/** Injects a storage manager into the device controller for persistence. */
|
|
5331
|
+
setStorageManager(storageManager: StorageManager): void;
|
|
5332
|
+
/** Clears all device state and re-enumerates. */
|
|
5333
|
+
clearDeviceState(): Promise<void>;
|
|
5334
|
+
/** Forces a device re-enumeration. */
|
|
5335
|
+
enumerateDevices(): Promise<void>;
|
|
5336
|
+
/** Disables audio input (receive-only mode). No audio track will be acquired. */
|
|
5337
|
+
disableAudioInput(): void;
|
|
5338
|
+
/** Re-enables audio input, restoring the last selection or auto-selecting. */
|
|
5339
|
+
enableAudioInput(): void;
|
|
5340
|
+
/** Disables video input (receive-only mode). No video track will be acquired. */
|
|
5341
|
+
disableVideoInput(): void;
|
|
5342
|
+
/** Re-enables video input, restoring the last selection or auto-selecting. */
|
|
5343
|
+
enableVideoInput(): void;
|
|
5344
|
+
/** Observable that emits `true` when video input is disabled (receive-only). */
|
|
5345
|
+
get videoInputDisabled$(): Observable<boolean>;
|
|
5346
|
+
/** Observable that emits `true` when audio input is disabled (receive-only). */
|
|
5347
|
+
get audioInputDisabled$(): Observable<boolean>;
|
|
5348
|
+
/** Whether video input is currently disabled. */
|
|
5349
|
+
get videoInputDisabled(): boolean;
|
|
5350
|
+
/** Whether audio input is currently disabled. */
|
|
5351
|
+
get audioInputDisabled(): boolean;
|
|
4924
5352
|
/**
|
|
4925
|
-
*
|
|
4926
|
-
*
|
|
5353
|
+
* Triggers the browser's media permission dialog and captures the user's device selections.
|
|
5354
|
+
*
|
|
5355
|
+
* @param options - Which permissions to request.
|
|
5356
|
+
* @param options.audio - Whether to request audio permission.
|
|
5357
|
+
* @param options.video - Whether to request video permission.
|
|
5358
|
+
* @returns The permission result with selected devices.
|
|
4927
5359
|
*/
|
|
4928
|
-
|
|
5360
|
+
requestMediaPermissions(options?: {
|
|
5361
|
+
audio?: boolean;
|
|
5362
|
+
video?: boolean;
|
|
5363
|
+
}): Promise<PermissionResult>;
|
|
4929
5364
|
/**
|
|
4930
|
-
*
|
|
4931
|
-
*
|
|
4932
|
-
*
|
|
4933
|
-
*
|
|
4934
|
-
* pipeline if one is active.
|
|
5365
|
+
* Clears all SDK-persisted state and resets to defaults.
|
|
5366
|
+
*
|
|
5367
|
+
* This clears device preferences, device history, authorization state,
|
|
5368
|
+
* attached call IDs, and all SDK storage keys, then re-enumerates devices.
|
|
4935
5369
|
*/
|
|
4936
|
-
|
|
4937
|
-
/** Toggle browser noise suppression on the local mic at runtime. */
|
|
4938
|
-
setNoiseSuppression(enabled: boolean): Promise<void>;
|
|
4939
|
-
/** Toggle browser automatic gain control on the local mic at runtime. */
|
|
4940
|
-
setAutoGainControl(enabled: boolean): Promise<void>;
|
|
5370
|
+
resetToDefaults(): Promise<void>;
|
|
4941
5371
|
/**
|
|
4942
|
-
*
|
|
4943
|
-
* delivers a single mixed audio stream for all remote participants — this
|
|
4944
|
-
* meter reports that mix. Per-participant audio is not available client-side.
|
|
5372
|
+
* Destroys the client, clearing timers and releasing all resources.
|
|
4945
5373
|
*
|
|
4946
|
-
*
|
|
4947
|
-
*
|
|
4948
|
-
*
|
|
5374
|
+
* Intentionally destroying the client ends its session: the resume state
|
|
5375
|
+
* (`authorization_state` + protocol) and the attach records are both
|
|
5376
|
+
* cleared. Credentials and device preferences are preserved — use
|
|
5377
|
+
* {@link resetToDefaults} for a full wipe. To temporarily stop receiving
|
|
5378
|
+
* inbound calls while keeping the session alive, use `unregister()`.
|
|
4949
5379
|
*/
|
|
4950
|
-
get remoteAudioLevel$(): Observable<number>;
|
|
4951
|
-
/** Destroys the call, releasing all resources and subscriptions. */
|
|
4952
5380
|
destroy(): void;
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
5381
|
+
}
|
|
5382
|
+
//#endregion
|
|
5383
|
+
//#region src/utils/embeddableCall.d.ts
|
|
5384
|
+
/** Options for {@link embeddableCall}. */
|
|
5385
|
+
interface EmbeddableCallOptions {
|
|
5386
|
+
/** Destination URI to call. */
|
|
5387
|
+
to: string;
|
|
5388
|
+
/** Embed token for authentication. */
|
|
5389
|
+
embedToken: string;
|
|
5390
|
+
/** SignalWire host URL. */
|
|
5391
|
+
host: string;
|
|
5392
|
+
}
|
|
5393
|
+
/**
|
|
5394
|
+
* Creates a call using an embed token for simple, embeddable integrations.
|
|
5395
|
+
*
|
|
5396
|
+
* Handles client creation, authentication, and dialing in a single call.
|
|
5397
|
+
*
|
|
5398
|
+
* @param options - Embed token, host, and destination.
|
|
5399
|
+
* @returns The created {@link Call} instance.
|
|
5400
|
+
*/
|
|
5401
|
+
declare function embeddableCall(options: EmbeddableCallOptions): Promise<Call>;
|
|
5402
|
+
//#endregion
|
|
5403
|
+
//#region src/dependencies/StaticCredentialProvider.d.ts
|
|
5404
|
+
/**
|
|
5405
|
+
* Credential provider that returns a fixed set of credentials.
|
|
5406
|
+
*
|
|
5407
|
+
* Use when the token is already available (e.g. from a backend endpoint).
|
|
5408
|
+
*
|
|
5409
|
+
* @example
|
|
5410
|
+
* ```ts
|
|
5411
|
+
* const provider = new StaticCredentialProvider({ token: 'my-sat-token' });
|
|
5412
|
+
* const client = new SignalWire(provider);
|
|
5413
|
+
* ```
|
|
5414
|
+
*/
|
|
5415
|
+
declare class StaticCredentialProvider implements CredentialProvider {
|
|
5416
|
+
private credentials;
|
|
5417
|
+
constructor(credentials: SDKCredential);
|
|
5418
|
+
/** Returns the static credentials. */
|
|
5419
|
+
authenticate(): Promise<SDKCredential>;
|
|
5420
|
+
}
|
|
5421
|
+
//#endregion
|
|
5422
|
+
//#region src/dependencies/EmbedTokenCredentialProvider.d.ts
|
|
5423
|
+
/** Credential provider that exchanges an embed token for a SAT via the host's token endpoint. */
|
|
5424
|
+
declare class EmbedTokenCredentialProvider implements CredentialProvider {
|
|
5425
|
+
private host;
|
|
5426
|
+
private embedToken;
|
|
5427
|
+
constructor(host: string, embedToken: string);
|
|
5428
|
+
private fetchSAT;
|
|
5429
|
+
authenticate(): Promise<{
|
|
5430
|
+
token: string;
|
|
5431
|
+
expiry_at: number;
|
|
5432
|
+
}>;
|
|
5433
|
+
refresh(): Promise<{
|
|
5434
|
+
token: string;
|
|
5435
|
+
expiry_at: number;
|
|
5436
|
+
}>;
|
|
4960
5437
|
}
|
|
4961
5438
|
//#endregion
|
|
4962
5439
|
//#region src/index.d.ts
|
|
@@ -4971,5 +5448,5 @@ declare const version: string;
|
|
|
4971
5448
|
*/
|
|
4972
5449
|
declare const ready: boolean;
|
|
4973
5450
|
//#endregion
|
|
4974
|
-
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 CredentialNoRefreshHandlerWarning, type CredentialProvider, type CredentialRefreshFallbackReason, type CredentialRefreshFallbackWarning, 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, MediaAccessError, 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 SDKWarning, 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 };
|
|
5451
|
+
export { Address, type AddressHistory, type AudioConstraintsEvent, type AuthenticateContext, AuxiliaryLegCancelledError, AuxiliaryLegTimeoutError, 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, CallNotReadyError, type CallOptions, type CallParticipant, type CallSelfParticipant, type CallState, type CallStatus, type Capability, ClientPreferences, CollectionFetchError, type ConstraintFallbackEvent, type CredentialNoRefreshHandlerWarning, type CredentialProvider, type CredentialRefreshFallbackReason, type CredentialRefreshFallbackWarning, 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, MediaAccessError, type MediaDirection, type MediaDirections, type MediaOptions, type MediaParamsEvent, MediaTrackError, type MemberCapabilities, MessageParseError, type NodeSocketAdapter, type OnOffCapability, OverconstrainedFallbackError, Participant, ParticipantNotReadyError, 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 SDKWarning, ScreenShareAlreadyActiveError, type ScreenShareOptions, 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 };
|
|
4975
5452
|
//# sourceMappingURL=index.d.mts.map
|