sip-connector 28.10.2 → 28.10.4
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/{@SipConnector-DCBKBecC.js → @SipConnector-BqJWQy2_.js} +832 -831
- package/dist/@SipConnector-EIXvEgiZ.cjs +1 -0
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/package.json +3 -3
- package/dist/@SipConnector-BuQgSFMC.cjs +0 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import { MediaStreamTrackMock as
|
|
3
|
-
import { TypedEvents as k, EventEmitterProxy as w, Events as
|
|
4
|
-
import
|
|
5
|
-
import { resolveRequesterByTimeout as
|
|
6
|
-
import { CancelableRequest as
|
|
7
|
-
import { createActor as
|
|
8
|
-
import { repeatedCallsAsync as
|
|
9
|
-
import { createStackPromises as
|
|
10
|
-
import { UAParser as
|
|
1
|
+
import { C as ee, NameAddrHeader as Mn, URI as On, SessionStatus as _n, IncomingResponse as Ot } from "@krivega/jssip";
|
|
2
|
+
import { MediaStreamTrackMock as bn, createAudioMediaStreamTrackMock as yn, createVideoMediaStreamTrackMock as Dn } from "webrtc-mock";
|
|
3
|
+
import { TypedEvents as k, EventEmitterProxy as w, Events as Pn } from "events-constructor";
|
|
4
|
+
import Ve from "debug";
|
|
5
|
+
import { resolveRequesterByTimeout as _t, DelayRequester as bt, hasCanceledError as yt, SetTimeoutRequest as Dt } from "@krivega/timeout-requester";
|
|
6
|
+
import { CancelableRequest as pe, isCanceledError as He } from "@krivega/cancelable-promise";
|
|
7
|
+
import { createActor as Ln, setup as te, assign as I, fromPromise as oe } from "xstate";
|
|
8
|
+
import { repeatedCallsAsync as We, hasCanceledError as wn } from "repeated-calls";
|
|
9
|
+
import { createStackPromises as Pt, isPromiseIsNotActualError as Lt } from "stack-promises";
|
|
10
|
+
import { UAParser as Gn } from "ua-parser-js";
|
|
11
11
|
import "sequent-promises";
|
|
12
|
-
import
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
var
|
|
19
|
-
const x = (t) => typeof t == "string" && t.trim().length > 0,
|
|
12
|
+
import kn, { isEqual as Ke } from "lodash";
|
|
13
|
+
const Qe = "sip-connector", Fn = Ve(Qe), Nl = () => {
|
|
14
|
+
Ve.enable(`${Qe}:*`);
|
|
15
|
+
}, Al = () => {
|
|
16
|
+
Ve.enable(`-${Qe}:*`);
|
|
17
|
+
}, N = (t) => Fn.extend(t), Un = "Error decline with 603", Bn = 1006, $n = (t) => typeof t == "object" && t !== null && "code" in t && t.code === Bn, xn = (t) => t.message === Un;
|
|
18
|
+
var Ie = /* @__PURE__ */ ((t) => (t.SPECTATOR = "SPECTATOR", t.PARTICIPANT = "PARTICIPANT", t))(Ie || {}), W = /* @__PURE__ */ ((t) => (t.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", t.MAIN_CAM = "application/vinteo.webrtc.maincam", t.ENTER_ROOM = "application/vinteo.webrtc.roomname", t.MIC = "application/vinteo.webrtc.mic", t.USE_LICENSE = "application/vinteo.webrtc.uselic", t.PARTICIPANT_STATE = "application/vinteo.webrtc.partstate", t.NOTIFY = "application/vinteo.webrtc.notify", t))(W || {}), V = /* @__PURE__ */ ((t) => (t.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", t.MAIN_CAM = "application/vinteo.webrtc.maincam", t.CHANNELS = "application/vinteo.webrtc.channels", t.MEDIA_STATE = "application/vinteo.webrtc.mediastate", t.REFUSAL = "application/vinteo.webrtc.refusal", t.STATS = "application/vinteo.webrtc.stats", t))(V || {}), $ = /* @__PURE__ */ ((t) => (t.PAUSE_MAIN_CAM = "PAUSEMAINCAM", t.RESUME_MAIN_CAM = "RESUMEMAINCAM", t.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", t.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", t.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", t))($ || {}), fe = /* @__PURE__ */ ((t) => (t.ADMIN_STOP_MIC = "ADMINSTOPMIC", t.ADMIN_START_MIC = "ADMINSTARTMIC", t))(fe || {}), wt = /* @__PURE__ */ ((t) => (t.H264 = "H264", t.VP8 = "VP8", t.VP9 = "VP9", t.AV1 = "AV1", t))(wt || {}), E = /* @__PURE__ */ ((t) => (t.CONTENT_TYPE = "content-type", t.CONTENT_ENTER_ROOM = "x-webrtc-enter-room", t.CONTENT_USE_LICENSE = "x-webrtc-use-license", t.PARTICIPANT_NAME = "x-webrtc-participant-name", t.INPUT_CHANNELS = "x-webrtc-input-channels", t.OUTPUT_CHANNELS = "x-webrtc-output-channels", t.MAIN_CAM = "x-webrtc-maincam", t.MIC = "x-webrtc-mic", t.MEDIA_SYNC = "x-webrtc-sync", t.MAIN_CAM_RESOLUTION = "x-webrtc-maincam-resolution", t.MEDIA_STATE = "x-webrtc-media-state", t.MEDIA_TYPE = "x-vinteo-media-type", t.MAIN_CAM_STATE = "x-vinteo-maincam-state", t.MIC_STATE = "x-vinteo-mic-state", t.CONTENT_PARTICIPANT_STATE = "x-webrtc-partstate", t.AUDIO_ID = "x-webrtc-audioid", t.SPECTATOR_MODE = "x-webrtc-spectator-mode", t.NOTIFY = "x-vinteo-notify", t.CONTENT_ENABLE_MEDIA_DEVICE = "x-webrtc-request-enable-media-device", t.CONTENTED_STREAM_STATE = "x-webrtc-share-state", t.CONTENTED_STREAM_CODEC = "x-webrtc-share-codec", t.AVAILABLE_INCOMING_BITRATE = "x-webrtc-available-incoming-bitrate", t.AUDIO_TRACK_COUNT = "x-webrtc-audio-track-count", t.VIDEO_TRACK_COUNT = "x-webrtc-video-track-count", t.TRACKS_DIRECTION = "x-webrtc-tracks-direction", t.BEARER_TOKEN = "x-bearer-token", t.IS_DIRECT_PEER_TO_PEER = "x-webrtc-is-direct-p2p", t))(E || {}), Ee = /* @__PURE__ */ ((t) => (t.AVAILABLE_CONTENTED_STREAM = "YOUCANRECEIVECONTENT", t.NOT_AVAILABLE_CONTENTED_STREAM = "CONTENTEND", t.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", t))(Ee || {}), ae = /* @__PURE__ */ ((t) => (t.AVAILABLE_CONTENTED_STREAM = "x-webrtc-share-state: YOUCANRECEIVECONTENT", t.NOT_AVAILABLE_CONTENTED_STREAM = "x-webrtc-share-state: CONTENTEND", t.ACK_PERMISSION_TO_START_PRESENTATION = "x-webrtc-share-state: LETMESTARTPRESENTATION", t.STOPPED_CLIENT_PRESENTATION = "x-webrtc-share-state: STOPPRESENTATION", t.ENABLE_MAIN_CAM = "x-webrtc-request-enable-media-device: LETMESTARTMAINCAM", t))(ae || {}), ve = /* @__PURE__ */ ((t) => (t.ADMIN_SYNC_FORCED = "1", t.ADMIN_SYNC_NOT_FORCED = "0", t))(ve || {}), Ye = /* @__PURE__ */ ((t) => (t.SPECTATOR_MANUAL = "0", t.BY_STATE_CAM = "1", t.SPECTATOR_FORCED = "2", t))(Ye || {}), je = /* @__PURE__ */ ((t) => (t.AUDIO = "AUDIO", t.VIDEO = "VIDEO", t.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", t))(je || {});
|
|
19
|
+
const x = (t) => typeof t == "string" && t.trim().length > 0, Fe = (t) => typeof t == "number" && !Number.isNaN(t) && Number.isFinite(t), qn = (t) => typeof t == "object" && t !== null && !Array.isArray(t), Gt = (t) => typeof t == "boolean", Vn = (t) => Array.isArray(t) && t.every(x), kt = [
|
|
20
20
|
"enter-room",
|
|
21
21
|
"main-cam-control",
|
|
22
22
|
"use-license",
|
|
@@ -46,13 +46,13 @@ const x = (t) => typeof t == "string" && t.trim().length > 0, Ge = (t) => typeof
|
|
|
46
46
|
"admin:stop-mic",
|
|
47
47
|
"admin:force-sync-media-state",
|
|
48
48
|
"failed-send-room-direct-p2p"
|
|
49
|
-
],
|
|
49
|
+
], Hn = () => new k(kt), Wn = (t) => !(!qn(t) || !x(t.conference) || !x(t.participant) || !x(t.jwt)), j = (t, e) => {
|
|
50
50
|
const n = e.toLowerCase(), s = Object.entries(t).find(([, r]) => typeof r == "string" && r.toLowerCase() === n);
|
|
51
51
|
return s ? s[1] : void 0;
|
|
52
|
-
},
|
|
53
|
-
if (
|
|
52
|
+
}, Qn = (t) => typeof t == "string" && !Number.isNaN(Number(t)) && Number.isFinite(Number(t)), Yn = (t) => {
|
|
53
|
+
if (Qn(t))
|
|
54
54
|
return Number(t);
|
|
55
|
-
},
|
|
55
|
+
}, jn = (t) => {
|
|
56
56
|
const e = t.toLowerCase();
|
|
57
57
|
if (e === "true" || e === "1")
|
|
58
58
|
return !0;
|
|
@@ -83,37 +83,37 @@ const x = (t) => typeof t == "string" && t.trim().length > 0, Ge = (t) => typeof
|
|
|
83
83
|
case E.AVAILABLE_INCOMING_BITRATE:
|
|
84
84
|
case E.AUDIO_TRACK_COUNT:
|
|
85
85
|
case E.VIDEO_TRACK_COUNT:
|
|
86
|
-
return
|
|
86
|
+
return Yn(s);
|
|
87
87
|
case E.CONTENTED_STREAM_CODEC:
|
|
88
|
-
return j(
|
|
88
|
+
return j(wt, s);
|
|
89
89
|
case E.CONTENT_TYPE:
|
|
90
90
|
return j(W, s);
|
|
91
91
|
case E.CONTENT_USE_LICENSE:
|
|
92
|
-
return j(
|
|
92
|
+
return j(je, s);
|
|
93
93
|
case E.MAIN_CAM:
|
|
94
94
|
return j($, s);
|
|
95
95
|
case E.MIC:
|
|
96
|
-
return j(
|
|
96
|
+
return j(fe, s);
|
|
97
97
|
case E.MEDIA_SYNC:
|
|
98
|
-
return j(
|
|
98
|
+
return j(ve, s);
|
|
99
99
|
case E.CONTENT_PARTICIPANT_STATE:
|
|
100
|
-
return j(
|
|
100
|
+
return j(Ie, s);
|
|
101
101
|
case E.SPECTATOR_MODE:
|
|
102
|
-
return j(
|
|
102
|
+
return j(Ye, s);
|
|
103
103
|
case E.CONTENTED_STREAM_STATE:
|
|
104
|
-
return j(
|
|
104
|
+
return j(Ee, s);
|
|
105
105
|
case E.IS_DIRECT_PEER_TO_PEER:
|
|
106
|
-
return
|
|
106
|
+
return jn(s);
|
|
107
107
|
default:
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
111
|
var U = /* @__PURE__ */ ((t) => (t.CHANNELS = "channels", t.WEBCAST_STARTED = "WebcastStarted", t.WEBCAST_STOPPED = "WebcastStopped", t.ACCOUNT_CHANGED = "accountChanged", t.ACCOUNT_DELETED = "accountDeleted", t.ADDED_TO_LIST_MODERATORS = "addedToListModerators", t.REMOVED_FROM_LIST_MODERATORS = "removedFromListModerators", t.ACCEPTING_WORD_REQUEST = "ParticipationRequestAccepted", t.CANCELLING_WORD_REQUEST = "ParticipationRequestRejected", t.MOVE_REQUEST_TO_STREAM = "ParticipantMovedToWebcast", t.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "ConferenceParticipantTokenIssued", t))(U || {});
|
|
112
|
-
const
|
|
113
|
-
class
|
|
112
|
+
const Xe = N("ApiManager");
|
|
113
|
+
class zn extends w {
|
|
114
114
|
callManager;
|
|
115
115
|
constructor() {
|
|
116
|
-
super(
|
|
116
|
+
super(Hn());
|
|
117
117
|
}
|
|
118
118
|
subscribe({
|
|
119
119
|
connectionManager: e,
|
|
@@ -194,32 +194,32 @@ class Yn extends w {
|
|
|
194
194
|
}
|
|
195
195
|
async sendAvailableContentedStream() {
|
|
196
196
|
await this.getEstablishedRTCSessionProtected().sendInfo(V.SHARE_STATE, void 0, {
|
|
197
|
-
extraHeaders: [
|
|
197
|
+
extraHeaders: [ae.AVAILABLE_CONTENTED_STREAM]
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
200
|
async askPermissionToStartPresentation() {
|
|
201
201
|
await this.getEstablishedRTCSessionProtected().sendInfo(V.SHARE_STATE, void 0, {
|
|
202
|
-
extraHeaders: [
|
|
202
|
+
extraHeaders: [ae.ACK_PERMISSION_TO_START_PRESENTATION]
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
205
|
async sendStoppedPresentation() {
|
|
206
206
|
await this.getEstablishedRTCSessionProtected().sendInfo(V.SHARE_STATE, void 0, {
|
|
207
|
-
extraHeaders: [
|
|
207
|
+
extraHeaders: [ae.STOPPED_CLIENT_PRESENTATION]
|
|
208
208
|
});
|
|
209
209
|
}
|
|
210
210
|
async sendNotAvailableContentedStream() {
|
|
211
211
|
await this.getEstablishedRTCSessionProtected().sendInfo(V.SHARE_STATE, void 0, {
|
|
212
|
-
extraHeaders: [
|
|
212
|
+
extraHeaders: [ae.NOT_AVAILABLE_CONTENTED_STREAM]
|
|
213
213
|
});
|
|
214
214
|
}
|
|
215
215
|
async askPermissionToEnableCam(e = {}) {
|
|
216
|
-
const n = this.getEstablishedRTCSessionProtected(), s = [
|
|
216
|
+
const n = this.getEstablishedRTCSessionProtected(), s = [ae.ENABLE_MAIN_CAM];
|
|
217
217
|
return n.sendInfo(V.MAIN_CAM, void 0, {
|
|
218
218
|
noTerminateWhenError: !0,
|
|
219
219
|
...e,
|
|
220
220
|
extraHeaders: s
|
|
221
221
|
}).catch((r) => {
|
|
222
|
-
if (
|
|
222
|
+
if (xn(r))
|
|
223
223
|
throw r;
|
|
224
224
|
});
|
|
225
225
|
}
|
|
@@ -240,7 +240,7 @@ class Yn extends w {
|
|
|
240
240
|
this.handleNotify(s);
|
|
241
241
|
}
|
|
242
242
|
} catch (n) {
|
|
243
|
-
|
|
243
|
+
Xe("error parse notify", n);
|
|
244
244
|
}
|
|
245
245
|
};
|
|
246
246
|
handleNotify = (e) => {
|
|
@@ -290,7 +290,7 @@ class Yn extends w {
|
|
|
290
290
|
break;
|
|
291
291
|
}
|
|
292
292
|
default:
|
|
293
|
-
|
|
293
|
+
Xe("unknown cmd", e);
|
|
294
294
|
}
|
|
295
295
|
};
|
|
296
296
|
handleNewInfo = (e) => {
|
|
@@ -412,7 +412,7 @@ class Yn extends w {
|
|
|
412
412
|
participant: n,
|
|
413
413
|
jwt: s
|
|
414
414
|
};
|
|
415
|
-
|
|
415
|
+
Wn(r) && this.events.trigger(
|
|
416
416
|
"conference:participant-token-issued",
|
|
417
417
|
r
|
|
418
418
|
);
|
|
@@ -440,16 +440,16 @@ class Yn extends w {
|
|
|
440
440
|
const n = P(e, E.CONTENTED_STREAM_STATE);
|
|
441
441
|
if (n !== void 0)
|
|
442
442
|
switch (n) {
|
|
443
|
-
case
|
|
443
|
+
case Ee.AVAILABLE_CONTENTED_STREAM: {
|
|
444
444
|
const s = P(e, E.CONTENTED_STREAM_CODEC);
|
|
445
445
|
this.events.trigger("contented-stream:available", { codec: s });
|
|
446
446
|
break;
|
|
447
447
|
}
|
|
448
|
-
case
|
|
448
|
+
case Ee.NOT_AVAILABLE_CONTENTED_STREAM: {
|
|
449
449
|
this.events.trigger("contented-stream:not-available");
|
|
450
450
|
break;
|
|
451
451
|
}
|
|
452
|
-
case
|
|
452
|
+
case Ee.MUST_STOP_PRESENTATION: {
|
|
453
453
|
this.events.trigger("presentation:must-stop");
|
|
454
454
|
break;
|
|
455
455
|
}
|
|
@@ -457,8 +457,8 @@ class Yn extends w {
|
|
|
457
457
|
};
|
|
458
458
|
maybeTriggerParticipantMoveRequest = (e) => {
|
|
459
459
|
const n = P(e, E.CONTENT_PARTICIPANT_STATE), s = P(e, E.AUDIO_ID), r = P(e, E.SPECTATOR_MODE);
|
|
460
|
-
if (n ===
|
|
461
|
-
const i = r ===
|
|
460
|
+
if (n === Ie.SPECTATOR) {
|
|
461
|
+
const i = r === Ye.BY_STATE_CAM;
|
|
462
462
|
s === void 0 ? (this.events.trigger("participant:move-request-to-spectators-synthetic", {
|
|
463
463
|
isAvailableSendingMedia: i
|
|
464
464
|
}), this.events.trigger("participant:move-request-to-spectators", {
|
|
@@ -473,10 +473,10 @@ class Yn extends w {
|
|
|
473
473
|
audioId: s
|
|
474
474
|
}));
|
|
475
475
|
}
|
|
476
|
-
n ===
|
|
476
|
+
n === Ie.PARTICIPANT && this.events.trigger("participant:move-request-to-participants");
|
|
477
477
|
};
|
|
478
478
|
triggerMainCamControl = (e) => {
|
|
479
|
-
const n = P(e, E.MAIN_CAM), s = P(e, E.MEDIA_SYNC), r = s ===
|
|
479
|
+
const n = P(e, E.MAIN_CAM), s = P(e, E.MEDIA_SYNC), r = s === ve.ADMIN_SYNC_FORCED;
|
|
480
480
|
if (n === $.ADMIN_START_MAIN_CAM) {
|
|
481
481
|
this.events.trigger("admin:start-main-cam", { isSyncForced: r });
|
|
482
482
|
return;
|
|
@@ -493,8 +493,8 @@ class Yn extends w {
|
|
|
493
493
|
});
|
|
494
494
|
};
|
|
495
495
|
triggerMicControl = (e) => {
|
|
496
|
-
const n = P(e, E.MIC), r = P(e, E.MEDIA_SYNC) ===
|
|
497
|
-
n ===
|
|
496
|
+
const n = P(e, E.MIC), r = P(e, E.MEDIA_SYNC) === ve.ADMIN_SYNC_FORCED;
|
|
497
|
+
n === fe.ADMIN_START_MIC ? this.events.trigger("admin:start-mic", { isSyncForced: r }) : n === fe.ADMIN_STOP_MIC && this.events.trigger("admin:stop-mic", { isSyncForced: r });
|
|
498
498
|
};
|
|
499
499
|
triggerUseLicense = (e) => {
|
|
500
500
|
const n = P(e, E.CONTENT_USE_LICENSE);
|
|
@@ -504,11 +504,11 @@ class Yn extends w {
|
|
|
504
504
|
return this.getEstablishedRTCSessionProtected().sendInfo(W.ENTER_ROOM, void 0, { extraHeaders: e });
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
|
-
const
|
|
508
|
-
let
|
|
509
|
-
countInner =
|
|
510
|
-
initialCount =
|
|
511
|
-
limitInner =
|
|
507
|
+
const Ze = 0, Jn = 30, le = N("AutoConnectorManager: AttemptsState");
|
|
508
|
+
let Kn = class {
|
|
509
|
+
countInner = Ze;
|
|
510
|
+
initialCount = Ze;
|
|
511
|
+
limitInner = Jn;
|
|
512
512
|
isInProgress = !1;
|
|
513
513
|
onStatusChange;
|
|
514
514
|
constructor({
|
|
@@ -526,22 +526,22 @@ let zn = class {
|
|
|
526
526
|
return this.isInProgress;
|
|
527
527
|
}
|
|
528
528
|
hasLimitReached() {
|
|
529
|
-
return this.countInner >= this.limitInner;
|
|
529
|
+
return le("hasLimitReached", { count: this.countInner, limit: this.limitInner }), this.countInner >= this.limitInner;
|
|
530
530
|
}
|
|
531
531
|
startAttempt() {
|
|
532
|
-
this.isInProgress || (this.isInProgress = !0, this.onStatusChange({ isInProgress: this.isInProgress }));
|
|
532
|
+
le("startAttempt", { count: this.countInner, limit: this.limitInner }), this.isInProgress || (this.isInProgress = !0, this.onStatusChange({ isInProgress: this.isInProgress }));
|
|
533
533
|
}
|
|
534
534
|
finishAttempt() {
|
|
535
|
-
this.isInProgress && (this.isInProgress = !1, this.onStatusChange({ isInProgress: this.isInProgress }));
|
|
535
|
+
le("finishAttempt", { count: this.countInner, limit: this.limitInner }), this.isInProgress && (this.isInProgress = !1, this.onStatusChange({ isInProgress: this.isInProgress }));
|
|
536
536
|
}
|
|
537
537
|
increment() {
|
|
538
|
-
this.count < this.limit && (this.countInner += 1);
|
|
538
|
+
le("increment", { count: this.countInner, limit: this.limitInner }), this.count < this.limit && (this.countInner += 1);
|
|
539
539
|
}
|
|
540
540
|
reset() {
|
|
541
|
-
this.countInner = this.initialCount, this.finishAttempt();
|
|
541
|
+
le("reset", { count: this.countInner, limit: this.limitInner }), this.countInner = this.initialCount, this.finishAttempt();
|
|
542
542
|
}
|
|
543
543
|
};
|
|
544
|
-
class
|
|
544
|
+
class Xn {
|
|
545
545
|
connectionManager;
|
|
546
546
|
interval;
|
|
547
547
|
checkTelephonyByTimeout = void 0;
|
|
@@ -556,7 +556,7 @@ class Jn {
|
|
|
556
556
|
onSuccessRequest: n,
|
|
557
557
|
onFailRequest: s
|
|
558
558
|
}) {
|
|
559
|
-
this.stop(), this.cancelableGetParameters = new
|
|
559
|
+
this.stop(), this.cancelableGetParameters = new pe(e), this.checkTelephonyByTimeout = _t({
|
|
560
560
|
isDontStopOnFail: !0,
|
|
561
561
|
requestInterval: this.interval,
|
|
562
562
|
request: async () => {
|
|
@@ -576,8 +576,8 @@ class Jn {
|
|
|
576
576
|
this.checkTelephonyByTimeout?.stop(), this.checkTelephonyByTimeout = void 0, this.cancelableGetParameters?.cancelRequest(), this.cancelableGetParameters = void 0;
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
|
-
const
|
|
580
|
-
class
|
|
579
|
+
const Zn = 15e3, es = 2, et = N("AutoConnectorManager: PingServerRequester");
|
|
580
|
+
class ts {
|
|
581
581
|
connectionManager;
|
|
582
582
|
pingServerByTimeout = void 0;
|
|
583
583
|
failRequestsCount = 0;
|
|
@@ -586,18 +586,18 @@ class Zn {
|
|
|
586
586
|
this.connectionManager = e;
|
|
587
587
|
}
|
|
588
588
|
start({ onFailRequest: e }) {
|
|
589
|
-
this.stop(), this.pingServerByTimeout =
|
|
589
|
+
this.stop(), this.pingServerByTimeout = _t({
|
|
590
590
|
isDontStopOnFail: !0,
|
|
591
|
-
requestInterval:
|
|
592
|
-
request: async () => (
|
|
593
|
-
|
|
591
|
+
requestInterval: Zn,
|
|
592
|
+
request: async () => (et("ping"), this.connectionManager.ping().then(() => {
|
|
593
|
+
et("ping success");
|
|
594
594
|
}))
|
|
595
595
|
}), this.pingServerByTimeout.start(void 0, {
|
|
596
596
|
onSuccessRequest: () => {
|
|
597
597
|
this.resetFailRequests();
|
|
598
598
|
},
|
|
599
599
|
onFailRequest: () => {
|
|
600
|
-
this.failRequestsCount += 1, !(this.failRequestsCount <
|
|
600
|
+
this.failRequestsCount += 1, !(this.failRequestsCount < es || this.isFailRequestReported) && (this.isFailRequestReported = !0, e());
|
|
601
601
|
}
|
|
602
602
|
});
|
|
603
603
|
}
|
|
@@ -608,7 +608,7 @@ class Zn {
|
|
|
608
608
|
this.failRequestsCount = 0, this.isFailRequestReported = !1;
|
|
609
609
|
}
|
|
610
610
|
}
|
|
611
|
-
class
|
|
611
|
+
class ns {
|
|
612
612
|
callManager;
|
|
613
613
|
disposers = [];
|
|
614
614
|
constructor({ callManager: e }) {
|
|
@@ -633,7 +633,7 @@ class es {
|
|
|
633
633
|
this.callManager.isCallActive ? e?.() : n();
|
|
634
634
|
}
|
|
635
635
|
}
|
|
636
|
-
class
|
|
636
|
+
class ss {
|
|
637
637
|
connectionManager;
|
|
638
638
|
isRegistrationFailed = !1;
|
|
639
639
|
disposers = [];
|
|
@@ -642,7 +642,7 @@ class ts {
|
|
|
642
642
|
connectionManager: e,
|
|
643
643
|
callManager: n
|
|
644
644
|
}) {
|
|
645
|
-
this.connectionManager = e, this.notActiveCallSubscriber = new
|
|
645
|
+
this.connectionManager = e, this.notActiveCallSubscriber = new ns({ callManager: n });
|
|
646
646
|
}
|
|
647
647
|
subscribe(e) {
|
|
648
648
|
this.unsubscribe(), this.disposers.push(
|
|
@@ -669,30 +669,30 @@ class ts {
|
|
|
669
669
|
this.isRegistrationFailed = !1;
|
|
670
670
|
}
|
|
671
671
|
}
|
|
672
|
-
const
|
|
672
|
+
const rs = {
|
|
673
673
|
baseRetryDelayMs: 1e3,
|
|
674
674
|
maxRetryDelayMs: 3e4,
|
|
675
675
|
warningThreshold: 3,
|
|
676
676
|
criticalThreshold: 5
|
|
677
|
-
},
|
|
677
|
+
}, tt = {
|
|
678
678
|
none: 0,
|
|
679
679
|
warning: 1,
|
|
680
680
|
critical: 2
|
|
681
681
|
};
|
|
682
|
-
class
|
|
682
|
+
class is {
|
|
683
683
|
failCount = 0;
|
|
684
684
|
nextRetryAtMs = 0;
|
|
685
685
|
escalationLevel = "none";
|
|
686
686
|
options;
|
|
687
687
|
constructor(e) {
|
|
688
688
|
this.options = {
|
|
689
|
-
...
|
|
689
|
+
...rs,
|
|
690
690
|
...e
|
|
691
691
|
};
|
|
692
692
|
}
|
|
693
693
|
registerFailure() {
|
|
694
694
|
this.failCount += 1;
|
|
695
|
-
const e = this.resolveEscalationLevel(this.failCount), n =
|
|
695
|
+
const e = this.resolveEscalationLevel(this.failCount), n = tt[e] > tt[this.escalationLevel];
|
|
696
696
|
this.escalationLevel = e;
|
|
697
697
|
const s = Date.now(), r = Math.max(this.nextRetryAtMs - s, 0);
|
|
698
698
|
if (r > 0)
|
|
@@ -735,7 +735,7 @@ const K = {
|
|
|
735
735
|
PERIODIC_PING_FAILED: "periodic-ping-failed",
|
|
736
736
|
NETWORK_ONLINE: "network-online",
|
|
737
737
|
NETWORK_CHANGE: "network-change"
|
|
738
|
-
},
|
|
738
|
+
}, as = {
|
|
739
739
|
[K.START]: 0,
|
|
740
740
|
[K.TELEPHONY_DISCONNECTED]: 1,
|
|
741
741
|
[K.TELEPHONY_CHECK_FAILED]: 1,
|
|
@@ -744,8 +744,8 @@ const K = {
|
|
|
744
744
|
[K.MANUAL_RESTART]: 4,
|
|
745
745
|
[K.NETWORK_ONLINE]: 4,
|
|
746
746
|
[K.NETWORK_CHANGE]: 4
|
|
747
|
-
},
|
|
748
|
-
class
|
|
747
|
+
}, nt = (t) => as[t], F = N("AutoConnectorManager: AutoConnectorRuntime"), os = 3e3, cs = 15e3;
|
|
748
|
+
class ls {
|
|
749
749
|
connectionManager;
|
|
750
750
|
connectionQueueManager;
|
|
751
751
|
checkTelephonyRequester;
|
|
@@ -757,17 +757,17 @@ class os {
|
|
|
757
757
|
emitters;
|
|
758
758
|
reconnectActions;
|
|
759
759
|
constructor(e) {
|
|
760
|
-
this.connectionManager = e.connectionManager, this.connectionQueueManager = e.connectionQueueManager, this.emitters = e.emitters, this.reconnectActions = e.reconnectActions, this.checkTelephonyRequester = new
|
|
760
|
+
this.connectionManager = e.connectionManager, this.connectionQueueManager = e.connectionQueueManager, this.emitters = e.emitters, this.reconnectActions = e.reconnectActions, this.checkTelephonyRequester = new Xn({
|
|
761
761
|
connectionManager: this.connectionManager,
|
|
762
|
-
interval: e.options?.checkTelephonyRequestInterval ??
|
|
763
|
-
}), this.pingServerRequester = new
|
|
762
|
+
interval: e.options?.checkTelephonyRequestInterval ?? cs
|
|
763
|
+
}), this.pingServerRequester = new ts({
|
|
764
764
|
connectionManager: this.connectionManager
|
|
765
|
-
}), this.registrationFailedOutOfCallSubscriber = new
|
|
765
|
+
}), this.registrationFailedOutOfCallSubscriber = new ss({
|
|
766
766
|
connectionManager: this.connectionManager,
|
|
767
767
|
callManager: e.callManager
|
|
768
|
-
}), this.delayBetweenAttempts = new
|
|
769
|
-
e.options?.timeoutBetweenAttempts ??
|
|
770
|
-
), this.telephonyFailPolicy = new
|
|
768
|
+
}), this.delayBetweenAttempts = new bt(
|
|
769
|
+
e.options?.timeoutBetweenAttempts ?? os
|
|
770
|
+
), this.telephonyFailPolicy = new is(e.options?.telephonyFailPolicy), this.attemptsState = new Kn({
|
|
771
771
|
onStatusChange: this.emitters.emitStatusChange
|
|
772
772
|
});
|
|
773
773
|
}
|
|
@@ -867,12 +867,12 @@ class os {
|
|
|
867
867
|
return e || n;
|
|
868
868
|
}
|
|
869
869
|
}
|
|
870
|
-
class
|
|
870
|
+
class ne {
|
|
871
871
|
actor;
|
|
872
872
|
subscriptions = [];
|
|
873
873
|
stateChangeListeners = /* @__PURE__ */ new Set();
|
|
874
874
|
constructor(e) {
|
|
875
|
-
this.actor =
|
|
875
|
+
this.actor = Ln(e), this.actor.start(), this.addSubscription(
|
|
876
876
|
this.subscribe((n) => {
|
|
877
877
|
const s = n.value;
|
|
878
878
|
this.stateChangeListeners.forEach((r) => {
|
|
@@ -914,27 +914,28 @@ class te {
|
|
|
914
914
|
return this.subscriptions.push(n), n;
|
|
915
915
|
}
|
|
916
916
|
}
|
|
917
|
-
const
|
|
918
|
-
class
|
|
919
|
-
resolveParametersRequester = new
|
|
917
|
+
const Ft = "Not ready for connection", ds = (t) => t instanceof Error && t.message === Ft, hs = () => new Error(Ft), us = async (t) => typeof t == "function" ? t() : t, X = N("ConnectionManager: ConnectionFlow"), gs = 3;
|
|
918
|
+
class Es {
|
|
919
|
+
resolveParametersRequester = new pe(us);
|
|
920
920
|
cancelableConnectWithRepeatedCalls;
|
|
921
921
|
numberOfConnectionAttempts;
|
|
922
922
|
dependencies;
|
|
923
923
|
constructor(e, {
|
|
924
|
-
numberOfConnectionAttempts: n =
|
|
924
|
+
numberOfConnectionAttempts: n = gs
|
|
925
925
|
} = {}) {
|
|
926
926
|
this.dependencies = e, this.numberOfConnectionAttempts = n, this.proxyEvents();
|
|
927
927
|
}
|
|
928
|
-
connect = async (e, n) => (this.dependencies.stateMachine.toStartConnect(), this.dependencies.events.trigger("connect-started", {}), this.cancelRequests(), this.resolveParametersRequester.request(e).then((s) => (this.dependencies.events.trigger("connect-parameters-resolve-success", s), s)).catch((s) => {
|
|
928
|
+
connect = async (e, n) => (X("connect", e, n), this.dependencies.stateMachine.toStartConnect(), this.dependencies.events.trigger("connect-started", {}), this.cancelRequests(), this.resolveParametersRequester.request(e).then((s) => (this.dependencies.events.trigger("connect-parameters-resolve-success", s), s)).catch((s) => {
|
|
929
929
|
throw this.dependencies.events.trigger("connect-parameters-resolve-failed", s), s;
|
|
930
|
-
}).then(async (s) => this.connectWithDuplicatedCalls(s, n)).then((s) => (this.dependencies.events.trigger("connect-succeeded", {
|
|
930
|
+
}).then(async (s) => this.connectWithDuplicatedCalls(s, n)).then((s) => (X("connect: succeeded", s), this.dependencies.events.trigger("connect-succeeded", {
|
|
931
931
|
...s
|
|
932
932
|
}), s)).catch((s) => {
|
|
933
|
+
X("connect: error", s);
|
|
933
934
|
const r = s ?? new Error("Failed to connect to server");
|
|
934
|
-
throw
|
|
935
|
+
throw He(r) || this.dependencies.events.trigger("connect-failed", r), r;
|
|
935
936
|
}));
|
|
936
937
|
disconnect = async ({ cancelRequests: e = !0 } = {}) => {
|
|
937
|
-
e && this.cancelRequests(), this.dependencies.events.trigger("disconnecting", {});
|
|
938
|
+
X("disconnect", { cancelRequests: e }), e && this.cancelRequests(), this.dependencies.events.trigger("disconnecting", {});
|
|
938
939
|
const n = new Promise((r) => {
|
|
939
940
|
this.dependencies.events.once("disconnected", () => {
|
|
940
941
|
r();
|
|
@@ -945,14 +946,14 @@ class us {
|
|
|
945
946
|
});
|
|
946
947
|
};
|
|
947
948
|
cancelRequests() {
|
|
948
|
-
this.resolveParametersRequester.cancelRequest(), this.cancelConnectWithRepeatedCalls();
|
|
949
|
+
X("cancelRequests"), this.resolveParametersRequester.cancelRequest(), this.cancelConnectWithRepeatedCalls();
|
|
949
950
|
}
|
|
950
951
|
connectWithDuplicatedCalls = async (e, { numberOfConnectionAttempts: n = this.numberOfConnectionAttempts } = {}) => {
|
|
951
952
|
const s = async () => this.connectInner(e), r = (i) => {
|
|
952
|
-
const c = this.dependencies.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), g = i != null &&
|
|
953
|
+
const c = this.dependencies.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), g = i != null && !$n(i);
|
|
953
954
|
return c || g;
|
|
954
955
|
};
|
|
955
|
-
return this.cancelableConnectWithRepeatedCalls =
|
|
956
|
+
return this.cancelableConnectWithRepeatedCalls = We({
|
|
956
957
|
targetFunction: s,
|
|
957
958
|
isComplete: r,
|
|
958
959
|
callLimit: n,
|
|
@@ -985,8 +986,8 @@ class us {
|
|
|
985
986
|
register: _ = !1,
|
|
986
987
|
extraHeaders: q = []
|
|
987
988
|
}) => {
|
|
988
|
-
this.dependencies.getUa() && await this.disconnect({ cancelRequests: !1 });
|
|
989
|
-
const { ua:
|
|
989
|
+
X("initUa"), this.dependencies.getUa() && await this.disconnect({ cancelRequests: !1 });
|
|
990
|
+
const { ua: Z, helpers: se } = this.dependencies.uaFactory.createUAWithConfiguration(
|
|
990
991
|
{
|
|
991
992
|
user: e,
|
|
992
993
|
password: n,
|
|
@@ -1004,21 +1005,21 @@ class us {
|
|
|
1004
1005
|
},
|
|
1005
1006
|
this.dependencies.events
|
|
1006
1007
|
);
|
|
1007
|
-
this.dependencies.setUa(
|
|
1008
|
-
const
|
|
1009
|
-
return { ua:
|
|
1008
|
+
this.dependencies.setUa(Z), this.dependencies.setGetUri(se.getUri), this.dependencies.setSocket(se.socket);
|
|
1009
|
+
const _e = Z.configuration.uri.user;
|
|
1010
|
+
return { ua: Z, configuration: {
|
|
1010
1011
|
sipServerIp: s,
|
|
1011
1012
|
sipServerUrl: r,
|
|
1012
1013
|
remoteAddress: i,
|
|
1013
1014
|
iceServers: a,
|
|
1014
1015
|
displayName: y,
|
|
1015
|
-
authorizationUser:
|
|
1016
|
+
authorizationUser: _e,
|
|
1016
1017
|
register: _,
|
|
1017
1018
|
user: e,
|
|
1018
1019
|
password: n
|
|
1019
1020
|
} };
|
|
1020
1021
|
};
|
|
1021
|
-
start = async (e) => new Promise((n, s) => {
|
|
1022
|
+
start = async (e) => (X("start", e), new Promise((n, s) => {
|
|
1022
1023
|
const r = this.dependencies.getUa();
|
|
1023
1024
|
if (!r) {
|
|
1024
1025
|
s(new Error("this.ua is not initialized"));
|
|
@@ -1037,11 +1038,11 @@ class us {
|
|
|
1037
1038
|
});
|
|
1038
1039
|
};
|
|
1039
1040
|
})(() => {
|
|
1040
|
-
i?.(), n(e);
|
|
1041
|
+
X("start: resolveUa"), i?.(), n(e);
|
|
1041
1042
|
}, (g) => {
|
|
1042
1043
|
i?.(), s(g);
|
|
1043
1044
|
}), this.dependencies.stateMachine.toStartUa(e), r.start();
|
|
1044
|
-
});
|
|
1045
|
+
}));
|
|
1045
1046
|
cancelConnectWithRepeatedCalls() {
|
|
1046
1047
|
this.cancelableConnectWithRepeatedCalls?.cancel();
|
|
1047
1048
|
}
|
|
@@ -1052,51 +1053,51 @@ class us {
|
|
|
1052
1053
|
});
|
|
1053
1054
|
}
|
|
1054
1055
|
}
|
|
1055
|
-
var l = /* @__PURE__ */ ((t) => (t.IDLE = "connection:idle", t.PREPARING = "connection:preparing", t.CONNECTING = "connection:connecting", t.CONNECTED = "connection:connected", t.REGISTERED = "connection:registered", t.ESTABLISHED = "connection:established", t.DISCONNECTING = "connection:disconnecting", t.DISCONNECTED = "connection:disconnected", t))(l || {}),
|
|
1056
|
-
const
|
|
1056
|
+
var l = /* @__PURE__ */ ((t) => (t.IDLE = "connection:idle", t.PREPARING = "connection:preparing", t.CONNECTING = "connection:connecting", t.CONNECTED = "connection:connected", t.REGISTERED = "connection:registered", t.ESTABLISHED = "connection:established", t.DISCONNECTING = "connection:disconnecting", t.DISCONNECTED = "connection:disconnected", t))(l || {}), A = /* @__PURE__ */ ((t) => (t.LOG_TRANSITION = "logTransition", t.LOG_STATE_CHANGE = "logStateChange", t.SET_CONNECTION_CONFIGURATION = "setConnectionConfiguration", t.CLEAR_CONNECTION_CONFIGURATION = "clearConnectionConfiguration", t))(A || {}), m = /* @__PURE__ */ ((t) => (t.START_CONNECT = "START_CONNECT", t.START_UA = "START_UA", t.START_DISCONNECT = "START_DISCONNECT", t.UA_CONNECTED = "UA_CONNECTED", t.UA_CONNECTING = "UA_CONNECTING", t.UA_REGISTERED = "UA_REGISTERED", t.UA_UNREGISTERED = "UA_UNREGISTERED", t.UA_DISCONNECTED = "UA_DISCONNECTED", t.RESET = "RESET", t))(m || {});
|
|
1057
|
+
const Ut = {
|
|
1057
1058
|
connectionConfiguration: void 0
|
|
1058
|
-
},
|
|
1059
|
+
}, st = N("ConnectionManager: createConnectionMachineSetup"), ms = () => te({
|
|
1059
1060
|
types: {
|
|
1060
|
-
context:
|
|
1061
|
+
context: Ut,
|
|
1061
1062
|
events: {}
|
|
1062
1063
|
},
|
|
1063
1064
|
guards: {
|
|
1064
1065
|
canAutoEstablish: ({ context: t }) => t.connectionConfiguration?.register !== !0
|
|
1065
1066
|
},
|
|
1066
1067
|
actions: {
|
|
1067
|
-
[
|
|
1068
|
+
[A.SET_CONNECTION_CONFIGURATION]: I(({ event: t }) => ({
|
|
1068
1069
|
connectionConfiguration: { ...t.configuration }
|
|
1069
1070
|
})),
|
|
1070
|
-
[
|
|
1071
|
+
[A.CLEAR_CONNECTION_CONFIGURATION]: I(() => ({
|
|
1071
1072
|
connectionConfiguration: void 0
|
|
1072
1073
|
})),
|
|
1073
|
-
[
|
|
1074
|
-
|
|
1074
|
+
[A.LOG_TRANSITION]: (t, e) => {
|
|
1075
|
+
st(`State transition: ${e.from} -> ${e.to} (${e.event})`);
|
|
1075
1076
|
},
|
|
1076
|
-
[
|
|
1077
|
-
|
|
1077
|
+
[A.LOG_STATE_CHANGE]: (t, e) => {
|
|
1078
|
+
st("ConnectionStateMachine state changed", e.state);
|
|
1078
1079
|
}
|
|
1079
1080
|
}
|
|
1080
|
-
}),
|
|
1081
|
+
}), Ts = () => ms().createMachine({
|
|
1081
1082
|
id: "connection",
|
|
1082
1083
|
initial: l.IDLE,
|
|
1083
|
-
context:
|
|
1084
|
+
context: Ut,
|
|
1084
1085
|
states: {
|
|
1085
1086
|
[l.IDLE]: {
|
|
1086
1087
|
entry: [
|
|
1087
1088
|
{
|
|
1088
|
-
type:
|
|
1089
|
+
type: A.LOG_STATE_CHANGE,
|
|
1089
1090
|
params: { state: l.IDLE }
|
|
1090
1091
|
},
|
|
1091
1092
|
{
|
|
1092
|
-
type:
|
|
1093
|
+
type: A.CLEAR_CONNECTION_CONFIGURATION
|
|
1093
1094
|
}
|
|
1094
1095
|
],
|
|
1095
1096
|
on: {
|
|
1096
1097
|
[m.START_CONNECT]: {
|
|
1097
1098
|
target: l.PREPARING,
|
|
1098
1099
|
actions: {
|
|
1099
|
-
type:
|
|
1100
|
+
type: A.LOG_TRANSITION,
|
|
1100
1101
|
params: {
|
|
1101
1102
|
from: l.IDLE,
|
|
1102
1103
|
to: l.PREPARING,
|
|
@@ -1108,16 +1109,16 @@ const kt = {
|
|
|
1108
1109
|
},
|
|
1109
1110
|
[l.PREPARING]: {
|
|
1110
1111
|
entry: {
|
|
1111
|
-
type:
|
|
1112
|
+
type: A.LOG_STATE_CHANGE,
|
|
1112
1113
|
params: { state: l.PREPARING }
|
|
1113
1114
|
},
|
|
1114
1115
|
on: {
|
|
1115
1116
|
[m.START_UA]: {
|
|
1116
1117
|
target: l.CONNECTING,
|
|
1117
1118
|
actions: [
|
|
1118
|
-
|
|
1119
|
+
A.SET_CONNECTION_CONFIGURATION,
|
|
1119
1120
|
{
|
|
1120
|
-
type:
|
|
1121
|
+
type: A.LOG_TRANSITION,
|
|
1121
1122
|
params: {
|
|
1122
1123
|
from: l.PREPARING,
|
|
1123
1124
|
to: l.CONNECTING,
|
|
@@ -1129,7 +1130,7 @@ const kt = {
|
|
|
1129
1130
|
[m.UA_DISCONNECTED]: {
|
|
1130
1131
|
target: l.DISCONNECTED,
|
|
1131
1132
|
actions: {
|
|
1132
|
-
type:
|
|
1133
|
+
type: A.LOG_TRANSITION,
|
|
1133
1134
|
params: {
|
|
1134
1135
|
from: l.PREPARING,
|
|
1135
1136
|
to: l.DISCONNECTED,
|
|
@@ -1141,14 +1142,14 @@ const kt = {
|
|
|
1141
1142
|
},
|
|
1142
1143
|
[l.CONNECTING]: {
|
|
1143
1144
|
entry: {
|
|
1144
|
-
type:
|
|
1145
|
+
type: A.LOG_STATE_CHANGE,
|
|
1145
1146
|
params: { state: l.CONNECTING }
|
|
1146
1147
|
},
|
|
1147
1148
|
on: {
|
|
1148
1149
|
[m.UA_CONNECTED]: {
|
|
1149
1150
|
target: l.CONNECTED,
|
|
1150
1151
|
actions: {
|
|
1151
|
-
type:
|
|
1152
|
+
type: A.LOG_TRANSITION,
|
|
1152
1153
|
params: {
|
|
1153
1154
|
from: l.CONNECTING,
|
|
1154
1155
|
to: l.CONNECTED,
|
|
@@ -1159,7 +1160,7 @@ const kt = {
|
|
|
1159
1160
|
[m.UA_REGISTERED]: {
|
|
1160
1161
|
target: l.REGISTERED,
|
|
1161
1162
|
actions: {
|
|
1162
|
-
type:
|
|
1163
|
+
type: A.LOG_TRANSITION,
|
|
1163
1164
|
params: {
|
|
1164
1165
|
from: l.CONNECTING,
|
|
1165
1166
|
to: l.REGISTERED,
|
|
@@ -1170,7 +1171,7 @@ const kt = {
|
|
|
1170
1171
|
[m.START_DISCONNECT]: {
|
|
1171
1172
|
target: l.DISCONNECTING,
|
|
1172
1173
|
actions: {
|
|
1173
|
-
type:
|
|
1174
|
+
type: A.LOG_TRANSITION,
|
|
1174
1175
|
params: {
|
|
1175
1176
|
from: l.CONNECTING,
|
|
1176
1177
|
to: l.DISCONNECTING,
|
|
@@ -1181,7 +1182,7 @@ const kt = {
|
|
|
1181
1182
|
[m.UA_DISCONNECTED]: {
|
|
1182
1183
|
target: l.DISCONNECTED,
|
|
1183
1184
|
actions: {
|
|
1184
|
-
type:
|
|
1185
|
+
type: A.LOG_TRANSITION,
|
|
1185
1186
|
params: {
|
|
1186
1187
|
from: l.CONNECTING,
|
|
1187
1188
|
to: l.DISCONNECTED,
|
|
@@ -1193,14 +1194,14 @@ const kt = {
|
|
|
1193
1194
|
},
|
|
1194
1195
|
[l.CONNECTED]: {
|
|
1195
1196
|
entry: {
|
|
1196
|
-
type:
|
|
1197
|
+
type: A.LOG_STATE_CHANGE,
|
|
1197
1198
|
params: { state: l.CONNECTED }
|
|
1198
1199
|
},
|
|
1199
1200
|
always: {
|
|
1200
1201
|
target: l.ESTABLISHED,
|
|
1201
1202
|
guard: "canAutoEstablish",
|
|
1202
1203
|
actions: {
|
|
1203
|
-
type:
|
|
1204
|
+
type: A.LOG_TRANSITION,
|
|
1204
1205
|
params: {
|
|
1205
1206
|
from: l.CONNECTED,
|
|
1206
1207
|
to: l.ESTABLISHED,
|
|
@@ -1212,7 +1213,7 @@ const kt = {
|
|
|
1212
1213
|
[m.UA_REGISTERED]: {
|
|
1213
1214
|
target: l.REGISTERED,
|
|
1214
1215
|
actions: {
|
|
1215
|
-
type:
|
|
1216
|
+
type: A.LOG_TRANSITION,
|
|
1216
1217
|
params: {
|
|
1217
1218
|
from: l.CONNECTED,
|
|
1218
1219
|
to: l.REGISTERED,
|
|
@@ -1223,7 +1224,7 @@ const kt = {
|
|
|
1223
1224
|
[m.START_DISCONNECT]: {
|
|
1224
1225
|
target: l.DISCONNECTING,
|
|
1225
1226
|
actions: {
|
|
1226
|
-
type:
|
|
1227
|
+
type: A.LOG_TRANSITION,
|
|
1227
1228
|
params: {
|
|
1228
1229
|
from: l.CONNECTED,
|
|
1229
1230
|
to: l.DISCONNECTING,
|
|
@@ -1234,7 +1235,7 @@ const kt = {
|
|
|
1234
1235
|
[m.UA_DISCONNECTED]: {
|
|
1235
1236
|
target: l.DISCONNECTED,
|
|
1236
1237
|
actions: {
|
|
1237
|
-
type:
|
|
1238
|
+
type: A.LOG_TRANSITION,
|
|
1238
1239
|
params: {
|
|
1239
1240
|
from: l.CONNECTED,
|
|
1240
1241
|
to: l.DISCONNECTED,
|
|
@@ -1246,13 +1247,13 @@ const kt = {
|
|
|
1246
1247
|
},
|
|
1247
1248
|
[l.REGISTERED]: {
|
|
1248
1249
|
entry: {
|
|
1249
|
-
type:
|
|
1250
|
+
type: A.LOG_STATE_CHANGE,
|
|
1250
1251
|
params: { state: l.REGISTERED }
|
|
1251
1252
|
},
|
|
1252
1253
|
always: {
|
|
1253
1254
|
target: l.ESTABLISHED,
|
|
1254
1255
|
actions: {
|
|
1255
|
-
type:
|
|
1256
|
+
type: A.LOG_TRANSITION,
|
|
1256
1257
|
params: {
|
|
1257
1258
|
from: l.REGISTERED,
|
|
1258
1259
|
to: l.ESTABLISHED,
|
|
@@ -1264,7 +1265,7 @@ const kt = {
|
|
|
1264
1265
|
[m.UA_UNREGISTERED]: {
|
|
1265
1266
|
target: l.CONNECTED,
|
|
1266
1267
|
actions: {
|
|
1267
|
-
type:
|
|
1268
|
+
type: A.LOG_TRANSITION,
|
|
1268
1269
|
params: {
|
|
1269
1270
|
from: l.REGISTERED,
|
|
1270
1271
|
to: l.CONNECTED,
|
|
@@ -1275,7 +1276,7 @@ const kt = {
|
|
|
1275
1276
|
[m.START_DISCONNECT]: {
|
|
1276
1277
|
target: l.DISCONNECTING,
|
|
1277
1278
|
actions: {
|
|
1278
|
-
type:
|
|
1279
|
+
type: A.LOG_TRANSITION,
|
|
1279
1280
|
params: {
|
|
1280
1281
|
from: l.REGISTERED,
|
|
1281
1282
|
to: l.DISCONNECTING,
|
|
@@ -1286,7 +1287,7 @@ const kt = {
|
|
|
1286
1287
|
[m.UA_DISCONNECTED]: {
|
|
1287
1288
|
target: l.DISCONNECTED,
|
|
1288
1289
|
actions: {
|
|
1289
|
-
type:
|
|
1290
|
+
type: A.LOG_TRANSITION,
|
|
1290
1291
|
params: {
|
|
1291
1292
|
from: l.REGISTERED,
|
|
1292
1293
|
to: l.DISCONNECTED,
|
|
@@ -1298,14 +1299,14 @@ const kt = {
|
|
|
1298
1299
|
},
|
|
1299
1300
|
[l.ESTABLISHED]: {
|
|
1300
1301
|
entry: {
|
|
1301
|
-
type:
|
|
1302
|
+
type: A.LOG_STATE_CHANGE,
|
|
1302
1303
|
params: { state: l.ESTABLISHED }
|
|
1303
1304
|
},
|
|
1304
1305
|
on: {
|
|
1305
1306
|
[m.START_DISCONNECT]: {
|
|
1306
1307
|
target: l.DISCONNECTING,
|
|
1307
1308
|
actions: {
|
|
1308
|
-
type:
|
|
1309
|
+
type: A.LOG_TRANSITION,
|
|
1309
1310
|
params: {
|
|
1310
1311
|
from: l.ESTABLISHED,
|
|
1311
1312
|
to: l.DISCONNECTING,
|
|
@@ -1316,7 +1317,7 @@ const kt = {
|
|
|
1316
1317
|
[m.UA_DISCONNECTED]: {
|
|
1317
1318
|
target: l.DISCONNECTED,
|
|
1318
1319
|
actions: {
|
|
1319
|
-
type:
|
|
1320
|
+
type: A.LOG_TRANSITION,
|
|
1320
1321
|
params: {
|
|
1321
1322
|
from: l.ESTABLISHED,
|
|
1322
1323
|
to: l.DISCONNECTED,
|
|
@@ -1327,7 +1328,7 @@ const kt = {
|
|
|
1327
1328
|
[m.RESET]: {
|
|
1328
1329
|
target: l.IDLE,
|
|
1329
1330
|
actions: {
|
|
1330
|
-
type:
|
|
1331
|
+
type: A.LOG_TRANSITION,
|
|
1331
1332
|
params: {
|
|
1332
1333
|
from: l.ESTABLISHED,
|
|
1333
1334
|
to: l.IDLE,
|
|
@@ -1339,14 +1340,14 @@ const kt = {
|
|
|
1339
1340
|
},
|
|
1340
1341
|
[l.DISCONNECTING]: {
|
|
1341
1342
|
entry: {
|
|
1342
|
-
type:
|
|
1343
|
+
type: A.LOG_STATE_CHANGE,
|
|
1343
1344
|
params: { state: l.DISCONNECTING }
|
|
1344
1345
|
},
|
|
1345
1346
|
on: {
|
|
1346
1347
|
[m.UA_DISCONNECTED]: {
|
|
1347
1348
|
target: l.DISCONNECTED,
|
|
1348
1349
|
actions: {
|
|
1349
|
-
type:
|
|
1350
|
+
type: A.LOG_TRANSITION,
|
|
1350
1351
|
params: {
|
|
1351
1352
|
from: l.DISCONNECTING,
|
|
1352
1353
|
to: l.DISCONNECTED,
|
|
@@ -1358,7 +1359,7 @@ const kt = {
|
|
|
1358
1359
|
},
|
|
1359
1360
|
[l.DISCONNECTED]: {
|
|
1360
1361
|
entry: {
|
|
1361
|
-
type:
|
|
1362
|
+
type: A.LOG_STATE_CHANGE,
|
|
1362
1363
|
params: { state: l.DISCONNECTED }
|
|
1363
1364
|
},
|
|
1364
1365
|
on: {
|
|
@@ -1366,7 +1367,7 @@ const kt = {
|
|
|
1366
1367
|
target: l.IDLE,
|
|
1367
1368
|
actions: [
|
|
1368
1369
|
{
|
|
1369
|
-
type:
|
|
1370
|
+
type: A.LOG_TRANSITION,
|
|
1370
1371
|
params: {
|
|
1371
1372
|
from: l.DISCONNECTED,
|
|
1372
1373
|
to: l.IDLE,
|
|
@@ -1378,7 +1379,7 @@ const kt = {
|
|
|
1378
1379
|
[m.START_CONNECT]: {
|
|
1379
1380
|
target: l.PREPARING,
|
|
1380
1381
|
actions: {
|
|
1381
|
-
type:
|
|
1382
|
+
type: A.LOG_TRANSITION,
|
|
1382
1383
|
params: {
|
|
1383
1384
|
from: l.DISCONNECTED,
|
|
1384
1385
|
to: l.PREPARING,
|
|
@@ -1389,7 +1390,7 @@ const kt = {
|
|
|
1389
1390
|
[m.UA_CONNECTING]: {
|
|
1390
1391
|
target: l.CONNECTING,
|
|
1391
1392
|
actions: {
|
|
1392
|
-
type:
|
|
1393
|
+
type: A.LOG_TRANSITION,
|
|
1393
1394
|
params: {
|
|
1394
1395
|
from: l.DISCONNECTED,
|
|
1395
1396
|
to: l.CONNECTING,
|
|
@@ -1400,12 +1401,12 @@ const kt = {
|
|
|
1400
1401
|
}
|
|
1401
1402
|
}
|
|
1402
1403
|
}
|
|
1403
|
-
}),
|
|
1404
|
-
class
|
|
1404
|
+
}), ps = Ts(), Ss = N("ConnectionManager: ConnectionStateMachine");
|
|
1405
|
+
class Cs extends ne {
|
|
1405
1406
|
events;
|
|
1406
1407
|
unsubscribeFromEvents;
|
|
1407
1408
|
constructor(e) {
|
|
1408
|
-
super(
|
|
1409
|
+
super(ps), this.events = e, this.subscribeToEvents();
|
|
1409
1410
|
}
|
|
1410
1411
|
get isIdle() {
|
|
1411
1412
|
return this.hasState(l.IDLE);
|
|
@@ -1467,7 +1468,7 @@ class ps extends te {
|
|
|
1467
1468
|
}
|
|
1468
1469
|
sendEvent(e) {
|
|
1469
1470
|
if (!this.actor.getSnapshot().can(e)) {
|
|
1470
|
-
|
|
1471
|
+
Ss(
|
|
1471
1472
|
`Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`
|
|
1472
1473
|
);
|
|
1473
1474
|
return;
|
|
@@ -1501,7 +1502,7 @@ class ps extends te {
|
|
|
1501
1502
|
};
|
|
1502
1503
|
}
|
|
1503
1504
|
}
|
|
1504
|
-
const
|
|
1505
|
+
const Bt = [
|
|
1505
1506
|
"connecting",
|
|
1506
1507
|
"connected",
|
|
1507
1508
|
"disconnected",
|
|
@@ -1511,7 +1512,7 @@ const Ft = [
|
|
|
1511
1512
|
"registrationFailed",
|
|
1512
1513
|
"newMessage",
|
|
1513
1514
|
"sipEvent"
|
|
1514
|
-
],
|
|
1515
|
+
], Rs = [
|
|
1515
1516
|
"disconnecting",
|
|
1516
1517
|
"connect-started",
|
|
1517
1518
|
"connect-succeeded",
|
|
@@ -1519,8 +1520,8 @@ const Ft = [
|
|
|
1519
1520
|
"connect-parameters-resolve-success",
|
|
1520
1521
|
"connect-parameters-resolve-failed",
|
|
1521
1522
|
"connected-with-configuration"
|
|
1522
|
-
],
|
|
1523
|
-
class
|
|
1523
|
+
], $t = [...Bt, ...Rs], Ns = () => new k($t), As = N("ConnectionManager: RegistrationManager");
|
|
1524
|
+
class Is {
|
|
1524
1525
|
events;
|
|
1525
1526
|
getUaProtected;
|
|
1526
1527
|
constructor(e) {
|
|
@@ -1542,7 +1543,7 @@ class Ns {
|
|
|
1542
1543
|
try {
|
|
1543
1544
|
await this.unregister();
|
|
1544
1545
|
} catch (e) {
|
|
1545
|
-
|
|
1546
|
+
As("tryRegister", e);
|
|
1546
1547
|
}
|
|
1547
1548
|
return this.register();
|
|
1548
1549
|
}
|
|
@@ -1557,8 +1558,8 @@ class Ns {
|
|
|
1557
1558
|
};
|
|
1558
1559
|
}
|
|
1559
1560
|
}
|
|
1560
|
-
const
|
|
1561
|
-
class
|
|
1561
|
+
const fs = 1e4;
|
|
1562
|
+
class vs {
|
|
1562
1563
|
uaFactory;
|
|
1563
1564
|
getUaProtected;
|
|
1564
1565
|
constructor(e) {
|
|
@@ -1592,7 +1593,7 @@ class Is {
|
|
|
1592
1593
|
*/
|
|
1593
1594
|
async ping(e, n) {
|
|
1594
1595
|
const r = this.getUaProtected().configuration.uri;
|
|
1595
|
-
return this.sendOptions(r, e, n,
|
|
1596
|
+
return this.sendOptions(r, e, n, fs);
|
|
1596
1597
|
}
|
|
1597
1598
|
/**
|
|
1598
1599
|
* Проверяет доступность телефонии, создавая временное соединение
|
|
@@ -1625,14 +1626,14 @@ class Is {
|
|
|
1625
1626
|
});
|
|
1626
1627
|
}
|
|
1627
1628
|
}
|
|
1628
|
-
function
|
|
1629
|
+
function Ms(t) {
|
|
1629
1630
|
return (e) => `sip:${e}@${t}`;
|
|
1630
1631
|
}
|
|
1631
|
-
const
|
|
1632
|
+
const Os = (t, e) => () => Math.floor(Math.random() * (e - t)) + t, _s = (t) => t.trim().replaceAll(" ", "_"), bs = Os(1e5, 99999999), ys = (t) => {
|
|
1632
1633
|
const e = [];
|
|
1633
1634
|
return t !== void 0 && t !== "" && e.push(`X-Vinteo-Remote: ${t}`), e;
|
|
1634
1635
|
};
|
|
1635
|
-
class
|
|
1636
|
+
class ce {
|
|
1636
1637
|
JsSIP;
|
|
1637
1638
|
constructor(e) {
|
|
1638
1639
|
this.JsSIP = e;
|
|
@@ -1657,10 +1658,10 @@ class oe {
|
|
|
1657
1658
|
throw new Error("user is required for authorized connection");
|
|
1658
1659
|
}
|
|
1659
1660
|
static resolveAuthorizationUser(e, n) {
|
|
1660
|
-
return e && n !== void 0 && n.trim() !== "" ? n.trim() : `${
|
|
1661
|
+
return e && n !== void 0 && n.trim() !== "" ? n.trim() : `${bs()}`;
|
|
1661
1662
|
}
|
|
1662
1663
|
static buildExtraHeaders(e, n) {
|
|
1663
|
-
const s = e !== void 0 && e !== "" ?
|
|
1664
|
+
const s = e !== void 0 && e !== "" ? ys(e) : [];
|
|
1664
1665
|
return n === void 0 ? s : [...s, ...n];
|
|
1665
1666
|
}
|
|
1666
1667
|
createConfiguration({
|
|
@@ -1677,20 +1678,20 @@ class oe {
|
|
|
1677
1678
|
connectionRecoveryMaxInterval: C = 6,
|
|
1678
1679
|
userAgent: f
|
|
1679
1680
|
}) {
|
|
1680
|
-
|
|
1681
|
+
ce.validateParametersConnection({
|
|
1681
1682
|
register: a,
|
|
1682
1683
|
password: n,
|
|
1683
1684
|
user: e,
|
|
1684
1685
|
sipServerIp: i,
|
|
1685
1686
|
sipServerUrl: s
|
|
1686
1687
|
});
|
|
1687
|
-
const y =
|
|
1688
|
+
const y = ce.resolveAuthorizationUser(a, e), _ = Ms(i), q = _(y), B = new this.JsSIP.WebSocketInterface(`wss://${s}/webrtc/wss/`);
|
|
1688
1689
|
return {
|
|
1689
1690
|
configuration: {
|
|
1690
1691
|
password: n,
|
|
1691
1692
|
register: a,
|
|
1692
1693
|
uri: q,
|
|
1693
|
-
display_name:
|
|
1694
|
+
display_name: _s(r),
|
|
1694
1695
|
user_agent: f,
|
|
1695
1696
|
sockets: [B],
|
|
1696
1697
|
session_timers: o,
|
|
@@ -1705,7 +1706,7 @@ class oe {
|
|
|
1705
1706
|
};
|
|
1706
1707
|
}
|
|
1707
1708
|
createUA({ remoteAddress: e, extraHeaders: n, ...s }) {
|
|
1708
|
-
const r = new this.JsSIP.UA(s), i =
|
|
1709
|
+
const r = new this.JsSIP.UA(s), i = ce.buildExtraHeaders(e, n);
|
|
1709
1710
|
return i.length > 0 && r.registrator().setExtraHeaders(i), r;
|
|
1710
1711
|
}
|
|
1711
1712
|
/**
|
|
@@ -1718,13 +1719,13 @@ class oe {
|
|
|
1718
1719
|
extraHeaders: e.extraHeaders
|
|
1719
1720
|
});
|
|
1720
1721
|
return n.eachTriggers((a, o) => {
|
|
1721
|
-
const c =
|
|
1722
|
+
const c = Bt.find((g) => g === o);
|
|
1722
1723
|
c && i.on(c, a);
|
|
1723
1724
|
}), { ua: i, helpers: r };
|
|
1724
1725
|
}
|
|
1725
1726
|
}
|
|
1726
|
-
const
|
|
1727
|
-
class
|
|
1727
|
+
const Ds = N("ConnectionManager");
|
|
1728
|
+
class Ps extends w {
|
|
1728
1729
|
stateMachine;
|
|
1729
1730
|
ua;
|
|
1730
1731
|
socket;
|
|
@@ -1735,13 +1736,13 @@ class ys extends w {
|
|
|
1735
1736
|
constructor({ JsSIP: e }, {
|
|
1736
1737
|
numberOfConnectionAttempts: n
|
|
1737
1738
|
} = {}) {
|
|
1738
|
-
super(
|
|
1739
|
+
super(Ns()), this.uaFactory = new ce(e), this.registrationManager = new Is({
|
|
1739
1740
|
events: this.events,
|
|
1740
1741
|
getUaProtected: this.getUaProtected
|
|
1741
|
-
}), this.stateMachine = new
|
|
1742
|
+
}), this.stateMachine = new Cs(this.events), this.sipOperations = new vs({
|
|
1742
1743
|
uaFactory: this.uaFactory,
|
|
1743
1744
|
getUaProtected: this.getUaProtected
|
|
1744
|
-
}), this.connectionFlow = new
|
|
1745
|
+
}), this.connectionFlow = new Es(
|
|
1745
1746
|
{
|
|
1746
1747
|
events: this.events,
|
|
1747
1748
|
uaFactory: this.uaFactory,
|
|
@@ -1783,13 +1784,13 @@ class ys extends w {
|
|
|
1783
1784
|
return this.stateMachine.state;
|
|
1784
1785
|
}
|
|
1785
1786
|
get isRegistered() {
|
|
1786
|
-
return
|
|
1787
|
+
return ce.isRegisteredUA(this.ua);
|
|
1787
1788
|
}
|
|
1788
1789
|
get isRegisterConfig() {
|
|
1789
1790
|
return this.stateMachine.isRegisterEnabled();
|
|
1790
1791
|
}
|
|
1791
1792
|
connect = async (e, n) => this.disconnect().catch((s) => {
|
|
1792
|
-
|
|
1793
|
+
Ds("connect: disconnect error", s);
|
|
1793
1794
|
}).then(async () => this.connectWithProcessError(e, n));
|
|
1794
1795
|
disconnect = async () => {
|
|
1795
1796
|
if (this.isConfigured() || this.requested)
|
|
@@ -1829,7 +1830,7 @@ class ys extends w {
|
|
|
1829
1830
|
getUa = () => this.ua;
|
|
1830
1831
|
connectWithProcessError = async (e, n) => {
|
|
1831
1832
|
if (!(n?.hasReadyForConnection?.() ?? !0))
|
|
1832
|
-
throw
|
|
1833
|
+
throw hs();
|
|
1833
1834
|
return this.connectionFlow.connect(e, n).catch(async (r) => {
|
|
1834
1835
|
const i = r;
|
|
1835
1836
|
return this.disconnect().then(() => {
|
|
@@ -1840,9 +1841,9 @@ class ys extends w {
|
|
|
1840
1841
|
});
|
|
1841
1842
|
};
|
|
1842
1843
|
}
|
|
1843
|
-
class
|
|
1844
|
+
class Ls {
|
|
1844
1845
|
connectionManager;
|
|
1845
|
-
stackPromises =
|
|
1846
|
+
stackPromises = Pt({
|
|
1846
1847
|
noRunIsNotActual: !0
|
|
1847
1848
|
});
|
|
1848
1849
|
constructor({ connectionManager: e }) {
|
|
@@ -1857,7 +1858,7 @@ class Ds {
|
|
|
1857
1858
|
const z = (t) => {
|
|
1858
1859
|
if (t !== null && typeof t == "object" && "error" in t)
|
|
1859
1860
|
return t.error;
|
|
1860
|
-
}, b =
|
|
1861
|
+
}, b = N("AutoConnectorManager: createAutoConnectorMachineSetup"), rt = (t) => t.parameters, ws = (t) => te({
|
|
1861
1862
|
types: {
|
|
1862
1863
|
context: {},
|
|
1863
1864
|
events: {}
|
|
@@ -1865,17 +1866,17 @@ const z = (t) => {
|
|
|
1865
1866
|
/** Асинхронные шаги: остановка флоу, коннект, задержка + beforeRetry. */
|
|
1866
1867
|
actors: {
|
|
1867
1868
|
/** Invoke при входе в `disconnecting`: единый «срез» текущего подключения. */
|
|
1868
|
-
stopConnectionFlow:
|
|
1869
|
+
stopConnectionFlow: oe(async () => {
|
|
1869
1870
|
b("stopConnectionFlow"), await t.stopConnectionFlow();
|
|
1870
1871
|
}),
|
|
1871
1872
|
/** Invoke в `attemptingConnect`: реальный SIP/WebSocket connect. */
|
|
1872
|
-
connect:
|
|
1873
|
+
connect: oe(async ({ input: e }) => {
|
|
1873
1874
|
if (b("connect", e), !e)
|
|
1874
1875
|
throw new Error("Auto connector parameters are missing in attemptingConnect state");
|
|
1875
1876
|
await t.connect(e);
|
|
1876
1877
|
}),
|
|
1877
1878
|
/** Invoke в `waitingBeforeRetry`: сначала задержка между попытками. */
|
|
1878
|
-
waitBeforeRetry:
|
|
1879
|
+
waitBeforeRetry: oe(async () => {
|
|
1879
1880
|
b("waitBeforeRetry"), await t.delayBetweenAttempts();
|
|
1880
1881
|
})
|
|
1881
1882
|
},
|
|
@@ -1903,7 +1904,7 @@ const z = (t) => {
|
|
|
1903
1904
|
},
|
|
1904
1905
|
/** Ошибка «ещё не готовы к подключению» — без ретрая. */
|
|
1905
1906
|
isNotReadyForConnection: ({ event: e }) => {
|
|
1906
|
-
const n =
|
|
1907
|
+
const n = ds(z(e));
|
|
1907
1908
|
return b("isNotReadyForConnection:", n), n;
|
|
1908
1909
|
},
|
|
1909
1910
|
/** Политика опций запрещает повтор для этой ошибки. */
|
|
@@ -1913,12 +1914,12 @@ const z = (t) => {
|
|
|
1913
1914
|
},
|
|
1914
1915
|
/** Промис коннекта снят очередью (`stack-promises`) — отмена попыток. */
|
|
1915
1916
|
isNotActualPromise: ({ event: e }) => {
|
|
1916
|
-
const n =
|
|
1917
|
+
const n = Lt(z(e));
|
|
1917
1918
|
return b("isNotActualPromise:", n), n;
|
|
1918
1919
|
},
|
|
1919
1920
|
/** Отмена задержки (cancelable / timeout-requester). */
|
|
1920
1921
|
isWaitRetryCancelled: ({ event: e }) => {
|
|
1921
|
-
const n = z(e), s =
|
|
1922
|
+
const n = z(e), s = He(n) || yt(n);
|
|
1922
1923
|
return b("isWaitRetryCancelled:", s), s;
|
|
1923
1924
|
}
|
|
1924
1925
|
},
|
|
@@ -1929,14 +1930,14 @@ const z = (t) => {
|
|
|
1929
1930
|
b("auto connector failed to restart connection attempts:", z(e));
|
|
1930
1931
|
},
|
|
1931
1932
|
/** Сохранить параметры подключения и намерение продолжить попытки после `disconnect`. */
|
|
1932
|
-
assignRestart:
|
|
1933
|
+
assignRestart: I(({ event: e }) => ({
|
|
1933
1934
|
parameters: e.parameters,
|
|
1934
1935
|
afterDisconnect: "attempt",
|
|
1935
1936
|
stopReason: void 0,
|
|
1936
1937
|
lastError: void 0
|
|
1937
1938
|
})),
|
|
1938
1939
|
/** Пользовательский или внешний стоп: после `disconnect` уйти в `idle`. */
|
|
1939
|
-
assignStop:
|
|
1940
|
+
assignStop: I({
|
|
1940
1941
|
afterDisconnect: "idle",
|
|
1941
1942
|
stopReason: () => {
|
|
1942
1943
|
},
|
|
@@ -1953,34 +1954,34 @@ const z = (t) => {
|
|
|
1953
1954
|
},
|
|
1954
1955
|
/** Лимит: завершить попытку, событие лимита, запуск опроса телефонии. */
|
|
1955
1956
|
onLimitReachedTransition: ({ context: e }) => {
|
|
1956
|
-
b("onLimitReachedTransition"), t.onLimitReached(
|
|
1957
|
+
b("onLimitReachedTransition"), t.onLimitReached(rt(e));
|
|
1957
1958
|
},
|
|
1958
1959
|
/** Успешный invoke `connect`. */
|
|
1959
1960
|
onConnectDone: ({ context: e }) => {
|
|
1960
|
-
b("onConnectDone"), t.onConnectSucceeded(
|
|
1961
|
+
b("onConnectDone"), t.onConnectSucceeded(rt(e));
|
|
1961
1962
|
},
|
|
1962
|
-
assignHaltedError:
|
|
1963
|
+
assignHaltedError: I({
|
|
1963
1964
|
stopReason: () => "halted",
|
|
1964
1965
|
lastError: ({ event: e }) => {
|
|
1965
1966
|
const n = z(e);
|
|
1966
1967
|
return b("assignHaltedError", n), n;
|
|
1967
1968
|
}
|
|
1968
1969
|
}),
|
|
1969
|
-
assignCancelledNotActualError:
|
|
1970
|
+
assignCancelledNotActualError: I({
|
|
1970
1971
|
stopReason: () => "cancelled",
|
|
1971
1972
|
lastError: ({ event: e }) => {
|
|
1972
1973
|
const n = z(e);
|
|
1973
1974
|
return b("assignCancelledNotActualError", n), n;
|
|
1974
1975
|
}
|
|
1975
1976
|
}),
|
|
1976
|
-
assignWaitRetryCancelledError:
|
|
1977
|
+
assignWaitRetryCancelledError: I({
|
|
1977
1978
|
stopReason: () => "cancelled",
|
|
1978
1979
|
lastError: ({ event: e }) => {
|
|
1979
1980
|
const n = z(e);
|
|
1980
1981
|
return b("assignWaitRetryCancelledError", n), n;
|
|
1981
1982
|
}
|
|
1982
1983
|
}),
|
|
1983
|
-
assignWaitRetryFailedError:
|
|
1984
|
+
assignWaitRetryFailedError: I({
|
|
1984
1985
|
stopReason: () => "failed",
|
|
1985
1986
|
lastError: ({ event: e }) => {
|
|
1986
1987
|
const n = z(e);
|
|
@@ -2008,12 +2009,12 @@ const z = (t) => {
|
|
|
2008
2009
|
}
|
|
2009
2010
|
});
|
|
2010
2011
|
var O = /* @__PURE__ */ ((t) => (t.IDLE = "idle", t.DISCONNECTING = "disconnecting", t.ATTEMPTING_GATE = "attemptingGate", t.ATTEMPTING_CONNECT = "attemptingConnect", t.WAITING_BEFORE_RETRY = "waitingBeforeRetry", t.CONNECTED_MONITORING = "connectedMonitoring", t.TELEPHONY_CHECKING = "telephonyChecking", t.ERROR_TERMINAL = "errorTerminal", t))(O || {});
|
|
2011
|
-
const
|
|
2012
|
+
const Gs = () => ({
|
|
2012
2013
|
parameters: void 0,
|
|
2013
2014
|
afterDisconnect: "idle",
|
|
2014
2015
|
stopReason: void 0,
|
|
2015
2016
|
lastError: void 0
|
|
2016
|
-
}),
|
|
2017
|
+
}), de = () => ({
|
|
2017
2018
|
"AUTO.STOP": {
|
|
2018
2019
|
target: O.DISCONNECTING,
|
|
2019
2020
|
actions: "assignStop"
|
|
@@ -2022,10 +2023,10 @@ const Ls = () => ({
|
|
|
2022
2023
|
target: O.DISCONNECTING,
|
|
2023
2024
|
actions: "assignRestart"
|
|
2024
2025
|
}
|
|
2025
|
-
}),
|
|
2026
|
+
}), ks = (t) => ws(t).createMachine({
|
|
2026
2027
|
id: "autoConnector",
|
|
2027
2028
|
initial: O.IDLE,
|
|
2028
|
-
context:
|
|
2029
|
+
context: Gs,
|
|
2029
2030
|
states: {
|
|
2030
2031
|
/** Ожидание: допустимы рестарт флоу или внешний стоп без побочных эффектов. */
|
|
2031
2032
|
[O.IDLE]: {
|
|
@@ -2106,7 +2107,7 @@ const Ls = () => ({
|
|
|
2106
2107
|
target: O.ATTEMPTING_CONNECT
|
|
2107
2108
|
}
|
|
2108
2109
|
],
|
|
2109
|
-
on:
|
|
2110
|
+
on: de()
|
|
2110
2111
|
},
|
|
2111
2112
|
/**
|
|
2112
2113
|
* Активный `connect`; ошибки классифицируются по бизнес-семантике:
|
|
@@ -2156,7 +2157,7 @@ const Ls = () => ({
|
|
|
2156
2157
|
}
|
|
2157
2158
|
]
|
|
2158
2159
|
},
|
|
2159
|
-
on:
|
|
2160
|
+
on: de()
|
|
2160
2161
|
},
|
|
2161
2162
|
/**
|
|
2162
2163
|
* Задержка перед следующим заходом в `attemptingGate`.
|
|
@@ -2191,11 +2192,11 @@ const Ls = () => ({
|
|
|
2191
2192
|
}
|
|
2192
2193
|
]
|
|
2193
2194
|
},
|
|
2194
|
-
on:
|
|
2195
|
+
on: de()
|
|
2195
2196
|
},
|
|
2196
2197
|
/** Подключение установлено; ожидание внешних событий (стоп, рестарт через `AUTO.RESTART`). */
|
|
2197
2198
|
[O.CONNECTED_MONITORING]: {
|
|
2198
|
-
on:
|
|
2199
|
+
on: de()
|
|
2199
2200
|
},
|
|
2200
2201
|
/**
|
|
2201
2202
|
* После лимита: работает check-telephony; если соединение уже живо, возвращаемся
|
|
@@ -2224,17 +2225,17 @@ const Ls = () => ({
|
|
|
2224
2225
|
*/
|
|
2225
2226
|
[O.ERROR_TERMINAL]: {
|
|
2226
2227
|
entry: "emitTerminalOutcome",
|
|
2227
|
-
on:
|
|
2228
|
+
on: de()
|
|
2228
2229
|
}
|
|
2229
2230
|
}
|
|
2230
|
-
}),
|
|
2231
|
-
class
|
|
2231
|
+
}), Fs = N("AutoConnectorManager: AutoConnectorStateMachine");
|
|
2232
|
+
class Us extends ne {
|
|
2232
2233
|
constructor(e) {
|
|
2233
2234
|
super(e);
|
|
2234
2235
|
}
|
|
2235
2236
|
send(e) {
|
|
2236
2237
|
if (!this.actor.getSnapshot().can(e)) {
|
|
2237
|
-
|
|
2238
|
+
Fs(
|
|
2238
2239
|
`[AutoConnectorStateMachine] Invalid transition: ${e.type} from ${String(this.state)}. Event cannot be processed in current state.`
|
|
2239
2240
|
);
|
|
2240
2241
|
return;
|
|
@@ -2263,19 +2264,19 @@ class ks extends te {
|
|
|
2263
2264
|
return this.state === O.WAITING_BEFORE_RETRY;
|
|
2264
2265
|
}
|
|
2265
2266
|
}
|
|
2266
|
-
const
|
|
2267
|
-
if (!
|
|
2267
|
+
const Bs = (t) => new Us(ks(t)), $s = /* @__PURE__ */ new Set([401, 403]), xs = (t) => typeof t == "object" && t !== null && "response" in t, qs = (t) => {
|
|
2268
|
+
if (!xs(t))
|
|
2268
2269
|
return !1;
|
|
2269
2270
|
const e = t.response?.status_code;
|
|
2270
|
-
return typeof e == "number" &&
|
|
2271
|
-
},
|
|
2271
|
+
return typeof e == "number" && $s.has(e);
|
|
2272
|
+
}, Vs = (t) => !qs(t), Hs = (t) => {
|
|
2272
2273
|
if (!(typeof window > "u"))
|
|
2273
2274
|
return window;
|
|
2274
|
-
},
|
|
2275
|
+
}, Ws = (t) => {
|
|
2275
2276
|
if (!(typeof navigator > "u"))
|
|
2276
2277
|
return navigator;
|
|
2277
|
-
},
|
|
2278
|
-
const e =
|
|
2278
|
+
}, Qs = (t) => {
|
|
2279
|
+
const e = Hs(), n = Ws();
|
|
2279
2280
|
if (!e)
|
|
2280
2281
|
return;
|
|
2281
2282
|
let s = [];
|
|
@@ -2310,11 +2311,11 @@ const Fs = (t) => new ks(ws(t)), Us = /* @__PURE__ */ new Set([401, 403]), Bs =
|
|
|
2310
2311
|
},
|
|
2311
2312
|
unsubscribe: r
|
|
2312
2313
|
};
|
|
2313
|
-
},
|
|
2314
|
+
}, Ys = "Failed to reconnect", it = (t) => t instanceof Error ? t : new Error(Ys), js = (t) => {
|
|
2314
2315
|
const e = (s) => t.baseCanRetryOnError(s) ? t.canRetryOnError?.(s) ?? !0 : !1, n = ({
|
|
2315
2316
|
stopReason: s,
|
|
2316
2317
|
lastError: r
|
|
2317
|
-
}) => s === "cancelled" && !
|
|
2318
|
+
}) => s === "cancelled" && !Lt(r) || s === "failed" ? it(r) : r;
|
|
2318
2319
|
return {
|
|
2319
2320
|
canRetryOnError: e,
|
|
2320
2321
|
shouldDisconnectBeforeAttempt: () => t.runtime.shouldDisconnectBeforeAttempt(),
|
|
@@ -2351,7 +2352,7 @@ const Fs = (t) => new ks(ws(t)), Us = /* @__PURE__ */ new Set([401, 403]), Bs =
|
|
|
2351
2352
|
t.runtime.onTelephonyStillConnected();
|
|
2352
2353
|
}
|
|
2353
2354
|
};
|
|
2354
|
-
},
|
|
2355
|
+
}, xt = [
|
|
2355
2356
|
"before-attempt",
|
|
2356
2357
|
"success",
|
|
2357
2358
|
"failed-all-attempts",
|
|
@@ -2361,8 +2362,8 @@ const Fs = (t) => new ks(ws(t)), Us = /* @__PURE__ */ new Set([401, 403]), Bs =
|
|
|
2361
2362
|
"limit-reached-attempts",
|
|
2362
2363
|
"telephony-check-failure",
|
|
2363
2364
|
"telephony-check-escalated"
|
|
2364
|
-
],
|
|
2365
|
-
class
|
|
2365
|
+
], zs = () => new k(xt), J = N("AutoConnectorManager: NetworkEventsReconnector"), Js = 2e3, at = "probe", Ks = "network-online", Xs = "network-change";
|
|
2366
|
+
class Zs {
|
|
2366
2367
|
subscriber;
|
|
2367
2368
|
offlineGraceMs;
|
|
2368
2369
|
onChangePolicy;
|
|
@@ -2385,7 +2386,7 @@ class Ks {
|
|
|
2385
2386
|
requestReconnect: a,
|
|
2386
2387
|
stopConnection: o
|
|
2387
2388
|
}) {
|
|
2388
|
-
this.subscriber = e, this.offlineGraceMs = n ??
|
|
2389
|
+
this.subscriber = e, this.offlineGraceMs = n ?? Js, this.onChangePolicy = s ?? at, this.onOnlinePolicy = r ?? at, this.probe = i, this.requestReconnect = a, this.stopConnection = o;
|
|
2389
2390
|
}
|
|
2390
2391
|
start(e) {
|
|
2391
2392
|
this.parameters = e, !this.isSubscribed && (this.subscriber.subscribe({
|
|
@@ -2401,10 +2402,10 @@ class Ks {
|
|
|
2401
2402
|
this.cancelOfflineTimer(), this.isSubscribed && (this.subscriber.unsubscribe(), this.isSubscribed = !1, this.parameters = void 0);
|
|
2402
2403
|
}
|
|
2403
2404
|
handleOnline = () => {
|
|
2404
|
-
J("network online", { policy: this.onOnlinePolicy }), this.cancelOfflineTimer(), this.applyPolicy(this.onOnlinePolicy,
|
|
2405
|
+
J("network online", { policy: this.onOnlinePolicy }), this.cancelOfflineTimer(), this.applyPolicy(this.onOnlinePolicy, Ks);
|
|
2405
2406
|
};
|
|
2406
2407
|
handleChange = () => {
|
|
2407
|
-
J("network change", { policy: this.onChangePolicy }), this.applyPolicy(this.onChangePolicy,
|
|
2408
|
+
J("network change", { policy: this.onChangePolicy }), this.applyPolicy(this.onChangePolicy, Xs);
|
|
2408
2409
|
};
|
|
2409
2410
|
handleOffline = () => {
|
|
2410
2411
|
J("network offline, scheduling disconnect", { graceMs: this.offlineGraceMs }), this.cancelOfflineTimer(), this.offlineTimer = setTimeout(() => {
|
|
@@ -2443,7 +2444,7 @@ class Ks {
|
|
|
2443
2444
|
this.offlineTimer !== void 0 && (clearTimeout(this.offlineTimer), this.offlineTimer = void 0);
|
|
2444
2445
|
}
|
|
2445
2446
|
}
|
|
2446
|
-
class
|
|
2447
|
+
class er {
|
|
2447
2448
|
generation = 0;
|
|
2448
2449
|
lastRequest;
|
|
2449
2450
|
coalesceWindowMs;
|
|
@@ -2451,9 +2452,9 @@ class Xs {
|
|
|
2451
2452
|
this.coalesceWindowMs = e;
|
|
2452
2453
|
}
|
|
2453
2454
|
register(e) {
|
|
2454
|
-
const n = Date.now(), s =
|
|
2455
|
+
const n = Date.now(), s = nt(e), { lastRequest: r } = this;
|
|
2455
2456
|
if (r !== void 0 && n - r.timestamp < this.coalesceWindowMs) {
|
|
2456
|
-
const a =
|
|
2457
|
+
const a = nt(r.reason);
|
|
2457
2458
|
if (s <= a)
|
|
2458
2459
|
return {
|
|
2459
2460
|
shouldRequest: !1,
|
|
@@ -2476,15 +2477,15 @@ class Xs {
|
|
|
2476
2477
|
this.lastRequest = void 0;
|
|
2477
2478
|
}
|
|
2478
2479
|
}
|
|
2479
|
-
const
|
|
2480
|
+
const tr = 250, nr = {
|
|
2480
2481
|
LIMIT_REACHED: "Limit reached"
|
|
2481
|
-
}, G =
|
|
2482
|
-
class
|
|
2482
|
+
}, G = N("AutoConnectorManager"), sr = "start", rr = "manual-restart";
|
|
2483
|
+
class ir extends w {
|
|
2483
2484
|
stateMachine;
|
|
2484
2485
|
runtime;
|
|
2485
2486
|
connectionManager;
|
|
2486
|
-
reconnectCoalescer = new
|
|
2487
|
-
coalesceWindowMs:
|
|
2487
|
+
reconnectCoalescer = new er({
|
|
2488
|
+
coalesceWindowMs: tr
|
|
2488
2489
|
});
|
|
2489
2490
|
networkEventsReconnector;
|
|
2490
2491
|
constructor({
|
|
@@ -2492,7 +2493,7 @@ class sr extends w {
|
|
|
2492
2493
|
connectionManager: n,
|
|
2493
2494
|
callManager: s
|
|
2494
2495
|
}, r) {
|
|
2495
|
-
super(
|
|
2496
|
+
super(zs()), this.connectionManager = n, this.runtime = new ls({
|
|
2496
2497
|
connectionManager: n,
|
|
2497
2498
|
connectionQueueManager: e,
|
|
2498
2499
|
callManager: s,
|
|
@@ -2502,7 +2503,7 @@ class sr extends w {
|
|
|
2502
2503
|
this.events.trigger("before-attempt", {});
|
|
2503
2504
|
},
|
|
2504
2505
|
emitLimitReachedAttempts: () => {
|
|
2505
|
-
this.events.trigger("limit-reached-attempts", new Error(
|
|
2506
|
+
this.events.trigger("limit-reached-attempts", new Error(nr.LIMIT_REACHED));
|
|
2506
2507
|
},
|
|
2507
2508
|
emitSuccess: () => {
|
|
2508
2509
|
G("handleSucceededAttempt"), this.events.trigger("success");
|
|
@@ -2532,15 +2533,15 @@ class sr extends w {
|
|
|
2532
2533
|
this.stateMachine.toTelephonyResultStillConnected();
|
|
2533
2534
|
}
|
|
2534
2535
|
}
|
|
2535
|
-
}), this.stateMachine =
|
|
2536
|
-
|
|
2537
|
-
baseCanRetryOnError:
|
|
2536
|
+
}), this.stateMachine = Bs(
|
|
2537
|
+
js({
|
|
2538
|
+
baseCanRetryOnError: Vs,
|
|
2538
2539
|
runtime: this.runtime,
|
|
2539
2540
|
canRetryOnError: r?.canRetryOnError
|
|
2540
2541
|
})
|
|
2541
2542
|
);
|
|
2542
|
-
const i = r?.networkEventsSubscriber ??
|
|
2543
|
-
i && (this.networkEventsReconnector = new
|
|
2543
|
+
const i = r?.networkEventsSubscriber ?? Qs();
|
|
2544
|
+
i && (this.networkEventsReconnector = new Zs({
|
|
2544
2545
|
subscriber: i,
|
|
2545
2546
|
offlineGraceMs: r?.offlineGraceMs,
|
|
2546
2547
|
onChangePolicy: r?.onNetworkChangePolicy,
|
|
@@ -2558,7 +2559,7 @@ class sr extends w {
|
|
|
2558
2559
|
), {
|
|
2559
2560
|
isSuccess: !1,
|
|
2560
2561
|
reason: "coalesced"
|
|
2561
|
-
}) :
|
|
2562
|
+
}) : this.requestReconnect(e, sr) ? (this.networkEventsReconnector?.start(e), new Promise((s) => {
|
|
2562
2563
|
const r = this.events.onceRace(
|
|
2563
2564
|
["success", "failed-all-attempts", "stop-attempts-by-error", "limit-reached-attempts"],
|
|
2564
2565
|
(i, a) => {
|
|
@@ -2592,10 +2593,10 @@ class sr extends w {
|
|
|
2592
2593
|
});
|
|
2593
2594
|
}
|
|
2594
2595
|
);
|
|
2595
|
-
}) : {
|
|
2596
|
+
})) : {
|
|
2596
2597
|
isSuccess: !1,
|
|
2597
2598
|
reason: "coalesced"
|
|
2598
|
-
}
|
|
2599
|
+
};
|
|
2599
2600
|
}
|
|
2600
2601
|
restart() {
|
|
2601
2602
|
G("auto connector restart");
|
|
@@ -2604,7 +2605,7 @@ class sr extends w {
|
|
|
2604
2605
|
G("auto connector restart skipped: no parameters in context");
|
|
2605
2606
|
return;
|
|
2606
2607
|
}
|
|
2607
|
-
this.requestReconnect(e,
|
|
2608
|
+
this.requestReconnect(e, rr);
|
|
2608
2609
|
}
|
|
2609
2610
|
stop() {
|
|
2610
2611
|
G("auto connector stop"), this.networkEventsReconnector?.stop(), this.resetReconnectCoalescingState(), this.stateMachine.toStop();
|
|
@@ -2675,10 +2676,10 @@ class sr extends w {
|
|
|
2675
2676
|
return !this.stateMachine.isInIdleState();
|
|
2676
2677
|
}
|
|
2677
2678
|
}
|
|
2678
|
-
const
|
|
2679
|
-
class
|
|
2680
|
-
countInner =
|
|
2681
|
-
initialCount =
|
|
2679
|
+
const ot = 0, ar = 0;
|
|
2680
|
+
class or {
|
|
2681
|
+
countInner = ot;
|
|
2682
|
+
initialCount = ot;
|
|
2682
2683
|
limitInner;
|
|
2683
2684
|
isInProgress = !1;
|
|
2684
2685
|
onStatusChange;
|
|
@@ -2695,7 +2696,7 @@ class ir {
|
|
|
2695
2696
|
return this.isInProgress;
|
|
2696
2697
|
}
|
|
2697
2698
|
hasLimitReached() {
|
|
2698
|
-
return this.limitInner ===
|
|
2699
|
+
return this.limitInner === ar ? !1 : this.countInner >= this.limitInner;
|
|
2699
2700
|
}
|
|
2700
2701
|
startAttempt() {
|
|
2701
2702
|
this.isInProgress || (this.isInProgress = !0, this.onStatusChange({ isInProgress: this.isInProgress }));
|
|
@@ -2710,43 +2711,43 @@ class ir {
|
|
|
2710
2711
|
this.countInner = this.initialCount, this.finishAttempt();
|
|
2711
2712
|
}
|
|
2712
2713
|
}
|
|
2713
|
-
const
|
|
2714
|
-
const { baseBackoffMs: n, maxBackoffMs: s, backoffFactor: r } = e, i =
|
|
2714
|
+
const ct = 1, cr = (t) => t < ct ? ct : t, lr = (t, e) => {
|
|
2715
|
+
const { baseBackoffMs: n, maxBackoffMs: s, backoffFactor: r } = e, i = cr(t), a = n * r ** (i - 1);
|
|
2715
2716
|
return Math.min(s, a);
|
|
2716
|
-
},
|
|
2717
|
+
}, dr = (t, e, n) => {
|
|
2717
2718
|
if (e === "none")
|
|
2718
2719
|
return t;
|
|
2719
2720
|
if (e === "full")
|
|
2720
2721
|
return n() * t;
|
|
2721
2722
|
const s = t / 2;
|
|
2722
2723
|
return s + n() * s;
|
|
2723
|
-
},
|
|
2724
|
-
const s =
|
|
2725
|
-
return
|
|
2726
|
-
},
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
]),
|
|
2724
|
+
}, hr = (t, e, n = Math.random) => {
|
|
2725
|
+
const s = lr(t, e);
|
|
2726
|
+
return dr(s, e.jitter, n);
|
|
2727
|
+
}, ur = /* @__PURE__ */ new Set([
|
|
2728
|
+
ee.causes.CONNECTION_ERROR,
|
|
2729
|
+
ee.causes.REQUEST_TIMEOUT,
|
|
2730
|
+
ee.causes.RTP_TIMEOUT,
|
|
2731
|
+
ee.causes.ADDRESS_INCOMPLETE
|
|
2732
|
+
]), gr = (t) => {
|
|
2732
2733
|
const { cause: e, originator: n } = t;
|
|
2733
|
-
return n === "local" ? !1 : !!(
|
|
2734
|
-
},
|
|
2734
|
+
return n === "local" ? !1 : !!(ur.has(e) || e === ee.causes.INTERNAL_ERROR && n === "system");
|
|
2735
|
+
}, Er = (t) => t ?? gr, lt = N("CallReconnectRuntime"), re = {
|
|
2735
2736
|
maxAttempts: 5,
|
|
2736
2737
|
baseBackoffMs: 1e3,
|
|
2737
2738
|
maxBackoffMs: 3e4,
|
|
2738
2739
|
backoffFactor: 2,
|
|
2739
2740
|
jitter: "equal",
|
|
2740
2741
|
waitSignalingTimeoutMs: 2e4
|
|
2741
|
-
},
|
|
2742
|
-
maxAttempts: t?.maxAttempts ??
|
|
2743
|
-
baseBackoffMs: t?.baseBackoffMs ??
|
|
2744
|
-
maxBackoffMs: t?.maxBackoffMs ??
|
|
2745
|
-
backoffFactor: t?.backoffFactor ??
|
|
2746
|
-
jitter: t?.jitter ??
|
|
2747
|
-
waitSignalingTimeoutMs: t?.waitSignalingTimeoutMs ??
|
|
2748
|
-
}),
|
|
2749
|
-
class
|
|
2742
|
+
}, mr = (t) => ({
|
|
2743
|
+
maxAttempts: t?.maxAttempts ?? re.maxAttempts,
|
|
2744
|
+
baseBackoffMs: t?.baseBackoffMs ?? re.baseBackoffMs,
|
|
2745
|
+
maxBackoffMs: t?.maxBackoffMs ?? re.maxBackoffMs,
|
|
2746
|
+
backoffFactor: t?.backoffFactor ?? re.backoffFactor,
|
|
2747
|
+
jitter: t?.jitter ?? re.jitter,
|
|
2748
|
+
waitSignalingTimeoutMs: t?.waitSignalingTimeoutMs ?? re.waitSignalingTimeoutMs
|
|
2749
|
+
}), Tr = (t) => !0;
|
|
2750
|
+
class pr {
|
|
2750
2751
|
resolvedOptions;
|
|
2751
2752
|
callManager;
|
|
2752
2753
|
connectionManager;
|
|
@@ -2757,7 +2758,7 @@ class mr {
|
|
|
2757
2758
|
canRetryOnErrorFn;
|
|
2758
2759
|
unsubscribeConnectionWait;
|
|
2759
2760
|
constructor(e) {
|
|
2760
|
-
this.resolvedOptions =
|
|
2761
|
+
this.resolvedOptions = mr(e.options), this.callManager = e.callManager, this.connectionManager = e.connectionManager, this.isNetworkFailureFn = Er(e.options?.isNetworkFailure), this.canRetryOnErrorFn = e.options?.canRetryOnError ?? Tr, this.delayRequester = new bt(this.resolvedOptions.baseBackoffMs), this.performCall = new pe(
|
|
2761
2762
|
async (n) => {
|
|
2762
2763
|
const s = await n.getCallParameters();
|
|
2763
2764
|
await this.callManager.startCall(
|
|
@@ -2766,7 +2767,7 @@ class mr {
|
|
|
2766
2767
|
s
|
|
2767
2768
|
);
|
|
2768
2769
|
}
|
|
2769
|
-
), this.attemptsState = new
|
|
2770
|
+
), this.attemptsState = new or({
|
|
2770
2771
|
limit: this.resolvedOptions.maxAttempts,
|
|
2771
2772
|
onStatusChange: ({ isInProgress: n }) => {
|
|
2772
2773
|
e.emitters.emitStatusChange({ isReconnecting: n });
|
|
@@ -2786,7 +2787,7 @@ class mr {
|
|
|
2786
2787
|
return this.attemptsState.hasLimitReached();
|
|
2787
2788
|
}
|
|
2788
2789
|
computeNextDelayMs(e) {
|
|
2789
|
-
return
|
|
2790
|
+
return hr(e, {
|
|
2790
2791
|
baseBackoffMs: this.resolvedOptions.baseBackoffMs,
|
|
2791
2792
|
maxBackoffMs: this.resolvedOptions.maxBackoffMs,
|
|
2792
2793
|
backoffFactor: this.resolvedOptions.backoffFactor,
|
|
@@ -2794,7 +2795,7 @@ class mr {
|
|
|
2794
2795
|
});
|
|
2795
2796
|
}
|
|
2796
2797
|
async delayBeforeAttempt(e) {
|
|
2797
|
-
|
|
2798
|
+
lt("delayBeforeAttempt", e), await this.delayRequester.request(e);
|
|
2798
2799
|
}
|
|
2799
2800
|
async waitSignalingReady() {
|
|
2800
2801
|
if (this.connectionManager.isRegistered)
|
|
@@ -2825,33 +2826,33 @@ class mr {
|
|
|
2825
2826
|
this.attemptsState.reset();
|
|
2826
2827
|
}
|
|
2827
2828
|
cancelAll() {
|
|
2828
|
-
|
|
2829
|
+
lt("cancelAll"), this.delayRequester.cancelRequest(), this.performCall.cancelRequest(), this.unsubscribeConnectionWait?.(), this.unsubscribeConnectionWait = void 0;
|
|
2829
2830
|
}
|
|
2830
2831
|
getWaitSignalingTimeoutMs() {
|
|
2831
2832
|
return this.resolvedOptions.waitSignalingTimeoutMs;
|
|
2832
2833
|
}
|
|
2833
2834
|
}
|
|
2834
|
-
const
|
|
2835
|
+
const Ce = (t) => {
|
|
2835
2836
|
if (t !== null && typeof t == "object" && "error" in t)
|
|
2836
2837
|
return t.error;
|
|
2837
|
-
},
|
|
2838
|
+
}, be = N("CallReconnectMachine"), Sr = (t) => t.parameters, Cr = (t) => te({
|
|
2838
2839
|
types: {
|
|
2839
2840
|
context: {},
|
|
2840
2841
|
events: {}
|
|
2841
2842
|
},
|
|
2842
2843
|
actors: {
|
|
2843
2844
|
/** Invoke в `backoff`: таймаут задержки перед следующей попыткой. */
|
|
2844
|
-
delayBeforeAttempt:
|
|
2845
|
-
|
|
2845
|
+
delayBeforeAttempt: oe(async ({ input: e }) => {
|
|
2846
|
+
be("delayBeforeAttempt", e), await t.delayBeforeAttempt(e);
|
|
2846
2847
|
}),
|
|
2847
2848
|
/** Invoke в `waitingSignaling`: ожидание готовности сигнализации с таймаутом. */
|
|
2848
|
-
waitSignalingReady:
|
|
2849
|
-
|
|
2849
|
+
waitSignalingReady: oe(async () => {
|
|
2850
|
+
be("waitSignalingReady"), await t.waitSignalingReady();
|
|
2850
2851
|
}),
|
|
2851
2852
|
/** Invoke в `attempting`: реальный `startCall`. */
|
|
2852
|
-
performAttempt:
|
|
2853
|
+
performAttempt: oe(
|
|
2853
2854
|
async ({ input: e }) => {
|
|
2854
|
-
if (
|
|
2855
|
+
if (be("performAttempt"), !e)
|
|
2855
2856
|
throw new Error("CallReconnect parameters missing in attempting state");
|
|
2856
2857
|
await t.performAttempt(e);
|
|
2857
2858
|
}
|
|
@@ -2864,14 +2865,14 @@ const pe = (t) => {
|
|
|
2864
2865
|
},
|
|
2865
2866
|
isLimitReached: () => t.hasLimitReached(),
|
|
2866
2867
|
isSignalingReady: () => t.isSignalingReady(),
|
|
2867
|
-
isNoRetryPolicy: ({ event: e }) => !t.canRetryOnError(
|
|
2868
|
+
isNoRetryPolicy: ({ event: e }) => !t.canRetryOnError(Ce(e)),
|
|
2868
2869
|
isAttemptCancelled: ({ event: e }) => {
|
|
2869
|
-
const n =
|
|
2870
|
-
return
|
|
2870
|
+
const n = Ce(e);
|
|
2871
|
+
return He(n) || yt(n);
|
|
2871
2872
|
}
|
|
2872
2873
|
},
|
|
2873
2874
|
actions: {
|
|
2874
|
-
assignArm:
|
|
2875
|
+
assignArm: I(({ event: e }) => ({
|
|
2875
2876
|
parameters: e.parameters,
|
|
2876
2877
|
attempt: 0,
|
|
2877
2878
|
nextDelayMs: 0,
|
|
@@ -2879,7 +2880,7 @@ const pe = (t) => {
|
|
|
2879
2880
|
lastFailureCause: void 0,
|
|
2880
2881
|
cancelledReason: void 0
|
|
2881
2882
|
})),
|
|
2882
|
-
assignDisarm:
|
|
2883
|
+
assignDisarm: I(({ event: e }) => ({
|
|
2883
2884
|
parameters: void 0,
|
|
2884
2885
|
attempt: 0,
|
|
2885
2886
|
nextDelayMs: 0,
|
|
@@ -2887,19 +2888,19 @@ const pe = (t) => {
|
|
|
2887
2888
|
lastFailureCause: void 0,
|
|
2888
2889
|
cancelledReason: e.reason ?? "disarm"
|
|
2889
2890
|
})),
|
|
2890
|
-
assignFailureDetected:
|
|
2891
|
+
assignFailureDetected: I(({ event: e }) => ({
|
|
2891
2892
|
lastFailureCause: e.event.cause
|
|
2892
2893
|
})),
|
|
2893
|
-
assignNextDelay:
|
|
2894
|
+
assignNextDelay: I(({ context: e }) => {
|
|
2894
2895
|
const n = e.attempt + 1;
|
|
2895
2896
|
return {
|
|
2896
2897
|
nextDelayMs: t.computeNextDelayMs(n)
|
|
2897
2898
|
};
|
|
2898
2899
|
}),
|
|
2899
|
-
assignIncrementAttempt:
|
|
2900
|
+
assignIncrementAttempt: I(({ context: e }) => ({
|
|
2900
2901
|
attempt: e.attempt + 1
|
|
2901
2902
|
})),
|
|
2902
|
-
assignResetAttempt:
|
|
2903
|
+
assignResetAttempt: I({
|
|
2903
2904
|
attempt: () => 0,
|
|
2904
2905
|
nextDelayMs: () => 0,
|
|
2905
2906
|
lastError: () => {
|
|
@@ -2907,8 +2908,8 @@ const pe = (t) => {
|
|
|
2907
2908
|
lastFailureCause: () => {
|
|
2908
2909
|
}
|
|
2909
2910
|
}),
|
|
2910
|
-
assignAttemptError:
|
|
2911
|
-
lastError: ({ event: e }) =>
|
|
2911
|
+
assignAttemptError: I({
|
|
2912
|
+
lastError: ({ event: e }) => Ce(e)
|
|
2912
2913
|
}),
|
|
2913
2914
|
emitArmedAction: () => {
|
|
2914
2915
|
t.emitArmed();
|
|
@@ -2941,7 +2942,7 @@ const pe = (t) => {
|
|
|
2941
2942
|
emitAttemptFailedAction: ({ context: e, event: n }) => {
|
|
2942
2943
|
t.emitAttemptFailed({
|
|
2943
2944
|
attempt: e.attempt,
|
|
2944
|
-
error:
|
|
2945
|
+
error: Ce(n)
|
|
2945
2946
|
});
|
|
2946
2947
|
},
|
|
2947
2948
|
emitWaitingSignalingAction: () => {
|
|
@@ -2965,17 +2966,17 @@ const pe = (t) => {
|
|
|
2965
2966
|
}
|
|
2966
2967
|
});
|
|
2967
2968
|
var v = /* @__PURE__ */ ((t) => (t.IDLE = "idle", t.ARMED = "armed", t.EVALUATING = "evaluating", t.BACKOFF = "backoff", t.WAITING_SIGNALING = "waitingSignaling", t.ATTEMPTING = "attempting", t.LIMIT_REACHED = "limitReached", t.ERROR_TERMINAL = "errorTerminal", t))(v || {});
|
|
2968
|
-
const
|
|
2969
|
+
const Rr = () => ({
|
|
2969
2970
|
parameters: void 0,
|
|
2970
2971
|
attempt: 0,
|
|
2971
2972
|
nextDelayMs: 0,
|
|
2972
2973
|
lastError: void 0,
|
|
2973
2974
|
lastFailureCause: void 0,
|
|
2974
2975
|
cancelledReason: void 0
|
|
2975
|
-
}),
|
|
2976
|
+
}), Nr = (t) => Cr(t).createMachine({
|
|
2976
2977
|
id: "callReconnect",
|
|
2977
2978
|
initial: v.IDLE,
|
|
2978
|
-
context:
|
|
2979
|
+
context: Rr,
|
|
2979
2980
|
on: {
|
|
2980
2981
|
/**
|
|
2981
2982
|
* Глобальный `RECONNECT.ARM`: из любого состояния возвращает армированный цикл
|
|
@@ -3099,7 +3100,7 @@ const Sr = () => ({
|
|
|
3099
3100
|
invoke: {
|
|
3100
3101
|
id: "performAttempt",
|
|
3101
3102
|
src: "performAttempt",
|
|
3102
|
-
input: ({ context: e }) =>
|
|
3103
|
+
input: ({ context: e }) => Sr(e),
|
|
3103
3104
|
onDone: {
|
|
3104
3105
|
target: v.ARMED,
|
|
3105
3106
|
actions: [
|
|
@@ -3144,14 +3145,14 @@ const Sr = () => ({
|
|
|
3144
3145
|
}
|
|
3145
3146
|
}
|
|
3146
3147
|
}
|
|
3147
|
-
}),
|
|
3148
|
-
class
|
|
3148
|
+
}), Ar = N("CallReconnectStateMachine");
|
|
3149
|
+
class Ir extends ne {
|
|
3149
3150
|
constructor(e) {
|
|
3150
3151
|
super(e);
|
|
3151
3152
|
}
|
|
3152
3153
|
send(e) {
|
|
3153
3154
|
if (!this.actor.getSnapshot().can(e)) {
|
|
3154
|
-
|
|
3155
|
+
Ar(
|
|
3155
3156
|
`[CallReconnectStateMachine] Invalid transition: ${e.type} from ${String(this.state)}. Event cannot be processed in current state.`
|
|
3156
3157
|
);
|
|
3157
3158
|
return;
|
|
@@ -3159,7 +3160,7 @@ class Nr extends te {
|
|
|
3159
3160
|
super.send(e);
|
|
3160
3161
|
}
|
|
3161
3162
|
}
|
|
3162
|
-
const
|
|
3163
|
+
const fr = (t) => new Ir(Nr(t)), vr = (t) => {
|
|
3163
3164
|
const { runtime: e, events: n } = t;
|
|
3164
3165
|
return {
|
|
3165
3166
|
isNetworkFailure: (s) => e.isNetworkFailure(s),
|
|
@@ -3220,7 +3221,7 @@ const Ar = (t) => new Nr(Cr(t)), Ir = (t) => {
|
|
|
3220
3221
|
},
|
|
3221
3222
|
getWaitSignalingTimeoutMs: () => e.getWaitSignalingTimeoutMs()
|
|
3222
3223
|
};
|
|
3223
|
-
},
|
|
3224
|
+
}, qt = [
|
|
3224
3225
|
"armed",
|
|
3225
3226
|
"disarmed",
|
|
3226
3227
|
"failure-detected",
|
|
@@ -3232,8 +3233,8 @@ const Ar = (t) => new Nr(Cr(t)), Ir = (t) => {
|
|
|
3232
3233
|
"limit-reached",
|
|
3233
3234
|
"cancelled",
|
|
3234
3235
|
"status-changed"
|
|
3235
|
-
],
|
|
3236
|
-
class
|
|
3236
|
+
], Mr = () => new k(qt), ye = N("CallReconnectManager");
|
|
3237
|
+
class Or extends w {
|
|
3237
3238
|
stateMachine;
|
|
3238
3239
|
runtime;
|
|
3239
3240
|
callManager;
|
|
@@ -3243,7 +3244,7 @@ class vr extends w {
|
|
|
3243
3244
|
callManager: e,
|
|
3244
3245
|
connectionManager: n
|
|
3245
3246
|
}, s) {
|
|
3246
|
-
super(
|
|
3247
|
+
super(Mr()), this.callManager = e, this.connectionManager = n, this.runtime = new pr({
|
|
3247
3248
|
callManager: e,
|
|
3248
3249
|
connectionManager: n,
|
|
3249
3250
|
options: s,
|
|
@@ -3252,8 +3253,8 @@ class vr extends w {
|
|
|
3252
3253
|
this.events.trigger("status-changed", r);
|
|
3253
3254
|
}
|
|
3254
3255
|
}
|
|
3255
|
-
}), this.stateMachine =
|
|
3256
|
-
|
|
3256
|
+
}), this.stateMachine = fr(
|
|
3257
|
+
vr({ runtime: this.runtime, events: this.events })
|
|
3257
3258
|
), this.subscribeToManagers();
|
|
3258
3259
|
}
|
|
3259
3260
|
get isReconnecting() {
|
|
@@ -3269,17 +3270,17 @@ class vr extends w {
|
|
|
3269
3270
|
* с событием `cancelled('spectator-role')`.
|
|
3270
3271
|
*/
|
|
3271
3272
|
arm(e) {
|
|
3272
|
-
if (
|
|
3273
|
+
if (ye("arm"), this.callManager.hasSpectator()) {
|
|
3273
3274
|
this.events.trigger("cancelled", { reason: "spectator-role" });
|
|
3274
3275
|
return;
|
|
3275
3276
|
}
|
|
3276
3277
|
this.stateMachine.send({ type: "RECONNECT.ARM", parameters: e });
|
|
3277
3278
|
}
|
|
3278
3279
|
disarm(e = "disarm") {
|
|
3279
|
-
|
|
3280
|
+
ye("disarm", e), this.stateMachine.send({ type: "RECONNECT.DISARM", reason: e });
|
|
3280
3281
|
}
|
|
3281
3282
|
forceReconnect() {
|
|
3282
|
-
|
|
3283
|
+
ye("forceReconnect"), this.stateMachine.send({ type: "RECONNECT.FORCE" });
|
|
3283
3284
|
}
|
|
3284
3285
|
cancelCurrentAttempt() {
|
|
3285
3286
|
this.runtime.cancelAll();
|
|
@@ -3329,55 +3330,53 @@ class vr extends w {
|
|
|
3329
3330
|
);
|
|
3330
3331
|
}
|
|
3331
3332
|
}
|
|
3332
|
-
const
|
|
3333
|
-
Mr,
|
|
3334
|
-
Or,
|
|
3335
|
-
br,
|
|
3333
|
+
const _r = "incomingCall", br = "declinedIncomingCall", yr = "failedIncomingCall", Dr = "terminatedIncomingCall", Vt = "connecting", Pr = "connected", Lr = "disconnected", wr = "newRTCSession", Gr = "registered", kr = "unregistered", Fr = "registrationFailed", Ur = "newMessage", Br = "sipEvent", $r = "availableSecondRemoteStream", xr = "notAvailableSecondRemoteStream", qr = "mustStopPresentation", Vr = "enterRoom", Hr = "useLicense", Wr = "peerconnection:confirmed", Qr = "peerconnection:ontrack", Yr = "channels", jr = "channels:notify", zr = "ended:fromserver", Jr = "main-cam-control", Kr = "admin:stop-main-cam", Xr = "admin:start-main-cam", Zr = "admin:stop-mic", ei = "admin:start-mic", ti = "admin:force-sync-media-state", ni = "participant:added-to-list-moderators", si = "participant:removed-from-list-moderators", ri = "participant:move-request-to-stream", ii = "participant:move-request-to-spectators", ai = "participant:move-request-to-participants", oi = "participation:accepting-word-request", ci = "participation:cancelling-word-request", li = "webcast:started", di = "webcast:stopped", hi = "account:changed", ui = "account:deleted", gi = "conference:participant-token-issued", Ei = "ended", mi = "sending", Ti = "reinvite", pi = "replaces", Si = "refer", Ci = "progress", Ri = "accepted", Ni = "confirmed", Ai = "peerconnection", Ii = "failed", fi = "muted", vi = "unmuted", Mi = "newDTMF", Oi = "newInfo", _i = "hold", bi = "unhold", yi = "update", Di = "sdp", Pi = "icecandidate", Li = "getusermediafailed", wi = "peerconnection:createofferfailed", Gi = "peerconnection:createanswerfailed", ki = "peerconnection:setlocaldescriptionfailed", Fi = "peerconnection:setremotedescriptionfailed", Ui = "presentation:start", Bi = "presentation:started", $i = "presentation:end", xi = "presentation:ended", qi = "presentation:failed", Vi = [
|
|
3336
3334
|
_r,
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3335
|
+
br,
|
|
3336
|
+
Dr,
|
|
3337
|
+
yr,
|
|
3338
|
+
oi,
|
|
3339
|
+
ci,
|
|
3340
|
+
ri,
|
|
3341
|
+
jr,
|
|
3342
|
+
gi,
|
|
3341
3343
|
hi,
|
|
3344
|
+
ui,
|
|
3342
3345
|
li,
|
|
3343
3346
|
di,
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
], qi = [
|
|
3349
|
-
xt,
|
|
3350
|
-
yr,
|
|
3351
|
-
Dr,
|
|
3347
|
+
ni,
|
|
3348
|
+
si
|
|
3349
|
+
], Hi = [
|
|
3350
|
+
Vt,
|
|
3352
3351
|
Pr,
|
|
3353
3352
|
Lr,
|
|
3354
3353
|
wr,
|
|
3355
3354
|
Gr,
|
|
3356
3355
|
kr,
|
|
3357
|
-
Fr
|
|
3358
|
-
], Vi = [
|
|
3356
|
+
Fr,
|
|
3359
3357
|
Ur,
|
|
3360
|
-
Br
|
|
3358
|
+
Br
|
|
3359
|
+
], Wi = [
|
|
3361
3360
|
$r,
|
|
3362
3361
|
xr,
|
|
3363
3362
|
qr,
|
|
3364
3363
|
Vr,
|
|
3365
3364
|
Hr,
|
|
3366
3365
|
Wr,
|
|
3366
|
+
Qr,
|
|
3367
3367
|
Yr,
|
|
3368
|
-
jr,
|
|
3369
|
-
Jr,
|
|
3370
3368
|
zr,
|
|
3371
|
-
|
|
3369
|
+
Jr,
|
|
3372
3370
|
Xr,
|
|
3371
|
+
Kr,
|
|
3373
3372
|
Zr,
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
gi,
|
|
3373
|
+
ei,
|
|
3374
|
+
ti,
|
|
3375
|
+
ii,
|
|
3376
|
+
ai
|
|
3377
|
+
], Ue = [
|
|
3380
3378
|
Ei,
|
|
3379
|
+
Vt,
|
|
3381
3380
|
mi,
|
|
3382
3381
|
Ti,
|
|
3383
3382
|
pi,
|
|
@@ -3403,15 +3402,17 @@ const Mr = "incomingCall", Or = "declinedIncomingCall", _r = "failedIncomingCall
|
|
|
3403
3402
|
Fi,
|
|
3404
3403
|
Ui,
|
|
3405
3404
|
Bi,
|
|
3406
|
-
$i
|
|
3405
|
+
$i,
|
|
3406
|
+
xi,
|
|
3407
|
+
qi
|
|
3407
3408
|
];
|
|
3408
|
-
[...
|
|
3409
|
+
[...Hi, ...Vi];
|
|
3409
3410
|
[
|
|
3410
|
-
...
|
|
3411
|
-
...
|
|
3411
|
+
...Ue,
|
|
3412
|
+
...Wi
|
|
3412
3413
|
];
|
|
3413
|
-
const
|
|
3414
|
-
class
|
|
3414
|
+
const Qi = N("BaseSession.mock");
|
|
3415
|
+
class Yi {
|
|
3415
3416
|
originator;
|
|
3416
3417
|
connection;
|
|
3417
3418
|
events;
|
|
@@ -3425,7 +3426,7 @@ class Wi {
|
|
|
3425
3426
|
eventHandlers: n,
|
|
3426
3427
|
remoteIdentity: s
|
|
3427
3428
|
}) {
|
|
3428
|
-
this.originator = e, this.events = new
|
|
3429
|
+
this.originator = e, this.events = new Pn(Ue), this.initEvents(n), this.remote_identity = s;
|
|
3429
3430
|
}
|
|
3430
3431
|
get contact() {
|
|
3431
3432
|
throw new Error("Method not implemented.");
|
|
@@ -3521,7 +3522,7 @@ class Wi {
|
|
|
3521
3522
|
return this.events.off(e, n), this;
|
|
3522
3523
|
}
|
|
3523
3524
|
removeAllListeners(e) {
|
|
3524
|
-
return
|
|
3525
|
+
return Qi("Method not implemented. Event:", e), this;
|
|
3525
3526
|
}
|
|
3526
3527
|
setMaxListeners(e) {
|
|
3527
3528
|
throw new Error("Method not implemented.");
|
|
@@ -3556,7 +3557,7 @@ class Wi {
|
|
|
3556
3557
|
});
|
|
3557
3558
|
}
|
|
3558
3559
|
// @ts-expect-error
|
|
3559
|
-
on = (e, n) => (
|
|
3560
|
+
on = (e, n) => (Ue.includes(e) && this.events.on(e, n), this);
|
|
3560
3561
|
trigger(e, n) {
|
|
3561
3562
|
this.events.trigger(e, n);
|
|
3562
3563
|
}
|
|
@@ -3580,7 +3581,7 @@ class Wi {
|
|
|
3580
3581
|
return !0;
|
|
3581
3582
|
}
|
|
3582
3583
|
}
|
|
3583
|
-
class
|
|
3584
|
+
class dt {
|
|
3584
3585
|
stats = (/* @__PURE__ */ new Map()).set("codec", { mimeType: "video/h264" });
|
|
3585
3586
|
dtmf = null;
|
|
3586
3587
|
track = null;
|
|
@@ -3623,7 +3624,7 @@ class ct {
|
|
|
3623
3624
|
throw new Error("Method not implemented.");
|
|
3624
3625
|
}
|
|
3625
3626
|
}
|
|
3626
|
-
class
|
|
3627
|
+
class ht {
|
|
3627
3628
|
currentDirection = "sendrecv";
|
|
3628
3629
|
direction = "sendrecv";
|
|
3629
3630
|
// eslint-disable-next-line unicorn/no-null
|
|
@@ -3641,7 +3642,7 @@ class lt {
|
|
|
3641
3642
|
stop() {
|
|
3642
3643
|
}
|
|
3643
3644
|
}
|
|
3644
|
-
class
|
|
3645
|
+
class ji extends EventTarget {
|
|
3645
3646
|
senders = [];
|
|
3646
3647
|
receivers = [];
|
|
3647
3648
|
canTrickleIceCandidates;
|
|
@@ -3726,16 +3727,16 @@ class Qi extends EventTarget {
|
|
|
3726
3727
|
getReceivers = () => this.receivers;
|
|
3727
3728
|
getSenders = () => this.senders;
|
|
3728
3729
|
addTrack = (e, ...n) => {
|
|
3729
|
-
const s = new
|
|
3730
|
+
const s = new dt({ track: e }), r = new ht(s);
|
|
3730
3731
|
return r.mid = e.kind === "audio" ? "0" : "1", this.senders.push(s), this.dispatchTrackInternal(e, ...n), s;
|
|
3731
3732
|
};
|
|
3732
3733
|
// Дополнительный метод для тестов с возможностью установки mid
|
|
3733
3734
|
addTrackWithMid = (e, n) => {
|
|
3734
|
-
const s = new
|
|
3735
|
+
const s = new dt({ track: e }), r = new ht(s);
|
|
3735
3736
|
return n === void 0 ? r.mid = e.kind === "audio" ? "0" : "1" : r.mid = n, this.senders.push(s), this.dispatchTrackInternal(e), s;
|
|
3736
3737
|
};
|
|
3737
3738
|
dispatchTrack(e) {
|
|
3738
|
-
this.dispatchTrackInternal(new
|
|
3739
|
+
this.dispatchTrackInternal(new bn(e));
|
|
3739
3740
|
}
|
|
3740
3741
|
dispatchTrackInternal(e, ...n) {
|
|
3741
3742
|
const s = new Event(
|
|
@@ -3749,14 +3750,14 @@ class Qi extends EventTarget {
|
|
|
3749
3750
|
}), this.dispatchEvent(s);
|
|
3750
3751
|
}
|
|
3751
3752
|
}
|
|
3752
|
-
function
|
|
3753
|
+
function zi(t) {
|
|
3753
3754
|
const e = t.match(/(purgatory)|[\d.]+/g);
|
|
3754
3755
|
if (!e)
|
|
3755
3756
|
throw new Error("wrong sip url");
|
|
3756
3757
|
return e[0];
|
|
3757
3758
|
}
|
|
3758
|
-
var
|
|
3759
|
-
const
|
|
3759
|
+
var Ht = /* @__PURE__ */ ((t) => (t.LOCAL = "local", t.REMOTE = "remote", t.SYSTEM = "system", t))(Ht || {});
|
|
3760
|
+
const Wt = [
|
|
3760
3761
|
"peerconnection",
|
|
3761
3762
|
"connecting",
|
|
3762
3763
|
"sending",
|
|
@@ -3787,7 +3788,7 @@ const Vt = [
|
|
|
3787
3788
|
"peerconnection:createanswerfailed",
|
|
3788
3789
|
"peerconnection:setlocaldescriptionfailed",
|
|
3789
3790
|
"peerconnection:setremotedescriptionfailed"
|
|
3790
|
-
],
|
|
3791
|
+
], Ji = [
|
|
3791
3792
|
"start-call",
|
|
3792
3793
|
"end-call",
|
|
3793
3794
|
"peerconnection:confirmed",
|
|
@@ -3799,11 +3800,11 @@ const Vt = [
|
|
|
3799
3800
|
"recv-session-started",
|
|
3800
3801
|
"recv-session-ended",
|
|
3801
3802
|
"recv-quality-changed"
|
|
3802
|
-
],
|
|
3803
|
-
...
|
|
3804
|
-
...
|
|
3805
|
-
],
|
|
3806
|
-
class H extends
|
|
3803
|
+
], Qt = [
|
|
3804
|
+
...Wt,
|
|
3805
|
+
...Ji
|
|
3806
|
+
], Ki = () => new k(Qt), ut = 400, Xi = "777", Zi = (t) => t.getVideoTracks().length > 0;
|
|
3807
|
+
class H extends Yi {
|
|
3807
3808
|
static presentationError;
|
|
3808
3809
|
static startPresentationError;
|
|
3809
3810
|
static countStartPresentationError = Number.POSITIVE_INFINITY;
|
|
@@ -3829,7 +3830,7 @@ class H extends Wi {
|
|
|
3829
3830
|
}, 100), setTimeout(() => {
|
|
3830
3831
|
this.trigger("confirmed");
|
|
3831
3832
|
}, 200);
|
|
3832
|
-
},
|
|
3833
|
+
}, ut);
|
|
3833
3834
|
});
|
|
3834
3835
|
replaceMediaStream = jest.fn(async (e) => {
|
|
3835
3836
|
});
|
|
@@ -3847,8 +3848,8 @@ class H extends Wi {
|
|
|
3847
3848
|
constructor({
|
|
3848
3849
|
eventHandlers: e,
|
|
3849
3850
|
originator: n,
|
|
3850
|
-
remoteIdentity: s = new
|
|
3851
|
-
new
|
|
3851
|
+
remoteIdentity: s = new Mn(
|
|
3852
|
+
new On("sip", "caller1", "test1.com", 5060),
|
|
3852
3853
|
"Test Caller 1"
|
|
3853
3854
|
),
|
|
3854
3855
|
delayStartPresentation: r = 0
|
|
@@ -3856,7 +3857,7 @@ class H extends Wi {
|
|
|
3856
3857
|
super({ originator: n, eventHandlers: e, remoteIdentity: s }), this.delayStartPresentation = r;
|
|
3857
3858
|
}
|
|
3858
3859
|
static get C() {
|
|
3859
|
-
return
|
|
3860
|
+
return _n;
|
|
3860
3861
|
}
|
|
3861
3862
|
static setPresentationError(e) {
|
|
3862
3863
|
this.presentationError = e;
|
|
@@ -3892,25 +3893,25 @@ class H extends Wi {
|
|
|
3892
3893
|
return e ? (this.createPeerconnection(e), !0) : !1;
|
|
3893
3894
|
}
|
|
3894
3895
|
createPeerconnection(e) {
|
|
3895
|
-
const n =
|
|
3896
|
+
const n = yn();
|
|
3896
3897
|
n.id = "mainaudio1";
|
|
3897
3898
|
const s = [n];
|
|
3898
|
-
if (
|
|
3899
|
-
const i =
|
|
3899
|
+
if (Zi(e)) {
|
|
3900
|
+
const i = Dn();
|
|
3900
3901
|
i.id = "mainvideo1", s.push(i);
|
|
3901
3902
|
}
|
|
3902
|
-
this.connection = new
|
|
3903
|
+
this.connection = new ji(void 0, s), this.trigger("peerconnection", { peerconnection: this.connection }), this.addStream(e);
|
|
3903
3904
|
}
|
|
3904
3905
|
connect(e, { mediaStream: n } = {}) {
|
|
3905
|
-
const s =
|
|
3906
|
+
const s = zi(e);
|
|
3906
3907
|
return this.initPeerconnection(n), this.timeoutConnect = setTimeout(() => {
|
|
3907
|
-
e.includes(
|
|
3908
|
+
e.includes(Xi) ? this.trigger("failed", {
|
|
3908
3909
|
originator: "remote",
|
|
3909
3910
|
message: "IncomingResponse",
|
|
3910
3911
|
cause: "Rejected"
|
|
3911
3912
|
}) : (this.trigger("connecting"), this.timeoutNewInfo = setTimeout(() => {
|
|
3912
3913
|
this.newInfo({
|
|
3913
|
-
originator:
|
|
3914
|
+
originator: Ht.REMOTE,
|
|
3914
3915
|
// @ts-expect-error
|
|
3915
3916
|
request: {
|
|
3916
3917
|
getHeader: (r) => r === "content-type" ? "application/vinteo.webrtc.roomname" : r === "x-webrtc-enter-room" ? s : r === "x-webrtc-participant-name" ? "Test Caller 1" : ""
|
|
@@ -3921,7 +3922,7 @@ class H extends Wi {
|
|
|
3921
3922
|
}, 200), this.timeoutConfirmed = setTimeout(() => {
|
|
3922
3923
|
this.trigger("confirmed");
|
|
3923
3924
|
}, 300));
|
|
3924
|
-
},
|
|
3925
|
+
}, ut), this.connection;
|
|
3925
3926
|
}
|
|
3926
3927
|
terminate({ status_code: e, cause: n } = {}) {
|
|
3927
3928
|
return this.status_code = e, this.trigger("ended", { status_code: e, cause: n, originator: "local" }), this.isEndedInner = !1, this;
|
|
@@ -3982,22 +3983,22 @@ class H extends Wi {
|
|
|
3982
3983
|
clearTimeout(this.timeoutStartPresentation), clearTimeout(this.timeoutConnect), clearTimeout(this.timeoutNewInfo), clearTimeout(this.timeoutAccepted), clearTimeout(this.timeoutConfirmed);
|
|
3983
3984
|
}
|
|
3984
3985
|
}
|
|
3985
|
-
const
|
|
3986
|
-
const n = Y(t) ||
|
|
3986
|
+
const ea = ["snapshot-changed"], ta = () => new k(ea), na = (t) => t.type === "participant", Te = (t) => t.type === "spectator_synthetic", Y = (t) => t.type === "spectator", sa = (t, e) => Y(t) && !Y(e), ra = (t, e) => Y(e), ia = (t, e) => {
|
|
3987
|
+
const n = Y(t) || Te(t), s = Y(e) || Te(e);
|
|
3987
3988
|
return n && !s;
|
|
3988
|
-
},
|
|
3989
|
-
const n = Y(t) ||
|
|
3989
|
+
}, aa = (t, e) => {
|
|
3990
|
+
const n = Y(t) || Te(t), s = Y(e) || Te(e);
|
|
3990
3991
|
return !n && s;
|
|
3991
|
-
},
|
|
3992
|
+
}, De = {
|
|
3992
3993
|
type: "participant"
|
|
3993
|
-
},
|
|
3994
|
+
}, oa = {
|
|
3994
3995
|
type: "spectator_synthetic"
|
|
3995
|
-
},
|
|
3996
|
+
}, ca = (t) => ({
|
|
3996
3997
|
type: "spectator",
|
|
3997
3998
|
recvParams: t
|
|
3998
3999
|
});
|
|
3999
|
-
class
|
|
4000
|
-
role =
|
|
4000
|
+
class la {
|
|
4001
|
+
role = De;
|
|
4001
4002
|
isAvailableSendingMedia = !0;
|
|
4002
4003
|
onRoleChanged;
|
|
4003
4004
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -4011,13 +4012,13 @@ class oa {
|
|
|
4011
4012
|
return this.isAvailableSendingMedia;
|
|
4012
4013
|
}
|
|
4013
4014
|
setCallRoleParticipant() {
|
|
4014
|
-
this.isAvailableSendingMedia = !0, this.changeRole(
|
|
4015
|
+
this.isAvailableSendingMedia = !0, this.changeRole(De);
|
|
4015
4016
|
}
|
|
4016
4017
|
setCallRoleSpectatorSynthetic(e = !0) {
|
|
4017
|
-
this.isAvailableSendingMedia = e, this.changeRole(
|
|
4018
|
+
this.isAvailableSendingMedia = e, this.changeRole(oa);
|
|
4018
4019
|
}
|
|
4019
4020
|
setCallRoleSpectator(e, n = !0) {
|
|
4020
|
-
this.isAvailableSendingMedia = n, this.changeRole(
|
|
4021
|
+
this.isAvailableSendingMedia = n, this.changeRole(ca(e));
|
|
4021
4022
|
}
|
|
4022
4023
|
changeRole(e) {
|
|
4023
4024
|
const n = this.role;
|
|
@@ -4028,13 +4029,13 @@ class oa {
|
|
|
4028
4029
|
Y(e) && Y(n) && n.recvParams.audioId !== e.recvParams.audioId && this.setRole(e);
|
|
4029
4030
|
}
|
|
4030
4031
|
reset() {
|
|
4031
|
-
this.role =
|
|
4032
|
+
this.role = De, this.isAvailableSendingMedia = !0;
|
|
4032
4033
|
}
|
|
4033
4034
|
hasParticipant() {
|
|
4034
|
-
return
|
|
4035
|
+
return na(this.role);
|
|
4035
4036
|
}
|
|
4036
4037
|
hasSpectatorSynthetic() {
|
|
4037
|
-
return
|
|
4038
|
+
return Te(this.role);
|
|
4038
4039
|
}
|
|
4039
4040
|
hasSpectator() {
|
|
4040
4041
|
return Y(this.role);
|
|
@@ -4051,7 +4052,7 @@ class oa {
|
|
|
4051
4052
|
});
|
|
4052
4053
|
}
|
|
4053
4054
|
}
|
|
4054
|
-
const
|
|
4055
|
+
const da = (t, e) => t.type !== e.type ? !1 : t.type !== "spectator" ? !0 : e.type === "spectator" && t.recvParams.audioId === e.recvParams.audioId, ha = (t, e) => t.license === e.license && t.isDuplexSendingMediaMode === e.isDuplexSendingMediaMode && da(t.role, e.role) && t.derived.isAvailableSendingMedia === e.derived.isAvailableSendingMedia, gt = (t, e, n) => {
|
|
4055
4056
|
const s = t.getRole(), r = s.type === "spectator" || s.type === "spectator_synthetic";
|
|
4056
4057
|
return {
|
|
4057
4058
|
license: n,
|
|
@@ -4063,16 +4064,16 @@ const ca = (t, e) => t.type !== e.type ? !1 : t.type !== "spectator" ? !0 : e.ty
|
|
|
4063
4064
|
isAvailableSendingMedia: t.getIsAvailableSendingMedia()
|
|
4064
4065
|
}
|
|
4065
4066
|
};
|
|
4066
|
-
},
|
|
4067
|
-
class
|
|
4068
|
-
roleManager = new
|
|
4069
|
-
license =
|
|
4067
|
+
}, Et = je.VIDEO;
|
|
4068
|
+
class ua extends w {
|
|
4069
|
+
roleManager = new la();
|
|
4070
|
+
license = Et;
|
|
4070
4071
|
isDuplexSendingMediaMode = !1;
|
|
4071
4072
|
currentSnapshot;
|
|
4072
4073
|
subscriptions = [];
|
|
4073
4074
|
dedupedTotal = 0;
|
|
4074
4075
|
constructor() {
|
|
4075
|
-
super(
|
|
4076
|
+
super(ta()), this.currentSnapshot = gt(
|
|
4076
4077
|
this.roleManager,
|
|
4077
4078
|
this.isDuplexSendingMediaMode,
|
|
4078
4079
|
this.license
|
|
@@ -4106,7 +4107,7 @@ class da extends w {
|
|
|
4106
4107
|
this.roleManager.setCallRoleSpectator(e, n);
|
|
4107
4108
|
}
|
|
4108
4109
|
reset() {
|
|
4109
|
-
this.roleManager.reset(), this.license =
|
|
4110
|
+
this.roleManager.reset(), this.license = Et, this.isDuplexSendingMediaMode = !1, this.notifySubscribers();
|
|
4110
4111
|
}
|
|
4111
4112
|
subscribeToApiEvents(e) {
|
|
4112
4113
|
const n = e.on("use-license", this.handleUseLicense), s = e.on(
|
|
@@ -4139,7 +4140,7 @@ class da extends w {
|
|
|
4139
4140
|
}
|
|
4140
4141
|
notifySubscribers = () => {
|
|
4141
4142
|
const { previousSnapshot: e, currentSnapshot: n } = this.updateCurrentSnapshot();
|
|
4142
|
-
if (
|
|
4143
|
+
if (ha(e, n)) {
|
|
4143
4144
|
this.dedupedTotal += 1;
|
|
4144
4145
|
return;
|
|
4145
4146
|
}
|
|
@@ -4150,7 +4151,7 @@ class da extends w {
|
|
|
4150
4151
|
};
|
|
4151
4152
|
updateCurrentSnapshot() {
|
|
4152
4153
|
const e = this.currentSnapshot;
|
|
4153
|
-
return this.currentSnapshot =
|
|
4154
|
+
return this.currentSnapshot = gt(
|
|
4154
4155
|
this.roleManager,
|
|
4155
4156
|
this.isDuplexSendingMediaMode,
|
|
4156
4157
|
this.license
|
|
@@ -4166,10 +4167,10 @@ class da extends w {
|
|
|
4166
4167
|
this.isDuplexSendingMediaMode = e, this.notifySubscribers();
|
|
4167
4168
|
};
|
|
4168
4169
|
}
|
|
4169
|
-
const
|
|
4170
|
+
const ga = (t, e) => {
|
|
4170
4171
|
const n = e.major === t.major, s = e.minor === t.minor, r = e.major > t.major, i = n && e.minor > t.minor, a = n && s && e.patch > t.patch;
|
|
4171
4172
|
return r || i || a;
|
|
4172
|
-
},
|
|
4173
|
+
}, Ea = (t) => t.major !== void 0 && t.minor !== void 0 && t.patch !== void 0, ma = (t) => (e) => Ea(t) && ga(t, e), Ta = (t = "") => {
|
|
4173
4174
|
const e = t.split(".");
|
|
4174
4175
|
if (e.length <= 1)
|
|
4175
4176
|
return {
|
|
@@ -4179,10 +4180,10 @@ const ha = (t, e) => {
|
|
|
4179
4180
|
};
|
|
4180
4181
|
const [n, s, r] = e.map((i) => Number.parseInt(i, 10));
|
|
4181
4182
|
return { major: n, minor: s, patch: r };
|
|
4182
|
-
},
|
|
4183
|
-
const t = new
|
|
4183
|
+
}, pa = () => globalThis.process?.versions?.electron !== void 0, Yt = () => {
|
|
4184
|
+
const t = new Gn(), { name: e, version: n } = t.getBrowser(), { name: s } = t.getOS(), { type: r } = t.getDevice(), i = pa(), a = r === "mobile", o = Ta(n);
|
|
4184
4185
|
return {
|
|
4185
|
-
hasGreaterThanBrowserVersion:
|
|
4186
|
+
hasGreaterThanBrowserVersion: ma(o),
|
|
4186
4187
|
isMobileDevice: a,
|
|
4187
4188
|
isChrome: e === "Chrome" || i,
|
|
4188
4189
|
isYandexBrowser: e === "Yandex",
|
|
@@ -4190,19 +4191,19 @@ const ha = (t, e) => {
|
|
|
4190
4191
|
isOpera: e === "Opera",
|
|
4191
4192
|
isWindows: s === "Windows"
|
|
4192
4193
|
};
|
|
4193
|
-
},
|
|
4194
|
+
}, Sa = N("stringifyMessage"), fl = (t) => {
|
|
4194
4195
|
let e = "";
|
|
4195
4196
|
try {
|
|
4196
4197
|
e = JSON.stringify(t);
|
|
4197
4198
|
} catch (n) {
|
|
4198
|
-
|
|
4199
|
+
Sa("failed to stringify message", n);
|
|
4199
4200
|
}
|
|
4200
4201
|
return e;
|
|
4201
|
-
},
|
|
4202
|
+
}, Ca = /^p2p.+to.+$/i, Be = (t) => t !== void 0 && t.length > 0 && Ca.test(t), Ra = "purgatory", Me = (t) => t === Ra, Na = (t, e) => {
|
|
4202
4203
|
t.getVideoTracks().forEach((s) => {
|
|
4203
4204
|
"contentHint" in s && s.contentHint !== e && (s.contentHint = e);
|
|
4204
4205
|
});
|
|
4205
|
-
},
|
|
4206
|
+
}, Ae = (t, {
|
|
4206
4207
|
directionVideo: e,
|
|
4207
4208
|
directionAudio: n,
|
|
4208
4209
|
contentHint: s
|
|
@@ -4210,8 +4211,8 @@ const ha = (t, e) => {
|
|
|
4210
4211
|
if (!t || e === "recvonly" && n === "recvonly")
|
|
4211
4212
|
return;
|
|
4212
4213
|
const r = n === "recvonly" ? [] : t.getAudioTracks(), i = e === "recvonly" ? [] : t.getVideoTracks(), a = [...r, ...i], o = new MediaStream(a);
|
|
4213
|
-
return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" &&
|
|
4214
|
-
},
|
|
4214
|
+
return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" && Na(o, s), o;
|
|
4215
|
+
}, Aa = "api/v2/rtp2webrtc/offer", Ia = async ({
|
|
4215
4216
|
serverUrl: t,
|
|
4216
4217
|
conferenceNumber: e,
|
|
4217
4218
|
quality: n,
|
|
@@ -4220,7 +4221,7 @@ const ha = (t, e) => {
|
|
|
4220
4221
|
token: i
|
|
4221
4222
|
}) => {
|
|
4222
4223
|
const a = new URL(
|
|
4223
|
-
`https://${t.replace(/\/$/, "")}/${
|
|
4224
|
+
`https://${t.replace(/\/$/, "")}/${Aa}/${encodeURIComponent(e)}`
|
|
4224
4225
|
);
|
|
4225
4226
|
a.searchParams.set("quality", n), a.searchParams.set("audio", String(s));
|
|
4226
4227
|
const o = {
|
|
@@ -4242,39 +4243,39 @@ const ha = (t, e) => {
|
|
|
4242
4243
|
return g;
|
|
4243
4244
|
}
|
|
4244
4245
|
};
|
|
4245
|
-
},
|
|
4246
|
+
}, fa = (t, e) => (t.degradationPreference = e.degradationPreference, t), va = (t, e) => {
|
|
4246
4247
|
t.encodings ??= [];
|
|
4247
4248
|
for (let n = t.encodings.length; n < e; n += 1)
|
|
4248
4249
|
t.encodings.push({});
|
|
4249
4250
|
return t;
|
|
4250
|
-
},
|
|
4251
|
-
if (
|
|
4251
|
+
}, jt = (t) => (e, n) => n !== void 0 && e !== n || n === void 0 && e !== t, Ma = jt(), Oa = (t, e) => {
|
|
4252
|
+
if (Ma(t, e))
|
|
4252
4253
|
return t;
|
|
4253
|
-
},
|
|
4254
|
-
const s = t.maxBitrate, r =
|
|
4254
|
+
}, _a = (t, e, { isResetAllowed: n = !1 } = {}) => {
|
|
4255
|
+
const s = t.maxBitrate, r = Oa(e, s);
|
|
4255
4256
|
return (r !== void 0 || n) && (t.maxBitrate = r ?? e), t;
|
|
4256
|
-
},
|
|
4257
|
-
|
|
4258
|
-
),
|
|
4259
|
-
const n = t === void 0 ? void 0 : Math.max(t,
|
|
4260
|
-
if (n !== void 0 &&
|
|
4257
|
+
}, zt = 1, ba = jt(
|
|
4258
|
+
zt
|
|
4259
|
+
), ya = (t, e) => {
|
|
4260
|
+
const n = t === void 0 ? void 0 : Math.max(t, zt);
|
|
4261
|
+
if (n !== void 0 && ba(
|
|
4261
4262
|
n,
|
|
4262
4263
|
e
|
|
4263
4264
|
))
|
|
4264
4265
|
return n;
|
|
4265
|
-
},
|
|
4266
|
-
const n = t.scaleResolutionDownBy, s =
|
|
4266
|
+
}, Da = (t, e) => {
|
|
4267
|
+
const n = t.scaleResolutionDownBy, s = ya(
|
|
4267
4268
|
e,
|
|
4268
4269
|
n
|
|
4269
4270
|
);
|
|
4270
4271
|
return s !== void 0 && (t.scaleResolutionDownBy = s), t;
|
|
4271
|
-
},
|
|
4272
|
+
}, Pa = (t, e, { isResetAllowed: n } = {}) => {
|
|
4272
4273
|
const s = e.encodings?.length ?? 0;
|
|
4273
|
-
return
|
|
4274
|
+
return va(t, s), t.encodings.forEach((r, i) => {
|
|
4274
4275
|
const a = (e?.encodings ?? [])[i], o = a?.maxBitrate, c = a?.scaleResolutionDownBy;
|
|
4275
|
-
|
|
4276
|
+
_a(r, o, { isResetAllowed: n }), Da(r, c);
|
|
4276
4277
|
}), t;
|
|
4277
|
-
},
|
|
4278
|
+
}, La = (t, e) => {
|
|
4278
4279
|
if (t.codecs?.length !== e.codecs?.length)
|
|
4279
4280
|
return !0;
|
|
4280
4281
|
for (let n = 0; n < (t.codecs?.length ?? 0); n++)
|
|
@@ -4291,15 +4292,15 @@ const ha = (t, e) => {
|
|
|
4291
4292
|
if (JSON.stringify(t.encodings[n]) !== JSON.stringify(e.encodings[n]))
|
|
4292
4293
|
return !0;
|
|
4293
4294
|
return t.rtcp?.cname !== e.rtcp?.cname || t.rtcp?.reducedSize !== e.rtcp?.reducedSize || t.degradationPreference !== e.degradationPreference;
|
|
4294
|
-
},
|
|
4295
|
+
}, $e = async (t, e, { isResetAllowed: n } = {}) => {
|
|
4295
4296
|
const s = t.getParameters(), r = JSON.parse(
|
|
4296
4297
|
JSON.stringify(s)
|
|
4297
4298
|
);
|
|
4298
|
-
|
|
4299
|
-
const i =
|
|
4299
|
+
Pa(s, e, { isResetAllowed: n }), fa(s, e);
|
|
4300
|
+
const i = La(r, s);
|
|
4300
4301
|
return i && await t.setParameters(s), { parameters: s, isChanged: i };
|
|
4301
|
-
},
|
|
4302
|
-
const { isChanged: s, parameters: r } = await
|
|
4302
|
+
}, Jt = async (t, e, n) => {
|
|
4303
|
+
const { isChanged: s, parameters: r } = await $e(t, {
|
|
4303
4304
|
encodings: [
|
|
4304
4305
|
{
|
|
4305
4306
|
scaleResolutionDownBy: e.scaleResolutionDownBy,
|
|
@@ -4308,12 +4309,12 @@ const ha = (t, e) => {
|
|
|
4308
4309
|
]
|
|
4309
4310
|
});
|
|
4310
4311
|
return s && n && n(r), { isChanged: s, parameters: r };
|
|
4311
|
-
},
|
|
4312
|
-
const s =
|
|
4312
|
+
}, wa = (t, e) => t.find((n) => n.track !== null && e.getTracks().includes(n.track)), Ga = async (t, e, n) => {
|
|
4313
|
+
const s = wa(t, e);
|
|
4313
4314
|
if (s)
|
|
4314
|
-
return
|
|
4315
|
-
},
|
|
4316
|
-
class
|
|
4315
|
+
return Jt(s, { maxBitrate: n });
|
|
4316
|
+
}, ka = N("resolveOnStartMainCam"), vl = (t) => (n) => (ka("onStartMainCam"), t.on("api:admin:start-main-cam", n)), Fa = N("resolveOnStartMic"), Ml = (t) => (n) => (Fa("onStartMic"), t.on("api:admin:start-mic", n)), Ua = N("resolveOnStopMainCam"), Ol = (t) => (n) => (Ua("onStopMainCam"), t.on("api:admin:stop-main-cam", n)), Ba = N("resolveOnStopMic"), _l = (t) => (n) => (Ba("onStopMic"), t.on("api:admin:stop-mic", n));
|
|
4317
|
+
class $a {
|
|
4317
4318
|
command = void 0;
|
|
4318
4319
|
unsubscribe;
|
|
4319
4320
|
options;
|
|
@@ -4331,12 +4332,12 @@ class Ua {
|
|
|
4331
4332
|
}
|
|
4332
4333
|
const M = "evaluate";
|
|
4333
4334
|
var u = /* @__PURE__ */ ((t) => (t.IDLE = "call:idle", t.CONNECTING = "call:connecting", t.PRESENTATION_CALL = "call:presentationCall", t.ROOM_PENDING_AUTH = "call:roomPendingAuth", t.PURGATORY = "call:purgatory", t.P2P_ROOM = "call:p2pRoom", t.DIRECT_P2P_ROOM = "call:directP2pRoom", t.IN_ROOM = "call:inRoom", t.DISCONNECTING = "call:disconnecting", t))(u || {});
|
|
4334
|
-
const
|
|
4335
|
+
const Kt = {
|
|
4335
4336
|
raw: {},
|
|
4336
4337
|
state: {}
|
|
4337
|
-
},
|
|
4338
|
+
}, Xt = (t) => "number" in t && x(t.number) && Gt(t.answer), Zt = (t) => "room" in t && x(t.room) && x(t.participantName) && Fe(t.startedTimestamp), xa = (t) => "token" in t && x(t.token), en = (t) => xa(t) && "conferenceForToken" in t && x(t.conferenceForToken), ge = (t) => Xt(t) && Zt(t), tn = (t) => !en(t) || !Zt(t) ? !1 : t.conferenceForToken === t.room, nn = ({
|
|
4338
4339
|
isDirectPeerToPeer: t
|
|
4339
|
-
}) => t === !0,
|
|
4340
|
+
}) => t === !0, Pe = (t) => "isDirectPeerToPeer" in t && nn(t), qa = "x-vinteo-presentation-call: yes", Va = (t) => Vn(t) && t.some((e) => e.trim().toLowerCase() === qa), Ha = (t) => "extraHeaders" in t && Va(t.extraHeaders) && "isConfirmed" in t && t.isConfirmed === !0, Re = (t) => ge(t) && !Me(t.room) && en(t) && tn(t), he = (t) => {
|
|
4340
4341
|
const e = t;
|
|
4341
4342
|
return {
|
|
4342
4343
|
number: e.number,
|
|
@@ -4351,71 +4352,71 @@ const zt = {
|
|
|
4351
4352
|
buildContext: () => ({})
|
|
4352
4353
|
},
|
|
4353
4354
|
[u.CONNECTING]: {
|
|
4354
|
-
guard:
|
|
4355
|
+
guard: Xt,
|
|
4355
4356
|
buildContext: (t) => {
|
|
4356
4357
|
const { number: e, answer: n, extraHeaders: s } = t;
|
|
4357
4358
|
return { number: e, answer: n, extraHeaders: s };
|
|
4358
4359
|
}
|
|
4359
4360
|
},
|
|
4360
4361
|
[u.PRESENTATION_CALL]: {
|
|
4361
|
-
guard:
|
|
4362
|
+
guard: Ha,
|
|
4362
4363
|
buildContext: (t) => {
|
|
4363
4364
|
const { number: e, answer: n, startedTimestamp: s } = t;
|
|
4364
4365
|
return { number: e, answer: n, startedTimestamp: s };
|
|
4365
4366
|
}
|
|
4366
4367
|
},
|
|
4367
4368
|
[u.ROOM_PENDING_AUTH]: {
|
|
4368
|
-
guard: (t) =>
|
|
4369
|
-
buildContext:
|
|
4369
|
+
guard: (t) => ge(t) && !Me(t.room) && !Be(t.room) && !Pe(t) && !tn(t),
|
|
4370
|
+
buildContext: he
|
|
4370
4371
|
},
|
|
4371
4372
|
/** Токен из TOKEN_ISSUED может уже лежать в context — это не переводит в IN_ROOM. */
|
|
4372
4373
|
[u.PURGATORY]: {
|
|
4373
|
-
guard: (t) =>
|
|
4374
|
-
buildContext:
|
|
4374
|
+
guard: (t) => ge(t) && Me(t.room) && !Re(t),
|
|
4375
|
+
buildContext: he
|
|
4375
4376
|
},
|
|
4376
4377
|
[u.P2P_ROOM]: {
|
|
4377
|
-
guard: (t) =>
|
|
4378
|
-
buildContext:
|
|
4378
|
+
guard: (t) => ge(t) && Be(t.room) && !Pe(t) && !Re(t),
|
|
4379
|
+
buildContext: he
|
|
4379
4380
|
},
|
|
4380
4381
|
[u.DIRECT_P2P_ROOM]: {
|
|
4381
|
-
guard: (t) =>
|
|
4382
|
-
buildContext: (t) => ({ ...
|
|
4382
|
+
guard: (t) => ge(t) && Pe(t) && !Re(t),
|
|
4383
|
+
buildContext: (t) => ({ ...he(t), isDirectPeerToPeer: !0 })
|
|
4383
4384
|
},
|
|
4384
4385
|
/** IN_ROOM только если `conferenceForToken === room` (в т.ч. после enter-room с bearer, где conference задаётся как room). */
|
|
4385
4386
|
[u.IN_ROOM]: {
|
|
4386
|
-
guard:
|
|
4387
|
+
guard: Re,
|
|
4387
4388
|
buildContext: (t) => {
|
|
4388
4389
|
const { token: e, conferenceForToken: n } = t;
|
|
4389
|
-
return { ...
|
|
4390
|
+
return { ...he(t), token: e, conferenceForToken: n };
|
|
4390
4391
|
}
|
|
4391
4392
|
},
|
|
4392
4393
|
[u.DISCONNECTING]: {
|
|
4393
4394
|
guard: (t) => t.pendingDisconnect === !0,
|
|
4394
4395
|
buildContext: () => ({})
|
|
4395
4396
|
}
|
|
4396
|
-
},
|
|
4397
|
+
}, Wa = (t) => Me(t.room) || Be(t.room) || nn(t), Le = () => ({}), Qa = () => te({
|
|
4397
4398
|
types: {
|
|
4398
|
-
context:
|
|
4399
|
+
context: Kt,
|
|
4399
4400
|
events: {}
|
|
4400
4401
|
},
|
|
4401
4402
|
actions: {
|
|
4402
|
-
setConnecting:
|
|
4403
|
+
setConnecting: I(({ event: t, context: e }) => t.type !== "CALL.CONNECTING" ? e : {
|
|
4403
4404
|
raw: {
|
|
4404
|
-
...
|
|
4405
|
+
...Le(),
|
|
4405
4406
|
number: t.number,
|
|
4406
4407
|
answer: t.answer,
|
|
4407
4408
|
extraHeaders: t.extraHeaders
|
|
4408
4409
|
}
|
|
4409
4410
|
}),
|
|
4410
|
-
setRoomInfo:
|
|
4411
|
+
setRoomInfo: I(({ event: t, context: e }) => {
|
|
4411
4412
|
if (t.type !== "CALL.ENTER_ROOM")
|
|
4412
4413
|
return e;
|
|
4413
4414
|
const n = {
|
|
4414
4415
|
room: t.room,
|
|
4415
4416
|
participantName: t.participantName
|
|
4416
4417
|
};
|
|
4417
|
-
x(t.token) ? (n.token = t.token, n.conferenceForToken = t.room) :
|
|
4418
|
-
const r = e.raw.startedTimestamp, i =
|
|
4418
|
+
x(t.token) ? (n.token = t.token, n.conferenceForToken = t.room) : Wa(t) && (n.token = void 0, n.conferenceForToken = void 0), Gt(t.isDirectPeerToPeer) && (n.isDirectPeerToPeer = t.isDirectPeerToPeer);
|
|
4419
|
+
const r = e.raw.startedTimestamp, i = Fe(r) ? r : Date.now();
|
|
4419
4420
|
return {
|
|
4420
4421
|
raw: {
|
|
4421
4422
|
...e.raw,
|
|
@@ -4424,7 +4425,7 @@ const zt = {
|
|
|
4424
4425
|
}
|
|
4425
4426
|
};
|
|
4426
4427
|
}),
|
|
4427
|
-
setTokenInfo:
|
|
4428
|
+
setTokenInfo: I(({ event: t, context: e }) => t.type !== "CALL.TOKEN_ISSUED" ? e : {
|
|
4428
4429
|
raw: {
|
|
4429
4430
|
...e.raw,
|
|
4430
4431
|
token: t.token,
|
|
@@ -4432,10 +4433,10 @@ const zt = {
|
|
|
4432
4433
|
participantName: t.participantName
|
|
4433
4434
|
}
|
|
4434
4435
|
}),
|
|
4435
|
-
setConfirmed:
|
|
4436
|
+
setConfirmed: I(({ event: t, context: e }) => {
|
|
4436
4437
|
if (t.type !== "CALL.PRESENTATION_CALL")
|
|
4437
4438
|
return e;
|
|
4438
|
-
const s = e.raw.startedTimestamp, r =
|
|
4439
|
+
const s = e.raw.startedTimestamp, r = Fe(s) ? s : Date.now();
|
|
4439
4440
|
return {
|
|
4440
4441
|
raw: {
|
|
4441
4442
|
...e.raw,
|
|
@@ -4444,21 +4445,21 @@ const zt = {
|
|
|
4444
4445
|
}
|
|
4445
4446
|
};
|
|
4446
4447
|
}),
|
|
4447
|
-
reset:
|
|
4448
|
-
prepareDisconnect:
|
|
4448
|
+
reset: I(() => ({ raw: Le() })),
|
|
4449
|
+
prepareDisconnect: I(() => ({
|
|
4449
4450
|
raw: {
|
|
4450
|
-
...
|
|
4451
|
+
...Le(),
|
|
4451
4452
|
pendingDisconnect: !0
|
|
4452
4453
|
}
|
|
4453
4454
|
}))
|
|
4454
4455
|
}
|
|
4455
|
-
}),
|
|
4456
|
+
}), Ya = () => Qa().createMachine({
|
|
4456
4457
|
id: "call",
|
|
4457
4458
|
initial: u.IDLE,
|
|
4458
|
-
context:
|
|
4459
|
+
context: Kt,
|
|
4459
4460
|
states: {
|
|
4460
4461
|
[u.IDLE]: {
|
|
4461
|
-
entry:
|
|
4462
|
+
entry: I(() => ({ state: L[u.IDLE].buildContext() })),
|
|
4462
4463
|
on: {
|
|
4463
4464
|
"CALL.CONNECTING": {
|
|
4464
4465
|
target: M,
|
|
@@ -4467,7 +4468,7 @@ const zt = {
|
|
|
4467
4468
|
}
|
|
4468
4469
|
},
|
|
4469
4470
|
[u.CONNECTING]: {
|
|
4470
|
-
entry:
|
|
4471
|
+
entry: I(({ context: t }) => ({ state: L[u.CONNECTING].buildContext(t.raw) })),
|
|
4471
4472
|
on: {
|
|
4472
4473
|
"CALL.PRESENTATION_CALL": {
|
|
4473
4474
|
target: M,
|
|
@@ -4492,7 +4493,7 @@ const zt = {
|
|
|
4492
4493
|
}
|
|
4493
4494
|
},
|
|
4494
4495
|
[u.ROOM_PENDING_AUTH]: {
|
|
4495
|
-
entry:
|
|
4496
|
+
entry: I(({ context: t }) => ({ state: L[u.ROOM_PENDING_AUTH].buildContext(t.raw) })),
|
|
4496
4497
|
on: {
|
|
4497
4498
|
"CALL.ENTER_ROOM": {
|
|
4498
4499
|
target: M,
|
|
@@ -4513,7 +4514,7 @@ const zt = {
|
|
|
4513
4514
|
}
|
|
4514
4515
|
},
|
|
4515
4516
|
[u.IN_ROOM]: {
|
|
4516
|
-
entry:
|
|
4517
|
+
entry: I((t) => ({ state: L[u.IN_ROOM].buildContext(t.context.raw) })),
|
|
4517
4518
|
on: {
|
|
4518
4519
|
"CALL.ENTER_ROOM": {
|
|
4519
4520
|
target: M,
|
|
@@ -4573,7 +4574,7 @@ const zt = {
|
|
|
4573
4574
|
]
|
|
4574
4575
|
},
|
|
4575
4576
|
[u.PURGATORY]: {
|
|
4576
|
-
entry:
|
|
4577
|
+
entry: I(({ context: t }) => ({ state: L[u.PURGATORY].buildContext(t.raw) })),
|
|
4577
4578
|
on: {
|
|
4578
4579
|
"CALL.ENTER_ROOM": {
|
|
4579
4580
|
target: M,
|
|
@@ -4594,7 +4595,7 @@ const zt = {
|
|
|
4594
4595
|
}
|
|
4595
4596
|
},
|
|
4596
4597
|
[u.P2P_ROOM]: {
|
|
4597
|
-
entry:
|
|
4598
|
+
entry: I(({ context: t }) => ({ state: L[u.P2P_ROOM].buildContext(t.raw) })),
|
|
4598
4599
|
on: {
|
|
4599
4600
|
"CALL.ENTER_ROOM": {
|
|
4600
4601
|
target: M,
|
|
@@ -4615,7 +4616,7 @@ const zt = {
|
|
|
4615
4616
|
}
|
|
4616
4617
|
},
|
|
4617
4618
|
[u.PRESENTATION_CALL]: {
|
|
4618
|
-
entry:
|
|
4619
|
+
entry: I(({ context: t }) => ({ state: L[u.PRESENTATION_CALL].buildContext(t.raw) })),
|
|
4619
4620
|
on: {
|
|
4620
4621
|
"CALL.START_DISCONNECT": {
|
|
4621
4622
|
target: M,
|
|
@@ -4628,7 +4629,7 @@ const zt = {
|
|
|
4628
4629
|
}
|
|
4629
4630
|
},
|
|
4630
4631
|
[u.DIRECT_P2P_ROOM]: {
|
|
4631
|
-
entry:
|
|
4632
|
+
entry: I(({ context: t }) => ({ state: L[u.DIRECT_P2P_ROOM].buildContext(t.raw) })),
|
|
4632
4633
|
on: {
|
|
4633
4634
|
"CALL.ENTER_ROOM": {
|
|
4634
4635
|
target: M,
|
|
@@ -4649,7 +4650,7 @@ const zt = {
|
|
|
4649
4650
|
}
|
|
4650
4651
|
},
|
|
4651
4652
|
[u.DISCONNECTING]: {
|
|
4652
|
-
entry:
|
|
4653
|
+
entry: I(() => ({ state: L[u.DISCONNECTING].buildContext() })),
|
|
4653
4654
|
on: {
|
|
4654
4655
|
"CALL.RESET": {
|
|
4655
4656
|
target: M,
|
|
@@ -4659,11 +4660,11 @@ const zt = {
|
|
|
4659
4660
|
}
|
|
4660
4661
|
}
|
|
4661
4662
|
});
|
|
4662
|
-
function
|
|
4663
|
+
function ja(t) {
|
|
4663
4664
|
return t !== M;
|
|
4664
4665
|
}
|
|
4665
|
-
const
|
|
4666
|
-
class
|
|
4666
|
+
const za = N("CallManager: CallStateMachine");
|
|
4667
|
+
class Ja extends ne {
|
|
4667
4668
|
constructor(e, n) {
|
|
4668
4669
|
super(e), this.subscribeToEvents(n);
|
|
4669
4670
|
}
|
|
@@ -4806,7 +4807,7 @@ class ja extends te {
|
|
|
4806
4807
|
(o !== a.token || c !== a.conferenceForToken) && (n = a, e(a));
|
|
4807
4808
|
return;
|
|
4808
4809
|
}
|
|
4809
|
-
|
|
4810
|
+
ja(r.value) && (n = void 0);
|
|
4810
4811
|
});
|
|
4811
4812
|
return () => {
|
|
4812
4813
|
s.unsubscribe();
|
|
@@ -4817,7 +4818,7 @@ class ja extends te {
|
|
|
4817
4818
|
}
|
|
4818
4819
|
send(e) {
|
|
4819
4820
|
if (!this.actor.getSnapshot().can(e)) {
|
|
4820
|
-
|
|
4821
|
+
za(
|
|
4821
4822
|
`[CallStateMachine] Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`
|
|
4822
4823
|
);
|
|
4823
4824
|
return;
|
|
@@ -4873,16 +4874,16 @@ class ja extends te {
|
|
|
4873
4874
|
);
|
|
4874
4875
|
}
|
|
4875
4876
|
}
|
|
4876
|
-
const
|
|
4877
|
-
class
|
|
4877
|
+
const Ka = (t) => new Ja(Ya(), t), Xa = (t) => [...t.keys()].map((e) => t.get(e)), Za = (t, e) => Xa(t).find((n) => n?.type === e), sn = async (t) => t.getStats().then((e) => Za(e, "codec")?.mimeType);
|
|
4878
|
+
class eo {
|
|
4878
4879
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
4879
4880
|
async getCodecFromSender(e) {
|
|
4880
|
-
return await
|
|
4881
|
+
return await sn(e) ?? "";
|
|
4881
4882
|
}
|
|
4882
4883
|
}
|
|
4883
|
-
const
|
|
4884
|
-
class
|
|
4885
|
-
stackPromises =
|
|
4884
|
+
const to = N("TaskQueue");
|
|
4885
|
+
class no {
|
|
4886
|
+
stackPromises = Pt({
|
|
4886
4887
|
noRunIsNotActual: !0
|
|
4887
4888
|
});
|
|
4888
4889
|
/**
|
|
@@ -4902,34 +4903,34 @@ class eo {
|
|
|
4902
4903
|
*/
|
|
4903
4904
|
async run() {
|
|
4904
4905
|
return this.stackPromises().catch((e) => {
|
|
4905
|
-
|
|
4906
|
+
to("TaskQueue: error", e);
|
|
4906
4907
|
});
|
|
4907
4908
|
}
|
|
4908
4909
|
}
|
|
4909
|
-
class
|
|
4910
|
+
class so {
|
|
4910
4911
|
taskQueue;
|
|
4911
4912
|
onSetParameters;
|
|
4912
4913
|
constructor(e) {
|
|
4913
|
-
this.onSetParameters = e, this.taskQueue = new
|
|
4914
|
+
this.onSetParameters = e, this.taskQueue = new no();
|
|
4914
4915
|
}
|
|
4915
4916
|
async setEncodingsToSender(e, n) {
|
|
4916
|
-
return this.taskQueue.add(async () =>
|
|
4917
|
+
return this.taskQueue.add(async () => Jt(e, n, this.onSetParameters));
|
|
4917
4918
|
}
|
|
4918
4919
|
stop() {
|
|
4919
4920
|
this.taskQueue.stop();
|
|
4920
4921
|
}
|
|
4921
4922
|
}
|
|
4922
|
-
const
|
|
4923
|
-
const n =
|
|
4924
|
-
return
|
|
4925
|
-
},
|
|
4923
|
+
const xe = (t, e) => t !== void 0 && e !== void 0 && t.toLowerCase().includes(e.toLowerCase()), ro = 1e6, Q = (t) => t * ro, rn = Q(0.06), an = Q(4), io = (t) => t <= 64 ? rn : t <= 128 ? Q(0.12) : t <= 256 ? Q(0.25) : t <= 384 ? Q(0.32) : t <= 426 ? Q(0.38) : t <= 640 ? Q(0.5) : t <= 848 ? Q(0.7) : t <= 1280 ? Q(1) : t <= 1920 ? Q(2) : an, ao = "av1", oo = (t) => xe(t, ao), co = 0.6, ze = (t, e) => oo(e) ? t * co : t, on = (t) => ze(rn, t), cn = (t) => ze(an, t), mt = (t, e) => {
|
|
4924
|
+
const n = io(t);
|
|
4925
|
+
return ze(n, e);
|
|
4926
|
+
}, we = 1, lo = ({
|
|
4926
4927
|
videoTrack: t,
|
|
4927
4928
|
targetSize: e
|
|
4928
4929
|
}) => {
|
|
4929
|
-
const n = t.getSettings(), s = n.width, r = n.height, i = s === void 0 ?
|
|
4930
|
-
return Math.max(i, a,
|
|
4930
|
+
const n = t.getSettings(), s = n.width, r = n.height, i = s === void 0 ? we : s / e.width, a = r === void 0 ? we : r / e.height;
|
|
4931
|
+
return Math.max(i, a, we);
|
|
4931
4932
|
};
|
|
4932
|
-
class
|
|
4933
|
+
class ho {
|
|
4933
4934
|
ignoreForCodec;
|
|
4934
4935
|
senderFinder;
|
|
4935
4936
|
codecProvider;
|
|
@@ -4962,7 +4963,7 @@ class co {
|
|
|
4962
4963
|
if (!r?.track)
|
|
4963
4964
|
return { ...this.resultNoChanged, sender: r };
|
|
4964
4965
|
const i = await this.codecProvider.getCodecFromSender(r);
|
|
4965
|
-
if (
|
|
4966
|
+
if (xe(i, this.ignoreForCodec))
|
|
4966
4967
|
return { ...this.resultNoChanged, sender: r };
|
|
4967
4968
|
const { mainCam: a, resolutionMainCam: o } = n ?? {};
|
|
4968
4969
|
return this.processSender(
|
|
@@ -4984,7 +4985,7 @@ class co {
|
|
|
4984
4985
|
if (!s?.track)
|
|
4985
4986
|
return { ...this.resultNoChanged, sender: s };
|
|
4986
4987
|
const r = await this.codecProvider.getCodecFromSender(s);
|
|
4987
|
-
if (
|
|
4988
|
+
if (xe(r, this.ignoreForCodec))
|
|
4988
4989
|
return { ...this.resultNoChanged, sender: s };
|
|
4989
4990
|
const i = {
|
|
4990
4991
|
sender: s,
|
|
@@ -5023,7 +5024,7 @@ class co {
|
|
|
5023
5024
|
async downgradeResolutionSender(e) {
|
|
5024
5025
|
const { sender: n, codec: s } = e, r = {
|
|
5025
5026
|
scaleResolutionDownBy: 200,
|
|
5026
|
-
maxBitrate:
|
|
5027
|
+
maxBitrate: on(s)
|
|
5027
5028
|
};
|
|
5028
5029
|
return this.parametersSetter.setEncodingsToSender(n, r);
|
|
5029
5030
|
}
|
|
@@ -5033,7 +5034,7 @@ class co {
|
|
|
5033
5034
|
* @returns Promise с результатом
|
|
5034
5035
|
*/
|
|
5035
5036
|
async setBitrateByTrackResolution(e) {
|
|
5036
|
-
const { sender: n, videoTrack: s, codec: r } = e, a = s.getSettings().width, o = a === void 0 ?
|
|
5037
|
+
const { sender: n, videoTrack: s, codec: r } = e, a = s.getSettings().width, o = a === void 0 ? cn(r) : mt(a, r);
|
|
5037
5038
|
return this.parametersSetter.setEncodingsToSender(n, {
|
|
5038
5039
|
scaleResolutionDownBy: 1,
|
|
5039
5040
|
maxBitrate: o
|
|
@@ -5049,24 +5050,24 @@ class co {
|
|
|
5049
5050
|
const [s, r] = e.split("x"), { sender: i, videoTrack: a, codec: o } = n, c = {
|
|
5050
5051
|
width: Number(s),
|
|
5051
5052
|
height: Number(r)
|
|
5052
|
-
}, g =
|
|
5053
|
+
}, g = lo({
|
|
5053
5054
|
videoTrack: a,
|
|
5054
5055
|
targetSize: c
|
|
5055
|
-
}), C =
|
|
5056
|
+
}), C = mt(c.width, o), f = {
|
|
5056
5057
|
scaleResolutionDownBy: g,
|
|
5057
5058
|
maxBitrate: C
|
|
5058
5059
|
};
|
|
5059
5060
|
return this.parametersSetter.setEncodingsToSender(i, f);
|
|
5060
5061
|
}
|
|
5061
5062
|
}
|
|
5062
|
-
const
|
|
5063
|
-
class
|
|
5063
|
+
const uo = (t) => t.find((e) => e.track?.kind === "video");
|
|
5064
|
+
class go {
|
|
5064
5065
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
5065
5066
|
findVideoSender(e) {
|
|
5066
|
-
return
|
|
5067
|
+
return uo(e);
|
|
5067
5068
|
}
|
|
5068
5069
|
}
|
|
5069
|
-
class
|
|
5070
|
+
class Eo {
|
|
5070
5071
|
currentSender;
|
|
5071
5072
|
originalReplaceTrack;
|
|
5072
5073
|
lastWidth;
|
|
@@ -5079,7 +5080,7 @@ class uo {
|
|
|
5079
5080
|
pollIntervalMs: e = 1e3,
|
|
5080
5081
|
maxPollIntervalMs: n
|
|
5081
5082
|
}) {
|
|
5082
|
-
this.pollIntervalMs = e, this.maxPollIntervalMs = n ?? e * 16, this.currentPollIntervalMs = this.pollIntervalMs, this.setTimeoutRequest = new
|
|
5083
|
+
this.pollIntervalMs = e, this.maxPollIntervalMs = n ?? e * 16, this.currentPollIntervalMs = this.pollIntervalMs, this.setTimeoutRequest = new Dt();
|
|
5083
5084
|
}
|
|
5084
5085
|
/**
|
|
5085
5086
|
* Проверяет актуальный video-sender и (при необходимости) перенастраивает наблюдение.
|
|
@@ -5130,7 +5131,7 @@ class uo {
|
|
|
5130
5131
|
this.setTimeoutRequest.cancelRequest(), this.lastWidth = void 0, this.lastHeight = void 0;
|
|
5131
5132
|
}
|
|
5132
5133
|
}
|
|
5133
|
-
class
|
|
5134
|
+
class mo {
|
|
5134
5135
|
apiManager;
|
|
5135
5136
|
currentHandler;
|
|
5136
5137
|
constructor(e) {
|
|
@@ -5150,8 +5151,8 @@ class go {
|
|
|
5150
5151
|
this.currentHandler && (this.apiManager.off("main-cam-control", this.currentHandler), this.currentHandler = void 0);
|
|
5151
5152
|
}
|
|
5152
5153
|
}
|
|
5153
|
-
const
|
|
5154
|
-
class
|
|
5154
|
+
const Ge = N("VideoSendingBalancer");
|
|
5155
|
+
class To {
|
|
5155
5156
|
eventHandler;
|
|
5156
5157
|
senderBalancer;
|
|
5157
5158
|
parametersSetterWithQueue;
|
|
@@ -5163,16 +5164,16 @@ class Eo {
|
|
|
5163
5164
|
onSetParameters: r,
|
|
5164
5165
|
pollIntervalMs: i
|
|
5165
5166
|
} = {}) {
|
|
5166
|
-
this.getConnection = n, this.eventHandler = new
|
|
5167
|
+
this.getConnection = n, this.eventHandler = new mo(e), this.parametersSetterWithQueue = new so(r), this.senderBalancer = new ho(
|
|
5167
5168
|
{
|
|
5168
|
-
senderFinder: new
|
|
5169
|
-
codecProvider: new
|
|
5169
|
+
senderFinder: new go(),
|
|
5170
|
+
codecProvider: new eo(),
|
|
5170
5171
|
parametersSetter: this.parametersSetterWithQueue
|
|
5171
5172
|
},
|
|
5172
5173
|
{
|
|
5173
5174
|
ignoreForCodec: s
|
|
5174
5175
|
}
|
|
5175
|
-
), this.trackMonitor = new
|
|
5176
|
+
), this.trackMonitor = new Eo({ pollIntervalMs: i });
|
|
5176
5177
|
}
|
|
5177
5178
|
/**
|
|
5178
5179
|
* Подписывается на события управления главной камерой
|
|
@@ -5193,7 +5194,7 @@ class Eo {
|
|
|
5193
5194
|
this.clearState();
|
|
5194
5195
|
const e = this.getConnection();
|
|
5195
5196
|
e ? this.senderBalancer.reset(e).catch((n) => {
|
|
5196
|
-
|
|
5197
|
+
Ge("reset sender encodings: error", n);
|
|
5197
5198
|
}).finally(() => {
|
|
5198
5199
|
this.parametersSetterWithQueue.stop();
|
|
5199
5200
|
}) : this.parametersSetterWithQueue.stop();
|
|
@@ -5209,7 +5210,7 @@ class Eo {
|
|
|
5209
5210
|
const n = await this.senderBalancer.balance(e, this.serverHeaders);
|
|
5210
5211
|
return this.trackMonitor.subscribe(n.sender, () => {
|
|
5211
5212
|
this.balance().catch((s) => {
|
|
5212
|
-
|
|
5213
|
+
Ge("balance on track change: error", s);
|
|
5213
5214
|
});
|
|
5214
5215
|
}), n;
|
|
5215
5216
|
}
|
|
@@ -5222,12 +5223,12 @@ class Eo {
|
|
|
5222
5223
|
*/
|
|
5223
5224
|
handleMainCamControl = (e) => {
|
|
5224
5225
|
this.serverHeaders = e, this.balance().catch((n) => {
|
|
5225
|
-
|
|
5226
|
+
Ge("handleMainCamControl: error", n);
|
|
5226
5227
|
});
|
|
5227
5228
|
};
|
|
5228
5229
|
}
|
|
5229
|
-
const
|
|
5230
|
-
class
|
|
5230
|
+
const po = 6e3, So = 52e4, Ne = (t, e) => t.getSenders().filter((n) => n.track?.kind === e), Co = (t, e) => t === "audio" ? po : on(e), Ro = (t) => t.track !== null;
|
|
5231
|
+
class No {
|
|
5231
5232
|
previousBitrates = /* @__PURE__ */ new Map();
|
|
5232
5233
|
/**
|
|
5233
5234
|
* Устанавливает минимальный битрейт для указанных типов потоков
|
|
@@ -5238,18 +5239,18 @@ class Co {
|
|
|
5238
5239
|
const s = [];
|
|
5239
5240
|
if (!e)
|
|
5240
5241
|
return;
|
|
5241
|
-
(n === "audio" || n === "all") && s.push(...
|
|
5242
|
-
const r = s.filter(
|
|
5242
|
+
(n === "audio" || n === "all") && s.push(...Ne(e, "audio")), (n === "video" || n === "all") && s.push(...Ne(e, "video"));
|
|
5243
|
+
const r = s.filter(Ro).map(async (i) => {
|
|
5243
5244
|
const a = i.getParameters();
|
|
5244
5245
|
this.saveCurrentBitrate(i, a);
|
|
5245
5246
|
const o = {
|
|
5246
5247
|
...a,
|
|
5247
5248
|
encodings: a.encodings.map((c) => ({
|
|
5248
5249
|
...c,
|
|
5249
|
-
maxBitrate:
|
|
5250
|
+
maxBitrate: Co(i.track.kind)
|
|
5250
5251
|
}))
|
|
5251
5252
|
};
|
|
5252
|
-
await
|
|
5253
|
+
await $e(i, o);
|
|
5253
5254
|
});
|
|
5254
5255
|
await Promise.all(r);
|
|
5255
5256
|
}
|
|
@@ -5262,14 +5263,14 @@ class Co {
|
|
|
5262
5263
|
const s = [];
|
|
5263
5264
|
if (!e)
|
|
5264
5265
|
return;
|
|
5265
|
-
(n === "audio" || n === "all") && s.push(...
|
|
5266
|
+
(n === "audio" || n === "all") && s.push(...Ne(e, "audio")), (n === "video" || n === "all") && s.push(...Ne(e, "video"));
|
|
5266
5267
|
const r = s.map(async (i) => {
|
|
5267
5268
|
const a = this.getSavedBitrate(i);
|
|
5268
5269
|
if (a) {
|
|
5269
|
-
const o = i.getParameters(), c = i.track?.kind === "video", g = c ? await
|
|
5270
|
+
const o = i.getParameters(), c = i.track?.kind === "video", g = c ? await sn(i) : void 0, C = {
|
|
5270
5271
|
...o,
|
|
5271
5272
|
encodings: a.map((f) => {
|
|
5272
|
-
const y = c ?
|
|
5273
|
+
const y = c ? cn(g) : So;
|
|
5273
5274
|
return {
|
|
5274
5275
|
...f,
|
|
5275
5276
|
// В Safari и некоторых браузерах encodings изначально не содержат maxBitrate.
|
|
@@ -5281,7 +5282,7 @@ class Co {
|
|
|
5281
5282
|
};
|
|
5282
5283
|
})
|
|
5283
5284
|
};
|
|
5284
|
-
await
|
|
5285
|
+
await $e(i, C, { isResetAllowed: !0 }), this.clearSavedBitrate(i);
|
|
5285
5286
|
}
|
|
5286
5287
|
});
|
|
5287
5288
|
await Promise.all(r);
|
|
@@ -5324,15 +5325,15 @@ class Co {
|
|
|
5324
5325
|
this.previousBitrates.set(e, s);
|
|
5325
5326
|
}
|
|
5326
5327
|
}
|
|
5327
|
-
var
|
|
5328
|
-
const
|
|
5329
|
-
class
|
|
5328
|
+
var ln = /* @__PURE__ */ ((t) => (t.BYE = "Terminated", t.WEBRTC_ERROR = "WebRTC Error", t.CANCELED = "Canceled", t.REQUEST_TIMEOUT = "Request Timeout", t.REJECTED = "Rejected", t.REDIRECTED = "Redirected", t.UNAVAILABLE = "Unavailable", t.NOT_FOUND = "Not Found", t.ADDRESS_INCOMPLETE = "Address Incomplete", t.INCOMPATIBLE_SDP = "Incompatible SDP", t.BAD_MEDIA_DESCRIPTION = "Bad Media Description", t))(ln || {});
|
|
5329
|
+
const Tt = N("CallManager: MCUSession");
|
|
5330
|
+
class Ao {
|
|
5330
5331
|
events;
|
|
5331
5332
|
rtcSession;
|
|
5332
5333
|
disposers = /* @__PURE__ */ new Set();
|
|
5333
5334
|
pcConfig;
|
|
5334
5335
|
// Менеджер состояния битрейта
|
|
5335
|
-
bitrateStateManager = new
|
|
5336
|
+
bitrateStateManager = new No();
|
|
5336
5337
|
constructor(e) {
|
|
5337
5338
|
this.events = e, e.on("failed", this.handleEnded), e.on("ended", this.handleEnded);
|
|
5338
5339
|
}
|
|
@@ -5364,11 +5365,11 @@ class Ro {
|
|
|
5364
5365
|
degradationPreference: y,
|
|
5365
5366
|
sendEncodings: _,
|
|
5366
5367
|
onAddedTransceiver: q
|
|
5367
|
-
}) => new Promise((B,
|
|
5368
|
-
this.handleCall().then(B).catch((
|
|
5369
|
-
|
|
5368
|
+
}) => new Promise((B, Z) => {
|
|
5369
|
+
this.handleCall().then(B).catch((se) => {
|
|
5370
|
+
Z(se);
|
|
5370
5371
|
}), this.pcConfig = { iceServers: a }, this.rtcSession = e.call(n(s), {
|
|
5371
|
-
mediaStream:
|
|
5372
|
+
mediaStream: Ae(r, {
|
|
5372
5373
|
directionVideo: o,
|
|
5373
5374
|
directionAudio: c,
|
|
5374
5375
|
contentHint: g
|
|
@@ -5396,7 +5397,7 @@ class Ro {
|
|
|
5396
5397
|
const { rtcSession: e } = this;
|
|
5397
5398
|
if (e && !e.isEnded())
|
|
5398
5399
|
return e.terminateAsync({
|
|
5399
|
-
cause:
|
|
5400
|
+
cause: ln.CANCELED
|
|
5400
5401
|
});
|
|
5401
5402
|
}
|
|
5402
5403
|
answerToIncomingCall = async (e, {
|
|
@@ -5423,7 +5424,7 @@ class Ro {
|
|
|
5423
5424
|
offerToReceiveAudio: o,
|
|
5424
5425
|
offerToReceiveVideo: c
|
|
5425
5426
|
},
|
|
5426
|
-
mediaStream:
|
|
5427
|
+
mediaStream: Ae(n, {
|
|
5427
5428
|
directionVideo: i,
|
|
5428
5429
|
directionAudio: a,
|
|
5429
5430
|
contentHint: g
|
|
@@ -5442,7 +5443,7 @@ class Ro {
|
|
|
5442
5443
|
async replaceMediaStream(e, n) {
|
|
5443
5444
|
if (!this.rtcSession)
|
|
5444
5445
|
throw new Error("No rtcSession established");
|
|
5445
|
-
const { contentHint: s } = n ?? {}, r =
|
|
5446
|
+
const { contentHint: s } = n ?? {}, r = Ae(e, { contentHint: s });
|
|
5446
5447
|
if (r === void 0)
|
|
5447
5448
|
throw new Error("No preparedMediaStream");
|
|
5448
5449
|
return this.rtcSession.replaceMediaStream(r, n);
|
|
@@ -5458,7 +5459,7 @@ class Ro {
|
|
|
5458
5459
|
*/
|
|
5459
5460
|
setMinBitrateForSenders(e = "all") {
|
|
5460
5461
|
this.bitrateStateManager.setMinBitrateForSenders(this.connection, e).catch((n) => {
|
|
5461
|
-
|
|
5462
|
+
Tt("setMinBitrateForSenders", n);
|
|
5462
5463
|
});
|
|
5463
5464
|
}
|
|
5464
5465
|
/**
|
|
@@ -5467,7 +5468,7 @@ class Ro {
|
|
|
5467
5468
|
*/
|
|
5468
5469
|
restoreBitrateForSenders(e = "all") {
|
|
5469
5470
|
this.bitrateStateManager.restoreBitrateForSenders(this.connection, e).catch((n) => {
|
|
5470
|
-
|
|
5471
|
+
Tt("restoreBitrateForSenders", n);
|
|
5471
5472
|
});
|
|
5472
5473
|
}
|
|
5473
5474
|
reset = () => {
|
|
@@ -5501,7 +5502,7 @@ class Ro {
|
|
|
5501
5502
|
});
|
|
5502
5503
|
subscribeToSessionEvents(e) {
|
|
5503
5504
|
this.events.eachTriggers((n, s) => {
|
|
5504
|
-
const r =
|
|
5505
|
+
const r = Wt.find((i) => i === s);
|
|
5505
5506
|
r && (e.on(r, n), this.disposers.add(() => {
|
|
5506
5507
|
e.off(r, n);
|
|
5507
5508
|
}));
|
|
@@ -5517,8 +5518,8 @@ class Ro {
|
|
|
5517
5518
|
n === "remote" && this.events.trigger("ended:fromserver", e);
|
|
5518
5519
|
};
|
|
5519
5520
|
}
|
|
5520
|
-
const
|
|
5521
|
-
class
|
|
5521
|
+
const qe = (t) => t === "auto" ? "high" : t, Io = 10, fo = 500, vo = 5e3;
|
|
5522
|
+
class Mo {
|
|
5522
5523
|
/**
|
|
5523
5524
|
* Текущая операция отправки offer с повторными попытками при ошибках.
|
|
5524
5525
|
* Может быть отменена при новом renegotiate для предотвращения конфликтов.
|
|
@@ -5539,7 +5540,7 @@ class fo {
|
|
|
5539
5540
|
this.config = {
|
|
5540
5541
|
...e,
|
|
5541
5542
|
quality: s,
|
|
5542
|
-
effectiveQuality:
|
|
5543
|
+
effectiveQuality: qe(s)
|
|
5543
5544
|
}, this.tools = n, this.connection = new RTCPeerConnection(e.pcConfig), this.addTransceivers();
|
|
5544
5545
|
}
|
|
5545
5546
|
get settings() {
|
|
@@ -5568,7 +5569,7 @@ class fo {
|
|
|
5568
5569
|
async setQuality(e) {
|
|
5569
5570
|
if (!this.lastCallParams)
|
|
5570
5571
|
return !1;
|
|
5571
|
-
const n = this.config.effectiveQuality, s = this.config.quality, r =
|
|
5572
|
+
const n = this.config.effectiveQuality, s = this.config.quality, r = qe(e);
|
|
5572
5573
|
return e === s && r === n ? !1 : (this.config.quality = e, this.config.effectiveQuality = r, r !== n && await this.renegotiate(this.lastCallParams), !0);
|
|
5573
5574
|
}
|
|
5574
5575
|
async applyQuality(e) {
|
|
@@ -5644,11 +5645,11 @@ class fo {
|
|
|
5644
5645
|
},
|
|
5645
5646
|
s
|
|
5646
5647
|
), i = (o) => !(o instanceof Error);
|
|
5647
|
-
this.cancelableSendOfferWithRepeatedCalls =
|
|
5648
|
+
this.cancelableSendOfferWithRepeatedCalls = We({
|
|
5648
5649
|
targetFunction: r,
|
|
5649
5650
|
isComplete: i,
|
|
5650
|
-
callLimit:
|
|
5651
|
-
delay:
|
|
5651
|
+
callLimit: Io,
|
|
5652
|
+
delay: fo,
|
|
5652
5653
|
isRejectAsValid: !0,
|
|
5653
5654
|
isCheckBeforeCall: !1
|
|
5654
5655
|
});
|
|
@@ -5742,7 +5743,7 @@ class fo {
|
|
|
5742
5743
|
c(
|
|
5743
5744
|
new Error("Timed out waiting for stable signaling state and ready connection state")
|
|
5744
5745
|
);
|
|
5745
|
-
},
|
|
5746
|
+
}, vo), this.connection.addEventListener("signalingstatechange", g), this.connection.addEventListener("connectionstatechange", g), g();
|
|
5746
5747
|
});
|
|
5747
5748
|
}
|
|
5748
5749
|
async waitForTracks() {
|
|
@@ -5775,18 +5776,18 @@ class fo {
|
|
|
5775
5776
|
this.cancelableSendOfferWithRepeatedCalls?.cancel();
|
|
5776
5777
|
}
|
|
5777
5778
|
}
|
|
5778
|
-
const
|
|
5779
|
-
const n =
|
|
5779
|
+
const dn = (t) => t.getSettings(), Oo = (t, e) => {
|
|
5780
|
+
const n = dn(t);
|
|
5780
5781
|
let s = e;
|
|
5781
5782
|
s ??= t.label;
|
|
5782
5783
|
let r = n?.msid;
|
|
5783
5784
|
return r ??= s, r ??= t.id, r;
|
|
5784
|
-
},
|
|
5785
|
-
const n =
|
|
5785
|
+
}, _o = (t, e) => {
|
|
5786
|
+
const n = dn(t);
|
|
5786
5787
|
let s = e;
|
|
5787
5788
|
return s ??= n?.msid, s ??= t.label, (s && s.length > 0 ? s : void 0) ?? t.id;
|
|
5788
5789
|
};
|
|
5789
|
-
class
|
|
5790
|
+
class pt {
|
|
5790
5791
|
participantGroups = /* @__PURE__ */ new Map();
|
|
5791
5792
|
trackToGroup = /* @__PURE__ */ new Map();
|
|
5792
5793
|
trackDisposers = /* @__PURE__ */ new Map();
|
|
@@ -5803,7 +5804,7 @@ class mt {
|
|
|
5803
5804
|
onRemoved: n,
|
|
5804
5805
|
streamHint: s
|
|
5805
5806
|
} = {}) {
|
|
5806
|
-
const r =
|
|
5807
|
+
const r = _o(e, s), i = Oo(e, s);
|
|
5807
5808
|
if (this.trackToGroup.has(e.id))
|
|
5808
5809
|
return { isAddedTrack: !1, isAddedStream: !1 };
|
|
5809
5810
|
const a = this.getParticipantGroups(r), o = a.get(i), c = !o;
|
|
@@ -5871,13 +5872,13 @@ class mt {
|
|
|
5871
5872
|
return this.participantGroups.set(e, s), s;
|
|
5872
5873
|
}
|
|
5873
5874
|
}
|
|
5874
|
-
const
|
|
5875
|
+
const bo = (t, e) => {
|
|
5875
5876
|
if (!t || !e)
|
|
5876
5877
|
return t === e;
|
|
5877
5878
|
const n = t.mainStream?.id, s = e.mainStream?.id, r = t.contentedStream?.id, i = e.contentedStream?.id;
|
|
5878
5879
|
return n === s && r === i;
|
|
5879
5880
|
};
|
|
5880
|
-
class
|
|
5881
|
+
class yo {
|
|
5881
5882
|
lastEmittedStreams;
|
|
5882
5883
|
/**
|
|
5883
5884
|
* Проверяет, изменились ли streams с последнего сохраненного состояния
|
|
@@ -5885,7 +5886,7 @@ class _o {
|
|
|
5885
5886
|
* @returns true, если streams изменились
|
|
5886
5887
|
*/
|
|
5887
5888
|
hasChanged(e) {
|
|
5888
|
-
return !
|
|
5889
|
+
return !bo(this.lastEmittedStreams, e);
|
|
5889
5890
|
}
|
|
5890
5891
|
/**
|
|
5891
5892
|
* Сохраняет текущие streams как последнее эмитнутое состояние
|
|
@@ -5908,8 +5909,8 @@ class _o {
|
|
|
5908
5909
|
this.lastEmittedStreams = void 0;
|
|
5909
5910
|
}
|
|
5910
5911
|
}
|
|
5911
|
-
const
|
|
5912
|
-
class
|
|
5912
|
+
const Do = "default", Po = "dual", Lo = "content_", wo = (t) => `${Lo}${t.toLowerCase()}`, Go = (t) => [...t.getTracks()].some((e) => e.label.includes(Po));
|
|
5913
|
+
class ko {
|
|
5913
5914
|
mainRemoteStreamsManager;
|
|
5914
5915
|
recvRemoteStreamsManager;
|
|
5915
5916
|
constructor(e, n) {
|
|
@@ -5926,7 +5927,7 @@ class wo {
|
|
|
5926
5927
|
}) {
|
|
5927
5928
|
const n = this.mainRemoteStreamsManager;
|
|
5928
5929
|
return { manager: n, getRemoteStreams: () => {
|
|
5929
|
-
const r = n.getStreams(), i = r.find((o) => !
|
|
5930
|
+
const r = n.getStreams(), i = r.find((o) => !Go(o)), a = e.isAvailable ? r.find((o) => o !== i) : void 0;
|
|
5930
5931
|
return { mainStream: i, contentedStream: a };
|
|
5931
5932
|
} };
|
|
5932
5933
|
}
|
|
@@ -5935,7 +5936,7 @@ class wo {
|
|
|
5935
5936
|
}) {
|
|
5936
5937
|
const n = this.recvRemoteStreamsManager;
|
|
5937
5938
|
return { manager: n, getRemoteStreams: () => {
|
|
5938
|
-
const i = n.getStreams(
|
|
5939
|
+
const i = n.getStreams(Do)[0], a = this.getRecvRemoteContentedStream({ stateInfo: e });
|
|
5939
5940
|
return { mainStream: i, contentedStream: a };
|
|
5940
5941
|
} };
|
|
5941
5942
|
}
|
|
@@ -5944,21 +5945,21 @@ class wo {
|
|
|
5944
5945
|
}) {
|
|
5945
5946
|
if (!e.isAvailable || e.codec === void 0)
|
|
5946
5947
|
return;
|
|
5947
|
-
const n =
|
|
5948
|
+
const n = wo(e.codec);
|
|
5948
5949
|
return this.recvRemoteStreamsManager.getStreams(n)[0];
|
|
5949
5950
|
}
|
|
5950
5951
|
}
|
|
5951
|
-
const
|
|
5952
|
-
const s =
|
|
5952
|
+
const Fo = "udp", Uo = (t) => t.transport?.iceTransport ? t.transport.iceTransport.getLocalCandidates() : [], Bo = (t) => t.getReceivers().flatMap(Uo), $o = (t) => {
|
|
5953
|
+
const s = Bo(t).filter(({ protocol: r, port: i }) => i !== null && Fo === r).map(({ port: r }) => r);
|
|
5953
5954
|
return [...new Set(s)];
|
|
5954
|
-
},
|
|
5955
|
-
class
|
|
5955
|
+
}, St = (t) => t.streams[0]?.id;
|
|
5956
|
+
class xo extends w {
|
|
5956
5957
|
stateMachine;
|
|
5957
5958
|
sessionState;
|
|
5958
5959
|
isPendingCall = !1;
|
|
5959
5960
|
isPendingAnswer = !1;
|
|
5960
|
-
mainRemoteStreamsManager = new
|
|
5961
|
-
recvRemoteStreamsManager = new
|
|
5961
|
+
mainRemoteStreamsManager = new pt();
|
|
5962
|
+
recvRemoteStreamsManager = new pt();
|
|
5962
5963
|
streamsManagerProvider;
|
|
5963
5964
|
contentedStreamManager;
|
|
5964
5965
|
tools;
|
|
@@ -5973,12 +5974,12 @@ class Bo extends w {
|
|
|
5973
5974
|
disposeRecvSessionTrackListener;
|
|
5974
5975
|
disposeInRoomCredentialsListener;
|
|
5975
5976
|
deferredStartRecvSessionRunner;
|
|
5976
|
-
streamsChangeTracker = new
|
|
5977
|
+
streamsChangeTracker = new yo();
|
|
5977
5978
|
constructor({ contentedStreamManager: e }, n, { callSessionState: s }) {
|
|
5978
|
-
super(
|
|
5979
|
+
super(Ki()), this.contentedStreamManager = e, this.tools = n, this.mcuSession = new Ao(this.events), this.stateMachine = Ka(this.events), this.sessionState = s, this.sessionState.subscribeRoleChanges(this.onRoleChanged), this.streamsManagerProvider = new ko(
|
|
5979
5980
|
this.mainRemoteStreamsManager,
|
|
5980
5981
|
this.recvRemoteStreamsManager
|
|
5981
|
-
), this.deferredStartRecvSessionRunner = new
|
|
5982
|
+
), this.deferredStartRecvSessionRunner = new $a({
|
|
5982
5983
|
subscribe: (r) => this.stateMachine.onStateChange(r),
|
|
5983
5984
|
isReady: (r) => r === u.IN_ROOM,
|
|
5984
5985
|
isCancelled: (r) => r === u.IDLE,
|
|
@@ -6014,7 +6015,7 @@ class Bo extends w {
|
|
|
6014
6015
|
}
|
|
6015
6016
|
get localPorts() {
|
|
6016
6017
|
const e = this.getActivePeerConnection();
|
|
6017
|
-
return e ?
|
|
6018
|
+
return e ? $o(e) : [];
|
|
6018
6019
|
}
|
|
6019
6020
|
// For testing purposes
|
|
6020
6021
|
getStreamsManagerProvider() {
|
|
@@ -6096,7 +6097,7 @@ class Bo extends w {
|
|
|
6096
6097
|
const { recvSession: n } = this;
|
|
6097
6098
|
if (!this.hasSpectator() || !n)
|
|
6098
6099
|
return !1;
|
|
6099
|
-
const s = n.getQuality(), r = n.getEffectiveQuality(), i = n.getAudioChannel(), a =
|
|
6100
|
+
const s = n.getQuality(), r = n.getEffectiveQuality(), i = n.getAudioChannel(), a = qe(e);
|
|
6100
6101
|
if (e === s && a === r)
|
|
6101
6102
|
return !1;
|
|
6102
6103
|
if (a === r)
|
|
@@ -6158,7 +6159,7 @@ class Bo extends w {
|
|
|
6158
6159
|
}
|
|
6159
6160
|
subscribeMcuRemoteTrackEvents() {
|
|
6160
6161
|
this.on("peerconnection:ontrack", (e) => {
|
|
6161
|
-
this.addRemoteTrack(this.mainRemoteStreamsManager, e.track,
|
|
6162
|
+
this.addRemoteTrack(this.mainRemoteStreamsManager, e.track, St(e));
|
|
6162
6163
|
});
|
|
6163
6164
|
}
|
|
6164
6165
|
addRemoteTrack(e, n, s) {
|
|
@@ -6214,7 +6215,7 @@ class Bo extends w {
|
|
|
6214
6215
|
}
|
|
6215
6216
|
attachRecvSessionTracks(e) {
|
|
6216
6217
|
const { peerConnection: n } = e, s = (r) => {
|
|
6217
|
-
this.addRemoteTrack(this.recvRemoteStreamsManager, r.track,
|
|
6218
|
+
this.addRemoteTrack(this.recvRemoteStreamsManager, r.track, St(r));
|
|
6218
6219
|
};
|
|
6219
6220
|
n.addEventListener("track", s), this.disposeRecvSessionTrackListener = () => {
|
|
6220
6221
|
n.removeEventListener("track", s);
|
|
@@ -6238,7 +6239,7 @@ class Bo extends w {
|
|
|
6238
6239
|
audioChannel: e,
|
|
6239
6240
|
quality: n,
|
|
6240
6241
|
pcConfig: this.mcuSession.getPcConfig()
|
|
6241
|
-
}, a = new
|
|
6242
|
+
}, a = new Mo(i, { sendOffer: this.tools.sendOffer });
|
|
6242
6243
|
return this.recvSession = a, this.recvRemoteStreamsManager.reset(), this.attachRecvSessionTracks(a), a.call({
|
|
6243
6244
|
conferenceNumber: r.conferenceForToken,
|
|
6244
6245
|
token: r.token
|
|
@@ -6249,9 +6250,9 @@ class Bo extends w {
|
|
|
6249
6250
|
}
|
|
6250
6251
|
)), { session: a, callResult: c })).catch(async (c) => {
|
|
6251
6252
|
this.stopRecvSession();
|
|
6252
|
-
const g = new
|
|
6253
|
+
const g = new Ot();
|
|
6253
6254
|
g.body = c instanceof Error ? c.message : String(c);
|
|
6254
|
-
const C =
|
|
6255
|
+
const C = ee.causes.INTERNAL_ERROR;
|
|
6255
6256
|
throw await this.failed(g, C), c;
|
|
6256
6257
|
});
|
|
6257
6258
|
}
|
|
@@ -6263,14 +6264,14 @@ class Bo extends w {
|
|
|
6263
6264
|
previous: e,
|
|
6264
6265
|
next: n
|
|
6265
6266
|
}) => {
|
|
6266
|
-
if (
|
|
6267
|
+
if (sa(e, n) && (this.stopRecvSession(), this.deferredStartRecvSessionRunner.cancel(), this.emitEventChangedRemoteStreamsConnected()), ra(e, n)) {
|
|
6267
6268
|
const s = n.recvParams;
|
|
6268
6269
|
this.stateMachine.getInRoomCredentials() === void 0 ? this.deferredStartRecvSessionRunner.set({
|
|
6269
6270
|
audioId: s.audioId
|
|
6270
6271
|
}) : this.startRecvSession({ audioChannel: s.audioId }).catch(() => {
|
|
6271
6272
|
});
|
|
6272
6273
|
}
|
|
6273
|
-
|
|
6274
|
+
ia(e, n) && this.mcuSession.restoreBitrateForSenders(), aa(e, n) && this.mcuSession.setMinBitrateForSenders();
|
|
6274
6275
|
};
|
|
6275
6276
|
subscribeContentedStreamEvents() {
|
|
6276
6277
|
this.contentedStreamManager.on("available", this.emitEventChangedRemoteStreamsConnected), this.contentedStreamManager.on("not-available", this.emitEventChangedRemoteStreamsConnected);
|
|
@@ -6286,39 +6287,39 @@ class Bo extends w {
|
|
|
6286
6287
|
return this.mcuSession.renegotiate();
|
|
6287
6288
|
}
|
|
6288
6289
|
}
|
|
6289
|
-
const
|
|
6290
|
+
const hn = [
|
|
6290
6291
|
"presentation:start",
|
|
6291
6292
|
"presentation:started",
|
|
6292
6293
|
"presentation:end",
|
|
6293
6294
|
"presentation:ended",
|
|
6294
6295
|
"presentation:failed"
|
|
6295
|
-
],
|
|
6296
|
+
], qo = () => new k(hn);
|
|
6296
6297
|
var h = /* @__PURE__ */ ((t) => (t.IDLE = "presentation:idle", t.STARTING = "presentation:starting", t.ACTIVE = "presentation:active", t.STOPPING = "presentation:stopping", t.FAILED = "presentation:failed", t))(h || {}), p = /* @__PURE__ */ ((t) => (t.LOG_TRANSITION = "logTransition", t.LOG_STATE_CHANGE = "logStateChange", t.SET_ERROR = "setError", t.CLEAR_ERROR = "clearError", t))(p || {}), T = /* @__PURE__ */ ((t) => (t.SCREEN_STARTING = "SCREEN.STARTING", t.SCREEN_STARTED = "SCREEN.STARTED", t.SCREEN_ENDING = "SCREEN.ENDING", t.SCREEN_ENDED = "SCREEN.ENDED", t.SCREEN_FAILED = "SCREEN.FAILED", t.CALL_ENDED = "CALL.ENDED", t.CALL_FAILED = "CALL.FAILED", t.PRESENTATION_RESET = "PRESENTATION.RESET", t))(T || {});
|
|
6297
|
-
const
|
|
6298
|
+
const un = {
|
|
6298
6299
|
lastError: void 0
|
|
6299
|
-
},
|
|
6300
|
+
}, Ct = N("PresentationStateMachine"), Vo = (t) => t instanceof Error ? t : new Error(JSON.stringify(t)), Ho = () => te({
|
|
6300
6301
|
types: {
|
|
6301
|
-
context:
|
|
6302
|
+
context: un,
|
|
6302
6303
|
events: {}
|
|
6303
6304
|
},
|
|
6304
6305
|
actions: {
|
|
6305
6306
|
[p.LOG_TRANSITION]: (t, e) => {
|
|
6306
|
-
|
|
6307
|
+
Ct(`State transition: ${e.from} -> ${e.to} (${e.event})`);
|
|
6307
6308
|
},
|
|
6308
6309
|
[p.LOG_STATE_CHANGE]: (t, e) => {
|
|
6309
|
-
|
|
6310
|
+
Ct("PresentationStateMachine state changed", e.state);
|
|
6310
6311
|
},
|
|
6311
|
-
[p.SET_ERROR]:
|
|
6312
|
-
lastError:
|
|
6312
|
+
[p.SET_ERROR]: I(({ event: t }) => "error" in t && t.error !== void 0 ? {
|
|
6313
|
+
lastError: Vo(t.error)
|
|
6313
6314
|
} : { lastError: void 0 }),
|
|
6314
|
-
[p.CLEAR_ERROR]:
|
|
6315
|
+
[p.CLEAR_ERROR]: I(() => ({
|
|
6315
6316
|
lastError: void 0
|
|
6316
6317
|
}))
|
|
6317
6318
|
}
|
|
6318
|
-
}),
|
|
6319
|
+
}), Wo = () => Ho().createMachine({
|
|
6319
6320
|
id: "presentation",
|
|
6320
6321
|
initial: h.IDLE,
|
|
6321
|
-
context:
|
|
6322
|
+
context: un,
|
|
6322
6323
|
states: {
|
|
6323
6324
|
[h.IDLE]: {
|
|
6324
6325
|
entry: {
|
|
@@ -6607,10 +6608,10 @@ const dn = {
|
|
|
6607
6608
|
}
|
|
6608
6609
|
}
|
|
6609
6610
|
}
|
|
6610
|
-
}),
|
|
6611
|
-
class
|
|
6611
|
+
}), Qo = Wo(), Yo = N("PresentationStateMachine");
|
|
6612
|
+
class jo extends ne {
|
|
6612
6613
|
constructor(e) {
|
|
6613
|
-
super(
|
|
6614
|
+
super(Qo), this.subscribeCallEvents(e);
|
|
6614
6615
|
}
|
|
6615
6616
|
get isIdle() {
|
|
6616
6617
|
return this.hasState(h.IDLE);
|
|
@@ -6647,7 +6648,7 @@ class Qo extends te {
|
|
|
6647
6648
|
}
|
|
6648
6649
|
sendEvent(e) {
|
|
6649
6650
|
if (!this.actor.getSnapshot().can(e)) {
|
|
6650
|
-
|
|
6651
|
+
Yo(
|
|
6651
6652
|
`[PresentationStateMachine] Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`
|
|
6652
6653
|
);
|
|
6653
6654
|
return;
|
|
@@ -6686,14 +6687,14 @@ class Qo extends te {
|
|
|
6686
6687
|
);
|
|
6687
6688
|
}
|
|
6688
6689
|
}
|
|
6689
|
-
const
|
|
6690
|
+
const zo = 1, Jo = [
|
|
6690
6691
|
"presentation:start",
|
|
6691
6692
|
"presentation:started",
|
|
6692
6693
|
"presentation:end",
|
|
6693
6694
|
"presentation:ended",
|
|
6694
6695
|
"presentation:failed"
|
|
6695
|
-
],
|
|
6696
|
-
class
|
|
6696
|
+
], Ko = (t) => t instanceof Error ? t : new Error(String(t)), bl = (t) => wn(t);
|
|
6697
|
+
class Xo extends w {
|
|
6697
6698
|
stateMachine;
|
|
6698
6699
|
promisePendingStartPresentation;
|
|
6699
6700
|
promisePendingStopPresentation;
|
|
@@ -6705,7 +6706,7 @@ class Jo extends w {
|
|
|
6705
6706
|
callManager: e,
|
|
6706
6707
|
maxBitrate: n
|
|
6707
6708
|
}) {
|
|
6708
|
-
super(
|
|
6709
|
+
super(qo()), this.callManager = e, this.maxBitrate = n, this.stateMachine = new jo(this.callManager.events), this.subscribe();
|
|
6709
6710
|
}
|
|
6710
6711
|
get isPendingPresentation() {
|
|
6711
6712
|
return !!this.promisePendingStartPresentation || !!this.promisePendingStopPresentation;
|
|
@@ -6758,7 +6759,7 @@ class Jo extends w {
|
|
|
6758
6759
|
this.cancelableSendPresentationWithRepeatedCalls?.stopRepeatedCalls();
|
|
6759
6760
|
}
|
|
6760
6761
|
subscribe() {
|
|
6761
|
-
|
|
6762
|
+
Jo.forEach((e) => {
|
|
6762
6763
|
this.callManager.on(e, (n) => {
|
|
6763
6764
|
this.events.trigger(e, n);
|
|
6764
6765
|
});
|
|
@@ -6769,7 +6770,7 @@ class Jo extends w {
|
|
|
6769
6770
|
stream: s,
|
|
6770
6771
|
presentationOptions: r,
|
|
6771
6772
|
options: i = {
|
|
6772
|
-
callLimit:
|
|
6773
|
+
callLimit: zo
|
|
6773
6774
|
}
|
|
6774
6775
|
}) {
|
|
6775
6776
|
const a = async () => this.sendPresentation(
|
|
@@ -6778,7 +6779,7 @@ class Jo extends w {
|
|
|
6778
6779
|
s,
|
|
6779
6780
|
r
|
|
6780
6781
|
), o = () => !!this.streamPresentationCurrent;
|
|
6781
|
-
return this.cancelableSendPresentationWithRepeatedCalls =
|
|
6782
|
+
return this.cancelableSendPresentationWithRepeatedCalls = We({
|
|
6782
6783
|
targetFunction: a,
|
|
6783
6784
|
isComplete: o,
|
|
6784
6785
|
isRejectAsValid: !0,
|
|
@@ -6793,7 +6794,7 @@ class Jo extends w {
|
|
|
6793
6794
|
sendEncodings: o,
|
|
6794
6795
|
onAddedTransceiver: c
|
|
6795
6796
|
}) {
|
|
6796
|
-
const g =
|
|
6797
|
+
const g = Ae(s, { contentHint: i });
|
|
6797
6798
|
if (g === void 0)
|
|
6798
6799
|
throw new Error("No streamPresentationTarget");
|
|
6799
6800
|
this.streamPresentationCurrent = g;
|
|
@@ -6813,7 +6814,7 @@ class Jo extends w {
|
|
|
6813
6814
|
if (!e || !n || s === void 0)
|
|
6814
6815
|
return;
|
|
6815
6816
|
const r = e.getSenders();
|
|
6816
|
-
await
|
|
6817
|
+
await Ga(r, n, s);
|
|
6817
6818
|
};
|
|
6818
6819
|
getRtcSessionProtected = () => {
|
|
6819
6820
|
const e = this.callManager.getEstablishedRTCSession();
|
|
@@ -6834,17 +6835,17 @@ class Jo extends w {
|
|
|
6834
6835
|
delete this.streamPresentationCurrent;
|
|
6835
6836
|
}
|
|
6836
6837
|
notifyPresentationFailed(e) {
|
|
6837
|
-
this.events.trigger("presentation:failed",
|
|
6838
|
+
this.events.trigger("presentation:failed", Ko(e));
|
|
6838
6839
|
}
|
|
6839
6840
|
}
|
|
6840
|
-
const
|
|
6841
|
+
const Zo = N("ContentedStreamStateMachine"), ec = te({
|
|
6841
6842
|
types: {
|
|
6842
6843
|
context: {},
|
|
6843
6844
|
events: {}
|
|
6844
6845
|
},
|
|
6845
6846
|
actions: {
|
|
6846
|
-
setCodec:
|
|
6847
|
-
clearCodec:
|
|
6847
|
+
setCodec: I(({ event: t }) => "codec" in t ? { codec: t.codec } : {}),
|
|
6848
|
+
clearCodec: I({ codec: void 0 })
|
|
6848
6849
|
}
|
|
6849
6850
|
}).createMachine({
|
|
6850
6851
|
id: "contented-stream",
|
|
@@ -6878,9 +6879,9 @@ const Ko = I("ContentedStreamStateMachine"), Xo = ee({
|
|
|
6878
6879
|
}
|
|
6879
6880
|
}
|
|
6880
6881
|
});
|
|
6881
|
-
class
|
|
6882
|
+
class tc extends ne {
|
|
6882
6883
|
constructor() {
|
|
6883
|
-
super(
|
|
6884
|
+
super(ec);
|
|
6884
6885
|
}
|
|
6885
6886
|
get isAvailable() {
|
|
6886
6887
|
return this.state === "contented-stream:available";
|
|
@@ -6902,7 +6903,7 @@ class Zo extends te {
|
|
|
6902
6903
|
}
|
|
6903
6904
|
send(e) {
|
|
6904
6905
|
if (!this.actor.getSnapshot().can(e)) {
|
|
6905
|
-
|
|
6906
|
+
Zo(
|
|
6906
6907
|
`[ContentedStreamStateMachine] Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`
|
|
6907
6908
|
);
|
|
6908
6909
|
return;
|
|
@@ -6921,15 +6922,15 @@ class Zo extends te {
|
|
|
6921
6922
|
);
|
|
6922
6923
|
}
|
|
6923
6924
|
}
|
|
6924
|
-
const
|
|
6925
|
+
const nc = [
|
|
6925
6926
|
"available",
|
|
6926
6927
|
"not-available"
|
|
6927
6928
|
/* NOT_AVAILABLE */
|
|
6928
|
-
],
|
|
6929
|
-
class
|
|
6929
|
+
], sc = () => new k(nc);
|
|
6930
|
+
class rc extends w {
|
|
6930
6931
|
stateMachine;
|
|
6931
6932
|
constructor() {
|
|
6932
|
-
super(
|
|
6933
|
+
super(sc()), this.stateMachine = new tc(), this.proxyEvents();
|
|
6933
6934
|
}
|
|
6934
6935
|
get isAvailable() {
|
|
6935
6936
|
return this.stateMachine.isAvailable;
|
|
@@ -6953,33 +6954,33 @@ class nc extends w {
|
|
|
6953
6954
|
});
|
|
6954
6955
|
}
|
|
6955
6956
|
}
|
|
6956
|
-
const
|
|
6957
|
+
const gn = [
|
|
6957
6958
|
"ringing",
|
|
6958
6959
|
"declinedIncomingCall",
|
|
6959
6960
|
"terminatedIncomingCall",
|
|
6960
6961
|
"failedIncomingCall"
|
|
6961
|
-
],
|
|
6962
|
+
], ic = () => new k(gn);
|
|
6962
6963
|
var d = /* @__PURE__ */ ((t) => (t.IDLE = "incoming:idle", t.RINGING = "incoming:ringing", t.CONSUMED = "incoming:consumed", t.DECLINED = "incoming:declined", t.TERMINATED = "incoming:terminated", t.FAILED = "incoming:failed", t))(d || {}), S = /* @__PURE__ */ ((t) => (t.LOG_TRANSITION = "logTransition", t.LOG_STATE_CHANGE = "logStateChange", t.REMEMBER_INCOMING = "rememberIncoming", t.REMEMBER_REASON = "rememberReason", t.CLEAR_INCOMING = "clearIncoming", t))(S || {}), R = /* @__PURE__ */ ((t) => (t.RINGING = "INCOMING.RINGING", t.CONSUMED = "INCOMING.CONSUMED", t.DECLINED = "INCOMING.DECLINED", t.TERMINATED = "INCOMING.TERMINATED", t.FAILED = "INCOMING.FAILED", t.CLEAR = "INCOMING.CLEAR", t))(R || {});
|
|
6963
|
-
const
|
|
6964
|
+
const En = {
|
|
6964
6965
|
remoteCallerData: void 0,
|
|
6965
6966
|
lastReason: void 0
|
|
6966
|
-
},
|
|
6967
|
+
}, Rt = N("IncomingCallManager: createIncomingCallMachineSetup"), ac = () => te({
|
|
6967
6968
|
types: {
|
|
6968
|
-
context:
|
|
6969
|
+
context: En,
|
|
6969
6970
|
events: {}
|
|
6970
6971
|
},
|
|
6971
6972
|
actions: {
|
|
6972
6973
|
[S.LOG_TRANSITION]: (t, e) => {
|
|
6973
|
-
|
|
6974
|
+
Rt(`State transition: ${e.from} -> ${e.to} (${e.event})`);
|
|
6974
6975
|
},
|
|
6975
6976
|
[S.LOG_STATE_CHANGE]: (t, e) => {
|
|
6976
|
-
|
|
6977
|
+
Rt("IncomingCallStateMachine state changed", e.state);
|
|
6977
6978
|
},
|
|
6978
|
-
[S.REMEMBER_INCOMING]:
|
|
6979
|
+
[S.REMEMBER_INCOMING]: I(({ event: t }) => ({
|
|
6979
6980
|
remoteCallerData: t.data,
|
|
6980
6981
|
lastReason: void 0
|
|
6981
6982
|
})),
|
|
6982
|
-
[S.REMEMBER_REASON]:
|
|
6983
|
+
[S.REMEMBER_REASON]: I(({ event: t, context: e }) => t.type === R.CONSUMED ? {
|
|
6983
6984
|
remoteCallerData: e.remoteCallerData,
|
|
6984
6985
|
lastReason: d.CONSUMED
|
|
6985
6986
|
} : t.type === R.DECLINED ? {
|
|
@@ -6992,15 +6993,15 @@ const un = {
|
|
|
6992
6993
|
remoteCallerData: t.data,
|
|
6993
6994
|
lastReason: d.FAILED
|
|
6994
6995
|
}),
|
|
6995
|
-
[S.CLEAR_INCOMING]:
|
|
6996
|
+
[S.CLEAR_INCOMING]: I(() => ({
|
|
6996
6997
|
remoteCallerData: void 0,
|
|
6997
6998
|
lastReason: void 0
|
|
6998
6999
|
}))
|
|
6999
7000
|
}
|
|
7000
|
-
}),
|
|
7001
|
+
}), oc = () => ac().createMachine({
|
|
7001
7002
|
id: "incoming",
|
|
7002
7003
|
initial: d.IDLE,
|
|
7003
|
-
context:
|
|
7004
|
+
context: En,
|
|
7004
7005
|
states: {
|
|
7005
7006
|
[d.IDLE]: {
|
|
7006
7007
|
entry: {
|
|
@@ -7275,10 +7276,10 @@ const un = {
|
|
|
7275
7276
|
}
|
|
7276
7277
|
}
|
|
7277
7278
|
}
|
|
7278
|
-
}),
|
|
7279
|
-
class
|
|
7279
|
+
}), cc = oc(), lc = N("IncomingCallStateMachine");
|
|
7280
|
+
class dc extends ne {
|
|
7280
7281
|
constructor({ incomingEvents: e, connectionEvents: n }) {
|
|
7281
|
-
super(
|
|
7282
|
+
super(cc), this.subscribeIncomingEvents(e), this.subscribeConnectionEvents(n);
|
|
7282
7283
|
}
|
|
7283
7284
|
get isIdle() {
|
|
7284
7285
|
return this.hasState(d.IDLE);
|
|
@@ -7324,7 +7325,7 @@ class cc extends te {
|
|
|
7324
7325
|
}
|
|
7325
7326
|
sendEvent(e) {
|
|
7326
7327
|
if (!this.actor.getSnapshot().can(e)) {
|
|
7327
|
-
|
|
7328
|
+
lc(
|
|
7328
7329
|
`[IncomingCallStateMachine] Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`
|
|
7329
7330
|
);
|
|
7330
7331
|
return;
|
|
@@ -7397,25 +7398,25 @@ class cc extends te {
|
|
|
7397
7398
|
this.sendEvent({ type: R.CLEAR });
|
|
7398
7399
|
};
|
|
7399
7400
|
}
|
|
7400
|
-
const
|
|
7401
|
+
const hc = 486, uc = 487, ke = (t) => ({
|
|
7401
7402
|
displayName: t.remote_identity.display_name,
|
|
7402
7403
|
host: t.remote_identity.uri.host,
|
|
7403
7404
|
incomingNumber: t.remote_identity.uri.user,
|
|
7404
7405
|
rtcSession: t
|
|
7405
7406
|
});
|
|
7406
|
-
class
|
|
7407
|
+
class gc extends w {
|
|
7407
7408
|
stateMachine;
|
|
7408
7409
|
incomingRTCSession;
|
|
7409
7410
|
connectionManager;
|
|
7410
7411
|
constructor(e) {
|
|
7411
|
-
super(
|
|
7412
|
+
super(ic()), this.connectionManager = e, this.stateMachine = new dc({
|
|
7412
7413
|
incomingEvents: this.events,
|
|
7413
7414
|
connectionEvents: this.connectionManager.events
|
|
7414
7415
|
}), this.start();
|
|
7415
7416
|
}
|
|
7416
7417
|
get remoteCallerData() {
|
|
7417
7418
|
if (this.incomingRTCSession)
|
|
7418
|
-
return
|
|
7419
|
+
return ke(this.incomingRTCSession);
|
|
7419
7420
|
}
|
|
7420
7421
|
get isAvailableIncomingCall() {
|
|
7421
7422
|
return !!this.incomingRTCSession;
|
|
@@ -7437,11 +7438,11 @@ class hc extends w {
|
|
|
7437
7438
|
return this.stateMachine.toConsumed(), this.removeIncomingSession(), e;
|
|
7438
7439
|
};
|
|
7439
7440
|
async declineToIncomingCall({
|
|
7440
|
-
statusCode: e =
|
|
7441
|
+
statusCode: e = uc
|
|
7441
7442
|
} = {}) {
|
|
7442
7443
|
return new Promise((n, s) => {
|
|
7443
7444
|
try {
|
|
7444
|
-
const r = this.getIncomingRTCSession(), i =
|
|
7445
|
+
const r = this.getIncomingRTCSession(), i = ke(r);
|
|
7445
7446
|
this.removeIncomingSession(), this.events.trigger("declinedIncomingCall", i), r.terminate({ status_code: e }), n();
|
|
7446
7447
|
} catch (r) {
|
|
7447
7448
|
s(r);
|
|
@@ -7449,7 +7450,7 @@ class hc extends w {
|
|
|
7449
7450
|
});
|
|
7450
7451
|
}
|
|
7451
7452
|
async busyIncomingCall() {
|
|
7452
|
-
return this.declineToIncomingCall({ statusCode:
|
|
7453
|
+
return this.declineToIncomingCall({ statusCode: hc });
|
|
7453
7454
|
}
|
|
7454
7455
|
subscribe() {
|
|
7455
7456
|
this.connectionManager.on("newRTCSession", this.handleNewRTCSession);
|
|
@@ -7465,7 +7466,7 @@ class hc extends w {
|
|
|
7465
7466
|
};
|
|
7466
7467
|
setIncomingSession(e) {
|
|
7467
7468
|
this.incomingRTCSession = e;
|
|
7468
|
-
const n =
|
|
7469
|
+
const n = ke(e);
|
|
7469
7470
|
e.on("failed", (s) => {
|
|
7470
7471
|
this.removeIncomingSession(), s.originator === "local" ? this.events.trigger("terminatedIncomingCall", n) : this.events.trigger("failedIncomingCall", n);
|
|
7471
7472
|
}), this.events.trigger("ringing", n);
|
|
@@ -7474,7 +7475,7 @@ class hc extends w {
|
|
|
7474
7475
|
delete this.incomingRTCSession;
|
|
7475
7476
|
}
|
|
7476
7477
|
}
|
|
7477
|
-
class
|
|
7478
|
+
class Ec {
|
|
7478
7479
|
apiManager;
|
|
7479
7480
|
connectionManager;
|
|
7480
7481
|
callManager;
|
|
@@ -7510,10 +7511,10 @@ class uc {
|
|
|
7510
7511
|
s.sendEnterRoom(r);
|
|
7511
7512
|
};
|
|
7512
7513
|
}
|
|
7513
|
-
const
|
|
7514
|
-
|
|
7514
|
+
const mn = ["snapshot-changed"], mc = () => new k(mn), Tc = (t, e) => Object.is(t, e), Nt = (t, e) => t.connection.value === e.connection.value && // Call: full snapshot so room/context updates without a state `value` change still emit snapshot-changed
|
|
7515
|
+
Ke(t.call, e.call) && // Incoming: value only — repeated RINGING with different callee metadata must not emit again
|
|
7515
7516
|
t.incoming.value === e.incoming.value && t.presentation.value === e.presentation.value && t.autoConnector.value === e.autoConnector.value && // CallReconnect: full snapshot so attempt/delay context updates без смены `value` тоже эмитят событие
|
|
7516
|
-
|
|
7517
|
+
Ke(t.callReconnect, e.callReconnect), At = (t) => ({
|
|
7517
7518
|
connection: t.connection.getSnapshot(),
|
|
7518
7519
|
call: t.call.getSnapshot(),
|
|
7519
7520
|
incoming: t.incoming.getSnapshot(),
|
|
@@ -7521,20 +7522,20 @@ ze(t.callReconnect, e.callReconnect), Rt = (t) => ({
|
|
|
7521
7522
|
autoConnector: t.autoConnector.getSnapshot(),
|
|
7522
7523
|
callReconnect: t.callReconnect.getSnapshot()
|
|
7523
7524
|
});
|
|
7524
|
-
class
|
|
7525
|
+
class pc extends w {
|
|
7525
7526
|
machines;
|
|
7526
7527
|
currentSnapshot;
|
|
7527
7528
|
subscribers = /* @__PURE__ */ new Set();
|
|
7528
7529
|
actorSubscriptions = [];
|
|
7529
7530
|
constructor(e) {
|
|
7530
|
-
super(
|
|
7531
|
+
super(mc()), this.machines = {
|
|
7531
7532
|
connection: e.connectionManager.stateMachine,
|
|
7532
7533
|
call: e.callManager.stateMachine,
|
|
7533
7534
|
incoming: e.incomingCallManager.stateMachine,
|
|
7534
7535
|
presentation: e.presentationManager.stateMachine,
|
|
7535
7536
|
autoConnector: e.autoConnectorManager.stateMachine,
|
|
7536
7537
|
callReconnect: e.callReconnectManager.stateMachine
|
|
7537
|
-
}, this.currentSnapshot =
|
|
7538
|
+
}, this.currentSnapshot = At(this.machines), this.actorSubscriptions.push(
|
|
7538
7539
|
this.machines.connection.subscribe(this.notifySubscribers),
|
|
7539
7540
|
this.machines.call.subscribe(this.notifySubscribers),
|
|
7540
7541
|
this.machines.incoming.subscribe(this.notifySubscribers),
|
|
@@ -7547,7 +7548,7 @@ class mc extends w {
|
|
|
7547
7548
|
return this.currentSnapshot;
|
|
7548
7549
|
}
|
|
7549
7550
|
subscribe(e, n, s) {
|
|
7550
|
-
const r = typeof n == "function", i = r ? e : (f) => f, a = r ? n : e, c = r ? s ??
|
|
7551
|
+
const r = typeof n == "function", i = r ? e : (f) => f, a = r ? n : e, c = r ? s ?? Tc : Nt, g = i(this.currentSnapshot), C = {
|
|
7551
7552
|
selector: i,
|
|
7552
7553
|
listener: a,
|
|
7553
7554
|
equals: c,
|
|
@@ -7564,8 +7565,8 @@ class mc extends w {
|
|
|
7564
7565
|
}
|
|
7565
7566
|
notifySubscribers = () => {
|
|
7566
7567
|
const e = this.currentSnapshot;
|
|
7567
|
-
this.currentSnapshot =
|
|
7568
|
-
const n =
|
|
7568
|
+
this.currentSnapshot = At(this.machines);
|
|
7569
|
+
const n = Nt(e, this.currentSnapshot);
|
|
7569
7570
|
for (const s of this.subscribers) {
|
|
7570
7571
|
const r = s.selector(this.currentSnapshot);
|
|
7571
7572
|
s.equals(s.current, r) || (s.current = r, s.listener(r));
|
|
@@ -7576,12 +7577,12 @@ class mc extends w {
|
|
|
7576
7577
|
});
|
|
7577
7578
|
};
|
|
7578
7579
|
}
|
|
7579
|
-
const
|
|
7580
|
+
const ue = 1e3;
|
|
7580
7581
|
var D = /* @__PURE__ */ ((t) => (t.INBOUND_RTP = "inbound-rtp", t.REMOTE_OUTBOUND_RTP = "remote-outbound-rtp", t.MEDIA_SOURCE = "media-source", t.OUTBOUND_RTP = "outbound-rtp", t.REMOTE_INBOUND_RTP = "remote-inbound-rtp", t.CODEC = "codec", t.CANDIDATE_PAIR = "candidate-pair", t.CERTIFICATE = "certificate", t.TRANSPORT = "transport", t.LOCAL_CANDIDATE = "local-candidate", t.REMOTE_CANDIDATE = "remote-candidate", t))(D || {});
|
|
7581
|
-
const
|
|
7582
|
+
const Tn = ["collected", "stopped"], Sc = () => new k(Tn), It = () => "performance" in window ? performance.now() : Date.now(), Se = (t) => [...t.keys()].reduce((e, n) => {
|
|
7582
7583
|
const s = t.get(n);
|
|
7583
7584
|
return s === void 0 ? e : { ...e, [s.type]: s };
|
|
7584
|
-
}, {}),
|
|
7585
|
+
}, {}), Cc = (t) => {
|
|
7585
7586
|
if (!t)
|
|
7586
7587
|
return {
|
|
7587
7588
|
outboundRtp: void 0,
|
|
@@ -7589,14 +7590,14 @@ const En = ["collected", "stopped"], Tc = () => new k(En), Nt = () => "performan
|
|
|
7589
7590
|
mediaSource: void 0,
|
|
7590
7591
|
remoteInboundRtp: void 0
|
|
7591
7592
|
};
|
|
7592
|
-
const e =
|
|
7593
|
+
const e = Se(t);
|
|
7593
7594
|
return {
|
|
7594
7595
|
outboundRtp: e[D.OUTBOUND_RTP],
|
|
7595
7596
|
codec: e[D.CODEC],
|
|
7596
7597
|
mediaSource: e[D.MEDIA_SOURCE],
|
|
7597
7598
|
remoteInboundRtp: e[D.REMOTE_INBOUND_RTP]
|
|
7598
7599
|
};
|
|
7599
|
-
},
|
|
7600
|
+
}, ft = (t) => {
|
|
7600
7601
|
if (!t)
|
|
7601
7602
|
return {
|
|
7602
7603
|
outboundRtp: void 0,
|
|
@@ -7604,14 +7605,14 @@ const En = ["collected", "stopped"], Tc = () => new k(En), Nt = () => "performan
|
|
|
7604
7605
|
mediaSource: void 0,
|
|
7605
7606
|
remoteInboundRtp: void 0
|
|
7606
7607
|
};
|
|
7607
|
-
const e =
|
|
7608
|
+
const e = Se(t);
|
|
7608
7609
|
return {
|
|
7609
7610
|
outboundRtp: e[D.OUTBOUND_RTP],
|
|
7610
7611
|
codec: e[D.CODEC],
|
|
7611
7612
|
mediaSource: e[D.MEDIA_SOURCE],
|
|
7612
7613
|
remoteInboundRtp: e[D.REMOTE_INBOUND_RTP]
|
|
7613
7614
|
};
|
|
7614
|
-
},
|
|
7615
|
+
}, vt = ({
|
|
7615
7616
|
videoReceiversStats: t,
|
|
7616
7617
|
synchronizationSourcesVideo: e
|
|
7617
7618
|
}) => {
|
|
@@ -7621,13 +7622,13 @@ const En = ["collected", "stopped"], Tc = () => new k(En), Nt = () => "performan
|
|
|
7621
7622
|
codec: void 0,
|
|
7622
7623
|
synchronizationSources: e
|
|
7623
7624
|
};
|
|
7624
|
-
const n =
|
|
7625
|
+
const n = Se(t);
|
|
7625
7626
|
return {
|
|
7626
7627
|
inboundRtp: n[D.INBOUND_RTP],
|
|
7627
7628
|
codec: n[D.CODEC],
|
|
7628
7629
|
synchronizationSources: e
|
|
7629
7630
|
};
|
|
7630
|
-
},
|
|
7631
|
+
}, Rc = ({
|
|
7631
7632
|
audioReceiverStats: t,
|
|
7632
7633
|
synchronizationSourcesAudio: e
|
|
7633
7634
|
}) => {
|
|
@@ -7638,14 +7639,14 @@ const En = ["collected", "stopped"], Tc = () => new k(En), Nt = () => "performan
|
|
|
7638
7639
|
remoteOutboundRtp: void 0,
|
|
7639
7640
|
synchronizationSources: e
|
|
7640
7641
|
};
|
|
7641
|
-
const n =
|
|
7642
|
+
const n = Se(t);
|
|
7642
7643
|
return {
|
|
7643
7644
|
inboundRtp: n[D.INBOUND_RTP],
|
|
7644
7645
|
codec: n[D.CODEC],
|
|
7645
7646
|
remoteOutboundRtp: n[D.REMOTE_OUTBOUND_RTP],
|
|
7646
7647
|
synchronizationSources: e
|
|
7647
7648
|
};
|
|
7648
|
-
},
|
|
7649
|
+
}, pn = (t) => {
|
|
7649
7650
|
if (!t)
|
|
7650
7651
|
return {
|
|
7651
7652
|
candidatePair: void 0,
|
|
@@ -7654,7 +7655,7 @@ const En = ["collected", "stopped"], Tc = () => new k(En), Nt = () => "performan
|
|
|
7654
7655
|
remoteCandidate: void 0,
|
|
7655
7656
|
transport: void 0
|
|
7656
7657
|
};
|
|
7657
|
-
const e =
|
|
7658
|
+
const e = Se(t);
|
|
7658
7659
|
return {
|
|
7659
7660
|
candidatePair: e[D.CANDIDATE_PAIR],
|
|
7660
7661
|
certificate: e[D.CERTIFICATE],
|
|
@@ -7662,39 +7663,39 @@ const En = ["collected", "stopped"], Tc = () => new k(En), Nt = () => "performan
|
|
|
7662
7663
|
remoteCandidate: e[D.REMOTE_CANDIDATE],
|
|
7663
7664
|
transport: e[D.TRANSPORT]
|
|
7664
7665
|
};
|
|
7665
|
-
},
|
|
7666
|
+
}, Nc = ({
|
|
7666
7667
|
audioSenderStats: t,
|
|
7667
7668
|
videoSenderFirstStats: e,
|
|
7668
7669
|
videoSenderSecondStats: n
|
|
7669
7670
|
}) => ({
|
|
7670
|
-
video:
|
|
7671
|
-
secondVideo:
|
|
7672
|
-
audio:
|
|
7673
|
-
additional:
|
|
7671
|
+
video: ft(e),
|
|
7672
|
+
secondVideo: ft(n),
|
|
7673
|
+
audio: Cc(t),
|
|
7674
|
+
additional: pn(
|
|
7674
7675
|
t ?? e ?? n
|
|
7675
7676
|
)
|
|
7676
|
-
}),
|
|
7677
|
+
}), Ac = ({
|
|
7677
7678
|
audioReceiverStats: t,
|
|
7678
7679
|
videoReceiverFirstStats: e,
|
|
7679
7680
|
videoReceiverSecondStats: n,
|
|
7680
7681
|
synchronizationSources: s
|
|
7681
7682
|
}) => ({
|
|
7682
|
-
video:
|
|
7683
|
+
video: vt({
|
|
7683
7684
|
videoReceiversStats: e,
|
|
7684
7685
|
synchronizationSourcesVideo: s.video
|
|
7685
7686
|
}),
|
|
7686
|
-
secondVideo:
|
|
7687
|
+
secondVideo: vt({
|
|
7687
7688
|
videoReceiversStats: n,
|
|
7688
7689
|
synchronizationSourcesVideo: s.secondVideo ?? s.video
|
|
7689
7690
|
}),
|
|
7690
|
-
audio:
|
|
7691
|
+
audio: Rc({
|
|
7691
7692
|
audioReceiverStats: t,
|
|
7692
7693
|
synchronizationSourcesAudio: s.audio
|
|
7693
7694
|
}),
|
|
7694
|
-
additional:
|
|
7695
|
+
additional: pn(
|
|
7695
7696
|
t ?? e ?? n
|
|
7696
7697
|
)
|
|
7697
|
-
}),
|
|
7698
|
+
}), Ic = ({
|
|
7698
7699
|
audioSenderStats: t,
|
|
7699
7700
|
videoSenderFirstStats: e,
|
|
7700
7701
|
videoSenderSecondStats: n,
|
|
@@ -7703,11 +7704,11 @@ const En = ["collected", "stopped"], Tc = () => new k(En), Nt = () => "performan
|
|
|
7703
7704
|
videoReceiverSecondStats: i,
|
|
7704
7705
|
synchronizationSources: a
|
|
7705
7706
|
}) => {
|
|
7706
|
-
const o =
|
|
7707
|
+
const o = Nc({
|
|
7707
7708
|
audioSenderStats: t,
|
|
7708
7709
|
videoSenderFirstStats: e,
|
|
7709
7710
|
videoSenderSecondStats: n
|
|
7710
|
-
}), c =
|
|
7711
|
+
}), c = Ac({
|
|
7711
7712
|
audioReceiverStats: s,
|
|
7712
7713
|
videoReceiverFirstStats: r,
|
|
7713
7714
|
videoReceiverSecondStats: i,
|
|
@@ -7717,7 +7718,7 @@ const En = ["collected", "stopped"], Tc = () => new k(En), Nt = () => "performan
|
|
|
7717
7718
|
outbound: o,
|
|
7718
7719
|
inbound: c
|
|
7719
7720
|
};
|
|
7720
|
-
},
|
|
7721
|
+
}, fc = async (t) => {
|
|
7721
7722
|
const e = "audio", n = "video", s = t.getSenders(), r = s.find((_) => _.track?.kind === e), i = s.filter((_) => _.track?.kind === n), a = t.getReceivers(), o = a.find((_) => _.track.kind === e), c = a.filter((_) => _.track.kind === n), g = {
|
|
7722
7723
|
trackIdentifier: o?.track.id,
|
|
7723
7724
|
item: o?.getSynchronizationSources()[0]
|
|
@@ -7743,34 +7744,34 @@ const En = ["collected", "stopped"], Tc = () => new k(En), Nt = () => "performan
|
|
|
7743
7744
|
const [
|
|
7744
7745
|
q,
|
|
7745
7746
|
B,
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7747
|
+
Z,
|
|
7748
|
+
se,
|
|
7749
|
+
_e,
|
|
7750
|
+
Je
|
|
7750
7751
|
] = _;
|
|
7751
7752
|
return {
|
|
7752
7753
|
synchronizationSources: y,
|
|
7753
7754
|
audioSenderStats: q,
|
|
7754
7755
|
videoSenderFirstStats: B,
|
|
7755
|
-
videoSenderSecondStats:
|
|
7756
|
-
audioReceiverStats:
|
|
7757
|
-
videoReceiverFirstStats:
|
|
7758
|
-
videoReceiverSecondStats:
|
|
7756
|
+
videoSenderSecondStats: Z,
|
|
7757
|
+
audioReceiverStats: se,
|
|
7758
|
+
videoReceiverFirstStats: _e,
|
|
7759
|
+
videoReceiverSecondStats: Je
|
|
7759
7760
|
};
|
|
7760
7761
|
});
|
|
7761
|
-
},
|
|
7762
|
-
class
|
|
7762
|
+
}, vc = N("StatsPeerConnection");
|
|
7763
|
+
class Mc extends w {
|
|
7763
7764
|
setTimeoutRequest;
|
|
7764
|
-
requesterAllStatistics = new
|
|
7765
|
+
requesterAllStatistics = new pe(fc);
|
|
7765
7766
|
constructor() {
|
|
7766
|
-
super(
|
|
7767
|
+
super(Sc()), this.setTimeoutRequest = new Dt();
|
|
7767
7768
|
}
|
|
7768
7769
|
get requested() {
|
|
7769
7770
|
return this.setTimeoutRequest.requested;
|
|
7770
7771
|
}
|
|
7771
7772
|
start(e, {
|
|
7772
|
-
interval: n =
|
|
7773
|
-
onError: s =
|
|
7773
|
+
interval: n = ue,
|
|
7774
|
+
onError: s = vc
|
|
7774
7775
|
} = {}) {
|
|
7775
7776
|
this.setTimeoutRequest.request(() => {
|
|
7776
7777
|
this.collectStatistics(e, {
|
|
@@ -7793,12 +7794,12 @@ class fc extends w {
|
|
|
7793
7794
|
onError: n,
|
|
7794
7795
|
onSuccess: s
|
|
7795
7796
|
}) => {
|
|
7796
|
-
const r =
|
|
7797
|
+
const r = It();
|
|
7797
7798
|
this.requestAllStatistics(e).then((i) => {
|
|
7798
|
-
this.events.trigger("collected",
|
|
7799
|
-
const o =
|
|
7800
|
-
let c =
|
|
7801
|
-
o > 48 ? c =
|
|
7799
|
+
this.events.trigger("collected", Ic(i));
|
|
7800
|
+
const o = It() - r;
|
|
7801
|
+
let c = ue;
|
|
7802
|
+
o > 48 ? c = ue * 4 : o > 32 ? c = ue * 3 : o > 16 && (c = ue * 2), s({ interval: c });
|
|
7802
7803
|
}).catch((i) => {
|
|
7803
7804
|
n && n(i);
|
|
7804
7805
|
});
|
|
@@ -7810,8 +7811,8 @@ class fc extends w {
|
|
|
7810
7811
|
return this.requesterAllStatistics.request(n);
|
|
7811
7812
|
};
|
|
7812
7813
|
}
|
|
7813
|
-
const
|
|
7814
|
-
class
|
|
7814
|
+
const Oc = 500, _c = N("StatsManager");
|
|
7815
|
+
class bc extends w {
|
|
7815
7816
|
statsPeerConnection;
|
|
7816
7817
|
availableStats;
|
|
7817
7818
|
previousAvailableStats;
|
|
@@ -7821,7 +7822,7 @@ class Oc extends w {
|
|
|
7821
7822
|
callManager: e,
|
|
7822
7823
|
apiManager: n
|
|
7823
7824
|
}) {
|
|
7824
|
-
const s = new
|
|
7825
|
+
const s = new Mc();
|
|
7825
7826
|
super(s.events), this.statsPeerConnection = s, this.callManager = e, this.apiManager = n, this.subscribe();
|
|
7826
7827
|
}
|
|
7827
7828
|
get availableIncomingBitrate() {
|
|
@@ -7884,7 +7885,7 @@ class Oc extends w {
|
|
|
7884
7885
|
return this.previousInboundRtp?.bytesReceived;
|
|
7885
7886
|
}
|
|
7886
7887
|
get isReceivingPackets() {
|
|
7887
|
-
const e = this.packetsReceived !== void 0 && this.packetsReceived >=
|
|
7888
|
+
const e = this.packetsReceived !== void 0 && this.packetsReceived >= Oc, n = this.packetsReceived !== this.previousPacketsReceived;
|
|
7888
7889
|
return e && n;
|
|
7889
7890
|
}
|
|
7890
7891
|
hasAvailableIncomingBitrateChangedQuarter() {
|
|
@@ -7920,42 +7921,42 @@ class Oc extends w {
|
|
|
7920
7921
|
};
|
|
7921
7922
|
maybeSendStats() {
|
|
7922
7923
|
this.availableIncomingBitrate !== void 0 && this.hasAvailableIncomingBitrateChangedQuarter() && this.apiManager.sendStats({ availableIncomingBitrate: this.availableIncomingBitrate }).catch((e) => {
|
|
7923
|
-
|
|
7924
|
+
_c("Failed to send stats", e);
|
|
7924
7925
|
});
|
|
7925
7926
|
}
|
|
7926
7927
|
}
|
|
7927
|
-
const
|
|
7928
|
+
const yc = N("setCodecPreferences"), Dc = (t, e) => t.filter((s) => e.some((r) => r.clockRate === s.clockRate && r.mimeType === s.mimeType && r.channels === s.channels && r.sdpFmtpLine === s.sdpFmtpLine)), Pc = (t) => {
|
|
7928
7929
|
const e = RTCRtpSender.getCapabilities(t), n = RTCRtpReceiver.getCapabilities(t), s = e === null ? [] : e.codecs, r = n === null ? [] : n.codecs;
|
|
7929
|
-
return
|
|
7930
|
-
},
|
|
7930
|
+
return Dc(s, r);
|
|
7931
|
+
}, Lc = (t, e) => e === void 0 || e.length === 0 ? t : t.sort((n, s) => {
|
|
7931
7932
|
const r = e.indexOf(n.mimeType), i = e.indexOf(s.mimeType), a = r === -1 ? Number.MAX_VALUE : r, o = i === -1 ? Number.MAX_VALUE : i;
|
|
7932
7933
|
return a - o;
|
|
7933
|
-
}),
|
|
7934
|
+
}), wc = (t, e) => e === void 0 || e.length === 0 ? t : t.filter((n) => !e.includes(n.mimeType)), Gc = (t, {
|
|
7934
7935
|
preferredMimeTypesVideoCodecs: e,
|
|
7935
7936
|
excludeMimeTypesVideoCodecs: n
|
|
7936
7937
|
}) => {
|
|
7937
7938
|
try {
|
|
7938
7939
|
if (typeof t.setCodecPreferences == "function" && t.sender.track?.kind === "video" && (e !== void 0 && e.length > 0 || n !== void 0 && n.length > 0)) {
|
|
7939
|
-
const s =
|
|
7940
|
+
const s = Pc("video"), r = wc(s, n), i = Lc(r, e);
|
|
7940
7941
|
t.setCodecPreferences(i);
|
|
7941
7942
|
}
|
|
7942
7943
|
} catch (s) {
|
|
7943
|
-
|
|
7944
|
+
yc("setCodecPreferences error", s);
|
|
7944
7945
|
}
|
|
7945
|
-
},
|
|
7946
|
+
}, Sn = [
|
|
7946
7947
|
"balancing-scheduled",
|
|
7947
7948
|
"balancing-started",
|
|
7948
7949
|
"balancing-stopped",
|
|
7949
7950
|
"parameters-updated"
|
|
7950
|
-
],
|
|
7951
|
-
class
|
|
7951
|
+
], kc = () => new k(Sn), Fc = N("VideoSendingBalancerManager");
|
|
7952
|
+
class Uc extends w {
|
|
7952
7953
|
isBalancingActive = !1;
|
|
7953
7954
|
callManager;
|
|
7954
7955
|
balancingStartDelay;
|
|
7955
7956
|
videoSendingBalancer;
|
|
7956
7957
|
startBalancingTimer;
|
|
7957
7958
|
constructor(e, n, s = {}) {
|
|
7958
|
-
super(
|
|
7959
|
+
super(kc()), this.callManager = e, this.balancingStartDelay = s.balancingStartDelay ?? 1e4, this.videoSendingBalancer = new To(
|
|
7959
7960
|
n,
|
|
7960
7961
|
() => e.connection,
|
|
7961
7962
|
{
|
|
@@ -8011,7 +8012,7 @@ class kc extends w {
|
|
|
8011
8012
|
scheduleBalancingStart() {
|
|
8012
8013
|
this.clearStartTimer(), this.startBalancingTimer = setTimeout(() => {
|
|
8013
8014
|
this.startBalancingTimer = void 0, this.startBalancing().catch((e) => {
|
|
8014
|
-
|
|
8015
|
+
Fc("startBalancing: error", e);
|
|
8015
8016
|
});
|
|
8016
8017
|
}, this.balancingStartDelay), this.events.trigger("balancing-scheduled", { delay: this.balancingStartDelay });
|
|
8017
8018
|
}
|
|
@@ -8019,21 +8020,21 @@ class kc extends w {
|
|
|
8019
8020
|
this.startBalancingTimer && (clearTimeout(this.startBalancingTimer), this.startBalancingTimer = void 0);
|
|
8020
8021
|
}
|
|
8021
8022
|
}
|
|
8022
|
-
const
|
|
8023
|
-
pn,
|
|
8024
|
-
Sn,
|
|
8023
|
+
const Cn = "health-snapshot", Rn = "inbound-video-problem-detected", Nn = "inbound-video-problem-resolved", An = "inbound-video-problem-reset", In = [
|
|
8025
8024
|
Cn,
|
|
8026
|
-
Rn
|
|
8027
|
-
|
|
8028
|
-
|
|
8025
|
+
Rn,
|
|
8026
|
+
Nn,
|
|
8027
|
+
An
|
|
8028
|
+
], Bc = () => new k(In), $c = 3;
|
|
8029
|
+
class me extends w {
|
|
8029
8030
|
statsManager;
|
|
8030
8031
|
callManager;
|
|
8031
8032
|
minConsecutiveProblemSamplesCount;
|
|
8032
8033
|
consecutiveProblemSamplesCount = 0;
|
|
8033
8034
|
currentProblemReason;
|
|
8034
8035
|
hasEmittedCurrentProblem = !1;
|
|
8035
|
-
constructor(e, n, s =
|
|
8036
|
-
super(
|
|
8036
|
+
constructor(e, n, s = $c) {
|
|
8037
|
+
super(Bc()), this.statsManager = e, this.callManager = n, me.assertValidMinConsecutiveProblemSamplesCount(
|
|
8037
8038
|
s
|
|
8038
8039
|
), this.minConsecutiveProblemSamplesCount = s, this.subscribe();
|
|
8039
8040
|
}
|
|
@@ -8074,19 +8075,19 @@ class ge extends w {
|
|
|
8074
8075
|
throw new Error("minConsecutiveProblemSamplesCount should be a positive integer");
|
|
8075
8076
|
}
|
|
8076
8077
|
setMinConsecutiveProblemSamplesCount(e) {
|
|
8077
|
-
|
|
8078
|
+
me.assertValidMinConsecutiveProblemSamplesCount(
|
|
8078
8079
|
e
|
|
8079
8080
|
), this.minConsecutiveProblemSamplesCount = e, this.resetProblemDetectionState();
|
|
8080
8081
|
}
|
|
8081
8082
|
handleStatsCollected = () => {
|
|
8082
8083
|
const { healthSnapshot: e } = this;
|
|
8083
|
-
this.events.trigger(
|
|
8084
|
-
const n =
|
|
8084
|
+
this.events.trigger(Cn, e);
|
|
8085
|
+
const n = me.resolveProblemReason(e);
|
|
8085
8086
|
if (n === void 0) {
|
|
8086
8087
|
this.maybeEmitResolvedProblem(e), this.resetProblemDetectionState();
|
|
8087
8088
|
return;
|
|
8088
8089
|
}
|
|
8089
|
-
this.updateProblemDetectionState(n), this.consecutiveProblemSamplesCount >= this.minConsecutiveProblemSamplesCount && !this.hasEmittedCurrentProblem && (this.events.trigger(
|
|
8090
|
+
this.updateProblemDetectionState(n), this.consecutiveProblemSamplesCount >= this.minConsecutiveProblemSamplesCount && !this.hasEmittedCurrentProblem && (this.events.trigger(Rn, {
|
|
8090
8091
|
...e,
|
|
8091
8092
|
consecutiveProblemSamplesCount: this.consecutiveProblemSamplesCount,
|
|
8092
8093
|
reason: n
|
|
@@ -8106,7 +8107,7 @@ class ge extends w {
|
|
|
8106
8107
|
this.currentProblemReason = e, this.consecutiveProblemSamplesCount = 1, this.hasEmittedCurrentProblem = !1;
|
|
8107
8108
|
};
|
|
8108
8109
|
maybeEmitResolvedProblem = (e) => {
|
|
8109
|
-
!this.hasEmittedCurrentProblem || this.currentProblemReason === void 0 || this.events.trigger(
|
|
8110
|
+
!this.hasEmittedCurrentProblem || this.currentProblemReason === void 0 || this.events.trigger(Nn, {
|
|
8110
8111
|
...e,
|
|
8111
8112
|
reason: this.currentProblemReason
|
|
8112
8113
|
});
|
|
@@ -8115,7 +8116,7 @@ class ge extends w {
|
|
|
8115
8116
|
this.maybeEmitResetProblem(e), this.resetProblemDetectionState();
|
|
8116
8117
|
};
|
|
8117
8118
|
maybeEmitResetProblem = (e) => {
|
|
8118
|
-
!this.hasEmittedCurrentProblem || this.currentProblemReason === void 0 || this.events.trigger(
|
|
8119
|
+
!this.hasEmittedCurrentProblem || this.currentProblemReason === void 0 || this.events.trigger(An, {
|
|
8119
8120
|
reason: this.currentProblemReason,
|
|
8120
8121
|
resetCause: e
|
|
8121
8122
|
});
|
|
@@ -8124,39 +8125,39 @@ class ge extends w {
|
|
|
8124
8125
|
this.currentProblemReason = void 0, this.consecutiveProblemSamplesCount = 0, this.hasEmittedCurrentProblem = !1;
|
|
8125
8126
|
};
|
|
8126
8127
|
}
|
|
8127
|
-
const
|
|
8128
|
-
class
|
|
8128
|
+
const ie = N("MainStreamRecovery"), xc = 4e3;
|
|
8129
|
+
class Oe {
|
|
8129
8130
|
renegotiateRequester;
|
|
8130
8131
|
renegotiateThrottled;
|
|
8131
8132
|
callManager;
|
|
8132
|
-
constructor(e, n =
|
|
8133
|
-
this.callManager = e, this.renegotiateRequester = new
|
|
8133
|
+
constructor(e, n = xc) {
|
|
8134
|
+
this.callManager = e, this.renegotiateRequester = new pe(e.renegotiate.bind(e)), this.renegotiateThrottled = this.createRenegotiateThrottled(n), this.subscribe();
|
|
8134
8135
|
}
|
|
8135
8136
|
static assertValidThrottleRecoveryTimeout(e) {
|
|
8136
8137
|
if (!Number.isInteger(e) || e < 1)
|
|
8137
8138
|
throw new Error("throttleRecoveryTimeout should be a positive integer");
|
|
8138
8139
|
}
|
|
8139
8140
|
setThrottleRecoveryTimeout(e) {
|
|
8140
|
-
|
|
8141
|
+
Oe.assertValidThrottleRecoveryTimeout(e), this.renegotiateThrottled.cancel(), this.renegotiateThrottled = this.createRenegotiateThrottled(e);
|
|
8141
8142
|
}
|
|
8142
8143
|
// Запускает recovery: фактически вызывает throttled-версию requestRenegotiate.
|
|
8143
8144
|
recover() {
|
|
8144
|
-
|
|
8145
|
+
ie("trying to recover main stream"), this.renegotiateThrottled();
|
|
8145
8146
|
}
|
|
8146
8147
|
// Выполняет renegotiate main media stream (если только он еще не выполняется).
|
|
8147
8148
|
requestRenegotiate = () => {
|
|
8148
|
-
if (
|
|
8149
|
-
|
|
8149
|
+
if (ie("trying to renegotiate"), this.renegotiateRequester.requested) {
|
|
8150
|
+
ie("previous renegotiate is not finished yet");
|
|
8150
8151
|
return;
|
|
8151
8152
|
}
|
|
8152
8153
|
this.renegotiateRequester.request().then(() => {
|
|
8153
|
-
|
|
8154
|
+
ie("renegotiate has successful");
|
|
8154
8155
|
}).catch((e) => {
|
|
8155
|
-
|
|
8156
|
+
ie("failed to renegotiate main media stream", e);
|
|
8156
8157
|
});
|
|
8157
8158
|
};
|
|
8158
8159
|
createRenegotiateThrottled(e) {
|
|
8159
|
-
return
|
|
8160
|
+
return Oe.assertValidThrottleRecoveryTimeout(e), kn.throttle(this.requestRenegotiate.bind(this), e);
|
|
8160
8161
|
}
|
|
8161
8162
|
// На завершение вызова: отменяем throttling и (если есть) in-flight renegotiate.
|
|
8162
8163
|
subscribe() {
|
|
@@ -8166,41 +8167,39 @@ class ve {
|
|
|
8166
8167
|
}
|
|
8167
8168
|
// Останавливает дальнейшие попытки recovery.
|
|
8168
8169
|
cancel() {
|
|
8169
|
-
|
|
8170
|
+
ie("cancel recover main stream"), this.renegotiateThrottled.cancel(), this.renegotiateRequester.cancelRequest();
|
|
8170
8171
|
}
|
|
8171
8172
|
}
|
|
8172
|
-
var
|
|
8173
|
-
const
|
|
8173
|
+
var fn = /* @__PURE__ */ ((t) => (t.VP8 = "video/VP8", t.VP9 = "video/VP9", t.H264 = "video/H264", t.AV1 = "video/AV1", t.rtx = "video/rtx", t.red = "video/red", t.flexfec03 = "video/flexfec-03", t))(fn || {});
|
|
8174
|
+
const qc = {
|
|
8174
8175
|
major: 25,
|
|
8175
8176
|
minor: 8,
|
|
8176
8177
|
patch: 0
|
|
8177
|
-
},
|
|
8178
|
+
}, Vc = ({
|
|
8178
8179
|
isYandexBrowser: t,
|
|
8179
8180
|
hasGreaterThanBrowserVersion: e
|
|
8180
8181
|
}) => {
|
|
8181
8182
|
const n = e(
|
|
8182
|
-
|
|
8183
|
+
qc
|
|
8183
8184
|
);
|
|
8184
8185
|
return t && n;
|
|
8185
|
-
},
|
|
8186
|
-
const t =
|
|
8187
|
-
if (
|
|
8188
|
-
return [
|
|
8189
|
-
},
|
|
8190
|
-
const { isMobileDevice: t, isSafari: e, isOpera: n, isWindows: s } =
|
|
8186
|
+
}, Hc = () => {
|
|
8187
|
+
const t = Yt();
|
|
8188
|
+
if (Vc(t))
|
|
8189
|
+
return [fn.VP8];
|
|
8190
|
+
}, Wc = () => {
|
|
8191
|
+
const { isMobileDevice: t, isSafari: e, isOpera: n, isWindows: s } = Yt();
|
|
8191
8192
|
return t || e || n && s;
|
|
8192
8193
|
};
|
|
8193
|
-
let
|
|
8194
|
-
|
|
8195
|
-
const
|
|
8196
|
-
ignoreForCodec:
|
|
8197
|
-
},
|
|
8194
|
+
let vn;
|
|
8195
|
+
Wc() && (vn = "h264");
|
|
8196
|
+
const Qc = {
|
|
8197
|
+
ignoreForCodec: vn
|
|
8198
|
+
}, Yc = Hc(), jc = 1e6, zc = xt.map((t) => `auto-connect:${t}`), Jc = qt.map((t) => `call-reconnect:${t}`), Kc = $t.map((t) => `connection:${t}`), Xc = Qt.map((t) => `call:${t}`), Zc = kt.map((t) => `api:${t}`), el = gn.map((t) => `incoming-call:${t}`), tl = hn.map((t) => `presentation:${t}`), nl = Tn.map((t) => `stats:${t}`), sl = Sn.map((t) => `video-balancer:${t}`), rl = In.map((t) => `main-stream-health:${t}`), il = mn.map((t) => `session:${t}`), al = [
|
|
8198
8199
|
"disconnected-from-out-of-call",
|
|
8199
8200
|
"connected-with-configuration-from-out-of-call",
|
|
8200
8201
|
"stopped-presentation-by-server-command"
|
|
8201
|
-
],
|
|
8202
|
-
...Yc,
|
|
8203
|
-
...jc,
|
|
8202
|
+
], ol = [
|
|
8204
8203
|
...zc,
|
|
8205
8204
|
...Jc,
|
|
8206
8205
|
...Kc,
|
|
@@ -8210,9 +8209,11 @@ const Hc = {
|
|
|
8210
8209
|
...tl,
|
|
8211
8210
|
...nl,
|
|
8212
8211
|
...sl,
|
|
8213
|
-
...rl
|
|
8214
|
-
|
|
8215
|
-
|
|
8212
|
+
...rl,
|
|
8213
|
+
...il,
|
|
8214
|
+
...al
|
|
8215
|
+
], cl = () => new k(ol), Mt = N("SipConnector");
|
|
8216
|
+
class yl extends w {
|
|
8216
8217
|
connectionManager;
|
|
8217
8218
|
connectionQueueManager;
|
|
8218
8219
|
contentedStreamManager;
|
|
@@ -8241,40 +8242,40 @@ class _l extends w {
|
|
|
8241
8242
|
minConsecutiveProblemSamplesCount: c,
|
|
8242
8243
|
throttleRecoveryTimeout: g
|
|
8243
8244
|
} = {}) {
|
|
8244
|
-
super(
|
|
8245
|
+
super(cl()), this.preferredMimeTypesVideoCodecs = n ?? Yc, this.excludeMimeTypesVideoCodecs = s, this.apiManager = new zn(), this.connectionManager = new Ps({ JsSIP: e }, { numberOfConnectionAttempts: o }), this.connectionQueueManager = new Ls({
|
|
8245
8246
|
connectionManager: this.connectionManager
|
|
8246
|
-
}), this.contentedStreamManager = new
|
|
8247
|
+
}), this.contentedStreamManager = new rc(), this.callSessionState = new ua(), this.callManager = new xo(
|
|
8247
8248
|
{ contentedStreamManager: this.contentedStreamManager },
|
|
8248
8249
|
{ sendOffer: this.sendOffer },
|
|
8249
8250
|
{ callSessionState: this.callSessionState }
|
|
8250
|
-
), this.incomingCallManager = new
|
|
8251
|
+
), this.incomingCallManager = new gc(this.connectionManager), this.presentationManager = new Xo({
|
|
8251
8252
|
callManager: this.callManager,
|
|
8252
|
-
maxBitrate:
|
|
8253
|
-
}), this.statsManager = new
|
|
8253
|
+
maxBitrate: jc
|
|
8254
|
+
}), this.statsManager = new bc({
|
|
8254
8255
|
callManager: this.callManager,
|
|
8255
8256
|
apiManager: this.apiManager
|
|
8256
|
-
}), this.autoConnectorManager = new
|
|
8257
|
+
}), this.autoConnectorManager = new ir(
|
|
8257
8258
|
{
|
|
8258
8259
|
connectionQueueManager: this.connectionQueueManager,
|
|
8259
8260
|
connectionManager: this.connectionManager,
|
|
8260
8261
|
callManager: this.callManager
|
|
8261
8262
|
},
|
|
8262
8263
|
i
|
|
8263
|
-
), this.callReconnectManager = new
|
|
8264
|
+
), this.callReconnectManager = new Or(
|
|
8264
8265
|
{
|
|
8265
8266
|
callManager: this.callManager,
|
|
8266
8267
|
connectionManager: this.connectionManager
|
|
8267
8268
|
},
|
|
8268
8269
|
a
|
|
8269
|
-
), this.videoSendingBalancerManager = new
|
|
8270
|
+
), this.videoSendingBalancerManager = new Uc(
|
|
8270
8271
|
this.callManager,
|
|
8271
8272
|
this.apiManager,
|
|
8272
|
-
r ??
|
|
8273
|
-
), this.mainStreamHealthMonitor = new
|
|
8273
|
+
r ?? Qc
|
|
8274
|
+
), this.mainStreamHealthMonitor = new me(
|
|
8274
8275
|
this.statsManager,
|
|
8275
8276
|
this.callManager,
|
|
8276
8277
|
c
|
|
8277
|
-
), this.mainStreamRecovery = new
|
|
8278
|
+
), this.mainStreamRecovery = new Oe(this.callManager, g), this.sessionManager = new pc({
|
|
8278
8279
|
connectionManager: this.connectionManager,
|
|
8279
8280
|
callManager: this.callManager,
|
|
8280
8281
|
incomingCallManager: this.incomingCallManager,
|
|
@@ -8284,7 +8285,7 @@ class _l extends w {
|
|
|
8284
8285
|
}), this.callManager.subscribeToApiEvents(this.apiManager), this.contentedStreamManager.subscribeToApiEvents(this.apiManager), this.apiManager.subscribe({
|
|
8285
8286
|
connectionManager: this.connectionManager,
|
|
8286
8287
|
callManager: this.callManager
|
|
8287
|
-
}), this.peerToPeerManager = new
|
|
8288
|
+
}), this.peerToPeerManager = new Ec(), this.peerToPeerManager.subscribe({
|
|
8288
8289
|
connectionManager: this.connectionManager,
|
|
8289
8290
|
callManager: this.callManager,
|
|
8290
8291
|
apiManager: this.apiManager
|
|
@@ -8490,11 +8491,11 @@ class _l extends w {
|
|
|
8490
8491
|
), this.apiManager.on("presentation:must-stop", () => {
|
|
8491
8492
|
this.mayBeStopPresentationAndNotify();
|
|
8492
8493
|
}), this.apiManager.on("failed-send-room-direct-p2p", ({ error: e }) => {
|
|
8493
|
-
const n = new
|
|
8494
|
+
const n = new Ot();
|
|
8494
8495
|
n.body = e instanceof Error ? e.message : String(e);
|
|
8495
|
-
const s =
|
|
8496
|
+
const s = ee.causes.INTERNAL_ERROR;
|
|
8496
8497
|
this.callManager.failed(n, s).catch((r) => {
|
|
8497
|
-
|
|
8498
|
+
Mt("Failed to end call after failed:", r);
|
|
8498
8499
|
});
|
|
8499
8500
|
});
|
|
8500
8501
|
}
|
|
@@ -8502,7 +8503,7 @@ class _l extends w {
|
|
|
8502
8503
|
const r = this.connectionManager.getConnectionConfiguration()?.sipServerUrl;
|
|
8503
8504
|
if (r === void 0)
|
|
8504
8505
|
throw new Error("No sipServerUrl for sendOffer");
|
|
8505
|
-
return
|
|
8506
|
+
return Ia({
|
|
8506
8507
|
serverUrl: r,
|
|
8507
8508
|
offer: n,
|
|
8508
8509
|
token: e.token,
|
|
@@ -8512,7 +8513,7 @@ class _l extends w {
|
|
|
8512
8513
|
});
|
|
8513
8514
|
};
|
|
8514
8515
|
setCodecPreferences(e) {
|
|
8515
|
-
|
|
8516
|
+
Gc(e, {
|
|
8516
8517
|
preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
|
|
8517
8518
|
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
8518
8519
|
});
|
|
@@ -8522,7 +8523,7 @@ class _l extends w {
|
|
|
8522
8523
|
}
|
|
8523
8524
|
subscribeToMainStreamHealthMonitorEvents() {
|
|
8524
8525
|
this.mainStreamHealthMonitor.on("inbound-video-problem-detected", ({ reason: e }) => {
|
|
8525
|
-
|
|
8526
|
+
Mt("detected inbound video problem", { reason: e }), this.mainStreamRecovery.recover();
|
|
8526
8527
|
});
|
|
8527
8528
|
}
|
|
8528
8529
|
bridgeEvents = (e, n) => {
|
|
@@ -8537,61 +8538,61 @@ class _l extends w {
|
|
|
8537
8538
|
};
|
|
8538
8539
|
}
|
|
8539
8540
|
export {
|
|
8540
|
-
|
|
8541
|
+
ia as $,
|
|
8541
8542
|
h as A,
|
|
8542
8543
|
D as B,
|
|
8543
|
-
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
|
|
8553
|
-
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
|
|
8544
|
+
ua as C,
|
|
8545
|
+
$a as D,
|
|
8546
|
+
ln as E,
|
|
8547
|
+
jo as F,
|
|
8548
|
+
yl as G,
|
|
8549
|
+
Mc as H,
|
|
8550
|
+
dc as I,
|
|
8551
|
+
Bs as J,
|
|
8552
|
+
Ki as K,
|
|
8553
|
+
fr as L,
|
|
8554
|
+
Ka as M,
|
|
8555
|
+
Ns as N,
|
|
8556
|
+
ic as O,
|
|
8557
|
+
Ra as P,
|
|
8558
|
+
Al as Q,
|
|
8558
8559
|
H as R,
|
|
8559
|
-
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8560
|
+
pc as S,
|
|
8561
|
+
Nl as T,
|
|
8562
|
+
sn as U,
|
|
8563
|
+
bl as V,
|
|
8564
|
+
na as W,
|
|
8564
8565
|
Y as X,
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
|
|
8571
|
-
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8578
|
-
|
|
8579
|
-
|
|
8566
|
+
Te as Y,
|
|
8567
|
+
aa as Z,
|
|
8568
|
+
ra as _,
|
|
8569
|
+
Ol as a,
|
|
8570
|
+
sa as a0,
|
|
8571
|
+
Hi as a1,
|
|
8572
|
+
Xi as a2,
|
|
8573
|
+
Ml as b,
|
|
8574
|
+
_l as c,
|
|
8575
|
+
Yt as d,
|
|
8576
|
+
Me as e,
|
|
8577
|
+
Ia as f,
|
|
8578
|
+
Jt as g,
|
|
8579
|
+
Be as h,
|
|
8580
|
+
$e as i,
|
|
8580
8581
|
u as j,
|
|
8581
8582
|
l as k,
|
|
8582
8583
|
O as l,
|
|
8583
|
-
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
|
|
8584
|
+
N as m,
|
|
8585
|
+
ds as n,
|
|
8586
|
+
qt as o,
|
|
8587
|
+
Ae as p,
|
|
8588
|
+
Cs as q,
|
|
8589
|
+
vl as r,
|
|
8590
|
+
fl as s,
|
|
8590
8591
|
v as t,
|
|
8591
8592
|
m as u,
|
|
8592
|
-
|
|
8593
|
+
je as v,
|
|
8593
8594
|
R as w,
|
|
8594
8595
|
d as x,
|
|
8595
|
-
|
|
8596
|
+
fn as y,
|
|
8596
8597
|
T as z
|
|
8597
8598
|
};
|