sip-connector 28.3.0 → 28.4.0
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-D1IwYjNa.js → @SipConnector-Atk5WNG4.js} +745 -723
- package/dist/@SipConnector-BbUiWxNW.cjs +1 -0
- package/dist/CallManager/CallStateMachine/CallStateMachine.d.ts +7 -0
- package/dist/CallManager/CallStateMachine/state.d.ts +3 -0
- package/dist/CallManager/CallStateMachine/types.d.ts +3 -0
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/utils/validators.d.ts +1 -0
- package/package.json +1 -1
- package/dist/@SipConnector-FHUBOY5f.cjs +0 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { NameAddrHeader as
|
|
2
|
-
import { MediaStreamTrackMock as
|
|
3
|
-
import { TypedEvents as G, EventEmitterProxy as w, Events as
|
|
4
|
-
import
|
|
5
|
-
import { resolveRequesterByTimeout as
|
|
6
|
-
import { CancelableRequest as
|
|
7
|
-
import { createActor as
|
|
8
|
-
import { repeatedCallsAsync as
|
|
9
|
-
import { createStackPromises as Et, isPromiseIsNotActualError as
|
|
10
|
-
import { UAParser as
|
|
1
|
+
import { NameAddrHeader as ln, URI as hn, SessionStatus as un, IncomingResponse as lt, C as ht } from "@krivega/jssip";
|
|
2
|
+
import { MediaStreamTrackMock as gn, createAudioMediaStreamTrackMock as En, createVideoMediaStreamTrackMock as Tn } from "webrtc-mock";
|
|
3
|
+
import { TypedEvents as G, EventEmitterProxy as w, Events as mn } from "events-constructor";
|
|
4
|
+
import we from "debug";
|
|
5
|
+
import { resolveRequesterByTimeout as Sn, requesterByTimeoutsWithFailCalls as pn, DelayRequester as Cn, hasCanceledError as Rn, SetTimeoutRequest as ut } from "@krivega/timeout-requester";
|
|
6
|
+
import { CancelableRequest as Ce, isCanceledError as gt } from "@krivega/cancelable-promise";
|
|
7
|
+
import { createActor as Nn, setup as Z, assign as f, fromPromise as Re } from "xstate";
|
|
8
|
+
import { repeatedCallsAsync as Ge, hasCanceledError as In } from "repeated-calls";
|
|
9
|
+
import { createStackPromises as Et, isPromiseIsNotActualError as Tt } from "stack-promises";
|
|
10
|
+
import { UAParser as An } from "ua-parser-js";
|
|
11
11
|
import "sequent-promises";
|
|
12
|
-
import
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
}, A = (t) =>
|
|
18
|
-
var
|
|
19
|
-
const B = (t) => typeof t == "string" && t.trim().length > 0,
|
|
12
|
+
import vn, { isEqual as fn } from "lodash";
|
|
13
|
+
const ke = "sip-connector", Mn = we(ke), Pc = () => {
|
|
14
|
+
we.enable(`${ke}:*`);
|
|
15
|
+
}, yc = () => {
|
|
16
|
+
we.enable(`-${ke}:*`);
|
|
17
|
+
}, A = (t) => Mn.extend(t), _n = "Error decline with 603", On = 1006, bn = (t) => typeof t == "object" && t !== null && "code" in t && t.code === On, Pn = (t) => t.message === _n;
|
|
18
|
+
var Ee = /* @__PURE__ */ ((t) => (t.SPECTATOR = "SPECTATOR", t.PARTICIPANT = "PARTICIPANT", t))(Ee || {}), V = /* @__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))(V || {}), $ = /* @__PURE__ */ ((t) => (t.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", t.MAIN_CAM = "application/vinteo.webrtc.maincam", t.CHANNELS = "application/vinteo.webrtc.channels", t.MEDIA_STATE = "application/vinteo.webrtc.mediastate", t.REFUSAL = "application/vinteo.webrtc.refusal", t.STATS = "application/vinteo.webrtc.stats", t))($ || {}), F = /* @__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))(F || {}), Te = /* @__PURE__ */ ((t) => (t.ADMIN_STOP_MIC = "ADMINSTOPMIC", t.ADMIN_START_MIC = "ADMINSTARTMIC", t))(Te || {}), mt = /* @__PURE__ */ ((t) => (t.H264 = "H264", t.VP8 = "VP8", t.VP9 = "VP9", t.AV1 = "AV1", t))(mt || {}), 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 || {}), oe = /* @__PURE__ */ ((t) => (t.AVAILABLE_CONTENTED_STREAM = "YOUCANRECEIVECONTENT", t.NOT_AVAILABLE_CONTENTED_STREAM = "CONTENTEND", t.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", t))(oe || {}), K = /* @__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))(K || {}), me = /* @__PURE__ */ ((t) => (t.ADMIN_SYNC_FORCED = "1", t.ADMIN_SYNC_NOT_FORCED = "0", t))(me || {}), Ue = /* @__PURE__ */ ((t) => (t.SPECTATOR_MANUAL = "0", t.BY_STATE_CAM = "1", t.SPECTATOR_FORCED = "2", t))(Ue || {}), St = /* @__PURE__ */ ((t) => (t.AUDIO = "AUDIO", t.VIDEO = "VIDEO", t.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", t))(St || {});
|
|
19
|
+
const B = (t) => typeof t == "string" && t.trim().length > 0, Oe = (t) => typeof t == "number" && !Number.isNaN(t) && Number.isFinite(t), yn = (t) => typeof t == "object" && t !== null && !Array.isArray(t), pt = (t) => typeof t == "boolean", Dn = (t) => Array.isArray(t) && t.every(B), Ct = [
|
|
20
20
|
"enter-room",
|
|
21
21
|
"main-cam-control",
|
|
22
22
|
"use-license",
|
|
@@ -46,13 +46,13 @@ const B = (t) => typeof t == "string" && t.trim().length > 0, Pn = (t) => typeof
|
|
|
46
46
|
"admin:stop-mic",
|
|
47
47
|
"admin:force-sync-media-state",
|
|
48
48
|
"failed-send-room-direct-p2p"
|
|
49
|
-
],
|
|
49
|
+
], Ln = () => new G(Ct), wn = (t) => !(!yn(t) || !B(t.conference) || !B(t.participant) || !B(t.jwt)), Q = (t, e) => {
|
|
50
50
|
const n = e.toLowerCase(), s = Object.entries(t).find(([, r]) => typeof r == "string" && r.toLowerCase() === n);
|
|
51
51
|
return s ? s[1] : void 0;
|
|
52
|
-
},
|
|
53
|
-
if (
|
|
52
|
+
}, Gn = (t) => typeof t == "string" && !Number.isNaN(Number(t)) && Number.isFinite(Number(t)), kn = (t) => {
|
|
53
|
+
if (Gn(t))
|
|
54
54
|
return Number(t);
|
|
55
|
-
},
|
|
55
|
+
}, Un = (t) => {
|
|
56
56
|
const e = t.toLowerCase();
|
|
57
57
|
if (e === "true" || e === "1")
|
|
58
58
|
return !0;
|
|
@@ -64,56 +64,56 @@ const B = (t) => typeof t == "string" && t.trim().length > 0, Pn = (t) => typeof
|
|
|
64
64
|
return;
|
|
65
65
|
const s = n.toLowerCase();
|
|
66
66
|
switch (e) {
|
|
67
|
-
case
|
|
67
|
+
case E.BEARER_TOKEN:
|
|
68
68
|
return n;
|
|
69
|
-
case
|
|
70
|
-
case
|
|
71
|
-
case
|
|
72
|
-
case
|
|
73
|
-
case
|
|
74
|
-
case
|
|
75
|
-
case
|
|
76
|
-
case
|
|
77
|
-
case
|
|
78
|
-
case
|
|
69
|
+
case E.CONTENT_ENTER_ROOM:
|
|
70
|
+
case E.PARTICIPANT_NAME:
|
|
71
|
+
case E.INPUT_CHANNELS:
|
|
72
|
+
case E.OUTPUT_CHANNELS:
|
|
73
|
+
case E.TRACKS_DIRECTION:
|
|
74
|
+
case E.AUDIO_ID:
|
|
75
|
+
case E.MAIN_CAM_RESOLUTION:
|
|
76
|
+
case E.MEDIA_STATE:
|
|
77
|
+
case E.NOTIFY:
|
|
78
|
+
case E.CONTENT_ENABLE_MEDIA_DEVICE:
|
|
79
79
|
return s;
|
|
80
|
-
case
|
|
81
|
-
case
|
|
82
|
-
case
|
|
83
|
-
case
|
|
84
|
-
case
|
|
85
|
-
case
|
|
86
|
-
return
|
|
87
|
-
case
|
|
88
|
-
return Q(Tt, s);
|
|
89
|
-
case g.CONTENT_TYPE:
|
|
90
|
-
return Q(V, s);
|
|
91
|
-
case g.CONTENT_USE_LICENSE:
|
|
80
|
+
case E.MEDIA_TYPE:
|
|
81
|
+
case E.MAIN_CAM_STATE:
|
|
82
|
+
case E.MIC_STATE:
|
|
83
|
+
case E.AVAILABLE_INCOMING_BITRATE:
|
|
84
|
+
case E.AUDIO_TRACK_COUNT:
|
|
85
|
+
case E.VIDEO_TRACK_COUNT:
|
|
86
|
+
return kn(s);
|
|
87
|
+
case E.CONTENTED_STREAM_CODEC:
|
|
92
88
|
return Q(mt, s);
|
|
93
|
-
case
|
|
89
|
+
case E.CONTENT_TYPE:
|
|
90
|
+
return Q(V, s);
|
|
91
|
+
case E.CONTENT_USE_LICENSE:
|
|
92
|
+
return Q(St, s);
|
|
93
|
+
case E.MAIN_CAM:
|
|
94
94
|
return Q(F, s);
|
|
95
|
-
case
|
|
95
|
+
case E.MIC:
|
|
96
96
|
return Q(Te, s);
|
|
97
|
-
case
|
|
97
|
+
case E.MEDIA_SYNC:
|
|
98
98
|
return Q(me, s);
|
|
99
|
-
case
|
|
100
|
-
return Q(
|
|
101
|
-
case
|
|
102
|
-
return Q(
|
|
103
|
-
case
|
|
99
|
+
case E.CONTENT_PARTICIPANT_STATE:
|
|
100
|
+
return Q(Ee, s);
|
|
101
|
+
case E.SPECTATOR_MODE:
|
|
102
|
+
return Q(Ue, s);
|
|
103
|
+
case E.CONTENTED_STREAM_STATE:
|
|
104
104
|
return Q(oe, s);
|
|
105
|
-
case
|
|
106
|
-
return
|
|
105
|
+
case E.IS_DIRECT_PEER_TO_PEER:
|
|
106
|
+
return Un(s);
|
|
107
107
|
default:
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
111
|
var U = /* @__PURE__ */ ((t) => (t.CHANNELS = "channels", t.WEBCAST_STARTED = "WebcastStarted", t.WEBCAST_STOPPED = "WebcastStopped", t.ACCOUNT_CHANGED = "accountChanged", t.ACCOUNT_DELETED = "accountDeleted", t.ADDED_TO_LIST_MODERATORS = "addedToListModerators", t.REMOVED_FROM_LIST_MODERATORS = "removedFromListModerators", t.ACCEPTING_WORD_REQUEST = "ParticipationRequestAccepted", t.CANCELLING_WORD_REQUEST = "ParticipationRequestRejected", t.MOVE_REQUEST_TO_STREAM = "ParticipantMovedToWebcast", t.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "ConferenceParticipantTokenIssued", t))(U || {});
|
|
112
|
-
const
|
|
113
|
-
class
|
|
112
|
+
const $e = A("ApiManager");
|
|
113
|
+
class Fn extends w {
|
|
114
114
|
callManager;
|
|
115
115
|
constructor() {
|
|
116
|
-
super(
|
|
116
|
+
super(Ln());
|
|
117
117
|
}
|
|
118
118
|
subscribe({
|
|
119
119
|
connectionManager: e,
|
|
@@ -146,7 +146,7 @@ class Un extends w {
|
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
148
|
async sendChannels({ inputChannels: e, outputChannels: n }) {
|
|
149
|
-
const s = this.getEstablishedRTCSessionProtected(), r = `${
|
|
149
|
+
const s = this.getEstablishedRTCSessionProtected(), r = `${E.INPUT_CHANNELS}: ${e}`, i = `${E.OUTPUT_CHANNELS}: ${n}`, a = [
|
|
150
150
|
r,
|
|
151
151
|
i
|
|
152
152
|
];
|
|
@@ -158,7 +158,7 @@ class Un extends w {
|
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
160
|
async sendMediaState({ cam: e, mic: n }, s = {}) {
|
|
161
|
-
const r = this.getEstablishedRTCSessionProtected(), i = `${
|
|
161
|
+
const r = this.getEstablishedRTCSessionProtected(), i = `${E.MEDIA_STATE}: currentstate`, a = `${E.MAIN_CAM_STATE}: ${Number(e)}`, o = `${E.MIC_STATE}: ${Number(n)}`, c = [
|
|
162
162
|
i,
|
|
163
163
|
a,
|
|
164
164
|
o
|
|
@@ -172,14 +172,14 @@ class Un extends w {
|
|
|
172
172
|
async sendStats({
|
|
173
173
|
availableIncomingBitrate: e
|
|
174
174
|
}) {
|
|
175
|
-
const n = this.getEstablishedRTCSessionProtected(), r = [`${
|
|
175
|
+
const n = this.getEstablishedRTCSessionProtected(), r = [`${E.AVAILABLE_INCOMING_BITRATE}: ${e}`];
|
|
176
176
|
return n.sendInfo($.STATS, void 0, {
|
|
177
177
|
noTerminateWhenError: !0,
|
|
178
178
|
extraHeaders: r
|
|
179
179
|
});
|
|
180
180
|
}
|
|
181
181
|
async sendRefusalToTurnOn(e, n = {}) {
|
|
182
|
-
const s = this.getEstablishedRTCSessionProtected(), a = e === "mic" ? 0 : 1, c = [`${
|
|
182
|
+
const s = this.getEstablishedRTCSessionProtected(), a = e === "mic" ? 0 : 1, c = [`${E.MEDIA_TYPE}: ${a}`];
|
|
183
183
|
return s.sendInfo($.REFUSAL, void 0, {
|
|
184
184
|
noTerminateWhenError: !0,
|
|
185
185
|
...n,
|
|
@@ -219,7 +219,7 @@ class Un extends w {
|
|
|
219
219
|
...e,
|
|
220
220
|
extraHeaders: s
|
|
221
221
|
}).catch((r) => {
|
|
222
|
-
if (
|
|
222
|
+
if (Pn(r))
|
|
223
223
|
throw r;
|
|
224
224
|
});
|
|
225
225
|
}
|
|
@@ -234,13 +234,13 @@ class Un extends w {
|
|
|
234
234
|
};
|
|
235
235
|
maybeHandleNotify = (e) => {
|
|
236
236
|
try {
|
|
237
|
-
const n = e.getHeader(
|
|
237
|
+
const n = e.getHeader(E.NOTIFY);
|
|
238
238
|
if (n) {
|
|
239
239
|
const s = JSON.parse(n);
|
|
240
240
|
this.handleNotify(s);
|
|
241
241
|
}
|
|
242
242
|
} catch (n) {
|
|
243
|
-
|
|
243
|
+
$e("error parse notify", n);
|
|
244
244
|
}
|
|
245
245
|
};
|
|
246
246
|
handleNotify = (e) => {
|
|
@@ -290,14 +290,14 @@ class Un extends w {
|
|
|
290
290
|
break;
|
|
291
291
|
}
|
|
292
292
|
default:
|
|
293
|
-
|
|
293
|
+
$e("unknown cmd", e);
|
|
294
294
|
}
|
|
295
295
|
};
|
|
296
296
|
handleNewInfo = (e) => {
|
|
297
297
|
const { originator: n } = e;
|
|
298
298
|
if (n !== "remote")
|
|
299
299
|
return;
|
|
300
|
-
const { request: s } = e, r = s, i = y(r,
|
|
300
|
+
const { request: s } = e, r = s, i = y(r, E.CONTENT_TYPE);
|
|
301
301
|
if (i !== void 0)
|
|
302
302
|
switch (i) {
|
|
303
303
|
case V.ENTER_ROOM: {
|
|
@@ -412,13 +412,13 @@ class Un extends w {
|
|
|
412
412
|
participant: n,
|
|
413
413
|
jwt: s
|
|
414
414
|
};
|
|
415
|
-
|
|
415
|
+
wn(r) && this.events.trigger(
|
|
416
416
|
"conference:participant-token-issued",
|
|
417
417
|
r
|
|
418
418
|
);
|
|
419
419
|
};
|
|
420
420
|
maybeTriggerChannels = (e) => {
|
|
421
|
-
const n = y(e,
|
|
421
|
+
const n = y(e, E.INPUT_CHANNELS), s = y(e, E.OUTPUT_CHANNELS);
|
|
422
422
|
if (n !== void 0 && s !== void 0) {
|
|
423
423
|
const r = {
|
|
424
424
|
inputChannels: n,
|
|
@@ -428,7 +428,7 @@ class Un extends w {
|
|
|
428
428
|
}
|
|
429
429
|
};
|
|
430
430
|
triggerEnterRoom = (e) => {
|
|
431
|
-
const n = y(e,
|
|
431
|
+
const n = y(e, E.CONTENT_ENTER_ROOM), s = y(e, E.PARTICIPANT_NAME), r = y(e, E.BEARER_TOKEN), i = y(e, E.IS_DIRECT_PEER_TO_PEER);
|
|
432
432
|
n !== void 0 && s !== void 0 && this.events.trigger("enter-room", {
|
|
433
433
|
room: n,
|
|
434
434
|
participantName: s,
|
|
@@ -437,11 +437,11 @@ class Un extends w {
|
|
|
437
437
|
});
|
|
438
438
|
};
|
|
439
439
|
triggerContentedStreamState = (e) => {
|
|
440
|
-
const n = y(e,
|
|
440
|
+
const n = y(e, E.CONTENTED_STREAM_STATE);
|
|
441
441
|
if (n !== void 0)
|
|
442
442
|
switch (n) {
|
|
443
443
|
case oe.AVAILABLE_CONTENTED_STREAM: {
|
|
444
|
-
const s = y(e,
|
|
444
|
+
const s = y(e, E.CONTENTED_STREAM_CODEC);
|
|
445
445
|
this.events.trigger("contented-stream:available", { codec: s });
|
|
446
446
|
break;
|
|
447
447
|
}
|
|
@@ -456,9 +456,9 @@ class Un extends w {
|
|
|
456
456
|
}
|
|
457
457
|
};
|
|
458
458
|
maybeTriggerParticipantMoveRequest = (e) => {
|
|
459
|
-
const n = y(e,
|
|
460
|
-
if (n ===
|
|
461
|
-
const i = r ===
|
|
459
|
+
const n = y(e, E.CONTENT_PARTICIPANT_STATE), s = y(e, E.AUDIO_ID), r = y(e, E.SPECTATOR_MODE);
|
|
460
|
+
if (n === Ee.SPECTATOR) {
|
|
461
|
+
const i = r === Ue.BY_STATE_CAM;
|
|
462
462
|
s === void 0 ? (this.events.trigger("participant:move-request-to-spectators-synthetic", {
|
|
463
463
|
isAvailableSendingMedia: i
|
|
464
464
|
}), this.events.trigger("participant:move-request-to-spectators", {
|
|
@@ -473,10 +473,10 @@ class Un extends w {
|
|
|
473
473
|
audioId: s
|
|
474
474
|
}));
|
|
475
475
|
}
|
|
476
|
-
n ===
|
|
476
|
+
n === Ee.PARTICIPANT && this.events.trigger("participant:move-request-to-participants");
|
|
477
477
|
};
|
|
478
478
|
triggerMainCamControl = (e) => {
|
|
479
|
-
const n = y(e,
|
|
479
|
+
const n = y(e, E.MAIN_CAM), s = y(e, E.MEDIA_SYNC), r = s === me.ADMIN_SYNC_FORCED;
|
|
480
480
|
if (n === F.ADMIN_START_MAIN_CAM) {
|
|
481
481
|
this.events.trigger("admin:start-main-cam", { isSyncForced: r });
|
|
482
482
|
return;
|
|
@@ -486,29 +486,29 @@ class Un extends w {
|
|
|
486
486
|
return;
|
|
487
487
|
}
|
|
488
488
|
(n === F.RESUME_MAIN_CAM || n === F.PAUSE_MAIN_CAM) && s !== void 0 && this.events.trigger("admin:force-sync-media-state", { isSyncForced: r });
|
|
489
|
-
const i = y(e,
|
|
489
|
+
const i = y(e, E.MAIN_CAM_RESOLUTION);
|
|
490
490
|
this.events.trigger("main-cam-control", {
|
|
491
491
|
mainCam: n,
|
|
492
492
|
resolutionMainCam: i
|
|
493
493
|
});
|
|
494
494
|
};
|
|
495
495
|
triggerMicControl = (e) => {
|
|
496
|
-
const n = y(e,
|
|
496
|
+
const n = y(e, E.MIC), r = y(e, E.MEDIA_SYNC) === me.ADMIN_SYNC_FORCED;
|
|
497
497
|
n === Te.ADMIN_START_MIC ? this.events.trigger("admin:start-mic", { isSyncForced: r }) : n === Te.ADMIN_STOP_MIC && this.events.trigger("admin:stop-mic", { isSyncForced: r });
|
|
498
498
|
};
|
|
499
499
|
triggerUseLicense = (e) => {
|
|
500
|
-
const n = y(e,
|
|
500
|
+
const n = y(e, E.CONTENT_USE_LICENSE);
|
|
501
501
|
n !== void 0 && this.events.trigger("use-license", n);
|
|
502
502
|
};
|
|
503
503
|
async sendEnterRoomProtected(e) {
|
|
504
504
|
return this.getEstablishedRTCSessionProtected().sendInfo(V.ENTER_ROOM, void 0, { extraHeaders: e });
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
|
-
const
|
|
508
|
-
class
|
|
509
|
-
countInner =
|
|
510
|
-
initialCount =
|
|
511
|
-
limitInner =
|
|
507
|
+
const xe = 0, Bn = 30;
|
|
508
|
+
class $n {
|
|
509
|
+
countInner = xe;
|
|
510
|
+
initialCount = xe;
|
|
511
|
+
limitInner = Bn;
|
|
512
512
|
isInProgress = !1;
|
|
513
513
|
onStatusChange;
|
|
514
514
|
constructor({
|
|
@@ -541,7 +541,7 @@ class Bn {
|
|
|
541
541
|
this.countInner = this.initialCount, this.finishAttempt();
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
|
-
class
|
|
544
|
+
class xn {
|
|
545
545
|
connectionManager;
|
|
546
546
|
interval;
|
|
547
547
|
checkTelephonyByTimeout = void 0;
|
|
@@ -556,7 +556,7 @@ class $n {
|
|
|
556
556
|
onSuccessRequest: n,
|
|
557
557
|
onFailRequest: s
|
|
558
558
|
}) {
|
|
559
|
-
this.stop(), this.cancelableGetParameters = new
|
|
559
|
+
this.stop(), this.cancelableGetParameters = new Ce(e), this.checkTelephonyByTimeout = Sn({
|
|
560
560
|
isDontStopOnFail: !0,
|
|
561
561
|
requestInterval: this.interval,
|
|
562
562
|
request: async () => {
|
|
@@ -576,7 +576,7 @@ class $n {
|
|
|
576
576
|
this.checkTelephonyByTimeout?.stop(), this.checkTelephonyByTimeout = void 0, this.cancelableGetParameters?.cancelRequest(), this.cancelableGetParameters = void 0;
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
|
-
class
|
|
579
|
+
class Rt {
|
|
580
580
|
callManager;
|
|
581
581
|
disposers = [];
|
|
582
582
|
constructor({ callManager: e }) {
|
|
@@ -601,15 +601,15 @@ class pt {
|
|
|
601
601
|
this.callManager.isCallActive ? e?.() : n();
|
|
602
602
|
}
|
|
603
603
|
}
|
|
604
|
-
const
|
|
605
|
-
class
|
|
604
|
+
const Vn = 15e3, qn = 2, Ne = A("PingServerRequester");
|
|
605
|
+
class Hn {
|
|
606
606
|
connectionManager;
|
|
607
607
|
pingServerByTimeoutWithFailCalls;
|
|
608
608
|
constructor({ connectionManager: e }) {
|
|
609
|
-
this.connectionManager = e, this.pingServerByTimeoutWithFailCalls =
|
|
609
|
+
this.connectionManager = e, this.pingServerByTimeoutWithFailCalls = pn(qn, {
|
|
610
610
|
whenPossibleRequest: async () => {
|
|
611
611
|
},
|
|
612
|
-
requestInterval:
|
|
612
|
+
requestInterval: Vn,
|
|
613
613
|
request: async () => (Ne("ping"), this.connectionManager.ping().then(() => {
|
|
614
614
|
Ne("ping success");
|
|
615
615
|
}))
|
|
@@ -622,20 +622,20 @@ class qn {
|
|
|
622
622
|
this.pingServerByTimeoutWithFailCalls.stop();
|
|
623
623
|
}
|
|
624
624
|
}
|
|
625
|
-
const
|
|
626
|
-
class
|
|
625
|
+
const Ve = A("PingServerIfNotActiveCallRequester");
|
|
626
|
+
class Wn {
|
|
627
627
|
pingServerRequester;
|
|
628
628
|
notActiveCallSubscriber;
|
|
629
629
|
constructor({
|
|
630
630
|
connectionManager: e,
|
|
631
631
|
callManager: n
|
|
632
632
|
}) {
|
|
633
|
-
this.pingServerRequester = new
|
|
633
|
+
this.pingServerRequester = new Hn({
|
|
634
634
|
connectionManager: e
|
|
635
|
-
}), this.notActiveCallSubscriber = new
|
|
635
|
+
}), this.notActiveCallSubscriber = new Rt({ callManager: n });
|
|
636
636
|
}
|
|
637
637
|
start({ onFailRequest: e }) {
|
|
638
|
-
|
|
638
|
+
Ve("start"), this.notActiveCallSubscriber.subscribe({
|
|
639
639
|
onActive: () => {
|
|
640
640
|
this.pingServerRequester.stop();
|
|
641
641
|
},
|
|
@@ -645,13 +645,13 @@ class Hn {
|
|
|
645
645
|
});
|
|
646
646
|
}
|
|
647
647
|
stop() {
|
|
648
|
-
|
|
648
|
+
Ve("stop"), this.pingServerRequester.stop(), this.unsubscribeCallStatusChange();
|
|
649
649
|
}
|
|
650
650
|
unsubscribeCallStatusChange() {
|
|
651
651
|
this.notActiveCallSubscriber.unsubscribe();
|
|
652
652
|
}
|
|
653
653
|
}
|
|
654
|
-
class
|
|
654
|
+
class Qn {
|
|
655
655
|
connectionManager;
|
|
656
656
|
isRegistrationFailed = !1;
|
|
657
657
|
disposers = [];
|
|
@@ -660,7 +660,7 @@ class Wn {
|
|
|
660
660
|
connectionManager: e,
|
|
661
661
|
callManager: n
|
|
662
662
|
}) {
|
|
663
|
-
this.connectionManager = e, this.notActiveCallSubscriber = new
|
|
663
|
+
this.connectionManager = e, this.notActiveCallSubscriber = new Rt({ callManager: n });
|
|
664
664
|
}
|
|
665
665
|
subscribe(e) {
|
|
666
666
|
this.unsubscribe(), this.disposers.push(
|
|
@@ -687,30 +687,30 @@ class Wn {
|
|
|
687
687
|
this.isRegistrationFailed = !1;
|
|
688
688
|
}
|
|
689
689
|
}
|
|
690
|
-
const
|
|
690
|
+
const Yn = {
|
|
691
691
|
baseRetryDelayMs: 1e3,
|
|
692
692
|
maxRetryDelayMs: 3e4,
|
|
693
693
|
warningThreshold: 3,
|
|
694
694
|
criticalThreshold: 5
|
|
695
|
-
},
|
|
695
|
+
}, qe = {
|
|
696
696
|
none: 0,
|
|
697
697
|
warning: 1,
|
|
698
698
|
critical: 2
|
|
699
699
|
};
|
|
700
|
-
class
|
|
700
|
+
class jn {
|
|
701
701
|
failCount = 0;
|
|
702
702
|
nextRetryAtMs = 0;
|
|
703
703
|
escalationLevel = "none";
|
|
704
704
|
options;
|
|
705
705
|
constructor(e) {
|
|
706
706
|
this.options = {
|
|
707
|
-
...
|
|
707
|
+
...Yn,
|
|
708
708
|
...e
|
|
709
709
|
};
|
|
710
710
|
}
|
|
711
711
|
registerFailure() {
|
|
712
712
|
this.failCount += 1;
|
|
713
|
-
const e = this.resolveEscalationLevel(this.failCount), n =
|
|
713
|
+
const e = this.resolveEscalationLevel(this.failCount), n = qe[e] > qe[this.escalationLevel];
|
|
714
714
|
this.escalationLevel = e;
|
|
715
715
|
const s = Date.now(), r = Math.max(this.nextRetryAtMs - s, 0);
|
|
716
716
|
if (r > 0)
|
|
@@ -743,8 +743,8 @@ class Yn {
|
|
|
743
743
|
);
|
|
744
744
|
}
|
|
745
745
|
}
|
|
746
|
-
const k = A("AutoConnectorRuntime"),
|
|
747
|
-
class
|
|
746
|
+
const k = A("AutoConnectorRuntime"), zn = 3e3, Jn = 15e3;
|
|
747
|
+
class Kn {
|
|
748
748
|
connectionManager;
|
|
749
749
|
connectionQueueManager;
|
|
750
750
|
checkTelephonyRequester;
|
|
@@ -756,18 +756,18 @@ class Jn {
|
|
|
756
756
|
emitters;
|
|
757
757
|
reconnectActions;
|
|
758
758
|
constructor(e) {
|
|
759
|
-
this.connectionManager = e.connectionManager, this.connectionQueueManager = e.connectionQueueManager, this.emitters = e.emitters, this.reconnectActions = e.reconnectActions, this.checkTelephonyRequester = new
|
|
759
|
+
this.connectionManager = e.connectionManager, this.connectionQueueManager = e.connectionQueueManager, this.emitters = e.emitters, this.reconnectActions = e.reconnectActions, this.checkTelephonyRequester = new xn({
|
|
760
760
|
connectionManager: this.connectionManager,
|
|
761
|
-
interval: e.options?.checkTelephonyRequestInterval ??
|
|
762
|
-
}), this.pingServerIfNotActiveCallRequester = new
|
|
761
|
+
interval: e.options?.checkTelephonyRequestInterval ?? Jn
|
|
762
|
+
}), this.pingServerIfNotActiveCallRequester = new Wn({
|
|
763
763
|
connectionManager: this.connectionManager,
|
|
764
764
|
callManager: e.callManager
|
|
765
|
-
}), this.registrationFailedOutOfCallSubscriber = new
|
|
765
|
+
}), this.registrationFailedOutOfCallSubscriber = new Qn({
|
|
766
766
|
connectionManager: this.connectionManager,
|
|
767
767
|
callManager: e.callManager
|
|
768
768
|
}), this.delayBetweenAttempts = new Cn(
|
|
769
|
-
e.options?.timeoutBetweenAttempts ??
|
|
770
|
-
), this.telephonyFailPolicy = new
|
|
769
|
+
e.options?.timeoutBetweenAttempts ?? zn
|
|
770
|
+
), this.telephonyFailPolicy = new jn(e.options?.telephonyFailPolicy), this.attemptsState = new $n({
|
|
771
771
|
onStatusChange: this.emitters.emitStatusChange
|
|
772
772
|
});
|
|
773
773
|
}
|
|
@@ -872,7 +872,7 @@ class ee {
|
|
|
872
872
|
subscriptions = [];
|
|
873
873
|
stateChangeListeners = /* @__PURE__ */ new Set();
|
|
874
874
|
constructor(e) {
|
|
875
|
-
this.actor =
|
|
875
|
+
this.actor = Nn(e), this.actor.start(), this.addSubscription(
|
|
876
876
|
this.subscribe((n) => {
|
|
877
877
|
const s = n.value;
|
|
878
878
|
this.stateChangeListeners.forEach((r) => {
|
|
@@ -914,14 +914,14 @@ class ee {
|
|
|
914
914
|
return this.subscriptions.push(n), n;
|
|
915
915
|
}
|
|
916
916
|
}
|
|
917
|
-
const
|
|
918
|
-
class
|
|
919
|
-
resolveParametersRequester = new
|
|
917
|
+
const Nt = "Not ready for connection", Xn = (t) => t instanceof Error && t.message === Nt, Zn = () => new Error(Nt), es = async (t) => typeof t == "function" ? t() : t, ts = 3;
|
|
918
|
+
class ns {
|
|
919
|
+
resolveParametersRequester = new Ce(es);
|
|
920
920
|
cancelableConnectWithRepeatedCalls;
|
|
921
921
|
numberOfConnectionAttempts;
|
|
922
922
|
dependencies;
|
|
923
923
|
constructor(e, {
|
|
924
|
-
numberOfConnectionAttempts: n =
|
|
924
|
+
numberOfConnectionAttempts: n = ts
|
|
925
925
|
} = {}) {
|
|
926
926
|
this.dependencies = e, this.numberOfConnectionAttempts = n, this.proxyEvents();
|
|
927
927
|
}
|
|
@@ -931,7 +931,7 @@ class ts {
|
|
|
931
931
|
...s
|
|
932
932
|
}), s)).catch((s) => {
|
|
933
933
|
const r = s ?? new Error("Failed to connect to server");
|
|
934
|
-
throw
|
|
934
|
+
throw gt(r) || this.dependencies.events.trigger("connect-failed", r), r;
|
|
935
935
|
}));
|
|
936
936
|
disconnect = async ({ cancelRequests: e = !0 } = {}) => {
|
|
937
937
|
e && this.cancelRequests(), this.dependencies.events.trigger("disconnecting", {});
|
|
@@ -949,10 +949,10 @@ class ts {
|
|
|
949
949
|
}
|
|
950
950
|
connectWithDuplicatedCalls = async (e, { numberOfConnectionAttempts: n = this.numberOfConnectionAttempts } = {}) => {
|
|
951
951
|
const s = async () => this.connectInner(e), r = (i) => {
|
|
952
|
-
const c = this.dependencies.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e),
|
|
953
|
-
return c ||
|
|
952
|
+
const c = this.dependencies.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), g = i != null && !bn(i);
|
|
953
|
+
return c || g;
|
|
954
954
|
};
|
|
955
|
-
return this.cancelableConnectWithRepeatedCalls =
|
|
955
|
+
return this.cancelableConnectWithRepeatedCalls = Ge({
|
|
956
956
|
targetFunction: s,
|
|
957
957
|
isComplete: r,
|
|
958
958
|
callLimit: n,
|
|
@@ -978,8 +978,8 @@ class ts {
|
|
|
978
978
|
sessionTimers: a,
|
|
979
979
|
registerExpires: o,
|
|
980
980
|
connectionRecoveryMinInterval: c,
|
|
981
|
-
connectionRecoveryMaxInterval:
|
|
982
|
-
userAgent:
|
|
981
|
+
connectionRecoveryMaxInterval: g,
|
|
982
|
+
userAgent: C,
|
|
983
983
|
displayName: I = "",
|
|
984
984
|
register: b = !1,
|
|
985
985
|
extraHeaders: _ = []
|
|
@@ -996,8 +996,8 @@ class ts {
|
|
|
996
996
|
sessionTimers: a,
|
|
997
997
|
registerExpires: o,
|
|
998
998
|
connectionRecoveryMinInterval: c,
|
|
999
|
-
connectionRecoveryMaxInterval:
|
|
1000
|
-
userAgent:
|
|
999
|
+
connectionRecoveryMaxInterval: g,
|
|
1000
|
+
userAgent: C,
|
|
1001
1001
|
remoteAddress: i,
|
|
1002
1002
|
extraHeaders: _
|
|
1003
1003
|
},
|
|
@@ -1022,21 +1022,21 @@ class ts {
|
|
|
1022
1022
|
return;
|
|
1023
1023
|
}
|
|
1024
1024
|
let i;
|
|
1025
|
-
i = ((
|
|
1025
|
+
i = ((g, C) => {
|
|
1026
1026
|
if (e.register === !0)
|
|
1027
|
-
return this.dependencies.registrationManager.subscribeToStartEvents(
|
|
1027
|
+
return this.dependencies.registrationManager.subscribeToStartEvents(g, C);
|
|
1028
1028
|
const I = "connected", b = ["disconnected"];
|
|
1029
|
-
return this.dependencies.events.on(I,
|
|
1030
|
-
this.dependencies.events.on(_,
|
|
1029
|
+
return this.dependencies.events.on(I, g), b.forEach((_) => {
|
|
1030
|
+
this.dependencies.events.on(_, C);
|
|
1031
1031
|
}), () => {
|
|
1032
|
-
this.dependencies.events.off(I,
|
|
1033
|
-
this.dependencies.events.off(_,
|
|
1032
|
+
this.dependencies.events.off(I, g), b.forEach((_) => {
|
|
1033
|
+
this.dependencies.events.off(_, C);
|
|
1034
1034
|
});
|
|
1035
1035
|
};
|
|
1036
1036
|
})(() => {
|
|
1037
1037
|
i?.(), n(e);
|
|
1038
|
-
}, (
|
|
1039
|
-
i?.(), s(
|
|
1038
|
+
}, (g) => {
|
|
1039
|
+
i?.(), s(g);
|
|
1040
1040
|
}), this.dependencies.stateMachine.toStartUa(e), r.start();
|
|
1041
1041
|
});
|
|
1042
1042
|
cancelConnectWithRepeatedCalls() {
|
|
@@ -1050,11 +1050,11 @@ class ts {
|
|
|
1050
1050
|
}
|
|
1051
1051
|
}
|
|
1052
1052
|
var d = /* @__PURE__ */ ((t) => (t.IDLE = "connection:idle", t.PREPARING = "connection:preparing", t.CONNECTING = "connection:connecting", t.CONNECTED = "connection:connected", t.REGISTERED = "connection:registered", t.ESTABLISHED = "connection:established", t.DISCONNECTING = "connection:disconnecting", t.DISCONNECTED = "connection:disconnected", t))(d || {}), N = /* @__PURE__ */ ((t) => (t.LOG_TRANSITION = "logTransition", t.LOG_STATE_CHANGE = "logStateChange", t.SET_CONNECTION_CONFIGURATION = "setConnectionConfiguration", t.CLEAR_CONNECTION_CONFIGURATION = "clearConnectionConfiguration", t))(N || {}), T = /* @__PURE__ */ ((t) => (t.START_CONNECT = "START_CONNECT", t.START_UA = "START_UA", t.START_DISCONNECT = "START_DISCONNECT", t.UA_CONNECTED = "UA_CONNECTED", t.UA_CONNECTING = "UA_CONNECTING", t.UA_REGISTERED = "UA_REGISTERED", t.UA_UNREGISTERED = "UA_UNREGISTERED", t.UA_DISCONNECTED = "UA_DISCONNECTED", t.RESET = "RESET", t))(T || {});
|
|
1053
|
-
const
|
|
1053
|
+
const It = {
|
|
1054
1054
|
connectionConfiguration: void 0
|
|
1055
|
-
},
|
|
1055
|
+
}, He = A("ConnectionStateMachine"), ss = () => Z({
|
|
1056
1056
|
types: {
|
|
1057
|
-
context:
|
|
1057
|
+
context: It,
|
|
1058
1058
|
events: {}
|
|
1059
1059
|
},
|
|
1060
1060
|
guards: {
|
|
@@ -1068,16 +1068,16 @@ const Nt = {
|
|
|
1068
1068
|
connectionConfiguration: void 0
|
|
1069
1069
|
})),
|
|
1070
1070
|
[N.LOG_TRANSITION]: (t, e) => {
|
|
1071
|
-
|
|
1071
|
+
He(`State transition: ${e.from} -> ${e.to} (${e.event})`);
|
|
1072
1072
|
},
|
|
1073
1073
|
[N.LOG_STATE_CHANGE]: (t, e) => {
|
|
1074
|
-
|
|
1074
|
+
He("ConnectionStateMachine state changed", e.state);
|
|
1075
1075
|
}
|
|
1076
1076
|
}
|
|
1077
|
-
}),
|
|
1077
|
+
}), rs = () => ss().createMachine({
|
|
1078
1078
|
id: "connection",
|
|
1079
1079
|
initial: d.IDLE,
|
|
1080
|
-
context:
|
|
1080
|
+
context: It,
|
|
1081
1081
|
states: {
|
|
1082
1082
|
[d.IDLE]: {
|
|
1083
1083
|
entry: [
|
|
@@ -1397,12 +1397,12 @@ const Nt = {
|
|
|
1397
1397
|
}
|
|
1398
1398
|
}
|
|
1399
1399
|
}
|
|
1400
|
-
}),
|
|
1401
|
-
class
|
|
1400
|
+
}), is = rs(), as = A("ConnectionStateMachine");
|
|
1401
|
+
class os extends ee {
|
|
1402
1402
|
events;
|
|
1403
1403
|
unsubscribeFromEvents;
|
|
1404
1404
|
constructor(e) {
|
|
1405
|
-
super(
|
|
1405
|
+
super(is), this.events = e, this.subscribeToEvents();
|
|
1406
1406
|
}
|
|
1407
1407
|
get isIdle() {
|
|
1408
1408
|
return this.hasState(d.IDLE);
|
|
@@ -1464,7 +1464,7 @@ class as extends ee {
|
|
|
1464
1464
|
}
|
|
1465
1465
|
sendEvent(e) {
|
|
1466
1466
|
if (!this.actor.getSnapshot().can(e)) {
|
|
1467
|
-
|
|
1467
|
+
as(
|
|
1468
1468
|
`Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`
|
|
1469
1469
|
);
|
|
1470
1470
|
return;
|
|
@@ -1498,7 +1498,7 @@ class as extends ee {
|
|
|
1498
1498
|
};
|
|
1499
1499
|
}
|
|
1500
1500
|
}
|
|
1501
|
-
const
|
|
1501
|
+
const At = [
|
|
1502
1502
|
"connecting",
|
|
1503
1503
|
"connected",
|
|
1504
1504
|
"disconnected",
|
|
@@ -1508,7 +1508,7 @@ const It = [
|
|
|
1508
1508
|
"registrationFailed",
|
|
1509
1509
|
"newMessage",
|
|
1510
1510
|
"sipEvent"
|
|
1511
|
-
],
|
|
1511
|
+
], cs = [
|
|
1512
1512
|
"disconnecting",
|
|
1513
1513
|
"connect-started",
|
|
1514
1514
|
"connect-succeeded",
|
|
@@ -1516,8 +1516,8 @@ const It = [
|
|
|
1516
1516
|
"connect-parameters-resolve-success",
|
|
1517
1517
|
"connect-parameters-resolve-failed",
|
|
1518
1518
|
"connected-with-configuration"
|
|
1519
|
-
],
|
|
1520
|
-
class
|
|
1519
|
+
], vt = [...At, ...cs], ds = () => new G(vt), ls = A("RegistrationManager");
|
|
1520
|
+
class hs {
|
|
1521
1521
|
events;
|
|
1522
1522
|
getUaProtected;
|
|
1523
1523
|
constructor(e) {
|
|
@@ -1539,7 +1539,7 @@ class ls {
|
|
|
1539
1539
|
try {
|
|
1540
1540
|
await this.unregister();
|
|
1541
1541
|
} catch (e) {
|
|
1542
|
-
|
|
1542
|
+
ls("tryRegister", e);
|
|
1543
1543
|
}
|
|
1544
1544
|
return this.register();
|
|
1545
1545
|
}
|
|
@@ -1554,7 +1554,7 @@ class ls {
|
|
|
1554
1554
|
};
|
|
1555
1555
|
}
|
|
1556
1556
|
}
|
|
1557
|
-
class
|
|
1557
|
+
class us {
|
|
1558
1558
|
uaFactory;
|
|
1559
1559
|
getUaProtected;
|
|
1560
1560
|
constructor(e) {
|
|
@@ -1600,29 +1600,29 @@ class hs {
|
|
|
1600
1600
|
extraHeaders: a
|
|
1601
1601
|
}) {
|
|
1602
1602
|
return new Promise((o, c) => {
|
|
1603
|
-
const { configuration:
|
|
1603
|
+
const { configuration: g } = this.uaFactory.createConfiguration({
|
|
1604
1604
|
sipServerUrl: r,
|
|
1605
1605
|
displayName: n,
|
|
1606
1606
|
userAgent: e,
|
|
1607
1607
|
sipServerIp: s
|
|
1608
|
-
}),
|
|
1608
|
+
}), C = this.uaFactory.createUA({ ...g, remoteAddress: i, extraHeaders: a }), I = () => {
|
|
1609
1609
|
const _ = new Error("Telephony is not available");
|
|
1610
1610
|
c(_);
|
|
1611
1611
|
};
|
|
1612
|
-
|
|
1612
|
+
C.once("disconnected", I);
|
|
1613
1613
|
const b = () => {
|
|
1614
|
-
|
|
1614
|
+
C.removeAllListeners(), C.once("disconnected", () => {
|
|
1615
1615
|
o();
|
|
1616
|
-
}),
|
|
1616
|
+
}), C.stop();
|
|
1617
1617
|
};
|
|
1618
|
-
|
|
1618
|
+
C.once("connected", b), C.start();
|
|
1619
1619
|
});
|
|
1620
1620
|
}
|
|
1621
1621
|
}
|
|
1622
|
-
function
|
|
1622
|
+
function gs(t) {
|
|
1623
1623
|
return (e) => `sip:${e}@${t}`;
|
|
1624
1624
|
}
|
|
1625
|
-
const Es = (t, e) => () => Math.floor(Math.random() * (e - t)) + t,
|
|
1625
|
+
const Es = (t, e) => () => Math.floor(Math.random() * (e - t)) + t, Ts = (t) => t.trim().replaceAll(" ", "_"), ms = Es(1e5, 99999999), Ss = (t) => {
|
|
1626
1626
|
const e = [];
|
|
1627
1627
|
return t !== void 0 && t !== "" && e.push(`X-Vinteo-Remote: ${t}`), e;
|
|
1628
1628
|
};
|
|
@@ -1651,10 +1651,10 @@ class X {
|
|
|
1651
1651
|
throw new Error("user is required for authorized connection");
|
|
1652
1652
|
}
|
|
1653
1653
|
static resolveAuthorizationUser(e, n) {
|
|
1654
|
-
return e && n !== void 0 && n.trim() !== "" ? n.trim() : `${
|
|
1654
|
+
return e && n !== void 0 && n.trim() !== "" ? n.trim() : `${ms()}`;
|
|
1655
1655
|
}
|
|
1656
1656
|
static buildExtraHeaders(e, n) {
|
|
1657
|
-
const s = e !== void 0 && e !== "" ?
|
|
1657
|
+
const s = e !== void 0 && e !== "" ? Ss(e) : [];
|
|
1658
1658
|
return n === void 0 ? s : [...s, ...n];
|
|
1659
1659
|
}
|
|
1660
1660
|
createConfiguration({
|
|
@@ -1667,8 +1667,8 @@ class X {
|
|
|
1667
1667
|
sessionTimers: o = !1,
|
|
1668
1668
|
registerExpires: c = 300,
|
|
1669
1669
|
// 5 minutes in sec
|
|
1670
|
-
connectionRecoveryMinInterval:
|
|
1671
|
-
connectionRecoveryMaxInterval:
|
|
1670
|
+
connectionRecoveryMinInterval: g = 2,
|
|
1671
|
+
connectionRecoveryMaxInterval: C = 6,
|
|
1672
1672
|
userAgent: I
|
|
1673
1673
|
}) {
|
|
1674
1674
|
X.validateParametersConnection({
|
|
@@ -1678,20 +1678,20 @@ class X {
|
|
|
1678
1678
|
sipServerIp: i,
|
|
1679
1679
|
sipServerUrl: s
|
|
1680
1680
|
});
|
|
1681
|
-
const b = X.resolveAuthorizationUser(a, e), _ =
|
|
1681
|
+
const b = X.resolveAuthorizationUser(a, e), _ = gs(i), W = _(b), L = new this.JsSIP.WebSocketInterface(`wss://${s}/webrtc/wss/`);
|
|
1682
1682
|
return {
|
|
1683
1683
|
configuration: {
|
|
1684
1684
|
password: n,
|
|
1685
1685
|
register: a,
|
|
1686
1686
|
uri: W,
|
|
1687
|
-
display_name:
|
|
1687
|
+
display_name: Ts(r),
|
|
1688
1688
|
user_agent: I,
|
|
1689
1689
|
sdpSemantics: "unified-plan",
|
|
1690
1690
|
sockets: [L],
|
|
1691
1691
|
session_timers: o,
|
|
1692
1692
|
register_expires: c,
|
|
1693
|
-
connection_recovery_min_interval:
|
|
1694
|
-
connection_recovery_max_interval:
|
|
1693
|
+
connection_recovery_min_interval: g,
|
|
1694
|
+
connection_recovery_max_interval: C
|
|
1695
1695
|
},
|
|
1696
1696
|
helpers: {
|
|
1697
1697
|
socket: L,
|
|
@@ -1713,12 +1713,12 @@ class X {
|
|
|
1713
1713
|
extraHeaders: e.extraHeaders
|
|
1714
1714
|
});
|
|
1715
1715
|
return n.eachTriggers((a, o) => {
|
|
1716
|
-
const c =
|
|
1716
|
+
const c = At.find((g) => g === o);
|
|
1717
1717
|
c && i.on(c, a);
|
|
1718
1718
|
}), { ua: i, helpers: r };
|
|
1719
1719
|
}
|
|
1720
1720
|
}
|
|
1721
|
-
const
|
|
1721
|
+
const ps = A("ConnectionManager");
|
|
1722
1722
|
class Cs extends w {
|
|
1723
1723
|
stateMachine;
|
|
1724
1724
|
ua;
|
|
@@ -1730,13 +1730,13 @@ class Cs extends w {
|
|
|
1730
1730
|
constructor({ JsSIP: e }, {
|
|
1731
1731
|
numberOfConnectionAttempts: n
|
|
1732
1732
|
} = {}) {
|
|
1733
|
-
super(
|
|
1733
|
+
super(ds()), this.uaFactory = new X(e), this.registrationManager = new hs({
|
|
1734
1734
|
events: this.events,
|
|
1735
1735
|
getUaProtected: this.getUaProtected
|
|
1736
|
-
}), this.stateMachine = new
|
|
1736
|
+
}), this.stateMachine = new os(this.events), this.sipOperations = new us({
|
|
1737
1737
|
uaFactory: this.uaFactory,
|
|
1738
1738
|
getUaProtected: this.getUaProtected
|
|
1739
|
-
}), this.connectionFlow = new
|
|
1739
|
+
}), this.connectionFlow = new ns(
|
|
1740
1740
|
{
|
|
1741
1741
|
events: this.events,
|
|
1742
1742
|
uaFactory: this.uaFactory,
|
|
@@ -1784,7 +1784,7 @@ class Cs extends w {
|
|
|
1784
1784
|
return this.stateMachine.isRegisterEnabled();
|
|
1785
1785
|
}
|
|
1786
1786
|
connect = async (e, n) => this.disconnect().catch((s) => {
|
|
1787
|
-
|
|
1787
|
+
ps("connect: disconnect error", s);
|
|
1788
1788
|
}).then(async () => this.connectWithProcessError(e, n));
|
|
1789
1789
|
disconnect = async () => {
|
|
1790
1790
|
if (this.isConfigured() || this.requested)
|
|
@@ -1824,7 +1824,7 @@ class Cs extends w {
|
|
|
1824
1824
|
getUa = () => this.ua;
|
|
1825
1825
|
connectWithProcessError = async (e, n) => {
|
|
1826
1826
|
if (!(n?.hasReadyForConnection?.() ?? !0))
|
|
1827
|
-
throw
|
|
1827
|
+
throw Zn();
|
|
1828
1828
|
return this.connectionFlow.connect(e, n).catch(async (r) => {
|
|
1829
1829
|
const i = r;
|
|
1830
1830
|
return this.disconnect().then(() => {
|
|
@@ -1835,7 +1835,7 @@ class Cs extends w {
|
|
|
1835
1835
|
});
|
|
1836
1836
|
};
|
|
1837
1837
|
}
|
|
1838
|
-
class
|
|
1838
|
+
class Rs {
|
|
1839
1839
|
connectionManager;
|
|
1840
1840
|
stackPromises = Et({
|
|
1841
1841
|
noRunIsNotActual: !0
|
|
@@ -1852,7 +1852,7 @@ class ps {
|
|
|
1852
1852
|
const Y = (t) => {
|
|
1853
1853
|
if (t !== null && typeof t == "object" && "error" in t)
|
|
1854
1854
|
return t.error;
|
|
1855
|
-
}, O = A("AutoConnectorMachine"),
|
|
1855
|
+
}, O = A("AutoConnectorMachine"), We = (t) => t.parameters, Ns = (t) => Z({
|
|
1856
1856
|
types: {
|
|
1857
1857
|
context: {},
|
|
1858
1858
|
events: {}
|
|
@@ -1898,7 +1898,7 @@ const Y = (t) => {
|
|
|
1898
1898
|
},
|
|
1899
1899
|
/** Ошибка «ещё не готовы к подключению» — без ретрая. */
|
|
1900
1900
|
isNotReadyForConnection: ({ event: e }) => {
|
|
1901
|
-
const n =
|
|
1901
|
+
const n = Xn(Y(e));
|
|
1902
1902
|
return O("isNotReadyForConnection:", n), n;
|
|
1903
1903
|
},
|
|
1904
1904
|
/** Политика опций запрещает повтор для этой ошибки. */
|
|
@@ -1908,12 +1908,12 @@ const Y = (t) => {
|
|
|
1908
1908
|
},
|
|
1909
1909
|
/** Промис коннекта снят очередью (`stack-promises`) — отмена попыток. */
|
|
1910
1910
|
isNotActualPromise: ({ event: e }) => {
|
|
1911
|
-
const n =
|
|
1911
|
+
const n = Tt(Y(e));
|
|
1912
1912
|
return O("isNotActualPromise:", n), n;
|
|
1913
1913
|
},
|
|
1914
1914
|
/** Отмена задержки (cancelable / timeout-requester). */
|
|
1915
1915
|
isWaitRetryCancelled: ({ event: e }) => {
|
|
1916
|
-
const n = Y(e), s =
|
|
1916
|
+
const n = Y(e), s = gt(n) || Rn(n);
|
|
1917
1917
|
return O("isWaitRetryCancelled:", s), s;
|
|
1918
1918
|
}
|
|
1919
1919
|
},
|
|
@@ -1948,11 +1948,11 @@ const Y = (t) => {
|
|
|
1948
1948
|
},
|
|
1949
1949
|
/** Лимит: завершить попытку, событие лимита, запуск опроса телефонии. */
|
|
1950
1950
|
onLimitReachedTransition: ({ context: e }) => {
|
|
1951
|
-
O("onLimitReachedTransition"), t.onLimitReached(
|
|
1951
|
+
O("onLimitReachedTransition"), t.onLimitReached(We(e));
|
|
1952
1952
|
},
|
|
1953
1953
|
/** Успешный invoke `connect`. */
|
|
1954
1954
|
onConnectDone: ({ context: e }) => {
|
|
1955
|
-
O("onConnectDone"), t.onConnectSucceeded(
|
|
1955
|
+
O("onConnectDone"), t.onConnectSucceeded(We(e));
|
|
1956
1956
|
},
|
|
1957
1957
|
assignHaltedError: f({
|
|
1958
1958
|
stopReason: () => "halted",
|
|
@@ -2003,7 +2003,7 @@ const Y = (t) => {
|
|
|
2003
2003
|
}
|
|
2004
2004
|
});
|
|
2005
2005
|
var M = /* @__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))(M || {});
|
|
2006
|
-
const
|
|
2006
|
+
const Is = () => ({
|
|
2007
2007
|
parameters: void 0,
|
|
2008
2008
|
afterDisconnect: "idle",
|
|
2009
2009
|
stopReason: void 0,
|
|
@@ -2017,10 +2017,10 @@ const Ns = () => ({
|
|
|
2017
2017
|
target: M.DISCONNECTING,
|
|
2018
2018
|
actions: "assignRestart"
|
|
2019
2019
|
}
|
|
2020
|
-
}),
|
|
2020
|
+
}), As = (t) => Ns(t).createMachine({
|
|
2021
2021
|
id: "autoConnector",
|
|
2022
2022
|
initial: M.IDLE,
|
|
2023
|
-
context:
|
|
2023
|
+
context: Is,
|
|
2024
2024
|
states: {
|
|
2025
2025
|
/** Ожидание: допустимы рестарт флоу или внешний стоп без побочных эффектов. */
|
|
2026
2026
|
[M.IDLE]: {
|
|
@@ -2222,14 +2222,14 @@ const Ns = () => ({
|
|
|
2222
2222
|
on: ne()
|
|
2223
2223
|
}
|
|
2224
2224
|
}
|
|
2225
|
-
}),
|
|
2226
|
-
class
|
|
2225
|
+
}), vs = A("AutoConnectorStateMachine");
|
|
2226
|
+
class fs extends ee {
|
|
2227
2227
|
constructor(e) {
|
|
2228
2228
|
super(e);
|
|
2229
2229
|
}
|
|
2230
2230
|
send(e) {
|
|
2231
2231
|
if (!this.actor.getSnapshot().can(e)) {
|
|
2232
|
-
|
|
2232
|
+
vs(
|
|
2233
2233
|
`[AutoConnectorStateMachine] Invalid transition: ${e.type} from ${String(this.state)}. Event cannot be processed in current state.`
|
|
2234
2234
|
);
|
|
2235
2235
|
return;
|
|
@@ -2249,11 +2249,11 @@ class vs extends ee {
|
|
|
2249
2249
|
this.toTelephonyResult("stillConnected");
|
|
2250
2250
|
}
|
|
2251
2251
|
}
|
|
2252
|
-
const
|
|
2252
|
+
const Ms = (t) => new fs(As(t)), _s = "Failed to reconnect", Qe = (t) => t instanceof Error ? t : new Error(_s), Os = (t) => {
|
|
2253
2253
|
const e = ({
|
|
2254
2254
|
stopReason: n,
|
|
2255
2255
|
lastError: s
|
|
2256
|
-
}) => n === "cancelled" && !
|
|
2256
|
+
}) => n === "cancelled" && !Tt(s) || n === "failed" ? Qe(s) : s;
|
|
2257
2257
|
return {
|
|
2258
2258
|
canRetryOnError: t.canRetryOnError,
|
|
2259
2259
|
shouldDisconnectBeforeAttempt: () => t.runtime.shouldDisconnectBeforeAttempt(),
|
|
@@ -2290,7 +2290,7 @@ const fs = (t) => new vs(Is(t)), Ms = "Failed to reconnect", We = (t) => t insta
|
|
|
2290
2290
|
t.runtime.onTelephonyStillConnected();
|
|
2291
2291
|
}
|
|
2292
2292
|
};
|
|
2293
|
-
},
|
|
2293
|
+
}, ft = [
|
|
2294
2294
|
"before-attempt",
|
|
2295
2295
|
"success",
|
|
2296
2296
|
"failed-all-attempts",
|
|
@@ -2300,20 +2300,20 @@ const fs = (t) => new vs(Is(t)), Ms = "Failed to reconnect", We = (t) => t insta
|
|
|
2300
2300
|
"limit-reached-attempts",
|
|
2301
2301
|
"telephony-check-failure",
|
|
2302
2302
|
"telephony-check-escalated"
|
|
2303
|
-
],
|
|
2303
|
+
], bs = () => new G(ft), se = {
|
|
2304
2304
|
START: "start",
|
|
2305
2305
|
MANUAL_RESTART: "manual-restart",
|
|
2306
2306
|
REGISTRATION_FAILED_OUT_OF_CALL: "registration-failed-out-of-call",
|
|
2307
2307
|
TELEPHONY_DISCONNECTED: "telephony-disconnected",
|
|
2308
2308
|
TELEPHONY_CHECK_FAILED: "telephony-check-failed"
|
|
2309
|
-
},
|
|
2309
|
+
}, Ps = {
|
|
2310
2310
|
[se.START]: 0,
|
|
2311
2311
|
[se.TELEPHONY_DISCONNECTED]: 1,
|
|
2312
2312
|
[se.TELEPHONY_CHECK_FAILED]: 1,
|
|
2313
2313
|
[se.REGISTRATION_FAILED_OUT_OF_CALL]: 3,
|
|
2314
2314
|
[se.MANUAL_RESTART]: 4
|
|
2315
|
-
},
|
|
2316
|
-
class
|
|
2315
|
+
}, Ye = (t) => Ps[t];
|
|
2316
|
+
class ys {
|
|
2317
2317
|
generation = 0;
|
|
2318
2318
|
lastRequest;
|
|
2319
2319
|
coalesceWindowMs;
|
|
@@ -2321,9 +2321,9 @@ class Ps {
|
|
|
2321
2321
|
this.coalesceWindowMs = e;
|
|
2322
2322
|
}
|
|
2323
2323
|
register(e) {
|
|
2324
|
-
const n = Date.now(), s =
|
|
2324
|
+
const n = Date.now(), s = Ye(e), { lastRequest: r } = this;
|
|
2325
2325
|
if (r !== void 0 && n - r.timestamp < this.coalesceWindowMs) {
|
|
2326
|
-
const a =
|
|
2326
|
+
const a = Ye(r.reason);
|
|
2327
2327
|
if (s <= a)
|
|
2328
2328
|
return {
|
|
2329
2329
|
shouldRequest: !1,
|
|
@@ -2346,21 +2346,21 @@ class Ps {
|
|
|
2346
2346
|
this.lastRequest = void 0;
|
|
2347
2347
|
}
|
|
2348
2348
|
}
|
|
2349
|
-
const
|
|
2349
|
+
const Ds = 250, Ls = {
|
|
2350
2350
|
LIMIT_REACHED: "Limit reached"
|
|
2351
|
-
},
|
|
2352
|
-
class
|
|
2351
|
+
}, ws = (t) => !0, j = A("AutoConnectorManager"), Gs = "start", ks = "manual-restart";
|
|
2352
|
+
class Us extends w {
|
|
2353
2353
|
stateMachine;
|
|
2354
2354
|
runtime;
|
|
2355
|
-
reconnectCoalescer = new
|
|
2356
|
-
coalesceWindowMs:
|
|
2355
|
+
reconnectCoalescer = new ys({
|
|
2356
|
+
coalesceWindowMs: Ds
|
|
2357
2357
|
});
|
|
2358
2358
|
constructor({
|
|
2359
2359
|
connectionQueueManager: e,
|
|
2360
2360
|
connectionManager: n,
|
|
2361
2361
|
callManager: s
|
|
2362
2362
|
}, r) {
|
|
2363
|
-
super(
|
|
2363
|
+
super(bs()), this.runtime = new Kn({
|
|
2364
2364
|
connectionManager: n,
|
|
2365
2365
|
connectionQueueManager: e,
|
|
2366
2366
|
callManager: s,
|
|
@@ -2370,7 +2370,7 @@ class ks extends w {
|
|
|
2370
2370
|
this.events.trigger("before-attempt", {});
|
|
2371
2371
|
},
|
|
2372
2372
|
emitLimitReachedAttempts: () => {
|
|
2373
|
-
this.events.trigger("limit-reached-attempts", new Error(
|
|
2373
|
+
this.events.trigger("limit-reached-attempts", new Error(Ls.LIMIT_REACHED));
|
|
2374
2374
|
},
|
|
2375
2375
|
emitSuccess: () => {
|
|
2376
2376
|
j("handleSucceededAttempt"), this.events.trigger("success");
|
|
@@ -2400,15 +2400,15 @@ class ks extends w {
|
|
|
2400
2400
|
this.stateMachine.toTelephonyResultStillConnected();
|
|
2401
2401
|
}
|
|
2402
2402
|
}
|
|
2403
|
-
}), this.stateMachine =
|
|
2404
|
-
|
|
2403
|
+
}), this.stateMachine = Ms(
|
|
2404
|
+
Os({
|
|
2405
2405
|
runtime: this.runtime,
|
|
2406
|
-
canRetryOnError: r?.canRetryOnError ??
|
|
2406
|
+
canRetryOnError: r?.canRetryOnError ?? ws
|
|
2407
2407
|
})
|
|
2408
2408
|
);
|
|
2409
2409
|
}
|
|
2410
2410
|
start(e) {
|
|
2411
|
-
j("auto connector start"), this.requestReconnect(e,
|
|
2411
|
+
j("auto connector start"), this.requestReconnect(e, Gs);
|
|
2412
2412
|
}
|
|
2413
2413
|
restart() {
|
|
2414
2414
|
j("auto connector restart");
|
|
@@ -2417,7 +2417,7 @@ class ks extends w {
|
|
|
2417
2417
|
j("auto connector restart skipped: no parameters in context");
|
|
2418
2418
|
return;
|
|
2419
2419
|
}
|
|
2420
|
-
this.requestReconnect(e,
|
|
2420
|
+
this.requestReconnect(e, ks);
|
|
2421
2421
|
}
|
|
2422
2422
|
stop() {
|
|
2423
2423
|
j("auto connector stop"), this.resetReconnectCoalescingState(), this.stateMachine.toStop();
|
|
@@ -2449,34 +2449,33 @@ class ks extends w {
|
|
|
2449
2449
|
this.reconnectCoalescer.reset();
|
|
2450
2450
|
}
|
|
2451
2451
|
}
|
|
2452
|
-
const
|
|
2453
|
-
Us,
|
|
2452
|
+
const Fs = "incomingCall", Bs = "declinedIncomingCall", $s = "failedIncomingCall", xs = "terminatedIncomingCall", Mt = "connecting", Vs = "connected", qs = "disconnected", Hs = "newRTCSession", Ws = "registered", Qs = "unregistered", Ys = "registrationFailed", js = "newMessage", zs = "sipEvent", Js = "availableSecondRemoteStream", Ks = "notAvailableSecondRemoteStream", Xs = "mustStopPresentation", Zs = "enterRoom", er = "useLicense", tr = "peerconnection:confirmed", nr = "peerconnection:ontrack", sr = "channels", rr = "channels:notify", ir = "ended:fromserver", ar = "main-cam-control", or = "admin:stop-main-cam", cr = "admin:start-main-cam", dr = "admin:stop-mic", lr = "admin:start-mic", hr = "admin:force-sync-media-state", ur = "participant:added-to-list-moderators", gr = "participant:removed-from-list-moderators", Er = "participant:move-request-to-stream", Tr = "participant:move-request-to-spectators", mr = "participant:move-request-to-participants", Sr = "participation:accepting-word-request", pr = "participation:cancelling-word-request", Cr = "webcast:started", Rr = "webcast:stopped", Nr = "account:changed", Ir = "account:deleted", Ar = "conference:participant-token-issued", vr = "ended", fr = "sending", Mr = "reinvite", _r = "replaces", Or = "refer", br = "progress", Pr = "accepted", yr = "confirmed", Dr = "peerconnection", Lr = "failed", wr = "muted", Gr = "unmuted", kr = "newDTMF", Ur = "newInfo", Fr = "hold", Br = "unhold", $r = "update", xr = "sdp", Vr = "icecandidate", qr = "getusermediafailed", Hr = "peerconnection:createofferfailed", Wr = "peerconnection:createanswerfailed", Qr = "peerconnection:setlocaldescriptionfailed", Yr = "peerconnection:setremotedescriptionfailed", jr = "presentation:start", zr = "presentation:started", Jr = "presentation:end", Kr = "presentation:ended", Xr = "presentation:failed", Zr = [
|
|
2454
2453
|
Fs,
|
|
2455
|
-
$s,
|
|
2456
2454
|
Bs,
|
|
2457
|
-
|
|
2455
|
+
xs,
|
|
2456
|
+
$s,
|
|
2458
2457
|
Sr,
|
|
2458
|
+
pr,
|
|
2459
2459
|
Er,
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
Rr,
|
|
2460
|
+
rr,
|
|
2461
|
+
Ar,
|
|
2463
2462
|
Nr,
|
|
2463
|
+
Ir,
|
|
2464
2464
|
Cr,
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
],
|
|
2469
|
-
|
|
2470
|
-
xs,
|
|
2465
|
+
Rr,
|
|
2466
|
+
ur,
|
|
2467
|
+
gr
|
|
2468
|
+
], ei = [
|
|
2469
|
+
Mt,
|
|
2471
2470
|
Vs,
|
|
2472
2471
|
qs,
|
|
2473
2472
|
Hs,
|
|
2474
2473
|
Ws,
|
|
2475
2474
|
Qs,
|
|
2476
2475
|
Ys,
|
|
2477
|
-
js
|
|
2478
|
-
|
|
2479
|
-
|
|
2476
|
+
js,
|
|
2477
|
+
zs
|
|
2478
|
+
], ti = [
|
|
2480
2479
|
Js,
|
|
2481
2480
|
Ks,
|
|
2482
2481
|
Xs,
|
|
@@ -2484,19 +2483,19 @@ const Us = "incomingCall", Fs = "declinedIncomingCall", Bs = "failedIncomingCall
|
|
|
2484
2483
|
er,
|
|
2485
2484
|
tr,
|
|
2486
2485
|
nr,
|
|
2487
|
-
|
|
2486
|
+
sr,
|
|
2488
2487
|
ir,
|
|
2489
|
-
or,
|
|
2490
2488
|
ar,
|
|
2491
2489
|
cr,
|
|
2490
|
+
or,
|
|
2492
2491
|
dr,
|
|
2493
2492
|
lr,
|
|
2494
|
-
|
|
2495
|
-
Tr
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
ft,
|
|
2493
|
+
hr,
|
|
2494
|
+
Tr,
|
|
2495
|
+
mr
|
|
2496
|
+
], be = [
|
|
2499
2497
|
vr,
|
|
2498
|
+
Mt,
|
|
2500
2499
|
fr,
|
|
2501
2500
|
Mr,
|
|
2502
2501
|
_r,
|
|
@@ -2523,15 +2522,16 @@ const Us = "incomingCall", Fs = "declinedIncomingCall", Bs = "failedIncomingCall
|
|
|
2523
2522
|
jr,
|
|
2524
2523
|
zr,
|
|
2525
2524
|
Jr,
|
|
2526
|
-
Kr
|
|
2525
|
+
Kr,
|
|
2526
|
+
Xr
|
|
2527
2527
|
];
|
|
2528
|
-
[...
|
|
2528
|
+
[...ei, ...Zr];
|
|
2529
2529
|
[
|
|
2530
|
-
...
|
|
2531
|
-
...
|
|
2530
|
+
...be,
|
|
2531
|
+
...ti
|
|
2532
2532
|
];
|
|
2533
|
-
const
|
|
2534
|
-
class
|
|
2533
|
+
const ni = A("BaseSession.mock");
|
|
2534
|
+
class si {
|
|
2535
2535
|
originator;
|
|
2536
2536
|
connection;
|
|
2537
2537
|
events;
|
|
@@ -2545,7 +2545,7 @@ class ni {
|
|
|
2545
2545
|
eventHandlers: n,
|
|
2546
2546
|
remoteIdentity: s
|
|
2547
2547
|
}) {
|
|
2548
|
-
this.originator = e, this.events = new
|
|
2548
|
+
this.originator = e, this.events = new mn(be), this.initEvents(n), this.remote_identity = s;
|
|
2549
2549
|
}
|
|
2550
2550
|
get contact() {
|
|
2551
2551
|
throw new Error("Method not implemented.");
|
|
@@ -2641,7 +2641,7 @@ class ni {
|
|
|
2641
2641
|
return this.events.off(e, n), this;
|
|
2642
2642
|
}
|
|
2643
2643
|
removeAllListeners(e) {
|
|
2644
|
-
return
|
|
2644
|
+
return ni("Method not implemented. Event:", e), this;
|
|
2645
2645
|
}
|
|
2646
2646
|
setMaxListeners(e) {
|
|
2647
2647
|
throw new Error("Method not implemented.");
|
|
@@ -2676,7 +2676,7 @@ class ni {
|
|
|
2676
2676
|
});
|
|
2677
2677
|
}
|
|
2678
2678
|
// @ts-expect-error
|
|
2679
|
-
on = (e, n) => (
|
|
2679
|
+
on = (e, n) => (be.includes(e) && this.events.on(e, n), this);
|
|
2680
2680
|
trigger(e, n) {
|
|
2681
2681
|
this.events.trigger(e, n);
|
|
2682
2682
|
}
|
|
@@ -2700,7 +2700,7 @@ class ni {
|
|
|
2700
2700
|
return !0;
|
|
2701
2701
|
}
|
|
2702
2702
|
}
|
|
2703
|
-
class
|
|
2703
|
+
class je {
|
|
2704
2704
|
stats = (/* @__PURE__ */ new Map()).set("codec", { mimeType: "video/h264" });
|
|
2705
2705
|
dtmf = null;
|
|
2706
2706
|
track = null;
|
|
@@ -2743,7 +2743,7 @@ class Ye {
|
|
|
2743
2743
|
throw new Error("Method not implemented.");
|
|
2744
2744
|
}
|
|
2745
2745
|
}
|
|
2746
|
-
class
|
|
2746
|
+
class ze {
|
|
2747
2747
|
currentDirection = "sendrecv";
|
|
2748
2748
|
direction = "sendrecv";
|
|
2749
2749
|
// eslint-disable-next-line unicorn/no-null
|
|
@@ -2761,7 +2761,7 @@ class je {
|
|
|
2761
2761
|
stop() {
|
|
2762
2762
|
}
|
|
2763
2763
|
}
|
|
2764
|
-
class
|
|
2764
|
+
class ri extends EventTarget {
|
|
2765
2765
|
senders = [];
|
|
2766
2766
|
receivers = [];
|
|
2767
2767
|
canTrickleIceCandidates;
|
|
@@ -2846,16 +2846,16 @@ class si extends EventTarget {
|
|
|
2846
2846
|
getReceivers = () => this.receivers;
|
|
2847
2847
|
getSenders = () => this.senders;
|
|
2848
2848
|
addTrack = (e, ...n) => {
|
|
2849
|
-
const s = new
|
|
2849
|
+
const s = new je({ track: e }), r = new ze(s);
|
|
2850
2850
|
return r.mid = e.kind === "audio" ? "0" : "1", this.senders.push(s), this.dispatchTrackInternal(e, ...n), s;
|
|
2851
2851
|
};
|
|
2852
2852
|
// Дополнительный метод для тестов с возможностью установки mid
|
|
2853
2853
|
addTrackWithMid = (e, n) => {
|
|
2854
|
-
const s = new
|
|
2854
|
+
const s = new je({ track: e }), r = new ze(s);
|
|
2855
2855
|
return n === void 0 ? r.mid = e.kind === "audio" ? "0" : "1" : r.mid = n, this.senders.push(s), this.dispatchTrackInternal(e), s;
|
|
2856
2856
|
};
|
|
2857
2857
|
dispatchTrack(e) {
|
|
2858
|
-
this.dispatchTrackInternal(new
|
|
2858
|
+
this.dispatchTrackInternal(new gn(e));
|
|
2859
2859
|
}
|
|
2860
2860
|
dispatchTrackInternal(e, ...n) {
|
|
2861
2861
|
const s = new Event(
|
|
@@ -2869,14 +2869,14 @@ class si extends EventTarget {
|
|
|
2869
2869
|
}), this.dispatchEvent(s);
|
|
2870
2870
|
}
|
|
2871
2871
|
}
|
|
2872
|
-
function
|
|
2872
|
+
function ii(t) {
|
|
2873
2873
|
const e = t.match(/(purgatory)|[\d.]+/g);
|
|
2874
2874
|
if (!e)
|
|
2875
2875
|
throw new Error("wrong sip url");
|
|
2876
2876
|
return e[0];
|
|
2877
2877
|
}
|
|
2878
|
-
var
|
|
2879
|
-
const
|
|
2878
|
+
var _t = /* @__PURE__ */ ((t) => (t.LOCAL = "local", t.REMOTE = "remote", t.SYSTEM = "system", t))(_t || {});
|
|
2879
|
+
const Ot = [
|
|
2880
2880
|
"peerconnection",
|
|
2881
2881
|
"connecting",
|
|
2882
2882
|
"sending",
|
|
@@ -2907,7 +2907,7 @@ const _t = [
|
|
|
2907
2907
|
"peerconnection:createanswerfailed",
|
|
2908
2908
|
"peerconnection:setlocaldescriptionfailed",
|
|
2909
2909
|
"peerconnection:setremotedescriptionfailed"
|
|
2910
|
-
],
|
|
2910
|
+
], ai = [
|
|
2911
2911
|
"start-call",
|
|
2912
2912
|
"end-call",
|
|
2913
2913
|
"peerconnection:confirmed",
|
|
@@ -2919,11 +2919,11 @@ const _t = [
|
|
|
2919
2919
|
"recv-session-started",
|
|
2920
2920
|
"recv-session-ended",
|
|
2921
2921
|
"recv-quality-changed"
|
|
2922
|
-
],
|
|
2923
|
-
...
|
|
2924
|
-
...
|
|
2925
|
-
],
|
|
2926
|
-
class x extends
|
|
2922
|
+
], bt = [
|
|
2923
|
+
...Ot,
|
|
2924
|
+
...ai
|
|
2925
|
+
], oi = () => new G(bt), Je = 400, ci = "777", di = (t) => t.getVideoTracks().length > 0;
|
|
2926
|
+
class x extends si {
|
|
2927
2927
|
static presentationError;
|
|
2928
2928
|
static startPresentationError;
|
|
2929
2929
|
static countStartPresentationError = Number.POSITIVE_INFINITY;
|
|
@@ -2949,7 +2949,7 @@ class x extends ni {
|
|
|
2949
2949
|
}, 100), setTimeout(() => {
|
|
2950
2950
|
this.trigger("confirmed");
|
|
2951
2951
|
}, 200);
|
|
2952
|
-
},
|
|
2952
|
+
}, Je);
|
|
2953
2953
|
});
|
|
2954
2954
|
replaceMediaStream = jest.fn(async (e) => {
|
|
2955
2955
|
});
|
|
@@ -2967,8 +2967,8 @@ class x extends ni {
|
|
|
2967
2967
|
constructor({
|
|
2968
2968
|
eventHandlers: e,
|
|
2969
2969
|
originator: n,
|
|
2970
|
-
remoteIdentity: s = new
|
|
2971
|
-
new
|
|
2970
|
+
remoteIdentity: s = new ln(
|
|
2971
|
+
new hn("sip", "caller1", "test1.com", 5060),
|
|
2972
2972
|
"Test Caller 1"
|
|
2973
2973
|
),
|
|
2974
2974
|
delayStartPresentation: r = 0
|
|
@@ -2976,7 +2976,7 @@ class x extends ni {
|
|
|
2976
2976
|
super({ originator: n, eventHandlers: e, remoteIdentity: s }), this.delayStartPresentation = r;
|
|
2977
2977
|
}
|
|
2978
2978
|
static get C() {
|
|
2979
|
-
return
|
|
2979
|
+
return un;
|
|
2980
2980
|
}
|
|
2981
2981
|
static setPresentationError(e) {
|
|
2982
2982
|
this.presentationError = e;
|
|
@@ -3015,22 +3015,22 @@ class x extends ni {
|
|
|
3015
3015
|
const n = En();
|
|
3016
3016
|
n.id = "mainaudio1";
|
|
3017
3017
|
const s = [n];
|
|
3018
|
-
if (
|
|
3019
|
-
const i =
|
|
3018
|
+
if (di(e)) {
|
|
3019
|
+
const i = Tn();
|
|
3020
3020
|
i.id = "mainvideo1", s.push(i);
|
|
3021
3021
|
}
|
|
3022
|
-
this.connection = new
|
|
3022
|
+
this.connection = new ri(void 0, s), this.trigger("peerconnection", { peerconnection: this.connection }), this.addStream(e);
|
|
3023
3023
|
}
|
|
3024
3024
|
connect(e, { mediaStream: n } = {}) {
|
|
3025
|
-
const s =
|
|
3025
|
+
const s = ii(e);
|
|
3026
3026
|
return this.initPeerconnection(n), this.timeoutConnect = setTimeout(() => {
|
|
3027
|
-
e.includes(
|
|
3027
|
+
e.includes(ci) ? this.trigger("failed", {
|
|
3028
3028
|
originator: "remote",
|
|
3029
3029
|
message: "IncomingResponse",
|
|
3030
3030
|
cause: "Rejected"
|
|
3031
3031
|
}) : (this.trigger("connecting"), this.timeoutNewInfo = setTimeout(() => {
|
|
3032
3032
|
this.newInfo({
|
|
3033
|
-
originator:
|
|
3033
|
+
originator: _t.REMOTE,
|
|
3034
3034
|
// @ts-expect-error
|
|
3035
3035
|
request: {
|
|
3036
3036
|
getHeader: (r) => r === "content-type" ? "application/vinteo.webrtc.roomname" : r === "x-webrtc-enter-room" ? s : r === "x-webrtc-participant-name" ? "Test Caller 1" : ""
|
|
@@ -3041,7 +3041,7 @@ class x extends ni {
|
|
|
3041
3041
|
}, 200), this.timeoutConfirmed = setTimeout(() => {
|
|
3042
3042
|
this.trigger("confirmed");
|
|
3043
3043
|
}, 300));
|
|
3044
|
-
},
|
|
3044
|
+
}, Je), this.connection;
|
|
3045
3045
|
}
|
|
3046
3046
|
terminate({ status_code: e, cause: n } = {}) {
|
|
3047
3047
|
return this.status_code = e, this.trigger("ended", { status_code: e, cause: n, originator: "local" }), this.isEndedInner = !1, this;
|
|
@@ -3102,17 +3102,17 @@ class x extends ni {
|
|
|
3102
3102
|
clearTimeout(this.timeoutStartPresentation), clearTimeout(this.timeoutConnect), clearTimeout(this.timeoutNewInfo), clearTimeout(this.timeoutAccepted), clearTimeout(this.timeoutConfirmed);
|
|
3103
3103
|
}
|
|
3104
3104
|
}
|
|
3105
|
-
const
|
|
3105
|
+
const li = ["snapshot-changed"], hi = () => new G(li), ui = (t) => t.type === "participant", de = (t) => t.type === "spectator_synthetic", H = (t) => t.type === "spectator", gi = (t, e) => H(t) && !H(e), Ei = (t, e) => H(e), Ti = (t, e) => {
|
|
3106
3106
|
const n = H(t) || de(t), s = H(e) || de(e);
|
|
3107
3107
|
return n && !s;
|
|
3108
|
-
},
|
|
3108
|
+
}, mi = (t, e) => {
|
|
3109
3109
|
const n = H(t) || de(t), s = H(e) || de(e);
|
|
3110
3110
|
return !n && s;
|
|
3111
3111
|
}, Ie = {
|
|
3112
3112
|
type: "participant"
|
|
3113
|
-
},
|
|
3113
|
+
}, Si = {
|
|
3114
3114
|
type: "spectator_synthetic"
|
|
3115
|
-
},
|
|
3115
|
+
}, pi = (t) => ({
|
|
3116
3116
|
type: "spectator",
|
|
3117
3117
|
recvParams: t
|
|
3118
3118
|
});
|
|
@@ -3134,10 +3134,10 @@ class Ci {
|
|
|
3134
3134
|
this.isAvailableSendingMedia = !0, this.changeRole(Ie);
|
|
3135
3135
|
}
|
|
3136
3136
|
setCallRoleSpectatorSynthetic(e = !0) {
|
|
3137
|
-
this.isAvailableSendingMedia = e, this.changeRole(
|
|
3137
|
+
this.isAvailableSendingMedia = e, this.changeRole(Si);
|
|
3138
3138
|
}
|
|
3139
3139
|
setCallRoleSpectator(e, n = !0) {
|
|
3140
|
-
this.isAvailableSendingMedia = n, this.changeRole(
|
|
3140
|
+
this.isAvailableSendingMedia = n, this.changeRole(pi(e));
|
|
3141
3141
|
}
|
|
3142
3142
|
changeRole(e) {
|
|
3143
3143
|
const n = this.role;
|
|
@@ -3151,7 +3151,7 @@ class Ci {
|
|
|
3151
3151
|
this.role = Ie, this.isAvailableSendingMedia = !0;
|
|
3152
3152
|
}
|
|
3153
3153
|
hasParticipant() {
|
|
3154
|
-
return
|
|
3154
|
+
return ui(this.role);
|
|
3155
3155
|
}
|
|
3156
3156
|
hasSpectatorSynthetic() {
|
|
3157
3157
|
return de(this.role);
|
|
@@ -3171,7 +3171,7 @@ class Ci {
|
|
|
3171
3171
|
});
|
|
3172
3172
|
}
|
|
3173
3173
|
}
|
|
3174
|
-
const
|
|
3174
|
+
const Ri = (t, e) => t.type !== e.type ? !1 : t.type !== "spectator" ? !0 : e.type === "spectator" && t.recvParams.audioId === e.recvParams.audioId, Ni = (t, e) => t.license === e.license && t.isDuplexSendingMediaMode === e.isDuplexSendingMediaMode && Ri(t.role, e.role) && t.derived.isAvailableSendingMedia === e.derived.isAvailableSendingMedia, Ke = (t, e, n) => {
|
|
3175
3175
|
const s = t.getRole(), r = s.type === "spectator" || s.type === "spectator_synthetic";
|
|
3176
3176
|
return {
|
|
3177
3177
|
license: n,
|
|
@@ -3184,7 +3184,7 @@ const pi = (t, e) => t.type !== e.type ? !1 : t.type !== "spectator" ? !0 : e.ty
|
|
|
3184
3184
|
}
|
|
3185
3185
|
};
|
|
3186
3186
|
};
|
|
3187
|
-
class
|
|
3187
|
+
class Ii extends w {
|
|
3188
3188
|
roleManager = new Ci();
|
|
3189
3189
|
license;
|
|
3190
3190
|
isDuplexSendingMediaMode = !1;
|
|
@@ -3192,7 +3192,7 @@ class Ni extends w {
|
|
|
3192
3192
|
subscriptions = [];
|
|
3193
3193
|
dedupedTotal = 0;
|
|
3194
3194
|
constructor() {
|
|
3195
|
-
super(
|
|
3195
|
+
super(hi()), this.currentSnapshot = Ke(
|
|
3196
3196
|
this.roleManager,
|
|
3197
3197
|
this.isDuplexSendingMediaMode,
|
|
3198
3198
|
this.license
|
|
@@ -3259,7 +3259,7 @@ class Ni extends w {
|
|
|
3259
3259
|
}
|
|
3260
3260
|
notifySubscribers = () => {
|
|
3261
3261
|
const { previousSnapshot: e, currentSnapshot: n } = this.updateCurrentSnapshot();
|
|
3262
|
-
if (
|
|
3262
|
+
if (Ni(e, n)) {
|
|
3263
3263
|
this.dedupedTotal += 1;
|
|
3264
3264
|
return;
|
|
3265
3265
|
}
|
|
@@ -3270,7 +3270,7 @@ class Ni extends w {
|
|
|
3270
3270
|
};
|
|
3271
3271
|
updateCurrentSnapshot() {
|
|
3272
3272
|
const e = this.currentSnapshot;
|
|
3273
|
-
return this.currentSnapshot =
|
|
3273
|
+
return this.currentSnapshot = Ke(
|
|
3274
3274
|
this.roleManager,
|
|
3275
3275
|
this.isDuplexSendingMediaMode,
|
|
3276
3276
|
this.license
|
|
@@ -3286,10 +3286,10 @@ class Ni extends w {
|
|
|
3286
3286
|
this.isDuplexSendingMediaMode = e, this.notifySubscribers();
|
|
3287
3287
|
};
|
|
3288
3288
|
}
|
|
3289
|
-
const
|
|
3289
|
+
const Ai = (t, e) => {
|
|
3290
3290
|
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;
|
|
3291
3291
|
return r || i || a;
|
|
3292
|
-
},
|
|
3292
|
+
}, vi = (t) => t.major !== void 0 && t.minor !== void 0 && t.patch !== void 0, fi = (t) => (e) => vi(t) && Ai(t, e), Mi = (t = "") => {
|
|
3293
3293
|
const e = t.split(".");
|
|
3294
3294
|
if (e.length <= 1)
|
|
3295
3295
|
return {
|
|
@@ -3299,10 +3299,10 @@ const Ii = (t, e) => {
|
|
|
3299
3299
|
};
|
|
3300
3300
|
const [n, s, r] = e.map((i) => Number.parseInt(i, 10));
|
|
3301
3301
|
return { major: n, minor: s, patch: r };
|
|
3302
|
-
},
|
|
3303
|
-
const t = new
|
|
3302
|
+
}, _i = () => globalThis.process?.versions?.electron !== void 0, Pt = () => {
|
|
3303
|
+
const t = new An(), { name: e, version: n } = t.getBrowser(), { name: s } = t.getOS(), { type: r } = t.getDevice(), i = _i(), a = r === "mobile", o = Mi(n);
|
|
3304
3304
|
return {
|
|
3305
|
-
hasGreaterThanBrowserVersion:
|
|
3305
|
+
hasGreaterThanBrowserVersion: fi(o),
|
|
3306
3306
|
isMobileDevice: a,
|
|
3307
3307
|
isChrome: e === "Chrome" || i,
|
|
3308
3308
|
isYandexBrowser: e === "Yandex",
|
|
@@ -3310,19 +3310,19 @@ const Ii = (t, e) => {
|
|
|
3310
3310
|
isOpera: e === "Opera",
|
|
3311
3311
|
isWindows: s === "Windows"
|
|
3312
3312
|
};
|
|
3313
|
-
},
|
|
3313
|
+
}, Oi = A("stringifyMessage"), Dc = (t) => {
|
|
3314
3314
|
let e = "";
|
|
3315
3315
|
try {
|
|
3316
3316
|
e = JSON.stringify(t);
|
|
3317
3317
|
} catch (n) {
|
|
3318
|
-
|
|
3318
|
+
Oi("failed to stringify message", n);
|
|
3319
3319
|
}
|
|
3320
3320
|
return e;
|
|
3321
|
-
},
|
|
3321
|
+
}, bi = /^p2p.+to.+$/i, Pe = (t) => t !== void 0 && t.length > 0 && bi.test(t), Pi = "purgatory", Se = (t) => t === Pi, yi = (t, e) => {
|
|
3322
3322
|
t.getVideoTracks().forEach((s) => {
|
|
3323
3323
|
"contentHint" in s && s.contentHint !== e && (s.contentHint = e);
|
|
3324
3324
|
});
|
|
3325
|
-
},
|
|
3325
|
+
}, ge = (t, {
|
|
3326
3326
|
directionVideo: e,
|
|
3327
3327
|
directionAudio: n,
|
|
3328
3328
|
contentHint: s
|
|
@@ -3330,8 +3330,8 @@ const Ii = (t, e) => {
|
|
|
3330
3330
|
if (!t || e === "recvonly" && n === "recvonly")
|
|
3331
3331
|
return;
|
|
3332
3332
|
const r = n === "recvonly" ? [] : t.getAudioTracks(), i = e === "recvonly" ? [] : t.getVideoTracks(), a = [...r, ...i], o = new MediaStream(a);
|
|
3333
|
-
return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" &&
|
|
3334
|
-
},
|
|
3333
|
+
return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" && yi(o, s), o;
|
|
3334
|
+
}, Di = "api/v2/rtp2webrtc/offer", Li = async ({
|
|
3335
3335
|
serverUrl: t,
|
|
3336
3336
|
conferenceNumber: e,
|
|
3337
3337
|
quality: n,
|
|
@@ -3340,7 +3340,7 @@ const Ii = (t, e) => {
|
|
|
3340
3340
|
token: i
|
|
3341
3341
|
}) => {
|
|
3342
3342
|
const a = new URL(
|
|
3343
|
-
`https://${t.replace(/\/$/, "")}/${
|
|
3343
|
+
`https://${t.replace(/\/$/, "")}/${Di}/${encodeURIComponent(e)}`
|
|
3344
3344
|
);
|
|
3345
3345
|
a.searchParams.set("quality", n), a.searchParams.set("audio", String(s));
|
|
3346
3346
|
const o = {
|
|
@@ -3354,47 +3354,47 @@ const Ii = (t, e) => {
|
|
|
3354
3354
|
});
|
|
3355
3355
|
if (!c.ok)
|
|
3356
3356
|
throw new Error(`sendOffer failed with status ${c.status}`);
|
|
3357
|
-
const
|
|
3357
|
+
const g = await c.json();
|
|
3358
3358
|
return {
|
|
3359
|
-
type:
|
|
3360
|
-
sdp:
|
|
3359
|
+
type: g.type,
|
|
3360
|
+
sdp: g.sdp,
|
|
3361
3361
|
toJSON() {
|
|
3362
|
-
return
|
|
3362
|
+
return g;
|
|
3363
3363
|
}
|
|
3364
3364
|
};
|
|
3365
|
-
},
|
|
3365
|
+
}, wi = (t, e) => (t.degradationPreference = e.degradationPreference, t), Gi = (t, e) => {
|
|
3366
3366
|
t.encodings ??= [];
|
|
3367
3367
|
for (let n = t.encodings.length; n < e; n += 1)
|
|
3368
3368
|
t.encodings.push({});
|
|
3369
3369
|
return t;
|
|
3370
|
-
},
|
|
3371
|
-
if (
|
|
3370
|
+
}, yt = (t) => (e, n) => n !== void 0 && e !== n || n === void 0 && e !== t, ki = yt(), Ui = (t, e) => {
|
|
3371
|
+
if (ki(t, e))
|
|
3372
3372
|
return t;
|
|
3373
|
-
},
|
|
3374
|
-
const s = t.maxBitrate, r =
|
|
3373
|
+
}, Fi = (t, e, { isResetAllowed: n = !1 } = {}) => {
|
|
3374
|
+
const s = t.maxBitrate, r = Ui(e, s);
|
|
3375
3375
|
return (r !== void 0 || n) && (t.maxBitrate = r ?? e), t;
|
|
3376
|
-
},
|
|
3377
|
-
|
|
3378
|
-
),
|
|
3379
|
-
const n = t === void 0 ? void 0 : Math.max(t,
|
|
3380
|
-
if (n !== void 0 &&
|
|
3376
|
+
}, Dt = 1, Bi = yt(
|
|
3377
|
+
Dt
|
|
3378
|
+
), $i = (t, e) => {
|
|
3379
|
+
const n = t === void 0 ? void 0 : Math.max(t, Dt);
|
|
3380
|
+
if (n !== void 0 && Bi(
|
|
3381
3381
|
n,
|
|
3382
3382
|
e
|
|
3383
3383
|
))
|
|
3384
3384
|
return n;
|
|
3385
|
-
},
|
|
3386
|
-
const n = t.scaleResolutionDownBy, s =
|
|
3385
|
+
}, xi = (t, e) => {
|
|
3386
|
+
const n = t.scaleResolutionDownBy, s = $i(
|
|
3387
3387
|
e,
|
|
3388
3388
|
n
|
|
3389
3389
|
);
|
|
3390
3390
|
return s !== void 0 && (t.scaleResolutionDownBy = s), t;
|
|
3391
|
-
},
|
|
3391
|
+
}, Vi = (t, e, { isResetAllowed: n } = {}) => {
|
|
3392
3392
|
const s = e.encodings?.length ?? 0;
|
|
3393
|
-
return
|
|
3393
|
+
return Gi(t, s), t.encodings.forEach((r, i) => {
|
|
3394
3394
|
const a = (e?.encodings ?? [])[i], o = a?.maxBitrate, c = a?.scaleResolutionDownBy;
|
|
3395
|
-
|
|
3395
|
+
Fi(r, o, { isResetAllowed: n }), xi(r, c);
|
|
3396
3396
|
}), t;
|
|
3397
|
-
},
|
|
3397
|
+
}, qi = (t, e) => {
|
|
3398
3398
|
if (t.codecs?.length !== e.codecs?.length)
|
|
3399
3399
|
return !0;
|
|
3400
3400
|
for (let n = 0; n < (t.codecs?.length ?? 0); n++)
|
|
@@ -3411,15 +3411,15 @@ const Ii = (t, e) => {
|
|
|
3411
3411
|
if (JSON.stringify(t.encodings[n]) !== JSON.stringify(e.encodings[n]))
|
|
3412
3412
|
return !0;
|
|
3413
3413
|
return t.rtcp?.cname !== e.rtcp?.cname || t.rtcp?.reducedSize !== e.rtcp?.reducedSize || t.degradationPreference !== e.degradationPreference;
|
|
3414
|
-
},
|
|
3414
|
+
}, ye = async (t, e, { isResetAllowed: n } = {}) => {
|
|
3415
3415
|
const s = t.getParameters(), r = JSON.parse(
|
|
3416
3416
|
JSON.stringify(s)
|
|
3417
3417
|
);
|
|
3418
|
-
|
|
3419
|
-
const i =
|
|
3418
|
+
Vi(s, e, { isResetAllowed: n }), wi(s, e);
|
|
3419
|
+
const i = qi(r, s);
|
|
3420
3420
|
return i && await t.setParameters(s), { parameters: s, isChanged: i };
|
|
3421
|
-
},
|
|
3422
|
-
const { isChanged: s, parameters: r } = await
|
|
3421
|
+
}, Lt = async (t, e, n) => {
|
|
3422
|
+
const { isChanged: s, parameters: r } = await ye(t, {
|
|
3423
3423
|
encodings: [
|
|
3424
3424
|
{
|
|
3425
3425
|
scaleResolutionDownBy: e.scaleResolutionDownBy,
|
|
@@ -3428,12 +3428,12 @@ const Ii = (t, e) => {
|
|
|
3428
3428
|
]
|
|
3429
3429
|
});
|
|
3430
3430
|
return s && n && n(r), { isChanged: s, parameters: r };
|
|
3431
|
-
},
|
|
3432
|
-
const s =
|
|
3431
|
+
}, Hi = (t, e) => t.find((n) => n.track !== null && e.getTracks().includes(n.track)), Wi = async (t, e, n) => {
|
|
3432
|
+
const s = Hi(t, e);
|
|
3433
3433
|
if (s)
|
|
3434
|
-
return
|
|
3435
|
-
},
|
|
3436
|
-
class
|
|
3434
|
+
return Lt(s, { maxBitrate: n });
|
|
3435
|
+
}, Qi = A("resolveOnStartMainCam"), Lc = (t) => (n) => (Qi("onStartMainCam"), t.on("api:admin:start-main-cam", n)), Yi = A("resolveOnStartMic"), wc = (t) => (n) => (Yi("onStartMic"), t.on("api:admin:start-mic", n)), ji = A("resolveOnStopMainCam"), Gc = (t) => (n) => (ji("onStopMainCam"), t.on("api:admin:stop-main-cam", n)), zi = A("resolveOnStopMic"), kc = (t) => (n) => (zi("onStopMic"), t.on("api:admin:stop-mic", n));
|
|
3436
|
+
class Ji {
|
|
3437
3437
|
command = void 0;
|
|
3438
3438
|
unsubscribe;
|
|
3439
3439
|
options;
|
|
@@ -3451,18 +3451,19 @@ class zi {
|
|
|
3451
3451
|
}
|
|
3452
3452
|
const v = "evaluate";
|
|
3453
3453
|
var u = /* @__PURE__ */ ((t) => (t.IDLE = "call:idle", t.CONNECTING = "call:connecting", t.PRESENTATION_CALL = "call:presentationCall", t.ROOM_PENDING_AUTH = "call:roomPendingAuth", t.PURGATORY = "call:purgatory", t.P2P_ROOM = "call:p2pRoom", t.DIRECT_P2P_ROOM = "call:directP2pRoom", t.IN_ROOM = "call:inRoom", t.DISCONNECTING = "call:disconnecting", t))(u || {});
|
|
3454
|
-
const
|
|
3454
|
+
const wt = {
|
|
3455
3455
|
raw: {},
|
|
3456
3456
|
state: {}
|
|
3457
|
-
},
|
|
3457
|
+
}, Gt = (t) => "number" in t && B(t.number) && pt(t.answer), kt = (t) => "room" in t && B(t.room) && B(t.participantName) && Oe(t.startedTimestamp), Ki = (t) => "token" in t && B(t.token), Ut = (t) => Ki(t) && "conferenceForToken" in t && B(t.conferenceForToken), ae = (t) => Gt(t) && kt(t), Ft = (t) => !Ut(t) || !kt(t) ? !1 : t.conferenceForToken === t.room, Bt = ({
|
|
3458
3458
|
isDirectPeerToPeer: t
|
|
3459
|
-
}) => t === !0, Ae = (t) => "isDirectPeerToPeer" in t &&
|
|
3459
|
+
}) => t === !0, Ae = (t) => "isDirectPeerToPeer" in t && Bt(t), Xi = "x-vinteo-presentation-call: yes", Zi = (t) => Dn(t) && t.some((e) => e.trim().toLowerCase() === Xi), ea = (t) => "extraHeaders" in t && Zi(t.extraHeaders) && "isConfirmed" in t && t.isConfirmed === !0, he = (t) => ae(t) && !Se(t.room) && Ut(t) && Ft(t), re = (t) => {
|
|
3460
3460
|
const e = t;
|
|
3461
3461
|
return {
|
|
3462
3462
|
number: e.number,
|
|
3463
3463
|
answer: e.answer,
|
|
3464
3464
|
room: e.room,
|
|
3465
|
-
participantName: e.participantName
|
|
3465
|
+
participantName: e.participantName,
|
|
3466
|
+
startedTimestamp: e.startedTimestamp
|
|
3466
3467
|
};
|
|
3467
3468
|
}, D = {
|
|
3468
3469
|
[u.IDLE]: {
|
|
@@ -3470,21 +3471,21 @@ const Lt = {
|
|
|
3470
3471
|
buildContext: () => ({})
|
|
3471
3472
|
},
|
|
3472
3473
|
[u.CONNECTING]: {
|
|
3473
|
-
guard:
|
|
3474
|
+
guard: Gt,
|
|
3474
3475
|
buildContext: (t) => {
|
|
3475
3476
|
const { number: e, answer: n, extraHeaders: s } = t;
|
|
3476
3477
|
return { number: e, answer: n, extraHeaders: s };
|
|
3477
3478
|
}
|
|
3478
3479
|
},
|
|
3479
3480
|
[u.PRESENTATION_CALL]: {
|
|
3480
|
-
guard:
|
|
3481
|
+
guard: ea,
|
|
3481
3482
|
buildContext: (t) => {
|
|
3482
|
-
const { number: e, answer: n } = t;
|
|
3483
|
-
return { number: e, answer: n };
|
|
3483
|
+
const { number: e, answer: n, startedTimestamp: s } = t;
|
|
3484
|
+
return { number: e, answer: n, startedTimestamp: s };
|
|
3484
3485
|
}
|
|
3485
3486
|
},
|
|
3486
3487
|
[u.ROOM_PENDING_AUTH]: {
|
|
3487
|
-
guard: (t) => ae(t) && !Se(t.room) && !
|
|
3488
|
+
guard: (t) => ae(t) && !Se(t.room) && !Pe(t.room) && !Ae(t) && !Ft(t),
|
|
3488
3489
|
buildContext: re
|
|
3489
3490
|
},
|
|
3490
3491
|
/** Токен из TOKEN_ISSUED может уже лежать в context — это не переводит в IN_ROOM. */
|
|
@@ -3493,7 +3494,7 @@ const Lt = {
|
|
|
3493
3494
|
buildContext: re
|
|
3494
3495
|
},
|
|
3495
3496
|
[u.P2P_ROOM]: {
|
|
3496
|
-
guard: (t) => ae(t) &&
|
|
3497
|
+
guard: (t) => ae(t) && Pe(t.room) && !Ae(t) && !he(t),
|
|
3497
3498
|
buildContext: re
|
|
3498
3499
|
},
|
|
3499
3500
|
[u.DIRECT_P2P_ROOM]: {
|
|
@@ -3512,9 +3513,9 @@ const Lt = {
|
|
|
3512
3513
|
guard: (t) => t.pendingDisconnect === !0,
|
|
3513
3514
|
buildContext: () => ({})
|
|
3514
3515
|
}
|
|
3515
|
-
},
|
|
3516
|
+
}, ta = (t) => Se(t.room) || Pe(t.room) || Bt(t), ve = () => ({}), na = () => Z({
|
|
3516
3517
|
types: {
|
|
3517
|
-
context:
|
|
3518
|
+
context: wt,
|
|
3518
3519
|
events: {}
|
|
3519
3520
|
},
|
|
3520
3521
|
actions: {
|
|
@@ -3533,10 +3534,13 @@ const Lt = {
|
|
|
3533
3534
|
room: t.room,
|
|
3534
3535
|
participantName: t.participantName
|
|
3535
3536
|
};
|
|
3536
|
-
|
|
3537
|
+
B(t.token) ? (n.token = t.token, n.conferenceForToken = t.room) : ta(t) && (n.token = void 0, n.conferenceForToken = void 0), pt(t.isDirectPeerToPeer) && (n.isDirectPeerToPeer = t.isDirectPeerToPeer);
|
|
3538
|
+
const r = e.raw.startedTimestamp, i = Oe(r) ? r : Date.now();
|
|
3539
|
+
return {
|
|
3537
3540
|
raw: {
|
|
3538
3541
|
...e.raw,
|
|
3539
|
-
...n
|
|
3542
|
+
...n,
|
|
3543
|
+
startedTimestamp: i
|
|
3540
3544
|
}
|
|
3541
3545
|
};
|
|
3542
3546
|
}),
|
|
@@ -3548,11 +3552,17 @@ const Lt = {
|
|
|
3548
3552
|
participantName: t.participantName
|
|
3549
3553
|
}
|
|
3550
3554
|
}),
|
|
3551
|
-
setConfirmed: f(({ event: t, context: e }) =>
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3555
|
+
setConfirmed: f(({ event: t, context: e }) => {
|
|
3556
|
+
if (t.type !== "CALL.PRESENTATION_CALL")
|
|
3557
|
+
return e;
|
|
3558
|
+
const s = e.raw.startedTimestamp, r = Oe(s) ? s : Date.now();
|
|
3559
|
+
return {
|
|
3560
|
+
raw: {
|
|
3561
|
+
...e.raw,
|
|
3562
|
+
isConfirmed: !0,
|
|
3563
|
+
startedTimestamp: r
|
|
3564
|
+
}
|
|
3565
|
+
};
|
|
3556
3566
|
}),
|
|
3557
3567
|
reset: f(() => ({ raw: ve() })),
|
|
3558
3568
|
prepareDisconnect: f(() => ({
|
|
@@ -3562,10 +3572,10 @@ const Lt = {
|
|
|
3562
3572
|
}
|
|
3563
3573
|
}))
|
|
3564
3574
|
}
|
|
3565
|
-
}),
|
|
3575
|
+
}), sa = () => na().createMachine({
|
|
3566
3576
|
id: "call",
|
|
3567
3577
|
initial: u.IDLE,
|
|
3568
|
-
context:
|
|
3578
|
+
context: wt,
|
|
3569
3579
|
states: {
|
|
3570
3580
|
[u.IDLE]: {
|
|
3571
3581
|
entry: f(() => ({ state: D[u.IDLE].buildContext() })),
|
|
@@ -3769,11 +3779,11 @@ const Lt = {
|
|
|
3769
3779
|
}
|
|
3770
3780
|
}
|
|
3771
3781
|
});
|
|
3772
|
-
function
|
|
3782
|
+
function ra(t) {
|
|
3773
3783
|
return t !== v;
|
|
3774
3784
|
}
|
|
3775
|
-
const
|
|
3776
|
-
class
|
|
3785
|
+
const ia = A("CallStateMachine");
|
|
3786
|
+
class aa extends ee {
|
|
3777
3787
|
constructor(e, n) {
|
|
3778
3788
|
super(e), this.subscribeToEvents(n);
|
|
3779
3789
|
}
|
|
@@ -3846,6 +3856,10 @@ class ia extends ee {
|
|
|
3846
3856
|
if (this.state === u.IN_ROOM)
|
|
3847
3857
|
return this.context.state;
|
|
3848
3858
|
}
|
|
3859
|
+
get presentationCallContext() {
|
|
3860
|
+
if (this.state === u.PRESENTATION_CALL)
|
|
3861
|
+
return this.context.state;
|
|
3862
|
+
}
|
|
3849
3863
|
/** Только в DISCONNECTING (контекст сброшен, опционально `pendingDisconnect`). */
|
|
3850
3864
|
get disconnectingContext() {
|
|
3851
3865
|
if (this.state === u.DISCONNECTING)
|
|
@@ -3854,6 +3868,14 @@ class ia extends ee {
|
|
|
3854
3868
|
get isActive() {
|
|
3855
3869
|
return this.isInRoom || this.isPresentationCall || this.isRoomPendingAuth || this.isInPurgatory || this.isP2PRoom || this.isDirectP2PRoom;
|
|
3856
3870
|
}
|
|
3871
|
+
/**
|
|
3872
|
+
* Время первого попадания в одно из состояний «активной» фазы звонка:
|
|
3873
|
+
* `ROOM_PENDING_AUTH`, `PRESENTATION_CALL`, `PURGATORY`, `P2P_ROOM`, `DIRECT_P2P_ROOM`, `IN_ROOM`.
|
|
3874
|
+
* Сохраняется при переходах между ними; сбрасывается при `CALL.RESET` / disconnect.
|
|
3875
|
+
*/
|
|
3876
|
+
get startedTimestamp() {
|
|
3877
|
+
return this.inRoomContext?.startedTimestamp ?? this.roomPendingAuthContext?.startedTimestamp ?? this.presentationCallContext?.startedTimestamp ?? this.purgatoryContext?.startedTimestamp ?? this.p2pRoomContext?.startedTimestamp ?? this.directP2pRoomContext?.startedTimestamp;
|
|
3878
|
+
}
|
|
3857
3879
|
get number() {
|
|
3858
3880
|
const { raw: e } = this.context;
|
|
3859
3881
|
if ("number" in e)
|
|
@@ -3904,7 +3926,7 @@ class ia extends ee {
|
|
|
3904
3926
|
(o !== a.token || c !== a.conferenceForToken) && (n = a, e(a));
|
|
3905
3927
|
return;
|
|
3906
3928
|
}
|
|
3907
|
-
|
|
3929
|
+
ra(r.value) && (n = void 0);
|
|
3908
3930
|
});
|
|
3909
3931
|
return () => {
|
|
3910
3932
|
s.unsubscribe();
|
|
@@ -3915,7 +3937,7 @@ class ia extends ee {
|
|
|
3915
3937
|
}
|
|
3916
3938
|
send(e) {
|
|
3917
3939
|
if (!this.actor.getSnapshot().can(e)) {
|
|
3918
|
-
|
|
3940
|
+
ia(
|
|
3919
3941
|
`[CallStateMachine] Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`
|
|
3920
3942
|
);
|
|
3921
3943
|
return;
|
|
@@ -3971,15 +3993,15 @@ class ia extends ee {
|
|
|
3971
3993
|
);
|
|
3972
3994
|
}
|
|
3973
3995
|
}
|
|
3974
|
-
const
|
|
3975
|
-
class
|
|
3996
|
+
const oa = (t) => new aa(sa(), t), ca = (t) => [...t.keys()].map((e) => t.get(e)), da = (t, e) => ca(t).find((n) => n?.type === e), $t = async (t) => t.getStats().then((e) => da(e, "codec")?.mimeType);
|
|
3997
|
+
class la {
|
|
3976
3998
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
3977
3999
|
async getCodecFromSender(e) {
|
|
3978
|
-
return await
|
|
4000
|
+
return await $t(e) ?? "";
|
|
3979
4001
|
}
|
|
3980
4002
|
}
|
|
3981
|
-
const
|
|
3982
|
-
class
|
|
4003
|
+
const ha = A("TaskQueue");
|
|
4004
|
+
class ua {
|
|
3983
4005
|
stackPromises = Et({
|
|
3984
4006
|
noRunIsNotActual: !0
|
|
3985
4007
|
});
|
|
@@ -4000,26 +4022,26 @@ class ha {
|
|
|
4000
4022
|
*/
|
|
4001
4023
|
async run() {
|
|
4002
4024
|
return this.stackPromises().catch((e) => {
|
|
4003
|
-
|
|
4025
|
+
ha("TaskQueue: error", e);
|
|
4004
4026
|
});
|
|
4005
4027
|
}
|
|
4006
4028
|
}
|
|
4007
|
-
class
|
|
4029
|
+
class ga {
|
|
4008
4030
|
taskQueue;
|
|
4009
4031
|
onSetParameters;
|
|
4010
4032
|
constructor(e) {
|
|
4011
|
-
this.onSetParameters = e, this.taskQueue = new
|
|
4033
|
+
this.onSetParameters = e, this.taskQueue = new ua();
|
|
4012
4034
|
}
|
|
4013
4035
|
async setEncodingsToSender(e, n) {
|
|
4014
|
-
return this.taskQueue.add(async () =>
|
|
4036
|
+
return this.taskQueue.add(async () => Lt(e, n, this.onSetParameters));
|
|
4015
4037
|
}
|
|
4016
4038
|
stop() {
|
|
4017
4039
|
this.taskQueue.stop();
|
|
4018
4040
|
}
|
|
4019
4041
|
}
|
|
4020
|
-
const
|
|
4021
|
-
const n =
|
|
4022
|
-
return
|
|
4042
|
+
const De = (t, e) => t !== void 0 && e !== void 0 && t.toLowerCase().includes(e.toLowerCase()), Ea = 1e6, q = (t) => t * Ea, xt = q(0.06), Vt = q(4), Ta = (t) => t <= 64 ? xt : 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) : Vt, ma = "av1", Sa = (t) => De(t, ma), pa = 0.6, Fe = (t, e) => Sa(e) ? t * pa : t, qt = (t) => Fe(xt, t), Ht = (t) => Fe(Vt, t), Xe = (t, e) => {
|
|
4043
|
+
const n = Ta(t);
|
|
4044
|
+
return Fe(n, e);
|
|
4023
4045
|
}, fe = 1, Ca = ({
|
|
4024
4046
|
videoTrack: t,
|
|
4025
4047
|
targetSize: e
|
|
@@ -4027,7 +4049,7 @@ const ye = (t, e) => t !== void 0 && e !== void 0 && t.toLowerCase().includes(e.
|
|
|
4027
4049
|
const n = t.getSettings(), s = n.width, r = n.height, i = s === void 0 ? fe : s / e.width, a = r === void 0 ? fe : r / e.height;
|
|
4028
4050
|
return Math.max(i, a, fe);
|
|
4029
4051
|
};
|
|
4030
|
-
class
|
|
4052
|
+
class Ra {
|
|
4031
4053
|
ignoreForCodec;
|
|
4032
4054
|
senderFinder;
|
|
4033
4055
|
codecProvider;
|
|
@@ -4060,7 +4082,7 @@ class pa {
|
|
|
4060
4082
|
if (!r?.track)
|
|
4061
4083
|
return { ...this.resultNoChanged, sender: r };
|
|
4062
4084
|
const i = await this.codecProvider.getCodecFromSender(r);
|
|
4063
|
-
if (
|
|
4085
|
+
if (De(i, this.ignoreForCodec))
|
|
4064
4086
|
return { ...this.resultNoChanged, sender: r };
|
|
4065
4087
|
const { mainCam: a, resolutionMainCam: o } = n ?? {};
|
|
4066
4088
|
return this.processSender(
|
|
@@ -4082,7 +4104,7 @@ class pa {
|
|
|
4082
4104
|
if (!s?.track)
|
|
4083
4105
|
return { ...this.resultNoChanged, sender: s };
|
|
4084
4106
|
const r = await this.codecProvider.getCodecFromSender(s);
|
|
4085
|
-
if (
|
|
4107
|
+
if (De(r, this.ignoreForCodec))
|
|
4086
4108
|
return { ...this.resultNoChanged, sender: s };
|
|
4087
4109
|
const i = {
|
|
4088
4110
|
sender: s,
|
|
@@ -4121,7 +4143,7 @@ class pa {
|
|
|
4121
4143
|
async downgradeResolutionSender(e) {
|
|
4122
4144
|
const { sender: n, codec: s } = e, r = {
|
|
4123
4145
|
scaleResolutionDownBy: 200,
|
|
4124
|
-
maxBitrate:
|
|
4146
|
+
maxBitrate: qt(s)
|
|
4125
4147
|
};
|
|
4126
4148
|
return this.parametersSetter.setEncodingsToSender(n, r);
|
|
4127
4149
|
}
|
|
@@ -4131,7 +4153,7 @@ class pa {
|
|
|
4131
4153
|
* @returns Promise с результатом
|
|
4132
4154
|
*/
|
|
4133
4155
|
async setBitrateByTrackResolution(e) {
|
|
4134
|
-
const { sender: n, videoTrack: s, codec: r } = e, a = s.getSettings().width, o = a === void 0 ?
|
|
4156
|
+
const { sender: n, videoTrack: s, codec: r } = e, a = s.getSettings().width, o = a === void 0 ? Ht(r) : Xe(a, r);
|
|
4135
4157
|
return this.parametersSetter.setEncodingsToSender(n, {
|
|
4136
4158
|
scaleResolutionDownBy: 1,
|
|
4137
4159
|
maxBitrate: o
|
|
@@ -4147,24 +4169,24 @@ class pa {
|
|
|
4147
4169
|
const [s, r] = e.split("x"), { sender: i, videoTrack: a, codec: o } = n, c = {
|
|
4148
4170
|
width: Number(s),
|
|
4149
4171
|
height: Number(r)
|
|
4150
|
-
},
|
|
4172
|
+
}, g = Ca({
|
|
4151
4173
|
videoTrack: a,
|
|
4152
4174
|
targetSize: c
|
|
4153
|
-
}),
|
|
4154
|
-
scaleResolutionDownBy:
|
|
4155
|
-
maxBitrate:
|
|
4175
|
+
}), C = Xe(c.width, o), I = {
|
|
4176
|
+
scaleResolutionDownBy: g,
|
|
4177
|
+
maxBitrate: C
|
|
4156
4178
|
};
|
|
4157
4179
|
return this.parametersSetter.setEncodingsToSender(i, I);
|
|
4158
4180
|
}
|
|
4159
4181
|
}
|
|
4160
|
-
const
|
|
4161
|
-
class
|
|
4182
|
+
const Na = (t) => t.find((e) => e.track?.kind === "video");
|
|
4183
|
+
class Ia {
|
|
4162
4184
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
4163
4185
|
findVideoSender(e) {
|
|
4164
|
-
return
|
|
4186
|
+
return Na(e);
|
|
4165
4187
|
}
|
|
4166
4188
|
}
|
|
4167
|
-
class
|
|
4189
|
+
class Aa {
|
|
4168
4190
|
currentSender;
|
|
4169
4191
|
originalReplaceTrack;
|
|
4170
4192
|
lastWidth;
|
|
@@ -4177,7 +4199,7 @@ class Ia {
|
|
|
4177
4199
|
pollIntervalMs: e = 1e3,
|
|
4178
4200
|
maxPollIntervalMs: n
|
|
4179
4201
|
}) {
|
|
4180
|
-
this.pollIntervalMs = e, this.maxPollIntervalMs = n ?? e * 16, this.currentPollIntervalMs = this.pollIntervalMs, this.setTimeoutRequest = new
|
|
4202
|
+
this.pollIntervalMs = e, this.maxPollIntervalMs = n ?? e * 16, this.currentPollIntervalMs = this.pollIntervalMs, this.setTimeoutRequest = new ut();
|
|
4181
4203
|
}
|
|
4182
4204
|
/**
|
|
4183
4205
|
* Проверяет актуальный video-sender и (при необходимости) перенастраивает наблюдение.
|
|
@@ -4228,7 +4250,7 @@ class Ia {
|
|
|
4228
4250
|
this.setTimeoutRequest.cancelRequest(), this.lastWidth = void 0, this.lastHeight = void 0;
|
|
4229
4251
|
}
|
|
4230
4252
|
}
|
|
4231
|
-
class
|
|
4253
|
+
class va {
|
|
4232
4254
|
apiManager;
|
|
4233
4255
|
currentHandler;
|
|
4234
4256
|
constructor(e) {
|
|
@@ -4249,7 +4271,7 @@ class Aa {
|
|
|
4249
4271
|
}
|
|
4250
4272
|
}
|
|
4251
4273
|
const Me = A("VideoSendingBalancer");
|
|
4252
|
-
class
|
|
4274
|
+
class fa {
|
|
4253
4275
|
eventHandler;
|
|
4254
4276
|
senderBalancer;
|
|
4255
4277
|
parametersSetterWithQueue;
|
|
@@ -4261,16 +4283,16 @@ class va {
|
|
|
4261
4283
|
onSetParameters: r,
|
|
4262
4284
|
pollIntervalMs: i
|
|
4263
4285
|
} = {}) {
|
|
4264
|
-
this.getConnection = n, this.eventHandler = new
|
|
4286
|
+
this.getConnection = n, this.eventHandler = new va(e), this.parametersSetterWithQueue = new ga(r), this.senderBalancer = new Ra(
|
|
4265
4287
|
{
|
|
4266
|
-
senderFinder: new
|
|
4267
|
-
codecProvider: new
|
|
4288
|
+
senderFinder: new Ia(),
|
|
4289
|
+
codecProvider: new la(),
|
|
4268
4290
|
parametersSetter: this.parametersSetterWithQueue
|
|
4269
4291
|
},
|
|
4270
4292
|
{
|
|
4271
4293
|
ignoreForCodec: s
|
|
4272
4294
|
}
|
|
4273
|
-
), this.trackMonitor = new
|
|
4295
|
+
), this.trackMonitor = new Aa({ pollIntervalMs: i });
|
|
4274
4296
|
}
|
|
4275
4297
|
/**
|
|
4276
4298
|
* Подписывается на события управления главной камерой
|
|
@@ -4324,8 +4346,8 @@ class va {
|
|
|
4324
4346
|
});
|
|
4325
4347
|
};
|
|
4326
4348
|
}
|
|
4327
|
-
const
|
|
4328
|
-
class
|
|
4349
|
+
const Ma = 6e3, _a = 52e4, ue = (t, e) => t.getSenders().filter((n) => n.track?.kind === e), Oa = (t, e) => t === "audio" ? Ma : qt(e), ba = (t) => t.track !== null;
|
|
4350
|
+
class Pa {
|
|
4329
4351
|
previousBitrates = /* @__PURE__ */ new Map();
|
|
4330
4352
|
/**
|
|
4331
4353
|
* Устанавливает минимальный битрейт для указанных типов потоков
|
|
@@ -4337,17 +4359,17 @@ class ba {
|
|
|
4337
4359
|
if (!e)
|
|
4338
4360
|
return;
|
|
4339
4361
|
(n === "audio" || n === "all") && s.push(...ue(e, "audio")), (n === "video" || n === "all") && s.push(...ue(e, "video"));
|
|
4340
|
-
const r = s.filter(
|
|
4362
|
+
const r = s.filter(ba).map(async (i) => {
|
|
4341
4363
|
const a = i.getParameters();
|
|
4342
4364
|
this.saveCurrentBitrate(i, a);
|
|
4343
4365
|
const o = {
|
|
4344
4366
|
...a,
|
|
4345
4367
|
encodings: a.encodings.map((c) => ({
|
|
4346
4368
|
...c,
|
|
4347
|
-
maxBitrate:
|
|
4369
|
+
maxBitrate: Oa(i.track.kind)
|
|
4348
4370
|
}))
|
|
4349
4371
|
};
|
|
4350
|
-
await
|
|
4372
|
+
await ye(i, o);
|
|
4351
4373
|
});
|
|
4352
4374
|
await Promise.all(r);
|
|
4353
4375
|
}
|
|
@@ -4364,10 +4386,10 @@ class ba {
|
|
|
4364
4386
|
const r = s.map(async (i) => {
|
|
4365
4387
|
const a = this.getSavedBitrate(i);
|
|
4366
4388
|
if (a) {
|
|
4367
|
-
const o = i.getParameters(), c = i.track?.kind === "video",
|
|
4389
|
+
const o = i.getParameters(), c = i.track?.kind === "video", g = c ? await $t(i) : void 0, C = {
|
|
4368
4390
|
...o,
|
|
4369
4391
|
encodings: a.map((I) => {
|
|
4370
|
-
const b = c ?
|
|
4392
|
+
const b = c ? Ht(g) : _a;
|
|
4371
4393
|
return {
|
|
4372
4394
|
...I,
|
|
4373
4395
|
// В Safari и некоторых браузерах encodings изначально не содержат maxBitrate.
|
|
@@ -4379,7 +4401,7 @@ class ba {
|
|
|
4379
4401
|
};
|
|
4380
4402
|
})
|
|
4381
4403
|
};
|
|
4382
|
-
await
|
|
4404
|
+
await ye(i, C, { isResetAllowed: !0 }), this.clearSavedBitrate(i);
|
|
4383
4405
|
}
|
|
4384
4406
|
});
|
|
4385
4407
|
await Promise.all(r);
|
|
@@ -4422,16 +4444,16 @@ class ba {
|
|
|
4422
4444
|
this.previousBitrates.set(e, s);
|
|
4423
4445
|
}
|
|
4424
4446
|
}
|
|
4425
|
-
var
|
|
4426
|
-
const
|
|
4427
|
-
class
|
|
4447
|
+
var Wt = /* @__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))(Wt || {});
|
|
4448
|
+
const Ze = A("MCUSession");
|
|
4449
|
+
class ya {
|
|
4428
4450
|
events;
|
|
4429
4451
|
rtcSession;
|
|
4430
4452
|
disposers = /* @__PURE__ */ new Set();
|
|
4431
4453
|
onReset;
|
|
4432
4454
|
pcConfig;
|
|
4433
4455
|
// Менеджер состояния битрейта
|
|
4434
|
-
bitrateStateManager = new
|
|
4456
|
+
bitrateStateManager = new Pa();
|
|
4435
4457
|
constructor(e, { onReset: n }) {
|
|
4436
4458
|
this.events = e, this.onReset = n, e.on("failed", this.handleEnded), e.on("ended", this.handleEnded);
|
|
4437
4459
|
}
|
|
@@ -4457,8 +4479,8 @@ class Pa {
|
|
|
4457
4479
|
iceServers: a,
|
|
4458
4480
|
directionVideo: o,
|
|
4459
4481
|
directionAudio: c,
|
|
4460
|
-
contentHint:
|
|
4461
|
-
offerToReceiveAudio:
|
|
4482
|
+
contentHint: g,
|
|
4483
|
+
offerToReceiveAudio: C = !0,
|
|
4462
4484
|
offerToReceiveVideo: I = !0,
|
|
4463
4485
|
degradationPreference: b,
|
|
4464
4486
|
sendEncodings: _,
|
|
@@ -4467,16 +4489,16 @@ class Pa {
|
|
|
4467
4489
|
this.handleCall().then(L).catch((te) => {
|
|
4468
4490
|
z(te);
|
|
4469
4491
|
}), this.pcConfig = { iceServers: a }, this.rtcSession = e.call(n(s), {
|
|
4470
|
-
mediaStream:
|
|
4492
|
+
mediaStream: ge(r, {
|
|
4471
4493
|
directionVideo: o,
|
|
4472
4494
|
directionAudio: c,
|
|
4473
|
-
contentHint:
|
|
4495
|
+
contentHint: g
|
|
4474
4496
|
}),
|
|
4475
4497
|
pcConfig: {
|
|
4476
4498
|
iceServers: a
|
|
4477
4499
|
},
|
|
4478
4500
|
rtcOfferConstraints: {
|
|
4479
|
-
offerToReceiveAudio:
|
|
4501
|
+
offerToReceiveAudio: C,
|
|
4480
4502
|
offerToReceiveVideo: I
|
|
4481
4503
|
},
|
|
4482
4504
|
// необходимо передавать в методе call, чтобы подписаться на события peerconnection,
|
|
@@ -4495,7 +4517,7 @@ class Pa {
|
|
|
4495
4517
|
const { rtcSession: e } = this;
|
|
4496
4518
|
if (e && !e.isEnded())
|
|
4497
4519
|
return e.terminateAsync({
|
|
4498
|
-
cause:
|
|
4520
|
+
cause: Wt.CANCELED
|
|
4499
4521
|
}).finally(() => {
|
|
4500
4522
|
this.reset();
|
|
4501
4523
|
});
|
|
@@ -4509,8 +4531,8 @@ class Pa {
|
|
|
4509
4531
|
directionAudio: a,
|
|
4510
4532
|
offerToReceiveAudio: o,
|
|
4511
4533
|
offerToReceiveVideo: c,
|
|
4512
|
-
contentHint:
|
|
4513
|
-
degradationPreference:
|
|
4534
|
+
contentHint: g,
|
|
4535
|
+
degradationPreference: C,
|
|
4514
4536
|
sendEncodings: I,
|
|
4515
4537
|
onAddedTransceiver: b
|
|
4516
4538
|
}) => new Promise((_, W) => {
|
|
@@ -4525,15 +4547,15 @@ class Pa {
|
|
|
4525
4547
|
offerToReceiveAudio: o,
|
|
4526
4548
|
offerToReceiveVideo: c
|
|
4527
4549
|
},
|
|
4528
|
-
mediaStream:
|
|
4550
|
+
mediaStream: ge(n, {
|
|
4529
4551
|
directionVideo: i,
|
|
4530
4552
|
directionAudio: a,
|
|
4531
|
-
contentHint:
|
|
4553
|
+
contentHint: g
|
|
4532
4554
|
}),
|
|
4533
4555
|
extraHeaders: s,
|
|
4534
4556
|
directionVideo: i,
|
|
4535
4557
|
directionAudio: a,
|
|
4536
|
-
degradationPreference:
|
|
4558
|
+
degradationPreference: C,
|
|
4537
4559
|
sendEncodings: I,
|
|
4538
4560
|
onAddedTransceiver: b
|
|
4539
4561
|
});
|
|
@@ -4544,7 +4566,7 @@ class Pa {
|
|
|
4544
4566
|
async replaceMediaStream(e, n) {
|
|
4545
4567
|
if (!this.rtcSession)
|
|
4546
4568
|
throw new Error("No rtcSession established");
|
|
4547
|
-
const { contentHint: s } = n ?? {}, r =
|
|
4569
|
+
const { contentHint: s } = n ?? {}, r = ge(e, { contentHint: s });
|
|
4548
4570
|
if (r === void 0)
|
|
4549
4571
|
throw new Error("No preparedMediaStream");
|
|
4550
4572
|
return this.rtcSession.replaceMediaStream(r, n);
|
|
@@ -4560,7 +4582,7 @@ class Pa {
|
|
|
4560
4582
|
*/
|
|
4561
4583
|
setMinBitrateForSenders(e = "all") {
|
|
4562
4584
|
this.bitrateStateManager.setMinBitrateForSenders(this.connection, e).catch((n) => {
|
|
4563
|
-
|
|
4585
|
+
Ze("setMinBitrateForSenders", n);
|
|
4564
4586
|
});
|
|
4565
4587
|
}
|
|
4566
4588
|
/**
|
|
@@ -4569,14 +4591,14 @@ class Pa {
|
|
|
4569
4591
|
*/
|
|
4570
4592
|
restoreBitrateForSenders(e = "all") {
|
|
4571
4593
|
this.bitrateStateManager.restoreBitrateForSenders(this.connection, e).catch((n) => {
|
|
4572
|
-
|
|
4594
|
+
Ze("restoreBitrateForSenders", n);
|
|
4573
4595
|
});
|
|
4574
4596
|
}
|
|
4575
4597
|
handleCall = async () => new Promise((e, n) => {
|
|
4576
4598
|
const s = () => {
|
|
4577
|
-
this.events.on("peerconnection",
|
|
4599
|
+
this.events.on("peerconnection", g), this.events.on("confirmed", C);
|
|
4578
4600
|
}, r = () => {
|
|
4579
|
-
this.events.off("peerconnection",
|
|
4601
|
+
this.events.off("peerconnection", g), this.events.off("confirmed", C);
|
|
4580
4602
|
}, i = () => {
|
|
4581
4603
|
this.events.on("failed", o), this.events.on("ended", o);
|
|
4582
4604
|
}, a = () => {
|
|
@@ -4585,7 +4607,7 @@ class Pa {
|
|
|
4585
4607
|
r(), a(), n(I);
|
|
4586
4608
|
};
|
|
4587
4609
|
let c;
|
|
4588
|
-
const
|
|
4610
|
+
const g = ({ peerconnection: I }) => {
|
|
4589
4611
|
c = I;
|
|
4590
4612
|
const b = (_) => {
|
|
4591
4613
|
this.events.trigger("peerconnection:ontrack", _);
|
|
@@ -4593,14 +4615,14 @@ class Pa {
|
|
|
4593
4615
|
I.addEventListener("track", b), this.disposers.add(() => {
|
|
4594
4616
|
I.removeEventListener("track", b);
|
|
4595
4617
|
});
|
|
4596
|
-
},
|
|
4618
|
+
}, C = () => {
|
|
4597
4619
|
c !== void 0 && this.events.trigger("peerconnection:confirmed", c), r(), a(), e(c);
|
|
4598
4620
|
};
|
|
4599
4621
|
s(), i();
|
|
4600
4622
|
});
|
|
4601
4623
|
subscribeToSessionEvents(e) {
|
|
4602
4624
|
this.events.eachTriggers((n, s) => {
|
|
4603
|
-
const r =
|
|
4625
|
+
const r = Ot.find((i) => i === s);
|
|
4604
4626
|
r && (e.on(r, n), this.disposers.add(() => {
|
|
4605
4627
|
e.off(r, n);
|
|
4606
4628
|
}));
|
|
@@ -4619,8 +4641,8 @@ class Pa {
|
|
|
4619
4641
|
delete this.rtcSession, delete this.pcConfig, this.unsubscribeFromSessionEvents(), this.bitrateStateManager.clearAll(), this.onReset();
|
|
4620
4642
|
};
|
|
4621
4643
|
}
|
|
4622
|
-
const
|
|
4623
|
-
class
|
|
4644
|
+
const Le = (t) => t === "auto" ? "high" : t, Da = 10, La = 500, wa = 5e3;
|
|
4645
|
+
class Ga {
|
|
4624
4646
|
/**
|
|
4625
4647
|
* Текущая операция отправки offer с повторными попытками при ошибках.
|
|
4626
4648
|
* Может быть отменена при новом renegotiate для предотвращения конфликтов.
|
|
@@ -4641,7 +4663,7 @@ class wa {
|
|
|
4641
4663
|
this.config = {
|
|
4642
4664
|
...e,
|
|
4643
4665
|
quality: s,
|
|
4644
|
-
effectiveQuality:
|
|
4666
|
+
effectiveQuality: Le(s)
|
|
4645
4667
|
}, this.tools = n, this.connection = new RTCPeerConnection(e.pcConfig), this.addTransceivers();
|
|
4646
4668
|
}
|
|
4647
4669
|
get settings() {
|
|
@@ -4670,7 +4692,7 @@ class wa {
|
|
|
4670
4692
|
async setQuality(e) {
|
|
4671
4693
|
if (!this.lastCallParams)
|
|
4672
4694
|
return !1;
|
|
4673
|
-
const n = this.config.effectiveQuality, s = this.config.quality, r =
|
|
4695
|
+
const n = this.config.effectiveQuality, s = this.config.quality, r = Le(e);
|
|
4674
4696
|
return e === s && r === n ? !1 : (this.config.quality = e, this.config.effectiveQuality = r, r !== n && await this.renegotiate(this.lastCallParams), !0);
|
|
4675
4697
|
}
|
|
4676
4698
|
async applyQuality(e) {
|
|
@@ -4746,11 +4768,11 @@ class wa {
|
|
|
4746
4768
|
},
|
|
4747
4769
|
s
|
|
4748
4770
|
), i = (o) => !(o instanceof Error);
|
|
4749
|
-
this.cancelableSendOfferWithRepeatedCalls =
|
|
4771
|
+
this.cancelableSendOfferWithRepeatedCalls = Ge({
|
|
4750
4772
|
targetFunction: r,
|
|
4751
4773
|
isComplete: i,
|
|
4752
|
-
callLimit:
|
|
4753
|
-
delay:
|
|
4774
|
+
callLimit: Da,
|
|
4775
|
+
delay: La,
|
|
4754
4776
|
isRejectAsValid: !0,
|
|
4755
4777
|
isCheckBeforeCall: !1
|
|
4756
4778
|
});
|
|
@@ -4828,23 +4850,23 @@ class wa {
|
|
|
4828
4850
|
return new Promise((s, r) => {
|
|
4829
4851
|
let i, a = !1;
|
|
4830
4852
|
const o = () => {
|
|
4831
|
-
a || (a = !0, clearTimeout(i), this.connection.removeEventListener("signalingstatechange",
|
|
4832
|
-
}, c = (
|
|
4833
|
-
a || (a = !0, clearTimeout(i), this.connection.removeEventListener("signalingstatechange",
|
|
4853
|
+
a || (a = !0, clearTimeout(i), this.connection.removeEventListener("signalingstatechange", g), this.connection.removeEventListener("connectionstatechange", g), s());
|
|
4854
|
+
}, c = (C) => {
|
|
4855
|
+
a || (a = !0, clearTimeout(i), this.connection.removeEventListener("signalingstatechange", g), this.connection.removeEventListener("connectionstatechange", g), r(C));
|
|
4834
4856
|
};
|
|
4835
|
-
function
|
|
4836
|
-
const
|
|
4837
|
-
if (
|
|
4857
|
+
function g() {
|
|
4858
|
+
const C = n();
|
|
4859
|
+
if (C === "error") {
|
|
4838
4860
|
c(e());
|
|
4839
4861
|
return;
|
|
4840
4862
|
}
|
|
4841
|
-
|
|
4863
|
+
C === "success" && o();
|
|
4842
4864
|
}
|
|
4843
4865
|
i = setTimeout(() => {
|
|
4844
4866
|
c(
|
|
4845
4867
|
new Error("Timed out waiting for stable signaling state and ready connection state")
|
|
4846
4868
|
);
|
|
4847
|
-
},
|
|
4869
|
+
}, wa), this.connection.addEventListener("signalingstatechange", g), this.connection.addEventListener("connectionstatechange", g), g();
|
|
4848
4870
|
});
|
|
4849
4871
|
}
|
|
4850
4872
|
async waitForTracks() {
|
|
@@ -4877,18 +4899,18 @@ class wa {
|
|
|
4877
4899
|
this.cancelableSendOfferWithRepeatedCalls?.cancel();
|
|
4878
4900
|
}
|
|
4879
4901
|
}
|
|
4880
|
-
const
|
|
4881
|
-
const n =
|
|
4902
|
+
const Qt = (t) => t.getSettings(), ka = (t, e) => {
|
|
4903
|
+
const n = Qt(t);
|
|
4882
4904
|
let s = e;
|
|
4883
4905
|
s ??= t.label;
|
|
4884
4906
|
let r = n?.msid;
|
|
4885
4907
|
return r ??= s, r ??= t.id, r;
|
|
4886
|
-
},
|
|
4887
|
-
const n =
|
|
4908
|
+
}, Ua = (t, e) => {
|
|
4909
|
+
const n = Qt(t);
|
|
4888
4910
|
let s = e;
|
|
4889
4911
|
return s ??= n?.msid, s ??= t.label, (s && s.length > 0 ? s : void 0) ?? t.id;
|
|
4890
4912
|
};
|
|
4891
|
-
class
|
|
4913
|
+
class et {
|
|
4892
4914
|
participantGroups = /* @__PURE__ */ new Map();
|
|
4893
4915
|
trackToGroup = /* @__PURE__ */ new Map();
|
|
4894
4916
|
trackDisposers = /* @__PURE__ */ new Map();
|
|
@@ -4905,18 +4927,18 @@ class Ze {
|
|
|
4905
4927
|
onRemoved: n,
|
|
4906
4928
|
streamHint: s
|
|
4907
4929
|
} = {}) {
|
|
4908
|
-
const r =
|
|
4930
|
+
const r = Ua(e, s), i = ka(e, s);
|
|
4909
4931
|
if (this.trackToGroup.has(e.id))
|
|
4910
4932
|
return { isAddedTrack: !1, isAddedStream: !1 };
|
|
4911
4933
|
const a = this.getParticipantGroups(r), o = a.get(i), c = !o;
|
|
4912
|
-
let
|
|
4913
|
-
|
|
4934
|
+
let g = o;
|
|
4935
|
+
g || (g = {
|
|
4914
4936
|
participantId: r,
|
|
4915
4937
|
groupId: i,
|
|
4916
4938
|
stream: new MediaStream(),
|
|
4917
4939
|
trackIds: /* @__PURE__ */ new Set()
|
|
4918
|
-
}, a.set(i,
|
|
4919
|
-
const
|
|
4940
|
+
}, a.set(i, g)), g.stream.addTrack(e), g.trackIds.add(e.id), this.trackToGroup.set(e.id, { participantId: r, groupId: i });
|
|
4941
|
+
const C = () => {
|
|
4920
4942
|
this.disposeTrackListener(e.id);
|
|
4921
4943
|
const I = this.removeTrack(e.id);
|
|
4922
4944
|
I.isRemovedTrack && n?.({
|
|
@@ -4925,8 +4947,8 @@ class Ze {
|
|
|
4925
4947
|
isRemovedStream: I.isRemovedStream
|
|
4926
4948
|
});
|
|
4927
4949
|
};
|
|
4928
|
-
return e.addEventListener("ended",
|
|
4929
|
-
e.removeEventListener("ended",
|
|
4950
|
+
return e.addEventListener("ended", C), this.trackDisposers.set(e.id, () => {
|
|
4951
|
+
e.removeEventListener("ended", C);
|
|
4930
4952
|
}), { isAddedTrack: !0, isAddedStream: c, participantId: r };
|
|
4931
4953
|
}
|
|
4932
4954
|
removeTrack(e) {
|
|
@@ -4937,7 +4959,7 @@ class Ze {
|
|
|
4937
4959
|
const { participantId: s, groupId: r } = n, i = this.participantGroups.get(s), a = i?.get(r);
|
|
4938
4960
|
if (!a)
|
|
4939
4961
|
return this.trackToGroup.delete(e), { isRemovedTrack: !1, isRemovedStream: !1 };
|
|
4940
|
-
const o = a.stream.getTracks().find((
|
|
4962
|
+
const o = a.stream.getTracks().find((g) => g.id === e);
|
|
4941
4963
|
o && a.stream.removeTrack(o), a.trackIds.delete(e), this.trackToGroup.delete(e);
|
|
4942
4964
|
const c = a.trackIds.size === 0;
|
|
4943
4965
|
return c && (i?.delete(r), i?.size === 0 && this.participantGroups.delete(s)), { isRemovedTrack: !0, isRemovedStream: c };
|
|
@@ -4949,8 +4971,8 @@ class Ze {
|
|
|
4949
4971
|
let r = !1;
|
|
4950
4972
|
return [...s.values()].forEach((a) => {
|
|
4951
4973
|
[...a.trackIds].filter((c) => !n.includes(c)).forEach((c) => {
|
|
4952
|
-
const
|
|
4953
|
-
r ||=
|
|
4974
|
+
const g = this.removeTrack(c);
|
|
4975
|
+
r ||= g.isRemovedTrack;
|
|
4954
4976
|
});
|
|
4955
4977
|
}), r;
|
|
4956
4978
|
}
|
|
@@ -4973,13 +4995,13 @@ class Ze {
|
|
|
4973
4995
|
return this.participantGroups.set(e, s), s;
|
|
4974
4996
|
}
|
|
4975
4997
|
}
|
|
4976
|
-
const
|
|
4998
|
+
const Fa = (t, e) => {
|
|
4977
4999
|
if (!t || !e)
|
|
4978
5000
|
return t === e;
|
|
4979
5001
|
const n = t.mainStream?.id, s = e.mainStream?.id, r = t.contentedStream?.id, i = e.contentedStream?.id;
|
|
4980
5002
|
return n === s && r === i;
|
|
4981
5003
|
};
|
|
4982
|
-
class
|
|
5004
|
+
class Ba {
|
|
4983
5005
|
lastEmittedStreams;
|
|
4984
5006
|
/**
|
|
4985
5007
|
* Проверяет, изменились ли streams с последнего сохраненного состояния
|
|
@@ -4987,7 +5009,7 @@ class Fa {
|
|
|
4987
5009
|
* @returns true, если streams изменились
|
|
4988
5010
|
*/
|
|
4989
5011
|
hasChanged(e) {
|
|
4990
|
-
return !
|
|
5012
|
+
return !Fa(this.lastEmittedStreams, e);
|
|
4991
5013
|
}
|
|
4992
5014
|
/**
|
|
4993
5015
|
* Сохраняет текущие streams как последнее эмитнутое состояние
|
|
@@ -5010,8 +5032,8 @@ class Fa {
|
|
|
5010
5032
|
this.lastEmittedStreams = void 0;
|
|
5011
5033
|
}
|
|
5012
5034
|
}
|
|
5013
|
-
const
|
|
5014
|
-
class
|
|
5035
|
+
const $a = "default", xa = "dual", Va = "content_", qa = (t) => `${Va}${t.toLowerCase()}`, Ha = (t) => [...t.getTracks()].some((e) => e.label.includes(xa));
|
|
5036
|
+
class Wa {
|
|
5015
5037
|
mainRemoteStreamsManager;
|
|
5016
5038
|
recvRemoteStreamsManager;
|
|
5017
5039
|
constructor(e, n) {
|
|
@@ -5028,7 +5050,7 @@ class Ha {
|
|
|
5028
5050
|
}) {
|
|
5029
5051
|
const n = this.mainRemoteStreamsManager;
|
|
5030
5052
|
return { manager: n, getRemoteStreams: () => {
|
|
5031
|
-
const r = n.getStreams(), i = r.find((o) => !
|
|
5053
|
+
const r = n.getStreams(), i = r.find((o) => !Ha(o)), a = e.isAvailable ? r.find((o) => o !== i) : void 0;
|
|
5032
5054
|
return { mainStream: i, contentedStream: a };
|
|
5033
5055
|
} };
|
|
5034
5056
|
}
|
|
@@ -5037,7 +5059,7 @@ class Ha {
|
|
|
5037
5059
|
}) {
|
|
5038
5060
|
const n = this.recvRemoteStreamsManager;
|
|
5039
5061
|
return { manager: n, getRemoteStreams: () => {
|
|
5040
|
-
const i = n.getStreams(
|
|
5062
|
+
const i = n.getStreams($a)[0], a = this.getRecvRemoteContentedStream({ stateInfo: e });
|
|
5041
5063
|
return { mainStream: i, contentedStream: a };
|
|
5042
5064
|
} };
|
|
5043
5065
|
}
|
|
@@ -5046,21 +5068,21 @@ class Ha {
|
|
|
5046
5068
|
}) {
|
|
5047
5069
|
if (!e.isAvailable || e.codec === void 0)
|
|
5048
5070
|
return;
|
|
5049
|
-
const n =
|
|
5071
|
+
const n = qa(e.codec);
|
|
5050
5072
|
return this.recvRemoteStreamsManager.getStreams(n)[0];
|
|
5051
5073
|
}
|
|
5052
5074
|
}
|
|
5053
|
-
const
|
|
5054
|
-
const s =
|
|
5075
|
+
const Qa = "udp", Ya = (t) => t.transport?.iceTransport ? t.transport.iceTransport.getLocalCandidates() : [], ja = (t) => t.getReceivers().flatMap(Ya), za = (t) => {
|
|
5076
|
+
const s = ja(t).filter(({ protocol: r, port: i }) => i !== null && Qa === r).map(({ port: r }) => r);
|
|
5055
5077
|
return [...new Set(s)];
|
|
5056
|
-
},
|
|
5057
|
-
class
|
|
5078
|
+
}, tt = (t) => t.streams[0]?.id;
|
|
5079
|
+
class Ja extends w {
|
|
5058
5080
|
stateMachine;
|
|
5059
5081
|
sessionState;
|
|
5060
5082
|
isPendingCall = !1;
|
|
5061
5083
|
isPendingAnswer = !1;
|
|
5062
|
-
mainRemoteStreamsManager = new
|
|
5063
|
-
recvRemoteStreamsManager = new
|
|
5084
|
+
mainRemoteStreamsManager = new et();
|
|
5085
|
+
recvRemoteStreamsManager = new et();
|
|
5064
5086
|
streamsManagerProvider;
|
|
5065
5087
|
contentedStreamManager;
|
|
5066
5088
|
tools;
|
|
@@ -5075,12 +5097,12 @@ class za extends w {
|
|
|
5075
5097
|
disposeRecvSessionTrackListener;
|
|
5076
5098
|
disposeInRoomCredentialsListener;
|
|
5077
5099
|
deferredStartRecvSessionRunner;
|
|
5078
|
-
streamsChangeTracker = new
|
|
5100
|
+
streamsChangeTracker = new Ba();
|
|
5079
5101
|
constructor({ contentedStreamManager: e }, n, { callSessionState: s }) {
|
|
5080
|
-
super(
|
|
5102
|
+
super(oi()), this.contentedStreamManager = e, this.tools = n, this.mcuSession = new ya(this.events, { onReset: this.reset }), this.stateMachine = oa(this.events), this.sessionState = s, this.sessionState.subscribeRoleChanges(this.onRoleChanged), this.streamsManagerProvider = new Wa(
|
|
5081
5103
|
this.mainRemoteStreamsManager,
|
|
5082
5104
|
this.recvRemoteStreamsManager
|
|
5083
|
-
), this.deferredStartRecvSessionRunner = new
|
|
5105
|
+
), this.deferredStartRecvSessionRunner = new Ji({
|
|
5084
5106
|
subscribe: (r) => this.stateMachine.onStateChange(r),
|
|
5085
5107
|
isReady: (r) => r === u.IN_ROOM,
|
|
5086
5108
|
isCancelled: (r) => r === u.IDLE,
|
|
@@ -5116,7 +5138,7 @@ class za extends w {
|
|
|
5116
5138
|
}
|
|
5117
5139
|
get localPorts() {
|
|
5118
5140
|
const e = this.getActivePeerConnection();
|
|
5119
|
-
return e ?
|
|
5141
|
+
return e ? za(e) : [];
|
|
5120
5142
|
}
|
|
5121
5143
|
// For testing purposes
|
|
5122
5144
|
getStreamsManagerProvider() {
|
|
@@ -5198,7 +5220,7 @@ class za extends w {
|
|
|
5198
5220
|
const { recvSession: n } = this;
|
|
5199
5221
|
if (!this.hasSpectator() || !n)
|
|
5200
5222
|
return !1;
|
|
5201
|
-
const s = n.getQuality(), r = n.getEffectiveQuality(), i = n.getAudioChannel(), a =
|
|
5223
|
+
const s = n.getQuality(), r = n.getEffectiveQuality(), i = n.getAudioChannel(), a = Le(e);
|
|
5202
5224
|
if (e === s && a === r)
|
|
5203
5225
|
return !1;
|
|
5204
5226
|
if (a === r)
|
|
@@ -5212,11 +5234,11 @@ class za extends w {
|
|
|
5212
5234
|
{ silent: !0 }
|
|
5213
5235
|
);
|
|
5214
5236
|
if (c) {
|
|
5215
|
-
const
|
|
5237
|
+
const g = o.getEffectiveQuality();
|
|
5216
5238
|
this.events.trigger("recv-quality-changed", {
|
|
5217
5239
|
previousQuality: s,
|
|
5218
5240
|
quality: e,
|
|
5219
|
-
effectiveQuality:
|
|
5241
|
+
effectiveQuality: g
|
|
5220
5242
|
});
|
|
5221
5243
|
}
|
|
5222
5244
|
return c;
|
|
@@ -5255,7 +5277,7 @@ class za extends w {
|
|
|
5255
5277
|
}
|
|
5256
5278
|
subscribeMcuRemoteTrackEvents() {
|
|
5257
5279
|
this.on("peerconnection:ontrack", (e) => {
|
|
5258
|
-
this.addRemoteTrack(this.mainRemoteStreamsManager, e.track,
|
|
5280
|
+
this.addRemoteTrack(this.mainRemoteStreamsManager, e.track, tt(e));
|
|
5259
5281
|
});
|
|
5260
5282
|
}
|
|
5261
5283
|
addRemoteTrack(e, n, s) {
|
|
@@ -5311,7 +5333,7 @@ class za extends w {
|
|
|
5311
5333
|
}
|
|
5312
5334
|
attachRecvSessionTracks(e) {
|
|
5313
5335
|
const { peerConnection: n } = e, s = (r) => {
|
|
5314
|
-
this.addRemoteTrack(this.recvRemoteStreamsManager, r.track,
|
|
5336
|
+
this.addRemoteTrack(this.recvRemoteStreamsManager, r.track, tt(r));
|
|
5315
5337
|
};
|
|
5316
5338
|
n.addEventListener("track", s), this.disposeRecvSessionTrackListener = () => {
|
|
5317
5339
|
n.removeEventListener("track", s);
|
|
@@ -5335,7 +5357,7 @@ class za extends w {
|
|
|
5335
5357
|
audioChannel: e,
|
|
5336
5358
|
quality: n,
|
|
5337
5359
|
pcConfig: this.mcuSession.getPcConfig()
|
|
5338
|
-
}, a = new
|
|
5360
|
+
}, a = new Ga(i, { sendOffer: this.tools.sendOffer });
|
|
5339
5361
|
return this.recvSession = a, this.recvRemoteStreamsManager.reset(), this.attachRecvSessionTracks(a), a.call({
|
|
5340
5362
|
conferenceNumber: r.conferenceForToken,
|
|
5341
5363
|
token: r.token
|
|
@@ -5346,10 +5368,10 @@ class za extends w {
|
|
|
5346
5368
|
}
|
|
5347
5369
|
)), { session: a, callResult: c })).catch(async (c) => {
|
|
5348
5370
|
this.stopRecvSession();
|
|
5349
|
-
const
|
|
5350
|
-
|
|
5351
|
-
const
|
|
5352
|
-
throw await this.failed(
|
|
5371
|
+
const g = new lt();
|
|
5372
|
+
g.body = c instanceof Error ? c.message : String(c);
|
|
5373
|
+
const C = ht.causes.INTERNAL_ERROR;
|
|
5374
|
+
throw await this.failed(g, C), c;
|
|
5353
5375
|
});
|
|
5354
5376
|
}
|
|
5355
5377
|
stopRecvSession({ silent: e } = {}) {
|
|
@@ -5360,14 +5382,14 @@ class za extends w {
|
|
|
5360
5382
|
previous: e,
|
|
5361
5383
|
next: n
|
|
5362
5384
|
}) => {
|
|
5363
|
-
if (
|
|
5385
|
+
if (gi(e, n) && (this.stopRecvSession(), this.deferredStartRecvSessionRunner.cancel(), this.emitEventChangedRemoteStreamsConnected()), Ei(e, n)) {
|
|
5364
5386
|
const s = n.recvParams;
|
|
5365
5387
|
this.stateMachine.getInRoomCredentials() === void 0 ? this.deferredStartRecvSessionRunner.set({
|
|
5366
5388
|
audioId: s.audioId
|
|
5367
5389
|
}) : this.startRecvSession({ audioChannel: s.audioId }).catch(() => {
|
|
5368
5390
|
});
|
|
5369
5391
|
}
|
|
5370
|
-
|
|
5392
|
+
Ti(e, n) && this.mcuSession.restoreBitrateForSenders(), mi(e, n) && this.mcuSession.setMinBitrateForSenders();
|
|
5371
5393
|
};
|
|
5372
5394
|
subscribeContentedStreamEvents() {
|
|
5373
5395
|
this.contentedStreamManager.on("available", this.emitEventChangedRemoteStreamsConnected), this.contentedStreamManager.on("not-available", this.emitEventChangedRemoteStreamsConnected);
|
|
@@ -5383,39 +5405,39 @@ class za extends w {
|
|
|
5383
5405
|
return this.mcuSession.renegotiate();
|
|
5384
5406
|
}
|
|
5385
5407
|
}
|
|
5386
|
-
const
|
|
5408
|
+
const Yt = [
|
|
5387
5409
|
"presentation:start",
|
|
5388
5410
|
"presentation:started",
|
|
5389
5411
|
"presentation:end",
|
|
5390
5412
|
"presentation:ended",
|
|
5391
5413
|
"presentation:failed"
|
|
5392
|
-
],
|
|
5414
|
+
], Ka = () => new G(Yt);
|
|
5393
5415
|
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 || {}), S = /* @__PURE__ */ ((t) => (t.LOG_TRANSITION = "logTransition", t.LOG_STATE_CHANGE = "logStateChange", t.SET_ERROR = "setError", t.CLEAR_ERROR = "clearError", t))(S || {}), m = /* @__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))(m || {});
|
|
5394
|
-
const
|
|
5416
|
+
const jt = {
|
|
5395
5417
|
lastError: void 0
|
|
5396
|
-
},
|
|
5418
|
+
}, nt = A("PresentationStateMachine"), Xa = (t) => t instanceof Error ? t : new Error(JSON.stringify(t)), Za = () => Z({
|
|
5397
5419
|
types: {
|
|
5398
|
-
context:
|
|
5420
|
+
context: jt,
|
|
5399
5421
|
events: {}
|
|
5400
5422
|
},
|
|
5401
5423
|
actions: {
|
|
5402
5424
|
[S.LOG_TRANSITION]: (t, e) => {
|
|
5403
|
-
|
|
5425
|
+
nt(`State transition: ${e.from} -> ${e.to} (${e.event})`);
|
|
5404
5426
|
},
|
|
5405
5427
|
[S.LOG_STATE_CHANGE]: (t, e) => {
|
|
5406
|
-
|
|
5428
|
+
nt("PresentationStateMachine state changed", e.state);
|
|
5407
5429
|
},
|
|
5408
5430
|
[S.SET_ERROR]: f(({ event: t }) => "error" in t && t.error !== void 0 ? {
|
|
5409
|
-
lastError:
|
|
5431
|
+
lastError: Xa(t.error)
|
|
5410
5432
|
} : { lastError: void 0 }),
|
|
5411
5433
|
[S.CLEAR_ERROR]: f(() => ({
|
|
5412
5434
|
lastError: void 0
|
|
5413
5435
|
}))
|
|
5414
5436
|
}
|
|
5415
|
-
}),
|
|
5437
|
+
}), eo = () => Za().createMachine({
|
|
5416
5438
|
id: "presentation",
|
|
5417
5439
|
initial: h.IDLE,
|
|
5418
|
-
context:
|
|
5440
|
+
context: jt,
|
|
5419
5441
|
states: {
|
|
5420
5442
|
[h.IDLE]: {
|
|
5421
5443
|
entry: {
|
|
@@ -5704,10 +5726,10 @@ const Yt = {
|
|
|
5704
5726
|
}
|
|
5705
5727
|
}
|
|
5706
5728
|
}
|
|
5707
|
-
}),
|
|
5708
|
-
class
|
|
5729
|
+
}), to = eo(), no = A("PresentationStateMachine");
|
|
5730
|
+
class so extends ee {
|
|
5709
5731
|
constructor(e) {
|
|
5710
|
-
super(
|
|
5732
|
+
super(to), this.subscribeCallEvents(e);
|
|
5711
5733
|
}
|
|
5712
5734
|
get isIdle() {
|
|
5713
5735
|
return this.hasState(h.IDLE);
|
|
@@ -5744,7 +5766,7 @@ class no extends ee {
|
|
|
5744
5766
|
}
|
|
5745
5767
|
sendEvent(e) {
|
|
5746
5768
|
if (!this.actor.getSnapshot().can(e)) {
|
|
5747
|
-
|
|
5769
|
+
no(
|
|
5748
5770
|
`[PresentationStateMachine] Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`
|
|
5749
5771
|
);
|
|
5750
5772
|
return;
|
|
@@ -5783,14 +5805,14 @@ class no extends ee {
|
|
|
5783
5805
|
);
|
|
5784
5806
|
}
|
|
5785
5807
|
}
|
|
5786
|
-
const
|
|
5808
|
+
const ro = 1, io = [
|
|
5787
5809
|
"presentation:start",
|
|
5788
5810
|
"presentation:started",
|
|
5789
5811
|
"presentation:end",
|
|
5790
5812
|
"presentation:ended",
|
|
5791
5813
|
"presentation:failed"
|
|
5792
|
-
],
|
|
5793
|
-
class
|
|
5814
|
+
], ao = (t) => t instanceof Error ? t : new Error(String(t)), Uc = (t) => In(t);
|
|
5815
|
+
class oo extends w {
|
|
5794
5816
|
stateMachine;
|
|
5795
5817
|
promisePendingStartPresentation;
|
|
5796
5818
|
promisePendingStopPresentation;
|
|
@@ -5802,7 +5824,7 @@ class ao extends w {
|
|
|
5802
5824
|
callManager: e,
|
|
5803
5825
|
maxBitrate: n
|
|
5804
5826
|
}) {
|
|
5805
|
-
super(
|
|
5827
|
+
super(Ka()), this.callManager = e, this.maxBitrate = n, this.stateMachine = new so(this.callManager.events), this.subscribe();
|
|
5806
5828
|
}
|
|
5807
5829
|
get isPendingPresentation() {
|
|
5808
5830
|
return !!this.promisePendingStartPresentation || !!this.promisePendingStopPresentation;
|
|
@@ -5855,7 +5877,7 @@ class ao extends w {
|
|
|
5855
5877
|
this.cancelableSendPresentationWithRepeatedCalls?.stopRepeatedCalls();
|
|
5856
5878
|
}
|
|
5857
5879
|
subscribe() {
|
|
5858
|
-
|
|
5880
|
+
io.forEach((e) => {
|
|
5859
5881
|
this.callManager.on(e, (n) => {
|
|
5860
5882
|
this.events.trigger(e, n);
|
|
5861
5883
|
});
|
|
@@ -5866,7 +5888,7 @@ class ao extends w {
|
|
|
5866
5888
|
stream: s,
|
|
5867
5889
|
presentationOptions: r,
|
|
5868
5890
|
options: i = {
|
|
5869
|
-
callLimit:
|
|
5891
|
+
callLimit: ro
|
|
5870
5892
|
}
|
|
5871
5893
|
}) {
|
|
5872
5894
|
const a = async () => this.sendPresentation(
|
|
@@ -5875,7 +5897,7 @@ class ao extends w {
|
|
|
5875
5897
|
s,
|
|
5876
5898
|
r
|
|
5877
5899
|
), o = () => !!this.streamPresentationCurrent;
|
|
5878
|
-
return this.cancelableSendPresentationWithRepeatedCalls =
|
|
5900
|
+
return this.cancelableSendPresentationWithRepeatedCalls = Ge({
|
|
5879
5901
|
targetFunction: a,
|
|
5880
5902
|
isComplete: o,
|
|
5881
5903
|
isRejectAsValid: !0,
|
|
@@ -5890,18 +5912,18 @@ class ao extends w {
|
|
|
5890
5912
|
sendEncodings: o,
|
|
5891
5913
|
onAddedTransceiver: c
|
|
5892
5914
|
}) {
|
|
5893
|
-
const
|
|
5894
|
-
if (
|
|
5915
|
+
const g = ge(s, { contentHint: i });
|
|
5916
|
+
if (g === void 0)
|
|
5895
5917
|
throw new Error("No streamPresentationTarget");
|
|
5896
|
-
this.streamPresentationCurrent =
|
|
5897
|
-
const
|
|
5918
|
+
this.streamPresentationCurrent = g;
|
|
5919
|
+
const C = e().then(async () => n.startPresentation(g, r, {
|
|
5898
5920
|
degradationPreference: a,
|
|
5899
5921
|
sendEncodings: o,
|
|
5900
5922
|
onAddedTransceiver: c
|
|
5901
5923
|
})).then(this.setMaxBitrate).then(() => s).catch((I) => {
|
|
5902
5924
|
throw this.removeStreamPresentationCurrent(), this.notifyPresentationFailed(I), I;
|
|
5903
5925
|
});
|
|
5904
|
-
return this.promisePendingStartPresentation =
|
|
5926
|
+
return this.promisePendingStartPresentation = C, C.finally(() => {
|
|
5905
5927
|
this.promisePendingStartPresentation = void 0;
|
|
5906
5928
|
});
|
|
5907
5929
|
}
|
|
@@ -5910,7 +5932,7 @@ class ao extends w {
|
|
|
5910
5932
|
if (!e || !n || s === void 0)
|
|
5911
5933
|
return;
|
|
5912
5934
|
const r = e.getSenders();
|
|
5913
|
-
await
|
|
5935
|
+
await Wi(r, n, s);
|
|
5914
5936
|
};
|
|
5915
5937
|
getRtcSessionProtected = () => {
|
|
5916
5938
|
const e = this.callManager.getEstablishedRTCSession();
|
|
@@ -5931,10 +5953,10 @@ class ao extends w {
|
|
|
5931
5953
|
delete this.streamPresentationCurrent;
|
|
5932
5954
|
}
|
|
5933
5955
|
notifyPresentationFailed(e) {
|
|
5934
|
-
this.events.trigger("presentation:failed",
|
|
5956
|
+
this.events.trigger("presentation:failed", ao(e));
|
|
5935
5957
|
}
|
|
5936
5958
|
}
|
|
5937
|
-
const
|
|
5959
|
+
const co = A("ContentedStreamStateMachine"), lo = Z({
|
|
5938
5960
|
types: {
|
|
5939
5961
|
context: {},
|
|
5940
5962
|
events: {}
|
|
@@ -5975,9 +5997,9 @@ const oo = A("ContentedStreamStateMachine"), co = Z({
|
|
|
5975
5997
|
}
|
|
5976
5998
|
}
|
|
5977
5999
|
});
|
|
5978
|
-
class
|
|
6000
|
+
class ho extends ee {
|
|
5979
6001
|
constructor() {
|
|
5980
|
-
super(
|
|
6002
|
+
super(lo);
|
|
5981
6003
|
}
|
|
5982
6004
|
get isAvailable() {
|
|
5983
6005
|
return this.state === "contented-stream:available";
|
|
@@ -5999,7 +6021,7 @@ class lo extends ee {
|
|
|
5999
6021
|
}
|
|
6000
6022
|
send(e) {
|
|
6001
6023
|
if (!this.actor.getSnapshot().can(e)) {
|
|
6002
|
-
|
|
6024
|
+
co(
|
|
6003
6025
|
`[ContentedStreamStateMachine] Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`
|
|
6004
6026
|
);
|
|
6005
6027
|
return;
|
|
@@ -6018,15 +6040,15 @@ class lo extends ee {
|
|
|
6018
6040
|
);
|
|
6019
6041
|
}
|
|
6020
6042
|
}
|
|
6021
|
-
const
|
|
6043
|
+
const uo = [
|
|
6022
6044
|
"available",
|
|
6023
6045
|
"not-available"
|
|
6024
6046
|
/* NOT_AVAILABLE */
|
|
6025
|
-
],
|
|
6047
|
+
], go = () => new G(uo);
|
|
6026
6048
|
class Eo extends w {
|
|
6027
6049
|
stateMachine;
|
|
6028
6050
|
constructor() {
|
|
6029
|
-
super(
|
|
6051
|
+
super(go()), this.stateMachine = new ho(), this.proxyEvents();
|
|
6030
6052
|
}
|
|
6031
6053
|
get isAvailable() {
|
|
6032
6054
|
return this.stateMachine.isAvailable;
|
|
@@ -6050,33 +6072,33 @@ class Eo extends w {
|
|
|
6050
6072
|
});
|
|
6051
6073
|
}
|
|
6052
6074
|
}
|
|
6053
|
-
const
|
|
6075
|
+
const zt = [
|
|
6054
6076
|
"ringing",
|
|
6055
6077
|
"declinedIncomingCall",
|
|
6056
6078
|
"terminatedIncomingCall",
|
|
6057
6079
|
"failedIncomingCall"
|
|
6058
|
-
],
|
|
6059
|
-
var l = /* @__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))(l || {}),
|
|
6060
|
-
const
|
|
6080
|
+
], To = () => new G(zt);
|
|
6081
|
+
var l = /* @__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))(l || {}), p = /* @__PURE__ */ ((t) => (t.LOG_TRANSITION = "logTransition", t.LOG_STATE_CHANGE = "logStateChange", t.REMEMBER_INCOMING = "rememberIncoming", t.REMEMBER_REASON = "rememberReason", t.CLEAR_INCOMING = "clearIncoming", t))(p || {}), 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 || {});
|
|
6082
|
+
const Jt = {
|
|
6061
6083
|
remoteCallerData: void 0,
|
|
6062
6084
|
lastReason: void 0
|
|
6063
|
-
},
|
|
6085
|
+
}, st = A("IncomingCallStateMachine"), mo = () => Z({
|
|
6064
6086
|
types: {
|
|
6065
|
-
context:
|
|
6087
|
+
context: Jt,
|
|
6066
6088
|
events: {}
|
|
6067
6089
|
},
|
|
6068
6090
|
actions: {
|
|
6069
|
-
[
|
|
6070
|
-
|
|
6091
|
+
[p.LOG_TRANSITION]: (t, e) => {
|
|
6092
|
+
st(`State transition: ${e.from} -> ${e.to} (${e.event})`);
|
|
6071
6093
|
},
|
|
6072
|
-
[
|
|
6073
|
-
|
|
6094
|
+
[p.LOG_STATE_CHANGE]: (t, e) => {
|
|
6095
|
+
st("IncomingCallStateMachine state changed", e.state);
|
|
6074
6096
|
},
|
|
6075
|
-
[
|
|
6097
|
+
[p.REMEMBER_INCOMING]: f(({ event: t }) => ({
|
|
6076
6098
|
remoteCallerData: t.data,
|
|
6077
6099
|
lastReason: void 0
|
|
6078
6100
|
})),
|
|
6079
|
-
[
|
|
6101
|
+
[p.REMEMBER_REASON]: f(({ event: t, context: e }) => t.type === R.CONSUMED ? {
|
|
6080
6102
|
remoteCallerData: e.remoteCallerData,
|
|
6081
6103
|
lastReason: l.CONSUMED
|
|
6082
6104
|
} : t.type === R.DECLINED ? {
|
|
@@ -6089,28 +6111,28 @@ const zt = {
|
|
|
6089
6111
|
remoteCallerData: t.data,
|
|
6090
6112
|
lastReason: l.FAILED
|
|
6091
6113
|
}),
|
|
6092
|
-
[
|
|
6114
|
+
[p.CLEAR_INCOMING]: f(() => ({
|
|
6093
6115
|
remoteCallerData: void 0,
|
|
6094
6116
|
lastReason: void 0
|
|
6095
6117
|
}))
|
|
6096
6118
|
}
|
|
6097
|
-
}),
|
|
6119
|
+
}), So = () => mo().createMachine({
|
|
6098
6120
|
id: "incoming",
|
|
6099
6121
|
initial: l.IDLE,
|
|
6100
|
-
context:
|
|
6122
|
+
context: Jt,
|
|
6101
6123
|
states: {
|
|
6102
6124
|
[l.IDLE]: {
|
|
6103
6125
|
entry: {
|
|
6104
|
-
type:
|
|
6126
|
+
type: p.LOG_STATE_CHANGE,
|
|
6105
6127
|
params: { state: l.IDLE }
|
|
6106
6128
|
},
|
|
6107
6129
|
on: {
|
|
6108
6130
|
[R.RINGING]: {
|
|
6109
6131
|
target: l.RINGING,
|
|
6110
6132
|
actions: [
|
|
6111
|
-
|
|
6133
|
+
p.REMEMBER_INCOMING,
|
|
6112
6134
|
{
|
|
6113
|
-
type:
|
|
6135
|
+
type: p.LOG_TRANSITION,
|
|
6114
6136
|
params: {
|
|
6115
6137
|
from: l.IDLE,
|
|
6116
6138
|
to: l.RINGING,
|
|
@@ -6122,9 +6144,9 @@ const zt = {
|
|
|
6122
6144
|
[R.CLEAR]: {
|
|
6123
6145
|
target: l.IDLE,
|
|
6124
6146
|
actions: [
|
|
6125
|
-
|
|
6147
|
+
p.CLEAR_INCOMING,
|
|
6126
6148
|
{
|
|
6127
|
-
type:
|
|
6149
|
+
type: p.LOG_TRANSITION,
|
|
6128
6150
|
params: {
|
|
6129
6151
|
from: l.IDLE,
|
|
6130
6152
|
to: l.IDLE,
|
|
@@ -6137,16 +6159,16 @@ const zt = {
|
|
|
6137
6159
|
},
|
|
6138
6160
|
[l.RINGING]: {
|
|
6139
6161
|
entry: {
|
|
6140
|
-
type:
|
|
6162
|
+
type: p.LOG_STATE_CHANGE,
|
|
6141
6163
|
params: { state: l.RINGING }
|
|
6142
6164
|
},
|
|
6143
6165
|
on: {
|
|
6144
6166
|
[R.RINGING]: {
|
|
6145
6167
|
target: l.RINGING,
|
|
6146
6168
|
actions: [
|
|
6147
|
-
|
|
6169
|
+
p.REMEMBER_INCOMING,
|
|
6148
6170
|
{
|
|
6149
|
-
type:
|
|
6171
|
+
type: p.LOG_TRANSITION,
|
|
6150
6172
|
params: {
|
|
6151
6173
|
from: l.RINGING,
|
|
6152
6174
|
to: l.RINGING,
|
|
@@ -6158,9 +6180,9 @@ const zt = {
|
|
|
6158
6180
|
[R.CONSUMED]: {
|
|
6159
6181
|
target: l.CONSUMED,
|
|
6160
6182
|
actions: [
|
|
6161
|
-
|
|
6183
|
+
p.REMEMBER_REASON,
|
|
6162
6184
|
{
|
|
6163
|
-
type:
|
|
6185
|
+
type: p.LOG_TRANSITION,
|
|
6164
6186
|
params: {
|
|
6165
6187
|
from: l.RINGING,
|
|
6166
6188
|
to: l.CONSUMED,
|
|
@@ -6172,9 +6194,9 @@ const zt = {
|
|
|
6172
6194
|
[R.DECLINED]: {
|
|
6173
6195
|
target: l.DECLINED,
|
|
6174
6196
|
actions: [
|
|
6175
|
-
|
|
6197
|
+
p.REMEMBER_REASON,
|
|
6176
6198
|
{
|
|
6177
|
-
type:
|
|
6199
|
+
type: p.LOG_TRANSITION,
|
|
6178
6200
|
params: {
|
|
6179
6201
|
from: l.RINGING,
|
|
6180
6202
|
to: l.DECLINED,
|
|
@@ -6186,9 +6208,9 @@ const zt = {
|
|
|
6186
6208
|
[R.TERMINATED]: {
|
|
6187
6209
|
target: l.TERMINATED,
|
|
6188
6210
|
actions: [
|
|
6189
|
-
|
|
6211
|
+
p.REMEMBER_REASON,
|
|
6190
6212
|
{
|
|
6191
|
-
type:
|
|
6213
|
+
type: p.LOG_TRANSITION,
|
|
6192
6214
|
params: {
|
|
6193
6215
|
from: l.RINGING,
|
|
6194
6216
|
to: l.TERMINATED,
|
|
@@ -6200,9 +6222,9 @@ const zt = {
|
|
|
6200
6222
|
[R.FAILED]: {
|
|
6201
6223
|
target: l.FAILED,
|
|
6202
6224
|
actions: [
|
|
6203
|
-
|
|
6225
|
+
p.REMEMBER_REASON,
|
|
6204
6226
|
{
|
|
6205
|
-
type:
|
|
6227
|
+
type: p.LOG_TRANSITION,
|
|
6206
6228
|
params: {
|
|
6207
6229
|
from: l.RINGING,
|
|
6208
6230
|
to: l.FAILED,
|
|
@@ -6214,9 +6236,9 @@ const zt = {
|
|
|
6214
6236
|
[R.CLEAR]: {
|
|
6215
6237
|
target: l.IDLE,
|
|
6216
6238
|
actions: [
|
|
6217
|
-
|
|
6239
|
+
p.CLEAR_INCOMING,
|
|
6218
6240
|
{
|
|
6219
|
-
type:
|
|
6241
|
+
type: p.LOG_TRANSITION,
|
|
6220
6242
|
params: {
|
|
6221
6243
|
from: l.RINGING,
|
|
6222
6244
|
to: l.IDLE,
|
|
@@ -6229,16 +6251,16 @@ const zt = {
|
|
|
6229
6251
|
},
|
|
6230
6252
|
[l.CONSUMED]: {
|
|
6231
6253
|
entry: {
|
|
6232
|
-
type:
|
|
6254
|
+
type: p.LOG_STATE_CHANGE,
|
|
6233
6255
|
params: { state: l.CONSUMED }
|
|
6234
6256
|
},
|
|
6235
6257
|
on: {
|
|
6236
6258
|
[R.CLEAR]: {
|
|
6237
6259
|
target: l.IDLE,
|
|
6238
6260
|
actions: [
|
|
6239
|
-
|
|
6261
|
+
p.CLEAR_INCOMING,
|
|
6240
6262
|
{
|
|
6241
|
-
type:
|
|
6263
|
+
type: p.LOG_TRANSITION,
|
|
6242
6264
|
params: {
|
|
6243
6265
|
from: l.CONSUMED,
|
|
6244
6266
|
to: l.IDLE,
|
|
@@ -6250,9 +6272,9 @@ const zt = {
|
|
|
6250
6272
|
[R.RINGING]: {
|
|
6251
6273
|
target: l.RINGING,
|
|
6252
6274
|
actions: [
|
|
6253
|
-
|
|
6275
|
+
p.REMEMBER_INCOMING,
|
|
6254
6276
|
{
|
|
6255
|
-
type:
|
|
6277
|
+
type: p.LOG_TRANSITION,
|
|
6256
6278
|
params: {
|
|
6257
6279
|
from: l.CONSUMED,
|
|
6258
6280
|
to: l.RINGING,
|
|
@@ -6265,16 +6287,16 @@ const zt = {
|
|
|
6265
6287
|
},
|
|
6266
6288
|
[l.DECLINED]: {
|
|
6267
6289
|
entry: {
|
|
6268
|
-
type:
|
|
6290
|
+
type: p.LOG_STATE_CHANGE,
|
|
6269
6291
|
params: { state: l.DECLINED }
|
|
6270
6292
|
},
|
|
6271
6293
|
on: {
|
|
6272
6294
|
[R.CLEAR]: {
|
|
6273
6295
|
target: l.IDLE,
|
|
6274
6296
|
actions: [
|
|
6275
|
-
|
|
6297
|
+
p.CLEAR_INCOMING,
|
|
6276
6298
|
{
|
|
6277
|
-
type:
|
|
6299
|
+
type: p.LOG_TRANSITION,
|
|
6278
6300
|
params: {
|
|
6279
6301
|
from: l.DECLINED,
|
|
6280
6302
|
to: l.IDLE,
|
|
@@ -6286,9 +6308,9 @@ const zt = {
|
|
|
6286
6308
|
[R.RINGING]: {
|
|
6287
6309
|
target: l.RINGING,
|
|
6288
6310
|
actions: [
|
|
6289
|
-
|
|
6311
|
+
p.REMEMBER_INCOMING,
|
|
6290
6312
|
{
|
|
6291
|
-
type:
|
|
6313
|
+
type: p.LOG_TRANSITION,
|
|
6292
6314
|
params: {
|
|
6293
6315
|
from: l.DECLINED,
|
|
6294
6316
|
to: l.RINGING,
|
|
@@ -6301,16 +6323,16 @@ const zt = {
|
|
|
6301
6323
|
},
|
|
6302
6324
|
[l.TERMINATED]: {
|
|
6303
6325
|
entry: {
|
|
6304
|
-
type:
|
|
6326
|
+
type: p.LOG_STATE_CHANGE,
|
|
6305
6327
|
params: { state: l.TERMINATED }
|
|
6306
6328
|
},
|
|
6307
6329
|
on: {
|
|
6308
6330
|
[R.CLEAR]: {
|
|
6309
6331
|
target: l.IDLE,
|
|
6310
6332
|
actions: [
|
|
6311
|
-
|
|
6333
|
+
p.CLEAR_INCOMING,
|
|
6312
6334
|
{
|
|
6313
|
-
type:
|
|
6335
|
+
type: p.LOG_TRANSITION,
|
|
6314
6336
|
params: {
|
|
6315
6337
|
from: l.TERMINATED,
|
|
6316
6338
|
to: l.IDLE,
|
|
@@ -6322,9 +6344,9 @@ const zt = {
|
|
|
6322
6344
|
[R.RINGING]: {
|
|
6323
6345
|
target: l.RINGING,
|
|
6324
6346
|
actions: [
|
|
6325
|
-
|
|
6347
|
+
p.REMEMBER_INCOMING,
|
|
6326
6348
|
{
|
|
6327
|
-
type:
|
|
6349
|
+
type: p.LOG_TRANSITION,
|
|
6328
6350
|
params: {
|
|
6329
6351
|
from: l.TERMINATED,
|
|
6330
6352
|
to: l.RINGING,
|
|
@@ -6337,16 +6359,16 @@ const zt = {
|
|
|
6337
6359
|
},
|
|
6338
6360
|
[l.FAILED]: {
|
|
6339
6361
|
entry: {
|
|
6340
|
-
type:
|
|
6362
|
+
type: p.LOG_STATE_CHANGE,
|
|
6341
6363
|
params: { state: l.FAILED }
|
|
6342
6364
|
},
|
|
6343
6365
|
on: {
|
|
6344
6366
|
[R.CLEAR]: {
|
|
6345
6367
|
target: l.IDLE,
|
|
6346
6368
|
actions: [
|
|
6347
|
-
|
|
6369
|
+
p.CLEAR_INCOMING,
|
|
6348
6370
|
{
|
|
6349
|
-
type:
|
|
6371
|
+
type: p.LOG_TRANSITION,
|
|
6350
6372
|
params: {
|
|
6351
6373
|
from: l.FAILED,
|
|
6352
6374
|
to: l.IDLE,
|
|
@@ -6358,9 +6380,9 @@ const zt = {
|
|
|
6358
6380
|
[R.RINGING]: {
|
|
6359
6381
|
target: l.RINGING,
|
|
6360
6382
|
actions: [
|
|
6361
|
-
|
|
6383
|
+
p.REMEMBER_INCOMING,
|
|
6362
6384
|
{
|
|
6363
|
-
type:
|
|
6385
|
+
type: p.LOG_TRANSITION,
|
|
6364
6386
|
params: {
|
|
6365
6387
|
from: l.FAILED,
|
|
6366
6388
|
to: l.RINGING,
|
|
@@ -6372,10 +6394,10 @@ const zt = {
|
|
|
6372
6394
|
}
|
|
6373
6395
|
}
|
|
6374
6396
|
}
|
|
6375
|
-
}),
|
|
6376
|
-
class
|
|
6397
|
+
}), po = So(), Co = A("IncomingCallStateMachine");
|
|
6398
|
+
class Ro extends ee {
|
|
6377
6399
|
constructor({ incomingEvents: e, connectionEvents: n }) {
|
|
6378
|
-
super(
|
|
6400
|
+
super(po), this.subscribeIncomingEvents(e), this.subscribeConnectionEvents(n);
|
|
6379
6401
|
}
|
|
6380
6402
|
get isIdle() {
|
|
6381
6403
|
return this.hasState(l.IDLE);
|
|
@@ -6466,18 +6488,18 @@ class po extends ee {
|
|
|
6466
6488
|
this.sendEvent({ type: R.CLEAR });
|
|
6467
6489
|
};
|
|
6468
6490
|
}
|
|
6469
|
-
const
|
|
6491
|
+
const No = 486, Io = 487, _e = (t) => ({
|
|
6470
6492
|
displayName: t.remote_identity.display_name,
|
|
6471
6493
|
host: t.remote_identity.uri.host,
|
|
6472
6494
|
incomingNumber: t.remote_identity.uri.user,
|
|
6473
6495
|
rtcSession: t
|
|
6474
6496
|
});
|
|
6475
|
-
class
|
|
6497
|
+
class Ao extends w {
|
|
6476
6498
|
stateMachine;
|
|
6477
6499
|
incomingRTCSession;
|
|
6478
6500
|
connectionManager;
|
|
6479
6501
|
constructor(e) {
|
|
6480
|
-
super(
|
|
6502
|
+
super(To()), this.connectionManager = e, this.stateMachine = new Ro({
|
|
6481
6503
|
incomingEvents: this.events,
|
|
6482
6504
|
connectionEvents: this.connectionManager.events
|
|
6483
6505
|
}), this.start();
|
|
@@ -6506,7 +6528,7 @@ class Io extends w {
|
|
|
6506
6528
|
return this.stateMachine.toConsumed(), this.removeIncomingSession(), e;
|
|
6507
6529
|
};
|
|
6508
6530
|
async declineToIncomingCall({
|
|
6509
|
-
statusCode: e =
|
|
6531
|
+
statusCode: e = Io
|
|
6510
6532
|
} = {}) {
|
|
6511
6533
|
return new Promise((n, s) => {
|
|
6512
6534
|
try {
|
|
@@ -6518,7 +6540,7 @@ class Io extends w {
|
|
|
6518
6540
|
});
|
|
6519
6541
|
}
|
|
6520
6542
|
async busyIncomingCall() {
|
|
6521
|
-
return this.declineToIncomingCall({ statusCode:
|
|
6543
|
+
return this.declineToIncomingCall({ statusCode: No });
|
|
6522
6544
|
}
|
|
6523
6545
|
subscribe() {
|
|
6524
6546
|
this.connectionManager.on("newRTCSession", this.handleNewRTCSession);
|
|
@@ -6543,7 +6565,7 @@ class Io extends w {
|
|
|
6543
6565
|
delete this.incomingRTCSession;
|
|
6544
6566
|
}
|
|
6545
6567
|
}
|
|
6546
|
-
class
|
|
6568
|
+
class vo {
|
|
6547
6569
|
apiManager;
|
|
6548
6570
|
connectionManager;
|
|
6549
6571
|
callManager;
|
|
@@ -6572,35 +6594,35 @@ class Ao {
|
|
|
6572
6594
|
if (e === void 0 || n === void 0 || s === void 0)
|
|
6573
6595
|
return;
|
|
6574
6596
|
const r = [
|
|
6575
|
-
`${
|
|
6576
|
-
`${
|
|
6577
|
-
`${
|
|
6597
|
+
`${E.CONTENT_ENTER_ROOM}: ${this.peerToPeerRoom}`,
|
|
6598
|
+
`${E.PARTICIPANT_NAME}: ${this.number}`,
|
|
6599
|
+
`${E.IS_DIRECT_PEER_TO_PEER}: true`
|
|
6578
6600
|
];
|
|
6579
6601
|
s.sendEnterRoom(r);
|
|
6580
6602
|
};
|
|
6581
6603
|
}
|
|
6582
|
-
const
|
|
6583
|
-
|
|
6584
|
-
t.incoming.value === e.incoming.value && t.presentation.value === e.presentation.value && t.autoConnector.value === e.autoConnector.value,
|
|
6604
|
+
const Kt = ["snapshot-changed"], fo = () => new G(Kt), Mo = (t, e) => Object.is(t, e), rt = (t, e) => t.connection.value === e.connection.value && // Call: full snapshot so room/context updates without a state `value` change still emit snapshot-changed
|
|
6605
|
+
fn(t.call, e.call) && // Incoming: value only — repeated RINGING with different callee metadata must not emit again
|
|
6606
|
+
t.incoming.value === e.incoming.value && t.presentation.value === e.presentation.value && t.autoConnector.value === e.autoConnector.value, it = (t) => ({
|
|
6585
6607
|
connection: t.connection.getSnapshot(),
|
|
6586
6608
|
call: t.call.getSnapshot(),
|
|
6587
6609
|
incoming: t.incoming.getSnapshot(),
|
|
6588
6610
|
presentation: t.presentation.getSnapshot(),
|
|
6589
6611
|
autoConnector: t.autoConnector.getSnapshot()
|
|
6590
6612
|
});
|
|
6591
|
-
class
|
|
6613
|
+
class _o extends w {
|
|
6592
6614
|
machines;
|
|
6593
6615
|
currentSnapshot;
|
|
6594
6616
|
subscribers = /* @__PURE__ */ new Set();
|
|
6595
6617
|
actorSubscriptions = [];
|
|
6596
6618
|
constructor(e) {
|
|
6597
|
-
super(
|
|
6619
|
+
super(fo()), this.machines = {
|
|
6598
6620
|
connection: e.connectionManager.stateMachine,
|
|
6599
6621
|
call: e.callManager.stateMachine,
|
|
6600
6622
|
incoming: e.incomingCallManager.stateMachine,
|
|
6601
6623
|
presentation: e.presentationManager.stateMachine,
|
|
6602
6624
|
autoConnector: e.autoConnectorManager.stateMachine
|
|
6603
|
-
}, this.currentSnapshot =
|
|
6625
|
+
}, this.currentSnapshot = it(this.machines), this.actorSubscriptions.push(
|
|
6604
6626
|
this.machines.connection.subscribe(this.notifySubscribers),
|
|
6605
6627
|
this.machines.call.subscribe(this.notifySubscribers),
|
|
6606
6628
|
this.machines.incoming.subscribe(this.notifySubscribers),
|
|
@@ -6612,14 +6634,14 @@ class Mo extends w {
|
|
|
6612
6634
|
return this.currentSnapshot;
|
|
6613
6635
|
}
|
|
6614
6636
|
subscribe(e, n, s) {
|
|
6615
|
-
const r = typeof n == "function", i = r ? e : (I) => I, a = r ? n : e, c = r ? s ??
|
|
6637
|
+
const r = typeof n == "function", i = r ? e : (I) => I, a = r ? n : e, c = r ? s ?? Mo : rt, g = i(this.currentSnapshot), C = {
|
|
6616
6638
|
selector: i,
|
|
6617
6639
|
listener: a,
|
|
6618
6640
|
equals: c,
|
|
6619
|
-
current:
|
|
6641
|
+
current: g
|
|
6620
6642
|
};
|
|
6621
|
-
return this.subscribers.add(
|
|
6622
|
-
this.subscribers.delete(
|
|
6643
|
+
return this.subscribers.add(C), () => {
|
|
6644
|
+
this.subscribers.delete(C);
|
|
6623
6645
|
};
|
|
6624
6646
|
}
|
|
6625
6647
|
stop() {
|
|
@@ -6629,8 +6651,8 @@ class Mo extends w {
|
|
|
6629
6651
|
}
|
|
6630
6652
|
notifySubscribers = () => {
|
|
6631
6653
|
const e = this.currentSnapshot;
|
|
6632
|
-
this.currentSnapshot =
|
|
6633
|
-
const n =
|
|
6654
|
+
this.currentSnapshot = it(this.machines);
|
|
6655
|
+
const n = rt(e, this.currentSnapshot);
|
|
6634
6656
|
for (const s of this.subscribers) {
|
|
6635
6657
|
const r = s.selector(this.currentSnapshot);
|
|
6636
6658
|
s.equals(s.current, r) || (s.current = r, s.listener(r));
|
|
@@ -6643,10 +6665,10 @@ class Mo extends w {
|
|
|
6643
6665
|
}
|
|
6644
6666
|
const ie = 1e3;
|
|
6645
6667
|
var P = /* @__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))(P || {});
|
|
6646
|
-
const
|
|
6668
|
+
const Xt = ["collected", "stopped"], Oo = () => new G(Xt), at = () => "performance" in window ? performance.now() : Date.now(), le = (t) => [...t.keys()].reduce((e, n) => {
|
|
6647
6669
|
const s = t.get(n);
|
|
6648
6670
|
return s === void 0 ? e : { ...e, [s.type]: s };
|
|
6649
|
-
}, {}),
|
|
6671
|
+
}, {}), bo = (t) => {
|
|
6650
6672
|
if (!t)
|
|
6651
6673
|
return {
|
|
6652
6674
|
outboundRtp: void 0,
|
|
@@ -6661,7 +6683,7 @@ const Kt = ["collected", "stopped"], _o = () => new G(Kt), it = () => "performan
|
|
|
6661
6683
|
mediaSource: e[P.MEDIA_SOURCE],
|
|
6662
6684
|
remoteInboundRtp: e[P.REMOTE_INBOUND_RTP]
|
|
6663
6685
|
};
|
|
6664
|
-
},
|
|
6686
|
+
}, ot = (t) => {
|
|
6665
6687
|
if (!t)
|
|
6666
6688
|
return {
|
|
6667
6689
|
outboundRtp: void 0,
|
|
@@ -6676,7 +6698,7 @@ const Kt = ["collected", "stopped"], _o = () => new G(Kt), it = () => "performan
|
|
|
6676
6698
|
mediaSource: e[P.MEDIA_SOURCE],
|
|
6677
6699
|
remoteInboundRtp: e[P.REMOTE_INBOUND_RTP]
|
|
6678
6700
|
};
|
|
6679
|
-
},
|
|
6701
|
+
}, ct = ({
|
|
6680
6702
|
videoReceiversStats: t,
|
|
6681
6703
|
synchronizationSourcesVideo: e
|
|
6682
6704
|
}) => {
|
|
@@ -6692,7 +6714,7 @@ const Kt = ["collected", "stopped"], _o = () => new G(Kt), it = () => "performan
|
|
|
6692
6714
|
codec: n[P.CODEC],
|
|
6693
6715
|
synchronizationSources: e
|
|
6694
6716
|
};
|
|
6695
|
-
},
|
|
6717
|
+
}, Po = ({
|
|
6696
6718
|
audioReceiverStats: t,
|
|
6697
6719
|
synchronizationSourcesAudio: e
|
|
6698
6720
|
}) => {
|
|
@@ -6710,7 +6732,7 @@ const Kt = ["collected", "stopped"], _o = () => new G(Kt), it = () => "performan
|
|
|
6710
6732
|
remoteOutboundRtp: n[P.REMOTE_OUTBOUND_RTP],
|
|
6711
6733
|
synchronizationSources: e
|
|
6712
6734
|
};
|
|
6713
|
-
},
|
|
6735
|
+
}, Zt = (t) => {
|
|
6714
6736
|
if (!t)
|
|
6715
6737
|
return {
|
|
6716
6738
|
candidatePair: void 0,
|
|
@@ -6727,39 +6749,39 @@ const Kt = ["collected", "stopped"], _o = () => new G(Kt), it = () => "performan
|
|
|
6727
6749
|
remoteCandidate: e[P.REMOTE_CANDIDATE],
|
|
6728
6750
|
transport: e[P.TRANSPORT]
|
|
6729
6751
|
};
|
|
6730
|
-
},
|
|
6752
|
+
}, yo = ({
|
|
6731
6753
|
audioSenderStats: t,
|
|
6732
6754
|
videoSenderFirstStats: e,
|
|
6733
6755
|
videoSenderSecondStats: n
|
|
6734
6756
|
}) => ({
|
|
6735
|
-
video:
|
|
6736
|
-
secondVideo:
|
|
6737
|
-
audio:
|
|
6738
|
-
additional:
|
|
6757
|
+
video: ot(e),
|
|
6758
|
+
secondVideo: ot(n),
|
|
6759
|
+
audio: bo(t),
|
|
6760
|
+
additional: Zt(
|
|
6739
6761
|
t ?? e ?? n
|
|
6740
6762
|
)
|
|
6741
|
-
}),
|
|
6763
|
+
}), Do = ({
|
|
6742
6764
|
audioReceiverStats: t,
|
|
6743
6765
|
videoReceiverFirstStats: e,
|
|
6744
6766
|
videoReceiverSecondStats: n,
|
|
6745
6767
|
synchronizationSources: s
|
|
6746
6768
|
}) => ({
|
|
6747
|
-
video:
|
|
6769
|
+
video: ct({
|
|
6748
6770
|
videoReceiversStats: e,
|
|
6749
6771
|
synchronizationSourcesVideo: s.video
|
|
6750
6772
|
}),
|
|
6751
|
-
secondVideo:
|
|
6773
|
+
secondVideo: ct({
|
|
6752
6774
|
videoReceiversStats: n,
|
|
6753
6775
|
synchronizationSourcesVideo: s.secondVideo ?? s.video
|
|
6754
6776
|
}),
|
|
6755
|
-
audio:
|
|
6777
|
+
audio: Po({
|
|
6756
6778
|
audioReceiverStats: t,
|
|
6757
6779
|
synchronizationSourcesAudio: s.audio
|
|
6758
6780
|
}),
|
|
6759
|
-
additional:
|
|
6781
|
+
additional: Zt(
|
|
6760
6782
|
t ?? e ?? n
|
|
6761
6783
|
)
|
|
6762
|
-
}),
|
|
6784
|
+
}), Lo = ({
|
|
6763
6785
|
audioSenderStats: t,
|
|
6764
6786
|
videoSenderFirstStats: e,
|
|
6765
6787
|
videoSenderSecondStats: n,
|
|
@@ -6768,11 +6790,11 @@ const Kt = ["collected", "stopped"], _o = () => new G(Kt), it = () => "performan
|
|
|
6768
6790
|
videoReceiverSecondStats: i,
|
|
6769
6791
|
synchronizationSources: a
|
|
6770
6792
|
}) => {
|
|
6771
|
-
const o =
|
|
6793
|
+
const o = yo({
|
|
6772
6794
|
audioSenderStats: t,
|
|
6773
6795
|
videoSenderFirstStats: e,
|
|
6774
6796
|
videoSenderSecondStats: n
|
|
6775
|
-
}), c =
|
|
6797
|
+
}), c = Do({
|
|
6776
6798
|
audioReceiverStats: s,
|
|
6777
6799
|
videoReceiverFirstStats: r,
|
|
6778
6800
|
videoReceiverSecondStats: i,
|
|
@@ -6782,19 +6804,19 @@ const Kt = ["collected", "stopped"], _o = () => new G(Kt), it = () => "performan
|
|
|
6782
6804
|
outbound: o,
|
|
6783
6805
|
inbound: c
|
|
6784
6806
|
};
|
|
6785
|
-
},
|
|
6786
|
-
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),
|
|
6807
|
+
}, wo = async (t) => {
|
|
6808
|
+
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 = {
|
|
6787
6809
|
trackIdentifier: o?.track.id,
|
|
6788
6810
|
item: o?.getSynchronizationSources()[0]
|
|
6789
|
-
},
|
|
6811
|
+
}, C = {
|
|
6790
6812
|
trackIdentifier: c[0]?.track.id,
|
|
6791
6813
|
item: c[0]?.getSynchronizationSources()[0]
|
|
6792
6814
|
}, I = {
|
|
6793
6815
|
trackIdentifier: c[1]?.track.id,
|
|
6794
6816
|
item: c[1]?.getSynchronizationSources()[0]
|
|
6795
6817
|
}, b = {
|
|
6796
|
-
audio:
|
|
6797
|
-
video:
|
|
6818
|
+
audio: g,
|
|
6819
|
+
video: C,
|
|
6798
6820
|
secondVideo: I
|
|
6799
6821
|
};
|
|
6800
6822
|
return Promise.all([
|
|
@@ -6810,8 +6832,8 @@ const Kt = ["collected", "stopped"], _o = () => new G(Kt), it = () => "performan
|
|
|
6810
6832
|
L,
|
|
6811
6833
|
z,
|
|
6812
6834
|
te,
|
|
6813
|
-
|
|
6814
|
-
|
|
6835
|
+
Be,
|
|
6836
|
+
dn
|
|
6815
6837
|
] = _;
|
|
6816
6838
|
return {
|
|
6817
6839
|
synchronizationSources: b,
|
|
@@ -6819,23 +6841,23 @@ const Kt = ["collected", "stopped"], _o = () => new G(Kt), it = () => "performan
|
|
|
6819
6841
|
videoSenderFirstStats: L,
|
|
6820
6842
|
videoSenderSecondStats: z,
|
|
6821
6843
|
audioReceiverStats: te,
|
|
6822
|
-
videoReceiverFirstStats:
|
|
6823
|
-
videoReceiverSecondStats:
|
|
6844
|
+
videoReceiverFirstStats: Be,
|
|
6845
|
+
videoReceiverSecondStats: dn
|
|
6824
6846
|
};
|
|
6825
6847
|
});
|
|
6826
|
-
},
|
|
6827
|
-
class
|
|
6848
|
+
}, Go = A("StatsPeerConnection");
|
|
6849
|
+
class ko extends w {
|
|
6828
6850
|
setTimeoutRequest;
|
|
6829
|
-
requesterAllStatistics = new
|
|
6851
|
+
requesterAllStatistics = new Ce(wo);
|
|
6830
6852
|
constructor() {
|
|
6831
|
-
super(
|
|
6853
|
+
super(Oo()), this.setTimeoutRequest = new ut();
|
|
6832
6854
|
}
|
|
6833
6855
|
get requested() {
|
|
6834
6856
|
return this.setTimeoutRequest.requested;
|
|
6835
6857
|
}
|
|
6836
6858
|
start(e, {
|
|
6837
6859
|
interval: n = ie,
|
|
6838
|
-
onError: s =
|
|
6860
|
+
onError: s = Go
|
|
6839
6861
|
} = {}) {
|
|
6840
6862
|
this.setTimeoutRequest.request(() => {
|
|
6841
6863
|
this.collectStatistics(e, {
|
|
@@ -6858,10 +6880,10 @@ class Go extends w {
|
|
|
6858
6880
|
onError: n,
|
|
6859
6881
|
onSuccess: s
|
|
6860
6882
|
}) => {
|
|
6861
|
-
const r =
|
|
6883
|
+
const r = at();
|
|
6862
6884
|
this.requestAllStatistics(e).then((i) => {
|
|
6863
|
-
this.events.trigger("collected",
|
|
6864
|
-
const o =
|
|
6885
|
+
this.events.trigger("collected", Lo(i));
|
|
6886
|
+
const o = at() - r;
|
|
6865
6887
|
let c = ie;
|
|
6866
6888
|
o > 48 ? c = ie * 4 : o > 32 ? c = ie * 3 : o > 16 && (c = ie * 2), s({ interval: c });
|
|
6867
6889
|
}).catch((i) => {
|
|
@@ -6875,8 +6897,8 @@ class Go extends w {
|
|
|
6875
6897
|
return this.requesterAllStatistics.request(n);
|
|
6876
6898
|
};
|
|
6877
6899
|
}
|
|
6878
|
-
const
|
|
6879
|
-
class
|
|
6900
|
+
const Uo = 500, Fo = A("StatsManager");
|
|
6901
|
+
class Bo extends w {
|
|
6880
6902
|
statsPeerConnection;
|
|
6881
6903
|
availableStats;
|
|
6882
6904
|
previousAvailableStats;
|
|
@@ -6886,7 +6908,7 @@ class Fo extends w {
|
|
|
6886
6908
|
callManager: e,
|
|
6887
6909
|
apiManager: n
|
|
6888
6910
|
}) {
|
|
6889
|
-
const s = new
|
|
6911
|
+
const s = new ko();
|
|
6890
6912
|
super(s.events), this.statsPeerConnection = s, this.callManager = e, this.apiManager = n, this.subscribe();
|
|
6891
6913
|
}
|
|
6892
6914
|
get availableIncomingBitrate() {
|
|
@@ -6949,7 +6971,7 @@ class Fo extends w {
|
|
|
6949
6971
|
return this.previousInboundRtp?.bytesReceived;
|
|
6950
6972
|
}
|
|
6951
6973
|
get isReceivingPackets() {
|
|
6952
|
-
const e = this.packetsReceived !== void 0 && this.packetsReceived >=
|
|
6974
|
+
const e = this.packetsReceived !== void 0 && this.packetsReceived >= Uo, n = this.packetsReceived !== this.previousPacketsReceived;
|
|
6953
6975
|
return e && n;
|
|
6954
6976
|
}
|
|
6955
6977
|
hasAvailableIncomingBitrateChangedQuarter() {
|
|
@@ -6985,42 +7007,42 @@ class Fo extends w {
|
|
|
6985
7007
|
};
|
|
6986
7008
|
maybeSendStats() {
|
|
6987
7009
|
this.availableIncomingBitrate !== void 0 && this.hasAvailableIncomingBitrateChangedQuarter() && this.apiManager.sendStats({ availableIncomingBitrate: this.availableIncomingBitrate }).catch((e) => {
|
|
6988
|
-
|
|
7010
|
+
Fo("Failed to send stats", e);
|
|
6989
7011
|
});
|
|
6990
7012
|
}
|
|
6991
7013
|
}
|
|
6992
|
-
const
|
|
7014
|
+
const $o = A("setCodecPreferences"), xo = (t, e) => t.filter((s) => e.some((r) => r.clockRate === s.clockRate && r.mimeType === s.mimeType && r.channels === s.channels && r.sdpFmtpLine === s.sdpFmtpLine)), Vo = (t) => {
|
|
6993
7015
|
const e = RTCRtpSender.getCapabilities(t), n = RTCRtpReceiver.getCapabilities(t), s = e === null ? [] : e.codecs, r = n === null ? [] : n.codecs;
|
|
6994
|
-
return
|
|
6995
|
-
},
|
|
7016
|
+
return xo(s, r);
|
|
7017
|
+
}, qo = (t, e) => e === void 0 || e.length === 0 ? t : t.sort((n, s) => {
|
|
6996
7018
|
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;
|
|
6997
7019
|
return a - o;
|
|
6998
|
-
}),
|
|
7020
|
+
}), Ho = (t, e) => e === void 0 || e.length === 0 ? t : t.filter((n) => !e.includes(n.mimeType)), Wo = (t, {
|
|
6999
7021
|
preferredMimeTypesVideoCodecs: e,
|
|
7000
7022
|
excludeMimeTypesVideoCodecs: n
|
|
7001
7023
|
}) => {
|
|
7002
7024
|
try {
|
|
7003
7025
|
if (typeof t.setCodecPreferences == "function" && t.sender.track?.kind === "video" && (e !== void 0 && e.length > 0 || n !== void 0 && n.length > 0)) {
|
|
7004
|
-
const s =
|
|
7026
|
+
const s = Vo("video"), r = Ho(s, n), i = qo(r, e);
|
|
7005
7027
|
t.setCodecPreferences(i);
|
|
7006
7028
|
}
|
|
7007
7029
|
} catch (s) {
|
|
7008
|
-
|
|
7030
|
+
$o("setCodecPreferences error", s);
|
|
7009
7031
|
}
|
|
7010
|
-
},
|
|
7032
|
+
}, en = [
|
|
7011
7033
|
"balancing-scheduled",
|
|
7012
7034
|
"balancing-started",
|
|
7013
7035
|
"balancing-stopped",
|
|
7014
7036
|
"parameters-updated"
|
|
7015
|
-
],
|
|
7016
|
-
class
|
|
7037
|
+
], Qo = () => new G(en), Yo = A("VideoSendingBalancerManager");
|
|
7038
|
+
class jo extends w {
|
|
7017
7039
|
isBalancingActive = !1;
|
|
7018
7040
|
callManager;
|
|
7019
7041
|
balancingStartDelay;
|
|
7020
7042
|
videoSendingBalancer;
|
|
7021
7043
|
startBalancingTimer;
|
|
7022
7044
|
constructor(e, n, s = {}) {
|
|
7023
|
-
super(
|
|
7045
|
+
super(Qo()), this.callManager = e, this.balancingStartDelay = s.balancingStartDelay ?? 1e4, this.videoSendingBalancer = new fa(
|
|
7024
7046
|
n,
|
|
7025
7047
|
() => e.connection,
|
|
7026
7048
|
{
|
|
@@ -7076,7 +7098,7 @@ class Yo extends w {
|
|
|
7076
7098
|
scheduleBalancingStart() {
|
|
7077
7099
|
this.clearStartTimer(), this.startBalancingTimer = setTimeout(() => {
|
|
7078
7100
|
this.startBalancingTimer = void 0, this.startBalancing().catch((e) => {
|
|
7079
|
-
|
|
7101
|
+
Yo("startBalancing: error", e);
|
|
7080
7102
|
});
|
|
7081
7103
|
}, this.balancingStartDelay), this.events.trigger("balancing-scheduled", { delay: this.balancingStartDelay });
|
|
7082
7104
|
}
|
|
@@ -7084,12 +7106,12 @@ class Yo extends w {
|
|
|
7084
7106
|
this.startBalancingTimer && (clearTimeout(this.startBalancingTimer), this.startBalancingTimer = void 0);
|
|
7085
7107
|
}
|
|
7086
7108
|
}
|
|
7087
|
-
const
|
|
7088
|
-
en,
|
|
7109
|
+
const tn = "health-snapshot", nn = "inbound-video-problem-detected", sn = "inbound-video-problem-resolved", rn = "inbound-video-problem-reset", an = [
|
|
7089
7110
|
tn,
|
|
7090
7111
|
nn,
|
|
7091
|
-
sn
|
|
7092
|
-
|
|
7112
|
+
sn,
|
|
7113
|
+
rn
|
|
7114
|
+
], zo = () => new G(an), Jo = 3;
|
|
7093
7115
|
class ce extends w {
|
|
7094
7116
|
statsManager;
|
|
7095
7117
|
callManager;
|
|
@@ -7097,8 +7119,8 @@ class ce extends w {
|
|
|
7097
7119
|
consecutiveProblemSamplesCount = 0;
|
|
7098
7120
|
currentProblemReason;
|
|
7099
7121
|
hasEmittedCurrentProblem = !1;
|
|
7100
|
-
constructor(e, n, s =
|
|
7101
|
-
super(
|
|
7122
|
+
constructor(e, n, s = Jo) {
|
|
7123
|
+
super(zo()), this.statsManager = e, this.callManager = n, ce.assertValidMinConsecutiveProblemSamplesCount(
|
|
7102
7124
|
s
|
|
7103
7125
|
), this.minConsecutiveProblemSamplesCount = s, this.subscribe();
|
|
7104
7126
|
}
|
|
@@ -7145,13 +7167,13 @@ class ce extends w {
|
|
|
7145
7167
|
}
|
|
7146
7168
|
handleStatsCollected = () => {
|
|
7147
7169
|
const { healthSnapshot: e } = this;
|
|
7148
|
-
this.events.trigger(
|
|
7170
|
+
this.events.trigger(tn, e);
|
|
7149
7171
|
const n = ce.resolveProblemReason(e);
|
|
7150
7172
|
if (n === void 0) {
|
|
7151
7173
|
this.maybeEmitResolvedProblem(e), this.resetProblemDetectionState();
|
|
7152
7174
|
return;
|
|
7153
7175
|
}
|
|
7154
|
-
this.updateProblemDetectionState(n), this.consecutiveProblemSamplesCount >= this.minConsecutiveProblemSamplesCount && !this.hasEmittedCurrentProblem && (this.events.trigger(
|
|
7176
|
+
this.updateProblemDetectionState(n), this.consecutiveProblemSamplesCount >= this.minConsecutiveProblemSamplesCount && !this.hasEmittedCurrentProblem && (this.events.trigger(nn, {
|
|
7155
7177
|
...e,
|
|
7156
7178
|
consecutiveProblemSamplesCount: this.consecutiveProblemSamplesCount,
|
|
7157
7179
|
reason: n
|
|
@@ -7171,7 +7193,7 @@ class ce extends w {
|
|
|
7171
7193
|
this.currentProblemReason = e, this.consecutiveProblemSamplesCount = 1, this.hasEmittedCurrentProblem = !1;
|
|
7172
7194
|
};
|
|
7173
7195
|
maybeEmitResolvedProblem = (e) => {
|
|
7174
|
-
!this.hasEmittedCurrentProblem || this.currentProblemReason === void 0 || this.events.trigger(
|
|
7196
|
+
!this.hasEmittedCurrentProblem || this.currentProblemReason === void 0 || this.events.trigger(sn, {
|
|
7175
7197
|
...e,
|
|
7176
7198
|
reason: this.currentProblemReason
|
|
7177
7199
|
});
|
|
@@ -7180,7 +7202,7 @@ class ce extends w {
|
|
|
7180
7202
|
this.maybeEmitResetProblem(e), this.resetProblemDetectionState();
|
|
7181
7203
|
};
|
|
7182
7204
|
maybeEmitResetProblem = (e) => {
|
|
7183
|
-
!this.hasEmittedCurrentProblem || this.currentProblemReason === void 0 || this.events.trigger(
|
|
7205
|
+
!this.hasEmittedCurrentProblem || this.currentProblemReason === void 0 || this.events.trigger(rn, {
|
|
7184
7206
|
reason: this.currentProblemReason,
|
|
7185
7207
|
resetCause: e
|
|
7186
7208
|
});
|
|
@@ -7189,20 +7211,20 @@ class ce extends w {
|
|
|
7189
7211
|
this.currentProblemReason = void 0, this.consecutiveProblemSamplesCount = 0, this.hasEmittedCurrentProblem = !1;
|
|
7190
7212
|
};
|
|
7191
7213
|
}
|
|
7192
|
-
const J = A("MainStreamRecovery"),
|
|
7193
|
-
class
|
|
7214
|
+
const J = A("MainStreamRecovery"), Ko = 4e3;
|
|
7215
|
+
class pe {
|
|
7194
7216
|
renegotiateRequester;
|
|
7195
7217
|
renegotiateThrottled;
|
|
7196
7218
|
callManager;
|
|
7197
|
-
constructor(e, n =
|
|
7198
|
-
this.callManager = e, this.renegotiateRequester = new
|
|
7219
|
+
constructor(e, n = Ko) {
|
|
7220
|
+
this.callManager = e, this.renegotiateRequester = new Ce(e.renegotiate.bind(e)), this.renegotiateThrottled = this.createRenegotiateThrottled(n), this.subscribe();
|
|
7199
7221
|
}
|
|
7200
7222
|
static assertValidThrottleRecoveryTimeout(e) {
|
|
7201
7223
|
if (!Number.isInteger(e) || e < 1)
|
|
7202
7224
|
throw new Error("throttleRecoveryTimeout should be a positive integer");
|
|
7203
7225
|
}
|
|
7204
7226
|
setThrottleRecoveryTimeout(e) {
|
|
7205
|
-
|
|
7227
|
+
pe.assertValidThrottleRecoveryTimeout(e), this.renegotiateThrottled.cancel(), this.renegotiateThrottled = this.createRenegotiateThrottled(e);
|
|
7206
7228
|
}
|
|
7207
7229
|
// Запускает recovery: фактически вызывает throttled-версию requestRenegotiate.
|
|
7208
7230
|
recover() {
|
|
@@ -7221,7 +7243,7 @@ class Ce {
|
|
|
7221
7243
|
});
|
|
7222
7244
|
};
|
|
7223
7245
|
createRenegotiateThrottled(e) {
|
|
7224
|
-
return
|
|
7246
|
+
return pe.assertValidThrottleRecoveryTimeout(e), vn.throttle(this.requestRenegotiate.bind(this), e);
|
|
7225
7247
|
}
|
|
7226
7248
|
// На завершение вызова: отменяем throttling и (если есть) in-flight renegotiate.
|
|
7227
7249
|
subscribe() {
|
|
@@ -7234,37 +7256,36 @@ class Ce {
|
|
|
7234
7256
|
J("cancel recover main stream"), this.renegotiateThrottled.cancel(), this.renegotiateRequester.cancelRequest();
|
|
7235
7257
|
}
|
|
7236
7258
|
}
|
|
7237
|
-
var
|
|
7238
|
-
const
|
|
7259
|
+
var on = /* @__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))(on || {});
|
|
7260
|
+
const Xo = {
|
|
7239
7261
|
major: 25,
|
|
7240
7262
|
minor: 8,
|
|
7241
7263
|
patch: 0
|
|
7242
|
-
},
|
|
7264
|
+
}, Zo = ({
|
|
7243
7265
|
isYandexBrowser: t,
|
|
7244
7266
|
hasGreaterThanBrowserVersion: e
|
|
7245
7267
|
}) => {
|
|
7246
7268
|
const n = e(
|
|
7247
|
-
|
|
7269
|
+
Xo
|
|
7248
7270
|
);
|
|
7249
7271
|
return t && n;
|
|
7250
|
-
}, Zo = () => {
|
|
7251
|
-
const t = bt();
|
|
7252
|
-
if (Xo(t))
|
|
7253
|
-
return [an.VP8];
|
|
7254
7272
|
}, ec = () => {
|
|
7255
|
-
const
|
|
7273
|
+
const t = Pt();
|
|
7274
|
+
if (Zo(t))
|
|
7275
|
+
return [on.VP8];
|
|
7276
|
+
}, tc = () => {
|
|
7277
|
+
const { isMobileDevice: t, isSafari: e, isOpera: n, isWindows: s } = Pt();
|
|
7256
7278
|
return t || e || n && s;
|
|
7257
7279
|
};
|
|
7258
|
-
let
|
|
7259
|
-
|
|
7260
|
-
const
|
|
7261
|
-
ignoreForCodec:
|
|
7262
|
-
},
|
|
7280
|
+
let cn;
|
|
7281
|
+
tc() && (cn = "h264");
|
|
7282
|
+
const nc = {
|
|
7283
|
+
ignoreForCodec: cn
|
|
7284
|
+
}, sc = ec(), rc = 1e6, ic = ft.map((t) => `auto-connect:${t}`), ac = vt.map((t) => `connection:${t}`), oc = bt.map((t) => `call:${t}`), cc = Ct.map((t) => `api:${t}`), dc = zt.map((t) => `incoming-call:${t}`), lc = Yt.map((t) => `presentation:${t}`), hc = Xt.map((t) => `stats:${t}`), uc = en.map((t) => `video-balancer:${t}`), gc = an.map((t) => `main-stream-health:${t}`), Ec = Kt.map((t) => `session:${t}`), Tc = [
|
|
7263
7285
|
"disconnected-from-out-of-call",
|
|
7264
7286
|
"connected-with-configuration-from-out-of-call",
|
|
7265
7287
|
"stopped-presentation-by-server-command"
|
|
7266
|
-
],
|
|
7267
|
-
...rc,
|
|
7288
|
+
], mc = [
|
|
7268
7289
|
...ic,
|
|
7269
7290
|
...ac,
|
|
7270
7291
|
...oc,
|
|
@@ -7273,10 +7294,11 @@ const tc = {
|
|
|
7273
7294
|
...lc,
|
|
7274
7295
|
...hc,
|
|
7275
7296
|
...uc,
|
|
7297
|
+
...gc,
|
|
7276
7298
|
...Ec,
|
|
7277
|
-
...
|
|
7278
|
-
],
|
|
7279
|
-
class
|
|
7299
|
+
...Tc
|
|
7300
|
+
], Sc = () => new G(mc), dt = A("SipConnector");
|
|
7301
|
+
class Fc extends w {
|
|
7280
7302
|
connectionManager;
|
|
7281
7303
|
connectionQueueManager;
|
|
7282
7304
|
contentedStreamManager;
|
|
@@ -7303,34 +7325,34 @@ class Uc extends w {
|
|
|
7303
7325
|
minConsecutiveProblemSamplesCount: o,
|
|
7304
7326
|
throttleRecoveryTimeout: c
|
|
7305
7327
|
} = {}) {
|
|
7306
|
-
super(
|
|
7328
|
+
super(Sc()), this.preferredMimeTypesVideoCodecs = n ?? sc, this.excludeMimeTypesVideoCodecs = s, this.apiManager = new Fn(), this.connectionManager = new Cs({ JsSIP: e }, { numberOfConnectionAttempts: a }), this.connectionQueueManager = new Rs({
|
|
7307
7329
|
connectionManager: this.connectionManager
|
|
7308
|
-
}), this.contentedStreamManager = new Eo(), this.callSessionState = new
|
|
7330
|
+
}), this.contentedStreamManager = new Eo(), this.callSessionState = new Ii(), this.callManager = new Ja(
|
|
7309
7331
|
{ contentedStreamManager: this.contentedStreamManager },
|
|
7310
7332
|
{ sendOffer: this.sendOffer },
|
|
7311
7333
|
{ callSessionState: this.callSessionState }
|
|
7312
|
-
), this.incomingCallManager = new
|
|
7334
|
+
), this.incomingCallManager = new Ao(this.connectionManager), this.presentationManager = new oo({
|
|
7313
7335
|
callManager: this.callManager,
|
|
7314
|
-
maxBitrate:
|
|
7315
|
-
}), this.statsManager = new
|
|
7336
|
+
maxBitrate: rc
|
|
7337
|
+
}), this.statsManager = new Bo({
|
|
7316
7338
|
callManager: this.callManager,
|
|
7317
7339
|
apiManager: this.apiManager
|
|
7318
|
-
}), this.autoConnectorManager = new
|
|
7340
|
+
}), this.autoConnectorManager = new Us(
|
|
7319
7341
|
{
|
|
7320
7342
|
connectionQueueManager: this.connectionQueueManager,
|
|
7321
7343
|
connectionManager: this.connectionManager,
|
|
7322
7344
|
callManager: this.callManager
|
|
7323
7345
|
},
|
|
7324
7346
|
i
|
|
7325
|
-
), this.videoSendingBalancerManager = new
|
|
7347
|
+
), this.videoSendingBalancerManager = new jo(
|
|
7326
7348
|
this.callManager,
|
|
7327
7349
|
this.apiManager,
|
|
7328
|
-
r ??
|
|
7350
|
+
r ?? nc
|
|
7329
7351
|
), this.mainStreamHealthMonitor = new ce(
|
|
7330
7352
|
this.statsManager,
|
|
7331
7353
|
this.callManager,
|
|
7332
7354
|
o
|
|
7333
|
-
), this.mainStreamRecovery = new
|
|
7355
|
+
), this.mainStreamRecovery = new pe(this.callManager, c), this.sessionManager = new _o({
|
|
7334
7356
|
connectionManager: this.connectionManager,
|
|
7335
7357
|
callManager: this.callManager,
|
|
7336
7358
|
incomingCallManager: this.incomingCallManager,
|
|
@@ -7339,7 +7361,7 @@ class Uc extends w {
|
|
|
7339
7361
|
}), this.callManager.subscribeToApiEvents(this.apiManager), this.contentedStreamManager.subscribeToApiEvents(this.apiManager), this.apiManager.subscribe({
|
|
7340
7362
|
connectionManager: this.connectionManager,
|
|
7341
7363
|
callManager: this.callManager
|
|
7342
|
-
}), this.peerToPeerManager = new
|
|
7364
|
+
}), this.peerToPeerManager = new vo(), this.peerToPeerManager.subscribe({
|
|
7343
7365
|
connectionManager: this.connectionManager,
|
|
7344
7366
|
callManager: this.callManager,
|
|
7345
7367
|
apiManager: this.apiManager
|
|
@@ -7529,11 +7551,11 @@ class Uc extends w {
|
|
|
7529
7551
|
), this.apiManager.on("presentation:must-stop", () => {
|
|
7530
7552
|
this.mayBeStopPresentationAndNotify();
|
|
7531
7553
|
}), this.apiManager.on("failed-send-room-direct-p2p", ({ error: e }) => {
|
|
7532
|
-
const n = new
|
|
7554
|
+
const n = new lt();
|
|
7533
7555
|
n.body = e instanceof Error ? e.message : String(e);
|
|
7534
|
-
const s =
|
|
7556
|
+
const s = ht.causes.INTERNAL_ERROR;
|
|
7535
7557
|
this.callManager.failed(n, s).catch((r) => {
|
|
7536
|
-
|
|
7558
|
+
dt("Failed to end call after failed:", r);
|
|
7537
7559
|
});
|
|
7538
7560
|
});
|
|
7539
7561
|
}
|
|
@@ -7541,7 +7563,7 @@ class Uc extends w {
|
|
|
7541
7563
|
const r = this.connectionManager.getConnectionConfiguration()?.sipServerUrl;
|
|
7542
7564
|
if (r === void 0)
|
|
7543
7565
|
throw new Error("No sipServerUrl for sendOffer");
|
|
7544
|
-
return
|
|
7566
|
+
return Li({
|
|
7545
7567
|
serverUrl: r,
|
|
7546
7568
|
offer: n,
|
|
7547
7569
|
token: e.token,
|
|
@@ -7551,7 +7573,7 @@ class Uc extends w {
|
|
|
7551
7573
|
});
|
|
7552
7574
|
};
|
|
7553
7575
|
setCodecPreferences(e) {
|
|
7554
|
-
|
|
7576
|
+
Wo(e, {
|
|
7555
7577
|
preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
|
|
7556
7578
|
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
7557
7579
|
});
|
|
@@ -7561,7 +7583,7 @@ class Uc extends w {
|
|
|
7561
7583
|
}
|
|
7562
7584
|
subscribeToMainStreamHealthMonitorEvents() {
|
|
7563
7585
|
this.mainStreamHealthMonitor.on("inbound-video-problem-detected", ({ reason: e }) => {
|
|
7564
|
-
|
|
7586
|
+
dt("detected inbound video problem", { reason: e }), this.mainStreamRecovery.recover();
|
|
7565
7587
|
});
|
|
7566
7588
|
}
|
|
7567
7589
|
bridgeEvents = (e, n) => {
|
|
@@ -7576,57 +7598,57 @@ class Uc extends w {
|
|
|
7576
7598
|
};
|
|
7577
7599
|
}
|
|
7578
7600
|
export {
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
|
|
7592
|
-
|
|
7593
|
-
|
|
7594
|
-
|
|
7595
|
-
|
|
7596
|
-
|
|
7601
|
+
ci as $,
|
|
7602
|
+
so as A,
|
|
7603
|
+
Fc as B,
|
|
7604
|
+
Ii as C,
|
|
7605
|
+
Ji as D,
|
|
7606
|
+
Wt as E,
|
|
7607
|
+
ko as F,
|
|
7608
|
+
Ms as G,
|
|
7609
|
+
oi as H,
|
|
7610
|
+
Ro as I,
|
|
7611
|
+
oa as J,
|
|
7612
|
+
ds as K,
|
|
7613
|
+
To as L,
|
|
7614
|
+
yc as M,
|
|
7615
|
+
Pc as N,
|
|
7616
|
+
$t as O,
|
|
7617
|
+
Pi as P,
|
|
7618
|
+
Uc as Q,
|
|
7597
7619
|
x as R,
|
|
7598
|
-
|
|
7599
|
-
|
|
7620
|
+
_o as S,
|
|
7621
|
+
ui as T,
|
|
7600
7622
|
H as U,
|
|
7601
7623
|
de as V,
|
|
7602
|
-
|
|
7624
|
+
mi as W,
|
|
7603
7625
|
Ei as X,
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
|
|
7607
|
-
|
|
7608
|
-
|
|
7609
|
-
|
|
7610
|
-
|
|
7626
|
+
Ti as Y,
|
|
7627
|
+
gi as Z,
|
|
7628
|
+
ei as _,
|
|
7629
|
+
Gc as a,
|
|
7630
|
+
wc as b,
|
|
7631
|
+
kc as c,
|
|
7632
|
+
Pt as d,
|
|
7611
7633
|
Se as e,
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
|
|
7634
|
+
Li as f,
|
|
7635
|
+
Lt as g,
|
|
7636
|
+
Pe as h,
|
|
7637
|
+
ye as i,
|
|
7616
7638
|
u as j,
|
|
7617
7639
|
d as k,
|
|
7618
7640
|
M as l,
|
|
7619
7641
|
A as m,
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7642
|
+
Xn as n,
|
|
7643
|
+
os as o,
|
|
7644
|
+
ge as p,
|
|
7623
7645
|
T as q,
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
7646
|
+
Lc as r,
|
|
7647
|
+
Dc as s,
|
|
7648
|
+
St as t,
|
|
7627
7649
|
R as u,
|
|
7628
7650
|
l as v,
|
|
7629
|
-
|
|
7651
|
+
on as w,
|
|
7630
7652
|
m as x,
|
|
7631
7653
|
h as y,
|
|
7632
7654
|
P as z
|