sip-connector 28.1.0 → 28.3.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-DzXjqZ5P.js → @SipConnector-D1IwYjNa.js} +951 -831
- package/dist/@SipConnector-FHUBOY5f.cjs +1 -0
- package/dist/CallManager/@CallManager.d.ts +6 -5
- package/dist/CallManager/CallStateMachine/createCallMachine.d.ts +3 -3
- package/dist/CallManager/types.d.ts +0 -13
- package/dist/CallSessionState/@CallSessionState.d.ts +31 -0
- package/dist/CallSessionState/RoleManager.d.ts +25 -0
- package/dist/CallSessionState/events.d.ts +11 -0
- package/dist/CallSessionState/index.d.ts +4 -0
- package/dist/CallSessionState/types.d.ts +30 -0
- package/dist/CallSessionState/utils.d.ts +8 -0
- package/dist/SipConnector/@SipConnector.d.ts +2 -0
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +13 -13
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +112 -104
- package/package.json +3 -3
- package/dist/@SipConnector-Dp-zNzG2.cjs +0 -1
- package/dist/CallManager/RoleManager.d.ts +0 -28
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { NameAddrHeader as
|
|
2
|
-
import { MediaStreamTrackMock as
|
|
3
|
-
import { TypedEvents as
|
|
4
|
-
import
|
|
5
|
-
import { resolveRequesterByTimeout as
|
|
6
|
-
import { CancelableRequest as
|
|
7
|
-
import { createActor as
|
|
8
|
-
import { repeatedCallsAsync as
|
|
9
|
-
import { createStackPromises as
|
|
10
|
-
import { UAParser as
|
|
1
|
+
import { NameAddrHeader as dn, URI as ln, SessionStatus as hn, IncomingResponse as dt, C as lt } from "@krivega/jssip";
|
|
2
|
+
import { MediaStreamTrackMock as un, createAudioMediaStreamTrackMock as En, createVideoMediaStreamTrackMock as gn } from "webrtc-mock";
|
|
3
|
+
import { TypedEvents as G, EventEmitterProxy as w, Events as Tn } from "events-constructor";
|
|
4
|
+
import Le from "debug";
|
|
5
|
+
import { resolveRequesterByTimeout as mn, requesterByTimeoutsWithFailCalls as Sn, DelayRequester as Cn, hasCanceledError as pn, SetTimeoutRequest as ht } from "@krivega/timeout-requester";
|
|
6
|
+
import { CancelableRequest as pe, isCanceledError as ut } from "@krivega/cancelable-promise";
|
|
7
|
+
import { createActor as Rn, setup as Z, assign as f, fromPromise as Re } from "xstate";
|
|
8
|
+
import { repeatedCallsAsync as we, hasCanceledError as Nn } from "repeated-calls";
|
|
9
|
+
import { createStackPromises as Et, isPromiseIsNotActualError as gt } from "stack-promises";
|
|
10
|
+
import { UAParser as In } from "ua-parser-js";
|
|
11
11
|
import "sequent-promises";
|
|
12
|
-
import
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
}, A = (t) =>
|
|
18
|
-
var
|
|
19
|
-
const
|
|
12
|
+
import An, { isEqual as vn } from "lodash";
|
|
13
|
+
const Ge = "sip-connector", fn = Le(Ge), bc = () => {
|
|
14
|
+
Le.enable(`${Ge}:*`);
|
|
15
|
+
}, Pc = () => {
|
|
16
|
+
Le.enable(`-${Ge}:*`);
|
|
17
|
+
}, A = (t) => fn.extend(t), Mn = "Error decline with 603", _n = 1006, On = (t) => typeof t == "object" && t !== null && "code" in t && t.code === _n, bn = (t) => t.message === Mn;
|
|
18
|
+
var ge = /* @__PURE__ */ ((t) => (t.SPECTATOR = "SPECTATOR", t.PARTICIPANT = "PARTICIPANT", t))(ge || {}), 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 || {}), Tt = /* @__PURE__ */ ((t) => (t.H264 = "H264", t.VP8 = "VP8", t.VP9 = "VP9", t.AV1 = "AV1", t))(Tt || {}), g = /* @__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))(g || {}), 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 || {}), ke = /* @__PURE__ */ ((t) => (t.SPECTATOR_MANUAL = "0", t.BY_STATE_CAM = "1", t.SPECTATOR_FORCED = "2", t))(ke || {}), mt = /* @__PURE__ */ ((t) => (t.AUDIO = "AUDIO", t.VIDEO = "VIDEO", t.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", t))(mt || {});
|
|
19
|
+
const B = (t) => typeof t == "string" && t.trim().length > 0, Pn = (t) => typeof t == "object" && t !== null && !Array.isArray(t), St = (t) => typeof t == "boolean", yn = (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 $ = (t) => typeof t == "string" && t.trim().length > 0, _n = (t) => typeof
|
|
|
46
46
|
"admin:stop-mic",
|
|
47
47
|
"admin:force-sync-media-state",
|
|
48
48
|
"failed-send-room-direct-p2p"
|
|
49
|
-
],
|
|
49
|
+
], Dn = () => new G(Ct), Ln = (t) => !(!Pn(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
|
+
}, wn = (t) => typeof t == "string" && !Number.isNaN(Number(t)) && Number.isFinite(Number(t)), Gn = (t) => {
|
|
53
|
+
if (wn(t))
|
|
54
54
|
return Number(t);
|
|
55
|
-
},
|
|
55
|
+
}, kn = (t) => {
|
|
56
56
|
const e = t.toLowerCase();
|
|
57
57
|
if (e === "true" || e === "1")
|
|
58
58
|
return !0;
|
|
@@ -60,7 +60,7 @@ const $ = (t) => typeof t == "string" && t.trim().length > 0, _n = (t) => typeof
|
|
|
60
60
|
return !1;
|
|
61
61
|
}, y = (t, e) => {
|
|
62
62
|
const n = t.getHeader(e.toLowerCase());
|
|
63
|
-
if (
|
|
63
|
+
if (!B(n))
|
|
64
64
|
return;
|
|
65
65
|
const s = n.toLowerCase();
|
|
66
66
|
switch (e) {
|
|
@@ -83,37 +83,37 @@ const $ = (t) => typeof t == "string" && t.trim().length > 0, _n = (t) => typeof
|
|
|
83
83
|
case g.AVAILABLE_INCOMING_BITRATE:
|
|
84
84
|
case g.AUDIO_TRACK_COUNT:
|
|
85
85
|
case g.VIDEO_TRACK_COUNT:
|
|
86
|
-
return
|
|
86
|
+
return Gn(s);
|
|
87
87
|
case g.CONTENTED_STREAM_CODEC:
|
|
88
|
-
return Q(
|
|
88
|
+
return Q(Tt, s);
|
|
89
89
|
case g.CONTENT_TYPE:
|
|
90
|
-
return Q(
|
|
90
|
+
return Q(V, s);
|
|
91
91
|
case g.CONTENT_USE_LICENSE:
|
|
92
|
-
return Q(
|
|
92
|
+
return Q(mt, s);
|
|
93
93
|
case g.MAIN_CAM:
|
|
94
|
-
return Q(
|
|
94
|
+
return Q(F, s);
|
|
95
95
|
case g.MIC:
|
|
96
|
-
return Q(ge, s);
|
|
97
|
-
case g.MEDIA_SYNC:
|
|
98
96
|
return Q(Te, s);
|
|
97
|
+
case g.MEDIA_SYNC:
|
|
98
|
+
return Q(me, s);
|
|
99
99
|
case g.CONTENT_PARTICIPANT_STATE:
|
|
100
|
-
return Q(
|
|
100
|
+
return Q(ge, s);
|
|
101
101
|
case g.SPECTATOR_MODE:
|
|
102
|
-
return Q(
|
|
102
|
+
return Q(ke, s);
|
|
103
103
|
case g.CONTENTED_STREAM_STATE:
|
|
104
104
|
return Q(oe, s);
|
|
105
105
|
case g.IS_DIRECT_PEER_TO_PEER:
|
|
106
|
-
return
|
|
106
|
+
return kn(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 Be = A("ApiManager");
|
|
113
|
+
class Un extends w {
|
|
114
114
|
callManager;
|
|
115
115
|
constructor() {
|
|
116
|
-
super(
|
|
116
|
+
super(Dn());
|
|
117
117
|
}
|
|
118
118
|
subscribe({
|
|
119
119
|
connectionManager: e,
|
|
@@ -150,7 +150,7 @@ class wn extends G {
|
|
|
150
150
|
r,
|
|
151
151
|
i
|
|
152
152
|
];
|
|
153
|
-
return s.sendInfo(
|
|
153
|
+
return s.sendInfo($.CHANNELS, void 0, { extraHeaders: a });
|
|
154
154
|
}
|
|
155
155
|
sendEnterRoom(e) {
|
|
156
156
|
this.sendEnterRoomProtected(e).catch((n) => {
|
|
@@ -163,7 +163,7 @@ class wn extends G {
|
|
|
163
163
|
a,
|
|
164
164
|
o
|
|
165
165
|
];
|
|
166
|
-
return r.sendInfo(
|
|
166
|
+
return r.sendInfo($.MEDIA_STATE, void 0, {
|
|
167
167
|
noTerminateWhenError: !0,
|
|
168
168
|
...s,
|
|
169
169
|
extraHeaders: c
|
|
@@ -173,14 +173,14 @@ class wn extends G {
|
|
|
173
173
|
availableIncomingBitrate: e
|
|
174
174
|
}) {
|
|
175
175
|
const n = this.getEstablishedRTCSessionProtected(), r = [`${g.AVAILABLE_INCOMING_BITRATE}: ${e}`];
|
|
176
|
-
return n.sendInfo(
|
|
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
182
|
const s = this.getEstablishedRTCSessionProtected(), a = e === "mic" ? 0 : 1, c = [`${g.MEDIA_TYPE}: ${a}`];
|
|
183
|
-
return s.sendInfo(
|
|
183
|
+
return s.sendInfo($.REFUSAL, void 0, {
|
|
184
184
|
noTerminateWhenError: !0,
|
|
185
185
|
...n,
|
|
186
186
|
extraHeaders: c
|
|
@@ -193,33 +193,33 @@ class wn extends G {
|
|
|
193
193
|
return this.sendRefusalToTurnOn("cam", { noTerminateWhenError: !0, ...e });
|
|
194
194
|
}
|
|
195
195
|
async sendAvailableContentedStream() {
|
|
196
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
196
|
+
await this.getEstablishedRTCSessionProtected().sendInfo($.SHARE_STATE, void 0, {
|
|
197
197
|
extraHeaders: [K.AVAILABLE_CONTENTED_STREAM]
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
200
|
async askPermissionToStartPresentation() {
|
|
201
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
201
|
+
await this.getEstablishedRTCSessionProtected().sendInfo($.SHARE_STATE, void 0, {
|
|
202
202
|
extraHeaders: [K.ACK_PERMISSION_TO_START_PRESENTATION]
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
205
|
async sendStoppedPresentation() {
|
|
206
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
206
|
+
await this.getEstablishedRTCSessionProtected().sendInfo($.SHARE_STATE, void 0, {
|
|
207
207
|
extraHeaders: [K.STOPPED_CLIENT_PRESENTATION]
|
|
208
208
|
});
|
|
209
209
|
}
|
|
210
210
|
async sendNotAvailableContentedStream() {
|
|
211
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
211
|
+
await this.getEstablishedRTCSessionProtected().sendInfo($.SHARE_STATE, void 0, {
|
|
212
212
|
extraHeaders: [K.NOT_AVAILABLE_CONTENTED_STREAM]
|
|
213
213
|
});
|
|
214
214
|
}
|
|
215
215
|
async askPermissionToEnableCam(e = {}) {
|
|
216
216
|
const n = this.getEstablishedRTCSessionProtected(), s = [K.ENABLE_MAIN_CAM];
|
|
217
|
-
return n.sendInfo(
|
|
217
|
+
return n.sendInfo($.MAIN_CAM, void 0, {
|
|
218
218
|
noTerminateWhenError: !0,
|
|
219
219
|
...e,
|
|
220
220
|
extraHeaders: s
|
|
221
221
|
}).catch((r) => {
|
|
222
|
-
if (
|
|
222
|
+
if (bn(r))
|
|
223
223
|
throw r;
|
|
224
224
|
});
|
|
225
225
|
}
|
|
@@ -240,7 +240,7 @@ class wn extends G {
|
|
|
240
240
|
this.handleNotify(s);
|
|
241
241
|
}
|
|
242
242
|
} catch (n) {
|
|
243
|
-
|
|
243
|
+
Be("error parse notify", n);
|
|
244
244
|
}
|
|
245
245
|
};
|
|
246
246
|
handleNotify = (e) => {
|
|
@@ -290,7 +290,7 @@ class wn extends G {
|
|
|
290
290
|
break;
|
|
291
291
|
}
|
|
292
292
|
default:
|
|
293
|
-
|
|
293
|
+
Be("unknown cmd", e);
|
|
294
294
|
}
|
|
295
295
|
};
|
|
296
296
|
handleNewInfo = (e) => {
|
|
@@ -300,31 +300,31 @@ class wn extends G {
|
|
|
300
300
|
const { request: s } = e, r = s, i = y(r, g.CONTENT_TYPE);
|
|
301
301
|
if (i !== void 0)
|
|
302
302
|
switch (i) {
|
|
303
|
-
case
|
|
303
|
+
case V.ENTER_ROOM: {
|
|
304
304
|
this.triggerEnterRoom(r), this.maybeTriggerChannels(r);
|
|
305
305
|
break;
|
|
306
306
|
}
|
|
307
|
-
case
|
|
307
|
+
case V.NOTIFY: {
|
|
308
308
|
this.maybeHandleNotify(r);
|
|
309
309
|
break;
|
|
310
310
|
}
|
|
311
|
-
case
|
|
311
|
+
case V.SHARE_STATE: {
|
|
312
312
|
this.triggerContentedStreamState(r);
|
|
313
313
|
break;
|
|
314
314
|
}
|
|
315
|
-
case
|
|
315
|
+
case V.MAIN_CAM: {
|
|
316
316
|
this.triggerMainCamControl(r);
|
|
317
317
|
break;
|
|
318
318
|
}
|
|
319
|
-
case
|
|
319
|
+
case V.MIC: {
|
|
320
320
|
this.triggerMicControl(r);
|
|
321
321
|
break;
|
|
322
322
|
}
|
|
323
|
-
case
|
|
323
|
+
case V.USE_LICENSE: {
|
|
324
324
|
this.triggerUseLicense(r);
|
|
325
325
|
break;
|
|
326
326
|
}
|
|
327
|
-
case
|
|
327
|
+
case V.PARTICIPANT_STATE: {
|
|
328
328
|
this.maybeTriggerParticipantMoveRequest(r);
|
|
329
329
|
break;
|
|
330
330
|
}
|
|
@@ -412,7 +412,7 @@ class wn extends G {
|
|
|
412
412
|
participant: n,
|
|
413
413
|
jwt: s
|
|
414
414
|
};
|
|
415
|
-
|
|
415
|
+
Ln(r) && this.events.trigger(
|
|
416
416
|
"conference:participant-token-issued",
|
|
417
417
|
r
|
|
418
418
|
);
|
|
@@ -457,8 +457,8 @@ class wn extends G {
|
|
|
457
457
|
};
|
|
458
458
|
maybeTriggerParticipantMoveRequest = (e) => {
|
|
459
459
|
const n = y(e, g.CONTENT_PARTICIPANT_STATE), s = y(e, g.AUDIO_ID), r = y(e, g.SPECTATOR_MODE);
|
|
460
|
-
if (n ===
|
|
461
|
-
const i = r ===
|
|
460
|
+
if (n === ge.SPECTATOR) {
|
|
461
|
+
const i = r === ke.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,19 +473,19 @@ class wn extends G {
|
|
|
473
473
|
audioId: s
|
|
474
474
|
}));
|
|
475
475
|
}
|
|
476
|
-
n ===
|
|
476
|
+
n === ge.PARTICIPANT && this.events.trigger("participant:move-request-to-participants");
|
|
477
477
|
};
|
|
478
478
|
triggerMainCamControl = (e) => {
|
|
479
|
-
const n = y(e, g.MAIN_CAM), s = y(e, g.MEDIA_SYNC), r = s ===
|
|
480
|
-
if (n ===
|
|
479
|
+
const n = y(e, g.MAIN_CAM), s = y(e, g.MEDIA_SYNC), r = s === me.ADMIN_SYNC_FORCED;
|
|
480
|
+
if (n === F.ADMIN_START_MAIN_CAM) {
|
|
481
481
|
this.events.trigger("admin:start-main-cam", { isSyncForced: r });
|
|
482
482
|
return;
|
|
483
483
|
}
|
|
484
|
-
if (n ===
|
|
484
|
+
if (n === F.ADMIN_STOP_MAIN_CAM) {
|
|
485
485
|
this.events.trigger("admin:stop-main-cam", { isSyncForced: r });
|
|
486
486
|
return;
|
|
487
487
|
}
|
|
488
|
-
(n ===
|
|
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
489
|
const i = y(e, g.MAIN_CAM_RESOLUTION);
|
|
490
490
|
this.events.trigger("main-cam-control", {
|
|
491
491
|
mainCam: n,
|
|
@@ -493,22 +493,22 @@ class wn extends G {
|
|
|
493
493
|
});
|
|
494
494
|
};
|
|
495
495
|
triggerMicControl = (e) => {
|
|
496
|
-
const n = y(e, g.MIC), r = y(e, g.MEDIA_SYNC) ===
|
|
497
|
-
n ===
|
|
496
|
+
const n = y(e, g.MIC), r = y(e, g.MEDIA_SYNC) === me.ADMIN_SYNC_FORCED;
|
|
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
500
|
const n = y(e, g.CONTENT_USE_LICENSE);
|
|
501
501
|
n !== void 0 && this.events.trigger("use-license", n);
|
|
502
502
|
};
|
|
503
503
|
async sendEnterRoomProtected(e) {
|
|
504
|
-
return this.getEstablishedRTCSessionProtected().sendInfo(
|
|
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 $e = 0, Fn = 30;
|
|
508
|
+
class Bn {
|
|
509
|
+
countInner = $e;
|
|
510
|
+
initialCount = $e;
|
|
511
|
+
limitInner = Fn;
|
|
512
512
|
isInProgress = !1;
|
|
513
513
|
onStatusChange;
|
|
514
514
|
constructor({
|
|
@@ -541,7 +541,7 @@ class kn {
|
|
|
541
541
|
this.countInner = this.initialCount, this.finishAttempt();
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
|
-
class
|
|
544
|
+
class $n {
|
|
545
545
|
connectionManager;
|
|
546
546
|
interval;
|
|
547
547
|
checkTelephonyByTimeout = void 0;
|
|
@@ -556,7 +556,7 @@ class Un {
|
|
|
556
556
|
onSuccessRequest: n,
|
|
557
557
|
onFailRequest: s
|
|
558
558
|
}) {
|
|
559
|
-
this.stop(), this.cancelableGetParameters = new
|
|
559
|
+
this.stop(), this.cancelableGetParameters = new pe(e), this.checkTelephonyByTimeout = mn({
|
|
560
560
|
isDontStopOnFail: !0,
|
|
561
561
|
requestInterval: this.interval,
|
|
562
562
|
request: async () => {
|
|
@@ -576,7 +576,7 @@ class Un {
|
|
|
576
576
|
this.checkTelephonyByTimeout?.stop(), this.checkTelephonyByTimeout = void 0, this.cancelableGetParameters?.cancelRequest(), this.cancelableGetParameters = void 0;
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
|
-
class
|
|
579
|
+
class pt {
|
|
580
580
|
callManager;
|
|
581
581
|
disposers = [];
|
|
582
582
|
constructor({ callManager: e }) {
|
|
@@ -601,41 +601,41 @@ class St {
|
|
|
601
601
|
this.callManager.isCallActive ? e?.() : n();
|
|
602
602
|
}
|
|
603
603
|
}
|
|
604
|
-
const
|
|
605
|
-
class
|
|
604
|
+
const xn = 15e3, Vn = 2, Ne = A("PingServerRequester");
|
|
605
|
+
class qn {
|
|
606
606
|
connectionManager;
|
|
607
607
|
pingServerByTimeoutWithFailCalls;
|
|
608
608
|
constructor({ connectionManager: e }) {
|
|
609
|
-
this.connectionManager = e, this.pingServerByTimeoutWithFailCalls =
|
|
609
|
+
this.connectionManager = e, this.pingServerByTimeoutWithFailCalls = Sn(Vn, {
|
|
610
610
|
whenPossibleRequest: async () => {
|
|
611
611
|
},
|
|
612
|
-
requestInterval:
|
|
613
|
-
request: async () => (
|
|
614
|
-
|
|
612
|
+
requestInterval: xn,
|
|
613
|
+
request: async () => (Ne("ping"), this.connectionManager.ping().then(() => {
|
|
614
|
+
Ne("ping success");
|
|
615
615
|
}))
|
|
616
616
|
});
|
|
617
617
|
}
|
|
618
618
|
start({ onFailRequest: e }) {
|
|
619
|
-
this.pingServerByTimeoutWithFailCalls.start(void 0, { onFailRequest: e }).catch(
|
|
619
|
+
this.pingServerByTimeoutWithFailCalls.start(void 0, { onFailRequest: e }).catch(Ne);
|
|
620
620
|
}
|
|
621
621
|
stop() {
|
|
622
622
|
this.pingServerByTimeoutWithFailCalls.stop();
|
|
623
623
|
}
|
|
624
624
|
}
|
|
625
|
-
const
|
|
626
|
-
class
|
|
625
|
+
const xe = A("PingServerIfNotActiveCallRequester");
|
|
626
|
+
class Hn {
|
|
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 qn({
|
|
634
634
|
connectionManager: e
|
|
635
|
-
}), this.notActiveCallSubscriber = new
|
|
635
|
+
}), this.notActiveCallSubscriber = new pt({ callManager: n });
|
|
636
636
|
}
|
|
637
637
|
start({ onFailRequest: e }) {
|
|
638
|
-
|
|
638
|
+
xe("start"), this.notActiveCallSubscriber.subscribe({
|
|
639
639
|
onActive: () => {
|
|
640
640
|
this.pingServerRequester.stop();
|
|
641
641
|
},
|
|
@@ -645,13 +645,13 @@ class xn {
|
|
|
645
645
|
});
|
|
646
646
|
}
|
|
647
647
|
stop() {
|
|
648
|
-
|
|
648
|
+
xe("stop"), this.pingServerRequester.stop(), this.unsubscribeCallStatusChange();
|
|
649
649
|
}
|
|
650
650
|
unsubscribeCallStatusChange() {
|
|
651
651
|
this.notActiveCallSubscriber.unsubscribe();
|
|
652
652
|
}
|
|
653
653
|
}
|
|
654
|
-
class
|
|
654
|
+
class Wn {
|
|
655
655
|
connectionManager;
|
|
656
656
|
isRegistrationFailed = !1;
|
|
657
657
|
disposers = [];
|
|
@@ -660,7 +660,7 @@ class Vn {
|
|
|
660
660
|
connectionManager: e,
|
|
661
661
|
callManager: n
|
|
662
662
|
}) {
|
|
663
|
-
this.connectionManager = e, this.notActiveCallSubscriber = new
|
|
663
|
+
this.connectionManager = e, this.notActiveCallSubscriber = new pt({ callManager: n });
|
|
664
664
|
}
|
|
665
665
|
subscribe(e) {
|
|
666
666
|
this.unsubscribe(), this.disposers.push(
|
|
@@ -687,30 +687,30 @@ class Vn {
|
|
|
687
687
|
this.isRegistrationFailed = !1;
|
|
688
688
|
}
|
|
689
689
|
}
|
|
690
|
-
const
|
|
690
|
+
const Qn = {
|
|
691
691
|
baseRetryDelayMs: 1e3,
|
|
692
692
|
maxRetryDelayMs: 3e4,
|
|
693
693
|
warningThreshold: 3,
|
|
694
694
|
criticalThreshold: 5
|
|
695
|
-
},
|
|
695
|
+
}, Ve = {
|
|
696
696
|
none: 0,
|
|
697
697
|
warning: 1,
|
|
698
698
|
critical: 2
|
|
699
699
|
};
|
|
700
|
-
class
|
|
700
|
+
class Yn {
|
|
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
|
+
...Qn,
|
|
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 = Ve[e] > Ve[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 Hn {
|
|
|
743
743
|
);
|
|
744
744
|
}
|
|
745
745
|
}
|
|
746
|
-
const k = A("AutoConnectorRuntime"),
|
|
747
|
-
class
|
|
746
|
+
const k = A("AutoConnectorRuntime"), jn = 3e3, zn = 15e3;
|
|
747
|
+
class Jn {
|
|
748
748
|
connectionManager;
|
|
749
749
|
connectionQueueManager;
|
|
750
750
|
checkTelephonyRequester;
|
|
@@ -756,18 +756,18 @@ class Yn {
|
|
|
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 $n({
|
|
760
760
|
connectionManager: this.connectionManager,
|
|
761
|
-
interval: e.options?.checkTelephonyRequestInterval ??
|
|
762
|
-
}), this.pingServerIfNotActiveCallRequester = new
|
|
761
|
+
interval: e.options?.checkTelephonyRequestInterval ?? zn
|
|
762
|
+
}), this.pingServerIfNotActiveCallRequester = new Hn({
|
|
763
763
|
connectionManager: this.connectionManager,
|
|
764
764
|
callManager: e.callManager
|
|
765
|
-
}), this.registrationFailedOutOfCallSubscriber = new
|
|
765
|
+
}), this.registrationFailedOutOfCallSubscriber = new Wn({
|
|
766
766
|
connectionManager: this.connectionManager,
|
|
767
767
|
callManager: e.callManager
|
|
768
|
-
}), this.delayBetweenAttempts = new
|
|
769
|
-
e.options?.timeoutBetweenAttempts ??
|
|
770
|
-
), this.telephonyFailPolicy = new
|
|
768
|
+
}), this.delayBetweenAttempts = new Cn(
|
|
769
|
+
e.options?.timeoutBetweenAttempts ?? jn
|
|
770
|
+
), this.telephonyFailPolicy = new Yn(e.options?.telephonyFailPolicy), this.attemptsState = new Bn({
|
|
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 = Rn(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 Rt = "Not ready for connection", Kn = (t) => t instanceof Error && t.message === Rt, Xn = () => new Error(Rt), Zn = async (t) => typeof t == "function" ? t() : t, es = 3;
|
|
918
|
+
class ts {
|
|
919
|
+
resolveParametersRequester = new pe(Zn);
|
|
920
920
|
cancelableConnectWithRepeatedCalls;
|
|
921
921
|
numberOfConnectionAttempts;
|
|
922
922
|
dependencies;
|
|
923
923
|
constructor(e, {
|
|
924
|
-
numberOfConnectionAttempts: n =
|
|
924
|
+
numberOfConnectionAttempts: n = es
|
|
925
925
|
} = {}) {
|
|
926
926
|
this.dependencies = e, this.numberOfConnectionAttempts = n, this.proxyEvents();
|
|
927
927
|
}
|
|
@@ -931,7 +931,7 @@ class Xn {
|
|
|
931
931
|
...s
|
|
932
932
|
}), s)).catch((s) => {
|
|
933
933
|
const r = s ?? new Error("Failed to connect to server");
|
|
934
|
-
throw
|
|
934
|
+
throw ut(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 Xn {
|
|
|
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), E = i != null && !
|
|
952
|
+
const c = this.dependencies.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), E = i != null && !On(i);
|
|
953
953
|
return c || E;
|
|
954
954
|
};
|
|
955
|
-
return this.cancelableConnectWithRepeatedCalls =
|
|
955
|
+
return this.cancelableConnectWithRepeatedCalls = we({
|
|
956
956
|
targetFunction: s,
|
|
957
957
|
isComplete: r,
|
|
958
958
|
callLimit: n,
|
|
@@ -985,7 +985,7 @@ class Xn {
|
|
|
985
985
|
extraHeaders: _ = []
|
|
986
986
|
}) => {
|
|
987
987
|
this.dependencies.getUa() && await this.disconnect({ cancelRequests: !1 });
|
|
988
|
-
const { ua:
|
|
988
|
+
const { ua: L, helpers: z } = this.dependencies.uaFactory.createUAWithConfiguration(
|
|
989
989
|
{
|
|
990
990
|
user: e,
|
|
991
991
|
password: n,
|
|
@@ -1003,9 +1003,9 @@ class Xn {
|
|
|
1003
1003
|
},
|
|
1004
1004
|
this.dependencies.events
|
|
1005
1005
|
);
|
|
1006
|
-
this.dependencies.setUa(
|
|
1007
|
-
const te =
|
|
1008
|
-
return { ua:
|
|
1006
|
+
this.dependencies.setUa(L), this.dependencies.setGetUri(z.getUri), this.dependencies.setSocket(z.socket);
|
|
1007
|
+
const te = L.configuration.uri.user;
|
|
1008
|
+
return { ua: L, configuration: {
|
|
1009
1009
|
sipServerIp: s,
|
|
1010
1010
|
sipServerUrl: r,
|
|
1011
1011
|
displayName: I,
|
|
@@ -1050,11 +1050,11 @@ class Xn {
|
|
|
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 Nt = {
|
|
1054
1054
|
connectionConfiguration: void 0
|
|
1055
|
-
},
|
|
1055
|
+
}, qe = A("ConnectionStateMachine"), ns = () => Z({
|
|
1056
1056
|
types: {
|
|
1057
|
-
context:
|
|
1057
|
+
context: Nt,
|
|
1058
1058
|
events: {}
|
|
1059
1059
|
},
|
|
1060
1060
|
guards: {
|
|
@@ -1068,16 +1068,16 @@ const pt = {
|
|
|
1068
1068
|
connectionConfiguration: void 0
|
|
1069
1069
|
})),
|
|
1070
1070
|
[N.LOG_TRANSITION]: (t, e) => {
|
|
1071
|
-
|
|
1071
|
+
qe(`State transition: ${e.from} -> ${e.to} (${e.event})`);
|
|
1072
1072
|
},
|
|
1073
1073
|
[N.LOG_STATE_CHANGE]: (t, e) => {
|
|
1074
|
-
|
|
1074
|
+
qe("ConnectionStateMachine state changed", e.state);
|
|
1075
1075
|
}
|
|
1076
1076
|
}
|
|
1077
|
-
}),
|
|
1077
|
+
}), ss = () => ns().createMachine({
|
|
1078
1078
|
id: "connection",
|
|
1079
1079
|
initial: d.IDLE,
|
|
1080
|
-
context:
|
|
1080
|
+
context: Nt,
|
|
1081
1081
|
states: {
|
|
1082
1082
|
[d.IDLE]: {
|
|
1083
1083
|
entry: [
|
|
@@ -1397,12 +1397,12 @@ const pt = {
|
|
|
1397
1397
|
}
|
|
1398
1398
|
}
|
|
1399
1399
|
}
|
|
1400
|
-
}),
|
|
1401
|
-
class
|
|
1400
|
+
}), rs = ss(), is = A("ConnectionStateMachine");
|
|
1401
|
+
class as extends ee {
|
|
1402
1402
|
events;
|
|
1403
1403
|
unsubscribeFromEvents;
|
|
1404
1404
|
constructor(e) {
|
|
1405
|
-
super(
|
|
1405
|
+
super(rs), this.events = e, this.subscribeToEvents();
|
|
1406
1406
|
}
|
|
1407
1407
|
get isIdle() {
|
|
1408
1408
|
return this.hasState(d.IDLE);
|
|
@@ -1464,7 +1464,7 @@ class ss extends ee {
|
|
|
1464
1464
|
}
|
|
1465
1465
|
sendEvent(e) {
|
|
1466
1466
|
if (!this.actor.getSnapshot().can(e)) {
|
|
1467
|
-
|
|
1467
|
+
is(
|
|
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 ss extends ee {
|
|
|
1498
1498
|
};
|
|
1499
1499
|
}
|
|
1500
1500
|
}
|
|
1501
|
-
const
|
|
1501
|
+
const It = [
|
|
1502
1502
|
"connecting",
|
|
1503
1503
|
"connected",
|
|
1504
1504
|
"disconnected",
|
|
@@ -1508,7 +1508,7 @@ const Rt = [
|
|
|
1508
1508
|
"registrationFailed",
|
|
1509
1509
|
"newMessage",
|
|
1510
1510
|
"sipEvent"
|
|
1511
|
-
],
|
|
1511
|
+
], os = [
|
|
1512
1512
|
"disconnecting",
|
|
1513
1513
|
"connect-started",
|
|
1514
1514
|
"connect-succeeded",
|
|
@@ -1516,8 +1516,8 @@ const Rt = [
|
|
|
1516
1516
|
"connect-parameters-resolve-success",
|
|
1517
1517
|
"connect-parameters-resolve-failed",
|
|
1518
1518
|
"connected-with-configuration"
|
|
1519
|
-
],
|
|
1520
|
-
class
|
|
1519
|
+
], At = [...It, ...os], cs = () => new G(At), ds = A("RegistrationManager");
|
|
1520
|
+
class ls {
|
|
1521
1521
|
events;
|
|
1522
1522
|
getUaProtected;
|
|
1523
1523
|
constructor(e) {
|
|
@@ -1539,7 +1539,7 @@ class os {
|
|
|
1539
1539
|
try {
|
|
1540
1540
|
await this.unregister();
|
|
1541
1541
|
} catch (e) {
|
|
1542
|
-
|
|
1542
|
+
ds("tryRegister", e);
|
|
1543
1543
|
}
|
|
1544
1544
|
return this.register();
|
|
1545
1545
|
}
|
|
@@ -1554,7 +1554,7 @@ class os {
|
|
|
1554
1554
|
};
|
|
1555
1555
|
}
|
|
1556
1556
|
}
|
|
1557
|
-
class
|
|
1557
|
+
class hs {
|
|
1558
1558
|
uaFactory;
|
|
1559
1559
|
getUaProtected;
|
|
1560
1560
|
constructor(e) {
|
|
@@ -1619,10 +1619,10 @@ class cs {
|
|
|
1619
1619
|
});
|
|
1620
1620
|
}
|
|
1621
1621
|
}
|
|
1622
|
-
function
|
|
1622
|
+
function us(t) {
|
|
1623
1623
|
return (e) => `sip:${e}@${t}`;
|
|
1624
1624
|
}
|
|
1625
|
-
const
|
|
1625
|
+
const Es = (t, e) => () => Math.floor(Math.random() * (e - t)) + t, gs = (t) => t.trim().replaceAll(" ", "_"), Ts = Es(1e5, 99999999), ms = (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() : `${Ts()}`;
|
|
1655
1655
|
}
|
|
1656
1656
|
static buildExtraHeaders(e, n) {
|
|
1657
|
-
const s = e !== void 0 && e !== "" ?
|
|
1657
|
+
const s = e !== void 0 && e !== "" ? ms(e) : [];
|
|
1658
1658
|
return n === void 0 ? s : [...s, ...n];
|
|
1659
1659
|
}
|
|
1660
1660
|
createConfiguration({
|
|
@@ -1678,23 +1678,23 @@ 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), _ = us(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: gs(r),
|
|
1688
1688
|
user_agent: I,
|
|
1689
1689
|
sdpSemantics: "unified-plan",
|
|
1690
|
-
sockets: [
|
|
1690
|
+
sockets: [L],
|
|
1691
1691
|
session_timers: o,
|
|
1692
1692
|
register_expires: c,
|
|
1693
1693
|
connection_recovery_min_interval: E,
|
|
1694
1694
|
connection_recovery_max_interval: p
|
|
1695
1695
|
},
|
|
1696
1696
|
helpers: {
|
|
1697
|
-
socket:
|
|
1697
|
+
socket: L,
|
|
1698
1698
|
getUri: _
|
|
1699
1699
|
}
|
|
1700
1700
|
};
|
|
@@ -1713,13 +1713,13 @@ class X {
|
|
|
1713
1713
|
extraHeaders: e.extraHeaders
|
|
1714
1714
|
});
|
|
1715
1715
|
return n.eachTriggers((a, o) => {
|
|
1716
|
-
const c =
|
|
1716
|
+
const c = It.find((E) => E === o);
|
|
1717
1717
|
c && i.on(c, a);
|
|
1718
1718
|
}), { ua: i, helpers: r };
|
|
1719
1719
|
}
|
|
1720
1720
|
}
|
|
1721
|
-
const
|
|
1722
|
-
class
|
|
1721
|
+
const Ss = A("ConnectionManager");
|
|
1722
|
+
class Cs extends w {
|
|
1723
1723
|
stateMachine;
|
|
1724
1724
|
ua;
|
|
1725
1725
|
socket;
|
|
@@ -1730,13 +1730,13 @@ class Ts extends G {
|
|
|
1730
1730
|
constructor({ JsSIP: e }, {
|
|
1731
1731
|
numberOfConnectionAttempts: n
|
|
1732
1732
|
} = {}) {
|
|
1733
|
-
super(
|
|
1733
|
+
super(cs()), this.uaFactory = new X(e), this.registrationManager = new ls({
|
|
1734
1734
|
events: this.events,
|
|
1735
1735
|
getUaProtected: this.getUaProtected
|
|
1736
|
-
}), this.stateMachine = new
|
|
1736
|
+
}), this.stateMachine = new as(this.events), this.sipOperations = new hs({
|
|
1737
1737
|
uaFactory: this.uaFactory,
|
|
1738
1738
|
getUaProtected: this.getUaProtected
|
|
1739
|
-
}), this.connectionFlow = new
|
|
1739
|
+
}), this.connectionFlow = new ts(
|
|
1740
1740
|
{
|
|
1741
1741
|
events: this.events,
|
|
1742
1742
|
uaFactory: this.uaFactory,
|
|
@@ -1784,7 +1784,7 @@ class Ts extends G {
|
|
|
1784
1784
|
return this.stateMachine.isRegisterEnabled();
|
|
1785
1785
|
}
|
|
1786
1786
|
connect = async (e, n) => this.disconnect().catch((s) => {
|
|
1787
|
-
|
|
1787
|
+
Ss("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 Ts extends G {
|
|
|
1824
1824
|
getUa = () => this.ua;
|
|
1825
1825
|
connectWithProcessError = async (e, n) => {
|
|
1826
1826
|
if (!(n?.hasReadyForConnection?.() ?? !0))
|
|
1827
|
-
throw
|
|
1827
|
+
throw Xn();
|
|
1828
1828
|
return this.connectionFlow.connect(e, n).catch(async (r) => {
|
|
1829
1829
|
const i = r;
|
|
1830
1830
|
return this.disconnect().then(() => {
|
|
@@ -1835,9 +1835,9 @@ class Ts extends G {
|
|
|
1835
1835
|
});
|
|
1836
1836
|
};
|
|
1837
1837
|
}
|
|
1838
|
-
class
|
|
1838
|
+
class ps {
|
|
1839
1839
|
connectionManager;
|
|
1840
|
-
stackPromises =
|
|
1840
|
+
stackPromises = Et({
|
|
1841
1841
|
noRunIsNotActual: !0
|
|
1842
1842
|
});
|
|
1843
1843
|
constructor({ connectionManager: e }) {
|
|
@@ -1852,7 +1852,7 @@ class ms {
|
|
|
1852
1852
|
const Y = (t) => {
|
|
1853
1853
|
if (t !== null && typeof t == "object" && "error" in t)
|
|
1854
1854
|
return t.error;
|
|
1855
|
-
},
|
|
1855
|
+
}, O = A("AutoConnectorMachine"), He = (t) => t.parameters, Rs = (t) => Z({
|
|
1856
1856
|
types: {
|
|
1857
1857
|
context: {},
|
|
1858
1858
|
events: {}
|
|
@@ -1860,18 +1860,18 @@ const Y = (t) => {
|
|
|
1860
1860
|
/** Асинхронные шаги: остановка флоу, коннект, задержка + beforeRetry. */
|
|
1861
1861
|
actors: {
|
|
1862
1862
|
/** Invoke при входе в `disconnecting`: единый «срез» текущего подключения. */
|
|
1863
|
-
stopConnectionFlow:
|
|
1864
|
-
|
|
1863
|
+
stopConnectionFlow: Re(async () => {
|
|
1864
|
+
O("stopConnectionFlow"), await t.stopConnectionFlow();
|
|
1865
1865
|
}),
|
|
1866
1866
|
/** Invoke в `attemptingConnect`: реальный SIP/WebSocket connect. */
|
|
1867
|
-
connect:
|
|
1868
|
-
if (
|
|
1867
|
+
connect: Re(async ({ input: e }) => {
|
|
1868
|
+
if (O("connect", e), !e)
|
|
1869
1869
|
throw new Error("Auto connector parameters are missing in attemptingConnect state");
|
|
1870
1870
|
await t.connect(e);
|
|
1871
1871
|
}),
|
|
1872
1872
|
/** Invoke в `waitingBeforeRetry`: сначала задержка между попытками. */
|
|
1873
|
-
waitBeforeRetry:
|
|
1874
|
-
|
|
1873
|
+
waitBeforeRetry: Re(async () => {
|
|
1874
|
+
O("waitBeforeRetry"), await t.delayBetweenAttempts();
|
|
1875
1875
|
})
|
|
1876
1876
|
},
|
|
1877
1877
|
/** Условия переходов после `disconnect`, классификация ошибок `connect` и ретрая. */
|
|
@@ -1879,49 +1879,49 @@ const Y = (t) => {
|
|
|
1879
1879
|
/** Нужен ли промежуточный `disconnecting` перед новым циклом попытки. */
|
|
1880
1880
|
shouldDisconnectBeforeAttempt: () => {
|
|
1881
1881
|
const e = t.shouldDisconnectBeforeAttempt();
|
|
1882
|
-
return
|
|
1882
|
+
return O("shouldDisconnectBeforeAttempt:", e), e;
|
|
1883
1883
|
},
|
|
1884
1884
|
/** После `stopConnectionFlow` уходим в `idle` (полная остановка / ошибка остановки). */
|
|
1885
1885
|
shouldGoIdleAfterDisconnect: ({ context: e }) => {
|
|
1886
1886
|
const n = e.afterDisconnect === "idle";
|
|
1887
|
-
return
|
|
1887
|
+
return O("shouldGoIdleAfterDisconnect:", n), n;
|
|
1888
1888
|
},
|
|
1889
1889
|
/** После `stopConnectionFlow` продолжаем цикл: к шлюзу попытки. */
|
|
1890
1890
|
shouldAttemptAfterDisconnect: ({ context: e }) => {
|
|
1891
1891
|
const n = e.afterDisconnect === "attempt";
|
|
1892
|
-
return
|
|
1892
|
+
return O("shouldAttemptAfterDisconnect:", n), n;
|
|
1893
1893
|
},
|
|
1894
1894
|
/** Лимит попыток исчерпан — переход к режиму check-telephony. */
|
|
1895
1895
|
isLimitReached: () => {
|
|
1896
1896
|
const e = t.hasLimitReached();
|
|
1897
|
-
return
|
|
1897
|
+
return O("isLimitReached:", e), e;
|
|
1898
1898
|
},
|
|
1899
1899
|
/** Ошибка «ещё не готовы к подключению» — без ретрая. */
|
|
1900
1900
|
isNotReadyForConnection: ({ event: e }) => {
|
|
1901
|
-
const n =
|
|
1902
|
-
return
|
|
1901
|
+
const n = Kn(Y(e));
|
|
1902
|
+
return O("isNotReadyForConnection:", n), n;
|
|
1903
1903
|
},
|
|
1904
1904
|
/** Политика опций запрещает повтор для этой ошибки. */
|
|
1905
1905
|
isNoRetryPolicy: ({ event: e }) => {
|
|
1906
1906
|
const n = !t.canRetryOnError(Y(e));
|
|
1907
|
-
return
|
|
1907
|
+
return O("isNoRetryPolicy:", n), n;
|
|
1908
1908
|
},
|
|
1909
1909
|
/** Промис коннекта снят очередью (`stack-promises`) — отмена попыток. */
|
|
1910
1910
|
isNotActualPromise: ({ event: e }) => {
|
|
1911
|
-
const n =
|
|
1912
|
-
return
|
|
1911
|
+
const n = gt(Y(e));
|
|
1912
|
+
return O("isNotActualPromise:", n), n;
|
|
1913
1913
|
},
|
|
1914
1914
|
/** Отмена задержки (cancelable / timeout-requester). */
|
|
1915
1915
|
isWaitRetryCancelled: ({ event: e }) => {
|
|
1916
|
-
const n = Y(e), s =
|
|
1917
|
-
return
|
|
1916
|
+
const n = Y(e), s = ut(n) || pn(n);
|
|
1917
|
+
return O("isWaitRetryCancelled:", s), s;
|
|
1918
1918
|
}
|
|
1919
1919
|
},
|
|
1920
1920
|
/** Синхронные побочные эффекты и обновление контекста (`assign`). */
|
|
1921
1921
|
actions: {
|
|
1922
1922
|
/** Лог при падении invoke `stopConnectionFlow` при рестарте. */
|
|
1923
1923
|
logRestartFailed: ({ event: e }) => {
|
|
1924
|
-
|
|
1924
|
+
O("auto connector failed to restart connection attempts:", Y(e));
|
|
1925
1925
|
},
|
|
1926
1926
|
/** Сохранить параметры подключения и намерение продолжить попытки после `disconnect`. */
|
|
1927
1927
|
assignRestart: f(({ event: e }) => ({
|
|
@@ -1940,46 +1940,46 @@ const Y = (t) => {
|
|
|
1940
1940
|
}),
|
|
1941
1941
|
/** Начало цикла попытки: событие «перед попыткой» и сброс внешних триггеров. */
|
|
1942
1942
|
entryAttemptingGate: () => {
|
|
1943
|
-
|
|
1943
|
+
O("entryAttemptingGate"), t.beforeAttempt();
|
|
1944
1944
|
},
|
|
1945
1945
|
/** Учёт попытки в `AttemptsState` непосредственно перед `connect`. */
|
|
1946
1946
|
entryAttemptingConnect: () => {
|
|
1947
|
-
|
|
1947
|
+
O("entryAttemptingConnect"), t.beforeConnectAttempt();
|
|
1948
1948
|
},
|
|
1949
1949
|
/** Лимит: завершить попытку, событие лимита, запуск опроса телефонии. */
|
|
1950
1950
|
onLimitReachedTransition: ({ context: e }) => {
|
|
1951
|
-
|
|
1951
|
+
O("onLimitReachedTransition"), t.onLimitReached(He(e));
|
|
1952
1952
|
},
|
|
1953
1953
|
/** Успешный invoke `connect`. */
|
|
1954
1954
|
onConnectDone: ({ context: e }) => {
|
|
1955
|
-
|
|
1955
|
+
O("onConnectDone"), t.onConnectSucceeded(He(e));
|
|
1956
1956
|
},
|
|
1957
1957
|
assignHaltedError: f({
|
|
1958
1958
|
stopReason: () => "halted",
|
|
1959
1959
|
lastError: ({ event: e }) => {
|
|
1960
1960
|
const n = Y(e);
|
|
1961
|
-
return
|
|
1961
|
+
return O("assignHaltedError", n), n;
|
|
1962
1962
|
}
|
|
1963
1963
|
}),
|
|
1964
1964
|
assignCancelledNotActualError: f({
|
|
1965
1965
|
stopReason: () => "cancelled",
|
|
1966
1966
|
lastError: ({ event: e }) => {
|
|
1967
1967
|
const n = Y(e);
|
|
1968
|
-
return
|
|
1968
|
+
return O("assignCancelledNotActualError", n), n;
|
|
1969
1969
|
}
|
|
1970
1970
|
}),
|
|
1971
1971
|
assignWaitRetryCancelledError: f({
|
|
1972
1972
|
stopReason: () => "cancelled",
|
|
1973
1973
|
lastError: ({ event: e }) => {
|
|
1974
1974
|
const n = Y(e);
|
|
1975
|
-
return
|
|
1975
|
+
return O("assignWaitRetryCancelledError", n), n;
|
|
1976
1976
|
}
|
|
1977
1977
|
}),
|
|
1978
1978
|
assignWaitRetryFailedError: f({
|
|
1979
1979
|
stopReason: () => "failed",
|
|
1980
1980
|
lastError: ({ event: e }) => {
|
|
1981
1981
|
const n = Y(e);
|
|
1982
|
-
return
|
|
1982
|
+
return O("assignWaitRetryFailedError", n), n;
|
|
1983
1983
|
}
|
|
1984
1984
|
}),
|
|
1985
1985
|
/**
|
|
@@ -1987,7 +1987,7 @@ const Y = (t) => {
|
|
|
1987
1987
|
* Так машина хранит одну терминальную вершину, но не теряет различие причин остановки.
|
|
1988
1988
|
*/
|
|
1989
1989
|
emitTerminalOutcome: ({ context: e }) => {
|
|
1990
|
-
|
|
1990
|
+
O("emitTerminalOutcome"), t.emitTerminalOutcome({
|
|
1991
1991
|
stopReason: e.stopReason,
|
|
1992
1992
|
lastError: e.lastError
|
|
1993
1993
|
});
|
|
@@ -1998,44 +1998,44 @@ const Y = (t) => {
|
|
|
1998
1998
|
* без нового вызова `connect`.
|
|
1999
1999
|
*/
|
|
2000
2000
|
onTelephonyStillConnected: () => {
|
|
2001
|
-
|
|
2001
|
+
O("onTelephonyStillConnected"), t.onTelephonyStillConnected();
|
|
2002
2002
|
}
|
|
2003
2003
|
}
|
|
2004
2004
|
});
|
|
2005
|
-
var
|
|
2006
|
-
const
|
|
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 Ns = () => ({
|
|
2007
2007
|
parameters: void 0,
|
|
2008
2008
|
afterDisconnect: "idle",
|
|
2009
2009
|
stopReason: void 0,
|
|
2010
2010
|
lastError: void 0
|
|
2011
2011
|
}), ne = () => ({
|
|
2012
2012
|
"AUTO.STOP": {
|
|
2013
|
-
target:
|
|
2013
|
+
target: M.DISCONNECTING,
|
|
2014
2014
|
actions: "assignStop"
|
|
2015
2015
|
},
|
|
2016
2016
|
"AUTO.RESTART": {
|
|
2017
|
-
target:
|
|
2017
|
+
target: M.DISCONNECTING,
|
|
2018
2018
|
actions: "assignRestart"
|
|
2019
2019
|
}
|
|
2020
|
-
}),
|
|
2020
|
+
}), Is = (t) => Rs(t).createMachine({
|
|
2021
2021
|
id: "autoConnector",
|
|
2022
|
-
initial:
|
|
2023
|
-
context:
|
|
2022
|
+
initial: M.IDLE,
|
|
2023
|
+
context: Ns,
|
|
2024
2024
|
states: {
|
|
2025
2025
|
/** Ожидание: допустимы рестарт флоу или внешний стоп без побочных эффектов. */
|
|
2026
|
-
[
|
|
2026
|
+
[M.IDLE]: {
|
|
2027
2027
|
on: {
|
|
2028
2028
|
"AUTO.STOP": {
|
|
2029
|
-
target:
|
|
2029
|
+
target: M.IDLE
|
|
2030
2030
|
},
|
|
2031
2031
|
"AUTO.RESTART": [
|
|
2032
2032
|
{
|
|
2033
2033
|
guard: "shouldDisconnectBeforeAttempt",
|
|
2034
|
-
target:
|
|
2034
|
+
target: M.DISCONNECTING,
|
|
2035
2035
|
actions: "assignRestart"
|
|
2036
2036
|
},
|
|
2037
2037
|
{
|
|
2038
|
-
target:
|
|
2038
|
+
target: M.ATTEMPTING_GATE,
|
|
2039
2039
|
actions: "assignRestart"
|
|
2040
2040
|
}
|
|
2041
2041
|
]
|
|
@@ -2045,7 +2045,7 @@ const Cs = () => ({
|
|
|
2045
2045
|
* Безопасная остановка: invoke `stopConnectionFlow`.
|
|
2046
2046
|
* Повторный `AUTO.STOP` с `reenter` перезапускает invoke (например сеть недоступна до `success`).
|
|
2047
2047
|
*/
|
|
2048
|
-
[
|
|
2048
|
+
[M.DISCONNECTING]: {
|
|
2049
2049
|
invoke: {
|
|
2050
2050
|
// `id` — имя (identity) конкретного invoke внутри этого состояния.
|
|
2051
2051
|
// Полезно для отладки, трейсинга и invoke-событий вида `xstate.done.actor.<id>`.
|
|
@@ -2061,21 +2061,21 @@ const Cs = () => ({
|
|
|
2061
2061
|
onDone: [
|
|
2062
2062
|
{
|
|
2063
2063
|
guard: "shouldGoIdleAfterDisconnect",
|
|
2064
|
-
target:
|
|
2064
|
+
target: M.IDLE
|
|
2065
2065
|
},
|
|
2066
2066
|
{
|
|
2067
2067
|
guard: "shouldAttemptAfterDisconnect",
|
|
2068
|
-
target:
|
|
2068
|
+
target: M.ATTEMPTING_GATE
|
|
2069
2069
|
}
|
|
2070
2070
|
],
|
|
2071
2071
|
onError: {
|
|
2072
2072
|
actions: "logRestartFailed",
|
|
2073
|
-
target:
|
|
2073
|
+
target: M.IDLE
|
|
2074
2074
|
}
|
|
2075
2075
|
},
|
|
2076
2076
|
on: {
|
|
2077
2077
|
"AUTO.STOP": {
|
|
2078
|
-
target:
|
|
2078
|
+
target: M.DISCONNECTING,
|
|
2079
2079
|
// Принудительно пере-входим в то же состояние, чтобы заново запустить invoke `stopConnectionFlow`.
|
|
2080
2080
|
// Без `reenter: true` повторный STOP в текущем состоянии не перезапустил бы actor остановки.
|
|
2081
2081
|
reenter: !0,
|
|
@@ -2089,16 +2089,16 @@ const Cs = () => ({
|
|
|
2089
2089
|
/**
|
|
2090
2090
|
* Перед новой попыткой: событие `before-attempt` и сброс триггеров; ветвление по лимиту.
|
|
2091
2091
|
*/
|
|
2092
|
-
[
|
|
2092
|
+
[M.ATTEMPTING_GATE]: {
|
|
2093
2093
|
entry: "entryAttemptingGate",
|
|
2094
2094
|
always: [
|
|
2095
2095
|
{
|
|
2096
2096
|
guard: "isLimitReached",
|
|
2097
|
-
target:
|
|
2097
|
+
target: M.TELEPHONY_CHECKING,
|
|
2098
2098
|
actions: "onLimitReachedTransition"
|
|
2099
2099
|
},
|
|
2100
2100
|
{
|
|
2101
|
-
target:
|
|
2101
|
+
target: M.ATTEMPTING_CONNECT
|
|
2102
2102
|
}
|
|
2103
2103
|
],
|
|
2104
2104
|
on: ne()
|
|
@@ -2109,7 +2109,7 @@ const Cs = () => ({
|
|
|
2109
2109
|
* - promise is not actual -> терминальное состояние с `cancelled-attempts`;
|
|
2110
2110
|
* - всё остальное -> `waitingBeforeRetry`.
|
|
2111
2111
|
*/
|
|
2112
|
-
[
|
|
2112
|
+
[M.ATTEMPTING_CONNECT]: {
|
|
2113
2113
|
entry: "entryAttemptingConnect",
|
|
2114
2114
|
invoke: {
|
|
2115
2115
|
// `id` остаётся стабильным идентификатором этого invoke-блока в состоянии.
|
|
@@ -2119,7 +2119,7 @@ const Cs = () => ({
|
|
|
2119
2119
|
input: ({ context: e }) => e.parameters,
|
|
2120
2120
|
// `connect` завершился без ошибки -> считаем подключение установленным и переходим в мониторинг.
|
|
2121
2121
|
onDone: {
|
|
2122
|
-
target:
|
|
2122
|
+
target: M.CONNECTED_MONITORING,
|
|
2123
2123
|
actions: "onConnectDone"
|
|
2124
2124
|
},
|
|
2125
2125
|
/**
|
|
@@ -2147,7 +2147,7 @@ const Cs = () => ({
|
|
|
2147
2147
|
},
|
|
2148
2148
|
{
|
|
2149
2149
|
// 4) Все остальные ошибки считаем retryable и идём в backoff/ожидание.
|
|
2150
|
-
target:
|
|
2150
|
+
target: M.WAITING_BEFORE_RETRY
|
|
2151
2151
|
}
|
|
2152
2152
|
]
|
|
2153
2153
|
},
|
|
@@ -2158,7 +2158,7 @@ const Cs = () => ({
|
|
|
2158
2158
|
* Здесь различаем отмену управляемой цепочки (`cancelled-attempts`) и реальную
|
|
2159
2159
|
* фатальную ошибку подготовки ретрая (`failed-all-attempts`).
|
|
2160
2160
|
*/
|
|
2161
|
-
[
|
|
2161
|
+
[M.WAITING_BEFORE_RETRY]: {
|
|
2162
2162
|
invoke: {
|
|
2163
2163
|
// `id` для invoke шага ожидания перед retry.
|
|
2164
2164
|
id: "waitBeforeRetry",
|
|
@@ -2166,7 +2166,7 @@ const Cs = () => ({
|
|
|
2166
2166
|
src: "waitBeforeRetry",
|
|
2167
2167
|
// Успешно прошли delay -> возвращаемся к шлюзу следующей попытки.
|
|
2168
2168
|
onDone: {
|
|
2169
|
-
target:
|
|
2169
|
+
target: M.ATTEMPTING_GATE
|
|
2170
2170
|
},
|
|
2171
2171
|
/**
|
|
2172
2172
|
* Здесь тот же принцип: ветки `onError` проверяются сверху вниз,
|
|
@@ -2189,25 +2189,25 @@ const Cs = () => ({
|
|
|
2189
2189
|
on: ne()
|
|
2190
2190
|
},
|
|
2191
2191
|
/** Подключение установлено; ожидание внешних событий (стоп, рестарт через `AUTO.RESTART`). */
|
|
2192
|
-
[
|
|
2192
|
+
[M.CONNECTED_MONITORING]: {
|
|
2193
2193
|
on: ne()
|
|
2194
2194
|
},
|
|
2195
2195
|
/**
|
|
2196
2196
|
* После лимита: работает check-telephony; если соединение уже живо, возвращаемся
|
|
2197
2197
|
* в обычный monitoring-режим без промежуточного состояния `standby`.
|
|
2198
2198
|
*/
|
|
2199
|
-
[
|
|
2199
|
+
[M.TELEPHONY_CHECKING]: {
|
|
2200
2200
|
on: {
|
|
2201
2201
|
"AUTO.STOP": {
|
|
2202
|
-
target:
|
|
2202
|
+
target: M.DISCONNECTING,
|
|
2203
2203
|
actions: "assignStop"
|
|
2204
2204
|
},
|
|
2205
2205
|
"AUTO.RESTART": {
|
|
2206
|
-
target:
|
|
2206
|
+
target: M.DISCONNECTING,
|
|
2207
2207
|
actions: "assignRestart"
|
|
2208
2208
|
},
|
|
2209
2209
|
"TELEPHONY.RESULT": {
|
|
2210
|
-
target:
|
|
2210
|
+
target: M.CONNECTED_MONITORING,
|
|
2211
2211
|
actions: "onTelephonyStillConnected"
|
|
2212
2212
|
}
|
|
2213
2213
|
}
|
|
@@ -2217,19 +2217,19 @@ const Cs = () => ({
|
|
|
2217
2217
|
* Конкретная причина хранится в `context.stopReason`, а наружу по-прежнему
|
|
2218
2218
|
* эмитятся прежние события в `entry`, сразу после входа в состояние.
|
|
2219
2219
|
*/
|
|
2220
|
-
[
|
|
2220
|
+
[M.ERROR_TERMINAL]: {
|
|
2221
2221
|
entry: "emitTerminalOutcome",
|
|
2222
2222
|
on: ne()
|
|
2223
2223
|
}
|
|
2224
2224
|
}
|
|
2225
|
-
}),
|
|
2226
|
-
class
|
|
2225
|
+
}), As = A("AutoConnectorStateMachine");
|
|
2226
|
+
class vs 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
|
+
As(
|
|
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 Ns extends ee {
|
|
|
2249
2249
|
this.toTelephonyResult("stillConnected");
|
|
2250
2250
|
}
|
|
2251
2251
|
}
|
|
2252
|
-
const
|
|
2252
|
+
const fs = (t) => new vs(Is(t)), Ms = "Failed to reconnect", We = (t) => t instanceof Error ? t : new Error(Ms), _s = (t) => {
|
|
2253
2253
|
const e = ({
|
|
2254
2254
|
stopReason: n,
|
|
2255
2255
|
lastError: s
|
|
2256
|
-
}) => n === "cancelled" && !
|
|
2256
|
+
}) => n === "cancelled" && !gt(s) || n === "failed" ? We(s) : s;
|
|
2257
2257
|
return {
|
|
2258
2258
|
canRetryOnError: t.canRetryOnError,
|
|
2259
2259
|
shouldDisconnectBeforeAttempt: () => t.runtime.shouldDisconnectBeforeAttempt(),
|
|
@@ -2290,7 +2290,7 @@ const Is = (t) => new Ns(ps(t)), As = "Failed to reconnect", He = (t) => t insta
|
|
|
2290
2290
|
t.runtime.onTelephonyStillConnected();
|
|
2291
2291
|
}
|
|
2292
2292
|
};
|
|
2293
|
-
},
|
|
2293
|
+
}, vt = [
|
|
2294
2294
|
"before-attempt",
|
|
2295
2295
|
"success",
|
|
2296
2296
|
"failed-all-attempts",
|
|
@@ -2300,20 +2300,20 @@ const Is = (t) => new Ns(ps(t)), As = "Failed to reconnect", He = (t) => t insta
|
|
|
2300
2300
|
"limit-reached-attempts",
|
|
2301
2301
|
"telephony-check-failure",
|
|
2302
2302
|
"telephony-check-escalated"
|
|
2303
|
-
],
|
|
2303
|
+
], Os = () => new G(vt), 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
|
+
}, bs = {
|
|
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
|
+
}, Qe = (t) => bs[t];
|
|
2316
|
+
class Ps {
|
|
2317
2317
|
generation = 0;
|
|
2318
2318
|
lastRequest;
|
|
2319
2319
|
coalesceWindowMs;
|
|
@@ -2321,9 +2321,9 @@ class _s {
|
|
|
2321
2321
|
this.coalesceWindowMs = e;
|
|
2322
2322
|
}
|
|
2323
2323
|
register(e) {
|
|
2324
|
-
const n = Date.now(), s =
|
|
2324
|
+
const n = Date.now(), s = Qe(e), { lastRequest: r } = this;
|
|
2325
2325
|
if (r !== void 0 && n - r.timestamp < this.coalesceWindowMs) {
|
|
2326
|
-
const a =
|
|
2326
|
+
const a = Qe(r.reason);
|
|
2327
2327
|
if (s <= a)
|
|
2328
2328
|
return {
|
|
2329
2329
|
shouldRequest: !1,
|
|
@@ -2346,21 +2346,21 @@ class _s {
|
|
|
2346
2346
|
this.lastRequest = void 0;
|
|
2347
2347
|
}
|
|
2348
2348
|
}
|
|
2349
|
-
const
|
|
2349
|
+
const ys = 250, Ds = {
|
|
2350
2350
|
LIMIT_REACHED: "Limit reached"
|
|
2351
|
-
},
|
|
2352
|
-
class
|
|
2351
|
+
}, Ls = (t) => !0, j = A("AutoConnectorManager"), ws = "start", Gs = "manual-restart";
|
|
2352
|
+
class ks extends w {
|
|
2353
2353
|
stateMachine;
|
|
2354
2354
|
runtime;
|
|
2355
|
-
reconnectCoalescer = new
|
|
2356
|
-
coalesceWindowMs:
|
|
2355
|
+
reconnectCoalescer = new Ps({
|
|
2356
|
+
coalesceWindowMs: ys
|
|
2357
2357
|
});
|
|
2358
2358
|
constructor({
|
|
2359
2359
|
connectionQueueManager: e,
|
|
2360
2360
|
connectionManager: n,
|
|
2361
2361
|
callManager: s
|
|
2362
2362
|
}, r) {
|
|
2363
|
-
super(
|
|
2363
|
+
super(Os()), this.runtime = new Jn({
|
|
2364
2364
|
connectionManager: n,
|
|
2365
2365
|
connectionQueueManager: e,
|
|
2366
2366
|
callManager: s,
|
|
@@ -2370,7 +2370,7 @@ class Ls extends G {
|
|
|
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(Ds.LIMIT_REACHED));
|
|
2374
2374
|
},
|
|
2375
2375
|
emitSuccess: () => {
|
|
2376
2376
|
j("handleSucceededAttempt"), this.events.trigger("success");
|
|
@@ -2400,15 +2400,15 @@ class Ls extends G {
|
|
|
2400
2400
|
this.stateMachine.toTelephonyResultStillConnected();
|
|
2401
2401
|
}
|
|
2402
2402
|
}
|
|
2403
|
-
}), this.stateMachine =
|
|
2404
|
-
|
|
2403
|
+
}), this.stateMachine = fs(
|
|
2404
|
+
_s({
|
|
2405
2405
|
runtime: this.runtime,
|
|
2406
|
-
canRetryOnError: r?.canRetryOnError ??
|
|
2406
|
+
canRetryOnError: r?.canRetryOnError ?? Ls
|
|
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, ws);
|
|
2412
2412
|
}
|
|
2413
2413
|
restart() {
|
|
2414
2414
|
j("auto connector restart");
|
|
@@ -2417,7 +2417,7 @@ class Ls extends G {
|
|
|
2417
2417
|
j("auto connector restart skipped: no parameters in context");
|
|
2418
2418
|
return;
|
|
2419
2419
|
}
|
|
2420
|
-
this.requestReconnect(e,
|
|
2420
|
+
this.requestReconnect(e, Gs);
|
|
2421
2421
|
}
|
|
2422
2422
|
stop() {
|
|
2423
2423
|
j("auto connector stop"), this.resetReconnectCoalescingState(), this.stateMachine.toStop();
|
|
@@ -2449,65 +2449,62 @@ class Ls extends G {
|
|
|
2449
2449
|
this.reconnectCoalescer.reset();
|
|
2450
2450
|
}
|
|
2451
2451
|
}
|
|
2452
|
-
const
|
|
2453
|
-
ws,
|
|
2454
|
-
Gs,
|
|
2452
|
+
const Us = "incomingCall", Fs = "declinedIncomingCall", Bs = "failedIncomingCall", $s = "terminatedIncomingCall", ft = "connecting", xs = "connected", Vs = "disconnected", qs = "newRTCSession", Hs = "registered", Ws = "unregistered", Qs = "registrationFailed", Ys = "newMessage", js = "sipEvent", zs = "availableSecondRemoteStream", Js = "notAvailableSecondRemoteStream", Ks = "mustStopPresentation", Xs = "enterRoom", Zs = "useLicense", er = "peerconnection:confirmed", tr = "peerconnection:ontrack", nr = "channels", sr = "channels:notify", rr = "ended:fromserver", ir = "main-cam-control", ar = "admin:stop-main-cam", or = "admin:start-main-cam", cr = "admin:stop-mic", dr = "admin:start-mic", lr = "admin:force-sync-media-state", hr = "participant:added-to-list-moderators", ur = "participant:removed-from-list-moderators", Er = "participant:move-request-to-stream", gr = "participant:move-request-to-spectators", Tr = "participant:move-request-to-participants", mr = "participation:accepting-word-request", Sr = "participation:cancelling-word-request", Cr = "webcast:started", pr = "webcast:stopped", Rr = "account:changed", Nr = "account:deleted", Ir = "conference:participant-token-issued", Ar = "ended", vr = "sending", fr = "reinvite", Mr = "replaces", _r = "refer", Or = "progress", br = "accepted", Pr = "confirmed", yr = "peerconnection", Dr = "failed", Lr = "muted", wr = "unmuted", Gr = "newDTMF", kr = "newInfo", Ur = "hold", Fr = "unhold", Br = "update", $r = "sdp", xr = "icecandidate", Vr = "getusermediafailed", qr = "peerconnection:createofferfailed", Hr = "peerconnection:createanswerfailed", Wr = "peerconnection:setlocaldescriptionfailed", Qr = "peerconnection:setremotedescriptionfailed", Yr = "presentation:start", jr = "presentation:started", zr = "presentation:end", Jr = "presentation:ended", Kr = "presentation:failed", Xr = [
|
|
2455
2453
|
Us,
|
|
2456
|
-
ks,
|
|
2457
|
-
Er,
|
|
2458
|
-
gr,
|
|
2459
|
-
lr,
|
|
2460
|
-
er,
|
|
2461
|
-
pr,
|
|
2462
|
-
Sr,
|
|
2463
|
-
Cr,
|
|
2464
|
-
Tr,
|
|
2465
|
-
mr,
|
|
2466
|
-
cr,
|
|
2467
|
-
dr
|
|
2468
|
-
], Jr = [
|
|
2469
|
-
At,
|
|
2470
2454
|
Fs,
|
|
2471
|
-
Bs,
|
|
2472
2455
|
$s,
|
|
2456
|
+
Bs,
|
|
2457
|
+
mr,
|
|
2458
|
+
Sr,
|
|
2459
|
+
Er,
|
|
2460
|
+
sr,
|
|
2461
|
+
Ir,
|
|
2462
|
+
Rr,
|
|
2463
|
+
Nr,
|
|
2464
|
+
Cr,
|
|
2465
|
+
pr,
|
|
2466
|
+
hr,
|
|
2467
|
+
ur
|
|
2468
|
+
], Zr = [
|
|
2469
|
+
ft,
|
|
2473
2470
|
xs,
|
|
2474
2471
|
Vs,
|
|
2475
2472
|
qs,
|
|
2476
2473
|
Hs,
|
|
2477
|
-
Ws
|
|
2478
|
-
], Kr = [
|
|
2474
|
+
Ws,
|
|
2479
2475
|
Qs,
|
|
2480
2476
|
Ys,
|
|
2481
|
-
js
|
|
2477
|
+
js
|
|
2478
|
+
], ei = [
|
|
2482
2479
|
zs,
|
|
2483
2480
|
Js,
|
|
2484
2481
|
Ks,
|
|
2485
2482
|
Xs,
|
|
2486
2483
|
Zs,
|
|
2484
|
+
er,
|
|
2487
2485
|
tr,
|
|
2488
2486
|
nr,
|
|
2489
2487
|
rr,
|
|
2490
|
-
sr,
|
|
2491
2488
|
ir,
|
|
2492
|
-
ar,
|
|
2493
2489
|
or,
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2490
|
+
ar,
|
|
2491
|
+
cr,
|
|
2492
|
+
dr,
|
|
2493
|
+
lr,
|
|
2494
|
+
gr,
|
|
2495
|
+
Tr
|
|
2496
|
+
], Oe = [
|
|
2501
2497
|
Ar,
|
|
2498
|
+
ft,
|
|
2502
2499
|
vr,
|
|
2503
2500
|
fr,
|
|
2504
|
-
Or,
|
|
2505
|
-
_r,
|
|
2506
2501
|
Mr,
|
|
2507
|
-
|
|
2502
|
+
_r,
|
|
2503
|
+
Or,
|
|
2508
2504
|
br,
|
|
2509
|
-
|
|
2505
|
+
Pr,
|
|
2510
2506
|
yr,
|
|
2507
|
+
Dr,
|
|
2511
2508
|
Lr,
|
|
2512
2509
|
wr,
|
|
2513
2510
|
Gr,
|
|
@@ -2523,15 +2520,18 @@ const ws = "incomingCall", Gs = "declinedIncomingCall", ks = "failedIncomingCall
|
|
|
2523
2520
|
Wr,
|
|
2524
2521
|
Qr,
|
|
2525
2522
|
Yr,
|
|
2526
|
-
jr
|
|
2523
|
+
jr,
|
|
2524
|
+
zr,
|
|
2525
|
+
Jr,
|
|
2526
|
+
Kr
|
|
2527
2527
|
];
|
|
2528
|
-
[...
|
|
2528
|
+
[...Zr, ...Xr];
|
|
2529
2529
|
[
|
|
2530
|
-
...
|
|
2531
|
-
...
|
|
2530
|
+
...Oe,
|
|
2531
|
+
...ei
|
|
2532
2532
|
];
|
|
2533
|
-
const
|
|
2534
|
-
class
|
|
2533
|
+
const ti = A("BaseSession.mock");
|
|
2534
|
+
class ni {
|
|
2535
2535
|
originator;
|
|
2536
2536
|
connection;
|
|
2537
2537
|
events;
|
|
@@ -2545,7 +2545,7 @@ class Zr {
|
|
|
2545
2545
|
eventHandlers: n,
|
|
2546
2546
|
remoteIdentity: s
|
|
2547
2547
|
}) {
|
|
2548
|
-
this.originator = e, this.events = new
|
|
2548
|
+
this.originator = e, this.events = new Tn(Oe), 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 Zr {
|
|
|
2641
2641
|
return this.events.off(e, n), this;
|
|
2642
2642
|
}
|
|
2643
2643
|
removeAllListeners(e) {
|
|
2644
|
-
return
|
|
2644
|
+
return ti("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 Zr {
|
|
|
2676
2676
|
});
|
|
2677
2677
|
}
|
|
2678
2678
|
// @ts-expect-error
|
|
2679
|
-
on = (e, n) => (
|
|
2679
|
+
on = (e, n) => (Oe.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 Zr {
|
|
|
2700
2700
|
return !0;
|
|
2701
2701
|
}
|
|
2702
2702
|
}
|
|
2703
|
-
class
|
|
2703
|
+
class Ye {
|
|
2704
2704
|
stats = (/* @__PURE__ */ new Map()).set("codec", { mimeType: "video/h264" });
|
|
2705
2705
|
dtmf = null;
|
|
2706
2706
|
track = null;
|
|
@@ -2743,7 +2743,7 @@ class Qe {
|
|
|
2743
2743
|
throw new Error("Method not implemented.");
|
|
2744
2744
|
}
|
|
2745
2745
|
}
|
|
2746
|
-
class
|
|
2746
|
+
class je {
|
|
2747
2747
|
currentDirection = "sendrecv";
|
|
2748
2748
|
direction = "sendrecv";
|
|
2749
2749
|
// eslint-disable-next-line unicorn/no-null
|
|
@@ -2761,7 +2761,7 @@ class Ye {
|
|
|
2761
2761
|
stop() {
|
|
2762
2762
|
}
|
|
2763
2763
|
}
|
|
2764
|
-
class
|
|
2764
|
+
class si extends EventTarget {
|
|
2765
2765
|
senders = [];
|
|
2766
2766
|
receivers = [];
|
|
2767
2767
|
canTrickleIceCandidates;
|
|
@@ -2846,16 +2846,16 @@ class ei 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 Ye({ track: e }), r = new je(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 Ye({ track: e }), r = new je(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 un(e));
|
|
2859
2859
|
}
|
|
2860
2860
|
dispatchTrackInternal(e, ...n) {
|
|
2861
2861
|
const s = new Event(
|
|
@@ -2869,14 +2869,14 @@ class ei extends EventTarget {
|
|
|
2869
2869
|
}), this.dispatchEvent(s);
|
|
2870
2870
|
}
|
|
2871
2871
|
}
|
|
2872
|
-
function
|
|
2872
|
+
function ri(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 Mt = /* @__PURE__ */ ((t) => (t.LOCAL = "local", t.REMOTE = "remote", t.SYSTEM = "system", t))(Mt || {});
|
|
2879
|
+
const _t = [
|
|
2880
2880
|
"peerconnection",
|
|
2881
2881
|
"connecting",
|
|
2882
2882
|
"sending",
|
|
@@ -2907,7 +2907,7 @@ const ft = [
|
|
|
2907
2907
|
"peerconnection:createanswerfailed",
|
|
2908
2908
|
"peerconnection:setlocaldescriptionfailed",
|
|
2909
2909
|
"peerconnection:setremotedescriptionfailed"
|
|
2910
|
-
],
|
|
2910
|
+
], ii = [
|
|
2911
2911
|
"start-call",
|
|
2912
2912
|
"end-call",
|
|
2913
2913
|
"peerconnection:confirmed",
|
|
@@ -2920,10 +2920,10 @@ const ft = [
|
|
|
2920
2920
|
"recv-session-ended",
|
|
2921
2921
|
"recv-quality-changed"
|
|
2922
2922
|
], Ot = [
|
|
2923
|
-
...
|
|
2924
|
-
...
|
|
2925
|
-
],
|
|
2926
|
-
class
|
|
2923
|
+
..._t,
|
|
2924
|
+
...ii
|
|
2925
|
+
], ai = () => new G(Ot), ze = 400, oi = "777", ci = (t) => t.getVideoTracks().length > 0;
|
|
2926
|
+
class x extends ni {
|
|
2927
2927
|
static presentationError;
|
|
2928
2928
|
static startPresentationError;
|
|
2929
2929
|
static countStartPresentationError = Number.POSITIVE_INFINITY;
|
|
@@ -2949,7 +2949,7 @@ class V extends Zr {
|
|
|
2949
2949
|
}, 100), setTimeout(() => {
|
|
2950
2950
|
this.trigger("confirmed");
|
|
2951
2951
|
}, 200);
|
|
2952
|
-
},
|
|
2952
|
+
}, ze);
|
|
2953
2953
|
});
|
|
2954
2954
|
replaceMediaStream = jest.fn(async (e) => {
|
|
2955
2955
|
});
|
|
@@ -2967,8 +2967,8 @@ class V extends Zr {
|
|
|
2967
2967
|
constructor({
|
|
2968
2968
|
eventHandlers: e,
|
|
2969
2969
|
originator: n,
|
|
2970
|
-
remoteIdentity: s = new
|
|
2971
|
-
new
|
|
2970
|
+
remoteIdentity: s = new dn(
|
|
2971
|
+
new ln("sip", "caller1", "test1.com", 5060),
|
|
2972
2972
|
"Test Caller 1"
|
|
2973
2973
|
),
|
|
2974
2974
|
delayStartPresentation: r = 0
|
|
@@ -2976,7 +2976,7 @@ class V extends Zr {
|
|
|
2976
2976
|
super({ originator: n, eventHandlers: e, remoteIdentity: s }), this.delayStartPresentation = r;
|
|
2977
2977
|
}
|
|
2978
2978
|
static get C() {
|
|
2979
|
-
return
|
|
2979
|
+
return hn;
|
|
2980
2980
|
}
|
|
2981
2981
|
static setPresentationError(e) {
|
|
2982
2982
|
this.presentationError = e;
|
|
@@ -2990,47 +2990,47 @@ class V extends Zr {
|
|
|
2990
2990
|
static resetStartPresentationError() {
|
|
2991
2991
|
this.startPresentationError = void 0, this.countStartPresentationError = Number.POSITIVE_INFINITY, this.countStartsPresentation = 0;
|
|
2992
2992
|
}
|
|
2993
|
-
startPresentation = async (e) => (
|
|
2993
|
+
startPresentation = async (e) => (x.countStartsPresentation += 1, new Promise((n, s) => {
|
|
2994
2994
|
this.timeoutStartPresentation = setTimeout(() => {
|
|
2995
|
-
if (
|
|
2996
|
-
this.trigger("presentation:start", e), this.trigger("presentation:failed", e), s(
|
|
2995
|
+
if (x.presentationError) {
|
|
2996
|
+
this.trigger("presentation:start", e), this.trigger("presentation:failed", e), s(x.presentationError);
|
|
2997
2997
|
return;
|
|
2998
2998
|
}
|
|
2999
|
-
if (
|
|
3000
|
-
this.trigger("presentation:start", e), this.trigger("presentation:failed", e), s(
|
|
2999
|
+
if (x.startPresentationError && x.countStartsPresentation < x.countStartPresentationError) {
|
|
3000
|
+
this.trigger("presentation:start", e), this.trigger("presentation:failed", e), s(x.startPresentationError);
|
|
3001
3001
|
return;
|
|
3002
3002
|
}
|
|
3003
3003
|
n(super.startPresentation(e));
|
|
3004
3004
|
}, this.delayStartPresentation);
|
|
3005
3005
|
}));
|
|
3006
3006
|
stopPresentation = async (e) => {
|
|
3007
|
-
if (
|
|
3008
|
-
throw this.trigger("presentation:end", e), this.trigger("presentation:failed", e),
|
|
3007
|
+
if (x.presentationError)
|
|
3008
|
+
throw this.trigger("presentation:end", e), this.trigger("presentation:failed", e), x.presentationError;
|
|
3009
3009
|
return super.stopPresentation(e);
|
|
3010
3010
|
};
|
|
3011
3011
|
initPeerconnection(e) {
|
|
3012
3012
|
return e ? (this.createPeerconnection(e), !0) : !1;
|
|
3013
3013
|
}
|
|
3014
3014
|
createPeerconnection(e) {
|
|
3015
|
-
const n =
|
|
3015
|
+
const n = En();
|
|
3016
3016
|
n.id = "mainaudio1";
|
|
3017
3017
|
const s = [n];
|
|
3018
|
-
if (
|
|
3019
|
-
const i =
|
|
3018
|
+
if (ci(e)) {
|
|
3019
|
+
const i = gn();
|
|
3020
3020
|
i.id = "mainvideo1", s.push(i);
|
|
3021
3021
|
}
|
|
3022
|
-
this.connection = new
|
|
3022
|
+
this.connection = new si(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 = ri(e);
|
|
3026
3026
|
return this.initPeerconnection(n), this.timeoutConnect = setTimeout(() => {
|
|
3027
|
-
e.includes(
|
|
3027
|
+
e.includes(oi) ? 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: Mt.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 V extends Zr {
|
|
|
3041
3041
|
}, 200), this.timeoutConfirmed = setTimeout(() => {
|
|
3042
3042
|
this.trigger("confirmed");
|
|
3043
3043
|
}, 300));
|
|
3044
|
-
},
|
|
3044
|
+
}, ze), 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,10 +3102,194 @@ class V extends Zr {
|
|
|
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 di = ["snapshot-changed"], li = () => new G(di), hi = (t) => t.type === "participant", de = (t) => t.type === "spectator_synthetic", H = (t) => t.type === "spectator", ui = (t, e) => H(t) && !H(e), Ei = (t, e) => H(e), gi = (t, e) => {
|
|
3106
|
+
const n = H(t) || de(t), s = H(e) || de(e);
|
|
3107
|
+
return n && !s;
|
|
3108
|
+
}, Ti = (t, e) => {
|
|
3109
|
+
const n = H(t) || de(t), s = H(e) || de(e);
|
|
3110
|
+
return !n && s;
|
|
3111
|
+
}, Ie = {
|
|
3112
|
+
type: "participant"
|
|
3113
|
+
}, mi = {
|
|
3114
|
+
type: "spectator_synthetic"
|
|
3115
|
+
}, Si = (t) => ({
|
|
3116
|
+
type: "spectator",
|
|
3117
|
+
recvParams: t
|
|
3118
|
+
});
|
|
3119
|
+
class Ci {
|
|
3120
|
+
role = Ie;
|
|
3121
|
+
isAvailableSendingMedia = !0;
|
|
3122
|
+
onRoleChanged;
|
|
3123
|
+
listeners = /* @__PURE__ */ new Set();
|
|
3124
|
+
constructor(e) {
|
|
3125
|
+
this.onRoleChanged = e;
|
|
3126
|
+
}
|
|
3127
|
+
getRole() {
|
|
3128
|
+
return this.role;
|
|
3129
|
+
}
|
|
3130
|
+
getIsAvailableSendingMedia() {
|
|
3131
|
+
return this.isAvailableSendingMedia;
|
|
3132
|
+
}
|
|
3133
|
+
setCallRoleParticipant() {
|
|
3134
|
+
this.isAvailableSendingMedia = !0, this.changeRole(Ie);
|
|
3135
|
+
}
|
|
3136
|
+
setCallRoleSpectatorSynthetic(e = !0) {
|
|
3137
|
+
this.isAvailableSendingMedia = e, this.changeRole(mi);
|
|
3138
|
+
}
|
|
3139
|
+
setCallRoleSpectator(e, n = !0) {
|
|
3140
|
+
this.isAvailableSendingMedia = n, this.changeRole(Si(e));
|
|
3141
|
+
}
|
|
3142
|
+
changeRole(e) {
|
|
3143
|
+
const n = this.role;
|
|
3144
|
+
if (n.type !== e.type) {
|
|
3145
|
+
this.setRole(e);
|
|
3146
|
+
return;
|
|
3147
|
+
}
|
|
3148
|
+
H(e) && H(n) && n.recvParams.audioId !== e.recvParams.audioId && this.setRole(e);
|
|
3149
|
+
}
|
|
3150
|
+
reset() {
|
|
3151
|
+
this.role = Ie, this.isAvailableSendingMedia = !0;
|
|
3152
|
+
}
|
|
3153
|
+
hasParticipant() {
|
|
3154
|
+
return hi(this.role);
|
|
3155
|
+
}
|
|
3156
|
+
hasSpectatorSynthetic() {
|
|
3157
|
+
return de(this.role);
|
|
3158
|
+
}
|
|
3159
|
+
hasSpectator() {
|
|
3160
|
+
return H(this.role);
|
|
3161
|
+
}
|
|
3162
|
+
subscribe(e) {
|
|
3163
|
+
return this.listeners.add(e), () => {
|
|
3164
|
+
this.listeners.delete(e);
|
|
3165
|
+
};
|
|
3166
|
+
}
|
|
3167
|
+
setRole(e) {
|
|
3168
|
+
const n = this.role;
|
|
3169
|
+
this.role = e, this.onRoleChanged?.({ previous: n, next: e }), this.listeners.forEach((s) => {
|
|
3170
|
+
s({ previous: n, next: e });
|
|
3171
|
+
});
|
|
3172
|
+
}
|
|
3173
|
+
}
|
|
3174
|
+
const pi = (t, e) => t.type !== e.type ? !1 : t.type !== "spectator" ? !0 : e.type === "spectator" && t.recvParams.audioId === e.recvParams.audioId, Ri = (t, e) => t.license === e.license && t.isDuplexSendingMediaMode === e.isDuplexSendingMediaMode && pi(t.role, e.role) && t.derived.isAvailableSendingMedia === e.derived.isAvailableSendingMedia, Je = (t, e, n) => {
|
|
3175
|
+
const s = t.getRole(), r = s.type === "spectator" || s.type === "spectator_synthetic";
|
|
3176
|
+
return {
|
|
3177
|
+
license: n,
|
|
3178
|
+
isDuplexSendingMediaMode: e,
|
|
3179
|
+
role: s,
|
|
3180
|
+
derived: {
|
|
3181
|
+
isSpectatorAny: r,
|
|
3182
|
+
isRecvSessionExpected: s.type === "spectator",
|
|
3183
|
+
isAvailableSendingMedia: t.getIsAvailableSendingMedia()
|
|
3184
|
+
}
|
|
3185
|
+
};
|
|
3186
|
+
};
|
|
3187
|
+
class Ni extends w {
|
|
3188
|
+
roleManager = new Ci();
|
|
3189
|
+
license;
|
|
3190
|
+
isDuplexSendingMediaMode = !1;
|
|
3191
|
+
currentSnapshot;
|
|
3192
|
+
subscriptions = [];
|
|
3193
|
+
dedupedTotal = 0;
|
|
3194
|
+
constructor() {
|
|
3195
|
+
super(li()), this.currentSnapshot = Je(
|
|
3196
|
+
this.roleManager,
|
|
3197
|
+
this.isDuplexSendingMediaMode,
|
|
3198
|
+
this.license
|
|
3199
|
+
);
|
|
3200
|
+
const e = this.roleManager.subscribe(this.notifySubscribers);
|
|
3201
|
+
this.subscriptions.push({
|
|
3202
|
+
unsubscribe: e
|
|
3203
|
+
});
|
|
3204
|
+
}
|
|
3205
|
+
getSnapshot() {
|
|
3206
|
+
return this.currentSnapshot;
|
|
3207
|
+
}
|
|
3208
|
+
subscribe(e) {
|
|
3209
|
+
return this.on("snapshot-changed", ({ current: n }) => {
|
|
3210
|
+
e(n);
|
|
3211
|
+
});
|
|
3212
|
+
}
|
|
3213
|
+
subscribeRoleChanges(e) {
|
|
3214
|
+
return this.roleManager.subscribe(e);
|
|
3215
|
+
}
|
|
3216
|
+
hasSpectator() {
|
|
3217
|
+
return this.roleManager.hasSpectator();
|
|
3218
|
+
}
|
|
3219
|
+
setCallRoleParticipant() {
|
|
3220
|
+
this.roleManager.setCallRoleParticipant();
|
|
3221
|
+
}
|
|
3222
|
+
setCallRoleSpectatorSynthetic(e = !0) {
|
|
3223
|
+
this.roleManager.setCallRoleSpectatorSynthetic(e);
|
|
3224
|
+
}
|
|
3225
|
+
setCallRoleSpectator(e, n = !0) {
|
|
3226
|
+
this.roleManager.setCallRoleSpectator(e, n);
|
|
3227
|
+
}
|
|
3228
|
+
reset() {
|
|
3229
|
+
this.roleManager.reset(), this.license = void 0, this.isDuplexSendingMediaMode = !1, this.notifySubscribers();
|
|
3230
|
+
}
|
|
3231
|
+
subscribeToApiEvents(e) {
|
|
3232
|
+
const n = e.on("use-license", this.handleUseLicense), s = e.on(
|
|
3233
|
+
"admin:force-sync-media-state",
|
|
3234
|
+
this.handleSyncMediaState
|
|
3235
|
+
), r = e.on("admin:stop-main-cam", this.handleSyncMediaState), i = e.on("admin:stop-mic", this.handleSyncMediaState), a = e.on("admin:start-mic", this.handleSyncMediaState);
|
|
3236
|
+
this.subscriptions.push({
|
|
3237
|
+
unsubscribe: n
|
|
3238
|
+
}), this.subscriptions.push({
|
|
3239
|
+
unsubscribe: s
|
|
3240
|
+
}), this.subscriptions.push({
|
|
3241
|
+
unsubscribe: r
|
|
3242
|
+
}), this.subscriptions.push({
|
|
3243
|
+
unsubscribe: i
|
|
3244
|
+
}), this.subscriptions.push({
|
|
3245
|
+
unsubscribe: a
|
|
3246
|
+
});
|
|
3247
|
+
}
|
|
3248
|
+
stop() {
|
|
3249
|
+
this.subscriptions.forEach((e) => {
|
|
3250
|
+
e.unsubscribe();
|
|
3251
|
+
}), this.events.offAll("snapshot-changed");
|
|
3252
|
+
}
|
|
3253
|
+
getDiagnostics() {
|
|
3254
|
+
return {
|
|
3255
|
+
emitsTotal: this.events.getEmitsTotal("snapshot-changed"),
|
|
3256
|
+
dedupedTotal: this.dedupedTotal,
|
|
3257
|
+
subscribersCount: this.events.getSubscribersCount("snapshot-changed")
|
|
3258
|
+
};
|
|
3259
|
+
}
|
|
3260
|
+
notifySubscribers = () => {
|
|
3261
|
+
const { previousSnapshot: e, currentSnapshot: n } = this.updateCurrentSnapshot();
|
|
3262
|
+
if (Ri(e, n)) {
|
|
3263
|
+
this.dedupedTotal += 1;
|
|
3264
|
+
return;
|
|
3265
|
+
}
|
|
3266
|
+
this.events.trigger("snapshot-changed", {
|
|
3267
|
+
previous: e,
|
|
3268
|
+
current: n
|
|
3269
|
+
});
|
|
3270
|
+
};
|
|
3271
|
+
updateCurrentSnapshot() {
|
|
3272
|
+
const e = this.currentSnapshot;
|
|
3273
|
+
return this.currentSnapshot = Je(
|
|
3274
|
+
this.roleManager,
|
|
3275
|
+
this.isDuplexSendingMediaMode,
|
|
3276
|
+
this.license
|
|
3277
|
+
), {
|
|
3278
|
+
previousSnapshot: e,
|
|
3279
|
+
currentSnapshot: this.currentSnapshot
|
|
3280
|
+
};
|
|
3281
|
+
}
|
|
3282
|
+
handleUseLicense = (e) => {
|
|
3283
|
+
this.license = e, this.notifySubscribers();
|
|
3284
|
+
};
|
|
3285
|
+
handleSyncMediaState = ({ isSyncForced: e }) => {
|
|
3286
|
+
this.isDuplexSendingMediaMode = e, this.notifySubscribers();
|
|
3287
|
+
};
|
|
3288
|
+
}
|
|
3289
|
+
const Ii = (t, e) => {
|
|
3106
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;
|
|
3107
3291
|
return r || i || a;
|
|
3108
|
-
},
|
|
3292
|
+
}, Ai = (t) => t.major !== void 0 && t.minor !== void 0 && t.patch !== void 0, vi = (t) => (e) => Ai(t) && Ii(t, e), fi = (t = "") => {
|
|
3109
3293
|
const e = t.split(".");
|
|
3110
3294
|
if (e.length <= 1)
|
|
3111
3295
|
return {
|
|
@@ -3115,10 +3299,10 @@ const ai = (t, e) => {
|
|
|
3115
3299
|
};
|
|
3116
3300
|
const [n, s, r] = e.map((i) => Number.parseInt(i, 10));
|
|
3117
3301
|
return { major: n, minor: s, patch: r };
|
|
3118
|
-
},
|
|
3119
|
-
const t = new
|
|
3302
|
+
}, Mi = () => globalThis.process?.versions?.electron !== void 0, bt = () => {
|
|
3303
|
+
const t = new In(), { name: e, version: n } = t.getBrowser(), { name: s } = t.getOS(), { type: r } = t.getDevice(), i = Mi(), a = r === "mobile", o = fi(n);
|
|
3120
3304
|
return {
|
|
3121
|
-
hasGreaterThanBrowserVersion:
|
|
3305
|
+
hasGreaterThanBrowserVersion: vi(o),
|
|
3122
3306
|
isMobileDevice: a,
|
|
3123
3307
|
isChrome: e === "Chrome" || i,
|
|
3124
3308
|
isYandexBrowser: e === "Yandex",
|
|
@@ -3126,19 +3310,19 @@ const ai = (t, e) => {
|
|
|
3126
3310
|
isOpera: e === "Opera",
|
|
3127
3311
|
isWindows: s === "Windows"
|
|
3128
3312
|
};
|
|
3129
|
-
},
|
|
3313
|
+
}, _i = A("stringifyMessage"), yc = (t) => {
|
|
3130
3314
|
let e = "";
|
|
3131
3315
|
try {
|
|
3132
3316
|
e = JSON.stringify(t);
|
|
3133
3317
|
} catch (n) {
|
|
3134
|
-
|
|
3318
|
+
_i("failed to stringify message", n);
|
|
3135
3319
|
}
|
|
3136
3320
|
return e;
|
|
3137
|
-
},
|
|
3321
|
+
}, Oi = /^p2p.+to.+$/i, be = (t) => t !== void 0 && t.length > 0 && Oi.test(t), bi = "purgatory", Se = (t) => t === bi, Pi = (t, e) => {
|
|
3138
3322
|
t.getVideoTracks().forEach((s) => {
|
|
3139
3323
|
"contentHint" in s && s.contentHint !== e && (s.contentHint = e);
|
|
3140
3324
|
});
|
|
3141
|
-
},
|
|
3325
|
+
}, Ee = (t, {
|
|
3142
3326
|
directionVideo: e,
|
|
3143
3327
|
directionAudio: n,
|
|
3144
3328
|
contentHint: s
|
|
@@ -3146,8 +3330,8 @@ const ai = (t, e) => {
|
|
|
3146
3330
|
if (!t || e === "recvonly" && n === "recvonly")
|
|
3147
3331
|
return;
|
|
3148
3332
|
const r = n === "recvonly" ? [] : t.getAudioTracks(), i = e === "recvonly" ? [] : t.getVideoTracks(), a = [...r, ...i], o = new MediaStream(a);
|
|
3149
|
-
return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" &&
|
|
3150
|
-
},
|
|
3333
|
+
return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" && Pi(o, s), o;
|
|
3334
|
+
}, yi = "api/v2/rtp2webrtc/offer", Di = async ({
|
|
3151
3335
|
serverUrl: t,
|
|
3152
3336
|
conferenceNumber: e,
|
|
3153
3337
|
quality: n,
|
|
@@ -3156,7 +3340,7 @@ const ai = (t, e) => {
|
|
|
3156
3340
|
token: i
|
|
3157
3341
|
}) => {
|
|
3158
3342
|
const a = new URL(
|
|
3159
|
-
`https://${t.replace(/\/$/, "")}/${
|
|
3343
|
+
`https://${t.replace(/\/$/, "")}/${yi}/${encodeURIComponent(e)}`
|
|
3160
3344
|
);
|
|
3161
3345
|
a.searchParams.set("quality", n), a.searchParams.set("audio", String(s));
|
|
3162
3346
|
const o = {
|
|
@@ -3178,39 +3362,39 @@ const ai = (t, e) => {
|
|
|
3178
3362
|
return E;
|
|
3179
3363
|
}
|
|
3180
3364
|
};
|
|
3181
|
-
},
|
|
3365
|
+
}, Li = (t, e) => (t.degradationPreference = e.degradationPreference, t), wi = (t, e) => {
|
|
3182
3366
|
t.encodings ??= [];
|
|
3183
3367
|
for (let n = t.encodings.length; n < e; n += 1)
|
|
3184
3368
|
t.encodings.push({});
|
|
3185
3369
|
return t;
|
|
3186
|
-
},
|
|
3187
|
-
if (
|
|
3370
|
+
}, Pt = (t) => (e, n) => n !== void 0 && e !== n || n === void 0 && e !== t, Gi = Pt(), ki = (t, e) => {
|
|
3371
|
+
if (Gi(t, e))
|
|
3188
3372
|
return t;
|
|
3189
|
-
},
|
|
3190
|
-
const s = t.maxBitrate, r =
|
|
3373
|
+
}, Ui = (t, e, { isResetAllowed: n = !1 } = {}) => {
|
|
3374
|
+
const s = t.maxBitrate, r = ki(e, s);
|
|
3191
3375
|
return (r !== void 0 || n) && (t.maxBitrate = r ?? e), t;
|
|
3192
|
-
},
|
|
3193
|
-
|
|
3194
|
-
),
|
|
3195
|
-
const n = t === void 0 ? void 0 : Math.max(t,
|
|
3196
|
-
if (n !== void 0 &&
|
|
3376
|
+
}, yt = 1, Fi = Pt(
|
|
3377
|
+
yt
|
|
3378
|
+
), Bi = (t, e) => {
|
|
3379
|
+
const n = t === void 0 ? void 0 : Math.max(t, yt);
|
|
3380
|
+
if (n !== void 0 && Fi(
|
|
3197
3381
|
n,
|
|
3198
3382
|
e
|
|
3199
3383
|
))
|
|
3200
3384
|
return n;
|
|
3201
|
-
},
|
|
3202
|
-
const n = t.scaleResolutionDownBy, s =
|
|
3385
|
+
}, $i = (t, e) => {
|
|
3386
|
+
const n = t.scaleResolutionDownBy, s = Bi(
|
|
3203
3387
|
e,
|
|
3204
3388
|
n
|
|
3205
3389
|
);
|
|
3206
3390
|
return s !== void 0 && (t.scaleResolutionDownBy = s), t;
|
|
3207
|
-
},
|
|
3391
|
+
}, xi = (t, e, { isResetAllowed: n } = {}) => {
|
|
3208
3392
|
const s = e.encodings?.length ?? 0;
|
|
3209
|
-
return
|
|
3393
|
+
return wi(t, s), t.encodings.forEach((r, i) => {
|
|
3210
3394
|
const a = (e?.encodings ?? [])[i], o = a?.maxBitrate, c = a?.scaleResolutionDownBy;
|
|
3211
|
-
|
|
3395
|
+
Ui(r, o, { isResetAllowed: n }), $i(r, c);
|
|
3212
3396
|
}), t;
|
|
3213
|
-
},
|
|
3397
|
+
}, Vi = (t, e) => {
|
|
3214
3398
|
if (t.codecs?.length !== e.codecs?.length)
|
|
3215
3399
|
return !0;
|
|
3216
3400
|
for (let n = 0; n < (t.codecs?.length ?? 0); n++)
|
|
@@ -3231,10 +3415,10 @@ const ai = (t, e) => {
|
|
|
3231
3415
|
const s = t.getParameters(), r = JSON.parse(
|
|
3232
3416
|
JSON.stringify(s)
|
|
3233
3417
|
);
|
|
3234
|
-
|
|
3235
|
-
const i =
|
|
3418
|
+
xi(s, e, { isResetAllowed: n }), Li(s, e);
|
|
3419
|
+
const i = Vi(r, s);
|
|
3236
3420
|
return i && await t.setParameters(s), { parameters: s, isChanged: i };
|
|
3237
|
-
},
|
|
3421
|
+
}, Dt = async (t, e, n) => {
|
|
3238
3422
|
const { isChanged: s, parameters: r } = await Pe(t, {
|
|
3239
3423
|
encodings: [
|
|
3240
3424
|
{
|
|
@@ -3244,12 +3428,12 @@ const ai = (t, e) => {
|
|
|
3244
3428
|
]
|
|
3245
3429
|
});
|
|
3246
3430
|
return s && n && n(r), { isChanged: s, parameters: r };
|
|
3247
|
-
},
|
|
3248
|
-
const s =
|
|
3431
|
+
}, qi = (t, e) => t.find((n) => n.track !== null && e.getTracks().includes(n.track)), Hi = async (t, e, n) => {
|
|
3432
|
+
const s = qi(t, e);
|
|
3249
3433
|
if (s)
|
|
3250
|
-
return
|
|
3251
|
-
},
|
|
3252
|
-
class
|
|
3434
|
+
return Dt(s, { maxBitrate: n });
|
|
3435
|
+
}, Wi = A("resolveOnStartMainCam"), Dc = (t) => (n) => (Wi("onStartMainCam"), t.on("api:admin:start-main-cam", n)), Qi = A("resolveOnStartMic"), Lc = (t) => (n) => (Qi("onStartMic"), t.on("api:admin:start-mic", n)), Yi = A("resolveOnStopMainCam"), wc = (t) => (n) => (Yi("onStopMainCam"), t.on("api:admin:stop-main-cam", n)), ji = A("resolveOnStopMic"), Gc = (t) => (n) => (ji("onStopMic"), t.on("api:admin:stop-mic", n));
|
|
3436
|
+
class zi {
|
|
3253
3437
|
command = void 0;
|
|
3254
3438
|
unsubscribe;
|
|
3255
3439
|
options;
|
|
@@ -3267,12 +3451,12 @@ class Li {
|
|
|
3267
3451
|
}
|
|
3268
3452
|
const v = "evaluate";
|
|
3269
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 || {});
|
|
3270
|
-
const
|
|
3454
|
+
const Lt = {
|
|
3271
3455
|
raw: {},
|
|
3272
3456
|
state: {}
|
|
3273
|
-
},
|
|
3457
|
+
}, wt = (t) => "number" in t && B(t.number) && St(t.answer), Gt = (t) => "room" in t && B(t.room) && B(t.participantName), Ji = (t) => "token" in t && B(t.token), kt = (t) => Ji(t) && "conferenceForToken" in t && B(t.conferenceForToken), ae = (t) => wt(t) && Gt(t), Ut = (t) => !kt(t) || !Gt(t) ? !1 : t.conferenceForToken === t.room, Ft = ({
|
|
3274
3458
|
isDirectPeerToPeer: t
|
|
3275
|
-
}) => t === !0,
|
|
3459
|
+
}) => t === !0, Ae = (t) => "isDirectPeerToPeer" in t && Ft(t), Ki = "x-vinteo-presentation-call: yes", Xi = (t) => yn(t) && t.some((e) => e.trim().toLowerCase() === Ki), Zi = (t) => "extraHeaders" in t && Xi(t.extraHeaders) && "isConfirmed" in t && t.isConfirmed === !0, he = (t) => ae(t) && !Se(t.room) && kt(t) && Ut(t), re = (t) => {
|
|
3276
3460
|
const e = t;
|
|
3277
3461
|
return {
|
|
3278
3462
|
number: e.number,
|
|
@@ -3280,45 +3464,45 @@ const Dt = {
|
|
|
3280
3464
|
room: e.room,
|
|
3281
3465
|
participantName: e.participantName
|
|
3282
3466
|
};
|
|
3283
|
-
},
|
|
3467
|
+
}, D = {
|
|
3284
3468
|
[u.IDLE]: {
|
|
3285
3469
|
guard: () => !0,
|
|
3286
3470
|
buildContext: () => ({})
|
|
3287
3471
|
},
|
|
3288
3472
|
[u.CONNECTING]: {
|
|
3289
|
-
guard:
|
|
3473
|
+
guard: wt,
|
|
3290
3474
|
buildContext: (t) => {
|
|
3291
3475
|
const { number: e, answer: n, extraHeaders: s } = t;
|
|
3292
3476
|
return { number: e, answer: n, extraHeaders: s };
|
|
3293
3477
|
}
|
|
3294
3478
|
},
|
|
3295
3479
|
[u.PRESENTATION_CALL]: {
|
|
3296
|
-
guard:
|
|
3480
|
+
guard: Zi,
|
|
3297
3481
|
buildContext: (t) => {
|
|
3298
3482
|
const { number: e, answer: n } = t;
|
|
3299
3483
|
return { number: e, answer: n };
|
|
3300
3484
|
}
|
|
3301
3485
|
},
|
|
3302
3486
|
[u.ROOM_PENDING_AUTH]: {
|
|
3303
|
-
guard: (t) => ae(t) && !
|
|
3487
|
+
guard: (t) => ae(t) && !Se(t.room) && !be(t.room) && !Ae(t) && !Ut(t),
|
|
3304
3488
|
buildContext: re
|
|
3305
3489
|
},
|
|
3306
3490
|
/** Токен из TOKEN_ISSUED может уже лежать в context — это не переводит в IN_ROOM. */
|
|
3307
3491
|
[u.PURGATORY]: {
|
|
3308
|
-
guard: (t) => ae(t) &&
|
|
3492
|
+
guard: (t) => ae(t) && Se(t.room) && !he(t),
|
|
3309
3493
|
buildContext: re
|
|
3310
3494
|
},
|
|
3311
3495
|
[u.P2P_ROOM]: {
|
|
3312
|
-
guard: (t) => ae(t) &&
|
|
3496
|
+
guard: (t) => ae(t) && be(t.room) && !Ae(t) && !he(t),
|
|
3313
3497
|
buildContext: re
|
|
3314
3498
|
},
|
|
3315
3499
|
[u.DIRECT_P2P_ROOM]: {
|
|
3316
|
-
guard: (t) => ae(t) &&
|
|
3500
|
+
guard: (t) => ae(t) && Ae(t) && !he(t),
|
|
3317
3501
|
buildContext: (t) => ({ ...re(t), isDirectPeerToPeer: !0 })
|
|
3318
3502
|
},
|
|
3319
3503
|
/** IN_ROOM только если `conferenceForToken === room` (в т.ч. после enter-room с bearer, где conference задаётся как room). */
|
|
3320
3504
|
[u.IN_ROOM]: {
|
|
3321
|
-
guard:
|
|
3505
|
+
guard: he,
|
|
3322
3506
|
buildContext: (t) => {
|
|
3323
3507
|
const { token: e, conferenceForToken: n } = t;
|
|
3324
3508
|
return { ...re(t), token: e, conferenceForToken: n };
|
|
@@ -3328,15 +3512,15 @@ const Dt = {
|
|
|
3328
3512
|
guard: (t) => t.pendingDisconnect === !0,
|
|
3329
3513
|
buildContext: () => ({})
|
|
3330
3514
|
}
|
|
3331
|
-
},
|
|
3515
|
+
}, ea = (t) => Se(t.room) || be(t.room) || Ft(t), ve = () => ({}), ta = () => Z({
|
|
3332
3516
|
types: {
|
|
3333
|
-
context:
|
|
3517
|
+
context: Lt,
|
|
3334
3518
|
events: {}
|
|
3335
3519
|
},
|
|
3336
3520
|
actions: {
|
|
3337
3521
|
setConnecting: f(({ event: t, context: e }) => t.type !== "CALL.CONNECTING" ? e : {
|
|
3338
3522
|
raw: {
|
|
3339
|
-
...
|
|
3523
|
+
...ve(),
|
|
3340
3524
|
number: t.number,
|
|
3341
3525
|
answer: t.answer,
|
|
3342
3526
|
extraHeaders: t.extraHeaders
|
|
@@ -3349,7 +3533,7 @@ const Dt = {
|
|
|
3349
3533
|
room: t.room,
|
|
3350
3534
|
participantName: t.participantName
|
|
3351
3535
|
};
|
|
3352
|
-
return
|
|
3536
|
+
return B(t.token) ? (n.token = t.token, n.conferenceForToken = t.room) : ea(t) && (n.token = void 0, n.conferenceForToken = void 0), St(t.isDirectPeerToPeer) && (n.isDirectPeerToPeer = t.isDirectPeerToPeer), {
|
|
3353
3537
|
raw: {
|
|
3354
3538
|
...e.raw,
|
|
3355
3539
|
...n
|
|
@@ -3370,21 +3554,21 @@ const Dt = {
|
|
|
3370
3554
|
isConfirmed: !0
|
|
3371
3555
|
}
|
|
3372
3556
|
}),
|
|
3373
|
-
reset: f(() => ({ raw:
|
|
3557
|
+
reset: f(() => ({ raw: ve() })),
|
|
3374
3558
|
prepareDisconnect: f(() => ({
|
|
3375
3559
|
raw: {
|
|
3376
|
-
...
|
|
3560
|
+
...ve(),
|
|
3377
3561
|
pendingDisconnect: !0
|
|
3378
3562
|
}
|
|
3379
3563
|
}))
|
|
3380
3564
|
}
|
|
3381
|
-
}),
|
|
3565
|
+
}), na = () => ta().createMachine({
|
|
3382
3566
|
id: "call",
|
|
3383
3567
|
initial: u.IDLE,
|
|
3384
|
-
context:
|
|
3568
|
+
context: Lt,
|
|
3385
3569
|
states: {
|
|
3386
3570
|
[u.IDLE]: {
|
|
3387
|
-
entry: f(() => ({ state:
|
|
3571
|
+
entry: f(() => ({ state: D[u.IDLE].buildContext() })),
|
|
3388
3572
|
on: {
|
|
3389
3573
|
"CALL.CONNECTING": {
|
|
3390
3574
|
target: v,
|
|
@@ -3393,7 +3577,7 @@ const Dt = {
|
|
|
3393
3577
|
}
|
|
3394
3578
|
},
|
|
3395
3579
|
[u.CONNECTING]: {
|
|
3396
|
-
entry: f(({ context: t }) => ({ state:
|
|
3580
|
+
entry: f(({ context: t }) => ({ state: D[u.CONNECTING].buildContext(t.raw) })),
|
|
3397
3581
|
on: {
|
|
3398
3582
|
"CALL.PRESENTATION_CALL": {
|
|
3399
3583
|
target: v,
|
|
@@ -3418,7 +3602,7 @@ const Dt = {
|
|
|
3418
3602
|
}
|
|
3419
3603
|
},
|
|
3420
3604
|
[u.ROOM_PENDING_AUTH]: {
|
|
3421
|
-
entry: f(({ context: t }) => ({ state:
|
|
3605
|
+
entry: f(({ context: t }) => ({ state: D[u.ROOM_PENDING_AUTH].buildContext(t.raw) })),
|
|
3422
3606
|
on: {
|
|
3423
3607
|
"CALL.ENTER_ROOM": {
|
|
3424
3608
|
target: v,
|
|
@@ -3439,7 +3623,7 @@ const Dt = {
|
|
|
3439
3623
|
}
|
|
3440
3624
|
},
|
|
3441
3625
|
[u.IN_ROOM]: {
|
|
3442
|
-
entry: f((t) => ({ state:
|
|
3626
|
+
entry: f((t) => ({ state: D[u.IN_ROOM].buildContext(t.context.raw) })),
|
|
3443
3627
|
on: {
|
|
3444
3628
|
"CALL.ENTER_ROOM": {
|
|
3445
3629
|
target: v,
|
|
@@ -3463,35 +3647,35 @@ const Dt = {
|
|
|
3463
3647
|
always: [
|
|
3464
3648
|
{
|
|
3465
3649
|
target: u.DISCONNECTING,
|
|
3466
|
-
guard: ({ context: t }) =>
|
|
3650
|
+
guard: ({ context: t }) => D[u.DISCONNECTING].guard(t.raw)
|
|
3467
3651
|
},
|
|
3468
3652
|
{
|
|
3469
3653
|
target: u.PRESENTATION_CALL,
|
|
3470
|
-
guard: ({ context: t }) =>
|
|
3654
|
+
guard: ({ context: t }) => D[u.PRESENTATION_CALL].guard(t.raw)
|
|
3471
3655
|
},
|
|
3472
3656
|
{
|
|
3473
3657
|
target: u.IN_ROOM,
|
|
3474
|
-
guard: ({ context: t }) =>
|
|
3658
|
+
guard: ({ context: t }) => D[u.IN_ROOM].guard(t.raw)
|
|
3475
3659
|
},
|
|
3476
3660
|
{
|
|
3477
3661
|
target: u.DIRECT_P2P_ROOM,
|
|
3478
|
-
guard: ({ context: t }) =>
|
|
3662
|
+
guard: ({ context: t }) => D[u.DIRECT_P2P_ROOM].guard(t.raw)
|
|
3479
3663
|
},
|
|
3480
3664
|
{
|
|
3481
3665
|
target: u.P2P_ROOM,
|
|
3482
|
-
guard: ({ context: t }) =>
|
|
3666
|
+
guard: ({ context: t }) => D[u.P2P_ROOM].guard(t.raw)
|
|
3483
3667
|
},
|
|
3484
3668
|
{
|
|
3485
3669
|
target: u.PURGATORY,
|
|
3486
|
-
guard: ({ context: t }) =>
|
|
3670
|
+
guard: ({ context: t }) => D[u.PURGATORY].guard(t.raw)
|
|
3487
3671
|
},
|
|
3488
3672
|
{
|
|
3489
3673
|
target: u.ROOM_PENDING_AUTH,
|
|
3490
|
-
guard: ({ context: t }) =>
|
|
3674
|
+
guard: ({ context: t }) => D[u.ROOM_PENDING_AUTH].guard(t.raw)
|
|
3491
3675
|
},
|
|
3492
3676
|
{
|
|
3493
3677
|
target: u.CONNECTING,
|
|
3494
|
-
guard: ({ context: t }) =>
|
|
3678
|
+
guard: ({ context: t }) => D[u.CONNECTING].guard(t.raw)
|
|
3495
3679
|
},
|
|
3496
3680
|
{
|
|
3497
3681
|
target: u.IDLE
|
|
@@ -3499,7 +3683,7 @@ const Dt = {
|
|
|
3499
3683
|
]
|
|
3500
3684
|
},
|
|
3501
3685
|
[u.PURGATORY]: {
|
|
3502
|
-
entry: f(({ context: t }) => ({ state:
|
|
3686
|
+
entry: f(({ context: t }) => ({ state: D[u.PURGATORY].buildContext(t.raw) })),
|
|
3503
3687
|
on: {
|
|
3504
3688
|
"CALL.ENTER_ROOM": {
|
|
3505
3689
|
target: v,
|
|
@@ -3520,7 +3704,7 @@ const Dt = {
|
|
|
3520
3704
|
}
|
|
3521
3705
|
},
|
|
3522
3706
|
[u.P2P_ROOM]: {
|
|
3523
|
-
entry: f(({ context: t }) => ({ state:
|
|
3707
|
+
entry: f(({ context: t }) => ({ state: D[u.P2P_ROOM].buildContext(t.raw) })),
|
|
3524
3708
|
on: {
|
|
3525
3709
|
"CALL.ENTER_ROOM": {
|
|
3526
3710
|
target: v,
|
|
@@ -3541,7 +3725,7 @@ const Dt = {
|
|
|
3541
3725
|
}
|
|
3542
3726
|
},
|
|
3543
3727
|
[u.PRESENTATION_CALL]: {
|
|
3544
|
-
entry: f(({ context: t }) => ({ state:
|
|
3728
|
+
entry: f(({ context: t }) => ({ state: D[u.PRESENTATION_CALL].buildContext(t.raw) })),
|
|
3545
3729
|
on: {
|
|
3546
3730
|
"CALL.START_DISCONNECT": {
|
|
3547
3731
|
target: v,
|
|
@@ -3554,7 +3738,7 @@ const Dt = {
|
|
|
3554
3738
|
}
|
|
3555
3739
|
},
|
|
3556
3740
|
[u.DIRECT_P2P_ROOM]: {
|
|
3557
|
-
entry: f(({ context: t }) => ({ state:
|
|
3741
|
+
entry: f(({ context: t }) => ({ state: D[u.DIRECT_P2P_ROOM].buildContext(t.raw) })),
|
|
3558
3742
|
on: {
|
|
3559
3743
|
"CALL.ENTER_ROOM": {
|
|
3560
3744
|
target: v,
|
|
@@ -3575,7 +3759,7 @@ const Dt = {
|
|
|
3575
3759
|
}
|
|
3576
3760
|
},
|
|
3577
3761
|
[u.DISCONNECTING]: {
|
|
3578
|
-
entry: f(() => ({ state:
|
|
3762
|
+
entry: f(() => ({ state: D[u.DISCONNECTING].buildContext() })),
|
|
3579
3763
|
on: {
|
|
3580
3764
|
"CALL.RESET": {
|
|
3581
3765
|
target: v,
|
|
@@ -3585,11 +3769,11 @@ const Dt = {
|
|
|
3585
3769
|
}
|
|
3586
3770
|
}
|
|
3587
3771
|
});
|
|
3588
|
-
function
|
|
3772
|
+
function sa(t) {
|
|
3589
3773
|
return t !== v;
|
|
3590
3774
|
}
|
|
3591
|
-
const
|
|
3592
|
-
class
|
|
3775
|
+
const ra = A("CallStateMachine");
|
|
3776
|
+
class ia extends ee {
|
|
3593
3777
|
constructor(e, n) {
|
|
3594
3778
|
super(e), this.subscribeToEvents(n);
|
|
3595
3779
|
}
|
|
@@ -3720,7 +3904,7 @@ class qi extends ee {
|
|
|
3720
3904
|
(o !== a.token || c !== a.conferenceForToken) && (n = a, e(a));
|
|
3721
3905
|
return;
|
|
3722
3906
|
}
|
|
3723
|
-
|
|
3907
|
+
sa(r.value) && (n = void 0);
|
|
3724
3908
|
});
|
|
3725
3909
|
return () => {
|
|
3726
3910
|
s.unsubscribe();
|
|
@@ -3731,7 +3915,7 @@ class qi extends ee {
|
|
|
3731
3915
|
}
|
|
3732
3916
|
send(e) {
|
|
3733
3917
|
if (!this.actor.getSnapshot().can(e)) {
|
|
3734
|
-
|
|
3918
|
+
ra(
|
|
3735
3919
|
`[CallStateMachine] Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`
|
|
3736
3920
|
);
|
|
3737
3921
|
return;
|
|
@@ -3787,16 +3971,16 @@ class qi extends ee {
|
|
|
3787
3971
|
);
|
|
3788
3972
|
}
|
|
3789
3973
|
}
|
|
3790
|
-
const
|
|
3791
|
-
class
|
|
3974
|
+
const aa = (t) => new ia(na(), t), oa = (t) => [...t.keys()].map((e) => t.get(e)), ca = (t, e) => oa(t).find((n) => n?.type === e), Bt = async (t) => t.getStats().then((e) => ca(e, "codec")?.mimeType);
|
|
3975
|
+
class da {
|
|
3792
3976
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
3793
3977
|
async getCodecFromSender(e) {
|
|
3794
|
-
return await
|
|
3978
|
+
return await Bt(e) ?? "";
|
|
3795
3979
|
}
|
|
3796
3980
|
}
|
|
3797
|
-
const
|
|
3798
|
-
class
|
|
3799
|
-
stackPromises =
|
|
3981
|
+
const la = A("TaskQueue");
|
|
3982
|
+
class ha {
|
|
3983
|
+
stackPromises = Et({
|
|
3800
3984
|
noRunIsNotActual: !0
|
|
3801
3985
|
});
|
|
3802
3986
|
/**
|
|
@@ -3816,34 +4000,34 @@ class zi {
|
|
|
3816
4000
|
*/
|
|
3817
4001
|
async run() {
|
|
3818
4002
|
return this.stackPromises().catch((e) => {
|
|
3819
|
-
|
|
4003
|
+
la("TaskQueue: error", e);
|
|
3820
4004
|
});
|
|
3821
4005
|
}
|
|
3822
4006
|
}
|
|
3823
|
-
class
|
|
4007
|
+
class ua {
|
|
3824
4008
|
taskQueue;
|
|
3825
4009
|
onSetParameters;
|
|
3826
4010
|
constructor(e) {
|
|
3827
|
-
this.onSetParameters = e, this.taskQueue = new
|
|
4011
|
+
this.onSetParameters = e, this.taskQueue = new ha();
|
|
3828
4012
|
}
|
|
3829
4013
|
async setEncodingsToSender(e, n) {
|
|
3830
|
-
return this.taskQueue.add(async () =>
|
|
4014
|
+
return this.taskQueue.add(async () => Dt(e, n, this.onSetParameters));
|
|
3831
4015
|
}
|
|
3832
4016
|
stop() {
|
|
3833
4017
|
this.taskQueue.stop();
|
|
3834
4018
|
}
|
|
3835
4019
|
}
|
|
3836
|
-
const
|
|
3837
|
-
const n =
|
|
3838
|
-
return
|
|
3839
|
-
},
|
|
4020
|
+
const ye = (t, e) => t !== void 0 && e !== void 0 && t.toLowerCase().includes(e.toLowerCase()), Ea = 1e6, q = (t) => t * Ea, $t = q(0.06), xt = q(4), ga = (t) => t <= 64 ? $t : 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) : xt, Ta = "av1", ma = (t) => ye(t, Ta), Sa = 0.6, Ue = (t, e) => ma(e) ? t * Sa : t, Vt = (t) => Ue($t, t), qt = (t) => Ue(xt, t), Ke = (t, e) => {
|
|
4021
|
+
const n = ga(t);
|
|
4022
|
+
return Ue(n, e);
|
|
4023
|
+
}, fe = 1, Ca = ({
|
|
3840
4024
|
videoTrack: t,
|
|
3841
4025
|
targetSize: e
|
|
3842
4026
|
}) => {
|
|
3843
|
-
const n = t.getSettings(), s = n.width, r = n.height, i = s === void 0 ?
|
|
3844
|
-
return Math.max(i, a,
|
|
4027
|
+
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
|
+
return Math.max(i, a, fe);
|
|
3845
4029
|
};
|
|
3846
|
-
class
|
|
4030
|
+
class pa {
|
|
3847
4031
|
ignoreForCodec;
|
|
3848
4032
|
senderFinder;
|
|
3849
4033
|
codecProvider;
|
|
@@ -3876,7 +4060,7 @@ class sa {
|
|
|
3876
4060
|
if (!r?.track)
|
|
3877
4061
|
return { ...this.resultNoChanged, sender: r };
|
|
3878
4062
|
const i = await this.codecProvider.getCodecFromSender(r);
|
|
3879
|
-
if (
|
|
4063
|
+
if (ye(i, this.ignoreForCodec))
|
|
3880
4064
|
return { ...this.resultNoChanged, sender: r };
|
|
3881
4065
|
const { mainCam: a, resolutionMainCam: o } = n ?? {};
|
|
3882
4066
|
return this.processSender(
|
|
@@ -3898,7 +4082,7 @@ class sa {
|
|
|
3898
4082
|
if (!s?.track)
|
|
3899
4083
|
return { ...this.resultNoChanged, sender: s };
|
|
3900
4084
|
const r = await this.codecProvider.getCodecFromSender(s);
|
|
3901
|
-
if (
|
|
4085
|
+
if (ye(r, this.ignoreForCodec))
|
|
3902
4086
|
return { ...this.resultNoChanged, sender: s };
|
|
3903
4087
|
const i = {
|
|
3904
4088
|
sender: s,
|
|
@@ -3915,14 +4099,14 @@ class sa {
|
|
|
3915
4099
|
async processSender(e, n) {
|
|
3916
4100
|
const { mainCam: s, resolutionMainCam: r } = e;
|
|
3917
4101
|
switch (s) {
|
|
3918
|
-
case
|
|
4102
|
+
case F.PAUSE_MAIN_CAM:
|
|
3919
4103
|
return this.downgradeResolutionSender(n);
|
|
3920
|
-
case
|
|
4104
|
+
case F.RESUME_MAIN_CAM:
|
|
3921
4105
|
return this.setBitrateByTrackResolution(n);
|
|
3922
|
-
case
|
|
4106
|
+
case F.MAX_MAIN_CAM_RESOLUTION:
|
|
3923
4107
|
return r !== void 0 ? this.setResolutionSender(r, n) : this.setBitrateByTrackResolution(n);
|
|
3924
|
-
case
|
|
3925
|
-
case
|
|
4108
|
+
case F.ADMIN_STOP_MAIN_CAM:
|
|
4109
|
+
case F.ADMIN_START_MAIN_CAM:
|
|
3926
4110
|
case void 0:
|
|
3927
4111
|
return this.setBitrateByTrackResolution(n);
|
|
3928
4112
|
default:
|
|
@@ -3937,7 +4121,7 @@ class sa {
|
|
|
3937
4121
|
async downgradeResolutionSender(e) {
|
|
3938
4122
|
const { sender: n, codec: s } = e, r = {
|
|
3939
4123
|
scaleResolutionDownBy: 200,
|
|
3940
|
-
maxBitrate:
|
|
4124
|
+
maxBitrate: Vt(s)
|
|
3941
4125
|
};
|
|
3942
4126
|
return this.parametersSetter.setEncodingsToSender(n, r);
|
|
3943
4127
|
}
|
|
@@ -3947,7 +4131,7 @@ class sa {
|
|
|
3947
4131
|
* @returns Promise с результатом
|
|
3948
4132
|
*/
|
|
3949
4133
|
async setBitrateByTrackResolution(e) {
|
|
3950
|
-
const { sender: n, videoTrack: s, codec: r } = e, a = s.getSettings().width, o = a === void 0 ?
|
|
4134
|
+
const { sender: n, videoTrack: s, codec: r } = e, a = s.getSettings().width, o = a === void 0 ? qt(r) : Ke(a, r);
|
|
3951
4135
|
return this.parametersSetter.setEncodingsToSender(n, {
|
|
3952
4136
|
scaleResolutionDownBy: 1,
|
|
3953
4137
|
maxBitrate: o
|
|
@@ -3963,24 +4147,24 @@ class sa {
|
|
|
3963
4147
|
const [s, r] = e.split("x"), { sender: i, videoTrack: a, codec: o } = n, c = {
|
|
3964
4148
|
width: Number(s),
|
|
3965
4149
|
height: Number(r)
|
|
3966
|
-
}, E =
|
|
4150
|
+
}, E = Ca({
|
|
3967
4151
|
videoTrack: a,
|
|
3968
4152
|
targetSize: c
|
|
3969
|
-
}), p =
|
|
4153
|
+
}), p = Ke(c.width, o), I = {
|
|
3970
4154
|
scaleResolutionDownBy: E,
|
|
3971
4155
|
maxBitrate: p
|
|
3972
4156
|
};
|
|
3973
4157
|
return this.parametersSetter.setEncodingsToSender(i, I);
|
|
3974
4158
|
}
|
|
3975
4159
|
}
|
|
3976
|
-
const
|
|
3977
|
-
class
|
|
4160
|
+
const Ra = (t) => t.find((e) => e.track?.kind === "video");
|
|
4161
|
+
class Na {
|
|
3978
4162
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
3979
4163
|
findVideoSender(e) {
|
|
3980
|
-
return
|
|
4164
|
+
return Ra(e);
|
|
3981
4165
|
}
|
|
3982
4166
|
}
|
|
3983
|
-
class
|
|
4167
|
+
class Ia {
|
|
3984
4168
|
currentSender;
|
|
3985
4169
|
originalReplaceTrack;
|
|
3986
4170
|
lastWidth;
|
|
@@ -3993,7 +4177,7 @@ class aa {
|
|
|
3993
4177
|
pollIntervalMs: e = 1e3,
|
|
3994
4178
|
maxPollIntervalMs: n
|
|
3995
4179
|
}) {
|
|
3996
|
-
this.pollIntervalMs = e, this.maxPollIntervalMs = n ?? e * 16, this.currentPollIntervalMs = this.pollIntervalMs, this.setTimeoutRequest = new
|
|
4180
|
+
this.pollIntervalMs = e, this.maxPollIntervalMs = n ?? e * 16, this.currentPollIntervalMs = this.pollIntervalMs, this.setTimeoutRequest = new ht();
|
|
3997
4181
|
}
|
|
3998
4182
|
/**
|
|
3999
4183
|
* Проверяет актуальный video-sender и (при необходимости) перенастраивает наблюдение.
|
|
@@ -4044,7 +4228,7 @@ class aa {
|
|
|
4044
4228
|
this.setTimeoutRequest.cancelRequest(), this.lastWidth = void 0, this.lastHeight = void 0;
|
|
4045
4229
|
}
|
|
4046
4230
|
}
|
|
4047
|
-
class
|
|
4231
|
+
class Aa {
|
|
4048
4232
|
apiManager;
|
|
4049
4233
|
currentHandler;
|
|
4050
4234
|
constructor(e) {
|
|
@@ -4064,8 +4248,8 @@ class oa {
|
|
|
4064
4248
|
this.currentHandler && (this.apiManager.off("main-cam-control", this.currentHandler), this.currentHandler = void 0);
|
|
4065
4249
|
}
|
|
4066
4250
|
}
|
|
4067
|
-
const
|
|
4068
|
-
class
|
|
4251
|
+
const Me = A("VideoSendingBalancer");
|
|
4252
|
+
class va {
|
|
4069
4253
|
eventHandler;
|
|
4070
4254
|
senderBalancer;
|
|
4071
4255
|
parametersSetterWithQueue;
|
|
@@ -4077,16 +4261,16 @@ class ca {
|
|
|
4077
4261
|
onSetParameters: r,
|
|
4078
4262
|
pollIntervalMs: i
|
|
4079
4263
|
} = {}) {
|
|
4080
|
-
this.getConnection = n, this.eventHandler = new
|
|
4264
|
+
this.getConnection = n, this.eventHandler = new Aa(e), this.parametersSetterWithQueue = new ua(r), this.senderBalancer = new pa(
|
|
4081
4265
|
{
|
|
4082
|
-
senderFinder: new
|
|
4083
|
-
codecProvider: new
|
|
4266
|
+
senderFinder: new Na(),
|
|
4267
|
+
codecProvider: new da(),
|
|
4084
4268
|
parametersSetter: this.parametersSetterWithQueue
|
|
4085
4269
|
},
|
|
4086
4270
|
{
|
|
4087
4271
|
ignoreForCodec: s
|
|
4088
4272
|
}
|
|
4089
|
-
), this.trackMonitor = new
|
|
4273
|
+
), this.trackMonitor = new Ia({ pollIntervalMs: i });
|
|
4090
4274
|
}
|
|
4091
4275
|
/**
|
|
4092
4276
|
* Подписывается на события управления главной камерой
|
|
@@ -4107,7 +4291,7 @@ class ca {
|
|
|
4107
4291
|
this.clearState();
|
|
4108
4292
|
const e = this.getConnection();
|
|
4109
4293
|
e ? this.senderBalancer.reset(e).catch((n) => {
|
|
4110
|
-
|
|
4294
|
+
Me("reset sender encodings: error", n);
|
|
4111
4295
|
}).finally(() => {
|
|
4112
4296
|
this.parametersSetterWithQueue.stop();
|
|
4113
4297
|
}) : this.parametersSetterWithQueue.stop();
|
|
@@ -4123,7 +4307,7 @@ class ca {
|
|
|
4123
4307
|
const n = await this.senderBalancer.balance(e, this.serverHeaders);
|
|
4124
4308
|
return this.trackMonitor.subscribe(n.sender, () => {
|
|
4125
4309
|
this.balance().catch((s) => {
|
|
4126
|
-
|
|
4310
|
+
Me("balance on track change: error", s);
|
|
4127
4311
|
});
|
|
4128
4312
|
}), n;
|
|
4129
4313
|
}
|
|
@@ -4136,12 +4320,12 @@ class ca {
|
|
|
4136
4320
|
*/
|
|
4137
4321
|
handleMainCamControl = (e) => {
|
|
4138
4322
|
this.serverHeaders = e, this.balance().catch((n) => {
|
|
4139
|
-
|
|
4323
|
+
Me("handleMainCamControl: error", n);
|
|
4140
4324
|
});
|
|
4141
4325
|
};
|
|
4142
4326
|
}
|
|
4143
|
-
const
|
|
4144
|
-
class
|
|
4327
|
+
const fa = 6e3, Ma = 52e4, ue = (t, e) => t.getSenders().filter((n) => n.track?.kind === e), _a = (t, e) => t === "audio" ? fa : Vt(e), Oa = (t) => t.track !== null;
|
|
4328
|
+
class ba {
|
|
4145
4329
|
previousBitrates = /* @__PURE__ */ new Map();
|
|
4146
4330
|
/**
|
|
4147
4331
|
* Устанавливает минимальный битрейт для указанных типов потоков
|
|
@@ -4152,15 +4336,15 @@ class Ea {
|
|
|
4152
4336
|
const s = [];
|
|
4153
4337
|
if (!e)
|
|
4154
4338
|
return;
|
|
4155
|
-
(n === "audio" || n === "all") && s.push(...
|
|
4156
|
-
const r = s.filter(
|
|
4339
|
+
(n === "audio" || n === "all") && s.push(...ue(e, "audio")), (n === "video" || n === "all") && s.push(...ue(e, "video"));
|
|
4340
|
+
const r = s.filter(Oa).map(async (i) => {
|
|
4157
4341
|
const a = i.getParameters();
|
|
4158
4342
|
this.saveCurrentBitrate(i, a);
|
|
4159
4343
|
const o = {
|
|
4160
4344
|
...a,
|
|
4161
4345
|
encodings: a.encodings.map((c) => ({
|
|
4162
4346
|
...c,
|
|
4163
|
-
maxBitrate:
|
|
4347
|
+
maxBitrate: _a(i.track.kind)
|
|
4164
4348
|
}))
|
|
4165
4349
|
};
|
|
4166
4350
|
await Pe(i, o);
|
|
@@ -4176,14 +4360,14 @@ class Ea {
|
|
|
4176
4360
|
const s = [];
|
|
4177
4361
|
if (!e)
|
|
4178
4362
|
return;
|
|
4179
|
-
(n === "audio" || n === "all") && s.push(...
|
|
4363
|
+
(n === "audio" || n === "all") && s.push(...ue(e, "audio")), (n === "video" || n === "all") && s.push(...ue(e, "video"));
|
|
4180
4364
|
const r = s.map(async (i) => {
|
|
4181
4365
|
const a = this.getSavedBitrate(i);
|
|
4182
4366
|
if (a) {
|
|
4183
|
-
const o = i.getParameters(), c = i.track?.kind === "video", E = c ? await
|
|
4367
|
+
const o = i.getParameters(), c = i.track?.kind === "video", E = c ? await Bt(i) : void 0, p = {
|
|
4184
4368
|
...o,
|
|
4185
4369
|
encodings: a.map((I) => {
|
|
4186
|
-
const b = c ?
|
|
4370
|
+
const b = c ? qt(E) : Ma;
|
|
4187
4371
|
return {
|
|
4188
4372
|
...I,
|
|
4189
4373
|
// В Safari и некоторых браузерах encodings изначально не содержат maxBitrate.
|
|
@@ -4238,16 +4422,16 @@ class Ea {
|
|
|
4238
4422
|
this.previousBitrates.set(e, s);
|
|
4239
4423
|
}
|
|
4240
4424
|
}
|
|
4241
|
-
var
|
|
4242
|
-
const
|
|
4243
|
-
class
|
|
4425
|
+
var Ht = /* @__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))(Ht || {});
|
|
4426
|
+
const Xe = A("MCUSession");
|
|
4427
|
+
class Pa {
|
|
4244
4428
|
events;
|
|
4245
4429
|
rtcSession;
|
|
4246
4430
|
disposers = /* @__PURE__ */ new Set();
|
|
4247
4431
|
onReset;
|
|
4248
4432
|
pcConfig;
|
|
4249
4433
|
// Менеджер состояния битрейта
|
|
4250
|
-
bitrateStateManager = new
|
|
4434
|
+
bitrateStateManager = new ba();
|
|
4251
4435
|
constructor(e, { onReset: n }) {
|
|
4252
4436
|
this.events = e, this.onReset = n, e.on("failed", this.handleEnded), e.on("ended", this.handleEnded);
|
|
4253
4437
|
}
|
|
@@ -4279,11 +4463,11 @@ class ga {
|
|
|
4279
4463
|
degradationPreference: b,
|
|
4280
4464
|
sendEncodings: _,
|
|
4281
4465
|
onAddedTransceiver: W
|
|
4282
|
-
}) => new Promise((
|
|
4283
|
-
this.handleCall().then(
|
|
4466
|
+
}) => new Promise((L, z) => {
|
|
4467
|
+
this.handleCall().then(L).catch((te) => {
|
|
4284
4468
|
z(te);
|
|
4285
4469
|
}), this.pcConfig = { iceServers: a }, this.rtcSession = e.call(n(s), {
|
|
4286
|
-
mediaStream:
|
|
4470
|
+
mediaStream: Ee(r, {
|
|
4287
4471
|
directionVideo: o,
|
|
4288
4472
|
directionAudio: c,
|
|
4289
4473
|
contentHint: E
|
|
@@ -4311,7 +4495,7 @@ class ga {
|
|
|
4311
4495
|
const { rtcSession: e } = this;
|
|
4312
4496
|
if (e && !e.isEnded())
|
|
4313
4497
|
return e.terminateAsync({
|
|
4314
|
-
cause:
|
|
4498
|
+
cause: Ht.CANCELED
|
|
4315
4499
|
}).finally(() => {
|
|
4316
4500
|
this.reset();
|
|
4317
4501
|
});
|
|
@@ -4331,8 +4515,8 @@ class ga {
|
|
|
4331
4515
|
onAddedTransceiver: b
|
|
4332
4516
|
}) => new Promise((_, W) => {
|
|
4333
4517
|
try {
|
|
4334
|
-
this.rtcSession = e, this.subscribeToSessionEvents(e), this.handleCall().then(_).catch((
|
|
4335
|
-
W(
|
|
4518
|
+
this.rtcSession = e, this.subscribeToSessionEvents(e), this.handleCall().then(_).catch((L) => {
|
|
4519
|
+
W(L);
|
|
4336
4520
|
}), this.pcConfig = { iceServers: r }, e.answer({
|
|
4337
4521
|
pcConfig: {
|
|
4338
4522
|
iceServers: r
|
|
@@ -4341,7 +4525,7 @@ class ga {
|
|
|
4341
4525
|
offerToReceiveAudio: o,
|
|
4342
4526
|
offerToReceiveVideo: c
|
|
4343
4527
|
},
|
|
4344
|
-
mediaStream:
|
|
4528
|
+
mediaStream: Ee(n, {
|
|
4345
4529
|
directionVideo: i,
|
|
4346
4530
|
directionAudio: a,
|
|
4347
4531
|
contentHint: E
|
|
@@ -4353,14 +4537,14 @@ class ga {
|
|
|
4353
4537
|
sendEncodings: I,
|
|
4354
4538
|
onAddedTransceiver: b
|
|
4355
4539
|
});
|
|
4356
|
-
} catch (
|
|
4357
|
-
W(
|
|
4540
|
+
} catch (L) {
|
|
4541
|
+
W(L);
|
|
4358
4542
|
}
|
|
4359
4543
|
});
|
|
4360
4544
|
async replaceMediaStream(e, n) {
|
|
4361
4545
|
if (!this.rtcSession)
|
|
4362
4546
|
throw new Error("No rtcSession established");
|
|
4363
|
-
const { contentHint: s } = n ?? {}, r =
|
|
4547
|
+
const { contentHint: s } = n ?? {}, r = Ee(e, { contentHint: s });
|
|
4364
4548
|
if (r === void 0)
|
|
4365
4549
|
throw new Error("No preparedMediaStream");
|
|
4366
4550
|
return this.rtcSession.replaceMediaStream(r, n);
|
|
@@ -4376,7 +4560,7 @@ class ga {
|
|
|
4376
4560
|
*/
|
|
4377
4561
|
setMinBitrateForSenders(e = "all") {
|
|
4378
4562
|
this.bitrateStateManager.setMinBitrateForSenders(this.connection, e).catch((n) => {
|
|
4379
|
-
|
|
4563
|
+
Xe("setMinBitrateForSenders", n);
|
|
4380
4564
|
});
|
|
4381
4565
|
}
|
|
4382
4566
|
/**
|
|
@@ -4385,7 +4569,7 @@ class ga {
|
|
|
4385
4569
|
*/
|
|
4386
4570
|
restoreBitrateForSenders(e = "all") {
|
|
4387
4571
|
this.bitrateStateManager.restoreBitrateForSenders(this.connection, e).catch((n) => {
|
|
4388
|
-
|
|
4572
|
+
Xe("restoreBitrateForSenders", n);
|
|
4389
4573
|
});
|
|
4390
4574
|
}
|
|
4391
4575
|
handleCall = async () => new Promise((e, n) => {
|
|
@@ -4416,7 +4600,7 @@ class ga {
|
|
|
4416
4600
|
});
|
|
4417
4601
|
subscribeToSessionEvents(e) {
|
|
4418
4602
|
this.events.eachTriggers((n, s) => {
|
|
4419
|
-
const r =
|
|
4603
|
+
const r = _t.find((i) => i === s);
|
|
4420
4604
|
r && (e.on(r, n), this.disposers.add(() => {
|
|
4421
4605
|
e.off(r, n);
|
|
4422
4606
|
}));
|
|
@@ -4435,8 +4619,8 @@ class ga {
|
|
|
4435
4619
|
delete this.rtcSession, delete this.pcConfig, this.unsubscribeFromSessionEvents(), this.bitrateStateManager.clearAll(), this.onReset();
|
|
4436
4620
|
};
|
|
4437
4621
|
}
|
|
4438
|
-
const De = (t) => t === "auto" ? "high" : t,
|
|
4439
|
-
class
|
|
4622
|
+
const De = (t) => t === "auto" ? "high" : t, ya = 10, Da = 500, La = 5e3;
|
|
4623
|
+
class wa {
|
|
4440
4624
|
/**
|
|
4441
4625
|
* Текущая операция отправки offer с повторными попытками при ошибках.
|
|
4442
4626
|
* Может быть отменена при новом renegotiate для предотвращения конфликтов.
|
|
@@ -4562,11 +4746,11 @@ class Ca {
|
|
|
4562
4746
|
},
|
|
4563
4747
|
s
|
|
4564
4748
|
), i = (o) => !(o instanceof Error);
|
|
4565
|
-
this.cancelableSendOfferWithRepeatedCalls =
|
|
4749
|
+
this.cancelableSendOfferWithRepeatedCalls = we({
|
|
4566
4750
|
targetFunction: r,
|
|
4567
4751
|
isComplete: i,
|
|
4568
|
-
callLimit:
|
|
4569
|
-
delay:
|
|
4752
|
+
callLimit: ya,
|
|
4753
|
+
delay: Da,
|
|
4570
4754
|
isRejectAsValid: !0,
|
|
4571
4755
|
isCheckBeforeCall: !1
|
|
4572
4756
|
});
|
|
@@ -4660,7 +4844,7 @@ class Ca {
|
|
|
4660
4844
|
c(
|
|
4661
4845
|
new Error("Timed out waiting for stable signaling state and ready connection state")
|
|
4662
4846
|
);
|
|
4663
|
-
},
|
|
4847
|
+
}, La), this.connection.addEventListener("signalingstatechange", E), this.connection.addEventListener("connectionstatechange", E), E();
|
|
4664
4848
|
});
|
|
4665
4849
|
}
|
|
4666
4850
|
async waitForTracks() {
|
|
@@ -4693,18 +4877,18 @@ class Ca {
|
|
|
4693
4877
|
this.cancelableSendOfferWithRepeatedCalls?.cancel();
|
|
4694
4878
|
}
|
|
4695
4879
|
}
|
|
4696
|
-
const
|
|
4697
|
-
const n =
|
|
4880
|
+
const Wt = (t) => t.getSettings(), Ga = (t, e) => {
|
|
4881
|
+
const n = Wt(t);
|
|
4698
4882
|
let s = e;
|
|
4699
4883
|
s ??= t.label;
|
|
4700
4884
|
let r = n?.msid;
|
|
4701
4885
|
return r ??= s, r ??= t.id, r;
|
|
4702
|
-
},
|
|
4703
|
-
const n =
|
|
4886
|
+
}, ka = (t, e) => {
|
|
4887
|
+
const n = Wt(t);
|
|
4704
4888
|
let s = e;
|
|
4705
4889
|
return s ??= n?.msid, s ??= t.label, (s && s.length > 0 ? s : void 0) ?? t.id;
|
|
4706
4890
|
};
|
|
4707
|
-
class
|
|
4891
|
+
class Ze {
|
|
4708
4892
|
participantGroups = /* @__PURE__ */ new Map();
|
|
4709
4893
|
trackToGroup = /* @__PURE__ */ new Map();
|
|
4710
4894
|
trackDisposers = /* @__PURE__ */ new Map();
|
|
@@ -4721,7 +4905,7 @@ class Ke {
|
|
|
4721
4905
|
onRemoved: n,
|
|
4722
4906
|
streamHint: s
|
|
4723
4907
|
} = {}) {
|
|
4724
|
-
const r =
|
|
4908
|
+
const r = ka(e, s), i = Ga(e, s);
|
|
4725
4909
|
if (this.trackToGroup.has(e.id))
|
|
4726
4910
|
return { isAddedTrack: !1, isAddedStream: !1 };
|
|
4727
4911
|
const a = this.getParticipantGroups(r), o = a.get(i), c = !o;
|
|
@@ -4789,87 +4973,13 @@ class Ke {
|
|
|
4789
4973
|
return this.participantGroups.set(e, s), s;
|
|
4790
4974
|
}
|
|
4791
4975
|
}
|
|
4792
|
-
const
|
|
4793
|
-
type: "participant"
|
|
4794
|
-
}, Na = {
|
|
4795
|
-
type: "spectator_synthetic"
|
|
4796
|
-
}, Ia = (t) => ({
|
|
4797
|
-
type: "spectator",
|
|
4798
|
-
recvParams: t
|
|
4799
|
-
});
|
|
4800
|
-
class P {
|
|
4801
|
-
role = fe;
|
|
4802
|
-
onRoleChanged;
|
|
4803
|
-
constructor(e) {
|
|
4804
|
-
this.onRoleChanged = e;
|
|
4805
|
-
}
|
|
4806
|
-
static hasParticipant(e) {
|
|
4807
|
-
return e.type === "participant";
|
|
4808
|
-
}
|
|
4809
|
-
static hasSpectatorSynthetic(e) {
|
|
4810
|
-
return e.type === "spectator_synthetic";
|
|
4811
|
-
}
|
|
4812
|
-
static hasSpectator(e) {
|
|
4813
|
-
return e.type === "spectator";
|
|
4814
|
-
}
|
|
4815
|
-
static isExitingSpectatorRole(e, n) {
|
|
4816
|
-
return P.hasSpectator(e) && !P.hasSpectator(n);
|
|
4817
|
-
}
|
|
4818
|
-
static isEnteringSpectatorRole(e, n) {
|
|
4819
|
-
return P.hasSpectator(n);
|
|
4820
|
-
}
|
|
4821
|
-
static isExitingAnySpectatorRole(e, n) {
|
|
4822
|
-
const s = P.hasSpectator(e) || P.hasSpectatorSynthetic(e), r = P.hasSpectator(n) || P.hasSpectatorSynthetic(n);
|
|
4823
|
-
return s && !r;
|
|
4824
|
-
}
|
|
4825
|
-
static isEnteringAnySpectatorRole(e, n) {
|
|
4826
|
-
const s = P.hasSpectator(e) || P.hasSpectatorSynthetic(e), r = P.hasSpectator(n) || P.hasSpectatorSynthetic(n);
|
|
4827
|
-
return !s && r;
|
|
4828
|
-
}
|
|
4829
|
-
getRole() {
|
|
4830
|
-
return this.role;
|
|
4831
|
-
}
|
|
4832
|
-
setCallRoleParticipant() {
|
|
4833
|
-
this.changeRole(fe);
|
|
4834
|
-
}
|
|
4835
|
-
setCallRoleSpectatorSynthetic() {
|
|
4836
|
-
this.changeRole(Na);
|
|
4837
|
-
}
|
|
4838
|
-
setCallRoleSpectator(e) {
|
|
4839
|
-
this.changeRole(Ia(e));
|
|
4840
|
-
}
|
|
4841
|
-
changeRole(e) {
|
|
4842
|
-
const n = this.role;
|
|
4843
|
-
if (n.type !== e.type) {
|
|
4844
|
-
this.setRole(e);
|
|
4845
|
-
return;
|
|
4846
|
-
}
|
|
4847
|
-
P.hasSpectator(e) && P.hasSpectator(n) && n.recvParams.audioId !== e.recvParams.audioId && this.setRole(e);
|
|
4848
|
-
}
|
|
4849
|
-
reset() {
|
|
4850
|
-
this.role = fe;
|
|
4851
|
-
}
|
|
4852
|
-
hasParticipant() {
|
|
4853
|
-
return P.hasParticipant(this.role);
|
|
4854
|
-
}
|
|
4855
|
-
hasSpectatorSynthetic() {
|
|
4856
|
-
return P.hasSpectatorSynthetic(this.role);
|
|
4857
|
-
}
|
|
4858
|
-
hasSpectator() {
|
|
4859
|
-
return P.hasSpectator(this.role);
|
|
4860
|
-
}
|
|
4861
|
-
setRole(e) {
|
|
4862
|
-
const n = this.role;
|
|
4863
|
-
this.role = e, this.onRoleChanged?.({ previous: n, next: e });
|
|
4864
|
-
}
|
|
4865
|
-
}
|
|
4866
|
-
const Aa = (t, e) => {
|
|
4976
|
+
const Ua = (t, e) => {
|
|
4867
4977
|
if (!t || !e)
|
|
4868
4978
|
return t === e;
|
|
4869
4979
|
const n = t.mainStream?.id, s = e.mainStream?.id, r = t.contentedStream?.id, i = e.contentedStream?.id;
|
|
4870
4980
|
return n === s && r === i;
|
|
4871
4981
|
};
|
|
4872
|
-
class
|
|
4982
|
+
class Fa {
|
|
4873
4983
|
lastEmittedStreams;
|
|
4874
4984
|
/**
|
|
4875
4985
|
* Проверяет, изменились ли streams с последнего сохраненного состояния
|
|
@@ -4877,7 +4987,7 @@ class va {
|
|
|
4877
4987
|
* @returns true, если streams изменились
|
|
4878
4988
|
*/
|
|
4879
4989
|
hasChanged(e) {
|
|
4880
|
-
return !
|
|
4990
|
+
return !Ua(this.lastEmittedStreams, e);
|
|
4881
4991
|
}
|
|
4882
4992
|
/**
|
|
4883
4993
|
* Сохраняет текущие streams как последнее эмитнутое состояние
|
|
@@ -4900,8 +5010,8 @@ class va {
|
|
|
4900
5010
|
this.lastEmittedStreams = void 0;
|
|
4901
5011
|
}
|
|
4902
5012
|
}
|
|
4903
|
-
const
|
|
4904
|
-
class
|
|
5013
|
+
const Ba = "default", $a = "dual", xa = "content_", Va = (t) => `${xa}${t.toLowerCase()}`, qa = (t) => [...t.getTracks()].some((e) => e.label.includes($a));
|
|
5014
|
+
class Ha {
|
|
4905
5015
|
mainRemoteStreamsManager;
|
|
4906
5016
|
recvRemoteStreamsManager;
|
|
4907
5017
|
constructor(e, n) {
|
|
@@ -4918,7 +5028,7 @@ class ba {
|
|
|
4918
5028
|
}) {
|
|
4919
5029
|
const n = this.mainRemoteStreamsManager;
|
|
4920
5030
|
return { manager: n, getRemoteStreams: () => {
|
|
4921
|
-
const r = n.getStreams(), i = r.find((o) => !
|
|
5031
|
+
const r = n.getStreams(), i = r.find((o) => !qa(o)), a = e.isAvailable ? r.find((o) => o !== i) : void 0;
|
|
4922
5032
|
return { mainStream: i, contentedStream: a };
|
|
4923
5033
|
} };
|
|
4924
5034
|
}
|
|
@@ -4927,7 +5037,7 @@ class ba {
|
|
|
4927
5037
|
}) {
|
|
4928
5038
|
const n = this.recvRemoteStreamsManager;
|
|
4929
5039
|
return { manager: n, getRemoteStreams: () => {
|
|
4930
|
-
const i = n.getStreams(
|
|
5040
|
+
const i = n.getStreams(Ba)[0], a = this.getRecvRemoteContentedStream({ stateInfo: e });
|
|
4931
5041
|
return { mainStream: i, contentedStream: a };
|
|
4932
5042
|
} };
|
|
4933
5043
|
}
|
|
@@ -4936,42 +5046,46 @@ class ba {
|
|
|
4936
5046
|
}) {
|
|
4937
5047
|
if (!e.isAvailable || e.codec === void 0)
|
|
4938
5048
|
return;
|
|
4939
|
-
const n =
|
|
5049
|
+
const n = Va(e.codec);
|
|
4940
5050
|
return this.recvRemoteStreamsManager.getStreams(n)[0];
|
|
4941
5051
|
}
|
|
4942
5052
|
}
|
|
4943
|
-
const
|
|
4944
|
-
const s =
|
|
5053
|
+
const Wa = "udp", Qa = (t) => t.transport?.iceTransport ? t.transport.iceTransport.getLocalCandidates() : [], Ya = (t) => t.getReceivers().flatMap(Qa), ja = (t) => {
|
|
5054
|
+
const s = Ya(t).filter(({ protocol: r, port: i }) => i !== null && Wa === r).map(({ port: r }) => r);
|
|
4945
5055
|
return [...new Set(s)];
|
|
4946
|
-
},
|
|
4947
|
-
class
|
|
5056
|
+
}, et = (t) => t.streams[0]?.id;
|
|
5057
|
+
class za extends w {
|
|
4948
5058
|
stateMachine;
|
|
5059
|
+
sessionState;
|
|
4949
5060
|
isPendingCall = !1;
|
|
4950
5061
|
isPendingAnswer = !1;
|
|
4951
|
-
mainRemoteStreamsManager = new
|
|
4952
|
-
recvRemoteStreamsManager = new
|
|
5062
|
+
mainRemoteStreamsManager = new Ze();
|
|
5063
|
+
recvRemoteStreamsManager = new Ze();
|
|
4953
5064
|
streamsManagerProvider;
|
|
4954
5065
|
contentedStreamManager;
|
|
4955
5066
|
tools;
|
|
4956
|
-
roleManager =
|
|
4957
|
-
this.
|
|
4958
|
-
|
|
5067
|
+
roleManager = {
|
|
5068
|
+
hasSpectator: () => this.sessionState.hasSpectator(),
|
|
5069
|
+
reset: () => {
|
|
5070
|
+
this.sessionState.reset();
|
|
5071
|
+
}
|
|
5072
|
+
};
|
|
4959
5073
|
mcuSession;
|
|
4960
5074
|
recvSession;
|
|
4961
5075
|
disposeRecvSessionTrackListener;
|
|
4962
5076
|
disposeInRoomCredentialsListener;
|
|
4963
5077
|
deferredStartRecvSessionRunner;
|
|
4964
|
-
streamsChangeTracker = new
|
|
4965
|
-
constructor({ contentedStreamManager: e }, n) {
|
|
4966
|
-
super(
|
|
5078
|
+
streamsChangeTracker = new Fa();
|
|
5079
|
+
constructor({ contentedStreamManager: e }, n, { callSessionState: s }) {
|
|
5080
|
+
super(ai()), this.contentedStreamManager = e, this.tools = n, this.mcuSession = new Pa(this.events, { onReset: this.reset }), this.stateMachine = aa(this.events), this.sessionState = s, this.sessionState.subscribeRoleChanges(this.onRoleChanged), this.streamsManagerProvider = new Ha(
|
|
4967
5081
|
this.mainRemoteStreamsManager,
|
|
4968
5082
|
this.recvRemoteStreamsManager
|
|
4969
|
-
), this.deferredStartRecvSessionRunner = new
|
|
4970
|
-
subscribe: (
|
|
4971
|
-
isReady: (
|
|
4972
|
-
isCancelled: (
|
|
4973
|
-
onExecute: (
|
|
4974
|
-
this.startRecvSessionForced({ audioChannel:
|
|
5083
|
+
), this.deferredStartRecvSessionRunner = new zi({
|
|
5084
|
+
subscribe: (r) => this.stateMachine.onStateChange(r),
|
|
5085
|
+
isReady: (r) => r === u.IN_ROOM,
|
|
5086
|
+
isCancelled: (r) => r === u.IDLE,
|
|
5087
|
+
onExecute: (r) => {
|
|
5088
|
+
this.startRecvSessionForced({ audioChannel: r.audioId }).catch(() => {
|
|
4975
5089
|
});
|
|
4976
5090
|
}
|
|
4977
5091
|
}), this.subscribeCallStatusChange(), this.subscribeMcuRemoteTrackEvents(), this.subscribeContentedStreamEvents();
|
|
@@ -5002,7 +5116,7 @@ class Ga extends G {
|
|
|
5002
5116
|
}
|
|
5003
5117
|
get localPorts() {
|
|
5004
5118
|
const e = this.getActivePeerConnection();
|
|
5005
|
-
return e ?
|
|
5119
|
+
return e ? ja(e) : [];
|
|
5006
5120
|
}
|
|
5007
5121
|
// For testing purposes
|
|
5008
5122
|
getStreamsManagerProvider() {
|
|
@@ -5013,7 +5127,7 @@ class Ga extends G {
|
|
|
5013
5127
|
}
|
|
5014
5128
|
getEstablishedRTCSession = () => this.mcuSession.getEstablishedRTCSession();
|
|
5015
5129
|
subscribeToApiEvents(e) {
|
|
5016
|
-
this.stateMachine.subscribeToApiEvents(e.events);
|
|
5130
|
+
this.stateMachine.subscribeToApiEvents(e.events), this.sessionState.subscribeToApiEvents(e.events);
|
|
5017
5131
|
}
|
|
5018
5132
|
startCall = async (e, n, s) => (this.isPendingCall = !0, this.events.emit("start-call", {
|
|
5019
5133
|
extraHeaders: s.extraHeaders,
|
|
@@ -5064,15 +5178,6 @@ class Ga extends G {
|
|
|
5064
5178
|
hasSpectator() {
|
|
5065
5179
|
return this.roleManager.hasSpectator();
|
|
5066
5180
|
}
|
|
5067
|
-
setCallRoleParticipant() {
|
|
5068
|
-
this.roleManager.setCallRoleParticipant();
|
|
5069
|
-
}
|
|
5070
|
-
setCallRoleSpectatorSynthetic() {
|
|
5071
|
-
this.roleManager.setCallRoleSpectatorSynthetic();
|
|
5072
|
-
}
|
|
5073
|
-
setCallRoleSpectator(e) {
|
|
5074
|
-
this.roleManager.setCallRoleSpectator(e);
|
|
5075
|
-
}
|
|
5076
5181
|
async replaceMediaStream(e, n) {
|
|
5077
5182
|
return this.mcuSession.replaceMediaStream(e, n);
|
|
5078
5183
|
}
|
|
@@ -5150,7 +5255,7 @@ class Ga extends G {
|
|
|
5150
5255
|
}
|
|
5151
5256
|
subscribeMcuRemoteTrackEvents() {
|
|
5152
5257
|
this.on("peerconnection:ontrack", (e) => {
|
|
5153
|
-
this.addRemoteTrack(this.mainRemoteStreamsManager, e.track,
|
|
5258
|
+
this.addRemoteTrack(this.mainRemoteStreamsManager, e.track, et(e));
|
|
5154
5259
|
});
|
|
5155
5260
|
}
|
|
5156
5261
|
addRemoteTrack(e, n, s) {
|
|
@@ -5206,7 +5311,7 @@ class Ga extends G {
|
|
|
5206
5311
|
}
|
|
5207
5312
|
attachRecvSessionTracks(e) {
|
|
5208
5313
|
const { peerConnection: n } = e, s = (r) => {
|
|
5209
|
-
this.addRemoteTrack(this.recvRemoteStreamsManager, r.track,
|
|
5314
|
+
this.addRemoteTrack(this.recvRemoteStreamsManager, r.track, et(r));
|
|
5210
5315
|
};
|
|
5211
5316
|
n.addEventListener("track", s), this.disposeRecvSessionTrackListener = () => {
|
|
5212
5317
|
n.removeEventListener("track", s);
|
|
@@ -5230,7 +5335,7 @@ class Ga extends G {
|
|
|
5230
5335
|
audioChannel: e,
|
|
5231
5336
|
quality: n,
|
|
5232
5337
|
pcConfig: this.mcuSession.getPcConfig()
|
|
5233
|
-
}, a = new
|
|
5338
|
+
}, a = new wa(i, { sendOffer: this.tools.sendOffer });
|
|
5234
5339
|
return this.recvSession = a, this.recvRemoteStreamsManager.reset(), this.attachRecvSessionTracks(a), a.call({
|
|
5235
5340
|
conferenceNumber: r.conferenceForToken,
|
|
5236
5341
|
token: r.token
|
|
@@ -5241,9 +5346,9 @@ class Ga extends G {
|
|
|
5241
5346
|
}
|
|
5242
5347
|
)), { session: a, callResult: c })).catch(async (c) => {
|
|
5243
5348
|
this.stopRecvSession();
|
|
5244
|
-
const E = new
|
|
5349
|
+
const E = new dt();
|
|
5245
5350
|
E.body = c instanceof Error ? c.message : String(c);
|
|
5246
|
-
const p =
|
|
5351
|
+
const p = lt.causes.INTERNAL_ERROR;
|
|
5247
5352
|
throw await this.failed(E, p), c;
|
|
5248
5353
|
});
|
|
5249
5354
|
}
|
|
@@ -5255,14 +5360,14 @@ class Ga extends G {
|
|
|
5255
5360
|
previous: e,
|
|
5256
5361
|
next: n
|
|
5257
5362
|
}) => {
|
|
5258
|
-
if (
|
|
5363
|
+
if (ui(e, n) && (this.stopRecvSession(), this.deferredStartRecvSessionRunner.cancel(), this.emitEventChangedRemoteStreamsConnected()), Ei(e, n)) {
|
|
5259
5364
|
const s = n.recvParams;
|
|
5260
5365
|
this.stateMachine.getInRoomCredentials() === void 0 ? this.deferredStartRecvSessionRunner.set({
|
|
5261
5366
|
audioId: s.audioId
|
|
5262
5367
|
}) : this.startRecvSession({ audioChannel: s.audioId }).catch(() => {
|
|
5263
5368
|
});
|
|
5264
5369
|
}
|
|
5265
|
-
|
|
5370
|
+
gi(e, n) && this.mcuSession.restoreBitrateForSenders(), Ti(e, n) && this.mcuSession.setMinBitrateForSenders();
|
|
5266
5371
|
};
|
|
5267
5372
|
subscribeContentedStreamEvents() {
|
|
5268
5373
|
this.contentedStreamManager.on("available", this.emitEventChangedRemoteStreamsConnected), this.contentedStreamManager.on("not-available", this.emitEventChangedRemoteStreamsConnected);
|
|
@@ -5278,39 +5383,39 @@ class Ga extends G {
|
|
|
5278
5383
|
return this.mcuSession.renegotiate();
|
|
5279
5384
|
}
|
|
5280
5385
|
}
|
|
5281
|
-
const
|
|
5386
|
+
const Qt = [
|
|
5282
5387
|
"presentation:start",
|
|
5283
5388
|
"presentation:started",
|
|
5284
5389
|
"presentation:end",
|
|
5285
5390
|
"presentation:ended",
|
|
5286
5391
|
"presentation:failed"
|
|
5287
|
-
],
|
|
5392
|
+
], Ja = () => new G(Qt);
|
|
5288
5393
|
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 || {});
|
|
5289
|
-
const
|
|
5394
|
+
const Yt = {
|
|
5290
5395
|
lastError: void 0
|
|
5291
|
-
},
|
|
5396
|
+
}, tt = A("PresentationStateMachine"), Ka = (t) => t instanceof Error ? t : new Error(JSON.stringify(t)), Xa = () => Z({
|
|
5292
5397
|
types: {
|
|
5293
|
-
context:
|
|
5398
|
+
context: Yt,
|
|
5294
5399
|
events: {}
|
|
5295
5400
|
},
|
|
5296
5401
|
actions: {
|
|
5297
5402
|
[S.LOG_TRANSITION]: (t, e) => {
|
|
5298
|
-
|
|
5403
|
+
tt(`State transition: ${e.from} -> ${e.to} (${e.event})`);
|
|
5299
5404
|
},
|
|
5300
5405
|
[S.LOG_STATE_CHANGE]: (t, e) => {
|
|
5301
|
-
|
|
5406
|
+
tt("PresentationStateMachine state changed", e.state);
|
|
5302
5407
|
},
|
|
5303
5408
|
[S.SET_ERROR]: f(({ event: t }) => "error" in t && t.error !== void 0 ? {
|
|
5304
|
-
lastError:
|
|
5409
|
+
lastError: Ka(t.error)
|
|
5305
5410
|
} : { lastError: void 0 }),
|
|
5306
5411
|
[S.CLEAR_ERROR]: f(() => ({
|
|
5307
5412
|
lastError: void 0
|
|
5308
5413
|
}))
|
|
5309
5414
|
}
|
|
5310
|
-
}),
|
|
5415
|
+
}), Za = () => Xa().createMachine({
|
|
5311
5416
|
id: "presentation",
|
|
5312
5417
|
initial: h.IDLE,
|
|
5313
|
-
context:
|
|
5418
|
+
context: Yt,
|
|
5314
5419
|
states: {
|
|
5315
5420
|
[h.IDLE]: {
|
|
5316
5421
|
entry: {
|
|
@@ -5599,10 +5704,10 @@ const Wt = {
|
|
|
5599
5704
|
}
|
|
5600
5705
|
}
|
|
5601
5706
|
}
|
|
5602
|
-
}),
|
|
5603
|
-
class
|
|
5707
|
+
}), eo = Za(), to = A("PresentationStateMachine");
|
|
5708
|
+
class no extends ee {
|
|
5604
5709
|
constructor(e) {
|
|
5605
|
-
super(
|
|
5710
|
+
super(eo), this.subscribeCallEvents(e);
|
|
5606
5711
|
}
|
|
5607
5712
|
get isIdle() {
|
|
5608
5713
|
return this.hasState(h.IDLE);
|
|
@@ -5639,7 +5744,7 @@ class Va extends ee {
|
|
|
5639
5744
|
}
|
|
5640
5745
|
sendEvent(e) {
|
|
5641
5746
|
if (!this.actor.getSnapshot().can(e)) {
|
|
5642
|
-
|
|
5747
|
+
to(
|
|
5643
5748
|
`[PresentationStateMachine] Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`
|
|
5644
5749
|
);
|
|
5645
5750
|
return;
|
|
@@ -5678,14 +5783,14 @@ class Va extends ee {
|
|
|
5678
5783
|
);
|
|
5679
5784
|
}
|
|
5680
5785
|
}
|
|
5681
|
-
const
|
|
5786
|
+
const so = 1, ro = [
|
|
5682
5787
|
"presentation:start",
|
|
5683
5788
|
"presentation:started",
|
|
5684
5789
|
"presentation:end",
|
|
5685
5790
|
"presentation:ended",
|
|
5686
5791
|
"presentation:failed"
|
|
5687
|
-
],
|
|
5688
|
-
class
|
|
5792
|
+
], io = (t) => t instanceof Error ? t : new Error(String(t)), kc = (t) => Nn(t);
|
|
5793
|
+
class ao extends w {
|
|
5689
5794
|
stateMachine;
|
|
5690
5795
|
promisePendingStartPresentation;
|
|
5691
5796
|
promisePendingStopPresentation;
|
|
@@ -5697,7 +5802,7 @@ class Qa extends G {
|
|
|
5697
5802
|
callManager: e,
|
|
5698
5803
|
maxBitrate: n
|
|
5699
5804
|
}) {
|
|
5700
|
-
super(
|
|
5805
|
+
super(Ja()), this.callManager = e, this.maxBitrate = n, this.stateMachine = new no(this.callManager.events), this.subscribe();
|
|
5701
5806
|
}
|
|
5702
5807
|
get isPendingPresentation() {
|
|
5703
5808
|
return !!this.promisePendingStartPresentation || !!this.promisePendingStopPresentation;
|
|
@@ -5750,7 +5855,7 @@ class Qa extends G {
|
|
|
5750
5855
|
this.cancelableSendPresentationWithRepeatedCalls?.stopRepeatedCalls();
|
|
5751
5856
|
}
|
|
5752
5857
|
subscribe() {
|
|
5753
|
-
|
|
5858
|
+
ro.forEach((e) => {
|
|
5754
5859
|
this.callManager.on(e, (n) => {
|
|
5755
5860
|
this.events.trigger(e, n);
|
|
5756
5861
|
});
|
|
@@ -5761,7 +5866,7 @@ class Qa extends G {
|
|
|
5761
5866
|
stream: s,
|
|
5762
5867
|
presentationOptions: r,
|
|
5763
5868
|
options: i = {
|
|
5764
|
-
callLimit:
|
|
5869
|
+
callLimit: so
|
|
5765
5870
|
}
|
|
5766
5871
|
}) {
|
|
5767
5872
|
const a = async () => this.sendPresentation(
|
|
@@ -5770,7 +5875,7 @@ class Qa extends G {
|
|
|
5770
5875
|
s,
|
|
5771
5876
|
r
|
|
5772
5877
|
), o = () => !!this.streamPresentationCurrent;
|
|
5773
|
-
return this.cancelableSendPresentationWithRepeatedCalls =
|
|
5878
|
+
return this.cancelableSendPresentationWithRepeatedCalls = we({
|
|
5774
5879
|
targetFunction: a,
|
|
5775
5880
|
isComplete: o,
|
|
5776
5881
|
isRejectAsValid: !0,
|
|
@@ -5785,7 +5890,7 @@ class Qa extends G {
|
|
|
5785
5890
|
sendEncodings: o,
|
|
5786
5891
|
onAddedTransceiver: c
|
|
5787
5892
|
}) {
|
|
5788
|
-
const E =
|
|
5893
|
+
const E = Ee(s, { contentHint: i });
|
|
5789
5894
|
if (E === void 0)
|
|
5790
5895
|
throw new Error("No streamPresentationTarget");
|
|
5791
5896
|
this.streamPresentationCurrent = E;
|
|
@@ -5805,7 +5910,7 @@ class Qa extends G {
|
|
|
5805
5910
|
if (!e || !n || s === void 0)
|
|
5806
5911
|
return;
|
|
5807
5912
|
const r = e.getSenders();
|
|
5808
|
-
await
|
|
5913
|
+
await Hi(r, n, s);
|
|
5809
5914
|
};
|
|
5810
5915
|
getRtcSessionProtected = () => {
|
|
5811
5916
|
const e = this.callManager.getEstablishedRTCSession();
|
|
@@ -5826,10 +5931,10 @@ class Qa extends G {
|
|
|
5826
5931
|
delete this.streamPresentationCurrent;
|
|
5827
5932
|
}
|
|
5828
5933
|
notifyPresentationFailed(e) {
|
|
5829
|
-
this.events.trigger("presentation:failed",
|
|
5934
|
+
this.events.trigger("presentation:failed", io(e));
|
|
5830
5935
|
}
|
|
5831
5936
|
}
|
|
5832
|
-
const
|
|
5937
|
+
const oo = A("ContentedStreamStateMachine"), co = Z({
|
|
5833
5938
|
types: {
|
|
5834
5939
|
context: {},
|
|
5835
5940
|
events: {}
|
|
@@ -5870,9 +5975,9 @@ const Ya = A("ContentedStreamStateMachine"), ja = Z({
|
|
|
5870
5975
|
}
|
|
5871
5976
|
}
|
|
5872
5977
|
});
|
|
5873
|
-
class
|
|
5978
|
+
class lo extends ee {
|
|
5874
5979
|
constructor() {
|
|
5875
|
-
super(
|
|
5980
|
+
super(co);
|
|
5876
5981
|
}
|
|
5877
5982
|
get isAvailable() {
|
|
5878
5983
|
return this.state === "contented-stream:available";
|
|
@@ -5894,7 +5999,7 @@ class za extends ee {
|
|
|
5894
5999
|
}
|
|
5895
6000
|
send(e) {
|
|
5896
6001
|
if (!this.actor.getSnapshot().can(e)) {
|
|
5897
|
-
|
|
6002
|
+
oo(
|
|
5898
6003
|
`[ContentedStreamStateMachine] Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`
|
|
5899
6004
|
);
|
|
5900
6005
|
return;
|
|
@@ -5913,15 +6018,15 @@ class za extends ee {
|
|
|
5913
6018
|
);
|
|
5914
6019
|
}
|
|
5915
6020
|
}
|
|
5916
|
-
const
|
|
6021
|
+
const ho = [
|
|
5917
6022
|
"available",
|
|
5918
6023
|
"not-available"
|
|
5919
6024
|
/* NOT_AVAILABLE */
|
|
5920
|
-
],
|
|
5921
|
-
class
|
|
6025
|
+
], uo = () => new G(ho);
|
|
6026
|
+
class Eo extends w {
|
|
5922
6027
|
stateMachine;
|
|
5923
6028
|
constructor() {
|
|
5924
|
-
super(
|
|
6029
|
+
super(uo()), this.stateMachine = new lo(), this.proxyEvents();
|
|
5925
6030
|
}
|
|
5926
6031
|
get isAvailable() {
|
|
5927
6032
|
return this.stateMachine.isAvailable;
|
|
@@ -5945,27 +6050,27 @@ class Xa extends G {
|
|
|
5945
6050
|
});
|
|
5946
6051
|
}
|
|
5947
6052
|
}
|
|
5948
|
-
const
|
|
6053
|
+
const jt = [
|
|
5949
6054
|
"ringing",
|
|
5950
6055
|
"declinedIncomingCall",
|
|
5951
6056
|
"terminatedIncomingCall",
|
|
5952
6057
|
"failedIncomingCall"
|
|
5953
|
-
],
|
|
6058
|
+
], go = () => new G(jt);
|
|
5954
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 || {}), C = /* @__PURE__ */ ((t) => (t.LOG_TRANSITION = "logTransition", t.LOG_STATE_CHANGE = "logStateChange", t.REMEMBER_INCOMING = "rememberIncoming", t.REMEMBER_REASON = "rememberReason", t.CLEAR_INCOMING = "clearIncoming", t))(C || {}), 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 || {});
|
|
5955
|
-
const
|
|
6060
|
+
const zt = {
|
|
5956
6061
|
remoteCallerData: void 0,
|
|
5957
6062
|
lastReason: void 0
|
|
5958
|
-
},
|
|
6063
|
+
}, nt = A("IncomingCallStateMachine"), To = () => Z({
|
|
5959
6064
|
types: {
|
|
5960
|
-
context:
|
|
6065
|
+
context: zt,
|
|
5961
6066
|
events: {}
|
|
5962
6067
|
},
|
|
5963
6068
|
actions: {
|
|
5964
6069
|
[C.LOG_TRANSITION]: (t, e) => {
|
|
5965
|
-
|
|
6070
|
+
nt(`State transition: ${e.from} -> ${e.to} (${e.event})`);
|
|
5966
6071
|
},
|
|
5967
6072
|
[C.LOG_STATE_CHANGE]: (t, e) => {
|
|
5968
|
-
|
|
6073
|
+
nt("IncomingCallStateMachine state changed", e.state);
|
|
5969
6074
|
},
|
|
5970
6075
|
[C.REMEMBER_INCOMING]: f(({ event: t }) => ({
|
|
5971
6076
|
remoteCallerData: t.data,
|
|
@@ -5989,10 +6094,10 @@ const Yt = {
|
|
|
5989
6094
|
lastReason: void 0
|
|
5990
6095
|
}))
|
|
5991
6096
|
}
|
|
5992
|
-
}),
|
|
6097
|
+
}), mo = () => To().createMachine({
|
|
5993
6098
|
id: "incoming",
|
|
5994
6099
|
initial: l.IDLE,
|
|
5995
|
-
context:
|
|
6100
|
+
context: zt,
|
|
5996
6101
|
states: {
|
|
5997
6102
|
[l.IDLE]: {
|
|
5998
6103
|
entry: {
|
|
@@ -6267,10 +6372,10 @@ const Yt = {
|
|
|
6267
6372
|
}
|
|
6268
6373
|
}
|
|
6269
6374
|
}
|
|
6270
|
-
}),
|
|
6271
|
-
class
|
|
6375
|
+
}), So = mo(), Co = A("IncomingCallStateMachine");
|
|
6376
|
+
class po extends ee {
|
|
6272
6377
|
constructor({ incomingEvents: e, connectionEvents: n }) {
|
|
6273
|
-
super(
|
|
6378
|
+
super(So), this.subscribeIncomingEvents(e), this.subscribeConnectionEvents(n);
|
|
6274
6379
|
}
|
|
6275
6380
|
get isIdle() {
|
|
6276
6381
|
return this.hasState(l.IDLE);
|
|
@@ -6316,7 +6421,7 @@ class ro extends ee {
|
|
|
6316
6421
|
}
|
|
6317
6422
|
sendEvent(e) {
|
|
6318
6423
|
if (!this.actor.getSnapshot().can(e)) {
|
|
6319
|
-
|
|
6424
|
+
Co(
|
|
6320
6425
|
`[IncomingCallStateMachine] Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`
|
|
6321
6426
|
);
|
|
6322
6427
|
return;
|
|
@@ -6361,25 +6466,25 @@ class ro extends ee {
|
|
|
6361
6466
|
this.sendEvent({ type: R.CLEAR });
|
|
6362
6467
|
};
|
|
6363
6468
|
}
|
|
6364
|
-
const
|
|
6469
|
+
const Ro = 486, No = 487, _e = (t) => ({
|
|
6365
6470
|
displayName: t.remote_identity.display_name,
|
|
6366
6471
|
host: t.remote_identity.uri.host,
|
|
6367
6472
|
incomingNumber: t.remote_identity.uri.user,
|
|
6368
6473
|
rtcSession: t
|
|
6369
6474
|
});
|
|
6370
|
-
class
|
|
6475
|
+
class Io extends w {
|
|
6371
6476
|
stateMachine;
|
|
6372
6477
|
incomingRTCSession;
|
|
6373
6478
|
connectionManager;
|
|
6374
6479
|
constructor(e) {
|
|
6375
|
-
super(
|
|
6480
|
+
super(go()), this.connectionManager = e, this.stateMachine = new po({
|
|
6376
6481
|
incomingEvents: this.events,
|
|
6377
6482
|
connectionEvents: this.connectionManager.events
|
|
6378
6483
|
}), this.start();
|
|
6379
6484
|
}
|
|
6380
6485
|
get remoteCallerData() {
|
|
6381
6486
|
if (this.incomingRTCSession)
|
|
6382
|
-
return
|
|
6487
|
+
return _e(this.incomingRTCSession);
|
|
6383
6488
|
}
|
|
6384
6489
|
get isAvailableIncomingCall() {
|
|
6385
6490
|
return !!this.incomingRTCSession;
|
|
@@ -6401,11 +6506,11 @@ class oo extends G {
|
|
|
6401
6506
|
return this.stateMachine.toConsumed(), this.removeIncomingSession(), e;
|
|
6402
6507
|
};
|
|
6403
6508
|
async declineToIncomingCall({
|
|
6404
|
-
statusCode: e =
|
|
6509
|
+
statusCode: e = No
|
|
6405
6510
|
} = {}) {
|
|
6406
6511
|
return new Promise((n, s) => {
|
|
6407
6512
|
try {
|
|
6408
|
-
const r = this.getIncomingRTCSession(), i =
|
|
6513
|
+
const r = this.getIncomingRTCSession(), i = _e(r);
|
|
6409
6514
|
this.removeIncomingSession(), this.events.trigger("declinedIncomingCall", i), r.terminate({ status_code: e }), n();
|
|
6410
6515
|
} catch (r) {
|
|
6411
6516
|
s(r);
|
|
@@ -6413,7 +6518,7 @@ class oo extends G {
|
|
|
6413
6518
|
});
|
|
6414
6519
|
}
|
|
6415
6520
|
async busyIncomingCall() {
|
|
6416
|
-
return this.declineToIncomingCall({ statusCode:
|
|
6521
|
+
return this.declineToIncomingCall({ statusCode: Ro });
|
|
6417
6522
|
}
|
|
6418
6523
|
subscribe() {
|
|
6419
6524
|
this.connectionManager.on("newRTCSession", this.handleNewRTCSession);
|
|
@@ -6429,7 +6534,7 @@ class oo extends G {
|
|
|
6429
6534
|
};
|
|
6430
6535
|
setIncomingSession(e) {
|
|
6431
6536
|
this.incomingRTCSession = e;
|
|
6432
|
-
const n =
|
|
6537
|
+
const n = _e(e);
|
|
6433
6538
|
e.on("failed", (s) => {
|
|
6434
6539
|
this.removeIncomingSession(), s.originator === "local" ? this.events.trigger("terminatedIncomingCall", n) : this.events.trigger("failedIncomingCall", n);
|
|
6435
6540
|
}), this.events.trigger("ringing", n);
|
|
@@ -6438,7 +6543,7 @@ class oo extends G {
|
|
|
6438
6543
|
delete this.incomingRTCSession;
|
|
6439
6544
|
}
|
|
6440
6545
|
}
|
|
6441
|
-
class
|
|
6546
|
+
class Ao {
|
|
6442
6547
|
apiManager;
|
|
6443
6548
|
connectionManager;
|
|
6444
6549
|
callManager;
|
|
@@ -6474,26 +6579,28 @@ class co {
|
|
|
6474
6579
|
s.sendEnterRoom(r);
|
|
6475
6580
|
};
|
|
6476
6581
|
}
|
|
6477
|
-
const
|
|
6582
|
+
const Jt = ["snapshot-changed"], vo = () => new G(Jt), fo = (t, e) => Object.is(t, e), st = (t, e) => t.connection.value === e.connection.value && // Call: full snapshot so room/context updates without a state `value` change still emit snapshot-changed
|
|
6583
|
+
vn(t.call, e.call) && // Incoming: value only — repeated RINGING with different callee metadata must not emit again
|
|
6584
|
+
t.incoming.value === e.incoming.value && t.presentation.value === e.presentation.value && t.autoConnector.value === e.autoConnector.value, rt = (t) => ({
|
|
6478
6585
|
connection: t.connection.getSnapshot(),
|
|
6479
6586
|
call: t.call.getSnapshot(),
|
|
6480
6587
|
incoming: t.incoming.getSnapshot(),
|
|
6481
6588
|
presentation: t.presentation.getSnapshot(),
|
|
6482
6589
|
autoConnector: t.autoConnector.getSnapshot()
|
|
6483
6590
|
});
|
|
6484
|
-
class
|
|
6591
|
+
class Mo extends w {
|
|
6485
6592
|
machines;
|
|
6486
6593
|
currentSnapshot;
|
|
6487
6594
|
subscribers = /* @__PURE__ */ new Set();
|
|
6488
6595
|
actorSubscriptions = [];
|
|
6489
6596
|
constructor(e) {
|
|
6490
|
-
super(
|
|
6597
|
+
super(vo()), this.machines = {
|
|
6491
6598
|
connection: e.connectionManager.stateMachine,
|
|
6492
6599
|
call: e.callManager.stateMachine,
|
|
6493
6600
|
incoming: e.incomingCallManager.stateMachine,
|
|
6494
6601
|
presentation: e.presentationManager.stateMachine,
|
|
6495
6602
|
autoConnector: e.autoConnectorManager.stateMachine
|
|
6496
|
-
}, this.currentSnapshot =
|
|
6603
|
+
}, this.currentSnapshot = rt(this.machines), this.actorSubscriptions.push(
|
|
6497
6604
|
this.machines.connection.subscribe(this.notifySubscribers),
|
|
6498
6605
|
this.machines.call.subscribe(this.notifySubscribers),
|
|
6499
6606
|
this.machines.incoming.subscribe(this.notifySubscribers),
|
|
@@ -6505,7 +6612,7 @@ class uo extends G {
|
|
|
6505
6612
|
return this.currentSnapshot;
|
|
6506
6613
|
}
|
|
6507
6614
|
subscribe(e, n, s) {
|
|
6508
|
-
const r = typeof n == "function", i = r ? e : (I) => I, a = r ? n : e, c = r ? s ??
|
|
6615
|
+
const r = typeof n == "function", i = r ? e : (I) => I, a = r ? n : e, c = r ? s ?? fo : st, E = i(this.currentSnapshot), p = {
|
|
6509
6616
|
selector: i,
|
|
6510
6617
|
listener: a,
|
|
6511
6618
|
equals: c,
|
|
@@ -6522,8 +6629,8 @@ class uo extends G {
|
|
|
6522
6629
|
}
|
|
6523
6630
|
notifySubscribers = () => {
|
|
6524
6631
|
const e = this.currentSnapshot;
|
|
6525
|
-
this.currentSnapshot =
|
|
6526
|
-
const n =
|
|
6632
|
+
this.currentSnapshot = rt(this.machines);
|
|
6633
|
+
const n = st(e, this.currentSnapshot);
|
|
6527
6634
|
for (const s of this.subscribers) {
|
|
6528
6635
|
const r = s.selector(this.currentSnapshot);
|
|
6529
6636
|
s.equals(s.current, r) || (s.current = r, s.listener(r));
|
|
@@ -6535,11 +6642,11 @@ class uo extends G {
|
|
|
6535
6642
|
};
|
|
6536
6643
|
}
|
|
6537
6644
|
const ie = 1e3;
|
|
6538
|
-
var
|
|
6539
|
-
const
|
|
6645
|
+
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 Kt = ["collected", "stopped"], _o = () => new G(Kt), it = () => "performance" in window ? performance.now() : Date.now(), le = (t) => [...t.keys()].reduce((e, n) => {
|
|
6540
6647
|
const s = t.get(n);
|
|
6541
6648
|
return s === void 0 ? e : { ...e, [s.type]: s };
|
|
6542
|
-
}, {}),
|
|
6649
|
+
}, {}), Oo = (t) => {
|
|
6543
6650
|
if (!t)
|
|
6544
6651
|
return {
|
|
6545
6652
|
outboundRtp: void 0,
|
|
@@ -6547,14 +6654,14 @@ const zt = ["collected", "stopped"], Eo = () => new F(zt), st = () => "performan
|
|
|
6547
6654
|
mediaSource: void 0,
|
|
6548
6655
|
remoteInboundRtp: void 0
|
|
6549
6656
|
};
|
|
6550
|
-
const e =
|
|
6657
|
+
const e = le(t);
|
|
6551
6658
|
return {
|
|
6552
|
-
outboundRtp: e[
|
|
6553
|
-
codec: e[
|
|
6554
|
-
mediaSource: e[
|
|
6555
|
-
remoteInboundRtp: e[
|
|
6659
|
+
outboundRtp: e[P.OUTBOUND_RTP],
|
|
6660
|
+
codec: e[P.CODEC],
|
|
6661
|
+
mediaSource: e[P.MEDIA_SOURCE],
|
|
6662
|
+
remoteInboundRtp: e[P.REMOTE_INBOUND_RTP]
|
|
6556
6663
|
};
|
|
6557
|
-
},
|
|
6664
|
+
}, at = (t) => {
|
|
6558
6665
|
if (!t)
|
|
6559
6666
|
return {
|
|
6560
6667
|
outboundRtp: void 0,
|
|
@@ -6562,14 +6669,14 @@ const zt = ["collected", "stopped"], Eo = () => new F(zt), st = () => "performan
|
|
|
6562
6669
|
mediaSource: void 0,
|
|
6563
6670
|
remoteInboundRtp: void 0
|
|
6564
6671
|
};
|
|
6565
|
-
const e =
|
|
6672
|
+
const e = le(t);
|
|
6566
6673
|
return {
|
|
6567
|
-
outboundRtp: e[
|
|
6568
|
-
codec: e[
|
|
6569
|
-
mediaSource: e[
|
|
6570
|
-
remoteInboundRtp: e[
|
|
6674
|
+
outboundRtp: e[P.OUTBOUND_RTP],
|
|
6675
|
+
codec: e[P.CODEC],
|
|
6676
|
+
mediaSource: e[P.MEDIA_SOURCE],
|
|
6677
|
+
remoteInboundRtp: e[P.REMOTE_INBOUND_RTP]
|
|
6571
6678
|
};
|
|
6572
|
-
},
|
|
6679
|
+
}, ot = ({
|
|
6573
6680
|
videoReceiversStats: t,
|
|
6574
6681
|
synchronizationSourcesVideo: e
|
|
6575
6682
|
}) => {
|
|
@@ -6579,13 +6686,13 @@ const zt = ["collected", "stopped"], Eo = () => new F(zt), st = () => "performan
|
|
|
6579
6686
|
codec: void 0,
|
|
6580
6687
|
synchronizationSources: e
|
|
6581
6688
|
};
|
|
6582
|
-
const n =
|
|
6689
|
+
const n = le(t);
|
|
6583
6690
|
return {
|
|
6584
|
-
inboundRtp: n[
|
|
6585
|
-
codec: n[
|
|
6691
|
+
inboundRtp: n[P.INBOUND_RTP],
|
|
6692
|
+
codec: n[P.CODEC],
|
|
6586
6693
|
synchronizationSources: e
|
|
6587
6694
|
};
|
|
6588
|
-
},
|
|
6695
|
+
}, bo = ({
|
|
6589
6696
|
audioReceiverStats: t,
|
|
6590
6697
|
synchronizationSourcesAudio: e
|
|
6591
6698
|
}) => {
|
|
@@ -6596,14 +6703,14 @@ const zt = ["collected", "stopped"], Eo = () => new F(zt), st = () => "performan
|
|
|
6596
6703
|
remoteOutboundRtp: void 0,
|
|
6597
6704
|
synchronizationSources: e
|
|
6598
6705
|
};
|
|
6599
|
-
const n =
|
|
6706
|
+
const n = le(t);
|
|
6600
6707
|
return {
|
|
6601
|
-
inboundRtp: n[
|
|
6602
|
-
codec: n[
|
|
6603
|
-
remoteOutboundRtp: n[
|
|
6708
|
+
inboundRtp: n[P.INBOUND_RTP],
|
|
6709
|
+
codec: n[P.CODEC],
|
|
6710
|
+
remoteOutboundRtp: n[P.REMOTE_OUTBOUND_RTP],
|
|
6604
6711
|
synchronizationSources: e
|
|
6605
6712
|
};
|
|
6606
|
-
},
|
|
6713
|
+
}, Xt = (t) => {
|
|
6607
6714
|
if (!t)
|
|
6608
6715
|
return {
|
|
6609
6716
|
candidatePair: void 0,
|
|
@@ -6612,47 +6719,47 @@ const zt = ["collected", "stopped"], Eo = () => new F(zt), st = () => "performan
|
|
|
6612
6719
|
remoteCandidate: void 0,
|
|
6613
6720
|
transport: void 0
|
|
6614
6721
|
};
|
|
6615
|
-
const e =
|
|
6722
|
+
const e = le(t);
|
|
6616
6723
|
return {
|
|
6617
|
-
candidatePair: e[
|
|
6618
|
-
certificate: e[
|
|
6619
|
-
localCandidate: e[
|
|
6620
|
-
remoteCandidate: e[
|
|
6621
|
-
transport: e[
|
|
6724
|
+
candidatePair: e[P.CANDIDATE_PAIR],
|
|
6725
|
+
certificate: e[P.CERTIFICATE],
|
|
6726
|
+
localCandidate: e[P.LOCAL_CANDIDATE],
|
|
6727
|
+
remoteCandidate: e[P.REMOTE_CANDIDATE],
|
|
6728
|
+
transport: e[P.TRANSPORT]
|
|
6622
6729
|
};
|
|
6623
|
-
},
|
|
6730
|
+
}, Po = ({
|
|
6624
6731
|
audioSenderStats: t,
|
|
6625
6732
|
videoSenderFirstStats: e,
|
|
6626
6733
|
videoSenderSecondStats: n
|
|
6627
6734
|
}) => ({
|
|
6628
|
-
video:
|
|
6629
|
-
secondVideo:
|
|
6630
|
-
audio:
|
|
6631
|
-
additional:
|
|
6735
|
+
video: at(e),
|
|
6736
|
+
secondVideo: at(n),
|
|
6737
|
+
audio: Oo(t),
|
|
6738
|
+
additional: Xt(
|
|
6632
6739
|
t ?? e ?? n
|
|
6633
6740
|
)
|
|
6634
|
-
}),
|
|
6741
|
+
}), yo = ({
|
|
6635
6742
|
audioReceiverStats: t,
|
|
6636
6743
|
videoReceiverFirstStats: e,
|
|
6637
6744
|
videoReceiverSecondStats: n,
|
|
6638
6745
|
synchronizationSources: s
|
|
6639
6746
|
}) => ({
|
|
6640
|
-
video:
|
|
6747
|
+
video: ot({
|
|
6641
6748
|
videoReceiversStats: e,
|
|
6642
6749
|
synchronizationSourcesVideo: s.video
|
|
6643
6750
|
}),
|
|
6644
|
-
secondVideo:
|
|
6751
|
+
secondVideo: ot({
|
|
6645
6752
|
videoReceiversStats: n,
|
|
6646
6753
|
synchronizationSourcesVideo: s.secondVideo ?? s.video
|
|
6647
6754
|
}),
|
|
6648
|
-
audio:
|
|
6755
|
+
audio: bo({
|
|
6649
6756
|
audioReceiverStats: t,
|
|
6650
6757
|
synchronizationSourcesAudio: s.audio
|
|
6651
6758
|
}),
|
|
6652
|
-
additional:
|
|
6759
|
+
additional: Xt(
|
|
6653
6760
|
t ?? e ?? n
|
|
6654
6761
|
)
|
|
6655
|
-
}),
|
|
6762
|
+
}), Do = ({
|
|
6656
6763
|
audioSenderStats: t,
|
|
6657
6764
|
videoSenderFirstStats: e,
|
|
6658
6765
|
videoSenderSecondStats: n,
|
|
@@ -6661,11 +6768,11 @@ const zt = ["collected", "stopped"], Eo = () => new F(zt), st = () => "performan
|
|
|
6661
6768
|
videoReceiverSecondStats: i,
|
|
6662
6769
|
synchronizationSources: a
|
|
6663
6770
|
}) => {
|
|
6664
|
-
const o =
|
|
6771
|
+
const o = Po({
|
|
6665
6772
|
audioSenderStats: t,
|
|
6666
6773
|
videoSenderFirstStats: e,
|
|
6667
6774
|
videoSenderSecondStats: n
|
|
6668
|
-
}), c =
|
|
6775
|
+
}), c = yo({
|
|
6669
6776
|
audioReceiverStats: s,
|
|
6670
6777
|
videoReceiverFirstStats: r,
|
|
6671
6778
|
videoReceiverSecondStats: i,
|
|
@@ -6675,7 +6782,7 @@ const zt = ["collected", "stopped"], Eo = () => new F(zt), st = () => "performan
|
|
|
6675
6782
|
outbound: o,
|
|
6676
6783
|
inbound: c
|
|
6677
6784
|
};
|
|
6678
|
-
},
|
|
6785
|
+
}, Lo = async (t) => {
|
|
6679
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), E = {
|
|
6680
6787
|
trackIdentifier: o?.track.id,
|
|
6681
6788
|
item: o?.getSynchronizationSources()[0]
|
|
@@ -6700,35 +6807,35 @@ const zt = ["collected", "stopped"], Eo = () => new F(zt), st = () => "performan
|
|
|
6700
6807
|
]).then((_) => {
|
|
6701
6808
|
const [
|
|
6702
6809
|
W,
|
|
6703
|
-
|
|
6810
|
+
L,
|
|
6704
6811
|
z,
|
|
6705
6812
|
te,
|
|
6706
|
-
|
|
6707
|
-
|
|
6813
|
+
Fe,
|
|
6814
|
+
cn
|
|
6708
6815
|
] = _;
|
|
6709
6816
|
return {
|
|
6710
6817
|
synchronizationSources: b,
|
|
6711
6818
|
audioSenderStats: W,
|
|
6712
|
-
videoSenderFirstStats:
|
|
6819
|
+
videoSenderFirstStats: L,
|
|
6713
6820
|
videoSenderSecondStats: z,
|
|
6714
6821
|
audioReceiverStats: te,
|
|
6715
|
-
videoReceiverFirstStats:
|
|
6716
|
-
videoReceiverSecondStats:
|
|
6822
|
+
videoReceiverFirstStats: Fe,
|
|
6823
|
+
videoReceiverSecondStats: cn
|
|
6717
6824
|
};
|
|
6718
6825
|
});
|
|
6719
|
-
},
|
|
6720
|
-
class
|
|
6826
|
+
}, wo = A("StatsPeerConnection");
|
|
6827
|
+
class Go extends w {
|
|
6721
6828
|
setTimeoutRequest;
|
|
6722
|
-
requesterAllStatistics = new
|
|
6829
|
+
requesterAllStatistics = new pe(Lo);
|
|
6723
6830
|
constructor() {
|
|
6724
|
-
super(
|
|
6831
|
+
super(_o()), this.setTimeoutRequest = new ht();
|
|
6725
6832
|
}
|
|
6726
6833
|
get requested() {
|
|
6727
6834
|
return this.setTimeoutRequest.requested;
|
|
6728
6835
|
}
|
|
6729
6836
|
start(e, {
|
|
6730
6837
|
interval: n = ie,
|
|
6731
|
-
onError: s =
|
|
6838
|
+
onError: s = wo
|
|
6732
6839
|
} = {}) {
|
|
6733
6840
|
this.setTimeoutRequest.request(() => {
|
|
6734
6841
|
this.collectStatistics(e, {
|
|
@@ -6751,10 +6858,10 @@ class No extends G {
|
|
|
6751
6858
|
onError: n,
|
|
6752
6859
|
onSuccess: s
|
|
6753
6860
|
}) => {
|
|
6754
|
-
const r =
|
|
6861
|
+
const r = it();
|
|
6755
6862
|
this.requestAllStatistics(e).then((i) => {
|
|
6756
|
-
this.events.trigger("collected",
|
|
6757
|
-
const o =
|
|
6863
|
+
this.events.trigger("collected", Do(i));
|
|
6864
|
+
const o = it() - r;
|
|
6758
6865
|
let c = ie;
|
|
6759
6866
|
o > 48 ? c = ie * 4 : o > 32 ? c = ie * 3 : o > 16 && (c = ie * 2), s({ interval: c });
|
|
6760
6867
|
}).catch((i) => {
|
|
@@ -6768,8 +6875,8 @@ class No extends G {
|
|
|
6768
6875
|
return this.requesterAllStatistics.request(n);
|
|
6769
6876
|
};
|
|
6770
6877
|
}
|
|
6771
|
-
const
|
|
6772
|
-
class
|
|
6878
|
+
const ko = 500, Uo = A("StatsManager");
|
|
6879
|
+
class Fo extends w {
|
|
6773
6880
|
statsPeerConnection;
|
|
6774
6881
|
availableStats;
|
|
6775
6882
|
previousAvailableStats;
|
|
@@ -6779,7 +6886,7 @@ class vo extends G {
|
|
|
6779
6886
|
callManager: e,
|
|
6780
6887
|
apiManager: n
|
|
6781
6888
|
}) {
|
|
6782
|
-
const s = new
|
|
6889
|
+
const s = new Go();
|
|
6783
6890
|
super(s.events), this.statsPeerConnection = s, this.callManager = e, this.apiManager = n, this.subscribe();
|
|
6784
6891
|
}
|
|
6785
6892
|
get availableIncomingBitrate() {
|
|
@@ -6842,7 +6949,7 @@ class vo extends G {
|
|
|
6842
6949
|
return this.previousInboundRtp?.bytesReceived;
|
|
6843
6950
|
}
|
|
6844
6951
|
get isReceivingPackets() {
|
|
6845
|
-
const e = this.packetsReceived !== void 0 && this.packetsReceived >=
|
|
6952
|
+
const e = this.packetsReceived !== void 0 && this.packetsReceived >= ko, n = this.packetsReceived !== this.previousPacketsReceived;
|
|
6846
6953
|
return e && n;
|
|
6847
6954
|
}
|
|
6848
6955
|
hasAvailableIncomingBitrateChangedQuarter() {
|
|
@@ -6878,42 +6985,42 @@ class vo extends G {
|
|
|
6878
6985
|
};
|
|
6879
6986
|
maybeSendStats() {
|
|
6880
6987
|
this.availableIncomingBitrate !== void 0 && this.hasAvailableIncomingBitrateChangedQuarter() && this.apiManager.sendStats({ availableIncomingBitrate: this.availableIncomingBitrate }).catch((e) => {
|
|
6881
|
-
|
|
6988
|
+
Uo("Failed to send stats", e);
|
|
6882
6989
|
});
|
|
6883
6990
|
}
|
|
6884
6991
|
}
|
|
6885
|
-
const
|
|
6992
|
+
const Bo = A("setCodecPreferences"), $o = (t, e) => t.filter((s) => e.some((r) => r.clockRate === s.clockRate && r.mimeType === s.mimeType && r.channels === s.channels && r.sdpFmtpLine === s.sdpFmtpLine)), xo = (t) => {
|
|
6886
6993
|
const e = RTCRtpSender.getCapabilities(t), n = RTCRtpReceiver.getCapabilities(t), s = e === null ? [] : e.codecs, r = n === null ? [] : n.codecs;
|
|
6887
|
-
return
|
|
6888
|
-
},
|
|
6994
|
+
return $o(s, r);
|
|
6995
|
+
}, Vo = (t, e) => e === void 0 || e.length === 0 ? t : t.sort((n, s) => {
|
|
6889
6996
|
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;
|
|
6890
6997
|
return a - o;
|
|
6891
|
-
}),
|
|
6998
|
+
}), qo = (t, e) => e === void 0 || e.length === 0 ? t : t.filter((n) => !e.includes(n.mimeType)), Ho = (t, {
|
|
6892
6999
|
preferredMimeTypesVideoCodecs: e,
|
|
6893
7000
|
excludeMimeTypesVideoCodecs: n
|
|
6894
7001
|
}) => {
|
|
6895
7002
|
try {
|
|
6896
7003
|
if (typeof t.setCodecPreferences == "function" && t.sender.track?.kind === "video" && (e !== void 0 && e.length > 0 || n !== void 0 && n.length > 0)) {
|
|
6897
|
-
const s =
|
|
7004
|
+
const s = xo("video"), r = qo(s, n), i = Vo(r, e);
|
|
6898
7005
|
t.setCodecPreferences(i);
|
|
6899
7006
|
}
|
|
6900
7007
|
} catch (s) {
|
|
6901
|
-
|
|
7008
|
+
Bo("setCodecPreferences error", s);
|
|
6902
7009
|
}
|
|
6903
|
-
},
|
|
7010
|
+
}, Zt = [
|
|
6904
7011
|
"balancing-scheduled",
|
|
6905
7012
|
"balancing-started",
|
|
6906
7013
|
"balancing-stopped",
|
|
6907
7014
|
"parameters-updated"
|
|
6908
|
-
],
|
|
6909
|
-
class
|
|
7015
|
+
], Wo = () => new G(Zt), Qo = A("VideoSendingBalancerManager");
|
|
7016
|
+
class Yo extends w {
|
|
6910
7017
|
isBalancingActive = !1;
|
|
6911
7018
|
callManager;
|
|
6912
7019
|
balancingStartDelay;
|
|
6913
7020
|
videoSendingBalancer;
|
|
6914
7021
|
startBalancingTimer;
|
|
6915
7022
|
constructor(e, n, s = {}) {
|
|
6916
|
-
super(
|
|
7023
|
+
super(Wo()), this.callManager = e, this.balancingStartDelay = s.balancingStartDelay ?? 1e4, this.videoSendingBalancer = new va(
|
|
6917
7024
|
n,
|
|
6918
7025
|
() => e.connection,
|
|
6919
7026
|
{
|
|
@@ -6969,7 +7076,7 @@ class Lo extends G {
|
|
|
6969
7076
|
scheduleBalancingStart() {
|
|
6970
7077
|
this.clearStartTimer(), this.startBalancingTimer = setTimeout(() => {
|
|
6971
7078
|
this.startBalancingTimer = void 0, this.startBalancing().catch((e) => {
|
|
6972
|
-
|
|
7079
|
+
Qo("startBalancing: error", e);
|
|
6973
7080
|
});
|
|
6974
7081
|
}, this.balancingStartDelay), this.events.trigger("balancing-scheduled", { delay: this.balancingStartDelay });
|
|
6975
7082
|
}
|
|
@@ -6977,21 +7084,21 @@ class Lo extends G {
|
|
|
6977
7084
|
this.startBalancingTimer && (clearTimeout(this.startBalancingTimer), this.startBalancingTimer = void 0);
|
|
6978
7085
|
}
|
|
6979
7086
|
}
|
|
6980
|
-
const
|
|
6981
|
-
Xt,
|
|
6982
|
-
Zt,
|
|
7087
|
+
const en = "health-snapshot", tn = "inbound-video-problem-detected", nn = "inbound-video-problem-resolved", sn = "inbound-video-problem-reset", rn = [
|
|
6983
7088
|
en,
|
|
6984
|
-
tn
|
|
6985
|
-
|
|
6986
|
-
|
|
7089
|
+
tn,
|
|
7090
|
+
nn,
|
|
7091
|
+
sn
|
|
7092
|
+
], jo = () => new G(rn), zo = 3;
|
|
7093
|
+
class ce extends w {
|
|
6987
7094
|
statsManager;
|
|
6988
7095
|
callManager;
|
|
6989
7096
|
minConsecutiveProblemSamplesCount;
|
|
6990
7097
|
consecutiveProblemSamplesCount = 0;
|
|
6991
7098
|
currentProblemReason;
|
|
6992
7099
|
hasEmittedCurrentProblem = !1;
|
|
6993
|
-
constructor(e, n, s =
|
|
6994
|
-
super(
|
|
7100
|
+
constructor(e, n, s = zo) {
|
|
7101
|
+
super(jo()), this.statsManager = e, this.callManager = n, ce.assertValidMinConsecutiveProblemSamplesCount(
|
|
6995
7102
|
s
|
|
6996
7103
|
), this.minConsecutiveProblemSamplesCount = s, this.subscribe();
|
|
6997
7104
|
}
|
|
@@ -7038,13 +7145,13 @@ class ce extends G {
|
|
|
7038
7145
|
}
|
|
7039
7146
|
handleStatsCollected = () => {
|
|
7040
7147
|
const { healthSnapshot: e } = this;
|
|
7041
|
-
this.events.trigger(
|
|
7148
|
+
this.events.trigger(en, e);
|
|
7042
7149
|
const n = ce.resolveProblemReason(e);
|
|
7043
7150
|
if (n === void 0) {
|
|
7044
7151
|
this.maybeEmitResolvedProblem(e), this.resetProblemDetectionState();
|
|
7045
7152
|
return;
|
|
7046
7153
|
}
|
|
7047
|
-
this.updateProblemDetectionState(n), this.consecutiveProblemSamplesCount >= this.minConsecutiveProblemSamplesCount && !this.hasEmittedCurrentProblem && (this.events.trigger(
|
|
7154
|
+
this.updateProblemDetectionState(n), this.consecutiveProblemSamplesCount >= this.minConsecutiveProblemSamplesCount && !this.hasEmittedCurrentProblem && (this.events.trigger(tn, {
|
|
7048
7155
|
...e,
|
|
7049
7156
|
consecutiveProblemSamplesCount: this.consecutiveProblemSamplesCount,
|
|
7050
7157
|
reason: n
|
|
@@ -7064,7 +7171,7 @@ class ce extends G {
|
|
|
7064
7171
|
this.currentProblemReason = e, this.consecutiveProblemSamplesCount = 1, this.hasEmittedCurrentProblem = !1;
|
|
7065
7172
|
};
|
|
7066
7173
|
maybeEmitResolvedProblem = (e) => {
|
|
7067
|
-
!this.hasEmittedCurrentProblem || this.currentProblemReason === void 0 || this.events.trigger(
|
|
7174
|
+
!this.hasEmittedCurrentProblem || this.currentProblemReason === void 0 || this.events.trigger(nn, {
|
|
7068
7175
|
...e,
|
|
7069
7176
|
reason: this.currentProblemReason
|
|
7070
7177
|
});
|
|
@@ -7073,7 +7180,7 @@ class ce extends G {
|
|
|
7073
7180
|
this.maybeEmitResetProblem(e), this.resetProblemDetectionState();
|
|
7074
7181
|
};
|
|
7075
7182
|
maybeEmitResetProblem = (e) => {
|
|
7076
|
-
!this.hasEmittedCurrentProblem || this.currentProblemReason === void 0 || this.events.trigger(
|
|
7183
|
+
!this.hasEmittedCurrentProblem || this.currentProblemReason === void 0 || this.events.trigger(sn, {
|
|
7077
7184
|
reason: this.currentProblemReason,
|
|
7078
7185
|
resetCause: e
|
|
7079
7186
|
});
|
|
@@ -7082,20 +7189,20 @@ class ce extends G {
|
|
|
7082
7189
|
this.currentProblemReason = void 0, this.consecutiveProblemSamplesCount = 0, this.hasEmittedCurrentProblem = !1;
|
|
7083
7190
|
};
|
|
7084
7191
|
}
|
|
7085
|
-
const J = A("MainStreamRecovery"),
|
|
7086
|
-
class
|
|
7192
|
+
const J = A("MainStreamRecovery"), Jo = 4e3;
|
|
7193
|
+
class Ce {
|
|
7087
7194
|
renegotiateRequester;
|
|
7088
7195
|
renegotiateThrottled;
|
|
7089
7196
|
callManager;
|
|
7090
|
-
constructor(e, n =
|
|
7091
|
-
this.callManager = e, this.renegotiateRequester = new
|
|
7197
|
+
constructor(e, n = Jo) {
|
|
7198
|
+
this.callManager = e, this.renegotiateRequester = new pe(e.renegotiate.bind(e)), this.renegotiateThrottled = this.createRenegotiateThrottled(n), this.subscribe();
|
|
7092
7199
|
}
|
|
7093
7200
|
static assertValidThrottleRecoveryTimeout(e) {
|
|
7094
7201
|
if (!Number.isInteger(e) || e < 1)
|
|
7095
7202
|
throw new Error("throttleRecoveryTimeout should be a positive integer");
|
|
7096
7203
|
}
|
|
7097
7204
|
setThrottleRecoveryTimeout(e) {
|
|
7098
|
-
|
|
7205
|
+
Ce.assertValidThrottleRecoveryTimeout(e), this.renegotiateThrottled.cancel(), this.renegotiateThrottled = this.createRenegotiateThrottled(e);
|
|
7099
7206
|
}
|
|
7100
7207
|
// Запускает recovery: фактически вызывает throttled-версию requestRenegotiate.
|
|
7101
7208
|
recover() {
|
|
@@ -7114,7 +7221,7 @@ class Se {
|
|
|
7114
7221
|
});
|
|
7115
7222
|
};
|
|
7116
7223
|
createRenegotiateThrottled(e) {
|
|
7117
|
-
return
|
|
7224
|
+
return Ce.assertValidThrottleRecoveryTimeout(e), An.throttle(this.requestRenegotiate.bind(this), e);
|
|
7118
7225
|
}
|
|
7119
7226
|
// На завершение вызова: отменяем throttling и (если есть) in-flight renegotiate.
|
|
7120
7227
|
subscribe() {
|
|
@@ -7127,53 +7234,54 @@ class Se {
|
|
|
7127
7234
|
J("cancel recover main stream"), this.renegotiateThrottled.cancel(), this.renegotiateRequester.cancelRequest();
|
|
7128
7235
|
}
|
|
7129
7236
|
}
|
|
7130
|
-
var
|
|
7131
|
-
const
|
|
7237
|
+
var an = /* @__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))(an || {});
|
|
7238
|
+
const Ko = {
|
|
7132
7239
|
major: 25,
|
|
7133
7240
|
minor: 8,
|
|
7134
7241
|
patch: 0
|
|
7135
|
-
},
|
|
7242
|
+
}, Xo = ({
|
|
7136
7243
|
isYandexBrowser: t,
|
|
7137
7244
|
hasGreaterThanBrowserVersion: e
|
|
7138
7245
|
}) => {
|
|
7139
7246
|
const n = e(
|
|
7140
|
-
|
|
7247
|
+
Ko
|
|
7141
7248
|
);
|
|
7142
7249
|
return t && n;
|
|
7143
|
-
},
|
|
7144
|
-
const t =
|
|
7145
|
-
if (
|
|
7146
|
-
return [
|
|
7147
|
-
},
|
|
7148
|
-
const { isMobileDevice: t, isSafari: e, isOpera: n, isWindows: s } =
|
|
7250
|
+
}, Zo = () => {
|
|
7251
|
+
const t = bt();
|
|
7252
|
+
if (Xo(t))
|
|
7253
|
+
return [an.VP8];
|
|
7254
|
+
}, ec = () => {
|
|
7255
|
+
const { isMobileDevice: t, isSafari: e, isOpera: n, isWindows: s } = bt();
|
|
7149
7256
|
return t || e || n && s;
|
|
7150
7257
|
};
|
|
7151
|
-
let
|
|
7152
|
-
|
|
7153
|
-
const
|
|
7154
|
-
ignoreForCodec:
|
|
7155
|
-
},
|
|
7258
|
+
let on;
|
|
7259
|
+
ec() && (on = "h264");
|
|
7260
|
+
const tc = {
|
|
7261
|
+
ignoreForCodec: on
|
|
7262
|
+
}, nc = Zo(), sc = 1e6, rc = vt.map((t) => `auto-connect:${t}`), ic = At.map((t) => `connection:${t}`), ac = Ot.map((t) => `call:${t}`), oc = Ct.map((t) => `api:${t}`), cc = jt.map((t) => `incoming-call:${t}`), dc = Qt.map((t) => `presentation:${t}`), lc = Kt.map((t) => `stats:${t}`), hc = Zt.map((t) => `video-balancer:${t}`), uc = rn.map((t) => `main-stream-health:${t}`), Ec = Jt.map((t) => `session:${t}`), gc = [
|
|
7156
7263
|
"disconnected-from-out-of-call",
|
|
7157
7264
|
"connected-with-configuration-from-out-of-call",
|
|
7158
7265
|
"stopped-presentation-by-server-command"
|
|
7159
|
-
],
|
|
7160
|
-
...
|
|
7161
|
-
...
|
|
7162
|
-
...
|
|
7163
|
-
...
|
|
7164
|
-
...
|
|
7165
|
-
...
|
|
7166
|
-
...
|
|
7167
|
-
...
|
|
7168
|
-
...
|
|
7169
|
-
...
|
|
7170
|
-
...
|
|
7171
|
-
],
|
|
7172
|
-
class
|
|
7266
|
+
], Tc = [
|
|
7267
|
+
...rc,
|
|
7268
|
+
...ic,
|
|
7269
|
+
...ac,
|
|
7270
|
+
...oc,
|
|
7271
|
+
...cc,
|
|
7272
|
+
...dc,
|
|
7273
|
+
...lc,
|
|
7274
|
+
...hc,
|
|
7275
|
+
...uc,
|
|
7276
|
+
...Ec,
|
|
7277
|
+
...gc
|
|
7278
|
+
], mc = () => new G(Tc), ct = A("SipConnector");
|
|
7279
|
+
class Uc extends w {
|
|
7173
7280
|
connectionManager;
|
|
7174
7281
|
connectionQueueManager;
|
|
7175
7282
|
contentedStreamManager;
|
|
7176
7283
|
callManager;
|
|
7284
|
+
callSessionState;
|
|
7177
7285
|
autoConnectorManager;
|
|
7178
7286
|
apiManager;
|
|
7179
7287
|
incomingCallManager;
|
|
@@ -7195,33 +7303,34 @@ class Ac extends G {
|
|
|
7195
7303
|
minConsecutiveProblemSamplesCount: o,
|
|
7196
7304
|
throttleRecoveryTimeout: c
|
|
7197
7305
|
} = {}) {
|
|
7198
|
-
super(
|
|
7306
|
+
super(mc()), this.preferredMimeTypesVideoCodecs = n ?? nc, this.excludeMimeTypesVideoCodecs = s, this.apiManager = new Un(), this.connectionManager = new Cs({ JsSIP: e }, { numberOfConnectionAttempts: a }), this.connectionQueueManager = new ps({
|
|
7199
7307
|
connectionManager: this.connectionManager
|
|
7200
|
-
}), this.contentedStreamManager = new
|
|
7308
|
+
}), this.contentedStreamManager = new Eo(), this.callSessionState = new Ni(), this.callManager = new za(
|
|
7201
7309
|
{ contentedStreamManager: this.contentedStreamManager },
|
|
7202
|
-
{ sendOffer: this.sendOffer }
|
|
7203
|
-
|
|
7310
|
+
{ sendOffer: this.sendOffer },
|
|
7311
|
+
{ callSessionState: this.callSessionState }
|
|
7312
|
+
), this.incomingCallManager = new Io(this.connectionManager), this.presentationManager = new ao({
|
|
7204
7313
|
callManager: this.callManager,
|
|
7205
|
-
maxBitrate:
|
|
7206
|
-
}), this.statsManager = new
|
|
7314
|
+
maxBitrate: sc
|
|
7315
|
+
}), this.statsManager = new Fo({
|
|
7207
7316
|
callManager: this.callManager,
|
|
7208
7317
|
apiManager: this.apiManager
|
|
7209
|
-
}), this.autoConnectorManager = new
|
|
7318
|
+
}), this.autoConnectorManager = new ks(
|
|
7210
7319
|
{
|
|
7211
7320
|
connectionQueueManager: this.connectionQueueManager,
|
|
7212
7321
|
connectionManager: this.connectionManager,
|
|
7213
7322
|
callManager: this.callManager
|
|
7214
7323
|
},
|
|
7215
7324
|
i
|
|
7216
|
-
), this.videoSendingBalancerManager = new
|
|
7325
|
+
), this.videoSendingBalancerManager = new Yo(
|
|
7217
7326
|
this.callManager,
|
|
7218
7327
|
this.apiManager,
|
|
7219
|
-
r ??
|
|
7328
|
+
r ?? tc
|
|
7220
7329
|
), this.mainStreamHealthMonitor = new ce(
|
|
7221
7330
|
this.statsManager,
|
|
7222
7331
|
this.callManager,
|
|
7223
7332
|
o
|
|
7224
|
-
), this.mainStreamRecovery = new
|
|
7333
|
+
), this.mainStreamRecovery = new Ce(this.callManager, c), this.sessionManager = new Mo({
|
|
7225
7334
|
connectionManager: this.connectionManager,
|
|
7226
7335
|
callManager: this.callManager,
|
|
7227
7336
|
incomingCallManager: this.incomingCallManager,
|
|
@@ -7230,7 +7339,7 @@ class Ac extends G {
|
|
|
7230
7339
|
}), this.callManager.subscribeToApiEvents(this.apiManager), this.contentedStreamManager.subscribeToApiEvents(this.apiManager), this.apiManager.subscribe({
|
|
7231
7340
|
connectionManager: this.connectionManager,
|
|
7232
7341
|
callManager: this.callManager
|
|
7233
|
-
}), this.peerToPeerManager = new
|
|
7342
|
+
}), this.peerToPeerManager = new Ao(), this.peerToPeerManager.subscribe({
|
|
7234
7343
|
connectionManager: this.connectionManager,
|
|
7235
7344
|
callManager: this.callManager,
|
|
7236
7345
|
apiManager: this.apiManager
|
|
@@ -7409,19 +7518,22 @@ class Ac extends G {
|
|
|
7409
7518
|
}
|
|
7410
7519
|
subscribeToApiEvents() {
|
|
7411
7520
|
this.apiManager.on("participant:move-request-to-participants", () => {
|
|
7412
|
-
this.
|
|
7413
|
-
}), this.apiManager.on("participant:move-request-to-spectators-synthetic", () => {
|
|
7414
|
-
this.
|
|
7415
|
-
}), this.apiManager.on(
|
|
7416
|
-
|
|
7417
|
-
|
|
7521
|
+
this.callSessionState.setCallRoleParticipant();
|
|
7522
|
+
}), this.apiManager.on("participant:move-request-to-spectators-synthetic", (e) => {
|
|
7523
|
+
this.callSessionState.setCallRoleSpectatorSynthetic(e.isAvailableSendingMedia), this.mayBeStopPresentationAndNotify();
|
|
7524
|
+
}), this.apiManager.on(
|
|
7525
|
+
"participant:move-request-to-spectators-with-audio-id",
|
|
7526
|
+
({ audioId: e, isAvailableSendingMedia: n }) => {
|
|
7527
|
+
this.callSessionState.setCallRoleSpectator({ audioId: e }, n), this.mayBeStopPresentationAndNotify();
|
|
7528
|
+
}
|
|
7529
|
+
), this.apiManager.on("presentation:must-stop", () => {
|
|
7418
7530
|
this.mayBeStopPresentationAndNotify();
|
|
7419
7531
|
}), this.apiManager.on("failed-send-room-direct-p2p", ({ error: e }) => {
|
|
7420
|
-
const n = new
|
|
7532
|
+
const n = new dt();
|
|
7421
7533
|
n.body = e instanceof Error ? e.message : String(e);
|
|
7422
|
-
const s =
|
|
7534
|
+
const s = lt.causes.INTERNAL_ERROR;
|
|
7423
7535
|
this.callManager.failed(n, s).catch((r) => {
|
|
7424
|
-
|
|
7536
|
+
ct("Failed to end call after failed:", r);
|
|
7425
7537
|
});
|
|
7426
7538
|
});
|
|
7427
7539
|
}
|
|
@@ -7429,7 +7541,7 @@ class Ac extends G {
|
|
|
7429
7541
|
const r = this.connectionManager.getConnectionConfiguration()?.sipServerUrl;
|
|
7430
7542
|
if (r === void 0)
|
|
7431
7543
|
throw new Error("No sipServerUrl for sendOffer");
|
|
7432
|
-
return
|
|
7544
|
+
return Di({
|
|
7433
7545
|
serverUrl: r,
|
|
7434
7546
|
offer: n,
|
|
7435
7547
|
token: e.token,
|
|
@@ -7439,7 +7551,7 @@ class Ac extends G {
|
|
|
7439
7551
|
});
|
|
7440
7552
|
};
|
|
7441
7553
|
setCodecPreferences(e) {
|
|
7442
|
-
|
|
7554
|
+
Ho(e, {
|
|
7443
7555
|
preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
|
|
7444
7556
|
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
7445
7557
|
});
|
|
@@ -7449,7 +7561,7 @@ class Ac extends G {
|
|
|
7449
7561
|
}
|
|
7450
7562
|
subscribeToMainStreamHealthMonitorEvents() {
|
|
7451
7563
|
this.mainStreamHealthMonitor.on("inbound-video-problem-detected", ({ reason: e }) => {
|
|
7452
|
-
|
|
7564
|
+
ct("detected inbound video problem", { reason: e }), this.mainStreamRecovery.recover();
|
|
7453
7565
|
});
|
|
7454
7566
|
}
|
|
7455
7567
|
bridgeEvents = (e, n) => {
|
|
@@ -7464,50 +7576,58 @@ class Ac extends G {
|
|
|
7464
7576
|
};
|
|
7465
7577
|
}
|
|
7466
7578
|
export {
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
|
|
7494
|
-
|
|
7579
|
+
oi as $,
|
|
7580
|
+
no as A,
|
|
7581
|
+
Uc as B,
|
|
7582
|
+
Ni as C,
|
|
7583
|
+
zi as D,
|
|
7584
|
+
Ht as E,
|
|
7585
|
+
Go as F,
|
|
7586
|
+
fs as G,
|
|
7587
|
+
ai as H,
|
|
7588
|
+
po as I,
|
|
7589
|
+
aa as J,
|
|
7590
|
+
cs as K,
|
|
7591
|
+
go as L,
|
|
7592
|
+
Pc as M,
|
|
7593
|
+
bc as N,
|
|
7594
|
+
Bt as O,
|
|
7595
|
+
bi as P,
|
|
7596
|
+
kc as Q,
|
|
7597
|
+
x as R,
|
|
7598
|
+
Mo as S,
|
|
7599
|
+
hi as T,
|
|
7600
|
+
H as U,
|
|
7601
|
+
de as V,
|
|
7602
|
+
Ti as W,
|
|
7603
|
+
Ei as X,
|
|
7604
|
+
gi as Y,
|
|
7605
|
+
ui as Z,
|
|
7606
|
+
Zr as _,
|
|
7607
|
+
wc as a,
|
|
7608
|
+
Lc as b,
|
|
7609
|
+
Gc as c,
|
|
7610
|
+
bt as d,
|
|
7611
|
+
Se as e,
|
|
7612
|
+
Di as f,
|
|
7613
|
+
Dt as g,
|
|
7614
|
+
be as h,
|
|
7495
7615
|
Pe as i,
|
|
7496
7616
|
u as j,
|
|
7497
7617
|
d as k,
|
|
7498
|
-
|
|
7618
|
+
M as l,
|
|
7499
7619
|
A as m,
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7620
|
+
Kn as n,
|
|
7621
|
+
as as o,
|
|
7622
|
+
Ee as p,
|
|
7623
|
+
T as q,
|
|
7624
|
+
Dc as r,
|
|
7625
|
+
yc as s,
|
|
7626
|
+
mt as t,
|
|
7627
|
+
R as u,
|
|
7628
|
+
l as v,
|
|
7629
|
+
an as w,
|
|
7630
|
+
m as x,
|
|
7631
|
+
h as y,
|
|
7632
|
+
P as z
|
|
7513
7633
|
};
|