@signalwire/js 4.0.0-dev-20260324190414 → 4.0.0-dev-20260401142150
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 +292 -25
- package/dist/browser.mjs.map +1 -1
- package/dist/browser.umd.js +292 -25
- package/dist/browser.umd.js.map +1 -1
- package/dist/index.cjs +292 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +381 -32
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +381 -32
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +292 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser.mjs
CHANGED
|
@@ -10167,6 +10167,7 @@ var NavigatorDeviceController = class extends Destroyable {
|
|
|
10167
10167
|
|
|
10168
10168
|
//#endregion
|
|
10169
10169
|
//#region src/dependencies/DefaultLocalStorage.ts
|
|
10170
|
+
/** Default storage implementation backed by browser `localStorage` and `sessionStorage`. */
|
|
10170
10171
|
var DefaultLocalStorage = class {
|
|
10171
10172
|
constructor() {
|
|
10172
10173
|
if (typeof localStorage === "undefined") throw new StorageNotAvailableError("localStorage");
|
|
@@ -11961,54 +11962,71 @@ var Participant = class extends Destroyable {
|
|
|
11961
11962
|
get type() {
|
|
11962
11963
|
return this._state$.value.type;
|
|
11963
11964
|
}
|
|
11965
|
+
/** Whether the participant has raised their hand. */
|
|
11964
11966
|
get handraised() {
|
|
11965
11967
|
return this._state$.value.handraised ?? false;
|
|
11966
11968
|
}
|
|
11969
|
+
/** Whether the participant is visible in the layout. */
|
|
11967
11970
|
get visible() {
|
|
11968
11971
|
return this._state$.value.visible ?? false;
|
|
11969
11972
|
}
|
|
11973
|
+
/** Whether the participant's audio is muted. */
|
|
11970
11974
|
get audioMuted() {
|
|
11971
11975
|
return this._state$.value.audio_muted ?? false;
|
|
11972
11976
|
}
|
|
11977
|
+
/** Whether the participant's video is muted. */
|
|
11973
11978
|
get videoMuted() {
|
|
11974
11979
|
return this._state$.value.video_muted ?? false;
|
|
11975
11980
|
}
|
|
11981
|
+
/** Whether the participant is deafened (incoming audio muted). */
|
|
11976
11982
|
get deaf() {
|
|
11977
11983
|
return this._state$.value.deaf ?? false;
|
|
11978
11984
|
}
|
|
11985
|
+
/** Current microphone input volume level, or `undefined` if not set. */
|
|
11979
11986
|
get inputVolume() {
|
|
11980
11987
|
return this._state$.value.input_volume;
|
|
11981
11988
|
}
|
|
11989
|
+
/** Current speaker output volume level, or `undefined` if not set. */
|
|
11982
11990
|
get outputVolume() {
|
|
11983
11991
|
return this._state$.value.output_volume;
|
|
11984
11992
|
}
|
|
11993
|
+
/** Current microphone input sensitivity level, or `undefined` if not set. */
|
|
11985
11994
|
get inputSensitivity() {
|
|
11986
11995
|
return this._state$.value.input_sensitivity;
|
|
11987
11996
|
}
|
|
11997
|
+
/** Whether echo cancellation is enabled. */
|
|
11988
11998
|
get echoCancellation() {
|
|
11989
11999
|
return this._state$.value.echo_cancellation ?? false;
|
|
11990
12000
|
}
|
|
12001
|
+
/** Whether automatic gain control is enabled. */
|
|
11991
12002
|
get autoGain() {
|
|
11992
12003
|
return this._state$.value.auto_gain ?? false;
|
|
11993
12004
|
}
|
|
12005
|
+
/** Whether noise suppression is enabled. */
|
|
11994
12006
|
get noiseSuppression() {
|
|
11995
12007
|
return this._state$.value.noise_suppression ?? false;
|
|
11996
12008
|
}
|
|
12009
|
+
/** Whether low-bitrate mode is active. */
|
|
11997
12010
|
get lowbitrate() {
|
|
11998
12011
|
return this._state$.value.lowbitrate ?? false;
|
|
11999
12012
|
}
|
|
12013
|
+
/** Whether noise reduction (denoise) is active. */
|
|
12000
12014
|
get denoise() {
|
|
12001
12015
|
return this._state$.value.denoise ?? false;
|
|
12002
12016
|
}
|
|
12017
|
+
/** Custom metadata for this participant, or `undefined` if not set. */
|
|
12003
12018
|
get meta() {
|
|
12004
12019
|
return this._state$.value.meta;
|
|
12005
12020
|
}
|
|
12021
|
+
/** Subscriber ID of this participant, or `undefined` if not available. */
|
|
12006
12022
|
get subscriberId() {
|
|
12007
12023
|
return this._state$.value.subscriber_id;
|
|
12008
12024
|
}
|
|
12025
|
+
/** Address ID of this participant, or `undefined` if not available. */
|
|
12009
12026
|
get addressId() {
|
|
12010
12027
|
return this._state$.value.address_id;
|
|
12011
12028
|
}
|
|
12029
|
+
/** Server node ID for this participant, or `undefined` if not available. */
|
|
12012
12030
|
get nodeId() {
|
|
12013
12031
|
return this._state$.value.node_id;
|
|
12014
12032
|
}
|
|
@@ -12080,15 +12098,24 @@ var Participant = class extends Destroyable {
|
|
|
12080
12098
|
async setAudioInputSensitivity(value) {
|
|
12081
12099
|
await this.executeMethod(this.id, "call.microphone.sensitivity.set", { sensitivity: value });
|
|
12082
12100
|
}
|
|
12083
|
-
/**
|
|
12101
|
+
/**
|
|
12102
|
+
* Sets the microphone input volume level.
|
|
12103
|
+
* @param value - Volume level (0-100).
|
|
12104
|
+
*/
|
|
12084
12105
|
async setAudioInputVolume(value) {
|
|
12085
12106
|
await this.executeMethod(this.id, "call.microphone.volume.set", { volume: value });
|
|
12086
12107
|
}
|
|
12087
|
-
/**
|
|
12108
|
+
/**
|
|
12109
|
+
* Sets the speaker output volume level.
|
|
12110
|
+
* @param value - Volume level (0-100).
|
|
12111
|
+
*/
|
|
12088
12112
|
async setAudioOutputVolume(value) {
|
|
12089
12113
|
await this.executeMethod(this.id, "call.speaker.volume.set", { volume: value });
|
|
12090
12114
|
}
|
|
12091
|
-
/**
|
|
12115
|
+
/**
|
|
12116
|
+
* Sets the participant's position in the video layout.
|
|
12117
|
+
* @param value - The {@link VideoPosition} to assign (e.g. `'auto'`, `'reserved-0'`).
|
|
12118
|
+
*/
|
|
12092
12119
|
async setPosition(value) {
|
|
12093
12120
|
await this.executeMethod(this.id, "call.member.position.set", { position: value });
|
|
12094
12121
|
}
|
|
@@ -12106,12 +12133,23 @@ var Participant = class extends Destroyable {
|
|
|
12106
12133
|
async end() {
|
|
12107
12134
|
await this.executeMethod(this.id, "call.end", {});
|
|
12108
12135
|
}
|
|
12136
|
+
/**
|
|
12137
|
+
* Replaces custom metadata for this participant.
|
|
12138
|
+
* @param _meta - Metadata object to set.
|
|
12139
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
12140
|
+
*/
|
|
12109
12141
|
async setMeta(_meta) {
|
|
12110
12142
|
throw new UnimplementedError();
|
|
12111
12143
|
}
|
|
12144
|
+
/**
|
|
12145
|
+
* Merges values into custom metadata (unlike {@link setMeta} which replaces).
|
|
12146
|
+
* @param _meta - Metadata to merge.
|
|
12147
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
12148
|
+
*/
|
|
12112
12149
|
async updateMeta(_meta) {
|
|
12113
12150
|
throw new UnimplementedError();
|
|
12114
12151
|
}
|
|
12152
|
+
/** Destroys the participant, releasing all subscriptions and references. */
|
|
12115
12153
|
destroy() {
|
|
12116
12154
|
this.executeMethod = void 0;
|
|
12117
12155
|
super.destroy();
|
|
@@ -12124,6 +12162,7 @@ var Participant = class extends Destroyable {
|
|
|
12124
12162
|
* and local media stream management.
|
|
12125
12163
|
*/
|
|
12126
12164
|
var SelfParticipant = class extends Participant {
|
|
12165
|
+
/** @internal */
|
|
12127
12166
|
constructor(id, executeMethod, vertoManager, deviceController) {
|
|
12128
12167
|
super(id, executeMethod, deviceController);
|
|
12129
12168
|
this.vertoManager = vertoManager;
|
|
@@ -12214,6 +12253,7 @@ var SelfParticipant = class extends Participant {
|
|
|
12214
12253
|
this.deviceController.selectAudioOutputDevice(device);
|
|
12215
12254
|
if (options.savePreference) PreferencesContainer.instance.preferredAudioOutput = device;
|
|
12216
12255
|
}
|
|
12256
|
+
/** Mutes local audio. Falls back to local device mute if the server RPC fails. */
|
|
12217
12257
|
async mute() {
|
|
12218
12258
|
try {
|
|
12219
12259
|
await super.mute();
|
|
@@ -12223,6 +12263,7 @@ var SelfParticipant = class extends Participant {
|
|
|
12223
12263
|
this.vertoManager.muteMainAudioInputDevice();
|
|
12224
12264
|
}
|
|
12225
12265
|
}
|
|
12266
|
+
/** Unmutes local audio. Falls back to local device unmute if the server RPC fails. */
|
|
12226
12267
|
async unmute() {
|
|
12227
12268
|
try {
|
|
12228
12269
|
await super.unmute();
|
|
@@ -12232,6 +12273,7 @@ var SelfParticipant = class extends Participant {
|
|
|
12232
12273
|
await this.vertoManager.unmuteMainAudioInputDevice();
|
|
12233
12274
|
}
|
|
12234
12275
|
}
|
|
12276
|
+
/** Mutes local video. Falls back to local device mute if the server RPC fails. */
|
|
12235
12277
|
async muteVideo() {
|
|
12236
12278
|
try {
|
|
12237
12279
|
await super.muteVideo();
|
|
@@ -12241,6 +12283,7 @@ var SelfParticipant = class extends Participant {
|
|
|
12241
12283
|
this.vertoManager.muteMainVideoInputDevice();
|
|
12242
12284
|
}
|
|
12243
12285
|
}
|
|
12286
|
+
/** Unmutes local video. Falls back to local device unmute if the server RPC fails. */
|
|
12244
12287
|
async unmuteVideo() {
|
|
12245
12288
|
try {
|
|
12246
12289
|
await super.unmuteVideo();
|
|
@@ -12276,6 +12319,7 @@ function isJSONRPCErrorResponse(value) {
|
|
|
12276
12319
|
|
|
12277
12320
|
//#endregion
|
|
12278
12321
|
//#region src/core/RPCMessages/guards/events.guards.ts
|
|
12322
|
+
/** @internal @packageDocumentation */
|
|
12279
12323
|
/**
|
|
12280
12324
|
* Factory function to create Request-level type guards.
|
|
12281
12325
|
*/
|
|
@@ -12299,6 +12343,7 @@ const isCallUpdatedRequest = createEventRequestGuard("call.updated");
|
|
|
12299
12343
|
const isCallStateRequest = createEventRequestGuard("call.state");
|
|
12300
12344
|
const isCallPlayRequest = createEventRequestGuard("call.play");
|
|
12301
12345
|
const isCallConnectRequest = createEventRequestGuard("call.connect");
|
|
12346
|
+
const isRoomUpdatedRequest = createEventRequestGuard("room.updated");
|
|
12302
12347
|
const isMemberUpdatedRequest = createEventRequestGuard("member.updated");
|
|
12303
12348
|
const isMemberJoinedRequest = createEventRequestGuard("member.joined");
|
|
12304
12349
|
const isMemberLeftRequest = createEventRequestGuard("member.left");
|
|
@@ -12310,7 +12355,7 @@ function isSignalwireMetadata(value) {
|
|
|
12310
12355
|
return isObject(value) && hasProperty(value, "event_type") && typeof value.event_type === "string" && hasProperty(value, "params");
|
|
12311
12356
|
}
|
|
12312
12357
|
function isSignalwireCallMetadata(value) {
|
|
12313
|
-
return isSignalwireMetadata(value) && (isCallJoinedMetadata(value) || isCallLeftMetadata(value) || isCallUpdatedMetadata(value) || isCallStateMetadata(value) || isCallPlayMetadata(value) || isCallConnectMetadata(value) || isMemberUpdatedMetadata(value) || isMemberJoinedMetadata(value) || isMemberLeftMetadata(value) || isMemberTalkingMetadata(value) || isLayoutChangedMetadata(value) || isWebrtcMessageMetadata(value) || isConversationMessageMetadata(value) || isConversationMessageUpdatedMetadata(value));
|
|
12358
|
+
return isSignalwireMetadata(value) && (isCallJoinedMetadata(value) || isCallLeftMetadata(value) || isCallUpdatedMetadata(value) || isCallStateMetadata(value) || isCallPlayMetadata(value) || isCallConnectMetadata(value) || isRoomUpdatedMetadata(value) || isMemberUpdatedMetadata(value) || isMemberJoinedMetadata(value) || isMemberLeftMetadata(value) || isMemberTalkingMetadata(value) || isLayoutChangedMetadata(value) || isWebrtcMessageMetadata(value) || isConversationMessageMetadata(value) || isConversationMessageUpdatedMetadata(value));
|
|
12314
12359
|
}
|
|
12315
12360
|
const isSignalwireAuthorizationStateMetadata = createEventMetadataGuard("signalwire.authorization.state");
|
|
12316
12361
|
const isWebrtcMessageMetadata = createEventMetadataGuard("webrtc.message");
|
|
@@ -12320,6 +12365,7 @@ const isCallUpdatedMetadata = createEventMetadataGuard("call.updated");
|
|
|
12320
12365
|
const isCallStateMetadata = createEventMetadataGuard("call.state");
|
|
12321
12366
|
const isCallPlayMetadata = createEventMetadataGuard("call.play");
|
|
12322
12367
|
const isCallConnectMetadata = createEventMetadataGuard("call.connect");
|
|
12368
|
+
const isRoomUpdatedMetadata = createEventMetadataGuard("room.updated");
|
|
12323
12369
|
const isMemberUpdatedMetadata = createEventMetadataGuard("member.updated");
|
|
12324
12370
|
const isMemberJoinedMetadata = createEventMetadataGuard("member.joined");
|
|
12325
12371
|
const isMemberLeftMetadata = createEventMetadataGuard("member.left");
|
|
@@ -12455,6 +12501,7 @@ function throwOnRPCError() {
|
|
|
12455
12501
|
var import_cjs$14 = require_cjs();
|
|
12456
12502
|
const logger$15 = getLogger();
|
|
12457
12503
|
const initialSessionState = {};
|
|
12504
|
+
/** @internal */
|
|
12458
12505
|
var CallEventsManager = class extends Destroyable {
|
|
12459
12506
|
constructor(webRtcCallSession, options = {}) {
|
|
12460
12507
|
super();
|
|
@@ -12594,6 +12641,21 @@ var CallEventsManager = class extends Destroyable {
|
|
|
12594
12641
|
this._participants$.next(participants);
|
|
12595
12642
|
} else logger$15.warn(`[CallEventsManager] Received member.left event for unknown member ID: ${memberLeftEvent.member.member_id}`);
|
|
12596
12643
|
});
|
|
12644
|
+
this.subscribeTo(this.webRtcCallSession.callUpdated$, (callUpdatedEvent) => {
|
|
12645
|
+
logger$15.debug("[CallEventsManager] Handling call.updated event:", callUpdatedEvent);
|
|
12646
|
+
const roomSession = callUpdatedEvent.room_session;
|
|
12647
|
+
this._sessionState$.next({
|
|
12648
|
+
...this._sessionState$.value,
|
|
12649
|
+
recording: roomSession.recording,
|
|
12650
|
+
recordings: roomSession.recordings,
|
|
12651
|
+
streaming: roomSession.streaming,
|
|
12652
|
+
streams: roomSession.streams,
|
|
12653
|
+
playbacks: roomSession.playbacks,
|
|
12654
|
+
prioritize_handraise: roomSession.prioritize_handraise,
|
|
12655
|
+
locked: roomSession.locked,
|
|
12656
|
+
meta: roomSession.meta
|
|
12657
|
+
});
|
|
12658
|
+
});
|
|
12597
12659
|
this.subscribeTo(this.layoutChangedEvent$, (layoutChangedEvent) => {
|
|
12598
12660
|
logger$15.debug("[CallEventsManager] Handling layout.changed event:", layoutChangedEvent);
|
|
12599
12661
|
this._sessionState$.next({
|
|
@@ -14505,7 +14567,7 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
14505
14567
|
*
|
|
14506
14568
|
* @see selectAudioInputDevice
|
|
14507
14569
|
* @see selectVideoInputDevice
|
|
14508
|
-
* @param options
|
|
14570
|
+
* @param options - Media options specifying which input devices to add (defaults to audio only).
|
|
14509
14571
|
*/
|
|
14510
14572
|
async addMainInputDevices(options = { audio: true }) {
|
|
14511
14573
|
let deviceKind = void 0;
|
|
@@ -14589,7 +14651,7 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
14589
14651
|
try {
|
|
14590
14652
|
const causeParams = cause ? {
|
|
14591
14653
|
cause,
|
|
14592
|
-
|
|
14654
|
+
causeCode: VertoByeCauseCodes[cause]
|
|
14593
14655
|
} : {};
|
|
14594
14656
|
await this.executeVerto(VertoBye({
|
|
14595
14657
|
...causeParams,
|
|
@@ -14788,24 +14850,42 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14788
14850
|
get self() {
|
|
14789
14851
|
return this.callEventsManager.self;
|
|
14790
14852
|
}
|
|
14853
|
+
/** Toggles the call lock state, preventing or allowing new participants from joining. */
|
|
14791
14854
|
async toggleLock() {
|
|
14792
14855
|
const method = this.locked ? "call.unlock" : "call.lock";
|
|
14793
14856
|
await this.executeMethod(this.selfId ?? "", method, {});
|
|
14794
14857
|
}
|
|
14858
|
+
/**
|
|
14859
|
+
* Toggles the hold state of the call (pauses/resumes local media transmission).
|
|
14860
|
+
*
|
|
14861
|
+
* Distinct from {@link Participant.toggleMute} which mutes individual tracks.
|
|
14862
|
+
*/
|
|
14795
14863
|
async toggleHold() {
|
|
14796
14864
|
if (this._holdState) await this.vertoManager.unhold();
|
|
14797
14865
|
else await this.vertoManager.hold();
|
|
14798
14866
|
this._holdState = !this._holdState;
|
|
14799
14867
|
}
|
|
14868
|
+
/** @throws {UnimplementedError} Not yet implemented. Status tracked via {@link recording$}. */
|
|
14800
14869
|
async startRecording() {
|
|
14801
14870
|
throw new UnimplementedError();
|
|
14802
14871
|
}
|
|
14872
|
+
/** @throws {UnimplementedError} Not yet implemented. Status tracked via {@link streaming$}. */
|
|
14803
14873
|
async startStreaming() {
|
|
14804
14874
|
throw new UnimplementedError();
|
|
14805
14875
|
}
|
|
14876
|
+
/**
|
|
14877
|
+
* Replaces the call's custom metadata.
|
|
14878
|
+
* @param _meta - Metadata object to set.
|
|
14879
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
14880
|
+
*/
|
|
14806
14881
|
async setMeta(_meta) {
|
|
14807
14882
|
throw new UnimplementedError();
|
|
14808
14883
|
}
|
|
14884
|
+
/**
|
|
14885
|
+
* Merges values into the call's custom metadata (unlike {@link setMeta} which replaces).
|
|
14886
|
+
* @param _meta - Metadata to merge.
|
|
14887
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
14888
|
+
*/
|
|
14809
14889
|
async updateMeta(_meta) {
|
|
14810
14890
|
throw new UnimplementedError();
|
|
14811
14891
|
}
|
|
@@ -14817,7 +14897,17 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14817
14897
|
get layoutLayers() {
|
|
14818
14898
|
return this.callEventsManager.layoutLayers;
|
|
14819
14899
|
}
|
|
14820
|
-
/**
|
|
14900
|
+
/**
|
|
14901
|
+
* Executes a Verto RPC method targeting a specific participant.
|
|
14902
|
+
*
|
|
14903
|
+
* Constructs call context (node_id, call_id, member_id) and sends the RPC request.
|
|
14904
|
+
*
|
|
14905
|
+
* @param target - Target member ID string, or a {@link MemberTarget} object.
|
|
14906
|
+
* @param method - Verto method name (e.g. `'call.mute'`, `'call.member.remove'`).
|
|
14907
|
+
* @param args - Parameters for the RPC method.
|
|
14908
|
+
* @returns The RPC response.
|
|
14909
|
+
* @throws {JSONRPCError} If the RPC call returns an error.
|
|
14910
|
+
*/
|
|
14821
14911
|
async executeMethod(target, method, args) {
|
|
14822
14912
|
const params = this.buildMethodParams(target, args);
|
|
14823
14913
|
const request = buildRPCRequest({
|
|
@@ -14979,7 +15069,16 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14979
15069
|
get participantsId$() {
|
|
14980
15070
|
return this.cachedObservable("participantsId$", () => this.participants$.pipe((0, import_cjs$9.map)((participants) => participants.map((participant) => participant.id))));
|
|
14981
15071
|
}
|
|
14982
|
-
/**
|
|
15072
|
+
/**
|
|
15073
|
+
* Executes a raw JSON-RPC request on the client session.
|
|
15074
|
+
*
|
|
15075
|
+
* Lower-level than {@link executeMethod} — allows full control over the RPC request structure.
|
|
15076
|
+
*
|
|
15077
|
+
* @param request - Complete JSON-RPC request object.
|
|
15078
|
+
* @param options - Optional RPC execution options (timeout, etc.).
|
|
15079
|
+
* @returns The RPC response.
|
|
15080
|
+
* @throws {JSONRPCError} If the RPC call returns an error response.
|
|
15081
|
+
*/
|
|
14983
15082
|
async execute(request, options) {
|
|
14984
15083
|
return this.clientSession.execute(request, options);
|
|
14985
15084
|
}
|
|
@@ -15012,17 +15111,19 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15012
15111
|
}
|
|
15013
15112
|
}
|
|
15014
15113
|
get callSessionEvents$() {
|
|
15015
|
-
return this.cachedObservable("callSessionEvents$", () => this.clientSession.signalingEvent$.pipe((0, import_cjs$9.filter)((event) => this.isCallSessionEvent(event)), (0, import_cjs$9.tap)((event) =>
|
|
15114
|
+
return this.cachedObservable("callSessionEvents$", () => this.clientSession.signalingEvent$.pipe((0, import_cjs$9.filter)((event) => this.isCallSessionEvent(event)), (0, import_cjs$9.tap)((event) => {
|
|
15115
|
+
logger$9.debug("[Call] Received call session event:", event);
|
|
15116
|
+
}), (0, import_cjs$9.takeUntil)(this.destroyed$), (0, import_cjs$9.share)()));
|
|
15016
15117
|
}
|
|
15017
15118
|
/** Observable of call-updated events. */
|
|
15018
15119
|
get callUpdated$() {
|
|
15019
15120
|
return this.publicCachedObservable("callUpdated$", () => this.callSessionEvents$.pipe(filterAs(isCallUpdatedMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
15020
15121
|
}
|
|
15021
|
-
/** Observable of member-joined events. */
|
|
15122
|
+
/** Observable of member-joined events, emitted when a remote participant joins the call. */
|
|
15022
15123
|
get memberJoined$() {
|
|
15023
15124
|
return this.publicCachedObservable("memberJoined$", () => this.callSessionEvents$.pipe(filterAs(isMemberJoinedMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
15024
15125
|
}
|
|
15025
|
-
/** Observable of member-left events. */
|
|
15126
|
+
/** Observable of member-left events, emitted when a participant leaves the call. */
|
|
15026
15127
|
get memberLeft$() {
|
|
15027
15128
|
return this.publicCachedObservable("memberLeft$", () => this.callSessionEvents$.pipe(filterAs(isMemberLeftMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
15028
15129
|
}
|
|
@@ -15062,7 +15163,17 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15062
15163
|
get layoutEvent$() {
|
|
15063
15164
|
return this.cachedObservable("layoutEvent$", () => this.callEvent$.pipe(filterAs(isLayoutChangedMetadata, "params")));
|
|
15064
15165
|
}
|
|
15065
|
-
/**
|
|
15166
|
+
/**
|
|
15167
|
+
* Hangs up the call and releases all resources.
|
|
15168
|
+
*
|
|
15169
|
+
* Sends a Verto `bye` to the server, transitions status to `'disconnecting'`,
|
|
15170
|
+
* then destroys the call. After this, the call instance is no longer usable.
|
|
15171
|
+
*
|
|
15172
|
+
* @example
|
|
15173
|
+
* ```ts
|
|
15174
|
+
* await call.hangup();
|
|
15175
|
+
* ```
|
|
15176
|
+
*/
|
|
15066
15177
|
async hangup() {
|
|
15067
15178
|
this._status$.next("disconnecting");
|
|
15068
15179
|
try {
|
|
@@ -15071,11 +15182,35 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15071
15182
|
this.destroy();
|
|
15072
15183
|
}
|
|
15073
15184
|
}
|
|
15074
|
-
/**
|
|
15185
|
+
/**
|
|
15186
|
+
* Sends DTMF digits on the call.
|
|
15187
|
+
*
|
|
15188
|
+
* @param dtmf - The digit string to send (e.g. `'1234#'`).
|
|
15189
|
+
*
|
|
15190
|
+
* @example
|
|
15191
|
+
* ```ts
|
|
15192
|
+
* await call.sendDigits('1234#');
|
|
15193
|
+
* ```
|
|
15194
|
+
*/
|
|
15075
15195
|
async sendDigits(dtmf) {
|
|
15076
15196
|
return this.vertoManager.sendDigits(dtmf);
|
|
15077
15197
|
}
|
|
15078
|
-
/**
|
|
15198
|
+
/**
|
|
15199
|
+
* Accepts an inbound call, optionally overriding media options for the answer.
|
|
15200
|
+
*
|
|
15201
|
+
* @param options - Optional media constraints for the answer (audio/video).
|
|
15202
|
+
*
|
|
15203
|
+
* @example
|
|
15204
|
+
* ```ts
|
|
15205
|
+
* // Accept with defaults
|
|
15206
|
+
* call.answer();
|
|
15207
|
+
*
|
|
15208
|
+
* // Accept audio-only
|
|
15209
|
+
* call.answer({ audio: true, video: false });
|
|
15210
|
+
* ```
|
|
15211
|
+
* @see {@link reject} to decline the call instead.
|
|
15212
|
+
* @see {@link answered$} to observe the acceptance state.
|
|
15213
|
+
*/
|
|
15079
15214
|
answer(options) {
|
|
15080
15215
|
this._answerMediaOptions = options;
|
|
15081
15216
|
this._answered$.next(true);
|
|
@@ -15084,7 +15219,12 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15084
15219
|
get answerMediaOptions() {
|
|
15085
15220
|
return this._answerMediaOptions;
|
|
15086
15221
|
}
|
|
15087
|
-
/**
|
|
15222
|
+
/**
|
|
15223
|
+
* Rejects an inbound call, preventing media negotiation.
|
|
15224
|
+
*
|
|
15225
|
+
* @see {@link answer} to accept the call instead.
|
|
15226
|
+
* @see {@link answered$} to observe the rejection state.
|
|
15227
|
+
*/
|
|
15088
15228
|
reject() {
|
|
15089
15229
|
this._answered$.next(false);
|
|
15090
15230
|
}
|
|
@@ -15094,8 +15234,17 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15094
15234
|
}
|
|
15095
15235
|
/**
|
|
15096
15236
|
* Sets the call layout and participant positions.
|
|
15237
|
+
*
|
|
15097
15238
|
* @param layout - Layout name (must be one of {@link layouts}).
|
|
15098
|
-
* @param positions - Map of member IDs to
|
|
15239
|
+
* @param positions - Map of member IDs to {@link VideoPosition} values.
|
|
15240
|
+
* @throws {InvalidParams} If the layout is not in the available {@link layouts}.
|
|
15241
|
+
*
|
|
15242
|
+
* @example
|
|
15243
|
+
* ```ts
|
|
15244
|
+
* await call.setLayout('grid-responsive', {
|
|
15245
|
+
* [participantId]: 'reserved-0',
|
|
15246
|
+
* });
|
|
15247
|
+
* ```
|
|
15099
15248
|
*/
|
|
15100
15249
|
async setLayout(layout, positions) {
|
|
15101
15250
|
if (!this.layouts.includes(layout)) throw new InvalidParams(`Layout ${layout} is not available in the current call layouts: ${this.layouts.join(", ")}`);
|
|
@@ -15105,7 +15254,12 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15105
15254
|
positions
|
|
15106
15255
|
});
|
|
15107
15256
|
}
|
|
15108
|
-
/**
|
|
15257
|
+
/**
|
|
15258
|
+
* Transfers the call to another destination.
|
|
15259
|
+
*
|
|
15260
|
+
* @param options - Transfer configuration including the target destination.
|
|
15261
|
+
* @see {@link status$} to observe the transfer progress.
|
|
15262
|
+
*/
|
|
15109
15263
|
async transfer(options) {
|
|
15110
15264
|
return this.vertoManager.transfer(options);
|
|
15111
15265
|
}
|
|
@@ -15466,11 +15620,28 @@ var Address = class extends Destroyable {
|
|
|
15466
15620
|
get locked$() {
|
|
15467
15621
|
return this.cachedObservable("locked$", () => this._state$.pipe(filterNull(), (0, import_cjs$7.shareReplay)(1), (0, import_cjs$7.map)((state) => state.locked), (0, import_cjs$7.takeUntil)(this.destroyed$)));
|
|
15468
15622
|
}
|
|
15469
|
-
/**
|
|
15623
|
+
/**
|
|
15624
|
+
* Sends a text message to this address.
|
|
15625
|
+
*
|
|
15626
|
+
* @param text - The message text to send.
|
|
15627
|
+
*
|
|
15628
|
+
* @example
|
|
15629
|
+
* ```ts
|
|
15630
|
+
* await address.sendText('Hello!');
|
|
15631
|
+
* ```
|
|
15632
|
+
*/
|
|
15470
15633
|
async sendText(text) {
|
|
15471
15634
|
return this.conversationManager.sendText(text, this.id);
|
|
15472
15635
|
}
|
|
15473
|
-
/**
|
|
15636
|
+
/**
|
|
15637
|
+
* Collection of text messages for this address, with pagination support.
|
|
15638
|
+
*
|
|
15639
|
+
* Returns `undefined` until {@link textMessages$} has been subscribed to (lazy-loaded).
|
|
15640
|
+
* Filters to `'chat'` subtype messages from the conversation.
|
|
15641
|
+
*
|
|
15642
|
+
* @see {@link textMessages$} to trigger lazy loading.
|
|
15643
|
+
* @see {@link sendText} to send a new message.
|
|
15644
|
+
*/
|
|
15474
15645
|
get textMessage() {
|
|
15475
15646
|
if (!this._conversationMessages) return;
|
|
15476
15647
|
this._textMessages$ = this._textMessages$ ?? new EntityCollectionTransformed(this._conversationMessages, (item) => item.subtype === "chat", (item) => ({
|
|
@@ -15481,7 +15652,14 @@ var Address = class extends Destroyable {
|
|
|
15481
15652
|
}));
|
|
15482
15653
|
return this._textMessages$;
|
|
15483
15654
|
}
|
|
15484
|
-
/**
|
|
15655
|
+
/**
|
|
15656
|
+
* Collection of call history entries for this address, with pagination support.
|
|
15657
|
+
*
|
|
15658
|
+
* Returns `undefined` until {@link history$} has been subscribed to (lazy-loaded).
|
|
15659
|
+
* Filters to `'log'` subtype messages including kind, status, start/end times.
|
|
15660
|
+
*
|
|
15661
|
+
* @see {@link history$} to trigger lazy loading.
|
|
15662
|
+
*/
|
|
15485
15663
|
get history() {
|
|
15486
15664
|
if (!this._conversationMessages) return;
|
|
15487
15665
|
this._history$ = this._history$ ?? new EntityCollectionTransformed(this._conversationMessages, (item) => item.subtype === "log", (item) => ({
|
|
@@ -16071,11 +16249,18 @@ var AddressFetcher = class extends Fetcher {
|
|
|
16071
16249
|
logger$4.error("Failed to fetch addresses");
|
|
16072
16250
|
}
|
|
16073
16251
|
};
|
|
16252
|
+
/** Collection of address states with reactive updates and pagination. */
|
|
16074
16253
|
var AddressStateCollection = class extends EntityCollection {
|
|
16075
16254
|
constructor(update$, http, onError) {
|
|
16076
16255
|
super(new AddressFetcher(http), update$, onError);
|
|
16077
16256
|
}
|
|
16078
16257
|
};
|
|
16258
|
+
/**
|
|
16259
|
+
* Manages the directory of {@link Address} entries with paginated loading.
|
|
16260
|
+
*
|
|
16261
|
+
* Implements the {@link Directory} interface and provides reactive access to
|
|
16262
|
+
* addresses via observables, along with pagination and lookup methods.
|
|
16263
|
+
*/
|
|
16079
16264
|
var DirectoryManager = class extends Destroyable {
|
|
16080
16265
|
constructor(http, clientSession, conversationManager, onError) {
|
|
16081
16266
|
super();
|
|
@@ -16100,6 +16285,7 @@ var DirectoryManager = class extends Destroyable {
|
|
|
16100
16285
|
this._statesCollection = new AddressStateCollection(clientSession.signalingEvent$.pipe(filterAs(isConversationMessageUpdatedMetadata, "params"), (0, import_cjs$2.map)((_) => ({}))), this.http, this.onError);
|
|
16101
16286
|
this.initSubscriptions();
|
|
16102
16287
|
}
|
|
16288
|
+
/** Whether addresses are currently being loaded from the server. */
|
|
16103
16289
|
get loading() {
|
|
16104
16290
|
return this._statesCollection.loading;
|
|
16105
16291
|
}
|
|
@@ -16113,28 +16299,57 @@ var DirectoryManager = class extends Destroyable {
|
|
|
16113
16299
|
}
|
|
16114
16300
|
});
|
|
16115
16301
|
}
|
|
16302
|
+
/** Observable stream of all addresses in the directory. */
|
|
16116
16303
|
get addresses$() {
|
|
16117
16304
|
return this._addresses$.asObservable();
|
|
16118
16305
|
}
|
|
16306
|
+
/** Current snapshot of all loaded addresses. */
|
|
16119
16307
|
get addresses() {
|
|
16120
16308
|
return this._addresses$.value;
|
|
16121
16309
|
}
|
|
16310
|
+
/** Observable indicating whether more addresses can be loaded. */
|
|
16122
16311
|
get hasMore$() {
|
|
16123
16312
|
return this._statesCollection.hasMore$;
|
|
16124
16313
|
}
|
|
16314
|
+
/** Observable of the current loading state. */
|
|
16125
16315
|
get loading$() {
|
|
16126
16316
|
return this._statesCollection.loading$;
|
|
16127
16317
|
}
|
|
16318
|
+
/**
|
|
16319
|
+
* Loads the next page of addresses from the server.
|
|
16320
|
+
*
|
|
16321
|
+
* No-op if {@link hasMore$} is `false`. Loading state is observable via {@link loading$}.
|
|
16322
|
+
* New addresses are appended to {@link addresses$} when the page loads.
|
|
16323
|
+
*/
|
|
16128
16324
|
loadMore() {
|
|
16129
16325
|
if (this._statesCollection.hasMore) this._statesCollection.loadMore();
|
|
16130
16326
|
}
|
|
16327
|
+
/**
|
|
16328
|
+
* Returns a reactive observable for a specific address by ID.
|
|
16329
|
+
* @param id - The address ID to observe.
|
|
16330
|
+
* @returns An observable of the address, or `undefined` if not found.
|
|
16331
|
+
*/
|
|
16131
16332
|
get$(id) {
|
|
16132
16333
|
if (!this._observableRegistry.has(id)) this.addNewAddress(id);
|
|
16133
16334
|
return this._observableRegistry.get(id);
|
|
16134
16335
|
}
|
|
16336
|
+
/**
|
|
16337
|
+
* Returns an address by ID from the local cache.
|
|
16338
|
+
* @param addressId - The address ID to look up.
|
|
16339
|
+
* @returns The address, or `undefined` if not found.
|
|
16340
|
+
*/
|
|
16135
16341
|
get(addressId) {
|
|
16136
16342
|
return this._addressesInstances.get(addressId);
|
|
16137
16343
|
}
|
|
16344
|
+
/**
|
|
16345
|
+
* Finds an address ID by its resource name (URI).
|
|
16346
|
+
*
|
|
16347
|
+
* Searches locally loaded addresses first, then queries the server if not found.
|
|
16348
|
+
* The resource name is the {@link Address.name} identifier, distinct from display name.
|
|
16349
|
+
*
|
|
16350
|
+
* @param name - The resource name to search for (exact match, e.g. `'/public/conference'`).
|
|
16351
|
+
* @returns The address ID, or `undefined` if no match is found locally or on server.
|
|
16352
|
+
*/
|
|
16138
16353
|
async findAddressIdByURI(name) {
|
|
16139
16354
|
let addressId = this._addressesInstances.values().find((addr) => addr.name === name)?.id;
|
|
16140
16355
|
if (!addressId) {
|
|
@@ -16569,6 +16784,12 @@ const buildOptionsFromDestination = (destination) => {
|
|
|
16569
16784
|
* ```
|
|
16570
16785
|
*/
|
|
16571
16786
|
var SignalWire = class extends Destroyable {
|
|
16787
|
+
/**
|
|
16788
|
+
* Creates a new SignalWire client and begins connecting.
|
|
16789
|
+
*
|
|
16790
|
+
* @param credentialProvider - Provider that supplies authentication credentials.
|
|
16791
|
+
* @param options - Configuration options (connection, device monitoring, preferences).
|
|
16792
|
+
*/
|
|
16572
16793
|
constructor(credentialProvider, options = {}) {
|
|
16573
16794
|
super();
|
|
16574
16795
|
this.preferences = new ClientPreferences();
|
|
@@ -16802,7 +17023,12 @@ var SignalWire = class extends Destroyable {
|
|
|
16802
17023
|
get errors$() {
|
|
16803
17024
|
return this.deferEmission(this._errors$.asObservable());
|
|
16804
17025
|
}
|
|
16805
|
-
/**
|
|
17026
|
+
/**
|
|
17027
|
+
* Disconnects the WebSocket and tears down the current session.
|
|
17028
|
+
*
|
|
17029
|
+
* The client can be reconnected by calling {@link connect} again,
|
|
17030
|
+
* which creates a fresh transport and session.
|
|
17031
|
+
*/
|
|
16806
17032
|
async disconnect() {
|
|
16807
17033
|
await this._clientSession.disconnect();
|
|
16808
17034
|
this._clientSession.destroy();
|
|
@@ -16811,7 +17037,14 @@ var SignalWire = class extends Destroyable {
|
|
|
16811
17037
|
async waitAuthentication() {
|
|
16812
17038
|
await (0, import_cjs.firstValueFrom)(this.ready$.pipe((0, import_cjs.filter)((ready$1) => ready$1 === true)));
|
|
16813
17039
|
}
|
|
16814
|
-
/**
|
|
17040
|
+
/**
|
|
17041
|
+
* Registers the subscriber as online to receive inbound calls and events.
|
|
17042
|
+
*
|
|
17043
|
+
* Waits for authentication to complete before sending the registration.
|
|
17044
|
+
* If the initial attempt fails, reauthentication is attempted automatically.
|
|
17045
|
+
*
|
|
17046
|
+
* @throws {InvalidCredentialsError} If registration and reauthentication both fail.
|
|
17047
|
+
*/
|
|
16815
17048
|
async register() {
|
|
16816
17049
|
try {
|
|
16817
17050
|
await this.waitAuthentication();
|
|
@@ -16839,7 +17072,11 @@ var SignalWire = class extends Destroyable {
|
|
|
16839
17072
|
throw error;
|
|
16840
17073
|
}
|
|
16841
17074
|
}
|
|
16842
|
-
/**
|
|
17075
|
+
/**
|
|
17076
|
+
* Unregisters the subscriber, going offline for inbound calls.
|
|
17077
|
+
*
|
|
17078
|
+
* The WebSocket connection remains open; use {@link disconnect} to fully close it.
|
|
17079
|
+
*/
|
|
16843
17080
|
async unregister() {
|
|
16844
17081
|
try {
|
|
16845
17082
|
await this._transport.execute(RPCExecute({
|
|
@@ -16855,9 +17092,27 @@ var SignalWire = class extends Destroyable {
|
|
|
16855
17092
|
}
|
|
16856
17093
|
/**
|
|
16857
17094
|
* Places an outbound call to the given destination.
|
|
16858
|
-
*
|
|
16859
|
-
*
|
|
17095
|
+
*
|
|
17096
|
+
* Waits for authentication before dialing. Media options are merged from
|
|
17097
|
+
* saved preferences, destination query parameters (e.g. `?channel=video`),
|
|
17098
|
+
* and the provided `options` (highest priority).
|
|
17099
|
+
*
|
|
17100
|
+
* Returns a {@link Call} in `'ringing'` state. Subscribe to {@link Call.status$}
|
|
17101
|
+
* to track progression through `'connected'` → `'disconnected'`.
|
|
17102
|
+
*
|
|
17103
|
+
* @param destination - Address URI string (e.g. `'/public/my-room'`) or {@link Address} instance.
|
|
17104
|
+
* @param options - Media and dial options (audio/video, device constraints). Overrides defaults.
|
|
16860
17105
|
* @returns The created {@link Call} instance.
|
|
17106
|
+
* @throws {Error} If authentication is not complete or call creation fails.
|
|
17107
|
+
*
|
|
17108
|
+
* @example
|
|
17109
|
+
* ```ts
|
|
17110
|
+
* const call = await client.dial('/public/conference', {
|
|
17111
|
+
* audio: true,
|
|
17112
|
+
* video: true,
|
|
17113
|
+
* });
|
|
17114
|
+
* call.status$.subscribe(status => console.log('Call:', status));
|
|
17115
|
+
* ```
|
|
16861
17116
|
*/
|
|
16862
17117
|
async dial(destination, options = {}) {
|
|
16863
17118
|
const computed_options = {
|
|
@@ -16953,12 +17208,23 @@ var SignalWire = class extends Destroyable {
|
|
|
16953
17208
|
disableDeviceMonitoring() {
|
|
16954
17209
|
this._deviceController.disableDeviceMonitoring();
|
|
16955
17210
|
}
|
|
17211
|
+
/**
|
|
17212
|
+
* Returns the capabilities of a media device.
|
|
17213
|
+
* @param deviceInfo - The device to query.
|
|
17214
|
+
* @returns The device capabilities, or `null` if unavailable.
|
|
17215
|
+
*/
|
|
16956
17216
|
async getDeviceCapabilities(deviceInfo) {
|
|
16957
17217
|
return this._deviceController.getDeviceCapabilities(deviceInfo);
|
|
16958
17218
|
}
|
|
17219
|
+
/**
|
|
17220
|
+
* Checks whether a device is still available and usable.
|
|
17221
|
+
* @param deviceInfo - The device to validate, or `null`.
|
|
17222
|
+
* @returns `true` if the device is valid and available. Returns `false` for `null`, audio output devices, or unavailable devices.
|
|
17223
|
+
*/
|
|
16959
17224
|
async isValidDevice(deviceInfo) {
|
|
16960
17225
|
return this._deviceController.isValidDevice(deviceInfo);
|
|
16961
17226
|
}
|
|
17227
|
+
/** Destroys the client, clearing timers and releasing all resources. */
|
|
16962
17228
|
destroy() {
|
|
16963
17229
|
if (this._refreshTimerId) {
|
|
16964
17230
|
clearTimeout(this._refreshTimerId);
|
|
@@ -16971,6 +17237,7 @@ var SignalWire = class extends Destroyable {
|
|
|
16971
17237
|
//#endregion
|
|
16972
17238
|
//#region src/dependencies/EmbedTokenCredentialProvider.ts
|
|
16973
17239
|
const logger = getLogger();
|
|
17240
|
+
/** Credential provider that exchanges an embed token for a SAT via the host's token endpoint. */
|
|
16974
17241
|
var EmbedTokenCredentialProvider = class {
|
|
16975
17242
|
constructor(host, embedToken) {
|
|
16976
17243
|
this.host = host;
|