@signalwire/js 4.0.0-dev-20260318131609 → 4.0.0-dev-20260318135307
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 +104 -73
- package/dist/browser.mjs.map +1 -1
- package/dist/browser.umd.js +104 -73
- package/dist/browser.umd.js.map +1 -1
- package/dist/index.cjs +93 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +76 -43
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +76 -43
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +94 -64
- package/dist/index.mjs.map +1 -1
- package/dist/operators/index.cjs +1 -1
- package/dist/operators/index.mjs +1 -1
- package/dist/{operators-BI5Gskex.mjs → operators-C8Tqm86j.mjs} +3 -2
- package/dist/{operators-BI5Gskex.mjs.map → operators-C8Tqm86j.mjs.map} +1 -1
- package/dist/{operators-DJmUGfZo.cjs → operators-CJEML6aa.cjs} +3 -2
- package/dist/{operators-DJmUGfZo.cjs.map → operators-CJEML6aa.cjs.map} +1 -1
- package/package.json +1 -1
package/dist/browser.mjs
CHANGED
|
@@ -3107,7 +3107,7 @@ var require_throwError = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3107
3107
|
exports.throwError = void 0;
|
|
3108
3108
|
var Observable_1$18 = require_Observable();
|
|
3109
3109
|
var isFunction_1$14 = require_isFunction();
|
|
3110
|
-
function throwError(errorOrErrorFactory, scheduler) {
|
|
3110
|
+
function throwError$1(errorOrErrorFactory, scheduler) {
|
|
3111
3111
|
var errorFactory = isFunction_1$14.isFunction(errorOrErrorFactory) ? errorOrErrorFactory : function() {
|
|
3112
3112
|
return errorOrErrorFactory;
|
|
3113
3113
|
};
|
|
@@ -3118,7 +3118,7 @@ var require_throwError = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3118
3118
|
return scheduler.schedule(init, 0, subscriber);
|
|
3119
3119
|
} : init);
|
|
3120
3120
|
}
|
|
3121
|
-
exports.throwError = throwError;
|
|
3121
|
+
exports.throwError = throwError$1;
|
|
3122
3122
|
}));
|
|
3123
3123
|
|
|
3124
3124
|
//#endregion
|
|
@@ -4327,13 +4327,13 @@ var require_race$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4327
4327
|
var innerFrom_1$28 = require_innerFrom();
|
|
4328
4328
|
var argsOrArgArray_1$4 = require_argsOrArgArray();
|
|
4329
4329
|
var OperatorSubscriber_1$48 = require_OperatorSubscriber();
|
|
4330
|
-
function race$
|
|
4330
|
+
function race$4() {
|
|
4331
4331
|
var sources = [];
|
|
4332
4332
|
for (var _i = 0; _i < arguments.length; _i++) sources[_i] = arguments[_i];
|
|
4333
4333
|
sources = argsOrArgArray_1$4.argsOrArgArray(sources);
|
|
4334
4334
|
return sources.length === 1 ? innerFrom_1$28.innerFrom(sources[0]) : new Observable_1$6.Observable(raceInit(sources));
|
|
4335
4335
|
}
|
|
4336
|
-
exports.race = race$
|
|
4336
|
+
exports.race = race$4;
|
|
4337
4337
|
function raceInit(sources) {
|
|
4338
4338
|
return function(subscriber) {
|
|
4339
4339
|
var subscriptions = [];
|
|
@@ -5470,7 +5470,7 @@ var require_distinctUntilChanged = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5470
5470
|
var identity_1$10 = require_identity();
|
|
5471
5471
|
var lift_1$42 = require_lift();
|
|
5472
5472
|
var OperatorSubscriber_1$31 = require_OperatorSubscriber();
|
|
5473
|
-
function distinctUntilChanged$
|
|
5473
|
+
function distinctUntilChanged$6(comparator, keySelector) {
|
|
5474
5474
|
if (keySelector === void 0) keySelector = identity_1$10.identity;
|
|
5475
5475
|
comparator = comparator !== null && comparator !== void 0 ? comparator : defaultCompare;
|
|
5476
5476
|
return lift_1$42.operate(function(source, subscriber) {
|
|
@@ -5486,7 +5486,7 @@ var require_distinctUntilChanged = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5486
5486
|
}));
|
|
5487
5487
|
});
|
|
5488
5488
|
}
|
|
5489
|
-
exports.distinctUntilChanged = distinctUntilChanged$
|
|
5489
|
+
exports.distinctUntilChanged = distinctUntilChanged$6;
|
|
5490
5490
|
function defaultCompare(a, b) {
|
|
5491
5491
|
return a === b;
|
|
5492
5492
|
}
|
|
@@ -6934,7 +6934,7 @@ var require_switchMap = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6934
6934
|
var innerFrom_1$6 = require_innerFrom();
|
|
6935
6935
|
var lift_1$13 = require_lift();
|
|
6936
6936
|
var OperatorSubscriber_1$11 = require_OperatorSubscriber();
|
|
6937
|
-
function switchMap$
|
|
6937
|
+
function switchMap$4(project, resultSelector) {
|
|
6938
6938
|
return lift_1$13.operate(function(source, subscriber) {
|
|
6939
6939
|
var innerSubscriber = null;
|
|
6940
6940
|
var index = 0;
|
|
@@ -6958,7 +6958,7 @@ var require_switchMap = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6958
6958
|
}));
|
|
6959
6959
|
});
|
|
6960
6960
|
}
|
|
6961
|
-
exports.switchMap = switchMap$
|
|
6961
|
+
exports.switchMap = switchMap$4;
|
|
6962
6962
|
}));
|
|
6963
6963
|
|
|
6964
6964
|
//#endregion
|
|
@@ -9104,13 +9104,14 @@ var DependencyError = class extends Error {
|
|
|
9104
9104
|
}
|
|
9105
9105
|
};
|
|
9106
9106
|
var CallCreateError = class extends Error {
|
|
9107
|
-
constructor(message, error = null, options) {
|
|
9107
|
+
constructor(message, error = null, direction = "outbound", options) {
|
|
9108
9108
|
super(message, {
|
|
9109
9109
|
...options,
|
|
9110
9110
|
cause: options?.cause ?? (error instanceof Error ? error : void 0)
|
|
9111
9111
|
});
|
|
9112
9112
|
this.message = message;
|
|
9113
9113
|
this.error = error;
|
|
9114
|
+
this.direction = direction;
|
|
9114
9115
|
this.name = "CallCreateError";
|
|
9115
9116
|
}
|
|
9116
9117
|
};
|
|
@@ -9982,7 +9983,7 @@ var NavigatorDeviceController = class extends Destroyable {
|
|
|
9982
9983
|
};
|
|
9983
9984
|
this._devicesState$ = this.createBehaviorSubject(initialDevicesState);
|
|
9984
9985
|
this._selectedDevicesState$ = this.createBehaviorSubject(initialSelectedDevicesState);
|
|
9985
|
-
this._errors$ = this.
|
|
9986
|
+
this._errors$ = this.createReplaySubject(1);
|
|
9986
9987
|
this.init();
|
|
9987
9988
|
}
|
|
9988
9989
|
get selectedAudioInputDeviceConstraints() {
|
|
@@ -10724,12 +10725,12 @@ var require_race = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
10724
10725
|
exports.race = void 0;
|
|
10725
10726
|
var argsOrArgArray_1 = require_argsOrArgArray();
|
|
10726
10727
|
var raceWith_1$1 = require_raceWith();
|
|
10727
|
-
function race$
|
|
10728
|
+
function race$3() {
|
|
10728
10729
|
var args = [];
|
|
10729
10730
|
for (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];
|
|
10730
10731
|
return raceWith_1$1.raceWith.apply(void 0, __spreadArray([], __read(argsOrArgArray_1.argsOrArgArray(args))));
|
|
10731
10732
|
}
|
|
10732
|
-
exports.race = race$
|
|
10733
|
+
exports.race = race$3;
|
|
10733
10734
|
}));
|
|
10734
10735
|
|
|
10735
10736
|
//#endregion
|
|
@@ -12428,7 +12429,6 @@ var CallEventsManager = class extends Destroyable {
|
|
|
12428
12429
|
this.options = options;
|
|
12429
12430
|
this.callIds = /* @__PURE__ */ new Set();
|
|
12430
12431
|
this.roomSessionIds = /* @__PURE__ */ new Set();
|
|
12431
|
-
this._status$ = this.createBehaviorSubject("trying");
|
|
12432
12432
|
this._participants$ = this.createBehaviorSubject({});
|
|
12433
12433
|
this._self$ = this.createBehaviorSubject(null);
|
|
12434
12434
|
this._sessionState$ = this.createBehaviorSubject(initialSessionState);
|
|
@@ -12443,12 +12443,6 @@ var CallEventsManager = class extends Destroyable {
|
|
|
12443
12443
|
get self$() {
|
|
12444
12444
|
return this.cachedObservable("self$", () => this._self$.asObservable().pipe(filterNull()));
|
|
12445
12445
|
}
|
|
12446
|
-
get status$() {
|
|
12447
|
-
return this._status$.asObservable();
|
|
12448
|
-
}
|
|
12449
|
-
get status() {
|
|
12450
|
-
return this._status$.value;
|
|
12451
|
-
}
|
|
12452
12446
|
isRoomSessionIdValid(roomSessionId) {
|
|
12453
12447
|
return this.roomSessionIds.has(roomSessionId);
|
|
12454
12448
|
}
|
|
@@ -12533,7 +12527,6 @@ var CallEventsManager = class extends Destroyable {
|
|
|
12533
12527
|
callId: callJoinedEvent.call_id,
|
|
12534
12528
|
roomSessionId: callJoinedEvent.room_session_id
|
|
12535
12529
|
});
|
|
12536
|
-
this._status$.next("connected");
|
|
12537
12530
|
const sessionState = callJoinedEvent.room_session;
|
|
12538
12531
|
const { capabilities } = callJoinedEvent;
|
|
12539
12532
|
this.selfId = this.selfId ?? callJoinedEvent.member_id;
|
|
@@ -13356,7 +13349,7 @@ var RTCPeerConnectionController = class extends Destroyable {
|
|
|
13356
13349
|
this._connectionState$ = this.createReplaySubject(1);
|
|
13357
13350
|
this._signalingState$ = this.createReplaySubject(1);
|
|
13358
13351
|
this._iceGatheringState$ = this.createReplaySubject(1);
|
|
13359
|
-
this._errors$ = this.
|
|
13352
|
+
this._errors$ = this.createReplaySubject(1);
|
|
13360
13353
|
this._iceCandidates$ = this.createReplaySubject(1);
|
|
13361
13354
|
this._initialized$ = this.createReplaySubject(1);
|
|
13362
13355
|
this._remoteDescription$ = this.createReplaySubject(1);
|
|
@@ -13797,37 +13790,29 @@ var RTCPeerConnectionController = class extends Destroyable {
|
|
|
13797
13790
|
}
|
|
13798
13791
|
async setupLocalTracks() {
|
|
13799
13792
|
logger$11.debug("[RTCPeerConnectionController] Setting up local tracks/transceivers.");
|
|
13800
|
-
|
|
13801
|
-
if (
|
|
13802
|
-
|
|
13803
|
-
|
|
13804
|
-
|
|
13805
|
-
|
|
13806
|
-
|
|
13807
|
-
if (localStream) {
|
|
13808
|
-
if (this.transceiverController?.useAddStream ?? false) {
|
|
13809
|
-
logger$11.warn("[RTCPeerConnectionController] Using deprecated addStream API to add local stream.");
|
|
13810
|
-
this.peerConnection?.addStream(localStream);
|
|
13811
|
-
if (!this.isNegotiating) {
|
|
13812
|
-
logger$11.debug("[RTCPeerConnectionController] Forcing negotiationneeded after local tracks setup.");
|
|
13813
|
-
this.negotiationNeeded$.next();
|
|
13814
|
-
}
|
|
13815
|
-
return;
|
|
13793
|
+
const localStream = this.localStream ?? await this.localStreamController.buildLocalStream();
|
|
13794
|
+
if (this.transceiverController?.useAddStream ?? false) {
|
|
13795
|
+
logger$11.warn("[RTCPeerConnectionController] Using deprecated addStream API to add local stream.");
|
|
13796
|
+
this.peerConnection?.addStream(localStream);
|
|
13797
|
+
if (!this.isNegotiating) {
|
|
13798
|
+
logger$11.debug("[RTCPeerConnectionController] Forcing negotiationneeded after local tracks setup.");
|
|
13799
|
+
this.negotiationNeeded$.next();
|
|
13816
13800
|
}
|
|
13817
|
-
|
|
13818
|
-
|
|
13819
|
-
|
|
13820
|
-
|
|
13821
|
-
|
|
13822
|
-
|
|
13823
|
-
|
|
13824
|
-
|
|
13825
|
-
|
|
13826
|
-
|
|
13827
|
-
|
|
13828
|
-
|
|
13829
|
-
|
|
13830
|
-
}
|
|
13801
|
+
return;
|
|
13802
|
+
}
|
|
13803
|
+
for (const kind of ["audio", "video"]) {
|
|
13804
|
+
const tracks = (kind === "audio" ? localStream.getAudioTracks() : localStream.getVideoTracks()).map((track, index) => ({
|
|
13805
|
+
index,
|
|
13806
|
+
track
|
|
13807
|
+
}));
|
|
13808
|
+
for (const { index, track } of tracks) {
|
|
13809
|
+
this.localStreamController.addTrackEndedListener(track);
|
|
13810
|
+
if (this.transceiverController?.useAddTransceivers ?? false) {
|
|
13811
|
+
const transceivers = (kind === "audio" ? this.transceiverController?.audioTransceivers : this.transceiverController?.videoTransceivers) ?? [];
|
|
13812
|
+
await this.transceiverController?.setupTransceiverSender(track, localStream, transceivers[index]);
|
|
13813
|
+
} else {
|
|
13814
|
+
logger$11.debug(`[RTCPeerConnectionController] Using addTrack for local ${kind} track:`, track.id);
|
|
13815
|
+
this.peerConnection?.addTrack(track, localStream);
|
|
13831
13816
|
}
|
|
13832
13817
|
}
|
|
13833
13818
|
}
|
|
@@ -13844,7 +13829,12 @@ var RTCPeerConnectionController = class extends Destroyable {
|
|
|
13844
13829
|
if (!this.peerConnection) throw new DependencyError("RTCPeerConnection is not initialized");
|
|
13845
13830
|
this.peerConnection.ontrack = (event) => {
|
|
13846
13831
|
logger$11.debug("[RTCPeerConnectionController] Remote track received:", event.track.kind);
|
|
13847
|
-
this._remoteStream$.next(event.streams[0]);
|
|
13832
|
+
if (event.streams[0]) this._remoteStream$.next(event.streams[0]);
|
|
13833
|
+
else {
|
|
13834
|
+
const existingTracks = this._remoteStream$.value?.getTracks() ?? [];
|
|
13835
|
+
const newStream = new MediaStream([...existingTracks, event.track]);
|
|
13836
|
+
this._remoteStream$.next(newStream);
|
|
13837
|
+
}
|
|
13848
13838
|
};
|
|
13849
13839
|
await this.transceiverController?.setupRemoteTransceivers(this.type);
|
|
13850
13840
|
}
|
|
@@ -14103,6 +14093,7 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
14103
14093
|
});
|
|
14104
14094
|
this.subscribeTo(this.vertoAnswer$, (event) => {
|
|
14105
14095
|
logger$10.debug("[WebRTCManager] Received Verto answer event:", event);
|
|
14096
|
+
this._signalingStatus$.next("connecting");
|
|
14106
14097
|
const { sdp, callID } = event;
|
|
14107
14098
|
this._rtcPeerConnectionsMap.get(callID)?.updateAnswerStatus({
|
|
14108
14099
|
status: "received",
|
|
@@ -14174,13 +14165,13 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
14174
14165
|
if (response.error) {
|
|
14175
14166
|
const error = new JSONRPCError(response.error.code, response.error.message, response.error.data);
|
|
14176
14167
|
this.onError?.(error);
|
|
14177
|
-
|
|
14168
|
+
return response;
|
|
14178
14169
|
}
|
|
14179
14170
|
const innerResult = getValueFrom(response, "result.result");
|
|
14180
14171
|
if (innerResult?.error) {
|
|
14181
14172
|
const error = new JSONRPCError(innerResult.error.code, innerResult.error.message, innerResult.error.data);
|
|
14182
14173
|
this.onError?.(error);
|
|
14183
|
-
|
|
14174
|
+
return response;
|
|
14184
14175
|
}
|
|
14185
14176
|
return response;
|
|
14186
14177
|
}
|
|
@@ -14200,7 +14191,7 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
14200
14191
|
}
|
|
14201
14192
|
} catch (error) {
|
|
14202
14193
|
logger$10.error(`[WebRTCManager] Error sending Verto ${vertoMethod}:`, error);
|
|
14203
|
-
|
|
14194
|
+
this.onError?.(error instanceof Error ? error : new Error(String(error), { cause: error }));
|
|
14204
14195
|
}
|
|
14205
14196
|
}
|
|
14206
14197
|
async processModifyResponse(response, rtcPeerConnController) {
|
|
@@ -14214,12 +14205,14 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
14214
14205
|
});
|
|
14215
14206
|
} catch (error) {
|
|
14216
14207
|
logger$10.warn("[WebRTCManager] Error processing modify response:", error);
|
|
14217
|
-
|
|
14208
|
+
const modifyError = error instanceof Error ? error : new Error(String(error), { cause: error });
|
|
14209
|
+
this.onError?.(modifyError);
|
|
14218
14210
|
}
|
|
14219
14211
|
}
|
|
14220
14212
|
}
|
|
14221
14213
|
processInviteResponse(response, rtcPeerConnController) {
|
|
14222
14214
|
if (!response.error && getValueFrom(response, "result.result.result.message") === "CALL CREATED") {
|
|
14215
|
+
this._signalingStatus$.next("trying");
|
|
14223
14216
|
this._nodeId$.next(getValueFrom(response, "result.node_id") ?? null);
|
|
14224
14217
|
const memberId = getValueFrom(response, "result.result.result.memberID") ?? null;
|
|
14225
14218
|
const callId = getValueFrom(response, "result.result.result.callID") ?? null;
|
|
@@ -14337,7 +14330,6 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
14337
14330
|
});
|
|
14338
14331
|
this.sendLocalDescriptionOnceAccepted(vertoMessageRequest, rtcPeerConnController);
|
|
14339
14332
|
} else if (initial) {
|
|
14340
|
-
this._signalingStatus$.next("trying");
|
|
14341
14333
|
const vertoMessageRequest = VertoInvite({
|
|
14342
14334
|
dialogParams,
|
|
14343
14335
|
sdp
|
|
@@ -14644,7 +14636,8 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14644
14636
|
this.clientSession = clientSession;
|
|
14645
14637
|
this.options = options;
|
|
14646
14638
|
this.address = address;
|
|
14647
|
-
this._errors$ = this.
|
|
14639
|
+
this._errors$ = this.createReplaySubject(1);
|
|
14640
|
+
this._lastMergedStatus = "new";
|
|
14648
14641
|
this._answered$ = this.createReplaySubject();
|
|
14649
14642
|
this._holdState = false;
|
|
14650
14643
|
this._userVariables$ = this.createBehaviorSubject({ ...PreferencesContainer.instance.userVariables });
|
|
@@ -14665,8 +14658,10 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14665
14658
|
const managers = initialization.initializeManagers(this);
|
|
14666
14659
|
this.vertoManager = managers.vertoManager;
|
|
14667
14660
|
this.callEventsManager = managers.callEventsManager;
|
|
14668
|
-
if (options.initOffer)
|
|
14669
|
-
|
|
14661
|
+
if (options.initOffer) {
|
|
14662
|
+
this._status$ = this.createBehaviorSubject("ringing");
|
|
14663
|
+
this._lastMergedStatus = "ringing";
|
|
14664
|
+
} else this._status$ = this.createBehaviorSubject("new");
|
|
14670
14665
|
const { deviceController } = initialization;
|
|
14671
14666
|
this.participantFactory = new ParticipantFactory(this.executeMethod.bind(this), this.vertoManager, deviceController);
|
|
14672
14667
|
}
|
|
@@ -14674,9 +14669,17 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14674
14669
|
get errors$() {
|
|
14675
14670
|
return this._errors$.asObservable();
|
|
14676
14671
|
}
|
|
14677
|
-
/**
|
|
14678
|
-
|
|
14679
|
-
|
|
14672
|
+
/**
|
|
14673
|
+
* @internal Push an error to the call's error stream.
|
|
14674
|
+
* Fatal errors automatically transition the call to `'failed'` and destroy it.
|
|
14675
|
+
*/
|
|
14676
|
+
emitError(callError) {
|
|
14677
|
+
if (this._status$.value === "destroyed" || this._status$.value === "failed") return;
|
|
14678
|
+
this._errors$.next(callError);
|
|
14679
|
+
if (callError.fatal) {
|
|
14680
|
+
this._status$.next("failed");
|
|
14681
|
+
this.destroy();
|
|
14682
|
+
}
|
|
14680
14683
|
}
|
|
14681
14684
|
/** Whether this call is `'inbound'` or `'outbound'`. */
|
|
14682
14685
|
get direction() {
|
|
@@ -14788,7 +14791,9 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14788
14791
|
}
|
|
14789
14792
|
/** Observable of the current call status (e.g. `'ringing'`, `'connected'`). */
|
|
14790
14793
|
get status$() {
|
|
14791
|
-
return this.cachedObservable("status$", () => (0, import_cjs$9.merge)(this._status$.asObservable(), this.vertoManager.signalingStatus$))
|
|
14794
|
+
return this.cachedObservable("status$", () => (0, import_cjs$9.merge)(this._status$.asObservable(), this.vertoManager.signalingStatus$).pipe((0, import_cjs$9.distinctUntilChanged)(), (0, import_cjs$9.tap)((status) => {
|
|
14795
|
+
this._lastMergedStatus = status;
|
|
14796
|
+
})));
|
|
14792
14797
|
}
|
|
14793
14798
|
/** Observable of the participants list, emits on join/leave/update. */
|
|
14794
14799
|
get participants$() {
|
|
@@ -14828,7 +14833,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14828
14833
|
}
|
|
14829
14834
|
/** Current call status. */
|
|
14830
14835
|
get status() {
|
|
14831
|
-
return this.
|
|
14836
|
+
return this._lastMergedStatus;
|
|
14832
14837
|
}
|
|
14833
14838
|
/** Whether the call is currently being recorded. */
|
|
14834
14839
|
get recording() {
|
|
@@ -15041,6 +15046,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15041
15046
|
}
|
|
15042
15047
|
/** Destroys the call, releasing all resources and subscriptions. */
|
|
15043
15048
|
destroy() {
|
|
15049
|
+
if (this._status$.value === "destroyed") return;
|
|
15044
15050
|
this._status$.next("destroyed");
|
|
15045
15051
|
this.vertoManager.destroy();
|
|
15046
15052
|
this.callEventsManager.destroy();
|
|
@@ -15051,6 +15057,23 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15051
15057
|
//#endregion
|
|
15052
15058
|
//#region src/managers/CallFactory.ts
|
|
15053
15059
|
/**
|
|
15060
|
+
* Infers the semantic error category from a raw Error thrown by VertoManager
|
|
15061
|
+
* or an RTCPeerConnection layer.
|
|
15062
|
+
*/
|
|
15063
|
+
function inferCallErrorKind(error) {
|
|
15064
|
+
if (error instanceof RPCTimeoutError) return "timeout";
|
|
15065
|
+
if (error instanceof JSONRPCError) return "signaling";
|
|
15066
|
+
if (error instanceof MediaTrackError) return "media";
|
|
15067
|
+
if (error instanceof WebSocketConnectionError || error instanceof TransportConnectionError) return "network";
|
|
15068
|
+
return "internal";
|
|
15069
|
+
}
|
|
15070
|
+
/** Determines whether an error should be fatal (destroy the call). */
|
|
15071
|
+
function isFatalError(error) {
|
|
15072
|
+
if (error instanceof VertoPongError) return false;
|
|
15073
|
+
if (error instanceof MediaTrackError) return false;
|
|
15074
|
+
return true;
|
|
15075
|
+
}
|
|
15076
|
+
/**
|
|
15054
15077
|
* Factory for creating WebRTCCall instances with proper manager wiring.
|
|
15055
15078
|
* Eliminates circular dependencies by centralizing Call and Manager creation.
|
|
15056
15079
|
*/
|
|
@@ -15071,7 +15094,13 @@ var CallFactory = class {
|
|
|
15071
15094
|
vertoManager: new WebRTCVertoManager(callInstance, this.attachManager, this.deviceController, this.webRTCApiProvider, {
|
|
15072
15095
|
nodeId: options.nodeId,
|
|
15073
15096
|
onError: (error) => {
|
|
15074
|
-
|
|
15097
|
+
const callError = {
|
|
15098
|
+
kind: inferCallErrorKind(error),
|
|
15099
|
+
fatal: isFatalError(error),
|
|
15100
|
+
error,
|
|
15101
|
+
callId: callInstance.id
|
|
15102
|
+
};
|
|
15103
|
+
callInstance.emitError(callError);
|
|
15075
15104
|
}
|
|
15076
15105
|
}),
|
|
15077
15106
|
callEventsManager: new CallEventsManager(callInstance)
|
|
@@ -15516,7 +15545,7 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
15516
15545
|
revision: 0
|
|
15517
15546
|
};
|
|
15518
15547
|
this._authorization$ = this.createBehaviorSubject(void 0);
|
|
15519
|
-
this._errors$ = this.
|
|
15548
|
+
this._errors$ = this.createReplaySubject(1);
|
|
15520
15549
|
this._authenticated$ = this.createBehaviorSubject(false);
|
|
15521
15550
|
this._subscriberInfo$ = this.createBehaviorSubject(null);
|
|
15522
15551
|
this._calls$ = this.createBehaviorSubject({});
|
|
@@ -15786,12 +15815,13 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
15786
15815
|
}
|
|
15787
15816
|
async createOutboundCall(destination, options = {}) {
|
|
15788
15817
|
const destinationURI = destination instanceof Address ? destination.defaultChannel : destination;
|
|
15818
|
+
let callSession;
|
|
15789
15819
|
try {
|
|
15790
|
-
|
|
15820
|
+
callSession = await this.createCall({
|
|
15791
15821
|
to: destinationURI,
|
|
15792
15822
|
...options
|
|
15793
15823
|
});
|
|
15794
|
-
await (0, import_cjs$5.firstValueFrom)(callSession.selfId$.pipe((0, import_cjs$5.filter)((id) => Boolean(id)), (0, import_cjs$5.take)(1), (0, import_cjs$5.timeout)(this.callCreateTimeout)));
|
|
15824
|
+
await (0, import_cjs$5.firstValueFrom)((0, import_cjs$5.race)(callSession.selfId$.pipe((0, import_cjs$5.filter)((id) => Boolean(id)), (0, import_cjs$5.take)(1), (0, import_cjs$5.timeout)(this.callCreateTimeout)), callSession.errors$.pipe((0, import_cjs$5.take)(1), (0, import_cjs$5.switchMap)((callError) => (0, import_cjs$5.throwError)(() => callError.error)))));
|
|
15795
15825
|
this._calls$.next({
|
|
15796
15826
|
[`${callSession.id}`]: callSession,
|
|
15797
15827
|
...this._calls$.value
|
|
@@ -15799,7 +15829,8 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
15799
15829
|
return callSession;
|
|
15800
15830
|
} catch (error) {
|
|
15801
15831
|
logger$6.error("[Session] Error creating outbound call:", error);
|
|
15802
|
-
|
|
15832
|
+
callSession?.destroy();
|
|
15833
|
+
const callError = new CallCreateError(error instanceof import_cjs$5.TimeoutError ? "Call create timeout" : "Call creation failed", error, "outbound");
|
|
15803
15834
|
this._errors$.next(callError);
|
|
15804
15835
|
throw callError;
|
|
15805
15836
|
}
|
|
@@ -15825,7 +15856,7 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
15825
15856
|
return callSession;
|
|
15826
15857
|
} catch (error) {
|
|
15827
15858
|
logger$6.error("[Session] Error creating call session:", error);
|
|
15828
|
-
throw new CallCreateError("Call create error", error);
|
|
15859
|
+
throw new CallCreateError("Call create error", error, options.initOffer ? "inbound" : "outbound");
|
|
15829
15860
|
}
|
|
15830
15861
|
}
|
|
15831
15862
|
destroy() {
|
|
@@ -16074,7 +16105,7 @@ var WebSocketController = class WebSocketController extends Destroyable {
|
|
|
16074
16105
|
this.shouldReconnect = false;
|
|
16075
16106
|
this._status$ = this.createBehaviorSubject("disconnected");
|
|
16076
16107
|
this._incomingMessages$ = this.createSubject();
|
|
16077
|
-
this._errors$ = this.
|
|
16108
|
+
this._errors$ = this.createReplaySubject(1);
|
|
16078
16109
|
this.reconnectDelayMin = options.reconnectDelayMin ?? WebSocketController.DEFAULT_RECONNECT_DELAY_MIN_MS;
|
|
16079
16110
|
this.reconnectDelayMax = options.reconnectDelayMax ?? WebSocketController.DEFAULT_RECONNECT_DELAY_MAX_MS;
|
|
16080
16111
|
this.connectionTimeout = options.connectionTimeout ?? WebSocketController.DEFAULT_CONNECTION_TIMEOUT_MS;
|
|
@@ -16432,7 +16463,7 @@ var SignalWire = class extends Destroyable {
|
|
|
16432
16463
|
this._directory$ = this.createBehaviorSubject(void 0);
|
|
16433
16464
|
this._isConnected$ = this.createBehaviorSubject(false);
|
|
16434
16465
|
this._isRegistered$ = this.createBehaviorSubject(false);
|
|
16435
|
-
this._errors$ = this.
|
|
16466
|
+
this._errors$ = this.createReplaySubject(1);
|
|
16436
16467
|
this._options = {};
|
|
16437
16468
|
this._deps = new DependencyContainer();
|
|
16438
16469
|
this._options = {
|