sip-connector 28.9.1 → 28.9.2
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-hy3LJqSU.js → @SipConnector-CqTjOCB3.js} +449 -443
- package/dist/@SipConnector-lXAjX378.cjs +1 -0
- package/dist/ConnectionManager/SipOperations.d.ts +1 -1
- 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-Dshp2OCj.cjs +0 -1
|
@@ -10,13 +10,13 @@ import { createStackPromises as bt, isPromiseIsNotActualError as yt } from "stac
|
|
|
10
10
|
import { UAParser as wn } from "ua-parser-js";
|
|
11
11
|
import "sequent-promises";
|
|
12
12
|
import Gn, { isEqual as Je } from "lodash";
|
|
13
|
-
const We = "sip-connector", kn = Ve(We),
|
|
13
|
+
const We = "sip-connector", kn = Ve(We), Rl = () => {
|
|
14
14
|
Ve.enable(`${We}:*`);
|
|
15
|
-
},
|
|
15
|
+
}, Nl = () => {
|
|
16
16
|
Ve.enable(`-${We}:*`);
|
|
17
17
|
}, I = (t) => kn.extend(t), Fn = "Error decline with 603", Un = 1006, Bn = (t) => typeof t == "object" && t !== null && "code" in t && t.code === Un, $n = (t) => t.message === Fn;
|
|
18
|
-
var Ne = /* @__PURE__ */ ((t) => (t.SPECTATOR = "SPECTATOR", t.PARTICIPANT = "PARTICIPANT", t))(Ne || {}), 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 || {}), q = /* @__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))(q || {}),
|
|
19
|
-
const
|
|
18
|
+
var Ne = /* @__PURE__ */ ((t) => (t.SPECTATOR = "SPECTATOR", t.PARTICIPANT = "PARTICIPANT", t))(Ne || {}), 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 || {}), q = /* @__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))(q || {}), $ = /* @__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))($ || {}), Ae = /* @__PURE__ */ ((t) => (t.ADMIN_STOP_MIC = "ADMINSTOPMIC", t.ADMIN_START_MIC = "ADMINSTARTMIC", t))(Ae || {}), Dt = /* @__PURE__ */ ((t) => (t.H264 = "H264", t.VP8 = "VP8", t.VP9 = "VP9", t.AV1 = "AV1", t))(Dt || {}), 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 || {}), ue = /* @__PURE__ */ ((t) => (t.AVAILABLE_CONTENTED_STREAM = "YOUCANRECEIVECONTENT", t.NOT_AVAILABLE_CONTENTED_STREAM = "CONTENTEND", t.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", t))(ue || {}), ie = /* @__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))(ie || {}), Ie = /* @__PURE__ */ ((t) => (t.ADMIN_SYNC_FORCED = "1", t.ADMIN_SYNC_NOT_FORCED = "0", t))(Ie || {}), Qe = /* @__PURE__ */ ((t) => (t.SPECTATOR_MANUAL = "0", t.BY_STATE_CAM = "1", t.SPECTATOR_FORCED = "2", t))(Qe || {}), Ye = /* @__PURE__ */ ((t) => (t.AUDIO = "AUDIO", t.VIDEO = "VIDEO", t.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", t))(Ye || {});
|
|
19
|
+
const x = (t) => typeof t == "string" && t.trim().length > 0, ke = (t) => typeof t == "number" && !Number.isNaN(t) && Number.isFinite(t), xn = (t) => typeof t == "object" && t !== null && !Array.isArray(t), Pt = (t) => typeof t == "boolean", Vn = (t) => Array.isArray(t) && t.every(x), Lt = [
|
|
20
20
|
"enter-room",
|
|
21
21
|
"main-cam-control",
|
|
22
22
|
"use-license",
|
|
@@ -46,7 +46,7 @@ const $ = (t) => typeof t == "string" && t.trim().length > 0, ke = (t) => typeof
|
|
|
46
46
|
"admin:stop-mic",
|
|
47
47
|
"admin:force-sync-media-state",
|
|
48
48
|
"failed-send-room-direct-p2p"
|
|
49
|
-
], qn = () => new G(Lt), Hn = (t) => !(!xn(t) ||
|
|
49
|
+
], qn = () => new G(Lt), Hn = (t) => !(!xn(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
52
|
}, Wn = (t) => typeof t == "string" && !Number.isNaN(Number(t)) && Number.isFinite(Number(t)), Qn = (t) => {
|
|
@@ -60,7 +60,7 @@ const $ = (t) => typeof t == "string" && t.trim().length > 0, ke = (t) => typeof
|
|
|
60
60
|
return !1;
|
|
61
61
|
}, P = (t, e) => {
|
|
62
62
|
const n = t.getHeader(e.toLowerCase());
|
|
63
|
-
if (
|
|
63
|
+
if (!x(n))
|
|
64
64
|
return;
|
|
65
65
|
const s = n.toLowerCase();
|
|
66
66
|
switch (e) {
|
|
@@ -91,7 +91,7 @@ const $ = (t) => typeof t == "string" && t.trim().length > 0, ke = (t) => typeof
|
|
|
91
91
|
case E.CONTENT_USE_LICENSE:
|
|
92
92
|
return j(Ye, s);
|
|
93
93
|
case E.MAIN_CAM:
|
|
94
|
-
return j(
|
|
94
|
+
return j($, s);
|
|
95
95
|
case E.MIC:
|
|
96
96
|
return j(Ae, s);
|
|
97
97
|
case E.MEDIA_SYNC:
|
|
@@ -108,7 +108,7 @@ const $ = (t) => typeof t == "string" && t.trim().length > 0, ke = (t) => typeof
|
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
|
-
var
|
|
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
112
|
const Ke = I("ApiManager");
|
|
113
113
|
class jn extends w {
|
|
114
114
|
callManager;
|
|
@@ -245,47 +245,47 @@ class jn extends w {
|
|
|
245
245
|
};
|
|
246
246
|
handleNotify = (e) => {
|
|
247
247
|
switch (e.cmd) {
|
|
248
|
-
case
|
|
248
|
+
case U.CHANNELS: {
|
|
249
249
|
this.triggerChannelsNotify(e);
|
|
250
250
|
break;
|
|
251
251
|
}
|
|
252
|
-
case
|
|
252
|
+
case U.WEBCAST_STARTED: {
|
|
253
253
|
this.triggerWebcastStartedNotify(e);
|
|
254
254
|
break;
|
|
255
255
|
}
|
|
256
|
-
case
|
|
256
|
+
case U.WEBCAST_STOPPED: {
|
|
257
257
|
this.triggerWebcastStoppedNotify(e);
|
|
258
258
|
break;
|
|
259
259
|
}
|
|
260
|
-
case
|
|
260
|
+
case U.ADDED_TO_LIST_MODERATORS: {
|
|
261
261
|
this.triggerAddedToListModeratorsNotify(e);
|
|
262
262
|
break;
|
|
263
263
|
}
|
|
264
|
-
case
|
|
264
|
+
case U.REMOVED_FROM_LIST_MODERATORS: {
|
|
265
265
|
this.triggerRemovedFromListModeratorsNotify(e);
|
|
266
266
|
break;
|
|
267
267
|
}
|
|
268
|
-
case
|
|
268
|
+
case U.ACCEPTING_WORD_REQUEST: {
|
|
269
269
|
this.triggerParticipationAcceptingWordRequest(e);
|
|
270
270
|
break;
|
|
271
271
|
}
|
|
272
|
-
case
|
|
272
|
+
case U.CANCELLING_WORD_REQUEST: {
|
|
273
273
|
this.triggerParticipationCancellingWordRequest(e);
|
|
274
274
|
break;
|
|
275
275
|
}
|
|
276
|
-
case
|
|
276
|
+
case U.MOVE_REQUEST_TO_STREAM: {
|
|
277
277
|
this.triggerParticipantMoveRequestToStream(e);
|
|
278
278
|
break;
|
|
279
279
|
}
|
|
280
|
-
case
|
|
280
|
+
case U.ACCOUNT_CHANGED: {
|
|
281
281
|
this.triggerAccountChangedNotify();
|
|
282
282
|
break;
|
|
283
283
|
}
|
|
284
|
-
case
|
|
284
|
+
case U.ACCOUNT_DELETED: {
|
|
285
285
|
this.triggerAccountDeletedNotify();
|
|
286
286
|
break;
|
|
287
287
|
}
|
|
288
|
-
case
|
|
288
|
+
case U.CONFERENCE_PARTICIPANT_TOKEN_ISSUED: {
|
|
289
289
|
this.maybeTriggerConferenceParticipantTokenIssued(e);
|
|
290
290
|
break;
|
|
291
291
|
}
|
|
@@ -477,15 +477,15 @@ class jn extends w {
|
|
|
477
477
|
};
|
|
478
478
|
triggerMainCamControl = (e) => {
|
|
479
479
|
const n = P(e, E.MAIN_CAM), s = P(e, E.MEDIA_SYNC), r = s === Ie.ADMIN_SYNC_FORCED;
|
|
480
|
-
if (n ===
|
|
480
|
+
if (n === $.ADMIN_START_MAIN_CAM) {
|
|
481
481
|
this.events.trigger("admin:start-main-cam", { isSyncForced: r });
|
|
482
482
|
return;
|
|
483
483
|
}
|
|
484
|
-
if (n ===
|
|
484
|
+
if (n === $.ADMIN_STOP_MAIN_CAM) {
|
|
485
485
|
this.events.trigger("admin:stop-main-cam", { isSyncForced: r });
|
|
486
486
|
return;
|
|
487
487
|
}
|
|
488
|
-
(n ===
|
|
488
|
+
(n === $.RESUME_MAIN_CAM || n === $.PAUSE_MAIN_CAM) && s !== void 0 && this.events.trigger("admin:force-sync-media-state", { isSyncForced: r });
|
|
489
489
|
const i = P(e, E.MAIN_CAM_RESOLUTION);
|
|
490
490
|
this.events.trigger("main-cam-control", {
|
|
491
491
|
mainCam: n,
|
|
@@ -714,7 +714,7 @@ class rs {
|
|
|
714
714
|
);
|
|
715
715
|
}
|
|
716
716
|
}
|
|
717
|
-
const
|
|
717
|
+
const F = I("AutoConnectorRuntime"), is = 3e3, as = 15e3;
|
|
718
718
|
class os {
|
|
719
719
|
connectionManager;
|
|
720
720
|
connectionQueueManager;
|
|
@@ -742,7 +742,7 @@ class os {
|
|
|
742
742
|
});
|
|
743
743
|
}
|
|
744
744
|
async stopConnectionFlow() {
|
|
745
|
-
|
|
745
|
+
F("stopConnectionFlow"), this.stopAttempts(), this.stopConnectTriggers(), await this.connectionQueueManager.disconnect();
|
|
746
746
|
}
|
|
747
747
|
async connect(e) {
|
|
748
748
|
await this.connectionQueueManager.connect(e.getParameters, e.options);
|
|
@@ -761,13 +761,13 @@ class os {
|
|
|
761
761
|
return s || r ? !0 : !(e || n);
|
|
762
762
|
}
|
|
763
763
|
beforeAttempt() {
|
|
764
|
-
|
|
764
|
+
F("entryAttemptingGate"), this.emitters.emitBeforeAttempt(), this.stopConnectTriggers();
|
|
765
765
|
}
|
|
766
766
|
beforeConnectAttempt() {
|
|
767
|
-
|
|
767
|
+
F("entryAttemptingConnect"), this.attemptsState.startAttempt(), this.attemptsState.increment();
|
|
768
768
|
}
|
|
769
769
|
onLimitReached(e) {
|
|
770
|
-
|
|
770
|
+
F("onLimitReachedTransition"), this.attemptsState.finishAttempt(), this.emitters.emitLimitReachedAttempts(), this.startCheckTelephony(e);
|
|
771
771
|
}
|
|
772
772
|
onConnectSucceeded(e) {
|
|
773
773
|
this.subscribeToConnectTriggers(e), this.emitters.emitSuccess();
|
|
@@ -788,23 +788,23 @@ class os {
|
|
|
788
788
|
this.emitters.emitFailedAllAttempts(n);
|
|
789
789
|
return;
|
|
790
790
|
}
|
|
791
|
-
|
|
791
|
+
F("emitTerminalOutcome without stopReason", n);
|
|
792
792
|
}
|
|
793
793
|
onTelephonyStillConnected() {
|
|
794
|
-
|
|
794
|
+
F("onTelephonyStillConnected"), this.stopConnectTriggers(), this.emitters.emitSuccess();
|
|
795
795
|
}
|
|
796
796
|
stopConnectTriggers() {
|
|
797
|
-
|
|
797
|
+
F("stopConnectTriggers"), this.pingServerRequester.stop(), this.checkTelephonyRequester.stop(), this.registrationFailedOutOfCallSubscriber.unsubscribe();
|
|
798
798
|
}
|
|
799
799
|
stopAttempts() {
|
|
800
800
|
this.attemptsState.isAttemptInProgress && this.connectionQueueManager.stop(), this.cancelPendingRetry(), this.attemptsState.reset();
|
|
801
801
|
}
|
|
802
802
|
startCheckTelephony(e) {
|
|
803
|
-
|
|
803
|
+
F("startCheckTelephony"), this.checkTelephonyRequester.start(
|
|
804
804
|
async () => e.getParameters(),
|
|
805
805
|
{
|
|
806
806
|
onSuccessRequest: () => {
|
|
807
|
-
|
|
807
|
+
F("startCheckTelephony: onSuccessRequest"), this.telephonyFailPolicy.reset(), this.isConnectionUnavailable() ? this.reconnectActions.requestReconnect(e, "telephony-disconnected") : this.reconnectActions.notifyTelephonyStillConnected();
|
|
808
808
|
},
|
|
809
809
|
onFailRequest: (n) => {
|
|
810
810
|
const s = this.telephonyFailPolicy.registerFailure();
|
|
@@ -818,7 +818,7 @@ class os {
|
|
|
818
818
|
failCount: s.failCount,
|
|
819
819
|
escalationLevel: s.escalationLevel,
|
|
820
820
|
error: n
|
|
821
|
-
}), s.shouldRequestReconnect && this.reconnectActions.requestReconnect(e, "telephony-check-failed"),
|
|
821
|
+
}), s.shouldRequestReconnect && this.reconnectActions.requestReconnect(e, "telephony-check-failed"), F("startCheckTelephony: onFailRequest", n?.message);
|
|
822
822
|
}
|
|
823
823
|
}
|
|
824
824
|
);
|
|
@@ -826,10 +826,10 @@ class os {
|
|
|
826
826
|
subscribeToConnectTriggers(e) {
|
|
827
827
|
this.pingServerRequester.start({
|
|
828
828
|
onFailRequest: () => {
|
|
829
|
-
|
|
829
|
+
F("pingRequester: onFailRequest");
|
|
830
830
|
}
|
|
831
831
|
}), this.registrationFailedOutOfCallSubscriber.subscribe(() => {
|
|
832
|
-
|
|
832
|
+
F("registrationFailedOutOfCallListener callback"), this.reconnectActions.requestReconnect(e, "registration-failed-out-of-call");
|
|
833
833
|
});
|
|
834
834
|
}
|
|
835
835
|
isConnectionUnavailable() {
|
|
@@ -953,7 +953,7 @@ class us {
|
|
|
953
953
|
userAgent: f,
|
|
954
954
|
displayName: y = "",
|
|
955
955
|
register: _ = !1,
|
|
956
|
-
extraHeaders:
|
|
956
|
+
extraHeaders: V = []
|
|
957
957
|
}) => {
|
|
958
958
|
this.dependencies.getUa() && await this.disconnect({ cancelRequests: !1 });
|
|
959
959
|
const { ua: K, helpers: ne } = this.dependencies.uaFactory.createUAWithConfiguration(
|
|
@@ -970,7 +970,7 @@ class us {
|
|
|
970
970
|
connectionRecoveryMaxInterval: C,
|
|
971
971
|
userAgent: f,
|
|
972
972
|
remoteAddress: i,
|
|
973
|
-
extraHeaders:
|
|
973
|
+
extraHeaders: V
|
|
974
974
|
},
|
|
975
975
|
this.dependencies.events
|
|
976
976
|
);
|
|
@@ -1527,7 +1527,8 @@ class Ns {
|
|
|
1527
1527
|
};
|
|
1528
1528
|
}
|
|
1529
1529
|
}
|
|
1530
|
-
|
|
1530
|
+
const As = 1e4;
|
|
1531
|
+
class Is {
|
|
1531
1532
|
uaFactory;
|
|
1532
1533
|
getUaProtected;
|
|
1533
1534
|
constructor(e) {
|
|
@@ -1536,21 +1537,23 @@ class As {
|
|
|
1536
1537
|
/**
|
|
1537
1538
|
* Отправляет SIP OPTIONS запрос к указанному адресу
|
|
1538
1539
|
*/
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1540
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
1541
|
+
async sendOptions(e, n, s, r) {
|
|
1542
|
+
const i = this.getUaProtected();
|
|
1543
|
+
return new Promise((a, o) => {
|
|
1542
1544
|
try {
|
|
1543
|
-
|
|
1545
|
+
i.sendOptions(e, n, {
|
|
1544
1546
|
extraHeaders: s,
|
|
1545
1547
|
eventHandlers: {
|
|
1546
1548
|
succeeded: () => {
|
|
1547
|
-
|
|
1549
|
+
a();
|
|
1548
1550
|
},
|
|
1549
|
-
failed:
|
|
1550
|
-
}
|
|
1551
|
+
failed: o
|
|
1552
|
+
},
|
|
1553
|
+
timeout: r
|
|
1551
1554
|
});
|
|
1552
|
-
} catch (
|
|
1553
|
-
|
|
1555
|
+
} catch (c) {
|
|
1556
|
+
o(c);
|
|
1554
1557
|
}
|
|
1555
1558
|
});
|
|
1556
1559
|
}
|
|
@@ -1559,7 +1562,7 @@ class As {
|
|
|
1559
1562
|
*/
|
|
1560
1563
|
async ping(e, n) {
|
|
1561
1564
|
const r = this.getUaProtected().configuration.uri;
|
|
1562
|
-
return this.sendOptions(r, e, n);
|
|
1565
|
+
return this.sendOptions(r, e, n, As);
|
|
1563
1566
|
}
|
|
1564
1567
|
/**
|
|
1565
1568
|
* Проверяет доступность телефонии, создавая временное соединение
|
|
@@ -1592,10 +1595,10 @@ class As {
|
|
|
1592
1595
|
});
|
|
1593
1596
|
}
|
|
1594
1597
|
}
|
|
1595
|
-
function
|
|
1598
|
+
function fs(t) {
|
|
1596
1599
|
return (e) => `sip:${e}@${t}`;
|
|
1597
1600
|
}
|
|
1598
|
-
const
|
|
1601
|
+
const vs = (t, e) => () => Math.floor(Math.random() * (e - t)) + t, Ms = (t) => t.trim().replaceAll(" ", "_"), Os = vs(1e5, 99999999), _s = (t) => {
|
|
1599
1602
|
const e = [];
|
|
1600
1603
|
return t !== void 0 && t !== "" && e.push(`X-Vinteo-Remote: ${t}`), e;
|
|
1601
1604
|
};
|
|
@@ -1624,10 +1627,10 @@ class oe {
|
|
|
1624
1627
|
throw new Error("user is required for authorized connection");
|
|
1625
1628
|
}
|
|
1626
1629
|
static resolveAuthorizationUser(e, n) {
|
|
1627
|
-
return e && n !== void 0 && n.trim() !== "" ? n.trim() : `${
|
|
1630
|
+
return e && n !== void 0 && n.trim() !== "" ? n.trim() : `${Os()}`;
|
|
1628
1631
|
}
|
|
1629
1632
|
static buildExtraHeaders(e, n) {
|
|
1630
|
-
const s = e !== void 0 && e !== "" ?
|
|
1633
|
+
const s = e !== void 0 && e !== "" ? _s(e) : [];
|
|
1631
1634
|
return n === void 0 ? s : [...s, ...n];
|
|
1632
1635
|
}
|
|
1633
1636
|
createConfiguration({
|
|
@@ -1651,22 +1654,22 @@ class oe {
|
|
|
1651
1654
|
sipServerIp: i,
|
|
1652
1655
|
sipServerUrl: s
|
|
1653
1656
|
});
|
|
1654
|
-
const y = oe.resolveAuthorizationUser(a, e), _ =
|
|
1657
|
+
const y = oe.resolveAuthorizationUser(a, e), _ = fs(i), V = _(y), B = new this.JsSIP.WebSocketInterface(`wss://${s}/webrtc/wss/`);
|
|
1655
1658
|
return {
|
|
1656
1659
|
configuration: {
|
|
1657
1660
|
password: n,
|
|
1658
1661
|
register: a,
|
|
1659
|
-
uri:
|
|
1660
|
-
display_name:
|
|
1662
|
+
uri: V,
|
|
1663
|
+
display_name: Ms(r),
|
|
1661
1664
|
user_agent: f,
|
|
1662
|
-
sockets: [
|
|
1665
|
+
sockets: [B],
|
|
1663
1666
|
session_timers: o,
|
|
1664
1667
|
register_expires: c,
|
|
1665
1668
|
connection_recovery_min_interval: g,
|
|
1666
1669
|
connection_recovery_max_interval: C
|
|
1667
1670
|
},
|
|
1668
1671
|
helpers: {
|
|
1669
|
-
socket:
|
|
1672
|
+
socket: B,
|
|
1670
1673
|
getUri: _
|
|
1671
1674
|
}
|
|
1672
1675
|
};
|
|
@@ -1690,8 +1693,8 @@ class oe {
|
|
|
1690
1693
|
}), { ua: i, helpers: r };
|
|
1691
1694
|
}
|
|
1692
1695
|
}
|
|
1693
|
-
const
|
|
1694
|
-
class
|
|
1696
|
+
const bs = I("ConnectionManager");
|
|
1697
|
+
class ys extends w {
|
|
1695
1698
|
stateMachine;
|
|
1696
1699
|
ua;
|
|
1697
1700
|
socket;
|
|
@@ -1705,7 +1708,7 @@ class bs extends w {
|
|
|
1705
1708
|
super(Cs()), this.uaFactory = new oe(e), this.registrationManager = new Ns({
|
|
1706
1709
|
events: this.events,
|
|
1707
1710
|
getUaProtected: this.getUaProtected
|
|
1708
|
-
}), this.stateMachine = new ps(this.events), this.sipOperations = new
|
|
1711
|
+
}), this.stateMachine = new ps(this.events), this.sipOperations = new Is({
|
|
1709
1712
|
uaFactory: this.uaFactory,
|
|
1710
1713
|
getUaProtected: this.getUaProtected
|
|
1711
1714
|
}), this.connectionFlow = new us(
|
|
@@ -1756,7 +1759,7 @@ class bs extends w {
|
|
|
1756
1759
|
return this.stateMachine.isRegisterEnabled();
|
|
1757
1760
|
}
|
|
1758
1761
|
connect = async (e, n) => this.disconnect().catch((s) => {
|
|
1759
|
-
|
|
1762
|
+
bs("connect: disconnect error", s);
|
|
1760
1763
|
}).then(async () => this.connectWithProcessError(e, n));
|
|
1761
1764
|
disconnect = async () => {
|
|
1762
1765
|
if (this.isConfigured() || this.requested)
|
|
@@ -1807,7 +1810,7 @@ class bs extends w {
|
|
|
1807
1810
|
});
|
|
1808
1811
|
};
|
|
1809
1812
|
}
|
|
1810
|
-
class
|
|
1813
|
+
class Ds {
|
|
1811
1814
|
connectionManager;
|
|
1812
1815
|
stackPromises = bt({
|
|
1813
1816
|
noRunIsNotActual: !0
|
|
@@ -1824,7 +1827,7 @@ class ys {
|
|
|
1824
1827
|
const z = (t) => {
|
|
1825
1828
|
if (t !== null && typeof t == "object" && "error" in t)
|
|
1826
1829
|
return t.error;
|
|
1827
|
-
}, b = I("AutoConnectorMachine"), tt = (t) => t.parameters,
|
|
1830
|
+
}, b = I("AutoConnectorMachine"), tt = (t) => t.parameters, Ps = (t) => ee({
|
|
1828
1831
|
types: {
|
|
1829
1832
|
context: {},
|
|
1830
1833
|
events: {}
|
|
@@ -1975,7 +1978,7 @@ const z = (t) => {
|
|
|
1975
1978
|
}
|
|
1976
1979
|
});
|
|
1977
1980
|
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 || {});
|
|
1978
|
-
const
|
|
1981
|
+
const Ls = () => ({
|
|
1979
1982
|
parameters: void 0,
|
|
1980
1983
|
afterDisconnect: "idle",
|
|
1981
1984
|
stopReason: void 0,
|
|
@@ -1989,10 +1992,10 @@ const Ps = () => ({
|
|
|
1989
1992
|
target: O.DISCONNECTING,
|
|
1990
1993
|
actions: "assignRestart"
|
|
1991
1994
|
}
|
|
1992
|
-
}),
|
|
1995
|
+
}), ws = (t) => Ps(t).createMachine({
|
|
1993
1996
|
id: "autoConnector",
|
|
1994
1997
|
initial: O.IDLE,
|
|
1995
|
-
context:
|
|
1998
|
+
context: Ls,
|
|
1996
1999
|
states: {
|
|
1997
2000
|
/** Ожидание: допустимы рестарт флоу или внешний стоп без побочных эффектов. */
|
|
1998
2001
|
[O.IDLE]: {
|
|
@@ -2194,14 +2197,14 @@ const Ps = () => ({
|
|
|
2194
2197
|
on: ce()
|
|
2195
2198
|
}
|
|
2196
2199
|
}
|
|
2197
|
-
}),
|
|
2198
|
-
class
|
|
2200
|
+
}), Gs = I("AutoConnectorStateMachine");
|
|
2201
|
+
class ks extends te {
|
|
2199
2202
|
constructor(e) {
|
|
2200
2203
|
super(e);
|
|
2201
2204
|
}
|
|
2202
2205
|
send(e) {
|
|
2203
2206
|
if (!this.actor.getSnapshot().can(e)) {
|
|
2204
|
-
|
|
2207
|
+
Gs(
|
|
2205
2208
|
`[AutoConnectorStateMachine] Invalid transition: ${e.type} from ${String(this.state)}. Event cannot be processed in current state.`
|
|
2206
2209
|
);
|
|
2207
2210
|
return;
|
|
@@ -2227,19 +2230,19 @@ class Gs extends te {
|
|
|
2227
2230
|
return this.state === O.WAITING_BEFORE_RETRY;
|
|
2228
2231
|
}
|
|
2229
2232
|
}
|
|
2230
|
-
const
|
|
2231
|
-
if (!
|
|
2233
|
+
const Fs = (t) => new ks(ws(t)), Us = /* @__PURE__ */ new Set([401, 403]), Bs = (t) => typeof t == "object" && t !== null && "response" in t, $s = (t) => {
|
|
2234
|
+
if (!Bs(t))
|
|
2232
2235
|
return !1;
|
|
2233
2236
|
const e = t.response?.status_code;
|
|
2234
|
-
return typeof e == "number" &&
|
|
2235
|
-
},
|
|
2237
|
+
return typeof e == "number" && Us.has(e);
|
|
2238
|
+
}, xs = (t) => !$s(t), Vs = (t) => {
|
|
2236
2239
|
if (!(typeof window > "u"))
|
|
2237
2240
|
return window;
|
|
2238
|
-
},
|
|
2241
|
+
}, qs = (t) => {
|
|
2239
2242
|
if (!(typeof navigator > "u"))
|
|
2240
2243
|
return navigator;
|
|
2241
|
-
},
|
|
2242
|
-
const e =
|
|
2244
|
+
}, Hs = (t) => {
|
|
2245
|
+
const e = Vs(), n = qs();
|
|
2243
2246
|
if (!e)
|
|
2244
2247
|
return;
|
|
2245
2248
|
let s = [];
|
|
@@ -2274,7 +2277,7 @@ const ks = (t) => new Gs(Ls(t)), Fs = /* @__PURE__ */ new Set([401, 403]), Us =
|
|
|
2274
2277
|
},
|
|
2275
2278
|
unsubscribe: r
|
|
2276
2279
|
};
|
|
2277
|
-
},
|
|
2280
|
+
}, Ws = "Failed to reconnect", nt = (t) => t instanceof Error ? t : new Error(Ws), Qs = (t) => {
|
|
2278
2281
|
const e = (s) => t.baseCanRetryOnError(s) ? t.canRetryOnError?.(s) ?? !0 : !1, n = ({
|
|
2279
2282
|
stopReason: s,
|
|
2280
2283
|
lastError: r
|
|
@@ -2325,8 +2328,8 @@ const ks = (t) => new Gs(Ls(t)), Fs = /* @__PURE__ */ new Set([401, 403]), Us =
|
|
|
2325
2328
|
"limit-reached-attempts",
|
|
2326
2329
|
"telephony-check-failure",
|
|
2327
2330
|
"telephony-check-escalated"
|
|
2328
|
-
],
|
|
2329
|
-
class
|
|
2331
|
+
], Ys = () => new G(Ut), J = I("NetworkEventsReconnector"), js = 2e3, st = "probe", zs = "network-online", Js = "network-change";
|
|
2332
|
+
class Ks {
|
|
2330
2333
|
subscriber;
|
|
2331
2334
|
offlineGraceMs;
|
|
2332
2335
|
onChangePolicy;
|
|
@@ -2349,7 +2352,7 @@ class Js {
|
|
|
2349
2352
|
requestReconnect: a,
|
|
2350
2353
|
stopConnection: o
|
|
2351
2354
|
}) {
|
|
2352
|
-
this.subscriber = e, this.offlineGraceMs = n ??
|
|
2355
|
+
this.subscriber = e, this.offlineGraceMs = n ?? js, this.onChangePolicy = s ?? st, this.onOnlinePolicy = r ?? st, this.probe = i, this.requestReconnect = a, this.stopConnection = o;
|
|
2353
2356
|
}
|
|
2354
2357
|
start(e) {
|
|
2355
2358
|
this.parameters = e, !this.isSubscribed && (this.subscriber.subscribe({
|
|
@@ -2365,10 +2368,10 @@ class Js {
|
|
|
2365
2368
|
this.cancelOfflineTimer(), this.isSubscribed && (this.subscriber.unsubscribe(), this.isSubscribed = !1, this.parameters = void 0);
|
|
2366
2369
|
}
|
|
2367
2370
|
handleOnline = () => {
|
|
2368
|
-
J("network online", { policy: this.onOnlinePolicy }), this.cancelOfflineTimer(), this.applyPolicy(this.onOnlinePolicy,
|
|
2371
|
+
J("network online", { policy: this.onOnlinePolicy }), this.cancelOfflineTimer(), this.applyPolicy(this.onOnlinePolicy, zs);
|
|
2369
2372
|
};
|
|
2370
2373
|
handleChange = () => {
|
|
2371
|
-
J("network change", { policy: this.onChangePolicy }), this.applyPolicy(this.onChangePolicy,
|
|
2374
|
+
J("network change", { policy: this.onChangePolicy }), this.applyPolicy(this.onChangePolicy, Js);
|
|
2372
2375
|
};
|
|
2373
2376
|
handleOffline = () => {
|
|
2374
2377
|
J("network offline, scheduling disconnect", { graceMs: this.offlineGraceMs }), this.cancelOfflineTimer(), this.offlineTimer = setTimeout(() => {
|
|
@@ -2415,7 +2418,7 @@ const X = {
|
|
|
2415
2418
|
TELEPHONY_CHECK_FAILED: "telephony-check-failed",
|
|
2416
2419
|
NETWORK_ONLINE: "network-online",
|
|
2417
2420
|
NETWORK_CHANGE: "network-change"
|
|
2418
|
-
},
|
|
2421
|
+
}, Xs = {
|
|
2419
2422
|
[X.START]: 0,
|
|
2420
2423
|
[X.TELEPHONY_DISCONNECTED]: 1,
|
|
2421
2424
|
[X.TELEPHONY_CHECK_FAILED]: 1,
|
|
@@ -2423,8 +2426,8 @@ const X = {
|
|
|
2423
2426
|
[X.MANUAL_RESTART]: 4,
|
|
2424
2427
|
[X.NETWORK_ONLINE]: 4,
|
|
2425
2428
|
[X.NETWORK_CHANGE]: 4
|
|
2426
|
-
}, rt = (t) =>
|
|
2427
|
-
class
|
|
2429
|
+
}, rt = (t) => Xs[t];
|
|
2430
|
+
class Zs {
|
|
2428
2431
|
generation = 0;
|
|
2429
2432
|
lastRequest;
|
|
2430
2433
|
coalesceWindowMs;
|
|
@@ -2457,15 +2460,15 @@ class Xs {
|
|
|
2457
2460
|
this.lastRequest = void 0;
|
|
2458
2461
|
}
|
|
2459
2462
|
}
|
|
2460
|
-
const
|
|
2463
|
+
const er = 250, tr = {
|
|
2461
2464
|
LIMIT_REACHED: "Limit reached"
|
|
2462
|
-
},
|
|
2463
|
-
class
|
|
2465
|
+
}, k = I("AutoConnectorManager"), nr = "start", sr = "manual-restart";
|
|
2466
|
+
class rr extends w {
|
|
2464
2467
|
stateMachine;
|
|
2465
2468
|
runtime;
|
|
2466
2469
|
connectionManager;
|
|
2467
|
-
reconnectCoalescer = new
|
|
2468
|
-
coalesceWindowMs:
|
|
2470
|
+
reconnectCoalescer = new Zs({
|
|
2471
|
+
coalesceWindowMs: er
|
|
2469
2472
|
});
|
|
2470
2473
|
networkEventsReconnector;
|
|
2471
2474
|
constructor({
|
|
@@ -2473,7 +2476,7 @@ class sr extends w {
|
|
|
2473
2476
|
connectionManager: n,
|
|
2474
2477
|
callManager: s
|
|
2475
2478
|
}, r) {
|
|
2476
|
-
super(
|
|
2479
|
+
super(Ys()), this.connectionManager = n, this.runtime = new os({
|
|
2477
2480
|
connectionManager: n,
|
|
2478
2481
|
connectionQueueManager: e,
|
|
2479
2482
|
callManager: s,
|
|
@@ -2483,10 +2486,10 @@ class sr extends w {
|
|
|
2483
2486
|
this.events.trigger("before-attempt", {});
|
|
2484
2487
|
},
|
|
2485
2488
|
emitLimitReachedAttempts: () => {
|
|
2486
|
-
this.events.trigger("limit-reached-attempts", new Error(
|
|
2489
|
+
this.events.trigger("limit-reached-attempts", new Error(tr.LIMIT_REACHED));
|
|
2487
2490
|
},
|
|
2488
2491
|
emitSuccess: () => {
|
|
2489
|
-
|
|
2492
|
+
k("handleSucceededAttempt"), this.events.trigger("success");
|
|
2490
2493
|
},
|
|
2491
2494
|
emitStopAttemptsByError: (a) => {
|
|
2492
2495
|
this.events.trigger("stop-attempts-by-error", a);
|
|
@@ -2513,15 +2516,15 @@ class sr extends w {
|
|
|
2513
2516
|
this.stateMachine.toTelephonyResultStillConnected();
|
|
2514
2517
|
}
|
|
2515
2518
|
}
|
|
2516
|
-
}), this.stateMachine =
|
|
2517
|
-
|
|
2518
|
-
baseCanRetryOnError:
|
|
2519
|
+
}), this.stateMachine = Fs(
|
|
2520
|
+
Qs({
|
|
2521
|
+
baseCanRetryOnError: xs,
|
|
2519
2522
|
runtime: this.runtime,
|
|
2520
2523
|
canRetryOnError: r?.canRetryOnError
|
|
2521
2524
|
})
|
|
2522
2525
|
);
|
|
2523
|
-
const i = r?.networkEventsSubscriber ??
|
|
2524
|
-
i && (this.networkEventsReconnector = new
|
|
2526
|
+
const i = r?.networkEventsSubscriber ?? Hs();
|
|
2527
|
+
i && (this.networkEventsReconnector = new Ks({
|
|
2525
2528
|
subscriber: i,
|
|
2526
2529
|
offlineGraceMs: r?.offlineGraceMs,
|
|
2527
2530
|
onChangePolicy: r?.onNetworkChangePolicy,
|
|
@@ -2534,19 +2537,19 @@ class sr extends w {
|
|
|
2534
2537
|
}));
|
|
2535
2538
|
}
|
|
2536
2539
|
start(e) {
|
|
2537
|
-
|
|
2540
|
+
k("auto connector start"), this.networkEventsReconnector?.start(e), this.requestReconnect(e, nr);
|
|
2538
2541
|
}
|
|
2539
2542
|
restart() {
|
|
2540
|
-
|
|
2543
|
+
k("auto connector restart");
|
|
2541
2544
|
const { parameters: e } = this.stateMachine.context;
|
|
2542
2545
|
if (!e) {
|
|
2543
|
-
|
|
2546
|
+
k("auto connector restart skipped: no parameters in context");
|
|
2544
2547
|
return;
|
|
2545
2548
|
}
|
|
2546
|
-
this.requestReconnect(e,
|
|
2549
|
+
this.requestReconnect(e, sr);
|
|
2547
2550
|
}
|
|
2548
2551
|
stop() {
|
|
2549
|
-
|
|
2552
|
+
k("auto connector stop"), this.networkEventsReconnector?.stop(), this.resetReconnectCoalescingState(), this.stateMachine.toStop();
|
|
2550
2553
|
}
|
|
2551
2554
|
// Test hook: allows deterministic cancellation of pending retry flow.
|
|
2552
2555
|
cancelPendingRetry() {
|
|
@@ -2554,7 +2557,7 @@ class sr extends w {
|
|
|
2554
2557
|
}
|
|
2555
2558
|
requestReconnect = (e, n) => {
|
|
2556
2559
|
const s = this.shouldRequestReconnect(n);
|
|
2557
|
-
|
|
2560
|
+
k("auto connector requestReconnect", {
|
|
2558
2561
|
isAvailableToRestart: s,
|
|
2559
2562
|
reason: n
|
|
2560
2563
|
}), s && (this.networkEventsReconnector?.setParameters(e), this.stateMachine.toRestart(e));
|
|
@@ -2575,29 +2578,32 @@ class sr extends w {
|
|
|
2575
2578
|
// параметров): возвращаем false, сохраняя прежнее поведение — пусть
|
|
2576
2579
|
// сетевое событие триггернёт стандартный `requestReconnect`.
|
|
2577
2580
|
probeServerReachability = async () => {
|
|
2578
|
-
if (this.stateMachine.isInConnectedMonitoringState())
|
|
2581
|
+
if (this.stateMachine.isInConnectedMonitoringState()) {
|
|
2582
|
+
k("probeServerReachability: isInConnectedMonitoringState");
|
|
2579
2583
|
try {
|
|
2580
2584
|
return await this.connectionManager.ping(), !0;
|
|
2581
2585
|
} catch (e) {
|
|
2582
|
-
return
|
|
2586
|
+
return k("probeServerReachability: ping failed", e), !1;
|
|
2583
2587
|
}
|
|
2588
|
+
}
|
|
2584
2589
|
if (this.stateMachine.isInWaitingBeforeRetryState()) {
|
|
2590
|
+
k("probeServerReachability: isInWaitingBeforeRetryState");
|
|
2585
2591
|
const { parameters: e } = this.stateMachine.context;
|
|
2586
2592
|
try {
|
|
2587
2593
|
const n = await e.getParameters();
|
|
2588
2594
|
return await this.connectionManager.checkTelephony(n), !1;
|
|
2589
2595
|
} catch (n) {
|
|
2590
|
-
return
|
|
2596
|
+
return k("probeServerReachability: checkTelephony failed", n), !0;
|
|
2591
2597
|
}
|
|
2592
2598
|
}
|
|
2593
|
-
return !1;
|
|
2599
|
+
return k("probeServerReachability: default return false"), !1;
|
|
2594
2600
|
};
|
|
2595
2601
|
shouldRequestReconnect(e) {
|
|
2596
2602
|
const n = this.reconnectCoalescer.register(e);
|
|
2597
|
-
return n.shouldRequest ? (
|
|
2603
|
+
return n.shouldRequest ? (k(`auto connector reconnect requested: ${e}`, {
|
|
2598
2604
|
state: String(this.stateMachine.state),
|
|
2599
2605
|
generation: n.generation
|
|
2600
|
-
}), !0) : (
|
|
2606
|
+
}), !0) : (k(`auto connector reconnect coalesced: ${e}`, {
|
|
2601
2607
|
state: String(this.stateMachine.state),
|
|
2602
2608
|
coalescedBy: n.coalescedBy,
|
|
2603
2609
|
currentPriority: n.currentPriority,
|
|
@@ -2608,8 +2614,8 @@ class sr extends w {
|
|
|
2608
2614
|
this.reconnectCoalescer.reset();
|
|
2609
2615
|
}
|
|
2610
2616
|
}
|
|
2611
|
-
const it = 0,
|
|
2612
|
-
class
|
|
2617
|
+
const it = 0, ir = 0;
|
|
2618
|
+
class ar {
|
|
2613
2619
|
countInner = it;
|
|
2614
2620
|
initialCount = it;
|
|
2615
2621
|
limitInner;
|
|
@@ -2628,7 +2634,7 @@ class ir {
|
|
|
2628
2634
|
return this.isInProgress;
|
|
2629
2635
|
}
|
|
2630
2636
|
hasLimitReached() {
|
|
2631
|
-
return this.limitInner ===
|
|
2637
|
+
return this.limitInner === ir ? !1 : this.countInner >= this.limitInner;
|
|
2632
2638
|
}
|
|
2633
2639
|
startAttempt() {
|
|
2634
2640
|
this.isInProgress || (this.isInProgress = !0, this.onStatusChange({ isInProgress: this.isInProgress }));
|
|
@@ -2643,43 +2649,43 @@ class ir {
|
|
|
2643
2649
|
this.countInner = this.initialCount, this.finishAttempt();
|
|
2644
2650
|
}
|
|
2645
2651
|
}
|
|
2646
|
-
const at = 1,
|
|
2647
|
-
const { baseBackoffMs: n, maxBackoffMs: s, backoffFactor: r } = e, i =
|
|
2652
|
+
const at = 1, or = (t) => t < at ? at : t, cr = (t, e) => {
|
|
2653
|
+
const { baseBackoffMs: n, maxBackoffMs: s, backoffFactor: r } = e, i = or(t), a = n * r ** (i - 1);
|
|
2648
2654
|
return Math.min(s, a);
|
|
2649
|
-
},
|
|
2655
|
+
}, lr = (t, e, n) => {
|
|
2650
2656
|
if (e === "none")
|
|
2651
2657
|
return t;
|
|
2652
2658
|
if (e === "full")
|
|
2653
2659
|
return n() * t;
|
|
2654
2660
|
const s = t / 2;
|
|
2655
2661
|
return s + n() * s;
|
|
2656
|
-
},
|
|
2657
|
-
const s =
|
|
2658
|
-
return
|
|
2659
|
-
},
|
|
2662
|
+
}, dr = (t, e, n = Math.random) => {
|
|
2663
|
+
const s = cr(t, e);
|
|
2664
|
+
return lr(s, e.jitter, n);
|
|
2665
|
+
}, hr = /* @__PURE__ */ new Set([
|
|
2660
2666
|
Z.causes.CONNECTION_ERROR,
|
|
2661
2667
|
Z.causes.REQUEST_TIMEOUT,
|
|
2662
2668
|
Z.causes.RTP_TIMEOUT,
|
|
2663
2669
|
Z.causes.ADDRESS_INCOMPLETE
|
|
2664
|
-
]),
|
|
2670
|
+
]), ur = (t) => {
|
|
2665
2671
|
const { cause: e, originator: n } = t;
|
|
2666
|
-
return n === "local" ? !1 : !!(
|
|
2667
|
-
},
|
|
2672
|
+
return n === "local" ? !1 : !!(hr.has(e) || e === Z.causes.INTERNAL_ERROR && n === "system");
|
|
2673
|
+
}, gr = (t) => t ?? ur, ot = I("CallReconnectRuntime"), se = {
|
|
2668
2674
|
maxAttempts: 5,
|
|
2669
2675
|
baseBackoffMs: 1e3,
|
|
2670
2676
|
maxBackoffMs: 3e4,
|
|
2671
2677
|
backoffFactor: 2,
|
|
2672
2678
|
jitter: "equal",
|
|
2673
2679
|
waitSignalingTimeoutMs: 2e4
|
|
2674
|
-
},
|
|
2680
|
+
}, Er = (t) => ({
|
|
2675
2681
|
maxAttempts: t?.maxAttempts ?? se.maxAttempts,
|
|
2676
2682
|
baseBackoffMs: t?.baseBackoffMs ?? se.baseBackoffMs,
|
|
2677
2683
|
maxBackoffMs: t?.maxBackoffMs ?? se.maxBackoffMs,
|
|
2678
2684
|
backoffFactor: t?.backoffFactor ?? se.backoffFactor,
|
|
2679
2685
|
jitter: t?.jitter ?? se.jitter,
|
|
2680
2686
|
waitSignalingTimeoutMs: t?.waitSignalingTimeoutMs ?? se.waitSignalingTimeoutMs
|
|
2681
|
-
}),
|
|
2682
|
-
class
|
|
2687
|
+
}), mr = (t) => !0;
|
|
2688
|
+
class Tr {
|
|
2683
2689
|
resolvedOptions;
|
|
2684
2690
|
callManager;
|
|
2685
2691
|
connectionManager;
|
|
@@ -2690,7 +2696,7 @@ class mr {
|
|
|
2690
2696
|
canRetryOnErrorFn;
|
|
2691
2697
|
unsubscribeConnectionWait;
|
|
2692
2698
|
constructor(e) {
|
|
2693
|
-
this.resolvedOptions =
|
|
2699
|
+
this.resolvedOptions = Er(e.options), this.callManager = e.callManager, this.connectionManager = e.connectionManager, this.isNetworkFailureFn = gr(e.options?.isNetworkFailure), this.canRetryOnErrorFn = e.options?.canRetryOnError ?? mr, this.delayRequester = new Mt(this.resolvedOptions.baseBackoffMs), this.performCall = new me(
|
|
2694
2700
|
async (n) => {
|
|
2695
2701
|
const s = await n.getCallParameters();
|
|
2696
2702
|
await this.callManager.startCall(
|
|
@@ -2699,7 +2705,7 @@ class mr {
|
|
|
2699
2705
|
s
|
|
2700
2706
|
);
|
|
2701
2707
|
}
|
|
2702
|
-
), this.attemptsState = new
|
|
2708
|
+
), this.attemptsState = new ar({
|
|
2703
2709
|
limit: this.resolvedOptions.maxAttempts,
|
|
2704
2710
|
onStatusChange: ({ isInProgress: n }) => {
|
|
2705
2711
|
e.emitters.emitStatusChange({ isReconnecting: n });
|
|
@@ -2719,7 +2725,7 @@ class mr {
|
|
|
2719
2725
|
return this.attemptsState.hasLimitReached();
|
|
2720
2726
|
}
|
|
2721
2727
|
computeNextDelayMs(e) {
|
|
2722
|
-
return
|
|
2728
|
+
return dr(e, {
|
|
2723
2729
|
baseBackoffMs: this.resolvedOptions.baseBackoffMs,
|
|
2724
2730
|
maxBackoffMs: this.resolvedOptions.maxBackoffMs,
|
|
2725
2731
|
backoffFactor: this.resolvedOptions.backoffFactor,
|
|
@@ -2767,7 +2773,7 @@ class mr {
|
|
|
2767
2773
|
const pe = (t) => {
|
|
2768
2774
|
if (t !== null && typeof t == "object" && "error" in t)
|
|
2769
2775
|
return t.error;
|
|
2770
|
-
}, _e = I("CallReconnectMachine"),
|
|
2776
|
+
}, _e = I("CallReconnectMachine"), pr = (t) => t.parameters, Sr = (t) => ee({
|
|
2771
2777
|
types: {
|
|
2772
2778
|
context: {},
|
|
2773
2779
|
events: {}
|
|
@@ -2898,17 +2904,17 @@ const pe = (t) => {
|
|
|
2898
2904
|
}
|
|
2899
2905
|
});
|
|
2900
2906
|
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 || {});
|
|
2901
|
-
const
|
|
2907
|
+
const Cr = () => ({
|
|
2902
2908
|
parameters: void 0,
|
|
2903
2909
|
attempt: 0,
|
|
2904
2910
|
nextDelayMs: 0,
|
|
2905
2911
|
lastError: void 0,
|
|
2906
2912
|
lastFailureCause: void 0,
|
|
2907
2913
|
cancelledReason: void 0
|
|
2908
|
-
}),
|
|
2914
|
+
}), Rr = (t) => Sr(t).createMachine({
|
|
2909
2915
|
id: "callReconnect",
|
|
2910
2916
|
initial: v.IDLE,
|
|
2911
|
-
context:
|
|
2917
|
+
context: Cr,
|
|
2912
2918
|
on: {
|
|
2913
2919
|
/**
|
|
2914
2920
|
* Глобальный `RECONNECT.ARM`: из любого состояния возвращает армированный цикл
|
|
@@ -3032,7 +3038,7 @@ const Sr = () => ({
|
|
|
3032
3038
|
invoke: {
|
|
3033
3039
|
id: "performAttempt",
|
|
3034
3040
|
src: "performAttempt",
|
|
3035
|
-
input: ({ context: e }) =>
|
|
3041
|
+
input: ({ context: e }) => pr(e),
|
|
3036
3042
|
onDone: {
|
|
3037
3043
|
target: v.ARMED,
|
|
3038
3044
|
actions: [
|
|
@@ -3077,14 +3083,14 @@ const Sr = () => ({
|
|
|
3077
3083
|
}
|
|
3078
3084
|
}
|
|
3079
3085
|
}
|
|
3080
|
-
}),
|
|
3081
|
-
class
|
|
3086
|
+
}), Nr = I("CallReconnectStateMachine");
|
|
3087
|
+
class Ar extends te {
|
|
3082
3088
|
constructor(e) {
|
|
3083
3089
|
super(e);
|
|
3084
3090
|
}
|
|
3085
3091
|
send(e) {
|
|
3086
3092
|
if (!this.actor.getSnapshot().can(e)) {
|
|
3087
|
-
|
|
3093
|
+
Nr(
|
|
3088
3094
|
`[CallReconnectStateMachine] Invalid transition: ${e.type} from ${String(this.state)}. Event cannot be processed in current state.`
|
|
3089
3095
|
);
|
|
3090
3096
|
return;
|
|
@@ -3092,7 +3098,7 @@ class Nr extends te {
|
|
|
3092
3098
|
super.send(e);
|
|
3093
3099
|
}
|
|
3094
3100
|
}
|
|
3095
|
-
const
|
|
3101
|
+
const Ir = (t) => new Ar(Rr(t)), fr = (t) => {
|
|
3096
3102
|
const { runtime: e, events: n } = t;
|
|
3097
3103
|
return {
|
|
3098
3104
|
isNetworkFailure: (s) => e.isNetworkFailure(s),
|
|
@@ -3165,8 +3171,8 @@ const Ar = (t) => new Nr(Cr(t)), Ir = (t) => {
|
|
|
3165
3171
|
"limit-reached",
|
|
3166
3172
|
"cancelled",
|
|
3167
3173
|
"status-changed"
|
|
3168
|
-
],
|
|
3169
|
-
class
|
|
3174
|
+
], vr = () => new G(Bt), be = I("CallReconnectManager");
|
|
3175
|
+
class Mr extends w {
|
|
3170
3176
|
stateMachine;
|
|
3171
3177
|
runtime;
|
|
3172
3178
|
callManager;
|
|
@@ -3176,7 +3182,7 @@ class vr extends w {
|
|
|
3176
3182
|
callManager: e,
|
|
3177
3183
|
connectionManager: n
|
|
3178
3184
|
}, s) {
|
|
3179
|
-
super(
|
|
3185
|
+
super(vr()), this.callManager = e, this.connectionManager = n, this.runtime = new Tr({
|
|
3180
3186
|
callManager: e,
|
|
3181
3187
|
connectionManager: n,
|
|
3182
3188
|
options: s,
|
|
@@ -3185,8 +3191,8 @@ class vr extends w {
|
|
|
3185
3191
|
this.events.trigger("status-changed", r);
|
|
3186
3192
|
}
|
|
3187
3193
|
}
|
|
3188
|
-
}), this.stateMachine =
|
|
3189
|
-
|
|
3194
|
+
}), this.stateMachine = Ir(
|
|
3195
|
+
fr({ runtime: this.runtime, events: this.events })
|
|
3190
3196
|
), this.subscribeToManagers();
|
|
3191
3197
|
}
|
|
3192
3198
|
get isReconnecting() {
|
|
@@ -3262,34 +3268,33 @@ class vr extends w {
|
|
|
3262
3268
|
);
|
|
3263
3269
|
}
|
|
3264
3270
|
}
|
|
3265
|
-
const
|
|
3266
|
-
Mr,
|
|
3271
|
+
const Or = "incomingCall", _r = "declinedIncomingCall", br = "failedIncomingCall", yr = "terminatedIncomingCall", $t = "connecting", Dr = "connected", Pr = "disconnected", Lr = "newRTCSession", wr = "registered", Gr = "unregistered", kr = "registrationFailed", Fr = "newMessage", Ur = "sipEvent", Br = "availableSecondRemoteStream", $r = "notAvailableSecondRemoteStream", xr = "mustStopPresentation", Vr = "enterRoom", qr = "useLicense", Hr = "peerconnection:confirmed", Wr = "peerconnection:ontrack", Qr = "channels", Yr = "channels:notify", jr = "ended:fromserver", zr = "main-cam-control", Jr = "admin:stop-main-cam", Kr = "admin:start-main-cam", Xr = "admin:stop-mic", Zr = "admin:start-mic", ei = "admin:force-sync-media-state", ti = "participant:added-to-list-moderators", ni = "participant:removed-from-list-moderators", si = "participant:move-request-to-stream", ri = "participant:move-request-to-spectators", ii = "participant:move-request-to-participants", ai = "participation:accepting-word-request", oi = "participation:cancelling-word-request", ci = "webcast:started", li = "webcast:stopped", di = "account:changed", hi = "account:deleted", ui = "conference:participant-token-issued", gi = "ended", Ei = "sending", mi = "reinvite", Ti = "replaces", pi = "refer", Si = "progress", Ci = "accepted", Ri = "confirmed", Ni = "peerconnection", Ai = "failed", Ii = "muted", fi = "unmuted", vi = "newDTMF", Mi = "newInfo", Oi = "hold", _i = "unhold", bi = "update", yi = "sdp", Di = "icecandidate", Pi = "getusermediafailed", Li = "peerconnection:createofferfailed", wi = "peerconnection:createanswerfailed", Gi = "peerconnection:setlocaldescriptionfailed", ki = "peerconnection:setremotedescriptionfailed", Fi = "presentation:start", Ui = "presentation:started", Bi = "presentation:end", $i = "presentation:ended", xi = "presentation:failed", Vi = [
|
|
3267
3272
|
Or,
|
|
3268
|
-
br,
|
|
3269
3273
|
_r,
|
|
3270
|
-
|
|
3274
|
+
yr,
|
|
3275
|
+
br,
|
|
3271
3276
|
ai,
|
|
3272
|
-
ni,
|
|
3273
|
-
Qr,
|
|
3274
|
-
hi,
|
|
3275
|
-
li,
|
|
3276
|
-
di,
|
|
3277
3277
|
oi,
|
|
3278
|
+
si,
|
|
3279
|
+
Yr,
|
|
3280
|
+
ui,
|
|
3281
|
+
di,
|
|
3282
|
+
hi,
|
|
3278
3283
|
ci,
|
|
3279
|
-
|
|
3280
|
-
ti
|
|
3281
|
-
|
|
3284
|
+
li,
|
|
3285
|
+
ti,
|
|
3286
|
+
ni
|
|
3287
|
+
], qi = [
|
|
3282
3288
|
$t,
|
|
3283
|
-
yr,
|
|
3284
3289
|
Dr,
|
|
3285
3290
|
Pr,
|
|
3286
3291
|
Lr,
|
|
3287
3292
|
wr,
|
|
3288
3293
|
Gr,
|
|
3289
3294
|
kr,
|
|
3290
|
-
Fr
|
|
3291
|
-
|
|
3292
|
-
|
|
3295
|
+
Fr,
|
|
3296
|
+
Ur
|
|
3297
|
+
], Hi = [
|
|
3293
3298
|
Br,
|
|
3294
3299
|
$r,
|
|
3295
3300
|
xr,
|
|
@@ -3297,19 +3302,19 @@ const Mr = "incomingCall", Or = "declinedIncomingCall", _r = "failedIncomingCall
|
|
|
3297
3302
|
qr,
|
|
3298
3303
|
Hr,
|
|
3299
3304
|
Wr,
|
|
3300
|
-
|
|
3305
|
+
Qr,
|
|
3301
3306
|
jr,
|
|
3302
|
-
Jr,
|
|
3303
3307
|
zr,
|
|
3304
3308
|
Kr,
|
|
3309
|
+
Jr,
|
|
3305
3310
|
Xr,
|
|
3306
3311
|
Zr,
|
|
3307
|
-
|
|
3308
|
-
ri
|
|
3312
|
+
ei,
|
|
3313
|
+
ri,
|
|
3314
|
+
ii
|
|
3309
3315
|
], Fe = [
|
|
3310
|
-
ui,
|
|
3311
|
-
$t,
|
|
3312
3316
|
gi,
|
|
3317
|
+
$t,
|
|
3313
3318
|
Ei,
|
|
3314
3319
|
mi,
|
|
3315
3320
|
Ti,
|
|
@@ -3336,15 +3341,16 @@ const Mr = "incomingCall", Or = "declinedIncomingCall", _r = "failedIncomingCall
|
|
|
3336
3341
|
Fi,
|
|
3337
3342
|
Ui,
|
|
3338
3343
|
Bi,
|
|
3339
|
-
$i
|
|
3344
|
+
$i,
|
|
3345
|
+
xi
|
|
3340
3346
|
];
|
|
3341
|
-
[...
|
|
3347
|
+
[...qi, ...Vi];
|
|
3342
3348
|
[
|
|
3343
3349
|
...Fe,
|
|
3344
|
-
...
|
|
3350
|
+
...Hi
|
|
3345
3351
|
];
|
|
3346
|
-
const
|
|
3347
|
-
class
|
|
3352
|
+
const Wi = I("BaseSession.mock");
|
|
3353
|
+
class Qi {
|
|
3348
3354
|
originator;
|
|
3349
3355
|
connection;
|
|
3350
3356
|
events;
|
|
@@ -3454,7 +3460,7 @@ class Wi {
|
|
|
3454
3460
|
return this.events.off(e, n), this;
|
|
3455
3461
|
}
|
|
3456
3462
|
removeAllListeners(e) {
|
|
3457
|
-
return
|
|
3463
|
+
return Wi("Method not implemented. Event:", e), this;
|
|
3458
3464
|
}
|
|
3459
3465
|
setMaxListeners(e) {
|
|
3460
3466
|
throw new Error("Method not implemented.");
|
|
@@ -3574,7 +3580,7 @@ class lt {
|
|
|
3574
3580
|
stop() {
|
|
3575
3581
|
}
|
|
3576
3582
|
}
|
|
3577
|
-
class
|
|
3583
|
+
class Yi extends EventTarget {
|
|
3578
3584
|
senders = [];
|
|
3579
3585
|
receivers = [];
|
|
3580
3586
|
canTrickleIceCandidates;
|
|
@@ -3682,7 +3688,7 @@ class Qi extends EventTarget {
|
|
|
3682
3688
|
}), this.dispatchEvent(s);
|
|
3683
3689
|
}
|
|
3684
3690
|
}
|
|
3685
|
-
function
|
|
3691
|
+
function ji(t) {
|
|
3686
3692
|
const e = t.match(/(purgatory)|[\d.]+/g);
|
|
3687
3693
|
if (!e)
|
|
3688
3694
|
throw new Error("wrong sip url");
|
|
@@ -3720,7 +3726,7 @@ const Vt = [
|
|
|
3720
3726
|
"peerconnection:createanswerfailed",
|
|
3721
3727
|
"peerconnection:setlocaldescriptionfailed",
|
|
3722
3728
|
"peerconnection:setremotedescriptionfailed"
|
|
3723
|
-
],
|
|
3729
|
+
], zi = [
|
|
3724
3730
|
"start-call",
|
|
3725
3731
|
"end-call",
|
|
3726
3732
|
"peerconnection:confirmed",
|
|
@@ -3734,9 +3740,9 @@ const Vt = [
|
|
|
3734
3740
|
"recv-quality-changed"
|
|
3735
3741
|
], qt = [
|
|
3736
3742
|
...Vt,
|
|
3737
|
-
...
|
|
3738
|
-
],
|
|
3739
|
-
class H extends
|
|
3743
|
+
...zi
|
|
3744
|
+
], Ji = () => new G(qt), dt = 400, Ki = "777", Xi = (t) => t.getVideoTracks().length > 0;
|
|
3745
|
+
class H extends Qi {
|
|
3740
3746
|
static presentationError;
|
|
3741
3747
|
static startPresentationError;
|
|
3742
3748
|
static countStartPresentationError = Number.POSITIVE_INFINITY;
|
|
@@ -3828,16 +3834,16 @@ class H extends Wi {
|
|
|
3828
3834
|
const n = On();
|
|
3829
3835
|
n.id = "mainaudio1";
|
|
3830
3836
|
const s = [n];
|
|
3831
|
-
if (
|
|
3837
|
+
if (Xi(e)) {
|
|
3832
3838
|
const i = _n();
|
|
3833
3839
|
i.id = "mainvideo1", s.push(i);
|
|
3834
3840
|
}
|
|
3835
|
-
this.connection = new
|
|
3841
|
+
this.connection = new Yi(void 0, s), this.trigger("peerconnection", { peerconnection: this.connection }), this.addStream(e);
|
|
3836
3842
|
}
|
|
3837
3843
|
connect(e, { mediaStream: n } = {}) {
|
|
3838
|
-
const s =
|
|
3844
|
+
const s = ji(e);
|
|
3839
3845
|
return this.initPeerconnection(n), this.timeoutConnect = setTimeout(() => {
|
|
3840
|
-
e.includes(
|
|
3846
|
+
e.includes(Ki) ? this.trigger("failed", {
|
|
3841
3847
|
originator: "remote",
|
|
3842
3848
|
message: "IncomingResponse",
|
|
3843
3849
|
cause: "Rejected"
|
|
@@ -3915,21 +3921,21 @@ class H extends Wi {
|
|
|
3915
3921
|
clearTimeout(this.timeoutStartPresentation), clearTimeout(this.timeoutConnect), clearTimeout(this.timeoutNewInfo), clearTimeout(this.timeoutAccepted), clearTimeout(this.timeoutConfirmed);
|
|
3916
3922
|
}
|
|
3917
3923
|
}
|
|
3918
|
-
const
|
|
3924
|
+
const Zi = ["snapshot-changed"], ea = () => new G(Zi), ta = (t) => t.type === "participant", Ee = (t) => t.type === "spectator_synthetic", Y = (t) => t.type === "spectator", na = (t, e) => Y(t) && !Y(e), sa = (t, e) => Y(e), ra = (t, e) => {
|
|
3919
3925
|
const n = Y(t) || Ee(t), s = Y(e) || Ee(e);
|
|
3920
3926
|
return n && !s;
|
|
3921
|
-
},
|
|
3927
|
+
}, ia = (t, e) => {
|
|
3922
3928
|
const n = Y(t) || Ee(t), s = Y(e) || Ee(e);
|
|
3923
3929
|
return !n && s;
|
|
3924
3930
|
}, ye = {
|
|
3925
3931
|
type: "participant"
|
|
3926
|
-
},
|
|
3932
|
+
}, aa = {
|
|
3927
3933
|
type: "spectator_synthetic"
|
|
3928
|
-
},
|
|
3934
|
+
}, oa = (t) => ({
|
|
3929
3935
|
type: "spectator",
|
|
3930
3936
|
recvParams: t
|
|
3931
3937
|
});
|
|
3932
|
-
class
|
|
3938
|
+
class ca {
|
|
3933
3939
|
role = ye;
|
|
3934
3940
|
isAvailableSendingMedia = !0;
|
|
3935
3941
|
onRoleChanged;
|
|
@@ -3947,10 +3953,10 @@ class oa {
|
|
|
3947
3953
|
this.isAvailableSendingMedia = !0, this.changeRole(ye);
|
|
3948
3954
|
}
|
|
3949
3955
|
setCallRoleSpectatorSynthetic(e = !0) {
|
|
3950
|
-
this.isAvailableSendingMedia = e, this.changeRole(
|
|
3956
|
+
this.isAvailableSendingMedia = e, this.changeRole(aa);
|
|
3951
3957
|
}
|
|
3952
3958
|
setCallRoleSpectator(e, n = !0) {
|
|
3953
|
-
this.isAvailableSendingMedia = n, this.changeRole(
|
|
3959
|
+
this.isAvailableSendingMedia = n, this.changeRole(oa(e));
|
|
3954
3960
|
}
|
|
3955
3961
|
changeRole(e) {
|
|
3956
3962
|
const n = this.role;
|
|
@@ -3964,7 +3970,7 @@ class oa {
|
|
|
3964
3970
|
this.role = ye, this.isAvailableSendingMedia = !0;
|
|
3965
3971
|
}
|
|
3966
3972
|
hasParticipant() {
|
|
3967
|
-
return
|
|
3973
|
+
return ta(this.role);
|
|
3968
3974
|
}
|
|
3969
3975
|
hasSpectatorSynthetic() {
|
|
3970
3976
|
return Ee(this.role);
|
|
@@ -3984,7 +3990,7 @@ class oa {
|
|
|
3984
3990
|
});
|
|
3985
3991
|
}
|
|
3986
3992
|
}
|
|
3987
|
-
const
|
|
3993
|
+
const la = (t, e) => t.type !== e.type ? !1 : t.type !== "spectator" ? !0 : e.type === "spectator" && t.recvParams.audioId === e.recvParams.audioId, da = (t, e) => t.license === e.license && t.isDuplexSendingMediaMode === e.isDuplexSendingMediaMode && la(t.role, e.role) && t.derived.isAvailableSendingMedia === e.derived.isAvailableSendingMedia, ht = (t, e, n) => {
|
|
3988
3994
|
const s = t.getRole(), r = s.type === "spectator" || s.type === "spectator_synthetic";
|
|
3989
3995
|
return {
|
|
3990
3996
|
license: n,
|
|
@@ -3997,15 +4003,15 @@ const ca = (t, e) => t.type !== e.type ? !1 : t.type !== "spectator" ? !0 : e.ty
|
|
|
3997
4003
|
}
|
|
3998
4004
|
};
|
|
3999
4005
|
}, ut = Ye.VIDEO;
|
|
4000
|
-
class
|
|
4001
|
-
roleManager = new
|
|
4006
|
+
class ha extends w {
|
|
4007
|
+
roleManager = new ca();
|
|
4002
4008
|
license = ut;
|
|
4003
4009
|
isDuplexSendingMediaMode = !1;
|
|
4004
4010
|
currentSnapshot;
|
|
4005
4011
|
subscriptions = [];
|
|
4006
4012
|
dedupedTotal = 0;
|
|
4007
4013
|
constructor() {
|
|
4008
|
-
super(
|
|
4014
|
+
super(ea()), this.currentSnapshot = ht(
|
|
4009
4015
|
this.roleManager,
|
|
4010
4016
|
this.isDuplexSendingMediaMode,
|
|
4011
4017
|
this.license
|
|
@@ -4072,7 +4078,7 @@ class da extends w {
|
|
|
4072
4078
|
}
|
|
4073
4079
|
notifySubscribers = () => {
|
|
4074
4080
|
const { previousSnapshot: e, currentSnapshot: n } = this.updateCurrentSnapshot();
|
|
4075
|
-
if (
|
|
4081
|
+
if (da(e, n)) {
|
|
4076
4082
|
this.dedupedTotal += 1;
|
|
4077
4083
|
return;
|
|
4078
4084
|
}
|
|
@@ -4099,10 +4105,10 @@ class da extends w {
|
|
|
4099
4105
|
this.isDuplexSendingMediaMode = e, this.notifySubscribers();
|
|
4100
4106
|
};
|
|
4101
4107
|
}
|
|
4102
|
-
const
|
|
4108
|
+
const ua = (t, e) => {
|
|
4103
4109
|
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;
|
|
4104
4110
|
return r || i || a;
|
|
4105
|
-
},
|
|
4111
|
+
}, ga = (t) => t.major !== void 0 && t.minor !== void 0 && t.patch !== void 0, Ea = (t) => (e) => ga(t) && ua(t, e), ma = (t = "") => {
|
|
4106
4112
|
const e = t.split(".");
|
|
4107
4113
|
if (e.length <= 1)
|
|
4108
4114
|
return {
|
|
@@ -4112,10 +4118,10 @@ const ha = (t, e) => {
|
|
|
4112
4118
|
};
|
|
4113
4119
|
const [n, s, r] = e.map((i) => Number.parseInt(i, 10));
|
|
4114
4120
|
return { major: n, minor: s, patch: r };
|
|
4115
|
-
},
|
|
4116
|
-
const t = new wn(), { name: e, version: n } = t.getBrowser(), { name: s } = t.getOS(), { type: r } = t.getDevice(), i =
|
|
4121
|
+
}, Ta = () => globalThis.process?.versions?.electron !== void 0, Ht = () => {
|
|
4122
|
+
const t = new wn(), { name: e, version: n } = t.getBrowser(), { name: s } = t.getOS(), { type: r } = t.getDevice(), i = Ta(), a = r === "mobile", o = ma(n);
|
|
4117
4123
|
return {
|
|
4118
|
-
hasGreaterThanBrowserVersion:
|
|
4124
|
+
hasGreaterThanBrowserVersion: Ea(o),
|
|
4119
4125
|
isMobileDevice: a,
|
|
4120
4126
|
isChrome: e === "Chrome" || i,
|
|
4121
4127
|
isYandexBrowser: e === "Yandex",
|
|
@@ -4123,15 +4129,15 @@ const ha = (t, e) => {
|
|
|
4123
4129
|
isOpera: e === "Opera",
|
|
4124
4130
|
isWindows: s === "Windows"
|
|
4125
4131
|
};
|
|
4126
|
-
},
|
|
4132
|
+
}, pa = I("stringifyMessage"), Il = (t) => {
|
|
4127
4133
|
let e = "";
|
|
4128
4134
|
try {
|
|
4129
4135
|
e = JSON.stringify(t);
|
|
4130
4136
|
} catch (n) {
|
|
4131
|
-
|
|
4137
|
+
pa("failed to stringify message", n);
|
|
4132
4138
|
}
|
|
4133
4139
|
return e;
|
|
4134
|
-
},
|
|
4140
|
+
}, Sa = /^p2p.+to.+$/i, Ue = (t) => t !== void 0 && t.length > 0 && Sa.test(t), Ca = "purgatory", fe = (t) => t === Ca, Ra = (t, e) => {
|
|
4135
4141
|
t.getVideoTracks().forEach((s) => {
|
|
4136
4142
|
"contentHint" in s && s.contentHint !== e && (s.contentHint = e);
|
|
4137
4143
|
});
|
|
@@ -4143,8 +4149,8 @@ const ha = (t, e) => {
|
|
|
4143
4149
|
if (!t || e === "recvonly" && n === "recvonly")
|
|
4144
4150
|
return;
|
|
4145
4151
|
const r = n === "recvonly" ? [] : t.getAudioTracks(), i = e === "recvonly" ? [] : t.getVideoTracks(), a = [...r, ...i], o = new MediaStream(a);
|
|
4146
|
-
return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" &&
|
|
4147
|
-
},
|
|
4152
|
+
return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" && Ra(o, s), o;
|
|
4153
|
+
}, Na = "api/v2/rtp2webrtc/offer", Aa = async ({
|
|
4148
4154
|
serverUrl: t,
|
|
4149
4155
|
conferenceNumber: e,
|
|
4150
4156
|
quality: n,
|
|
@@ -4153,7 +4159,7 @@ const ha = (t, e) => {
|
|
|
4153
4159
|
token: i
|
|
4154
4160
|
}) => {
|
|
4155
4161
|
const a = new URL(
|
|
4156
|
-
`https://${t.replace(/\/$/, "")}/${
|
|
4162
|
+
`https://${t.replace(/\/$/, "")}/${Na}/${encodeURIComponent(e)}`
|
|
4157
4163
|
);
|
|
4158
4164
|
a.searchParams.set("quality", n), a.searchParams.set("audio", String(s));
|
|
4159
4165
|
const o = {
|
|
@@ -4175,39 +4181,39 @@ const ha = (t, e) => {
|
|
|
4175
4181
|
return g;
|
|
4176
4182
|
}
|
|
4177
4183
|
};
|
|
4178
|
-
},
|
|
4184
|
+
}, Ia = (t, e) => (t.degradationPreference = e.degradationPreference, t), fa = (t, e) => {
|
|
4179
4185
|
t.encodings ??= [];
|
|
4180
4186
|
for (let n = t.encodings.length; n < e; n += 1)
|
|
4181
4187
|
t.encodings.push({});
|
|
4182
4188
|
return t;
|
|
4183
|
-
}, Wt = (t) => (e, n) => n !== void 0 && e !== n || n === void 0 && e !== t,
|
|
4184
|
-
if (
|
|
4189
|
+
}, Wt = (t) => (e, n) => n !== void 0 && e !== n || n === void 0 && e !== t, va = Wt(), Ma = (t, e) => {
|
|
4190
|
+
if (va(t, e))
|
|
4185
4191
|
return t;
|
|
4186
|
-
},
|
|
4187
|
-
const s = t.maxBitrate, r =
|
|
4192
|
+
}, Oa = (t, e, { isResetAllowed: n = !1 } = {}) => {
|
|
4193
|
+
const s = t.maxBitrate, r = Ma(e, s);
|
|
4188
4194
|
return (r !== void 0 || n) && (t.maxBitrate = r ?? e), t;
|
|
4189
|
-
}, Qt = 1,
|
|
4195
|
+
}, Qt = 1, _a = Wt(
|
|
4190
4196
|
Qt
|
|
4191
|
-
),
|
|
4197
|
+
), ba = (t, e) => {
|
|
4192
4198
|
const n = t === void 0 ? void 0 : Math.max(t, Qt);
|
|
4193
|
-
if (n !== void 0 &&
|
|
4199
|
+
if (n !== void 0 && _a(
|
|
4194
4200
|
n,
|
|
4195
4201
|
e
|
|
4196
4202
|
))
|
|
4197
4203
|
return n;
|
|
4198
|
-
},
|
|
4199
|
-
const n = t.scaleResolutionDownBy, s =
|
|
4204
|
+
}, ya = (t, e) => {
|
|
4205
|
+
const n = t.scaleResolutionDownBy, s = ba(
|
|
4200
4206
|
e,
|
|
4201
4207
|
n
|
|
4202
4208
|
);
|
|
4203
4209
|
return s !== void 0 && (t.scaleResolutionDownBy = s), t;
|
|
4204
|
-
},
|
|
4210
|
+
}, Da = (t, e, { isResetAllowed: n } = {}) => {
|
|
4205
4211
|
const s = e.encodings?.length ?? 0;
|
|
4206
|
-
return
|
|
4212
|
+
return fa(t, s), t.encodings.forEach((r, i) => {
|
|
4207
4213
|
const a = (e?.encodings ?? [])[i], o = a?.maxBitrate, c = a?.scaleResolutionDownBy;
|
|
4208
|
-
|
|
4214
|
+
Oa(r, o, { isResetAllowed: n }), ya(r, c);
|
|
4209
4215
|
}), t;
|
|
4210
|
-
},
|
|
4216
|
+
}, Pa = (t, e) => {
|
|
4211
4217
|
if (t.codecs?.length !== e.codecs?.length)
|
|
4212
4218
|
return !0;
|
|
4213
4219
|
for (let n = 0; n < (t.codecs?.length ?? 0); n++)
|
|
@@ -4228,8 +4234,8 @@ const ha = (t, e) => {
|
|
|
4228
4234
|
const s = t.getParameters(), r = JSON.parse(
|
|
4229
4235
|
JSON.stringify(s)
|
|
4230
4236
|
);
|
|
4231
|
-
|
|
4232
|
-
const i =
|
|
4237
|
+
Da(s, e, { isResetAllowed: n }), Ia(s, e);
|
|
4238
|
+
const i = Pa(r, s);
|
|
4233
4239
|
return i && await t.setParameters(s), { parameters: s, isChanged: i };
|
|
4234
4240
|
}, Yt = async (t, e, n) => {
|
|
4235
4241
|
const { isChanged: s, parameters: r } = await Be(t, {
|
|
@@ -4241,12 +4247,12 @@ const ha = (t, e) => {
|
|
|
4241
4247
|
]
|
|
4242
4248
|
});
|
|
4243
4249
|
return s && n && n(r), { isChanged: s, parameters: r };
|
|
4244
|
-
},
|
|
4245
|
-
const s =
|
|
4250
|
+
}, La = (t, e) => t.find((n) => n.track !== null && e.getTracks().includes(n.track)), wa = async (t, e, n) => {
|
|
4251
|
+
const s = La(t, e);
|
|
4246
4252
|
if (s)
|
|
4247
4253
|
return Yt(s, { maxBitrate: n });
|
|
4248
|
-
},
|
|
4249
|
-
class
|
|
4254
|
+
}, Ga = I("resolveOnStartMainCam"), fl = (t) => (n) => (Ga("onStartMainCam"), t.on("api:admin:start-main-cam", n)), ka = I("resolveOnStartMic"), vl = (t) => (n) => (ka("onStartMic"), t.on("api:admin:start-mic", n)), Fa = I("resolveOnStopMainCam"), Ml = (t) => (n) => (Fa("onStopMainCam"), t.on("api:admin:stop-main-cam", n)), Ua = I("resolveOnStopMic"), Ol = (t) => (n) => (Ua("onStopMic"), t.on("api:admin:stop-mic", n));
|
|
4255
|
+
class Ba {
|
|
4250
4256
|
command = void 0;
|
|
4251
4257
|
unsubscribe;
|
|
4252
4258
|
options;
|
|
@@ -4267,9 +4273,9 @@ var u = /* @__PURE__ */ ((t) => (t.IDLE = "call:idle", t.CONNECTING = "call:conn
|
|
|
4267
4273
|
const jt = {
|
|
4268
4274
|
raw: {},
|
|
4269
4275
|
state: {}
|
|
4270
|
-
}, zt = (t) => "number" in t &&
|
|
4276
|
+
}, zt = (t) => "number" in t && x(t.number) && Pt(t.answer), Jt = (t) => "room" in t && x(t.room) && x(t.participantName) && ke(t.startedTimestamp), $a = (t) => "token" in t && x(t.token), Kt = (t) => $a(t) && "conferenceForToken" in t && x(t.conferenceForToken), he = (t) => zt(t) && Jt(t), Xt = (t) => !Kt(t) || !Jt(t) ? !1 : t.conferenceForToken === t.room, Zt = ({
|
|
4271
4277
|
isDirectPeerToPeer: t
|
|
4272
|
-
}) => t === !0, De = (t) => "isDirectPeerToPeer" in t && Zt(t),
|
|
4278
|
+
}) => t === !0, De = (t) => "isDirectPeerToPeer" in t && Zt(t), xa = "x-vinteo-presentation-call: yes", Va = (t) => Vn(t) && t.some((e) => e.trim().toLowerCase() === xa), qa = (t) => "extraHeaders" in t && Va(t.extraHeaders) && "isConfirmed" in t && t.isConfirmed === !0, Se = (t) => he(t) && !fe(t.room) && Kt(t) && Xt(t), le = (t) => {
|
|
4273
4279
|
const e = t;
|
|
4274
4280
|
return {
|
|
4275
4281
|
number: e.number,
|
|
@@ -4291,7 +4297,7 @@ const jt = {
|
|
|
4291
4297
|
}
|
|
4292
4298
|
},
|
|
4293
4299
|
[u.PRESENTATION_CALL]: {
|
|
4294
|
-
guard:
|
|
4300
|
+
guard: qa,
|
|
4295
4301
|
buildContext: (t) => {
|
|
4296
4302
|
const { number: e, answer: n, startedTimestamp: s } = t;
|
|
4297
4303
|
return { number: e, answer: n, startedTimestamp: s };
|
|
@@ -4326,7 +4332,7 @@ const jt = {
|
|
|
4326
4332
|
guard: (t) => t.pendingDisconnect === !0,
|
|
4327
4333
|
buildContext: () => ({})
|
|
4328
4334
|
}
|
|
4329
|
-
},
|
|
4335
|
+
}, Ha = (t) => fe(t.room) || Ue(t.room) || Zt(t), Pe = () => ({}), Wa = () => ee({
|
|
4330
4336
|
types: {
|
|
4331
4337
|
context: jt,
|
|
4332
4338
|
events: {}
|
|
@@ -4347,7 +4353,7 @@ const jt = {
|
|
|
4347
4353
|
room: t.room,
|
|
4348
4354
|
participantName: t.participantName
|
|
4349
4355
|
};
|
|
4350
|
-
|
|
4356
|
+
x(t.token) ? (n.token = t.token, n.conferenceForToken = t.room) : Ha(t) && (n.token = void 0, n.conferenceForToken = void 0), Pt(t.isDirectPeerToPeer) && (n.isDirectPeerToPeer = t.isDirectPeerToPeer);
|
|
4351
4357
|
const r = e.raw.startedTimestamp, i = ke(r) ? r : Date.now();
|
|
4352
4358
|
return {
|
|
4353
4359
|
raw: {
|
|
@@ -4385,7 +4391,7 @@ const jt = {
|
|
|
4385
4391
|
}
|
|
4386
4392
|
}))
|
|
4387
4393
|
}
|
|
4388
|
-
}),
|
|
4394
|
+
}), Qa = () => Wa().createMachine({
|
|
4389
4395
|
id: "call",
|
|
4390
4396
|
initial: u.IDLE,
|
|
4391
4397
|
context: jt,
|
|
@@ -4592,11 +4598,11 @@ const jt = {
|
|
|
4592
4598
|
}
|
|
4593
4599
|
}
|
|
4594
4600
|
});
|
|
4595
|
-
function
|
|
4601
|
+
function Ya(t) {
|
|
4596
4602
|
return t !== M;
|
|
4597
4603
|
}
|
|
4598
|
-
const
|
|
4599
|
-
class
|
|
4604
|
+
const ja = I("CallStateMachine");
|
|
4605
|
+
class za extends te {
|
|
4600
4606
|
constructor(e, n) {
|
|
4601
4607
|
super(e), this.subscribeToEvents(n);
|
|
4602
4608
|
}
|
|
@@ -4739,7 +4745,7 @@ class ja extends te {
|
|
|
4739
4745
|
(o !== a.token || c !== a.conferenceForToken) && (n = a, e(a));
|
|
4740
4746
|
return;
|
|
4741
4747
|
}
|
|
4742
|
-
|
|
4748
|
+
Ya(r.value) && (n = void 0);
|
|
4743
4749
|
});
|
|
4744
4750
|
return () => {
|
|
4745
4751
|
s.unsubscribe();
|
|
@@ -4750,7 +4756,7 @@ class ja extends te {
|
|
|
4750
4756
|
}
|
|
4751
4757
|
send(e) {
|
|
4752
4758
|
if (!this.actor.getSnapshot().can(e)) {
|
|
4753
|
-
|
|
4759
|
+
ja(
|
|
4754
4760
|
`[CallStateMachine] Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`
|
|
4755
4761
|
);
|
|
4756
4762
|
return;
|
|
@@ -4806,15 +4812,15 @@ class ja extends te {
|
|
|
4806
4812
|
);
|
|
4807
4813
|
}
|
|
4808
4814
|
}
|
|
4809
|
-
const
|
|
4810
|
-
class
|
|
4815
|
+
const Ja = (t) => new za(Qa(), t), Ka = (t) => [...t.keys()].map((e) => t.get(e)), Xa = (t, e) => Ka(t).find((n) => n?.type === e), en = async (t) => t.getStats().then((e) => Xa(e, "codec")?.mimeType);
|
|
4816
|
+
class Za {
|
|
4811
4817
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
4812
4818
|
async getCodecFromSender(e) {
|
|
4813
4819
|
return await en(e) ?? "";
|
|
4814
4820
|
}
|
|
4815
4821
|
}
|
|
4816
|
-
const
|
|
4817
|
-
class
|
|
4822
|
+
const eo = I("TaskQueue");
|
|
4823
|
+
class to {
|
|
4818
4824
|
stackPromises = bt({
|
|
4819
4825
|
noRunIsNotActual: !0
|
|
4820
4826
|
});
|
|
@@ -4835,15 +4841,15 @@ class eo {
|
|
|
4835
4841
|
*/
|
|
4836
4842
|
async run() {
|
|
4837
4843
|
return this.stackPromises().catch((e) => {
|
|
4838
|
-
|
|
4844
|
+
eo("TaskQueue: error", e);
|
|
4839
4845
|
});
|
|
4840
4846
|
}
|
|
4841
4847
|
}
|
|
4842
|
-
class
|
|
4848
|
+
class no {
|
|
4843
4849
|
taskQueue;
|
|
4844
4850
|
onSetParameters;
|
|
4845
4851
|
constructor(e) {
|
|
4846
|
-
this.onSetParameters = e, this.taskQueue = new
|
|
4852
|
+
this.onSetParameters = e, this.taskQueue = new to();
|
|
4847
4853
|
}
|
|
4848
4854
|
async setEncodingsToSender(e, n) {
|
|
4849
4855
|
return this.taskQueue.add(async () => Yt(e, n, this.onSetParameters));
|
|
@@ -4852,17 +4858,17 @@ class to {
|
|
|
4852
4858
|
this.taskQueue.stop();
|
|
4853
4859
|
}
|
|
4854
4860
|
}
|
|
4855
|
-
const $e = (t, e) => t !== void 0 && e !== void 0 && t.toLowerCase().includes(e.toLowerCase()),
|
|
4856
|
-
const n =
|
|
4861
|
+
const $e = (t, e) => t !== void 0 && e !== void 0 && t.toLowerCase().includes(e.toLowerCase()), so = 1e6, Q = (t) => t * so, tn = Q(0.06), nn = Q(4), ro = (t) => t <= 64 ? tn : 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) : nn, io = "av1", ao = (t) => $e(t, io), oo = 0.6, je = (t, e) => ao(e) ? t * oo : t, sn = (t) => je(tn, t), rn = (t) => je(nn, t), gt = (t, e) => {
|
|
4862
|
+
const n = ro(t);
|
|
4857
4863
|
return je(n, e);
|
|
4858
|
-
}, Le = 1,
|
|
4864
|
+
}, Le = 1, co = ({
|
|
4859
4865
|
videoTrack: t,
|
|
4860
4866
|
targetSize: e
|
|
4861
4867
|
}) => {
|
|
4862
4868
|
const n = t.getSettings(), s = n.width, r = n.height, i = s === void 0 ? Le : s / e.width, a = r === void 0 ? Le : r / e.height;
|
|
4863
4869
|
return Math.max(i, a, Le);
|
|
4864
4870
|
};
|
|
4865
|
-
class
|
|
4871
|
+
class lo {
|
|
4866
4872
|
ignoreForCodec;
|
|
4867
4873
|
senderFinder;
|
|
4868
4874
|
codecProvider;
|
|
@@ -4934,14 +4940,14 @@ class co {
|
|
|
4934
4940
|
async processSender(e, n) {
|
|
4935
4941
|
const { mainCam: s, resolutionMainCam: r } = e;
|
|
4936
4942
|
switch (s) {
|
|
4937
|
-
case
|
|
4943
|
+
case $.PAUSE_MAIN_CAM:
|
|
4938
4944
|
return this.downgradeResolutionSender(n);
|
|
4939
|
-
case
|
|
4945
|
+
case $.RESUME_MAIN_CAM:
|
|
4940
4946
|
return this.setBitrateByTrackResolution(n);
|
|
4941
|
-
case
|
|
4947
|
+
case $.MAX_MAIN_CAM_RESOLUTION:
|
|
4942
4948
|
return r !== void 0 ? this.setResolutionSender(r, n) : this.setBitrateByTrackResolution(n);
|
|
4943
|
-
case
|
|
4944
|
-
case
|
|
4949
|
+
case $.ADMIN_STOP_MAIN_CAM:
|
|
4950
|
+
case $.ADMIN_START_MAIN_CAM:
|
|
4945
4951
|
case void 0:
|
|
4946
4952
|
return this.setBitrateByTrackResolution(n);
|
|
4947
4953
|
default:
|
|
@@ -4982,7 +4988,7 @@ class co {
|
|
|
4982
4988
|
const [s, r] = e.split("x"), { sender: i, videoTrack: a, codec: o } = n, c = {
|
|
4983
4989
|
width: Number(s),
|
|
4984
4990
|
height: Number(r)
|
|
4985
|
-
}, g =
|
|
4991
|
+
}, g = co({
|
|
4986
4992
|
videoTrack: a,
|
|
4987
4993
|
targetSize: c
|
|
4988
4994
|
}), C = gt(c.width, o), f = {
|
|
@@ -4992,14 +4998,14 @@ class co {
|
|
|
4992
4998
|
return this.parametersSetter.setEncodingsToSender(i, f);
|
|
4993
4999
|
}
|
|
4994
5000
|
}
|
|
4995
|
-
const
|
|
4996
|
-
class
|
|
5001
|
+
const ho = (t) => t.find((e) => e.track?.kind === "video");
|
|
5002
|
+
class uo {
|
|
4997
5003
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
4998
5004
|
findVideoSender(e) {
|
|
4999
|
-
return
|
|
5005
|
+
return ho(e);
|
|
5000
5006
|
}
|
|
5001
5007
|
}
|
|
5002
|
-
class
|
|
5008
|
+
class go {
|
|
5003
5009
|
currentSender;
|
|
5004
5010
|
originalReplaceTrack;
|
|
5005
5011
|
lastWidth;
|
|
@@ -5063,7 +5069,7 @@ class uo {
|
|
|
5063
5069
|
this.setTimeoutRequest.cancelRequest(), this.lastWidth = void 0, this.lastHeight = void 0;
|
|
5064
5070
|
}
|
|
5065
5071
|
}
|
|
5066
|
-
class
|
|
5072
|
+
class Eo {
|
|
5067
5073
|
apiManager;
|
|
5068
5074
|
currentHandler;
|
|
5069
5075
|
constructor(e) {
|
|
@@ -5084,7 +5090,7 @@ class go {
|
|
|
5084
5090
|
}
|
|
5085
5091
|
}
|
|
5086
5092
|
const we = I("VideoSendingBalancer");
|
|
5087
|
-
class
|
|
5093
|
+
class mo {
|
|
5088
5094
|
eventHandler;
|
|
5089
5095
|
senderBalancer;
|
|
5090
5096
|
parametersSetterWithQueue;
|
|
@@ -5096,16 +5102,16 @@ class Eo {
|
|
|
5096
5102
|
onSetParameters: r,
|
|
5097
5103
|
pollIntervalMs: i
|
|
5098
5104
|
} = {}) {
|
|
5099
|
-
this.getConnection = n, this.eventHandler = new
|
|
5105
|
+
this.getConnection = n, this.eventHandler = new Eo(e), this.parametersSetterWithQueue = new no(r), this.senderBalancer = new lo(
|
|
5100
5106
|
{
|
|
5101
|
-
senderFinder: new
|
|
5102
|
-
codecProvider: new
|
|
5107
|
+
senderFinder: new uo(),
|
|
5108
|
+
codecProvider: new Za(),
|
|
5103
5109
|
parametersSetter: this.parametersSetterWithQueue
|
|
5104
5110
|
},
|
|
5105
5111
|
{
|
|
5106
5112
|
ignoreForCodec: s
|
|
5107
5113
|
}
|
|
5108
|
-
), this.trackMonitor = new
|
|
5114
|
+
), this.trackMonitor = new go({ pollIntervalMs: i });
|
|
5109
5115
|
}
|
|
5110
5116
|
/**
|
|
5111
5117
|
* Подписывается на события управления главной камерой
|
|
@@ -5159,8 +5165,8 @@ class Eo {
|
|
|
5159
5165
|
});
|
|
5160
5166
|
};
|
|
5161
5167
|
}
|
|
5162
|
-
const
|
|
5163
|
-
class
|
|
5168
|
+
const To = 6e3, po = 52e4, Ce = (t, e) => t.getSenders().filter((n) => n.track?.kind === e), So = (t, e) => t === "audio" ? To : sn(e), Co = (t) => t.track !== null;
|
|
5169
|
+
class Ro {
|
|
5164
5170
|
previousBitrates = /* @__PURE__ */ new Map();
|
|
5165
5171
|
/**
|
|
5166
5172
|
* Устанавливает минимальный битрейт для указанных типов потоков
|
|
@@ -5172,14 +5178,14 @@ class Co {
|
|
|
5172
5178
|
if (!e)
|
|
5173
5179
|
return;
|
|
5174
5180
|
(n === "audio" || n === "all") && s.push(...Ce(e, "audio")), (n === "video" || n === "all") && s.push(...Ce(e, "video"));
|
|
5175
|
-
const r = s.filter(
|
|
5181
|
+
const r = s.filter(Co).map(async (i) => {
|
|
5176
5182
|
const a = i.getParameters();
|
|
5177
5183
|
this.saveCurrentBitrate(i, a);
|
|
5178
5184
|
const o = {
|
|
5179
5185
|
...a,
|
|
5180
5186
|
encodings: a.encodings.map((c) => ({
|
|
5181
5187
|
...c,
|
|
5182
|
-
maxBitrate:
|
|
5188
|
+
maxBitrate: So(i.track.kind)
|
|
5183
5189
|
}))
|
|
5184
5190
|
};
|
|
5185
5191
|
await Be(i, o);
|
|
@@ -5202,7 +5208,7 @@ class Co {
|
|
|
5202
5208
|
const o = i.getParameters(), c = i.track?.kind === "video", g = c ? await en(i) : void 0, C = {
|
|
5203
5209
|
...o,
|
|
5204
5210
|
encodings: a.map((f) => {
|
|
5205
|
-
const y = c ? rn(g) :
|
|
5211
|
+
const y = c ? rn(g) : po;
|
|
5206
5212
|
return {
|
|
5207
5213
|
...f,
|
|
5208
5214
|
// В Safari и некоторых браузерах encodings изначально не содержат maxBitrate.
|
|
@@ -5259,13 +5265,13 @@ class Co {
|
|
|
5259
5265
|
}
|
|
5260
5266
|
var an = /* @__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))(an || {});
|
|
5261
5267
|
const Et = I("MCUSession");
|
|
5262
|
-
class
|
|
5268
|
+
class No {
|
|
5263
5269
|
events;
|
|
5264
5270
|
rtcSession;
|
|
5265
5271
|
disposers = /* @__PURE__ */ new Set();
|
|
5266
5272
|
pcConfig;
|
|
5267
5273
|
// Менеджер состояния битрейта
|
|
5268
|
-
bitrateStateManager = new
|
|
5274
|
+
bitrateStateManager = new Ro();
|
|
5269
5275
|
constructor(e) {
|
|
5270
5276
|
this.events = e, e.on("failed", this.handleEnded), e.on("ended", this.handleEnded);
|
|
5271
5277
|
}
|
|
@@ -5296,9 +5302,9 @@ class Ro {
|
|
|
5296
5302
|
offerToReceiveVideo: f = !0,
|
|
5297
5303
|
degradationPreference: y,
|
|
5298
5304
|
sendEncodings: _,
|
|
5299
|
-
onAddedTransceiver:
|
|
5300
|
-
}) => new Promise((
|
|
5301
|
-
this.handleCall().then(
|
|
5305
|
+
onAddedTransceiver: V
|
|
5306
|
+
}) => new Promise((B, K) => {
|
|
5307
|
+
this.handleCall().then(B).catch((ne) => {
|
|
5302
5308
|
K(ne);
|
|
5303
5309
|
}), this.pcConfig = { iceServers: a }, this.rtcSession = e.call(n(s), {
|
|
5304
5310
|
mediaStream: Re(r, {
|
|
@@ -5322,7 +5328,7 @@ class Ro {
|
|
|
5322
5328
|
directionAudio: c,
|
|
5323
5329
|
degradationPreference: y,
|
|
5324
5330
|
sendEncodings: _,
|
|
5325
|
-
onAddedTransceiver:
|
|
5331
|
+
onAddedTransceiver: V
|
|
5326
5332
|
});
|
|
5327
5333
|
});
|
|
5328
5334
|
async endCall() {
|
|
@@ -5344,10 +5350,10 @@ class Ro {
|
|
|
5344
5350
|
degradationPreference: C,
|
|
5345
5351
|
sendEncodings: f,
|
|
5346
5352
|
onAddedTransceiver: y
|
|
5347
|
-
}) => new Promise((_,
|
|
5353
|
+
}) => new Promise((_, V) => {
|
|
5348
5354
|
try {
|
|
5349
|
-
this.rtcSession = e, this.subscribeToSessionEvents(e), this.handleCall().then(_).catch((
|
|
5350
|
-
|
|
5355
|
+
this.rtcSession = e, this.subscribeToSessionEvents(e), this.handleCall().then(_).catch((B) => {
|
|
5356
|
+
V(B);
|
|
5351
5357
|
}), this.pcConfig = { iceServers: r }, e.answer({
|
|
5352
5358
|
pcConfig: {
|
|
5353
5359
|
iceServers: r
|
|
@@ -5368,8 +5374,8 @@ class Ro {
|
|
|
5368
5374
|
sendEncodings: f,
|
|
5369
5375
|
onAddedTransceiver: y
|
|
5370
5376
|
});
|
|
5371
|
-
} catch (
|
|
5372
|
-
|
|
5377
|
+
} catch (B) {
|
|
5378
|
+
V(B);
|
|
5373
5379
|
}
|
|
5374
5380
|
});
|
|
5375
5381
|
async replaceMediaStream(e, n) {
|
|
@@ -5450,8 +5456,8 @@ class Ro {
|
|
|
5450
5456
|
n === "remote" && this.events.trigger("ended:fromserver", e);
|
|
5451
5457
|
};
|
|
5452
5458
|
}
|
|
5453
|
-
const xe = (t) => t === "auto" ? "high" : t,
|
|
5454
|
-
class
|
|
5459
|
+
const xe = (t) => t === "auto" ? "high" : t, Ao = 10, Io = 500, fo = 5e3;
|
|
5460
|
+
class vo {
|
|
5455
5461
|
/**
|
|
5456
5462
|
* Текущая операция отправки offer с повторными попытками при ошибках.
|
|
5457
5463
|
* Может быть отменена при новом renegotiate для предотвращения конфликтов.
|
|
@@ -5580,8 +5586,8 @@ class fo {
|
|
|
5580
5586
|
this.cancelableSendOfferWithRepeatedCalls = He({
|
|
5581
5587
|
targetFunction: r,
|
|
5582
5588
|
isComplete: i,
|
|
5583
|
-
callLimit:
|
|
5584
|
-
delay:
|
|
5589
|
+
callLimit: Ao,
|
|
5590
|
+
delay: Io,
|
|
5585
5591
|
isRejectAsValid: !0,
|
|
5586
5592
|
isCheckBeforeCall: !1
|
|
5587
5593
|
});
|
|
@@ -5675,7 +5681,7 @@ class fo {
|
|
|
5675
5681
|
c(
|
|
5676
5682
|
new Error("Timed out waiting for stable signaling state and ready connection state")
|
|
5677
5683
|
);
|
|
5678
|
-
},
|
|
5684
|
+
}, fo), this.connection.addEventListener("signalingstatechange", g), this.connection.addEventListener("connectionstatechange", g), g();
|
|
5679
5685
|
});
|
|
5680
5686
|
}
|
|
5681
5687
|
async waitForTracks() {
|
|
@@ -5708,13 +5714,13 @@ class fo {
|
|
|
5708
5714
|
this.cancelableSendOfferWithRepeatedCalls?.cancel();
|
|
5709
5715
|
}
|
|
5710
5716
|
}
|
|
5711
|
-
const on = (t) => t.getSettings(),
|
|
5717
|
+
const on = (t) => t.getSettings(), Mo = (t, e) => {
|
|
5712
5718
|
const n = on(t);
|
|
5713
5719
|
let s = e;
|
|
5714
5720
|
s ??= t.label;
|
|
5715
5721
|
let r = n?.msid;
|
|
5716
5722
|
return r ??= s, r ??= t.id, r;
|
|
5717
|
-
},
|
|
5723
|
+
}, Oo = (t, e) => {
|
|
5718
5724
|
const n = on(t);
|
|
5719
5725
|
let s = e;
|
|
5720
5726
|
return s ??= n?.msid, s ??= t.label, (s && s.length > 0 ? s : void 0) ?? t.id;
|
|
@@ -5736,7 +5742,7 @@ class mt {
|
|
|
5736
5742
|
onRemoved: n,
|
|
5737
5743
|
streamHint: s
|
|
5738
5744
|
} = {}) {
|
|
5739
|
-
const r =
|
|
5745
|
+
const r = Oo(e, s), i = Mo(e, s);
|
|
5740
5746
|
if (this.trackToGroup.has(e.id))
|
|
5741
5747
|
return { isAddedTrack: !1, isAddedStream: !1 };
|
|
5742
5748
|
const a = this.getParticipantGroups(r), o = a.get(i), c = !o;
|
|
@@ -5804,13 +5810,13 @@ class mt {
|
|
|
5804
5810
|
return this.participantGroups.set(e, s), s;
|
|
5805
5811
|
}
|
|
5806
5812
|
}
|
|
5807
|
-
const
|
|
5813
|
+
const _o = (t, e) => {
|
|
5808
5814
|
if (!t || !e)
|
|
5809
5815
|
return t === e;
|
|
5810
5816
|
const n = t.mainStream?.id, s = e.mainStream?.id, r = t.contentedStream?.id, i = e.contentedStream?.id;
|
|
5811
5817
|
return n === s && r === i;
|
|
5812
5818
|
};
|
|
5813
|
-
class
|
|
5819
|
+
class bo {
|
|
5814
5820
|
lastEmittedStreams;
|
|
5815
5821
|
/**
|
|
5816
5822
|
* Проверяет, изменились ли streams с последнего сохраненного состояния
|
|
@@ -5818,7 +5824,7 @@ class _o {
|
|
|
5818
5824
|
* @returns true, если streams изменились
|
|
5819
5825
|
*/
|
|
5820
5826
|
hasChanged(e) {
|
|
5821
|
-
return !
|
|
5827
|
+
return !_o(this.lastEmittedStreams, e);
|
|
5822
5828
|
}
|
|
5823
5829
|
/**
|
|
5824
5830
|
* Сохраняет текущие streams как последнее эмитнутое состояние
|
|
@@ -5841,8 +5847,8 @@ class _o {
|
|
|
5841
5847
|
this.lastEmittedStreams = void 0;
|
|
5842
5848
|
}
|
|
5843
5849
|
}
|
|
5844
|
-
const
|
|
5845
|
-
class
|
|
5850
|
+
const yo = "default", Do = "dual", Po = "content_", Lo = (t) => `${Po}${t.toLowerCase()}`, wo = (t) => [...t.getTracks()].some((e) => e.label.includes(Do));
|
|
5851
|
+
class Go {
|
|
5846
5852
|
mainRemoteStreamsManager;
|
|
5847
5853
|
recvRemoteStreamsManager;
|
|
5848
5854
|
constructor(e, n) {
|
|
@@ -5859,7 +5865,7 @@ class wo {
|
|
|
5859
5865
|
}) {
|
|
5860
5866
|
const n = this.mainRemoteStreamsManager;
|
|
5861
5867
|
return { manager: n, getRemoteStreams: () => {
|
|
5862
|
-
const r = n.getStreams(), i = r.find((o) => !
|
|
5868
|
+
const r = n.getStreams(), i = r.find((o) => !wo(o)), a = e.isAvailable ? r.find((o) => o !== i) : void 0;
|
|
5863
5869
|
return { mainStream: i, contentedStream: a };
|
|
5864
5870
|
} };
|
|
5865
5871
|
}
|
|
@@ -5868,7 +5874,7 @@ class wo {
|
|
|
5868
5874
|
}) {
|
|
5869
5875
|
const n = this.recvRemoteStreamsManager;
|
|
5870
5876
|
return { manager: n, getRemoteStreams: () => {
|
|
5871
|
-
const i = n.getStreams(
|
|
5877
|
+
const i = n.getStreams(yo)[0], a = this.getRecvRemoteContentedStream({ stateInfo: e });
|
|
5872
5878
|
return { mainStream: i, contentedStream: a };
|
|
5873
5879
|
} };
|
|
5874
5880
|
}
|
|
@@ -5877,15 +5883,15 @@ class wo {
|
|
|
5877
5883
|
}) {
|
|
5878
5884
|
if (!e.isAvailable || e.codec === void 0)
|
|
5879
5885
|
return;
|
|
5880
|
-
const n =
|
|
5886
|
+
const n = Lo(e.codec);
|
|
5881
5887
|
return this.recvRemoteStreamsManager.getStreams(n)[0];
|
|
5882
5888
|
}
|
|
5883
5889
|
}
|
|
5884
|
-
const
|
|
5885
|
-
const s =
|
|
5890
|
+
const ko = "udp", Fo = (t) => t.transport?.iceTransport ? t.transport.iceTransport.getLocalCandidates() : [], Uo = (t) => t.getReceivers().flatMap(Fo), Bo = (t) => {
|
|
5891
|
+
const s = Uo(t).filter(({ protocol: r, port: i }) => i !== null && ko === r).map(({ port: r }) => r);
|
|
5886
5892
|
return [...new Set(s)];
|
|
5887
5893
|
}, Tt = (t) => t.streams[0]?.id;
|
|
5888
|
-
class
|
|
5894
|
+
class $o extends w {
|
|
5889
5895
|
stateMachine;
|
|
5890
5896
|
sessionState;
|
|
5891
5897
|
isPendingCall = !1;
|
|
@@ -5906,12 +5912,12 @@ class Bo extends w {
|
|
|
5906
5912
|
disposeRecvSessionTrackListener;
|
|
5907
5913
|
disposeInRoomCredentialsListener;
|
|
5908
5914
|
deferredStartRecvSessionRunner;
|
|
5909
|
-
streamsChangeTracker = new
|
|
5915
|
+
streamsChangeTracker = new bo();
|
|
5910
5916
|
constructor({ contentedStreamManager: e }, n, { callSessionState: s }) {
|
|
5911
|
-
super(
|
|
5917
|
+
super(Ji()), this.contentedStreamManager = e, this.tools = n, this.mcuSession = new No(this.events), this.stateMachine = Ja(this.events), this.sessionState = s, this.sessionState.subscribeRoleChanges(this.onRoleChanged), this.streamsManagerProvider = new Go(
|
|
5912
5918
|
this.mainRemoteStreamsManager,
|
|
5913
5919
|
this.recvRemoteStreamsManager
|
|
5914
|
-
), this.deferredStartRecvSessionRunner = new
|
|
5920
|
+
), this.deferredStartRecvSessionRunner = new Ba({
|
|
5915
5921
|
subscribe: (r) => this.stateMachine.onStateChange(r),
|
|
5916
5922
|
isReady: (r) => r === u.IN_ROOM,
|
|
5917
5923
|
isCancelled: (r) => r === u.IDLE,
|
|
@@ -5947,7 +5953,7 @@ class Bo extends w {
|
|
|
5947
5953
|
}
|
|
5948
5954
|
get localPorts() {
|
|
5949
5955
|
const e = this.getActivePeerConnection();
|
|
5950
|
-
return e ?
|
|
5956
|
+
return e ? Bo(e) : [];
|
|
5951
5957
|
}
|
|
5952
5958
|
// For testing purposes
|
|
5953
5959
|
getStreamsManagerProvider() {
|
|
@@ -6171,7 +6177,7 @@ class Bo extends w {
|
|
|
6171
6177
|
audioChannel: e,
|
|
6172
6178
|
quality: n,
|
|
6173
6179
|
pcConfig: this.mcuSession.getPcConfig()
|
|
6174
|
-
}, a = new
|
|
6180
|
+
}, a = new vo(i, { sendOffer: this.tools.sendOffer });
|
|
6175
6181
|
return this.recvSession = a, this.recvRemoteStreamsManager.reset(), this.attachRecvSessionTracks(a), a.call({
|
|
6176
6182
|
conferenceNumber: r.conferenceForToken,
|
|
6177
6183
|
token: r.token
|
|
@@ -6196,14 +6202,14 @@ class Bo extends w {
|
|
|
6196
6202
|
previous: e,
|
|
6197
6203
|
next: n
|
|
6198
6204
|
}) => {
|
|
6199
|
-
if (
|
|
6205
|
+
if (na(e, n) && (this.stopRecvSession(), this.deferredStartRecvSessionRunner.cancel(), this.emitEventChangedRemoteStreamsConnected()), sa(e, n)) {
|
|
6200
6206
|
const s = n.recvParams;
|
|
6201
6207
|
this.stateMachine.getInRoomCredentials() === void 0 ? this.deferredStartRecvSessionRunner.set({
|
|
6202
6208
|
audioId: s.audioId
|
|
6203
6209
|
}) : this.startRecvSession({ audioChannel: s.audioId }).catch(() => {
|
|
6204
6210
|
});
|
|
6205
6211
|
}
|
|
6206
|
-
|
|
6212
|
+
ra(e, n) && this.mcuSession.restoreBitrateForSenders(), ia(e, n) && this.mcuSession.setMinBitrateForSenders();
|
|
6207
6213
|
};
|
|
6208
6214
|
subscribeContentedStreamEvents() {
|
|
6209
6215
|
this.contentedStreamManager.on("available", this.emitEventChangedRemoteStreamsConnected), this.contentedStreamManager.on("not-available", this.emitEventChangedRemoteStreamsConnected);
|
|
@@ -6225,11 +6231,11 @@ const cn = [
|
|
|
6225
6231
|
"presentation:end",
|
|
6226
6232
|
"presentation:ended",
|
|
6227
6233
|
"presentation:failed"
|
|
6228
|
-
],
|
|
6234
|
+
], xo = () => new G(cn);
|
|
6229
6235
|
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 || {});
|
|
6230
6236
|
const ln = {
|
|
6231
6237
|
lastError: void 0
|
|
6232
|
-
}, pt = I("PresentationStateMachine"),
|
|
6238
|
+
}, pt = I("PresentationStateMachine"), Vo = (t) => t instanceof Error ? t : new Error(JSON.stringify(t)), qo = () => ee({
|
|
6233
6239
|
types: {
|
|
6234
6240
|
context: ln,
|
|
6235
6241
|
events: {}
|
|
@@ -6242,13 +6248,13 @@ const ln = {
|
|
|
6242
6248
|
pt("PresentationStateMachine state changed", e.state);
|
|
6243
6249
|
},
|
|
6244
6250
|
[p.SET_ERROR]: A(({ event: t }) => "error" in t && t.error !== void 0 ? {
|
|
6245
|
-
lastError:
|
|
6251
|
+
lastError: Vo(t.error)
|
|
6246
6252
|
} : { lastError: void 0 }),
|
|
6247
6253
|
[p.CLEAR_ERROR]: A(() => ({
|
|
6248
6254
|
lastError: void 0
|
|
6249
6255
|
}))
|
|
6250
6256
|
}
|
|
6251
|
-
}),
|
|
6257
|
+
}), Ho = () => qo().createMachine({
|
|
6252
6258
|
id: "presentation",
|
|
6253
6259
|
initial: h.IDLE,
|
|
6254
6260
|
context: ln,
|
|
@@ -6540,10 +6546,10 @@ const ln = {
|
|
|
6540
6546
|
}
|
|
6541
6547
|
}
|
|
6542
6548
|
}
|
|
6543
|
-
}),
|
|
6544
|
-
class
|
|
6549
|
+
}), Wo = Ho(), Qo = I("PresentationStateMachine");
|
|
6550
|
+
class Yo extends te {
|
|
6545
6551
|
constructor(e) {
|
|
6546
|
-
super(
|
|
6552
|
+
super(Wo), this.subscribeCallEvents(e);
|
|
6547
6553
|
}
|
|
6548
6554
|
get isIdle() {
|
|
6549
6555
|
return this.hasState(h.IDLE);
|
|
@@ -6580,7 +6586,7 @@ class Qo extends te {
|
|
|
6580
6586
|
}
|
|
6581
6587
|
sendEvent(e) {
|
|
6582
6588
|
if (!this.actor.getSnapshot().can(e)) {
|
|
6583
|
-
|
|
6589
|
+
Qo(
|
|
6584
6590
|
`[PresentationStateMachine] Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`
|
|
6585
6591
|
);
|
|
6586
6592
|
return;
|
|
@@ -6619,14 +6625,14 @@ class Qo extends te {
|
|
|
6619
6625
|
);
|
|
6620
6626
|
}
|
|
6621
6627
|
}
|
|
6622
|
-
const
|
|
6628
|
+
const jo = 1, zo = [
|
|
6623
6629
|
"presentation:start",
|
|
6624
6630
|
"presentation:started",
|
|
6625
6631
|
"presentation:end",
|
|
6626
6632
|
"presentation:ended",
|
|
6627
6633
|
"presentation:failed"
|
|
6628
|
-
],
|
|
6629
|
-
class
|
|
6634
|
+
], Jo = (t) => t instanceof Error ? t : new Error(String(t)), _l = (t) => Ln(t);
|
|
6635
|
+
class Ko extends w {
|
|
6630
6636
|
stateMachine;
|
|
6631
6637
|
promisePendingStartPresentation;
|
|
6632
6638
|
promisePendingStopPresentation;
|
|
@@ -6638,7 +6644,7 @@ class Jo extends w {
|
|
|
6638
6644
|
callManager: e,
|
|
6639
6645
|
maxBitrate: n
|
|
6640
6646
|
}) {
|
|
6641
|
-
super(
|
|
6647
|
+
super(xo()), this.callManager = e, this.maxBitrate = n, this.stateMachine = new Yo(this.callManager.events), this.subscribe();
|
|
6642
6648
|
}
|
|
6643
6649
|
get isPendingPresentation() {
|
|
6644
6650
|
return !!this.promisePendingStartPresentation || !!this.promisePendingStopPresentation;
|
|
@@ -6691,7 +6697,7 @@ class Jo extends w {
|
|
|
6691
6697
|
this.cancelableSendPresentationWithRepeatedCalls?.stopRepeatedCalls();
|
|
6692
6698
|
}
|
|
6693
6699
|
subscribe() {
|
|
6694
|
-
|
|
6700
|
+
zo.forEach((e) => {
|
|
6695
6701
|
this.callManager.on(e, (n) => {
|
|
6696
6702
|
this.events.trigger(e, n);
|
|
6697
6703
|
});
|
|
@@ -6702,7 +6708,7 @@ class Jo extends w {
|
|
|
6702
6708
|
stream: s,
|
|
6703
6709
|
presentationOptions: r,
|
|
6704
6710
|
options: i = {
|
|
6705
|
-
callLimit:
|
|
6711
|
+
callLimit: jo
|
|
6706
6712
|
}
|
|
6707
6713
|
}) {
|
|
6708
6714
|
const a = async () => this.sendPresentation(
|
|
@@ -6746,7 +6752,7 @@ class Jo extends w {
|
|
|
6746
6752
|
if (!e || !n || s === void 0)
|
|
6747
6753
|
return;
|
|
6748
6754
|
const r = e.getSenders();
|
|
6749
|
-
await
|
|
6755
|
+
await wa(r, n, s);
|
|
6750
6756
|
};
|
|
6751
6757
|
getRtcSessionProtected = () => {
|
|
6752
6758
|
const e = this.callManager.getEstablishedRTCSession();
|
|
@@ -6767,10 +6773,10 @@ class Jo extends w {
|
|
|
6767
6773
|
delete this.streamPresentationCurrent;
|
|
6768
6774
|
}
|
|
6769
6775
|
notifyPresentationFailed(e) {
|
|
6770
|
-
this.events.trigger("presentation:failed",
|
|
6776
|
+
this.events.trigger("presentation:failed", Jo(e));
|
|
6771
6777
|
}
|
|
6772
6778
|
}
|
|
6773
|
-
const
|
|
6779
|
+
const Xo = I("ContentedStreamStateMachine"), Zo = ee({
|
|
6774
6780
|
types: {
|
|
6775
6781
|
context: {},
|
|
6776
6782
|
events: {}
|
|
@@ -6811,9 +6817,9 @@ const Ko = I("ContentedStreamStateMachine"), Xo = ee({
|
|
|
6811
6817
|
}
|
|
6812
6818
|
}
|
|
6813
6819
|
});
|
|
6814
|
-
class
|
|
6820
|
+
class ec extends te {
|
|
6815
6821
|
constructor() {
|
|
6816
|
-
super(
|
|
6822
|
+
super(Zo);
|
|
6817
6823
|
}
|
|
6818
6824
|
get isAvailable() {
|
|
6819
6825
|
return this.state === "contented-stream:available";
|
|
@@ -6835,7 +6841,7 @@ class Zo extends te {
|
|
|
6835
6841
|
}
|
|
6836
6842
|
send(e) {
|
|
6837
6843
|
if (!this.actor.getSnapshot().can(e)) {
|
|
6838
|
-
|
|
6844
|
+
Xo(
|
|
6839
6845
|
`[ContentedStreamStateMachine] Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`
|
|
6840
6846
|
);
|
|
6841
6847
|
return;
|
|
@@ -6854,15 +6860,15 @@ class Zo extends te {
|
|
|
6854
6860
|
);
|
|
6855
6861
|
}
|
|
6856
6862
|
}
|
|
6857
|
-
const
|
|
6863
|
+
const tc = [
|
|
6858
6864
|
"available",
|
|
6859
6865
|
"not-available"
|
|
6860
6866
|
/* NOT_AVAILABLE */
|
|
6861
|
-
],
|
|
6862
|
-
class
|
|
6867
|
+
], nc = () => new G(tc);
|
|
6868
|
+
class sc extends w {
|
|
6863
6869
|
stateMachine;
|
|
6864
6870
|
constructor() {
|
|
6865
|
-
super(
|
|
6871
|
+
super(nc()), this.stateMachine = new ec(), this.proxyEvents();
|
|
6866
6872
|
}
|
|
6867
6873
|
get isAvailable() {
|
|
6868
6874
|
return this.stateMachine.isAvailable;
|
|
@@ -6891,12 +6897,12 @@ const dn = [
|
|
|
6891
6897
|
"declinedIncomingCall",
|
|
6892
6898
|
"terminatedIncomingCall",
|
|
6893
6899
|
"failedIncomingCall"
|
|
6894
|
-
],
|
|
6900
|
+
], rc = () => new G(dn);
|
|
6895
6901
|
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 || {});
|
|
6896
6902
|
const hn = {
|
|
6897
6903
|
remoteCallerData: void 0,
|
|
6898
6904
|
lastReason: void 0
|
|
6899
|
-
}, St = I("IncomingCallStateMachine"),
|
|
6905
|
+
}, St = I("IncomingCallStateMachine"), ic = () => ee({
|
|
6900
6906
|
types: {
|
|
6901
6907
|
context: hn,
|
|
6902
6908
|
events: {}
|
|
@@ -6930,7 +6936,7 @@ const hn = {
|
|
|
6930
6936
|
lastReason: void 0
|
|
6931
6937
|
}))
|
|
6932
6938
|
}
|
|
6933
|
-
}),
|
|
6939
|
+
}), ac = () => ic().createMachine({
|
|
6934
6940
|
id: "incoming",
|
|
6935
6941
|
initial: d.IDLE,
|
|
6936
6942
|
context: hn,
|
|
@@ -7208,10 +7214,10 @@ const hn = {
|
|
|
7208
7214
|
}
|
|
7209
7215
|
}
|
|
7210
7216
|
}
|
|
7211
|
-
}),
|
|
7212
|
-
class
|
|
7217
|
+
}), oc = ac(), cc = I("IncomingCallStateMachine");
|
|
7218
|
+
class lc extends te {
|
|
7213
7219
|
constructor({ incomingEvents: e, connectionEvents: n }) {
|
|
7214
|
-
super(
|
|
7220
|
+
super(oc), this.subscribeIncomingEvents(e), this.subscribeConnectionEvents(n);
|
|
7215
7221
|
}
|
|
7216
7222
|
get isIdle() {
|
|
7217
7223
|
return this.hasState(d.IDLE);
|
|
@@ -7257,7 +7263,7 @@ class cc extends te {
|
|
|
7257
7263
|
}
|
|
7258
7264
|
sendEvent(e) {
|
|
7259
7265
|
if (!this.actor.getSnapshot().can(e)) {
|
|
7260
|
-
|
|
7266
|
+
cc(
|
|
7261
7267
|
`[IncomingCallStateMachine] Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`
|
|
7262
7268
|
);
|
|
7263
7269
|
return;
|
|
@@ -7330,18 +7336,18 @@ class cc extends te {
|
|
|
7330
7336
|
this.sendEvent({ type: R.CLEAR });
|
|
7331
7337
|
};
|
|
7332
7338
|
}
|
|
7333
|
-
const
|
|
7339
|
+
const dc = 486, hc = 487, Ge = (t) => ({
|
|
7334
7340
|
displayName: t.remote_identity.display_name,
|
|
7335
7341
|
host: t.remote_identity.uri.host,
|
|
7336
7342
|
incomingNumber: t.remote_identity.uri.user,
|
|
7337
7343
|
rtcSession: t
|
|
7338
7344
|
});
|
|
7339
|
-
class
|
|
7345
|
+
class uc extends w {
|
|
7340
7346
|
stateMachine;
|
|
7341
7347
|
incomingRTCSession;
|
|
7342
7348
|
connectionManager;
|
|
7343
7349
|
constructor(e) {
|
|
7344
|
-
super(
|
|
7350
|
+
super(rc()), this.connectionManager = e, this.stateMachine = new lc({
|
|
7345
7351
|
incomingEvents: this.events,
|
|
7346
7352
|
connectionEvents: this.connectionManager.events
|
|
7347
7353
|
}), this.start();
|
|
@@ -7370,7 +7376,7 @@ class hc extends w {
|
|
|
7370
7376
|
return this.stateMachine.toConsumed(), this.removeIncomingSession(), e;
|
|
7371
7377
|
};
|
|
7372
7378
|
async declineToIncomingCall({
|
|
7373
|
-
statusCode: e =
|
|
7379
|
+
statusCode: e = hc
|
|
7374
7380
|
} = {}) {
|
|
7375
7381
|
return new Promise((n, s) => {
|
|
7376
7382
|
try {
|
|
@@ -7382,7 +7388,7 @@ class hc extends w {
|
|
|
7382
7388
|
});
|
|
7383
7389
|
}
|
|
7384
7390
|
async busyIncomingCall() {
|
|
7385
|
-
return this.declineToIncomingCall({ statusCode:
|
|
7391
|
+
return this.declineToIncomingCall({ statusCode: dc });
|
|
7386
7392
|
}
|
|
7387
7393
|
subscribe() {
|
|
7388
7394
|
this.connectionManager.on("newRTCSession", this.handleNewRTCSession);
|
|
@@ -7407,7 +7413,7 @@ class hc extends w {
|
|
|
7407
7413
|
delete this.incomingRTCSession;
|
|
7408
7414
|
}
|
|
7409
7415
|
}
|
|
7410
|
-
class
|
|
7416
|
+
class gc {
|
|
7411
7417
|
apiManager;
|
|
7412
7418
|
connectionManager;
|
|
7413
7419
|
callManager;
|
|
@@ -7443,7 +7449,7 @@ class uc {
|
|
|
7443
7449
|
s.sendEnterRoom(r);
|
|
7444
7450
|
};
|
|
7445
7451
|
}
|
|
7446
|
-
const un = ["snapshot-changed"],
|
|
7452
|
+
const un = ["snapshot-changed"], Ec = () => new G(un), mc = (t, e) => Object.is(t, e), Ct = (t, e) => t.connection.value === e.connection.value && // Call: full snapshot so room/context updates without a state `value` change still emit snapshot-changed
|
|
7447
7453
|
Je(t.call, e.call) && // Incoming: value only — repeated RINGING with different callee metadata must not emit again
|
|
7448
7454
|
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` тоже эмитят событие
|
|
7449
7455
|
Je(t.callReconnect, e.callReconnect), Rt = (t) => ({
|
|
@@ -7454,13 +7460,13 @@ Je(t.callReconnect, e.callReconnect), Rt = (t) => ({
|
|
|
7454
7460
|
autoConnector: t.autoConnector.getSnapshot(),
|
|
7455
7461
|
callReconnect: t.callReconnect.getSnapshot()
|
|
7456
7462
|
});
|
|
7457
|
-
class
|
|
7463
|
+
class Tc extends w {
|
|
7458
7464
|
machines;
|
|
7459
7465
|
currentSnapshot;
|
|
7460
7466
|
subscribers = /* @__PURE__ */ new Set();
|
|
7461
7467
|
actorSubscriptions = [];
|
|
7462
7468
|
constructor(e) {
|
|
7463
|
-
super(
|
|
7469
|
+
super(Ec()), this.machines = {
|
|
7464
7470
|
connection: e.connectionManager.stateMachine,
|
|
7465
7471
|
call: e.callManager.stateMachine,
|
|
7466
7472
|
incoming: e.incomingCallManager.stateMachine,
|
|
@@ -7480,7 +7486,7 @@ class mc extends w {
|
|
|
7480
7486
|
return this.currentSnapshot;
|
|
7481
7487
|
}
|
|
7482
7488
|
subscribe(e, n, s) {
|
|
7483
|
-
const r = typeof n == "function", i = r ? e : (f) => f, a = r ? n : e, c = r ? s ??
|
|
7489
|
+
const r = typeof n == "function", i = r ? e : (f) => f, a = r ? n : e, c = r ? s ?? mc : Ct, g = i(this.currentSnapshot), C = {
|
|
7484
7490
|
selector: i,
|
|
7485
7491
|
listener: a,
|
|
7486
7492
|
equals: c,
|
|
@@ -7511,10 +7517,10 @@ class mc extends w {
|
|
|
7511
7517
|
}
|
|
7512
7518
|
const de = 1e3;
|
|
7513
7519
|
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 || {});
|
|
7514
|
-
const gn = ["collected", "stopped"],
|
|
7520
|
+
const gn = ["collected", "stopped"], pc = () => new G(gn), Nt = () => "performance" in window ? performance.now() : Date.now(), Te = (t) => [...t.keys()].reduce((e, n) => {
|
|
7515
7521
|
const s = t.get(n);
|
|
7516
7522
|
return s === void 0 ? e : { ...e, [s.type]: s };
|
|
7517
|
-
}, {}),
|
|
7523
|
+
}, {}), Sc = (t) => {
|
|
7518
7524
|
if (!t)
|
|
7519
7525
|
return {
|
|
7520
7526
|
outboundRtp: void 0,
|
|
@@ -7560,7 +7566,7 @@ const gn = ["collected", "stopped"], Tc = () => new G(gn), Nt = () => "performan
|
|
|
7560
7566
|
codec: n[D.CODEC],
|
|
7561
7567
|
synchronizationSources: e
|
|
7562
7568
|
};
|
|
7563
|
-
},
|
|
7569
|
+
}, Cc = ({
|
|
7564
7570
|
audioReceiverStats: t,
|
|
7565
7571
|
synchronizationSourcesAudio: e
|
|
7566
7572
|
}) => {
|
|
@@ -7595,18 +7601,18 @@ const gn = ["collected", "stopped"], Tc = () => new G(gn), Nt = () => "performan
|
|
|
7595
7601
|
remoteCandidate: e[D.REMOTE_CANDIDATE],
|
|
7596
7602
|
transport: e[D.TRANSPORT]
|
|
7597
7603
|
};
|
|
7598
|
-
},
|
|
7604
|
+
}, Rc = ({
|
|
7599
7605
|
audioSenderStats: t,
|
|
7600
7606
|
videoSenderFirstStats: e,
|
|
7601
7607
|
videoSenderSecondStats: n
|
|
7602
7608
|
}) => ({
|
|
7603
7609
|
video: At(e),
|
|
7604
7610
|
secondVideo: At(n),
|
|
7605
|
-
audio:
|
|
7611
|
+
audio: Sc(t),
|
|
7606
7612
|
additional: En(
|
|
7607
7613
|
t ?? e ?? n
|
|
7608
7614
|
)
|
|
7609
|
-
}),
|
|
7615
|
+
}), Nc = ({
|
|
7610
7616
|
audioReceiverStats: t,
|
|
7611
7617
|
videoReceiverFirstStats: e,
|
|
7612
7618
|
videoReceiverSecondStats: n,
|
|
@@ -7620,14 +7626,14 @@ const gn = ["collected", "stopped"], Tc = () => new G(gn), Nt = () => "performan
|
|
|
7620
7626
|
videoReceiversStats: n,
|
|
7621
7627
|
synchronizationSourcesVideo: s.secondVideo ?? s.video
|
|
7622
7628
|
}),
|
|
7623
|
-
audio:
|
|
7629
|
+
audio: Cc({
|
|
7624
7630
|
audioReceiverStats: t,
|
|
7625
7631
|
synchronizationSourcesAudio: s.audio
|
|
7626
7632
|
}),
|
|
7627
7633
|
additional: En(
|
|
7628
7634
|
t ?? e ?? n
|
|
7629
7635
|
)
|
|
7630
|
-
}),
|
|
7636
|
+
}), Ac = ({
|
|
7631
7637
|
audioSenderStats: t,
|
|
7632
7638
|
videoSenderFirstStats: e,
|
|
7633
7639
|
videoSenderSecondStats: n,
|
|
@@ -7636,11 +7642,11 @@ const gn = ["collected", "stopped"], Tc = () => new G(gn), Nt = () => "performan
|
|
|
7636
7642
|
videoReceiverSecondStats: i,
|
|
7637
7643
|
synchronizationSources: a
|
|
7638
7644
|
}) => {
|
|
7639
|
-
const o =
|
|
7645
|
+
const o = Rc({
|
|
7640
7646
|
audioSenderStats: t,
|
|
7641
7647
|
videoSenderFirstStats: e,
|
|
7642
7648
|
videoSenderSecondStats: n
|
|
7643
|
-
}), c =
|
|
7649
|
+
}), c = Nc({
|
|
7644
7650
|
audioReceiverStats: s,
|
|
7645
7651
|
videoReceiverFirstStats: r,
|
|
7646
7652
|
videoReceiverSecondStats: i,
|
|
@@ -7650,7 +7656,7 @@ const gn = ["collected", "stopped"], Tc = () => new G(gn), Nt = () => "performan
|
|
|
7650
7656
|
outbound: o,
|
|
7651
7657
|
inbound: c
|
|
7652
7658
|
};
|
|
7653
|
-
},
|
|
7659
|
+
}, Ic = async (t) => {
|
|
7654
7660
|
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 = {
|
|
7655
7661
|
trackIdentifier: o?.track.id,
|
|
7656
7662
|
item: o?.getSynchronizationSources()[0]
|
|
@@ -7674,8 +7680,8 @@ const gn = ["collected", "stopped"], Tc = () => new G(gn), Nt = () => "performan
|
|
|
7674
7680
|
c[1]?.getStats() ?? Promise.resolve(void 0)
|
|
7675
7681
|
]).then((_) => {
|
|
7676
7682
|
const [
|
|
7677
|
-
|
|
7678
|
-
|
|
7683
|
+
V,
|
|
7684
|
+
B,
|
|
7679
7685
|
K,
|
|
7680
7686
|
ne,
|
|
7681
7687
|
Me,
|
|
@@ -7683,27 +7689,27 @@ const gn = ["collected", "stopped"], Tc = () => new G(gn), Nt = () => "performan
|
|
|
7683
7689
|
] = _;
|
|
7684
7690
|
return {
|
|
7685
7691
|
synchronizationSources: y,
|
|
7686
|
-
audioSenderStats:
|
|
7687
|
-
videoSenderFirstStats:
|
|
7692
|
+
audioSenderStats: V,
|
|
7693
|
+
videoSenderFirstStats: B,
|
|
7688
7694
|
videoSenderSecondStats: K,
|
|
7689
7695
|
audioReceiverStats: ne,
|
|
7690
7696
|
videoReceiverFirstStats: Me,
|
|
7691
7697
|
videoReceiverSecondStats: ze
|
|
7692
7698
|
};
|
|
7693
7699
|
});
|
|
7694
|
-
},
|
|
7695
|
-
class
|
|
7700
|
+
}, fc = I("StatsPeerConnection");
|
|
7701
|
+
class vc extends w {
|
|
7696
7702
|
setTimeoutRequest;
|
|
7697
|
-
requesterAllStatistics = new me(
|
|
7703
|
+
requesterAllStatistics = new me(Ic);
|
|
7698
7704
|
constructor() {
|
|
7699
|
-
super(
|
|
7705
|
+
super(pc()), this.setTimeoutRequest = new _t();
|
|
7700
7706
|
}
|
|
7701
7707
|
get requested() {
|
|
7702
7708
|
return this.setTimeoutRequest.requested;
|
|
7703
7709
|
}
|
|
7704
7710
|
start(e, {
|
|
7705
7711
|
interval: n = de,
|
|
7706
|
-
onError: s =
|
|
7712
|
+
onError: s = fc
|
|
7707
7713
|
} = {}) {
|
|
7708
7714
|
this.setTimeoutRequest.request(() => {
|
|
7709
7715
|
this.collectStatistics(e, {
|
|
@@ -7728,7 +7734,7 @@ class fc extends w {
|
|
|
7728
7734
|
}) => {
|
|
7729
7735
|
const r = Nt();
|
|
7730
7736
|
this.requestAllStatistics(e).then((i) => {
|
|
7731
|
-
this.events.trigger("collected",
|
|
7737
|
+
this.events.trigger("collected", Ac(i));
|
|
7732
7738
|
const o = Nt() - r;
|
|
7733
7739
|
let c = de;
|
|
7734
7740
|
o > 48 ? c = de * 4 : o > 32 ? c = de * 3 : o > 16 && (c = de * 2), s({ interval: c });
|
|
@@ -7743,8 +7749,8 @@ class fc extends w {
|
|
|
7743
7749
|
return this.requesterAllStatistics.request(n);
|
|
7744
7750
|
};
|
|
7745
7751
|
}
|
|
7746
|
-
const
|
|
7747
|
-
class
|
|
7752
|
+
const Mc = 500, Oc = I("StatsManager");
|
|
7753
|
+
class _c extends w {
|
|
7748
7754
|
statsPeerConnection;
|
|
7749
7755
|
availableStats;
|
|
7750
7756
|
previousAvailableStats;
|
|
@@ -7754,7 +7760,7 @@ class Oc extends w {
|
|
|
7754
7760
|
callManager: e,
|
|
7755
7761
|
apiManager: n
|
|
7756
7762
|
}) {
|
|
7757
|
-
const s = new
|
|
7763
|
+
const s = new vc();
|
|
7758
7764
|
super(s.events), this.statsPeerConnection = s, this.callManager = e, this.apiManager = n, this.subscribe();
|
|
7759
7765
|
}
|
|
7760
7766
|
get availableIncomingBitrate() {
|
|
@@ -7817,7 +7823,7 @@ class Oc extends w {
|
|
|
7817
7823
|
return this.previousInboundRtp?.bytesReceived;
|
|
7818
7824
|
}
|
|
7819
7825
|
get isReceivingPackets() {
|
|
7820
|
-
const e = this.packetsReceived !== void 0 && this.packetsReceived >=
|
|
7826
|
+
const e = this.packetsReceived !== void 0 && this.packetsReceived >= Mc, n = this.packetsReceived !== this.previousPacketsReceived;
|
|
7821
7827
|
return e && n;
|
|
7822
7828
|
}
|
|
7823
7829
|
hasAvailableIncomingBitrateChangedQuarter() {
|
|
@@ -7853,42 +7859,42 @@ class Oc extends w {
|
|
|
7853
7859
|
};
|
|
7854
7860
|
maybeSendStats() {
|
|
7855
7861
|
this.availableIncomingBitrate !== void 0 && this.hasAvailableIncomingBitrateChangedQuarter() && this.apiManager.sendStats({ availableIncomingBitrate: this.availableIncomingBitrate }).catch((e) => {
|
|
7856
|
-
|
|
7862
|
+
Oc("Failed to send stats", e);
|
|
7857
7863
|
});
|
|
7858
7864
|
}
|
|
7859
7865
|
}
|
|
7860
|
-
const
|
|
7866
|
+
const bc = I("setCodecPreferences"), yc = (t, e) => t.filter((s) => e.some((r) => r.clockRate === s.clockRate && r.mimeType === s.mimeType && r.channels === s.channels && r.sdpFmtpLine === s.sdpFmtpLine)), Dc = (t) => {
|
|
7861
7867
|
const e = RTCRtpSender.getCapabilities(t), n = RTCRtpReceiver.getCapabilities(t), s = e === null ? [] : e.codecs, r = n === null ? [] : n.codecs;
|
|
7862
|
-
return
|
|
7863
|
-
},
|
|
7868
|
+
return yc(s, r);
|
|
7869
|
+
}, Pc = (t, e) => e === void 0 || e.length === 0 ? t : t.sort((n, s) => {
|
|
7864
7870
|
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;
|
|
7865
7871
|
return a - o;
|
|
7866
|
-
}),
|
|
7872
|
+
}), Lc = (t, e) => e === void 0 || e.length === 0 ? t : t.filter((n) => !e.includes(n.mimeType)), wc = (t, {
|
|
7867
7873
|
preferredMimeTypesVideoCodecs: e,
|
|
7868
7874
|
excludeMimeTypesVideoCodecs: n
|
|
7869
7875
|
}) => {
|
|
7870
7876
|
try {
|
|
7871
7877
|
if (typeof t.setCodecPreferences == "function" && t.sender.track?.kind === "video" && (e !== void 0 && e.length > 0 || n !== void 0 && n.length > 0)) {
|
|
7872
|
-
const s =
|
|
7878
|
+
const s = Dc("video"), r = Lc(s, n), i = Pc(r, e);
|
|
7873
7879
|
t.setCodecPreferences(i);
|
|
7874
7880
|
}
|
|
7875
7881
|
} catch (s) {
|
|
7876
|
-
|
|
7882
|
+
bc("setCodecPreferences error", s);
|
|
7877
7883
|
}
|
|
7878
7884
|
}, mn = [
|
|
7879
7885
|
"balancing-scheduled",
|
|
7880
7886
|
"balancing-started",
|
|
7881
7887
|
"balancing-stopped",
|
|
7882
7888
|
"parameters-updated"
|
|
7883
|
-
],
|
|
7884
|
-
class
|
|
7889
|
+
], Gc = () => new G(mn), kc = I("VideoSendingBalancerManager");
|
|
7890
|
+
class Fc extends w {
|
|
7885
7891
|
isBalancingActive = !1;
|
|
7886
7892
|
callManager;
|
|
7887
7893
|
balancingStartDelay;
|
|
7888
7894
|
videoSendingBalancer;
|
|
7889
7895
|
startBalancingTimer;
|
|
7890
7896
|
constructor(e, n, s = {}) {
|
|
7891
|
-
super(
|
|
7897
|
+
super(Gc()), this.callManager = e, this.balancingStartDelay = s.balancingStartDelay ?? 1e4, this.videoSendingBalancer = new mo(
|
|
7892
7898
|
n,
|
|
7893
7899
|
() => e.connection,
|
|
7894
7900
|
{
|
|
@@ -7944,7 +7950,7 @@ class kc extends w {
|
|
|
7944
7950
|
scheduleBalancingStart() {
|
|
7945
7951
|
this.clearStartTimer(), this.startBalancingTimer = setTimeout(() => {
|
|
7946
7952
|
this.startBalancingTimer = void 0, this.startBalancing().catch((e) => {
|
|
7947
|
-
|
|
7953
|
+
kc("startBalancing: error", e);
|
|
7948
7954
|
});
|
|
7949
7955
|
}, this.balancingStartDelay), this.events.trigger("balancing-scheduled", { delay: this.balancingStartDelay });
|
|
7950
7956
|
}
|
|
@@ -7957,7 +7963,7 @@ const Tn = "health-snapshot", pn = "inbound-video-problem-detected", Sn = "inbou
|
|
|
7957
7963
|
pn,
|
|
7958
7964
|
Sn,
|
|
7959
7965
|
Cn
|
|
7960
|
-
],
|
|
7966
|
+
], Uc = () => new G(Rn), Bc = 3;
|
|
7961
7967
|
class ge extends w {
|
|
7962
7968
|
statsManager;
|
|
7963
7969
|
callManager;
|
|
@@ -7965,8 +7971,8 @@ class ge extends w {
|
|
|
7965
7971
|
consecutiveProblemSamplesCount = 0;
|
|
7966
7972
|
currentProblemReason;
|
|
7967
7973
|
hasEmittedCurrentProblem = !1;
|
|
7968
|
-
constructor(e, n, s =
|
|
7969
|
-
super(
|
|
7974
|
+
constructor(e, n, s = Bc) {
|
|
7975
|
+
super(Uc()), this.statsManager = e, this.callManager = n, ge.assertValidMinConsecutiveProblemSamplesCount(
|
|
7970
7976
|
s
|
|
7971
7977
|
), this.minConsecutiveProblemSamplesCount = s, this.subscribe();
|
|
7972
7978
|
}
|
|
@@ -8057,12 +8063,12 @@ class ge extends w {
|
|
|
8057
8063
|
this.currentProblemReason = void 0, this.consecutiveProblemSamplesCount = 0, this.hasEmittedCurrentProblem = !1;
|
|
8058
8064
|
};
|
|
8059
8065
|
}
|
|
8060
|
-
const re = I("MainStreamRecovery"),
|
|
8066
|
+
const re = I("MainStreamRecovery"), $c = 4e3;
|
|
8061
8067
|
class ve {
|
|
8062
8068
|
renegotiateRequester;
|
|
8063
8069
|
renegotiateThrottled;
|
|
8064
8070
|
callManager;
|
|
8065
|
-
constructor(e, n =
|
|
8071
|
+
constructor(e, n = $c) {
|
|
8066
8072
|
this.callManager = e, this.renegotiateRequester = new me(e.renegotiate.bind(e)), this.renegotiateThrottled = this.createRenegotiateThrottled(n), this.subscribe();
|
|
8067
8073
|
}
|
|
8068
8074
|
static assertValidThrottleRecoveryTimeout(e) {
|
|
@@ -8103,36 +8109,35 @@ class ve {
|
|
|
8103
8109
|
}
|
|
8104
8110
|
}
|
|
8105
8111
|
var Nn = /* @__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))(Nn || {});
|
|
8106
|
-
const
|
|
8112
|
+
const xc = {
|
|
8107
8113
|
major: 25,
|
|
8108
8114
|
minor: 8,
|
|
8109
8115
|
patch: 0
|
|
8110
|
-
},
|
|
8116
|
+
}, Vc = ({
|
|
8111
8117
|
isYandexBrowser: t,
|
|
8112
8118
|
hasGreaterThanBrowserVersion: e
|
|
8113
8119
|
}) => {
|
|
8114
8120
|
const n = e(
|
|
8115
|
-
|
|
8121
|
+
xc
|
|
8116
8122
|
);
|
|
8117
8123
|
return t && n;
|
|
8118
|
-
},
|
|
8124
|
+
}, qc = () => {
|
|
8119
8125
|
const t = Ht();
|
|
8120
|
-
if (
|
|
8126
|
+
if (Vc(t))
|
|
8121
8127
|
return [Nn.VP8];
|
|
8122
|
-
},
|
|
8128
|
+
}, Hc = () => {
|
|
8123
8129
|
const { isMobileDevice: t, isSafari: e, isOpera: n, isWindows: s } = Ht();
|
|
8124
8130
|
return t || e || n && s;
|
|
8125
8131
|
};
|
|
8126
8132
|
let An;
|
|
8127
|
-
|
|
8128
|
-
const
|
|
8133
|
+
Hc() && (An = "h264");
|
|
8134
|
+
const Wc = {
|
|
8129
8135
|
ignoreForCodec: An
|
|
8130
|
-
},
|
|
8136
|
+
}, Qc = qc(), Yc = 1e6, jc = Ut.map((t) => `auto-connect:${t}`), zc = Bt.map((t) => `call-reconnect:${t}`), Jc = Ft.map((t) => `connection:${t}`), Kc = qt.map((t) => `call:${t}`), Xc = Lt.map((t) => `api:${t}`), Zc = dn.map((t) => `incoming-call:${t}`), el = cn.map((t) => `presentation:${t}`), tl = gn.map((t) => `stats:${t}`), nl = mn.map((t) => `video-balancer:${t}`), sl = Rn.map((t) => `main-stream-health:${t}`), rl = un.map((t) => `session:${t}`), il = [
|
|
8131
8137
|
"disconnected-from-out-of-call",
|
|
8132
8138
|
"connected-with-configuration-from-out-of-call",
|
|
8133
8139
|
"stopped-presentation-by-server-command"
|
|
8134
|
-
],
|
|
8135
|
-
...Yc,
|
|
8140
|
+
], al = [
|
|
8136
8141
|
...jc,
|
|
8137
8142
|
...zc,
|
|
8138
8143
|
...Jc,
|
|
@@ -8143,9 +8148,10 @@ const Hc = {
|
|
|
8143
8148
|
...tl,
|
|
8144
8149
|
...nl,
|
|
8145
8150
|
...sl,
|
|
8146
|
-
...rl
|
|
8147
|
-
|
|
8148
|
-
|
|
8151
|
+
...rl,
|
|
8152
|
+
...il
|
|
8153
|
+
], ol = () => new G(al), ft = I("SipConnector");
|
|
8154
|
+
class bl extends w {
|
|
8149
8155
|
connectionManager;
|
|
8150
8156
|
connectionQueueManager;
|
|
8151
8157
|
contentedStreamManager;
|
|
@@ -8174,40 +8180,40 @@ class _l extends w {
|
|
|
8174
8180
|
minConsecutiveProblemSamplesCount: c,
|
|
8175
8181
|
throttleRecoveryTimeout: g
|
|
8176
8182
|
} = {}) {
|
|
8177
|
-
super(
|
|
8183
|
+
super(ol()), this.preferredMimeTypesVideoCodecs = n ?? Qc, this.excludeMimeTypesVideoCodecs = s, this.apiManager = new jn(), this.connectionManager = new ys({ JsSIP: e }, { numberOfConnectionAttempts: o }), this.connectionQueueManager = new Ds({
|
|
8178
8184
|
connectionManager: this.connectionManager
|
|
8179
|
-
}), this.contentedStreamManager = new
|
|
8185
|
+
}), this.contentedStreamManager = new sc(), this.callSessionState = new ha(), this.callManager = new $o(
|
|
8180
8186
|
{ contentedStreamManager: this.contentedStreamManager },
|
|
8181
8187
|
{ sendOffer: this.sendOffer },
|
|
8182
8188
|
{ callSessionState: this.callSessionState }
|
|
8183
|
-
), this.incomingCallManager = new
|
|
8189
|
+
), this.incomingCallManager = new uc(this.connectionManager), this.presentationManager = new Ko({
|
|
8184
8190
|
callManager: this.callManager,
|
|
8185
|
-
maxBitrate:
|
|
8186
|
-
}), this.statsManager = new
|
|
8191
|
+
maxBitrate: Yc
|
|
8192
|
+
}), this.statsManager = new _c({
|
|
8187
8193
|
callManager: this.callManager,
|
|
8188
8194
|
apiManager: this.apiManager
|
|
8189
|
-
}), this.autoConnectorManager = new
|
|
8195
|
+
}), this.autoConnectorManager = new rr(
|
|
8190
8196
|
{
|
|
8191
8197
|
connectionQueueManager: this.connectionQueueManager,
|
|
8192
8198
|
connectionManager: this.connectionManager,
|
|
8193
8199
|
callManager: this.callManager
|
|
8194
8200
|
},
|
|
8195
8201
|
i
|
|
8196
|
-
), this.callReconnectManager = new
|
|
8202
|
+
), this.callReconnectManager = new Mr(
|
|
8197
8203
|
{
|
|
8198
8204
|
callManager: this.callManager,
|
|
8199
8205
|
connectionManager: this.connectionManager
|
|
8200
8206
|
},
|
|
8201
8207
|
a
|
|
8202
|
-
), this.videoSendingBalancerManager = new
|
|
8208
|
+
), this.videoSendingBalancerManager = new Fc(
|
|
8203
8209
|
this.callManager,
|
|
8204
8210
|
this.apiManager,
|
|
8205
|
-
r ??
|
|
8211
|
+
r ?? Wc
|
|
8206
8212
|
), this.mainStreamHealthMonitor = new ge(
|
|
8207
8213
|
this.statsManager,
|
|
8208
8214
|
this.callManager,
|
|
8209
8215
|
c
|
|
8210
|
-
), this.mainStreamRecovery = new ve(this.callManager, g), this.sessionManager = new
|
|
8216
|
+
), this.mainStreamRecovery = new ve(this.callManager, g), this.sessionManager = new Tc({
|
|
8211
8217
|
connectionManager: this.connectionManager,
|
|
8212
8218
|
callManager: this.callManager,
|
|
8213
8219
|
incomingCallManager: this.incomingCallManager,
|
|
@@ -8217,7 +8223,7 @@ class _l extends w {
|
|
|
8217
8223
|
}), this.callManager.subscribeToApiEvents(this.apiManager), this.contentedStreamManager.subscribeToApiEvents(this.apiManager), this.apiManager.subscribe({
|
|
8218
8224
|
connectionManager: this.connectionManager,
|
|
8219
8225
|
callManager: this.callManager
|
|
8220
|
-
}), this.peerToPeerManager = new
|
|
8226
|
+
}), this.peerToPeerManager = new gc(), this.peerToPeerManager.subscribe({
|
|
8221
8227
|
connectionManager: this.connectionManager,
|
|
8222
8228
|
callManager: this.callManager,
|
|
8223
8229
|
apiManager: this.apiManager
|
|
@@ -8437,7 +8443,7 @@ class _l extends w {
|
|
|
8437
8443
|
const r = this.connectionManager.getConnectionConfiguration()?.sipServerUrl;
|
|
8438
8444
|
if (r === void 0)
|
|
8439
8445
|
throw new Error("No sipServerUrl for sendOffer");
|
|
8440
|
-
return
|
|
8446
|
+
return Aa({
|
|
8441
8447
|
serverUrl: r,
|
|
8442
8448
|
offer: n,
|
|
8443
8449
|
token: e.token,
|
|
@@ -8447,7 +8453,7 @@ class _l extends w {
|
|
|
8447
8453
|
});
|
|
8448
8454
|
};
|
|
8449
8455
|
setCodecPreferences(e) {
|
|
8450
|
-
|
|
8456
|
+
wc(e, {
|
|
8451
8457
|
preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
|
|
8452
8458
|
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
8453
8459
|
});
|
|
@@ -8472,43 +8478,43 @@ class _l extends w {
|
|
|
8472
8478
|
};
|
|
8473
8479
|
}
|
|
8474
8480
|
export {
|
|
8475
|
-
|
|
8481
|
+
ra as $,
|
|
8476
8482
|
h as A,
|
|
8477
8483
|
D as B,
|
|
8478
|
-
|
|
8479
|
-
|
|
8484
|
+
ha as C,
|
|
8485
|
+
Ba as D,
|
|
8480
8486
|
an as E,
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8487
|
+
Yo as F,
|
|
8488
|
+
bl as G,
|
|
8489
|
+
vc as H,
|
|
8490
|
+
lc as I,
|
|
8491
|
+
Fs as J,
|
|
8492
|
+
Ji as K,
|
|
8493
|
+
Ir as L,
|
|
8494
|
+
Ja as M,
|
|
8489
8495
|
Cs as N,
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8496
|
+
rc as O,
|
|
8497
|
+
Ca as P,
|
|
8498
|
+
Nl as Q,
|
|
8493
8499
|
H as R,
|
|
8494
|
-
|
|
8495
|
-
|
|
8500
|
+
Tc as S,
|
|
8501
|
+
Rl as T,
|
|
8496
8502
|
en as U,
|
|
8497
|
-
|
|
8498
|
-
|
|
8503
|
+
_l as V,
|
|
8504
|
+
ta as W,
|
|
8499
8505
|
Y as X,
|
|
8500
8506
|
Ee as Y,
|
|
8501
|
-
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
|
|
8506
|
-
|
|
8507
|
-
|
|
8508
|
-
|
|
8507
|
+
ia as Z,
|
|
8508
|
+
sa as _,
|
|
8509
|
+
Ml as a,
|
|
8510
|
+
na as a0,
|
|
8511
|
+
qi as a1,
|
|
8512
|
+
Ki as a2,
|
|
8513
|
+
vl as b,
|
|
8514
|
+
Ol as c,
|
|
8509
8515
|
Ht as d,
|
|
8510
8516
|
fe as e,
|
|
8511
|
-
|
|
8517
|
+
Aa as f,
|
|
8512
8518
|
Yt as g,
|
|
8513
8519
|
Ue as h,
|
|
8514
8520
|
Be as i,
|
|
@@ -8520,8 +8526,8 @@ export {
|
|
|
8520
8526
|
Bt as o,
|
|
8521
8527
|
Re as p,
|
|
8522
8528
|
ps as q,
|
|
8523
|
-
|
|
8524
|
-
|
|
8529
|
+
fl as r,
|
|
8530
|
+
Il as s,
|
|
8525
8531
|
v as t,
|
|
8526
8532
|
m as u,
|
|
8527
8533
|
Ye as v,
|