sip-connector 26.3.2 → 26.4.1
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-uI2lujlG.js → @SipConnector-8f-Nkvj8.js} +332 -275
- package/dist/@SipConnector-CEGxN1yT.cjs +1 -0
- package/dist/CallManager/@CallManager.d.ts +1 -1
- package/dist/CallManager/CallStateMachine.d.ts +4 -0
- package/dist/StatsManager/@StatsManager.d.ts +3 -0
- package/dist/VideoSendingBalancer/@VideoSendingBalancer.d.ts +2 -1
- package/dist/VideoSendingBalancer/SenderBalancer.d.ts +8 -0
- package/dist/VideoSendingBalancerManager/@VideoSendingBalancerManager.d.ts +3 -0
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +24 -23
- package/package.json +2 -2
- package/dist/@SipConnector-DJ9A6Qar.cjs +0 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { IncomingResponse as
|
|
2
|
-
import
|
|
1
|
+
import { IncomingResponse as Me, C as _e } from "@krivega/jssip";
|
|
2
|
+
import he from "debug";
|
|
3
3
|
import { TypedEvents as M } from "events-constructor";
|
|
4
4
|
import { CancelableRequest as K, isCanceledError as ct } from "@krivega/cancelable-promise";
|
|
5
|
-
import { resolveRequesterByTimeout as dt, requesterByTimeoutsWithFailCalls as ht, DelayRequester as lt, hasCanceledError as ut, SetTimeoutRequest as
|
|
6
|
-
import { repeatedCallsAsync as
|
|
5
|
+
import { resolveRequesterByTimeout as dt, requesterByTimeoutsWithFailCalls as ht, DelayRequester as lt, hasCanceledError as ut, SetTimeoutRequest as be } from "@krivega/timeout-requester";
|
|
6
|
+
import { repeatedCallsAsync as le, hasCanceledError as gt } from "repeated-calls";
|
|
7
7
|
import { createActor as Tt, setup as q, assign as f } from "xstate";
|
|
8
|
-
import { createStackPromises as
|
|
8
|
+
import { createStackPromises as Oe, isPromiseIsNotActualError as St } from "stack-promises";
|
|
9
9
|
import "ua-parser-js";
|
|
10
10
|
import "sequent-promises";
|
|
11
11
|
import Et from "lodash";
|
|
12
|
-
const
|
|
12
|
+
const ue = "sip-connector", d = he(ue), Ee = (n, e) => {
|
|
13
13
|
d(`${n}:`, e);
|
|
14
14
|
}, qi = () => {
|
|
15
|
-
|
|
15
|
+
he.enable(`${ue}:*`);
|
|
16
16
|
}, xi = () => {
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
var z = /* @__PURE__ */ ((n) => (n.SPECTATOR = "SPECTATOR", n.PARTICIPANT = "PARTICIPANT", n))(z || {}), P = /* @__PURE__ */ ((n) => (n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n.ENTER_ROOM = "application/vinteo.webrtc.roomname", n.MIC = "application/vinteo.webrtc.mic", n.USE_LICENSE = "application/vinteo.webrtc.uselic", n.PARTICIPANT_STATE = "application/vinteo.webrtc.partstate", n.NOTIFY = "application/vinteo.webrtc.notify", n))(P || {}), O = /* @__PURE__ */ ((n) => (n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n.CHANNELS = "application/vinteo.webrtc.channels", n.MEDIA_STATE = "application/vinteo.webrtc.mediastate", n.REFUSAL = "application/vinteo.webrtc.refusal", n.STATS = "application/vinteo.webrtc.stats", n))(O || {}), b = /* @__PURE__ */ ((n) => (n.PAUSE_MAIN_CAM = "PAUSEMAINCAM", n.RESUME_MAIN_CAM = "RESUMEMAINCAM", n.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", n.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", n.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", n))(b || {}), J = /* @__PURE__ */ ((n) => (n.ADMIN_STOP_MIC = "ADMINSTOPMIC", n.ADMIN_START_MIC = "ADMINSTARTMIC", n))(J || {}),
|
|
20
|
-
const
|
|
17
|
+
he.enable(`-${ue}:*`);
|
|
18
|
+
}, Ct = "Error decline with 603", mt = 1006, pt = (n) => typeof n == "object" && n !== null && "code" in n && n.code === mt, Rt = (n) => n.message === Ct;
|
|
19
|
+
var z = /* @__PURE__ */ ((n) => (n.SPECTATOR = "SPECTATOR", n.PARTICIPANT = "PARTICIPANT", n))(z || {}), P = /* @__PURE__ */ ((n) => (n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n.ENTER_ROOM = "application/vinteo.webrtc.roomname", n.MIC = "application/vinteo.webrtc.mic", n.USE_LICENSE = "application/vinteo.webrtc.uselic", n.PARTICIPANT_STATE = "application/vinteo.webrtc.partstate", n.NOTIFY = "application/vinteo.webrtc.notify", n))(P || {}), O = /* @__PURE__ */ ((n) => (n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n.CHANNELS = "application/vinteo.webrtc.channels", n.MEDIA_STATE = "application/vinteo.webrtc.mediastate", n.REFUSAL = "application/vinteo.webrtc.refusal", n.STATS = "application/vinteo.webrtc.stats", n))(O || {}), b = /* @__PURE__ */ ((n) => (n.PAUSE_MAIN_CAM = "PAUSEMAINCAM", n.RESUME_MAIN_CAM = "RESUMEMAINCAM", n.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", n.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", n.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", n))(b || {}), J = /* @__PURE__ */ ((n) => (n.ADMIN_STOP_MIC = "ADMINSTOPMIC", n.ADMIN_START_MIC = "ADMINSTARTMIC", n))(J || {}), Pe = /* @__PURE__ */ ((n) => (n.H264 = "H264", n.VP8 = "VP8", n.VP9 = "VP9", n.AV1 = "AV1", n))(Pe || {}), l = /* @__PURE__ */ ((n) => (n.CONTENT_TYPE = "content-type", n.CONTENT_ENTER_ROOM = "x-webrtc-enter-room", n.CONTENT_USE_LICENSE = "x-webrtc-use-license", n.PARTICIPANT_NAME = "x-webrtc-participant-name", n.INPUT_CHANNELS = "x-webrtc-input-channels", n.OUTPUT_CHANNELS = "x-webrtc-output-channels", n.MAIN_CAM = "x-webrtc-maincam", n.MIC = "x-webrtc-mic", n.MEDIA_SYNC = "x-webrtc-sync", n.MAIN_CAM_RESOLUTION = "x-webrtc-maincam-resolution", n.MEDIA_STATE = "x-webrtc-media-state", n.MEDIA_TYPE = "x-vinteo-media-type", n.MAIN_CAM_STATE = "x-vinteo-maincam-state", n.MIC_STATE = "x-vinteo-mic-state", n.CONTENT_PARTICIPANT_STATE = "x-webrtc-partstate", n.AUDIO_ID = "x-webrtc-audioid", n.SPECTATOR_MODE = "x-webrtc-spectator-mode", n.NOTIFY = "x-vinteo-notify", n.CONTENT_ENABLE_MEDIA_DEVICE = "x-webrtc-request-enable-media-device", n.CONTENTED_STREAM_STATE = "x-webrtc-share-state", n.CONTENTED_STREAM_CODEC = "x-webrtc-share-codec", n.AVAILABLE_INCOMING_BITRATE = "x-webrtc-available-incoming-bitrate", n.AUDIO_TRACK_COUNT = "x-webrtc-audio-track-count", n.VIDEO_TRACK_COUNT = "x-webrtc-video-track-count", n.TRACKS_DIRECTION = "x-webrtc-tracks-direction", n.BEARER_TOKEN = "x-bearer-token", n.IS_DIRECT_PEER_TO_PEER = "x-webrtc-is-direct-p2p", n))(l || {}), V = /* @__PURE__ */ ((n) => (n.AVAILABLE_CONTENTED_STREAM = "YOUCANRECEIVECONTENT", n.NOT_AVAILABLE_CONTENTED_STREAM = "CONTENTEND", n.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", n))(V || {}), k = /* @__PURE__ */ ((n) => (n.AVAILABLE_CONTENTED_STREAM = "x-webrtc-share-state: YOUCANRECEIVECONTENT", n.NOT_AVAILABLE_CONTENTED_STREAM = "x-webrtc-share-state: CONTENTEND", n.ACK_PERMISSION_TO_START_PRESENTATION = "x-webrtc-share-state: LETMESTARTPRESENTATION", n.STOPPED_CLIENT_PRESENTATION = "x-webrtc-share-state: STOPPRESENTATION", n.ENABLE_MAIN_CAM = "x-webrtc-request-enable-media-device: LETMESTARTMAINCAM", n))(k || {}), j = /* @__PURE__ */ ((n) => (n.ADMIN_SYNC_FORCED = "1", n.ADMIN_SYNC_NOT_FORCED = "0", n))(j || {}), ge = /* @__PURE__ */ ((n) => (n.SPECTATOR_MANUAL = "0", n.BY_STATE_CAM = "1", n.SPECTATOR_FORCED = "2", n))(ge || {}), De = /* @__PURE__ */ ((n) => (n.AUDIO = "AUDIO", n.VIDEO = "VIDEO", n.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", n))(De || {}), T = /* @__PURE__ */ ((n) => (n.ENTER_ROOM = "enter-room", n.MAIN_CAM_CONTROL = "main-cam-control", n.USE_LICENSE = "use-license", n.NEW_DTMF = "new-dtmf", n.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "conference:participant-token-issued", n.CONTENTED_STREAM_AVAILABLE = "contented-stream:available", n.CONTENTED_STREAM_NOT_AVAILABLE = "contented-stream:not-available", n.PRESENTATION_MUST_STOP = "presentation:must-stop", n.CHANNELS_ALL = "channels:all", n.CHANNELS_NOTIFY = "channels:notify", n.PARTICIPANT_ADDED_TO_LIST_MODERATORS = "participant:added-to-list-moderators", n.PARTICIPANT_REMOVED_FROM_LIST_MODERATORS = "participant:removed-from-list-moderators", n.PARTICIPANT_MOVE_REQUEST_TO_STREAM = "participant:move-request-to-stream", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS = "participant:move-request-to-spectators", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_SYNTHETIC = "participant:move-request-to-spectators-synthetic", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_WITH_AUDIO_ID = "participant:move-request-to-spectators-with-audio-id", n.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS = "participant:move-request-to-participants", n.PARTICIPATION_ACCEPTING_WORD_REQUEST = "participation:accepting-word-request", n.PARTICIPATION_CANCELLING_WORD_REQUEST = "participation:cancelling-word-request", n.WEBCAST_STARTED = "webcast:started", n.WEBCAST_STOPPED = "webcast:stopped", n.ACCOUNT_CHANGED = "account:changed", n.ACCOUNT_DELETED = "account:deleted", n.ADMIN_START_MAIN_CAM = "admin:start-main-cam", n.ADMIN_STOP_MAIN_CAM = "admin:stop-main-cam", n.ADMIN_START_MIC = "admin:start-mic", n.ADMIN_STOP_MIC = "admin:stop-mic", n.ADMIN_FORCE_SYNC_MEDIA_STATE = "admin:force-sync-media-state", n.FAILED_SEND_ROOM_DIRECT_P2P = "failed-send-room-direct-p2p", n))(T || {});
|
|
20
|
+
const ye = [
|
|
21
21
|
"enter-room",
|
|
22
22
|
"main-cam-control",
|
|
23
23
|
"use-license",
|
|
@@ -47,7 +47,7 @@ const Oe = [
|
|
|
47
47
|
"admin:stop-mic",
|
|
48
48
|
"admin:force-sync-media-state",
|
|
49
49
|
"failed-send-room-direct-p2p"
|
|
50
|
-
], Nt = () => new M(
|
|
50
|
+
], Nt = () => new M(ye), At = (n) => typeof n == "string" && n.trim().length > 0, L = (n, e) => {
|
|
51
51
|
const t = e.toLowerCase(), s = Object.entries(n).find(([, i]) => typeof i == "string" && i.toLowerCase() === t);
|
|
52
52
|
return s ? s[1] : void 0;
|
|
53
53
|
}, It = (n) => typeof n == "string" && !Number.isNaN(Number(n)) && Number.isFinite(Number(n)), vt = (n) => {
|
|
@@ -86,11 +86,11 @@ const Oe = [
|
|
|
86
86
|
case l.VIDEO_TRACK_COUNT:
|
|
87
87
|
return vt(s);
|
|
88
88
|
case l.CONTENTED_STREAM_CODEC:
|
|
89
|
-
return L(
|
|
89
|
+
return L(Pe, s);
|
|
90
90
|
case l.CONTENT_TYPE:
|
|
91
91
|
return L(P, s);
|
|
92
92
|
case l.CONTENT_USE_LICENSE:
|
|
93
|
-
return L(
|
|
93
|
+
return L(De, s);
|
|
94
94
|
case l.MAIN_CAM:
|
|
95
95
|
return L(b, s);
|
|
96
96
|
case l.MIC:
|
|
@@ -100,7 +100,7 @@ const Oe = [
|
|
|
100
100
|
case l.CONTENT_PARTICIPANT_STATE:
|
|
101
101
|
return L(z, s);
|
|
102
102
|
case l.SPECTATOR_MODE:
|
|
103
|
-
return L(
|
|
103
|
+
return L(ge, s);
|
|
104
104
|
case l.CONTENTED_STREAM_STATE:
|
|
105
105
|
return L(V, s);
|
|
106
106
|
case l.IS_DIRECT_PEER_TO_PEER:
|
|
@@ -121,14 +121,14 @@ class Mt {
|
|
|
121
121
|
callManager: t
|
|
122
122
|
}) {
|
|
123
123
|
this.callManager = t, e.on("sipEvent", this.handleSipEvent), t.on("newInfo", this.handleNewInfo), t.on("newDTMF", ({ originator: s }) => {
|
|
124
|
-
this.events.trigger(
|
|
124
|
+
this.events.trigger(T.NEW_DTMF, { originator: s });
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
127
|
async waitChannels() {
|
|
128
|
-
return this.wait(
|
|
128
|
+
return this.wait(T.CHANNELS_ALL);
|
|
129
129
|
}
|
|
130
130
|
async waitSyncMediaState() {
|
|
131
|
-
return this.wait(
|
|
131
|
+
return this.wait(T.ADMIN_FORCE_SYNC_MEDIA_STATE);
|
|
132
132
|
}
|
|
133
133
|
async sendDTMF(e) {
|
|
134
134
|
return new Promise((t, s) => {
|
|
@@ -155,7 +155,7 @@ class Mt {
|
|
|
155
155
|
}
|
|
156
156
|
sendEnterRoom(e) {
|
|
157
157
|
this.sendEnterRoomProtected(e).catch((t) => {
|
|
158
|
-
this.events.trigger(
|
|
158
|
+
this.events.trigger(T.FAILED_SEND_ROOM_DIRECT_P2P, { error: t });
|
|
159
159
|
});
|
|
160
160
|
}
|
|
161
161
|
async sendMediaState({ cam: e, mic: t }, s = {}) {
|
|
@@ -360,7 +360,7 @@ class Mt {
|
|
|
360
360
|
inputChannels: t,
|
|
361
361
|
outputChannels: s
|
|
362
362
|
};
|
|
363
|
-
this.events.trigger(
|
|
363
|
+
this.events.trigger(T.CHANNELS_NOTIFY, i);
|
|
364
364
|
};
|
|
365
365
|
triggerWebcastStartedNotify = ({
|
|
366
366
|
body: { conference: e, type: t }
|
|
@@ -369,7 +369,7 @@ class Mt {
|
|
|
369
369
|
conference: e,
|
|
370
370
|
type: t
|
|
371
371
|
};
|
|
372
|
-
this.events.trigger(
|
|
372
|
+
this.events.trigger(T.WEBCAST_STARTED, s);
|
|
373
373
|
};
|
|
374
374
|
triggerWebcastStoppedNotify = ({
|
|
375
375
|
body: { conference: e, type: t }
|
|
@@ -378,7 +378,7 @@ class Mt {
|
|
|
378
378
|
conference: e,
|
|
379
379
|
type: t
|
|
380
380
|
};
|
|
381
|
-
this.events.trigger(
|
|
381
|
+
this.events.trigger(T.WEBCAST_STOPPED, s);
|
|
382
382
|
};
|
|
383
383
|
triggerAddedToListModeratorsNotify = ({
|
|
384
384
|
conference: e
|
|
@@ -387,7 +387,7 @@ class Mt {
|
|
|
387
387
|
conference: e
|
|
388
388
|
};
|
|
389
389
|
this.events.trigger(
|
|
390
|
-
|
|
390
|
+
T.PARTICIPANT_ADDED_TO_LIST_MODERATORS,
|
|
391
391
|
t
|
|
392
392
|
);
|
|
393
393
|
};
|
|
@@ -398,7 +398,7 @@ class Mt {
|
|
|
398
398
|
conference: e
|
|
399
399
|
};
|
|
400
400
|
this.events.trigger(
|
|
401
|
-
|
|
401
|
+
T.PARTICIPANT_REMOVED_FROM_LIST_MODERATORS,
|
|
402
402
|
t
|
|
403
403
|
);
|
|
404
404
|
};
|
|
@@ -408,7 +408,7 @@ class Mt {
|
|
|
408
408
|
const t = {
|
|
409
409
|
conference: e
|
|
410
410
|
};
|
|
411
|
-
this.events.trigger(
|
|
411
|
+
this.events.trigger(T.PARTICIPATION_ACCEPTING_WORD_REQUEST, t);
|
|
412
412
|
};
|
|
413
413
|
triggerParticipationCancellingWordRequest = ({
|
|
414
414
|
body: { conference: e }
|
|
@@ -416,7 +416,7 @@ class Mt {
|
|
|
416
416
|
const t = {
|
|
417
417
|
conference: e
|
|
418
418
|
};
|
|
419
|
-
this.events.trigger(
|
|
419
|
+
this.events.trigger(T.PARTICIPATION_CANCELLING_WORD_REQUEST, t);
|
|
420
420
|
};
|
|
421
421
|
triggerParticipantMoveRequestToStream = ({
|
|
422
422
|
body: { conference: e }
|
|
@@ -424,13 +424,13 @@ class Mt {
|
|
|
424
424
|
const t = {
|
|
425
425
|
conference: e
|
|
426
426
|
};
|
|
427
|
-
this.events.trigger(
|
|
427
|
+
this.events.trigger(T.PARTICIPANT_MOVE_REQUEST_TO_STREAM, t);
|
|
428
428
|
};
|
|
429
429
|
triggerAccountChangedNotify = () => {
|
|
430
|
-
this.events.trigger(
|
|
430
|
+
this.events.trigger(T.ACCOUNT_CHANGED);
|
|
431
431
|
};
|
|
432
432
|
triggerAccountDeletedNotify = () => {
|
|
433
|
-
this.events.trigger(
|
|
433
|
+
this.events.trigger(T.ACCOUNT_DELETED);
|
|
434
434
|
};
|
|
435
435
|
triggerConferenceParticipantTokenIssued = ({
|
|
436
436
|
body: { conference: e, participant: t, jwt: s }
|
|
@@ -441,7 +441,7 @@ class Mt {
|
|
|
441
441
|
jwt: s
|
|
442
442
|
};
|
|
443
443
|
this.events.trigger(
|
|
444
|
-
|
|
444
|
+
T.CONFERENCE_PARTICIPANT_TOKEN_ISSUED,
|
|
445
445
|
i
|
|
446
446
|
);
|
|
447
447
|
};
|
|
@@ -452,12 +452,12 @@ class Mt {
|
|
|
452
452
|
inputChannels: t,
|
|
453
453
|
outputChannels: s
|
|
454
454
|
};
|
|
455
|
-
this.events.trigger(
|
|
455
|
+
this.events.trigger(T.CHANNELS_ALL, i);
|
|
456
456
|
}
|
|
457
457
|
};
|
|
458
458
|
triggerEnterRoom = (e) => {
|
|
459
459
|
const t = A(e, l.CONTENT_ENTER_ROOM), s = A(e, l.PARTICIPANT_NAME), i = A(e, l.BEARER_TOKEN), r = A(e, l.IS_DIRECT_PEER_TO_PEER);
|
|
460
|
-
t !== void 0 && s !== void 0 && this.events.trigger(
|
|
460
|
+
t !== void 0 && s !== void 0 && this.events.trigger(T.ENTER_ROOM, {
|
|
461
461
|
room: t,
|
|
462
462
|
participantName: s,
|
|
463
463
|
bearerToken: i,
|
|
@@ -470,15 +470,15 @@ class Mt {
|
|
|
470
470
|
switch (t) {
|
|
471
471
|
case V.AVAILABLE_CONTENTED_STREAM: {
|
|
472
472
|
const s = A(e, l.CONTENTED_STREAM_CODEC);
|
|
473
|
-
this.events.trigger(
|
|
473
|
+
this.events.trigger(T.CONTENTED_STREAM_AVAILABLE, { codec: s });
|
|
474
474
|
break;
|
|
475
475
|
}
|
|
476
476
|
case V.NOT_AVAILABLE_CONTENTED_STREAM: {
|
|
477
|
-
this.events.trigger(
|
|
477
|
+
this.events.trigger(T.CONTENTED_STREAM_NOT_AVAILABLE);
|
|
478
478
|
break;
|
|
479
479
|
}
|
|
480
480
|
case V.MUST_STOP_PRESENTATION: {
|
|
481
|
-
this.events.trigger(
|
|
481
|
+
this.events.trigger(T.PRESENTATION_MUST_STOP);
|
|
482
482
|
break;
|
|
483
483
|
}
|
|
484
484
|
}
|
|
@@ -486,53 +486,53 @@ class Mt {
|
|
|
486
486
|
maybeTriggerParticipantMoveRequest = (e) => {
|
|
487
487
|
const t = A(e, l.CONTENT_PARTICIPANT_STATE), s = A(e, l.AUDIO_ID), i = A(e, l.SPECTATOR_MODE);
|
|
488
488
|
if (t === z.SPECTATOR) {
|
|
489
|
-
const r = i ===
|
|
490
|
-
s === void 0 ? (this.events.trigger(
|
|
489
|
+
const r = i === ge.BY_STATE_CAM;
|
|
490
|
+
s === void 0 ? (this.events.trigger(T.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_SYNTHETIC, {
|
|
491
491
|
isAvailableSendingMedia: r
|
|
492
|
-
}), this.events.trigger(
|
|
492
|
+
}), this.events.trigger(T.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS, {
|
|
493
493
|
isAvailableSendingMedia: r,
|
|
494
494
|
isSynthetic: !0
|
|
495
|
-
})) : (this.events.trigger(
|
|
495
|
+
})) : (this.events.trigger(T.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_WITH_AUDIO_ID, {
|
|
496
496
|
isAvailableSendingMedia: r,
|
|
497
497
|
audioId: s
|
|
498
|
-
}), this.events.trigger(
|
|
498
|
+
}), this.events.trigger(T.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS, {
|
|
499
499
|
isAvailableSendingMedia: r,
|
|
500
500
|
isSynthetic: !1,
|
|
501
501
|
audioId: s
|
|
502
502
|
}));
|
|
503
503
|
}
|
|
504
|
-
t === z.PARTICIPANT && this.events.trigger(
|
|
504
|
+
t === z.PARTICIPANT && this.events.trigger(T.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS);
|
|
505
505
|
};
|
|
506
506
|
triggerMainCamControl = (e) => {
|
|
507
507
|
const t = A(e, l.MAIN_CAM), s = A(e, l.MEDIA_SYNC), i = s === j.ADMIN_SYNC_FORCED;
|
|
508
508
|
if (t === b.ADMIN_START_MAIN_CAM) {
|
|
509
|
-
this.events.trigger(
|
|
509
|
+
this.events.trigger(T.ADMIN_START_MAIN_CAM, { isSyncForced: i });
|
|
510
510
|
return;
|
|
511
511
|
}
|
|
512
512
|
if (t === b.ADMIN_STOP_MAIN_CAM) {
|
|
513
|
-
this.events.trigger(
|
|
513
|
+
this.events.trigger(T.ADMIN_STOP_MAIN_CAM, { isSyncForced: i });
|
|
514
514
|
return;
|
|
515
515
|
}
|
|
516
|
-
(t === b.RESUME_MAIN_CAM || t === b.PAUSE_MAIN_CAM) && s !== void 0 && this.events.trigger(
|
|
516
|
+
(t === b.RESUME_MAIN_CAM || t === b.PAUSE_MAIN_CAM) && s !== void 0 && this.events.trigger(T.ADMIN_FORCE_SYNC_MEDIA_STATE, { isSyncForced: i });
|
|
517
517
|
const r = A(e, l.MAIN_CAM_RESOLUTION);
|
|
518
|
-
this.events.trigger(
|
|
518
|
+
this.events.trigger(T.MAIN_CAM_CONTROL, {
|
|
519
519
|
mainCam: t,
|
|
520
520
|
resolutionMainCam: r
|
|
521
521
|
});
|
|
522
522
|
};
|
|
523
523
|
triggerMicControl = (e) => {
|
|
524
524
|
const t = A(e, l.MIC), i = A(e, l.MEDIA_SYNC) === j.ADMIN_SYNC_FORCED;
|
|
525
|
-
t === J.ADMIN_START_MIC ? this.events.trigger(
|
|
525
|
+
t === J.ADMIN_START_MIC ? this.events.trigger(T.ADMIN_START_MIC, { isSyncForced: i }) : t === J.ADMIN_STOP_MIC && this.events.trigger(T.ADMIN_STOP_MIC, { isSyncForced: i });
|
|
526
526
|
};
|
|
527
527
|
triggerUseLicense = (e) => {
|
|
528
528
|
const t = A(e, l.CONTENT_USE_LICENSE);
|
|
529
|
-
t !== void 0 && this.events.trigger(
|
|
529
|
+
t !== void 0 && this.events.trigger(T.USE_LICENSE, t);
|
|
530
530
|
};
|
|
531
531
|
async sendEnterRoomProtected(e) {
|
|
532
532
|
return this.getEstablishedRTCSessionProtected().sendInfo(P.ENTER_ROOM, void 0, { extraHeaders: e });
|
|
533
533
|
}
|
|
534
534
|
}
|
|
535
|
-
const _t = /^p2p.+to.+$/i,
|
|
535
|
+
const _t = /^p2p.+to.+$/i, Le = (n) => n !== void 0 && n.length > 0 && _t.test(n), bt = "purgatory", we = (n) => n === bt, Ot = (n, e) => {
|
|
536
536
|
n.getVideoTracks().forEach((s) => {
|
|
537
537
|
"contentHint" in s && s.contentHint !== e && (s.contentHint = e);
|
|
538
538
|
});
|
|
@@ -581,16 +581,16 @@ const _t = /^p2p.+to.+$/i, Pe = (n) => n !== void 0 && n.length > 0 && _t.test(n
|
|
|
581
581
|
for (let t = n.encodings.length; t < e; t += 1)
|
|
582
582
|
n.encodings.push({});
|
|
583
583
|
return n;
|
|
584
|
-
},
|
|
584
|
+
}, Ue = (n) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== n, wt = Ue(), Ut = (n, e) => {
|
|
585
585
|
if (wt(n, e))
|
|
586
586
|
return n;
|
|
587
587
|
}, kt = (n, e, { isResetAllowed: t = !1 } = {}) => {
|
|
588
588
|
const s = n.maxBitrate, i = Ut(e, s);
|
|
589
589
|
return (i !== void 0 || t) && (n.maxBitrate = i), n;
|
|
590
|
-
},
|
|
591
|
-
|
|
590
|
+
}, ke = 1, Ft = Ue(
|
|
591
|
+
ke
|
|
592
592
|
), Bt = (n, e) => {
|
|
593
|
-
const t = n === void 0 ? void 0 : Math.max(n,
|
|
593
|
+
const t = n === void 0 ? void 0 : Math.max(n, ke);
|
|
594
594
|
if (t !== void 0 && Ft(
|
|
595
595
|
t,
|
|
596
596
|
e
|
|
@@ -632,7 +632,7 @@ const _t = /^p2p.+to.+$/i, Pe = (n) => n !== void 0 && n.length > 0 && _t.test(n
|
|
|
632
632
|
Gt(s, e, { isResetAllowed: t }), yt(s, e);
|
|
633
633
|
const r = Vt(i, s);
|
|
634
634
|
return r && await n.setParameters(s), { parameters: s, isChanged: r };
|
|
635
|
-
},
|
|
635
|
+
}, Fe = async (n, e, t) => {
|
|
636
636
|
const { isChanged: s, parameters: i } = await re(n, {
|
|
637
637
|
encodings: [
|
|
638
638
|
{
|
|
@@ -645,7 +645,7 @@ const _t = /^p2p.+to.+$/i, Pe = (n) => n !== void 0 && n.length > 0 && _t.test(n
|
|
|
645
645
|
}, qt = (n, e) => n.find((t) => t.track !== null && e.getTracks().includes(t.track)), xt = async (n, e, t) => {
|
|
646
646
|
const s = qt(n, e);
|
|
647
647
|
if (s)
|
|
648
|
-
return
|
|
648
|
+
return Fe(s, { maxBitrate: t });
|
|
649
649
|
};
|
|
650
650
|
class Ht {
|
|
651
651
|
command = void 0;
|
|
@@ -711,12 +711,14 @@ class x {
|
|
|
711
711
|
}
|
|
712
712
|
}
|
|
713
713
|
var ae = /* @__PURE__ */ ((n) => (n.IDLE = "call:idle", n.CONNECTING = "call:connecting", n.PURGATORY = "call:purgatory", n.P2P_ROOM = "call:p2pRoom", n.DIRECT_P2P_ROOM = "call:directP2pRoom", n.IN_ROOM = "call:inRoom", n.DISCONNECTING = "call:disconnecting", n))(ae || {});
|
|
714
|
-
const
|
|
714
|
+
const m = "evaluate", X = (n) => typeof n == "string" && n.length > 0, H = (n) => "number" in n && X(n.number) && typeof n.answer == "boolean", Z = (n) => "room" in n && X(n.room) && X(n.participantName), ee = (n) => "token" in n && X(n.token), Be = ({ isDirectPeerToPeer: n }) => n === !0, Qt = (n) => we(n.room) || Le(n.room) || Be(n), Wt = (n) => H(n) && Z(n) && !ee(n) && "room" in n && we(n.room), Yt = (n) => H(n) && Z(n) && !ee(n) && "room" in n && Le(n.room), zt = (n) => "isDirectPeerToPeer" in n && Be(n), Jt = (n) => H(n) && Z(n) && !ee(n) && "room" in n && zt(n), $e = (n) => H(n) && Z(n) && ee(n), jt = {}, te = () => ({
|
|
715
715
|
number: void 0,
|
|
716
716
|
answer: void 0,
|
|
717
717
|
room: void 0,
|
|
718
718
|
participantName: void 0,
|
|
719
719
|
token: void 0,
|
|
720
|
+
conference: void 0,
|
|
721
|
+
participant: void 0,
|
|
720
722
|
isDirectPeerToPeer: void 0,
|
|
721
723
|
pendingDisconnect: void 0
|
|
722
724
|
}), Xt = q({
|
|
@@ -737,10 +739,12 @@ const C = "evaluate", X = (n) => typeof n == "string" && n.length > 0, H = (n) =
|
|
|
737
739
|
room: n.room,
|
|
738
740
|
participantName: n.participantName
|
|
739
741
|
};
|
|
740
|
-
return n.token !== void 0 ? t.token = n.token :
|
|
742
|
+
return n.token !== void 0 ? t.token = n.token : Qt(n) && (t.token = void 0), n.isDirectPeerToPeer !== void 0 && (t.isDirectPeerToPeer = n.isDirectPeerToPeer), t;
|
|
741
743
|
}),
|
|
742
744
|
setTokenInfo: f(({ event: n, context: e }) => n.type !== "CALL.TOKEN_ISSUED" ? e : {
|
|
743
|
-
token: n.token
|
|
745
|
+
token: n.token,
|
|
746
|
+
conference: n.conference,
|
|
747
|
+
participant: n.participant
|
|
744
748
|
}),
|
|
745
749
|
reset: f(te()),
|
|
746
750
|
prepareDisconnect: f(() => ({
|
|
@@ -756,7 +760,7 @@ const C = "evaluate", X = (n) => typeof n == "string" && n.length > 0, H = (n) =
|
|
|
756
760
|
"call:idle": {
|
|
757
761
|
on: {
|
|
758
762
|
"CALL.CONNECTING": {
|
|
759
|
-
target:
|
|
763
|
+
target: m,
|
|
760
764
|
actions: "setConnecting"
|
|
761
765
|
}
|
|
762
766
|
}
|
|
@@ -764,19 +768,19 @@ const C = "evaluate", X = (n) => typeof n == "string" && n.length > 0, H = (n) =
|
|
|
764
768
|
"call:connecting": {
|
|
765
769
|
on: {
|
|
766
770
|
"CALL.ENTER_ROOM": {
|
|
767
|
-
target:
|
|
771
|
+
target: m,
|
|
768
772
|
actions: "setRoomInfo"
|
|
769
773
|
},
|
|
770
774
|
"CALL.TOKEN_ISSUED": {
|
|
771
|
-
target:
|
|
775
|
+
target: m,
|
|
772
776
|
actions: "setTokenInfo"
|
|
773
777
|
},
|
|
774
778
|
"CALL.START_DISCONNECT": {
|
|
775
|
-
target:
|
|
779
|
+
target: m,
|
|
776
780
|
actions: "prepareDisconnect"
|
|
777
781
|
},
|
|
778
782
|
"CALL.RESET": {
|
|
779
|
-
target:
|
|
783
|
+
target: m,
|
|
780
784
|
actions: "reset"
|
|
781
785
|
}
|
|
782
786
|
}
|
|
@@ -784,24 +788,24 @@ const C = "evaluate", X = (n) => typeof n == "string" && n.length > 0, H = (n) =
|
|
|
784
788
|
"call:inRoom": {
|
|
785
789
|
on: {
|
|
786
790
|
"CALL.ENTER_ROOM": {
|
|
787
|
-
target:
|
|
791
|
+
target: m,
|
|
788
792
|
actions: "setRoomInfo"
|
|
789
793
|
},
|
|
790
794
|
"CALL.TOKEN_ISSUED": {
|
|
791
|
-
target:
|
|
795
|
+
target: m,
|
|
792
796
|
actions: "setTokenInfo"
|
|
793
797
|
},
|
|
794
798
|
"CALL.START_DISCONNECT": {
|
|
795
|
-
target:
|
|
799
|
+
target: m,
|
|
796
800
|
actions: "prepareDisconnect"
|
|
797
801
|
},
|
|
798
802
|
"CALL.RESET": {
|
|
799
|
-
target:
|
|
803
|
+
target: m,
|
|
800
804
|
actions: "reset"
|
|
801
805
|
}
|
|
802
806
|
}
|
|
803
807
|
},
|
|
804
|
-
[
|
|
808
|
+
[m]: {
|
|
805
809
|
always: [
|
|
806
810
|
{
|
|
807
811
|
target: "call:disconnecting",
|
|
@@ -810,7 +814,7 @@ const C = "evaluate", X = (n) => typeof n == "string" && n.length > 0, H = (n) =
|
|
|
810
814
|
},
|
|
811
815
|
{
|
|
812
816
|
target: "call:inRoom",
|
|
813
|
-
guard: ({ context: n }) =>
|
|
817
|
+
guard: ({ context: n }) => $e(n)
|
|
814
818
|
},
|
|
815
819
|
{
|
|
816
820
|
target: "call:directP2pRoom",
|
|
@@ -822,7 +826,7 @@ const C = "evaluate", X = (n) => typeof n == "string" && n.length > 0, H = (n) =
|
|
|
822
826
|
},
|
|
823
827
|
{
|
|
824
828
|
target: "call:purgatory",
|
|
825
|
-
guard: ({ context: n }) =>
|
|
829
|
+
guard: ({ context: n }) => Wt(n)
|
|
826
830
|
},
|
|
827
831
|
{
|
|
828
832
|
target: "call:connecting",
|
|
@@ -837,19 +841,19 @@ const C = "evaluate", X = (n) => typeof n == "string" && n.length > 0, H = (n) =
|
|
|
837
841
|
"call:purgatory": {
|
|
838
842
|
on: {
|
|
839
843
|
"CALL.ENTER_ROOM": {
|
|
840
|
-
target:
|
|
844
|
+
target: m,
|
|
841
845
|
actions: "setRoomInfo"
|
|
842
846
|
},
|
|
843
847
|
"CALL.TOKEN_ISSUED": {
|
|
844
|
-
target:
|
|
848
|
+
target: m,
|
|
845
849
|
actions: "setTokenInfo"
|
|
846
850
|
},
|
|
847
851
|
"CALL.START_DISCONNECT": {
|
|
848
|
-
target:
|
|
852
|
+
target: m,
|
|
849
853
|
actions: "prepareDisconnect"
|
|
850
854
|
},
|
|
851
855
|
"CALL.RESET": {
|
|
852
|
-
target:
|
|
856
|
+
target: m,
|
|
853
857
|
actions: "reset"
|
|
854
858
|
}
|
|
855
859
|
}
|
|
@@ -857,19 +861,19 @@ const C = "evaluate", X = (n) => typeof n == "string" && n.length > 0, H = (n) =
|
|
|
857
861
|
"call:p2pRoom": {
|
|
858
862
|
on: {
|
|
859
863
|
"CALL.ENTER_ROOM": {
|
|
860
|
-
target:
|
|
864
|
+
target: m,
|
|
861
865
|
actions: "setRoomInfo"
|
|
862
866
|
},
|
|
863
867
|
"CALL.TOKEN_ISSUED": {
|
|
864
|
-
target:
|
|
868
|
+
target: m,
|
|
865
869
|
actions: "setTokenInfo"
|
|
866
870
|
},
|
|
867
871
|
"CALL.START_DISCONNECT": {
|
|
868
|
-
target:
|
|
872
|
+
target: m,
|
|
869
873
|
actions: "prepareDisconnect"
|
|
870
874
|
},
|
|
871
875
|
"CALL.RESET": {
|
|
872
|
-
target:
|
|
876
|
+
target: m,
|
|
873
877
|
actions: "reset"
|
|
874
878
|
}
|
|
875
879
|
}
|
|
@@ -877,19 +881,19 @@ const C = "evaluate", X = (n) => typeof n == "string" && n.length > 0, H = (n) =
|
|
|
877
881
|
"call:directP2pRoom": {
|
|
878
882
|
on: {
|
|
879
883
|
"CALL.ENTER_ROOM": {
|
|
880
|
-
target:
|
|
884
|
+
target: m,
|
|
881
885
|
actions: "setRoomInfo"
|
|
882
886
|
},
|
|
883
887
|
"CALL.TOKEN_ISSUED": {
|
|
884
|
-
target:
|
|
888
|
+
target: m,
|
|
885
889
|
actions: "setTokenInfo"
|
|
886
890
|
},
|
|
887
891
|
"CALL.START_DISCONNECT": {
|
|
888
|
-
target:
|
|
892
|
+
target: m,
|
|
889
893
|
actions: "prepareDisconnect"
|
|
890
894
|
},
|
|
891
895
|
"CALL.RESET": {
|
|
892
|
-
target:
|
|
896
|
+
target: m,
|
|
893
897
|
actions: "reset"
|
|
894
898
|
}
|
|
895
899
|
}
|
|
@@ -897,7 +901,7 @@ const C = "evaluate", X = (n) => typeof n == "string" && n.length > 0, H = (n) =
|
|
|
897
901
|
"call:disconnecting": {
|
|
898
902
|
on: {
|
|
899
903
|
"CALL.RESET": {
|
|
900
|
-
target:
|
|
904
|
+
target: m,
|
|
901
905
|
actions: "reset"
|
|
902
906
|
}
|
|
903
907
|
}
|
|
@@ -932,7 +936,7 @@ class Kt extends x {
|
|
|
932
936
|
/** Контекст в состоянии IN_ROOM; undefined в остальных состояниях. Использовать вместо каста context. */
|
|
933
937
|
get inRoomContext() {
|
|
934
938
|
const { context: e } = this;
|
|
935
|
-
return
|
|
939
|
+
return $e(e) ? e : void 0;
|
|
936
940
|
}
|
|
937
941
|
get isActive() {
|
|
938
942
|
return this.isInRoom || this.isInPurgatory || this.isP2PRoom || this.isDirectP2PRoom;
|
|
@@ -978,9 +982,12 @@ class Kt extends x {
|
|
|
978
982
|
});
|
|
979
983
|
})
|
|
980
984
|
), this.addSubscription(
|
|
981
|
-
e.on(
|
|
982
|
-
|
|
983
|
-
|
|
985
|
+
e.on(
|
|
986
|
+
"conference:participant-token-issued",
|
|
987
|
+
({ jwt: t, conference: s, participant: i }) => {
|
|
988
|
+
this.send({ type: "CALL.TOKEN_ISSUED", token: t, conference: s, participant: i });
|
|
989
|
+
}
|
|
990
|
+
)
|
|
984
991
|
);
|
|
985
992
|
}
|
|
986
993
|
subscribeToEvents(e) {
|
|
@@ -1003,8 +1010,8 @@ class Kt extends x {
|
|
|
1003
1010
|
);
|
|
1004
1011
|
}
|
|
1005
1012
|
}
|
|
1006
|
-
var
|
|
1007
|
-
const
|
|
1013
|
+
var S = /* @__PURE__ */ ((n) => (n.PEER_CONNECTION = "peerconnection", n.CONNECTING = "connecting", n.SENDING = "sending", n.PROGRESS = "progress", n.ACCEPTED = "accepted", n.CONFIRMED = "confirmed", n.ENDED = "ended", n.FAILED = "failed", n.NEW_DTMF = "newDTMF", n.NEW_INFO = "newInfo", n.HOLD = "hold", n.UNHOLD = "unhold", n.MUTED = "muted", n.UNMUTED = "unmuted", n.REINVITE = "reinvite", n.UPDATE = "update", n.REFER = "refer", n.REPLACES = "replaces", n.SDP = "sdp", n.ICE_CANDIDATE = "icecandidate", n.GET_USER_MEDIA_FAILED = "getusermediafailed", n.PEER_CONNECTION_CREATE_OFFER_FAILED = "peerconnection:createofferfailed", n.PEER_CONNECTION_CREATE_ANSWER_FAILED = "peerconnection:createanswerfailed", n.PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED = "peerconnection:setlocaldescriptionfailed", n.PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED = "peerconnection:setremotedescriptionfailed", n.START_PRESENTATION = "presentation:start", n.STARTED_PRESENTATION = "presentation:started", n.END_PRESENTATION = "presentation:end", n.ENDED_PRESENTATION = "presentation:ended", n.FAILED_PRESENTATION = "presentation:failed", n.START_CALL = "start-call", n.END_CALL = "end-call", n.PEER_CONNECTION_CONFIRMED = "peerconnection:confirmed", n.PEER_CONNECTION_ONTRACK = "peerconnection:ontrack", n.ENDED_FROM_SERVER = "ended:fromserver", n.CALL_STATUS_CHANGED = "call-status-changed", n.REMOTE_TRACKS_CHANGED = "remote-tracks-changed", n.REMOTE_STREAMS_CHANGED = "remote-streams-changed", n.RECV_SESSION_STARTED = "recv-session-started", n.RECV_SESSION_ENDED = "recv-session-ended", n.RECV_QUALITY_CHANGED = "recv-quality-changed", n))(S || {}), Zt = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))(Zt || {});
|
|
1014
|
+
const Ge = [
|
|
1008
1015
|
"peerconnection",
|
|
1009
1016
|
"connecting",
|
|
1010
1017
|
"sending",
|
|
@@ -1047,10 +1054,10 @@ const Fe = [
|
|
|
1047
1054
|
"recv-session-started",
|
|
1048
1055
|
"recv-session-ended",
|
|
1049
1056
|
"recv-quality-changed"
|
|
1050
|
-
],
|
|
1051
|
-
...
|
|
1057
|
+
], Ve = [
|
|
1058
|
+
...Ge,
|
|
1052
1059
|
...en
|
|
1053
|
-
], tn = () => new M(
|
|
1060
|
+
], tn = () => new M(Ve), nn = 6e3, sn = 1e3, W = (n, e) => n.getSenders().filter((t) => t.track?.kind === e), rn = (n) => n === "audio" ? nn : sn, an = (n) => n.track !== null;
|
|
1054
1061
|
class on {
|
|
1055
1062
|
previousBitrates = /* @__PURE__ */ new Map();
|
|
1056
1063
|
/**
|
|
@@ -1062,7 +1069,7 @@ class on {
|
|
|
1062
1069
|
const s = [];
|
|
1063
1070
|
if (!e)
|
|
1064
1071
|
return;
|
|
1065
|
-
(t === "audio" || t === "all") && s.push(...
|
|
1072
|
+
(t === "audio" || t === "all") && s.push(...W(e, "audio")), (t === "video" || t === "all") && s.push(...W(e, "video"));
|
|
1066
1073
|
const i = s.filter(an).map(async (r) => {
|
|
1067
1074
|
const a = r.getParameters();
|
|
1068
1075
|
this.saveCurrentBitrate(r, a);
|
|
@@ -1086,7 +1093,7 @@ class on {
|
|
|
1086
1093
|
const s = [];
|
|
1087
1094
|
if (!e)
|
|
1088
1095
|
return;
|
|
1089
|
-
(t === "audio" || t === "all") && s.push(...
|
|
1096
|
+
(t === "audio" || t === "all") && s.push(...W(e, "audio")), (t === "video" || t === "all") && s.push(...W(e, "video"));
|
|
1090
1097
|
const i = s.map(async (r) => {
|
|
1091
1098
|
const a = this.getSavedBitrate(r);
|
|
1092
1099
|
if (a) {
|
|
@@ -1137,7 +1144,7 @@ class on {
|
|
|
1137
1144
|
this.previousBitrates.set(e, s);
|
|
1138
1145
|
}
|
|
1139
1146
|
}
|
|
1140
|
-
var
|
|
1147
|
+
var qe = /* @__PURE__ */ ((n) => (n.BYE = "Terminated", n.WEBRTC_ERROR = "WebRTC Error", n.CANCELED = "Canceled", n.REQUEST_TIMEOUT = "Request Timeout", n.REJECTED = "Rejected", n.REDIRECTED = "Redirected", n.UNAVAILABLE = "Unavailable", n.NOT_FOUND = "Not Found", n.ADDRESS_INCOMPLETE = "Address Incomplete", n.INCOMPATIBLE_SDP = "Incompatible SDP", n.BAD_MEDIA_DESCRIPTION = "Bad Media Description", n))(qe || {});
|
|
1141
1148
|
class cn {
|
|
1142
1149
|
events;
|
|
1143
1150
|
rtcSession;
|
|
@@ -1146,7 +1153,7 @@ class cn {
|
|
|
1146
1153
|
// Менеджер состояния битрейта
|
|
1147
1154
|
bitrateStateManager = new on();
|
|
1148
1155
|
constructor(e, { onReset: t }) {
|
|
1149
|
-
this.events = e, this.onReset = t, e.on(
|
|
1156
|
+
this.events = e, this.onReset = t, e.on(S.FAILED, this.handleEnded), e.on(S.ENDED, this.handleEnded);
|
|
1150
1157
|
}
|
|
1151
1158
|
get connection() {
|
|
1152
1159
|
return this.rtcSession?.connection;
|
|
@@ -1169,7 +1176,7 @@ class cn {
|
|
|
1169
1176
|
directionAudio: c,
|
|
1170
1177
|
contentHint: h,
|
|
1171
1178
|
offerToReceiveAudio: u = !0,
|
|
1172
|
-
offerToReceiveVideo:
|
|
1179
|
+
offerToReceiveVideo: g = !0,
|
|
1173
1180
|
degradationPreference: E,
|
|
1174
1181
|
sendEncodings: N,
|
|
1175
1182
|
onAddedTransceiver: y
|
|
@@ -1187,7 +1194,7 @@ class cn {
|
|
|
1187
1194
|
},
|
|
1188
1195
|
rtcOfferConstraints: {
|
|
1189
1196
|
offerToReceiveAudio: u,
|
|
1190
|
-
offerToReceiveVideo:
|
|
1197
|
+
offerToReceiveVideo: g
|
|
1191
1198
|
},
|
|
1192
1199
|
// необходимо передавать в методе call, чтобы подписаться на события peerconnection,
|
|
1193
1200
|
// так как в методе call создается RTCSession
|
|
@@ -1205,7 +1212,7 @@ class cn {
|
|
|
1205
1212
|
const { rtcSession: e } = this;
|
|
1206
1213
|
if (e && !e.isEnded())
|
|
1207
1214
|
return e.terminateAsync({
|
|
1208
|
-
cause:
|
|
1215
|
+
cause: qe.CANCELED
|
|
1209
1216
|
}).finally(() => {
|
|
1210
1217
|
this.reset();
|
|
1211
1218
|
});
|
|
@@ -1221,7 +1228,7 @@ class cn {
|
|
|
1221
1228
|
offerToReceiveVideo: c,
|
|
1222
1229
|
contentHint: h,
|
|
1223
1230
|
degradationPreference: u,
|
|
1224
|
-
sendEncodings:
|
|
1231
|
+
sendEncodings: g,
|
|
1225
1232
|
onAddedTransceiver: E
|
|
1226
1233
|
}) => new Promise((N, y) => {
|
|
1227
1234
|
try {
|
|
@@ -1244,7 +1251,7 @@ class cn {
|
|
|
1244
1251
|
directionVideo: r,
|
|
1245
1252
|
directionAudio: a,
|
|
1246
1253
|
degradationPreference: u,
|
|
1247
|
-
sendEncodings:
|
|
1254
|
+
sendEncodings: g,
|
|
1248
1255
|
onAddedTransceiver: E
|
|
1249
1256
|
});
|
|
1250
1257
|
} catch (I) {
|
|
@@ -1270,7 +1277,7 @@ class cn {
|
|
|
1270
1277
|
*/
|
|
1271
1278
|
setMinBitrateForSenders(e = "all") {
|
|
1272
1279
|
this.bitrateStateManager.setMinBitrateForSenders(this.connection, e).catch((t) => {
|
|
1273
|
-
|
|
1280
|
+
Ee("MCUSession.setMinBitrateForSenders", t);
|
|
1274
1281
|
});
|
|
1275
1282
|
}
|
|
1276
1283
|
/**
|
|
@@ -1279,38 +1286,38 @@ class cn {
|
|
|
1279
1286
|
*/
|
|
1280
1287
|
restoreBitrateForSenders(e = "all") {
|
|
1281
1288
|
this.bitrateStateManager.restoreBitrateForSenders(this.connection, e).catch((t) => {
|
|
1282
|
-
|
|
1289
|
+
Ee("MCUSession.restoreBitrateForSenders", t);
|
|
1283
1290
|
});
|
|
1284
1291
|
}
|
|
1285
1292
|
handleCall = async () => new Promise((e, t) => {
|
|
1286
1293
|
const s = () => {
|
|
1287
|
-
this.events.on(
|
|
1294
|
+
this.events.on(S.PEER_CONNECTION, h), this.events.on(S.CONFIRMED, u);
|
|
1288
1295
|
}, i = () => {
|
|
1289
|
-
this.events.off(
|
|
1296
|
+
this.events.off(S.PEER_CONNECTION, h), this.events.off(S.CONFIRMED, u);
|
|
1290
1297
|
}, r = () => {
|
|
1291
|
-
this.events.on(
|
|
1298
|
+
this.events.on(S.FAILED, o), this.events.on(S.ENDED, o);
|
|
1292
1299
|
}, a = () => {
|
|
1293
|
-
this.events.off(
|
|
1294
|
-
}, o = (
|
|
1295
|
-
i(), a(), t(
|
|
1300
|
+
this.events.off(S.FAILED, o), this.events.off(S.ENDED, o);
|
|
1301
|
+
}, o = (g) => {
|
|
1302
|
+
i(), a(), t(g);
|
|
1296
1303
|
};
|
|
1297
1304
|
let c;
|
|
1298
|
-
const h = ({ peerconnection:
|
|
1299
|
-
c =
|
|
1305
|
+
const h = ({ peerconnection: g }) => {
|
|
1306
|
+
c = g;
|
|
1300
1307
|
const E = (N) => {
|
|
1301
|
-
this.events.trigger(
|
|
1308
|
+
this.events.trigger(S.PEER_CONNECTION_ONTRACK, N);
|
|
1302
1309
|
};
|
|
1303
|
-
|
|
1304
|
-
|
|
1310
|
+
g.addEventListener("track", E), this.disposers.add(() => {
|
|
1311
|
+
g.removeEventListener("track", E);
|
|
1305
1312
|
});
|
|
1306
1313
|
}, u = () => {
|
|
1307
|
-
c !== void 0 && this.events.trigger(
|
|
1314
|
+
c !== void 0 && this.events.trigger(S.PEER_CONNECTION_CONFIRMED, c), i(), a(), e(c);
|
|
1308
1315
|
};
|
|
1309
1316
|
s(), r();
|
|
1310
1317
|
});
|
|
1311
1318
|
subscribeToSessionEvents(e) {
|
|
1312
1319
|
this.events.eachTriggers((t, s) => {
|
|
1313
|
-
const i =
|
|
1320
|
+
const i = Ge.find((r) => r === s);
|
|
1314
1321
|
i && (e.on(i, t), this.disposers.add(() => {
|
|
1315
1322
|
e.off(i, t);
|
|
1316
1323
|
}));
|
|
@@ -1323,7 +1330,7 @@ class cn {
|
|
|
1323
1330
|
}
|
|
1324
1331
|
handleEnded = (e) => {
|
|
1325
1332
|
const { originator: t } = e;
|
|
1326
|
-
t === "remote" && this.events.trigger(
|
|
1333
|
+
t === "remote" && this.events.trigger(S.ENDED_FROM_SERVER, e), this.reset();
|
|
1327
1334
|
};
|
|
1328
1335
|
reset = () => {
|
|
1329
1336
|
delete this.rtcSession, this.unsubscribeFromSessionEvents(), this.bitrateStateManager.clearAll(), this.onReset();
|
|
@@ -1456,7 +1463,7 @@ class un {
|
|
|
1456
1463
|
},
|
|
1457
1464
|
s
|
|
1458
1465
|
), r = (o) => !(o instanceof Error);
|
|
1459
|
-
this.cancelableSendOfferWithRepeatedCalls =
|
|
1466
|
+
this.cancelableSendOfferWithRepeatedCalls = le({
|
|
1460
1467
|
targetFunction: i,
|
|
1461
1468
|
isComplete: r,
|
|
1462
1469
|
callLimit: dn,
|
|
@@ -1587,18 +1594,18 @@ class un {
|
|
|
1587
1594
|
this.cancelableSendOfferWithRepeatedCalls?.cancel();
|
|
1588
1595
|
}
|
|
1589
1596
|
}
|
|
1590
|
-
const
|
|
1591
|
-
const t =
|
|
1597
|
+
const xe = (n) => n.getSettings(), gn = (n, e) => {
|
|
1598
|
+
const t = xe(n);
|
|
1592
1599
|
let s = e;
|
|
1593
1600
|
s ??= n.label;
|
|
1594
1601
|
let i = t?.msid;
|
|
1595
1602
|
return i ??= s, i ??= n.id, i;
|
|
1596
1603
|
}, Tn = (n, e) => {
|
|
1597
|
-
const t =
|
|
1604
|
+
const t = xe(n);
|
|
1598
1605
|
let s = e;
|
|
1599
1606
|
return s ??= t?.msid, s ??= n.label, (s && s.length > 0 ? s : void 0) ?? n.id;
|
|
1600
1607
|
};
|
|
1601
|
-
class
|
|
1608
|
+
class Ce {
|
|
1602
1609
|
participantGroups = /* @__PURE__ */ new Map();
|
|
1603
1610
|
trackToGroup = /* @__PURE__ */ new Map();
|
|
1604
1611
|
trackDisposers = /* @__PURE__ */ new Map();
|
|
@@ -1628,11 +1635,11 @@ class Ee {
|
|
|
1628
1635
|
}, a.set(r, h)), h.stream.addTrack(e), h.trackIds.add(e.id), this.trackToGroup.set(e.id, { participantId: i, groupId: r });
|
|
1629
1636
|
const u = () => {
|
|
1630
1637
|
this.disposeTrackListener(e.id);
|
|
1631
|
-
const
|
|
1632
|
-
|
|
1638
|
+
const g = this.removeTrack(e.id);
|
|
1639
|
+
g.isRemovedTrack && t?.({
|
|
1633
1640
|
participantId: i,
|
|
1634
1641
|
trackId: e.id,
|
|
1635
|
-
isRemovedStream:
|
|
1642
|
+
isRemovedStream: g.isRemovedStream
|
|
1636
1643
|
});
|
|
1637
1644
|
};
|
|
1638
1645
|
return e.addEventListener("ended", u), this.trackDisposers.set(e.id, () => {
|
|
@@ -1757,13 +1764,13 @@ class p {
|
|
|
1757
1764
|
this.role = e, this.onRoleChanged?.({ previous: t, next: e });
|
|
1758
1765
|
}
|
|
1759
1766
|
}
|
|
1760
|
-
const
|
|
1767
|
+
const Cn = (n, e) => {
|
|
1761
1768
|
if (!n || !e)
|
|
1762
1769
|
return n === e;
|
|
1763
1770
|
const t = n.mainStream?.id, s = e.mainStream?.id, i = n.contentedStream?.id, r = e.contentedStream?.id;
|
|
1764
1771
|
return t === s && i === r;
|
|
1765
1772
|
};
|
|
1766
|
-
class
|
|
1773
|
+
class mn {
|
|
1767
1774
|
lastEmittedStreams;
|
|
1768
1775
|
/**
|
|
1769
1776
|
* Проверяет, изменились ли streams с последнего сохраненного состояния
|
|
@@ -1771,7 +1778,7 @@ class Cn {
|
|
|
1771
1778
|
* @returns true, если streams изменились
|
|
1772
1779
|
*/
|
|
1773
1780
|
hasChanged(e) {
|
|
1774
|
-
return !
|
|
1781
|
+
return !Cn(this.lastEmittedStreams, e);
|
|
1775
1782
|
}
|
|
1776
1783
|
/**
|
|
1777
1784
|
* Сохраняет текущие streams как последнее эмитнутое состояние
|
|
@@ -1848,8 +1855,8 @@ class Mn {
|
|
|
1848
1855
|
stateMachine;
|
|
1849
1856
|
isPendingCall = !1;
|
|
1850
1857
|
isPendingAnswer = !1;
|
|
1851
|
-
mainRemoteStreamsManager = new
|
|
1852
|
-
recvRemoteStreamsManager = new
|
|
1858
|
+
mainRemoteStreamsManager = new Ce();
|
|
1859
|
+
recvRemoteStreamsManager = new Ce();
|
|
1853
1860
|
streamsManagerProvider;
|
|
1854
1861
|
contentedStreamManager;
|
|
1855
1862
|
tools;
|
|
@@ -1860,7 +1867,7 @@ class Mn {
|
|
|
1860
1867
|
recvSession;
|
|
1861
1868
|
disposeRecvSessionTrackListener;
|
|
1862
1869
|
deferredStartRecvSessionRunner;
|
|
1863
|
-
streamsChangeTracker = new
|
|
1870
|
+
streamsChangeTracker = new mn();
|
|
1864
1871
|
constructor({ contentedStreamManager: e }, t) {
|
|
1865
1872
|
this.contentedStreamManager = e, this.tools = t, this.events = tn(), this.mcuSession = new cn(this.events, { onReset: this.reset }), this.stateMachine = new Kt(this.events), this.streamsManagerProvider = new vn(
|
|
1866
1873
|
this.mainRemoteStreamsManager,
|
|
@@ -1925,14 +1932,14 @@ class Mn {
|
|
|
1925
1932
|
subscribeToApiEvents(e) {
|
|
1926
1933
|
this.stateMachine.subscribeToApiEvents(e.events);
|
|
1927
1934
|
}
|
|
1928
|
-
startCall = async (e, t, s) => (this.isPendingCall = !0, this.events.emit(
|
|
1935
|
+
startCall = async (e, t, s) => (this.isPendingCall = !0, this.events.emit(S.START_CALL, {
|
|
1929
1936
|
number: s.number,
|
|
1930
1937
|
answer: !1
|
|
1931
1938
|
}), this.mcuSession.startCall(e, t, s).finally(() => {
|
|
1932
1939
|
this.isPendingCall = !1;
|
|
1933
1940
|
}));
|
|
1934
1941
|
async endCall() {
|
|
1935
|
-
return this.events.emit(
|
|
1942
|
+
return this.events.emit(S.END_CALL), this.mcuSession.endCall();
|
|
1936
1943
|
}
|
|
1937
1944
|
async renegotiate() {
|
|
1938
1945
|
return this.roleManager.hasSpectator() ? this.renegotiateRecvSession() : this.renegotiateMcuSession();
|
|
@@ -1940,7 +1947,7 @@ class Mn {
|
|
|
1940
1947
|
answerToIncomingCall = async (e, t) => {
|
|
1941
1948
|
this.isPendingAnswer = !0;
|
|
1942
1949
|
const s = e();
|
|
1943
|
-
return this.events.emit(
|
|
1950
|
+
return this.events.emit(S.START_CALL, {
|
|
1944
1951
|
answer: !0,
|
|
1945
1952
|
number: s.remote_identity.uri.user
|
|
1946
1953
|
}), this.mcuSession.answerToIncomingCall(s, t).finally(() => {
|
|
@@ -1992,7 +1999,7 @@ class Mn {
|
|
|
1992
1999
|
if (e === s && a === i)
|
|
1993
2000
|
return !1;
|
|
1994
2001
|
if (a === i)
|
|
1995
|
-
return await t.setQuality(e), this.events.trigger(
|
|
2002
|
+
return await t.setQuality(e), this.events.trigger(S.RECV_QUALITY_CHANGED, {
|
|
1996
2003
|
previousQuality: s,
|
|
1997
2004
|
quality: e,
|
|
1998
2005
|
effectiveQuality: i
|
|
@@ -2003,7 +2010,7 @@ class Mn {
|
|
|
2003
2010
|
);
|
|
2004
2011
|
if (c) {
|
|
2005
2012
|
const h = o.getEffectiveQuality();
|
|
2006
|
-
this.events.trigger(
|
|
2013
|
+
this.events.trigger(S.RECV_QUALITY_CHANGED, {
|
|
2007
2014
|
previousQuality: s,
|
|
2008
2015
|
quality: e,
|
|
2009
2016
|
effectiveQuality: h
|
|
@@ -2016,7 +2023,7 @@ class Mn {
|
|
|
2016
2023
|
if (!this.roleManager.hasSpectator() || !t)
|
|
2017
2024
|
return !1;
|
|
2018
2025
|
const s = t.getQuality(), i = await t.applyQuality(e);
|
|
2019
|
-
return i.applied && this.events.trigger(
|
|
2026
|
+
return i.applied && this.events.trigger(S.RECV_QUALITY_CHANGED, {
|
|
2020
2027
|
previousQuality: s,
|
|
2021
2028
|
quality: e,
|
|
2022
2029
|
effectiveQuality: i.effectiveQuality
|
|
@@ -2026,13 +2033,13 @@ class Mn {
|
|
|
2026
2033
|
this.emitFailedCall(e, t), await this.endCall();
|
|
2027
2034
|
}
|
|
2028
2035
|
emitFailedCall(e, t) {
|
|
2029
|
-
this.events.trigger(
|
|
2036
|
+
this.events.trigger(S.FAILED, { message: e, cause: t, originator: "local" });
|
|
2030
2037
|
}
|
|
2031
2038
|
reset = () => {
|
|
2032
2039
|
this.mainRemoteStreamsManager.reset(), this.roleManager.reset(), this.recvRemoteStreamsManager.reset(), this.stopRecvSession(), this.deferredStartRecvSessionRunner.cancel(), this.streamsChangeTracker.reset();
|
|
2033
2040
|
};
|
|
2034
2041
|
subscribeCallStatusChange() {
|
|
2035
|
-
const { ACCEPTED: e, CONFIRMED: t, ENDED: s, FAILED: i } =
|
|
2042
|
+
const { ACCEPTED: e, CONFIRMED: t, ENDED: s, FAILED: i } = S, r = this.createCallStatusChangeListener();
|
|
2036
2043
|
this.onRace([e, t, s, i], r);
|
|
2037
2044
|
}
|
|
2038
2045
|
/** Хранит prev/next и эмитит CALL_STATUS_CHANGED только при реальном изменении. */
|
|
@@ -2040,11 +2047,11 @@ class Mn {
|
|
|
2040
2047
|
let e = this.isCallActive;
|
|
2041
2048
|
return () => {
|
|
2042
2049
|
const t = this.isCallActive;
|
|
2043
|
-
t !== e && this.events.trigger(
|
|
2050
|
+
t !== e && this.events.trigger(S.CALL_STATUS_CHANGED, { isCallActive: t }), e = t;
|
|
2044
2051
|
};
|
|
2045
2052
|
}
|
|
2046
2053
|
subscribeMcuRemoteTrackEvents() {
|
|
2047
|
-
this.on(
|
|
2054
|
+
this.on(S.PEER_CONNECTION_ONTRACK, (e) => {
|
|
2048
2055
|
this.addRemoteTrack(this.mainRemoteStreamsManager, e.track, me(e));
|
|
2049
2056
|
});
|
|
2050
2057
|
}
|
|
@@ -2080,7 +2087,7 @@ class Mn {
|
|
|
2080
2087
|
this.emitEventChangedRemoteTracks(c, t, { trackId: s, participantId: i }), (a || r) && this.emitEventChangedRemoteStreams(c);
|
|
2081
2088
|
}
|
|
2082
2089
|
emitEventChangedRemoteTracks(e, t, { trackId: s, participantId: i }) {
|
|
2083
|
-
this.events.trigger(
|
|
2090
|
+
this.events.trigger(S.REMOTE_TRACKS_CHANGED, {
|
|
2084
2091
|
streams: e,
|
|
2085
2092
|
changeType: t,
|
|
2086
2093
|
trackId: s,
|
|
@@ -2091,7 +2098,7 @@ class Mn {
|
|
|
2091
2098
|
this.emitEventChangedRemoteStreams(this.getRemoteStreams());
|
|
2092
2099
|
};
|
|
2093
2100
|
emitEventChangedRemoteStreams(e) {
|
|
2094
|
-
this.streamsChangeTracker.hasChanged(e) && (this.streamsChangeTracker.updateLastEmittedStreams(e), this.events.trigger(
|
|
2101
|
+
this.streamsChangeTracker.hasChanged(e) && (this.streamsChangeTracker.updateLastEmittedStreams(e), this.events.trigger(S.REMOTE_STREAMS_CHANGED, { streams: e }));
|
|
2095
2102
|
}
|
|
2096
2103
|
getActiveStreamsManagerTools() {
|
|
2097
2104
|
return this.streamsManagerProvider.getActiveStreamsManagerTools({
|
|
@@ -2126,8 +2133,12 @@ class Mn {
|
|
|
2126
2133
|
audioChannel: e,
|
|
2127
2134
|
quality: t
|
|
2128
2135
|
}, o = new un(a, { sendOffer: this.tools.sendOffer });
|
|
2129
|
-
return this.recvSession = o, this.recvRemoteStreamsManager.reset(), this.attachRecvSessionTracks(o), o.call({ conferenceNumber: r, token: s }).then((h) => (i !== !0 && this.events.emit("recv-session-started"), { session: o, callResult: h })).catch((h) => {
|
|
2130
|
-
|
|
2136
|
+
return this.recvSession = o, this.recvRemoteStreamsManager.reset(), this.attachRecvSessionTracks(o), o.call({ conferenceNumber: r, token: s }).then((h) => (i !== !0 && this.events.emit("recv-session-started"), { session: o, callResult: h })).catch(async (h) => {
|
|
2137
|
+
this.stopRecvSession();
|
|
2138
|
+
const u = new Me();
|
|
2139
|
+
u.body = h instanceof Error ? h.message : String(h);
|
|
2140
|
+
const g = _e.causes.INTERNAL_ERROR;
|
|
2141
|
+
throw await this.failed(u, g), h;
|
|
2131
2142
|
});
|
|
2132
2143
|
}
|
|
2133
2144
|
stopRecvSession({ silent: e } = {}) {
|
|
@@ -2164,13 +2175,13 @@ class Mn {
|
|
|
2164
2175
|
}
|
|
2165
2176
|
}
|
|
2166
2177
|
var w = /* @__PURE__ */ ((n) => (n.START_PRESENTATION = "presentation:start", n.STARTED_PRESENTATION = "presentation:started", n.END_PRESENTATION = "presentation:end", n.ENDED_PRESENTATION = "presentation:ended", n.FAILED_PRESENTATION = "presentation:failed", n))(w || {});
|
|
2167
|
-
const
|
|
2178
|
+
const He = [
|
|
2168
2179
|
"presentation:start",
|
|
2169
2180
|
"presentation:started",
|
|
2170
2181
|
"presentation:end",
|
|
2171
2182
|
"presentation:ended",
|
|
2172
2183
|
"presentation:failed"
|
|
2173
|
-
], _n = () => new M(
|
|
2184
|
+
], _n = () => new M(He);
|
|
2174
2185
|
var bn = /* @__PURE__ */ ((n) => (n.IDLE = "presentation:idle", n.STARTING = "presentation:starting", n.ACTIVE = "presentation:active", n.STOPPING = "presentation:stopping", n.FAILED = "presentation:failed", n))(bn || {});
|
|
2175
2186
|
const On = q({
|
|
2176
2187
|
types: {
|
|
@@ -2539,31 +2550,31 @@ class Pn extends x {
|
|
|
2539
2550
|
}
|
|
2540
2551
|
subscribeCallEvents(e) {
|
|
2541
2552
|
this.addSubscription(
|
|
2542
|
-
e.on(
|
|
2553
|
+
e.on(S.START_PRESENTATION, () => {
|
|
2543
2554
|
this.send({ type: "SCREEN.STARTING" });
|
|
2544
2555
|
})
|
|
2545
2556
|
), this.addSubscription(
|
|
2546
|
-
e.on(
|
|
2557
|
+
e.on(S.STARTED_PRESENTATION, () => {
|
|
2547
2558
|
this.send({ type: "SCREEN.STARTED" });
|
|
2548
2559
|
})
|
|
2549
2560
|
), this.addSubscription(
|
|
2550
|
-
e.on(
|
|
2561
|
+
e.on(S.END_PRESENTATION, () => {
|
|
2551
2562
|
this.send({ type: "SCREEN.ENDING" });
|
|
2552
2563
|
})
|
|
2553
2564
|
), this.addSubscription(
|
|
2554
|
-
e.on(
|
|
2565
|
+
e.on(S.ENDED_PRESENTATION, () => {
|
|
2555
2566
|
this.send({ type: "SCREEN.ENDED" });
|
|
2556
2567
|
})
|
|
2557
2568
|
), this.addSubscription(
|
|
2558
|
-
e.on(
|
|
2569
|
+
e.on(S.FAILED_PRESENTATION, (t) => {
|
|
2559
2570
|
this.send({ type: "SCREEN.FAILED", error: t });
|
|
2560
2571
|
})
|
|
2561
2572
|
), this.addSubscription(
|
|
2562
|
-
e.on(
|
|
2573
|
+
e.on(S.ENDED, () => {
|
|
2563
2574
|
this.send({ type: "CALL.ENDED" });
|
|
2564
2575
|
})
|
|
2565
2576
|
), this.addSubscription(
|
|
2566
|
-
e.on(
|
|
2577
|
+
e.on(S.FAILED, (t) => {
|
|
2567
2578
|
this.send({ type: "CALL.FAILED", error: t });
|
|
2568
2579
|
})
|
|
2569
2580
|
);
|
|
@@ -2687,7 +2698,7 @@ class yn {
|
|
|
2687
2698
|
s,
|
|
2688
2699
|
i
|
|
2689
2700
|
), o = () => !!this.streamPresentationCurrent;
|
|
2690
|
-
return this.cancelableSendPresentationWithRepeatedCalls =
|
|
2701
|
+
return this.cancelableSendPresentationWithRepeatedCalls = le({
|
|
2691
2702
|
targetFunction: a,
|
|
2692
2703
|
isComplete: o,
|
|
2693
2704
|
isRejectAsValid: !0,
|
|
@@ -2710,10 +2721,10 @@ class yn {
|
|
|
2710
2721
|
degradationPreference: a,
|
|
2711
2722
|
sendEncodings: o,
|
|
2712
2723
|
onAddedTransceiver: c
|
|
2713
|
-
})).then(this.setMaxBitrate).then(() => s).catch((
|
|
2724
|
+
})).then(this.setMaxBitrate).then(() => s).catch((g) => {
|
|
2714
2725
|
this.removeStreamPresentationCurrent();
|
|
2715
|
-
const E =
|
|
2716
|
-
throw this.events.trigger(w.FAILED_PRESENTATION, E),
|
|
2726
|
+
const E = g instanceof Error ? g : new Error(String(g));
|
|
2727
|
+
throw this.events.trigger(w.FAILED_PRESENTATION, E), g;
|
|
2717
2728
|
});
|
|
2718
2729
|
return this.promisePendingStartPresentation = u, u.finally(() => {
|
|
2719
2730
|
this.promisePendingStartPresentation = void 0;
|
|
@@ -2831,8 +2842,8 @@ class Ln {
|
|
|
2831
2842
|
return this.data?.register === !0;
|
|
2832
2843
|
}
|
|
2833
2844
|
}
|
|
2834
|
-
var
|
|
2835
|
-
const
|
|
2845
|
+
var C = /* @__PURE__ */ ((n) => (n.CONNECTING = "connecting", n.CONNECTED = "connected", n.DISCONNECTED = "disconnected", n.DISCONNECTING = "disconnecting", n.NEW_RTC_SESSION = "newRTCSession", n.REGISTERED = "registered", n.UNREGISTERED = "unregistered", n.REGISTRATION_FAILED = "registrationFailed", n.NEW_MESSAGE = "newMessage", n.SIP_EVENT = "sipEvent", n.CONNECT_STARTED = "connect-started", n.CONNECT_SUCCEEDED = "connect-succeeded", n.CONNECT_FAILED = "connect-failed", n.CONNECT_PARAMETERS_RESOLVE_SUCCESS = "connect-parameters-resolve-success", n.CONNECT_PARAMETERS_RESOLVE_FAILED = "connect-parameters-resolve-failed", n.CONNECTED_WITH_CONFIGURATION = "connected-with-configuration", n))(C || {});
|
|
2846
|
+
const Qe = [
|
|
2836
2847
|
"connecting",
|
|
2837
2848
|
"connected",
|
|
2838
2849
|
"disconnected",
|
|
@@ -2850,11 +2861,11 @@ const qe = [
|
|
|
2850
2861
|
"connect-parameters-resolve-success",
|
|
2851
2862
|
"connect-parameters-resolve-failed",
|
|
2852
2863
|
"connected-with-configuration"
|
|
2853
|
-
],
|
|
2864
|
+
], We = [...Qe, ...wn], Un = () => new M(We);
|
|
2854
2865
|
function kn(n) {
|
|
2855
2866
|
return (e) => `sip:${e}@${n}`;
|
|
2856
2867
|
}
|
|
2857
|
-
const Fn = (n, e) => () => Math.floor(Math.random() * (e - n)) + n,
|
|
2868
|
+
const Fn = (n, e) => () => Math.floor(Math.random() * (e - n)) + n, Ye = (n) => n.trim().replaceAll(" ", "_"), Bn = Fn(1e5, 99999999), $n = 3;
|
|
2858
2869
|
class Gn {
|
|
2859
2870
|
cancelableConnectWithRepeatedCalls;
|
|
2860
2871
|
events;
|
|
@@ -2880,18 +2891,18 @@ class Gn {
|
|
|
2880
2891
|
}
|
|
2881
2892
|
let r = !1;
|
|
2882
2893
|
const a = this.getConnectionConfiguration();
|
|
2883
|
-
e !== void 0 && e !== a?.displayName && (r = i.set("display_name",
|
|
2894
|
+
e !== void 0 && e !== a?.displayName && (r = i.set("display_name", Ye(e)), this.updateConnectionConfiguration("displayName", e));
|
|
2884
2895
|
const o = r;
|
|
2885
2896
|
o ? t(o) : s(new Error("nothing changed"));
|
|
2886
2897
|
});
|
|
2887
2898
|
disconnect = async () => {
|
|
2888
|
-
this.events.trigger(
|
|
2899
|
+
this.events.trigger(C.DISCONNECTING, {});
|
|
2889
2900
|
const e = new Promise((s) => {
|
|
2890
|
-
this.events.once(
|
|
2901
|
+
this.events.once(C.DISCONNECTED, () => {
|
|
2891
2902
|
s();
|
|
2892
2903
|
});
|
|
2893
2904
|
}), t = this.getUa();
|
|
2894
|
-
return t ? t.stop() : this.events.trigger(
|
|
2905
|
+
return t ? t.stop() : this.events.trigger(C.DISCONNECTED, { socket: {}, error: !1 }), e.finally(() => {
|
|
2895
2906
|
t?.removeAllListeners(), this.setUa(void 0), this.stateMachine.reset();
|
|
2896
2907
|
});
|
|
2897
2908
|
};
|
|
@@ -2903,7 +2914,7 @@ class Gn {
|
|
|
2903
2914
|
const c = this.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), h = r != null && !pt(r);
|
|
2904
2915
|
return c || h;
|
|
2905
2916
|
};
|
|
2906
|
-
return this.stateMachine.startConnect(), this.cancelableConnectWithRepeatedCalls =
|
|
2917
|
+
return this.stateMachine.startConnect(), this.cancelableConnectWithRepeatedCalls = le({
|
|
2907
2918
|
targetFunction: s,
|
|
2908
2919
|
isComplete: i,
|
|
2909
2920
|
callLimit: t,
|
|
@@ -2936,7 +2947,7 @@ class Gn {
|
|
|
2936
2947
|
connectionRecoveryMinInterval: c,
|
|
2937
2948
|
connectionRecoveryMaxInterval: h,
|
|
2938
2949
|
userAgent: u,
|
|
2939
|
-
displayName:
|
|
2950
|
+
displayName: g = "",
|
|
2940
2951
|
register: E = !1,
|
|
2941
2952
|
extraHeaders: N = []
|
|
2942
2953
|
}) => {
|
|
@@ -2947,7 +2958,7 @@ class Gn {
|
|
|
2947
2958
|
password: t,
|
|
2948
2959
|
sipServerIp: s,
|
|
2949
2960
|
sipServerUrl: i,
|
|
2950
|
-
displayName:
|
|
2961
|
+
displayName: g,
|
|
2951
2962
|
register: E,
|
|
2952
2963
|
sessionTimers: a,
|
|
2953
2964
|
registerExpires: o,
|
|
@@ -2962,7 +2973,7 @@ class Gn {
|
|
|
2962
2973
|
return this.setConnectionConfiguration({
|
|
2963
2974
|
sipServerIp: s,
|
|
2964
2975
|
sipServerUrl: i,
|
|
2965
|
-
displayName:
|
|
2976
|
+
displayName: g,
|
|
2966
2977
|
authorizationUser: B,
|
|
2967
2978
|
register: E,
|
|
2968
2979
|
user: e,
|
|
@@ -2979,11 +2990,11 @@ class Gn {
|
|
|
2979
2990
|
i = ((c, h) => {
|
|
2980
2991
|
if (this.getConnectionConfiguration()?.register === !0)
|
|
2981
2992
|
return this.registrationManager.subscribeToStartEvents(c, h);
|
|
2982
|
-
const
|
|
2983
|
-
return this.events.on(
|
|
2993
|
+
const g = C.CONNECTED, E = [C.DISCONNECTED];
|
|
2994
|
+
return this.events.on(g, c), E.forEach((N) => {
|
|
2984
2995
|
this.events.on(N, h);
|
|
2985
2996
|
}), () => {
|
|
2986
|
-
this.events.off(
|
|
2997
|
+
this.events.off(g, c), E.forEach((N) => {
|
|
2987
2998
|
this.events.off(N, h);
|
|
2988
2999
|
});
|
|
2989
3000
|
};
|
|
@@ -2997,14 +3008,14 @@ class Gn {
|
|
|
2997
3008
|
this.cancelableConnectWithRepeatedCalls?.cancel();
|
|
2998
3009
|
}
|
|
2999
3010
|
proxyEvents() {
|
|
3000
|
-
this.events.on(
|
|
3011
|
+
this.events.on(C.CONNECTED, () => {
|
|
3001
3012
|
const e = this.getConnectionConfiguration();
|
|
3002
|
-
e !== void 0 && this.events.trigger(
|
|
3013
|
+
e !== void 0 && this.events.trigger(C.CONNECTED_WITH_CONFIGURATION, e);
|
|
3003
3014
|
});
|
|
3004
3015
|
}
|
|
3005
3016
|
}
|
|
3006
|
-
var Vn = /* @__PURE__ */ ((n) => (n.IDLE = "connection:idle", n.PREPARING = "connection:preparing", n.CONNECTING = "connection:connecting", n.CONNECTED = "connection:connected", n.REGISTERED = "connection:registered", n.ESTABLISHED = "connection:established", n.DISCONNECTING = "connection:disconnecting", n.DISCONNECTED = "connection:disconnected", n))(Vn || {}),
|
|
3007
|
-
const qn = Object.values(
|
|
3017
|
+
var Vn = /* @__PURE__ */ ((n) => (n.IDLE = "connection:idle", n.PREPARING = "connection:preparing", n.CONNECTING = "connection:connecting", n.CONNECTED = "connection:connected", n.REGISTERED = "connection:registered", n.ESTABLISHED = "connection:established", n.DISCONNECTING = "connection:disconnecting", n.DISCONNECTED = "connection:disconnected", n))(Vn || {}), ze = /* @__PURE__ */ ((n) => (n.START_CONNECT = "START_CONNECT", n.START_INIT_UA = "START_INIT_UA", n.START_DISCONNECT = "START_DISCONNECT", n.UA_CONNECTED = "UA_CONNECTED", n.UA_REGISTERED = "UA_REGISTERED", n.UA_UNREGISTERED = "UA_UNREGISTERED", n.UA_DISCONNECTED = "UA_DISCONNECTED", n.RESET = "RESET", n))(ze || {});
|
|
3018
|
+
const qn = Object.values(ze), xn = q({
|
|
3008
3019
|
types: {
|
|
3009
3020
|
context: {},
|
|
3010
3021
|
events: {}
|
|
@@ -3516,7 +3527,7 @@ class Hn extends x {
|
|
|
3516
3527
|
};
|
|
3517
3528
|
}
|
|
3518
3529
|
}
|
|
3519
|
-
class
|
|
3530
|
+
class Qn {
|
|
3520
3531
|
events;
|
|
3521
3532
|
getUaProtected;
|
|
3522
3533
|
constructor(e) {
|
|
@@ -3525,13 +3536,13 @@ class Wn {
|
|
|
3525
3536
|
async register() {
|
|
3526
3537
|
const e = this.getUaProtected();
|
|
3527
3538
|
return new Promise((t, s) => {
|
|
3528
|
-
e.on(
|
|
3539
|
+
e.on(C.REGISTERED, t), e.on(C.REGISTRATION_FAILED, s), e.register();
|
|
3529
3540
|
});
|
|
3530
3541
|
}
|
|
3531
3542
|
async unregister() {
|
|
3532
3543
|
const e = this.getUaProtected();
|
|
3533
3544
|
return new Promise((t) => {
|
|
3534
|
-
e.on(
|
|
3545
|
+
e.on(C.UNREGISTERED, t), e.unregister();
|
|
3535
3546
|
});
|
|
3536
3547
|
}
|
|
3537
3548
|
async tryRegister() {
|
|
@@ -3543,7 +3554,7 @@ class Wn {
|
|
|
3543
3554
|
return this.register();
|
|
3544
3555
|
}
|
|
3545
3556
|
subscribeToStartEvents(e, t) {
|
|
3546
|
-
const s =
|
|
3557
|
+
const s = C.REGISTERED, i = [C.REGISTRATION_FAILED, C.DISCONNECTED];
|
|
3547
3558
|
return this.events.on(s, e), i.forEach((r) => {
|
|
3548
3559
|
this.events.on(r, t);
|
|
3549
3560
|
}), () => {
|
|
@@ -3553,7 +3564,7 @@ class Wn {
|
|
|
3553
3564
|
};
|
|
3554
3565
|
}
|
|
3555
3566
|
}
|
|
3556
|
-
class
|
|
3567
|
+
class Wn {
|
|
3557
3568
|
uaFactory;
|
|
3558
3569
|
getUaProtected;
|
|
3559
3570
|
constructor(e) {
|
|
@@ -3604,17 +3615,17 @@ class Qn {
|
|
|
3604
3615
|
displayName: t,
|
|
3605
3616
|
userAgent: e,
|
|
3606
3617
|
sipServerIp: s
|
|
3607
|
-
}), u = this.uaFactory.createUA({ ...h, remoteAddress: r, extraHeaders: a }),
|
|
3618
|
+
}), u = this.uaFactory.createUA({ ...h, remoteAddress: r, extraHeaders: a }), g = () => {
|
|
3608
3619
|
const N = new Error("Telephony is not available");
|
|
3609
3620
|
c(N);
|
|
3610
3621
|
};
|
|
3611
|
-
u.once(
|
|
3622
|
+
u.once(C.DISCONNECTED, g);
|
|
3612
3623
|
const E = () => {
|
|
3613
|
-
u.removeAllListeners(), u.once(
|
|
3624
|
+
u.removeAllListeners(), u.once(C.DISCONNECTED, () => {
|
|
3614
3625
|
o();
|
|
3615
3626
|
}), u.stop();
|
|
3616
3627
|
};
|
|
3617
|
-
u.once(
|
|
3628
|
+
u.once(C.CONNECTED, E), u.start();
|
|
3618
3629
|
});
|
|
3619
3630
|
}
|
|
3620
3631
|
}
|
|
@@ -3665,7 +3676,7 @@ class F {
|
|
|
3665
3676
|
// 5 minutes in sec
|
|
3666
3677
|
connectionRecoveryMinInterval: h = 2,
|
|
3667
3678
|
connectionRecoveryMaxInterval: u = 6,
|
|
3668
|
-
userAgent:
|
|
3679
|
+
userAgent: g
|
|
3669
3680
|
}) {
|
|
3670
3681
|
F.validateParametersConnection({
|
|
3671
3682
|
register: a,
|
|
@@ -3680,8 +3691,8 @@ class F {
|
|
|
3680
3691
|
password: t,
|
|
3681
3692
|
register: a,
|
|
3682
3693
|
uri: y,
|
|
3683
|
-
display_name:
|
|
3684
|
-
user_agent:
|
|
3694
|
+
display_name: Ye(i),
|
|
3695
|
+
user_agent: g,
|
|
3685
3696
|
sdpSemantics: "unified-plan",
|
|
3686
3697
|
sockets: [I],
|
|
3687
3698
|
session_timers: o,
|
|
@@ -3709,12 +3720,12 @@ class F {
|
|
|
3709
3720
|
extraHeaders: e.extraHeaders
|
|
3710
3721
|
});
|
|
3711
3722
|
return t.eachTriggers((a, o) => {
|
|
3712
|
-
const c =
|
|
3723
|
+
const c = Qe.find((h) => h === o);
|
|
3713
3724
|
c && r.on(c, a);
|
|
3714
3725
|
}), { ua: r, helpers: i };
|
|
3715
3726
|
}
|
|
3716
3727
|
}
|
|
3717
|
-
const
|
|
3728
|
+
const Je = "Not ready for connection", zn = (n) => n instanceof Error && n.message === Je, Jn = () => new Error(Je), jn = async (n) => typeof n == "function" ? n() : n;
|
|
3718
3729
|
class Xn {
|
|
3719
3730
|
events;
|
|
3720
3731
|
stateMachine;
|
|
@@ -3726,12 +3737,12 @@ class Xn {
|
|
|
3726
3737
|
sipOperations;
|
|
3727
3738
|
configurationManager;
|
|
3728
3739
|
constructor({ JsSIP: e }) {
|
|
3729
|
-
this.events = Un(), this.uaFactory = new F(e), this.registrationManager = new
|
|
3740
|
+
this.events = Un(), this.uaFactory = new F(e), this.registrationManager = new Qn({
|
|
3730
3741
|
events: this.events,
|
|
3731
3742
|
getUaProtected: this.getUaProtected
|
|
3732
3743
|
}), this.stateMachine = new Hn(this.events), this.configurationManager = new Ln({
|
|
3733
3744
|
getUa: this.getUa
|
|
3734
|
-
}), this.sipOperations = new
|
|
3745
|
+
}), this.sipOperations = new Wn({
|
|
3735
3746
|
uaFactory: this.uaFactory,
|
|
3736
3747
|
getUaProtected: this.getUaProtected
|
|
3737
3748
|
}), this.connectionFlow = new Gn({
|
|
@@ -3852,18 +3863,18 @@ class Xn {
|
|
|
3852
3863
|
});
|
|
3853
3864
|
});
|
|
3854
3865
|
};
|
|
3855
|
-
processConnect = async (e, t) => (this.events.trigger(
|
|
3856
|
-
throw this.events.trigger(
|
|
3857
|
-
}).then(async (s) => this.connectionFlow.connect(s, t)).then((s) => (this.events.trigger(
|
|
3866
|
+
processConnect = async (e, t) => (this.events.trigger(C.CONNECT_STARTED, {}), jn(e).then((s) => (this.events.trigger(C.CONNECT_PARAMETERS_RESOLVE_SUCCESS, s), s)).catch((s) => {
|
|
3867
|
+
throw this.events.trigger(C.CONNECT_PARAMETERS_RESOLVE_FAILED, s), s;
|
|
3868
|
+
}).then(async (s) => this.connectionFlow.connect(s, t)).then((s) => (this.events.trigger(C.CONNECT_SUCCEEDED, {
|
|
3858
3869
|
...s
|
|
3859
3870
|
}), s)).catch((s) => {
|
|
3860
3871
|
const i = s ?? new Error("Failed to connect to server");
|
|
3861
|
-
throw this.events.trigger(
|
|
3872
|
+
throw this.events.trigger(C.CONNECT_FAILED, i), i;
|
|
3862
3873
|
}));
|
|
3863
3874
|
}
|
|
3864
3875
|
class Kn {
|
|
3865
3876
|
connectionManager;
|
|
3866
|
-
stackPromises =
|
|
3877
|
+
stackPromises = Oe({
|
|
3867
3878
|
noRunIsNotActual: !0
|
|
3868
3879
|
});
|
|
3869
3880
|
constructor({ connectionManager: e }) {
|
|
@@ -3875,10 +3886,10 @@ class Kn {
|
|
|
3875
3886
|
this.stackPromises.stop();
|
|
3876
3887
|
}
|
|
3877
3888
|
}
|
|
3878
|
-
const
|
|
3889
|
+
const pe = 0, Zn = 30;
|
|
3879
3890
|
class es {
|
|
3880
|
-
countInner =
|
|
3881
|
-
initialCount =
|
|
3891
|
+
countInner = pe;
|
|
3892
|
+
initialCount = pe;
|
|
3882
3893
|
limitInner = Zn;
|
|
3883
3894
|
isInProgress = !1;
|
|
3884
3895
|
onStatusChange;
|
|
@@ -3949,7 +3960,7 @@ class ts {
|
|
|
3949
3960
|
}
|
|
3950
3961
|
}
|
|
3951
3962
|
var _ = /* @__PURE__ */ ((n) => (n.BEFORE_ATTEMPT = "before-attempt", n.SUCCESS = "success", n.FAILED_ALL_ATTEMPTS = "failed-all-attempts", n.CANCELLED_ATTEMPTS = "cancelled-attempts", n.CHANGED_ATTEMPT_STATUS = "changed-attempt-status", n.STOP_ATTEMPTS_BY_ERROR = "stop-attempts-by-error", n.LIMIT_REACHED_ATTEMPTS = "limit-reached-attempts", n))(_ || {});
|
|
3952
|
-
const
|
|
3963
|
+
const je = [
|
|
3953
3964
|
"before-attempt",
|
|
3954
3965
|
"success",
|
|
3955
3966
|
"failed-all-attempts",
|
|
@@ -3957,8 +3968,8 @@ const Ye = [
|
|
|
3957
3968
|
"changed-attempt-status",
|
|
3958
3969
|
"stop-attempts-by-error",
|
|
3959
3970
|
"limit-reached-attempts"
|
|
3960
|
-
], ns = () => new M(
|
|
3961
|
-
class
|
|
3971
|
+
], ns = () => new M(je);
|
|
3972
|
+
class Te {
|
|
3962
3973
|
callManager;
|
|
3963
3974
|
disposers = [];
|
|
3964
3975
|
constructor({ callManager: e }) {
|
|
@@ -4013,7 +4024,7 @@ class as {
|
|
|
4013
4024
|
}) {
|
|
4014
4025
|
this.pingServerRequester = new rs({
|
|
4015
4026
|
connectionManager: e
|
|
4016
|
-
}), this.notActiveCallSubscriber = new
|
|
4027
|
+
}), this.notActiveCallSubscriber = new Te({ callManager: t });
|
|
4017
4028
|
}
|
|
4018
4029
|
start({ onFailRequest: e }) {
|
|
4019
4030
|
d("start"), this.notActiveCallSubscriber.subscribe({
|
|
@@ -4041,7 +4052,7 @@ class os {
|
|
|
4041
4052
|
connectionManager: e,
|
|
4042
4053
|
callManager: t
|
|
4043
4054
|
}) {
|
|
4044
|
-
this.connectionManager = e, this.notActiveCallSubscriber = new
|
|
4055
|
+
this.connectionManager = e, this.notActiveCallSubscriber = new Te({ callManager: t });
|
|
4045
4056
|
}
|
|
4046
4057
|
subscribe(e) {
|
|
4047
4058
|
this.unsubscribe(), this.disposers.push(
|
|
@@ -4068,7 +4079,7 @@ class os {
|
|
|
4068
4079
|
this.isRegistrationFailed = !1;
|
|
4069
4080
|
}
|
|
4070
4081
|
}
|
|
4071
|
-
const cs = 3e3, ds = 15e3,
|
|
4082
|
+
const cs = 3e3, ds = 15e3, Re = {
|
|
4072
4083
|
LIMIT_REACHED: "Limit reached",
|
|
4073
4084
|
FAILED_TO_RECONNECT: "Failed to reconnect"
|
|
4074
4085
|
}, hs = async () => {
|
|
@@ -4107,7 +4118,7 @@ class us {
|
|
|
4107
4118
|
onStatusChange: this.emitStatusChange
|
|
4108
4119
|
}), this.cancelableRequestBeforeRetry = new K(r), this.delayBetweenAttempts = new lt(
|
|
4109
4120
|
i?.timeoutBetweenAttempts ?? cs
|
|
4110
|
-
), this.notActiveCallSubscriber = new
|
|
4121
|
+
), this.notActiveCallSubscriber = new Te({ callManager: s });
|
|
4111
4122
|
}
|
|
4112
4123
|
start(e) {
|
|
4113
4124
|
d("auto connector start"), this.restartConnectionAttempts(e), this.subscribeToNotActiveCall(e);
|
|
@@ -4187,7 +4198,7 @@ class us {
|
|
|
4187
4198
|
d("executeConnectionAttempt: error", e), this.scheduleReconnect(t);
|
|
4188
4199
|
}
|
|
4189
4200
|
handleLimitReached(e) {
|
|
4190
|
-
this.attemptsState.finishAttempt(), this.events.trigger(_.LIMIT_REACHED_ATTEMPTS, new Error(
|
|
4201
|
+
this.attemptsState.finishAttempt(), this.events.trigger(_.LIMIT_REACHED_ATTEMPTS, new Error(Re.LIMIT_REACHED)), this.startCheckTelephony(e);
|
|
4191
4202
|
}
|
|
4192
4203
|
handleSucceededAttempt(e) {
|
|
4193
4204
|
d("handleSucceededAttempt"), this.subscribeToConnectTriggers(e), this.events.trigger(_.SUCCESS);
|
|
@@ -4248,7 +4259,7 @@ class us {
|
|
|
4248
4259
|
}
|
|
4249
4260
|
scheduleReconnect(e) {
|
|
4250
4261
|
d("scheduleReconnect"), this.delayBetweenAttempts.request().then(async () => (d("scheduleReconnect: delayBetweenAttempts success"), this.cancelableRequestBeforeRetry.request())).then(async () => (d("scheduleReconnect: onBeforeRetry success"), this.attemptConnection(e))).catch((t) => {
|
|
4251
|
-
const s = t instanceof Error ? t : new Error(
|
|
4262
|
+
const s = t instanceof Error ? t : new Error(Re.FAILED_TO_RECONNECT);
|
|
4252
4263
|
this.attemptsState.finishAttempt(), ct(t) || ut(t) ? this.events.trigger(_.CANCELLED_ATTEMPTS, s) : this.events.trigger(_.FAILED_ALL_ATTEMPTS, s), d("scheduleReconnect: error", t);
|
|
4253
4264
|
});
|
|
4254
4265
|
}
|
|
@@ -4350,7 +4361,7 @@ const Ss = [
|
|
|
4350
4361
|
"not-available"
|
|
4351
4362
|
/* NOT_AVAILABLE */
|
|
4352
4363
|
], Es = () => new M(Ss);
|
|
4353
|
-
class
|
|
4364
|
+
class Cs {
|
|
4354
4365
|
events;
|
|
4355
4366
|
stateMachine;
|
|
4356
4367
|
constructor() {
|
|
@@ -4388,12 +4399,12 @@ class ms {
|
|
|
4388
4399
|
}
|
|
4389
4400
|
}
|
|
4390
4401
|
var G = /* @__PURE__ */ ((n) => (n.RINGING = "ringing", n.DECLINED_INCOMING_CALL = "declinedIncomingCall", n.TERMINATED_INCOMING_CALL = "terminatedIncomingCall", n.FAILED_INCOMING_CALL = "failedIncomingCall", n))(G || {});
|
|
4391
|
-
const
|
|
4402
|
+
const Xe = [
|
|
4392
4403
|
"ringing",
|
|
4393
4404
|
"declinedIncomingCall",
|
|
4394
4405
|
"terminatedIncomingCall",
|
|
4395
4406
|
"failedIncomingCall"
|
|
4396
|
-
],
|
|
4407
|
+
], ms = () => new M(Xe);
|
|
4397
4408
|
var ps = /* @__PURE__ */ ((n) => (n.IDLE = "incoming:idle", n.RINGING = "incoming:ringing", n.CONSUMED = "incoming:consumed", n.DECLINED = "incoming:declined", n.TERMINATED = "incoming:terminated", n.FAILED = "incoming:failed", n))(ps || {});
|
|
4398
4409
|
const Rs = q({
|
|
4399
4410
|
types: {
|
|
@@ -4797,15 +4808,15 @@ class Ns extends x {
|
|
|
4797
4808
|
}
|
|
4798
4809
|
subscribeConnectionEvents(e) {
|
|
4799
4810
|
this.addSubscription(
|
|
4800
|
-
e.on(
|
|
4811
|
+
e.on(C.DISCONNECTED, () => {
|
|
4801
4812
|
this.toClearIncoming();
|
|
4802
4813
|
})
|
|
4803
4814
|
), this.addSubscription(
|
|
4804
|
-
e.on(
|
|
4815
|
+
e.on(C.REGISTRATION_FAILED, () => {
|
|
4805
4816
|
this.toClearIncoming();
|
|
4806
4817
|
})
|
|
4807
4818
|
), this.addSubscription(
|
|
4808
|
-
e.on(
|
|
4819
|
+
e.on(C.CONNECT_FAILED, () => {
|
|
4809
4820
|
this.toClearIncoming();
|
|
4810
4821
|
})
|
|
4811
4822
|
);
|
|
@@ -4826,7 +4837,7 @@ class vs {
|
|
|
4826
4837
|
incomingRTCSession;
|
|
4827
4838
|
connectionManager;
|
|
4828
4839
|
constructor(e) {
|
|
4829
|
-
this.connectionManager = e, this.events =
|
|
4840
|
+
this.connectionManager = e, this.events = ms(), this.stateMachine = new Ns({
|
|
4830
4841
|
incomingEvents: this.events,
|
|
4831
4842
|
connectionEvents: this.connectionManager.events
|
|
4832
4843
|
}), this.start();
|
|
@@ -4943,8 +4954,8 @@ class fs {
|
|
|
4943
4954
|
s.sendEnterRoom(i);
|
|
4944
4955
|
};
|
|
4945
4956
|
}
|
|
4946
|
-
var
|
|
4947
|
-
const
|
|
4957
|
+
var Ke = /* @__PURE__ */ ((n) => (n.SNAPSHOT_CHANGED = "snapshot-changed", n))(Ke || {});
|
|
4958
|
+
const Ze = ["snapshot-changed"], Ms = () => new M(Ze), _s = (n, e) => Object.is(n, e), Ne = (n) => ({
|
|
4948
4959
|
connection: n.connection.getSnapshot(),
|
|
4949
4960
|
call: n.call.getSnapshot(),
|
|
4950
4961
|
incoming: n.incoming.getSnapshot(),
|
|
@@ -4962,7 +4973,7 @@ class bs {
|
|
|
4962
4973
|
call: e.callManager.stateMachine,
|
|
4963
4974
|
incoming: e.incomingCallManager.stateMachine,
|
|
4964
4975
|
presentation: e.presentationManager.stateMachine
|
|
4965
|
-
}, this.currentSnapshot =
|
|
4976
|
+
}, this.currentSnapshot = Ne(this.machines), this.actorSubscriptions.push(
|
|
4966
4977
|
this.machines.connection.subscribe(this.notifySubscribers),
|
|
4967
4978
|
this.machines.call.subscribe(this.notifySubscribers),
|
|
4968
4979
|
this.machines.incoming.subscribe(this.notifySubscribers),
|
|
@@ -4996,12 +5007,12 @@ class bs {
|
|
|
4996
5007
|
}
|
|
4997
5008
|
notifySubscribers = () => {
|
|
4998
5009
|
const e = this.currentSnapshot;
|
|
4999
|
-
this.currentSnapshot =
|
|
5010
|
+
this.currentSnapshot = Ne(this.machines);
|
|
5000
5011
|
for (const t of this.subscribers) {
|
|
5001
5012
|
const s = t.selector(this.currentSnapshot);
|
|
5002
5013
|
t.equals(t.current, s) || (t.current = s, t.listener(s));
|
|
5003
5014
|
}
|
|
5004
|
-
this.events.trigger(
|
|
5015
|
+
this.events.trigger(Ke.SNAPSHOT_CHANGED, {
|
|
5005
5016
|
previous: e,
|
|
5006
5017
|
current: this.currentSnapshot
|
|
5007
5018
|
});
|
|
@@ -5009,7 +5020,7 @@ class bs {
|
|
|
5009
5020
|
}
|
|
5010
5021
|
const $ = 1e3;
|
|
5011
5022
|
var R = /* @__PURE__ */ ((n) => (n.INBOUND_RTP = "inbound-rtp", n.REMOTE_OUTBOUND_RTP = "remote-outbound-rtp", n.MEDIA_SOURCE = "media-source", n.OUTBOUND_RTP = "outbound-rtp", n.REMOTE_INBOUND_RTP = "remote-inbound-rtp", n.CODEC = "codec", n.CANDIDATE_PAIR = "candidate-pair", n.CERTIFICATE = "certificate", n.TRANSPORT = "transport", n.LOCAL_CANDIDATE = "local-candidate", n.REMOTE_CANDIDATE = "remote-candidate", n))(R || {});
|
|
5012
|
-
const
|
|
5023
|
+
const et = ["collected"], Os = () => new M(et), Ae = () => "performance" in window ? performance.now() : Date.now(), Q = (n) => [...n.keys()].reduce((e, t) => {
|
|
5013
5024
|
const s = n.get(t);
|
|
5014
5025
|
return s === void 0 ? e : { ...e, [s.type]: s };
|
|
5015
5026
|
}, {}), Ps = (n) => {
|
|
@@ -5020,14 +5031,14 @@ const Xe = ["collected"], Os = () => new M(Xe), Ne = () => "performance" in wind
|
|
|
5020
5031
|
mediaSource: void 0,
|
|
5021
5032
|
remoteInboundRtp: void 0
|
|
5022
5033
|
};
|
|
5023
|
-
const e =
|
|
5034
|
+
const e = Q(n);
|
|
5024
5035
|
return {
|
|
5025
5036
|
outboundRtp: e[R.OUTBOUND_RTP],
|
|
5026
5037
|
codec: e[R.CODEC],
|
|
5027
5038
|
mediaSource: e[R.MEDIA_SOURCE],
|
|
5028
5039
|
remoteInboundRtp: e[R.REMOTE_INBOUND_RTP]
|
|
5029
5040
|
};
|
|
5030
|
-
},
|
|
5041
|
+
}, Ie = (n) => {
|
|
5031
5042
|
if (!n)
|
|
5032
5043
|
return {
|
|
5033
5044
|
outboundRtp: void 0,
|
|
@@ -5035,14 +5046,14 @@ const Xe = ["collected"], Os = () => new M(Xe), Ne = () => "performance" in wind
|
|
|
5035
5046
|
mediaSource: void 0,
|
|
5036
5047
|
remoteInboundRtp: void 0
|
|
5037
5048
|
};
|
|
5038
|
-
const e =
|
|
5049
|
+
const e = Q(n);
|
|
5039
5050
|
return {
|
|
5040
5051
|
outboundRtp: e[R.OUTBOUND_RTP],
|
|
5041
5052
|
codec: e[R.CODEC],
|
|
5042
5053
|
mediaSource: e[R.MEDIA_SOURCE],
|
|
5043
5054
|
remoteInboundRtp: e[R.REMOTE_INBOUND_RTP]
|
|
5044
5055
|
};
|
|
5045
|
-
},
|
|
5056
|
+
}, ve = ({
|
|
5046
5057
|
videoReceiversStats: n,
|
|
5047
5058
|
synchronizationSourcesVideo: e
|
|
5048
5059
|
}) => {
|
|
@@ -5052,7 +5063,7 @@ const Xe = ["collected"], Os = () => new M(Xe), Ne = () => "performance" in wind
|
|
|
5052
5063
|
codec: void 0,
|
|
5053
5064
|
synchronizationSources: e
|
|
5054
5065
|
};
|
|
5055
|
-
const t =
|
|
5066
|
+
const t = Q(n);
|
|
5056
5067
|
return {
|
|
5057
5068
|
inboundRtp: t[R.INBOUND_RTP],
|
|
5058
5069
|
codec: t[R.CODEC],
|
|
@@ -5069,14 +5080,14 @@ const Xe = ["collected"], Os = () => new M(Xe), Ne = () => "performance" in wind
|
|
|
5069
5080
|
remoteOutboundRtp: void 0,
|
|
5070
5081
|
synchronizationSources: e
|
|
5071
5082
|
};
|
|
5072
|
-
const t =
|
|
5083
|
+
const t = Q(n);
|
|
5073
5084
|
return {
|
|
5074
5085
|
inboundRtp: t[R.INBOUND_RTP],
|
|
5075
5086
|
codec: t[R.CODEC],
|
|
5076
5087
|
remoteOutboundRtp: t[R.REMOTE_OUTBOUND_RTP],
|
|
5077
5088
|
synchronizationSources: e
|
|
5078
5089
|
};
|
|
5079
|
-
},
|
|
5090
|
+
}, tt = (n) => {
|
|
5080
5091
|
if (!n)
|
|
5081
5092
|
return {
|
|
5082
5093
|
candidatePair: void 0,
|
|
@@ -5085,7 +5096,7 @@ const Xe = ["collected"], Os = () => new M(Xe), Ne = () => "performance" in wind
|
|
|
5085
5096
|
remoteCandidate: void 0,
|
|
5086
5097
|
transport: void 0
|
|
5087
5098
|
};
|
|
5088
|
-
const e =
|
|
5099
|
+
const e = Q(n);
|
|
5089
5100
|
return {
|
|
5090
5101
|
candidatePair: e[R.CANDIDATE_PAIR],
|
|
5091
5102
|
certificate: e[R.CERTIFICATE],
|
|
@@ -5098,10 +5109,10 @@ const Xe = ["collected"], Os = () => new M(Xe), Ne = () => "performance" in wind
|
|
|
5098
5109
|
videoSenderFirstStats: e,
|
|
5099
5110
|
videoSenderSecondStats: t
|
|
5100
5111
|
}) => ({
|
|
5101
|
-
video:
|
|
5102
|
-
secondVideo:
|
|
5112
|
+
video: Ie(e),
|
|
5113
|
+
secondVideo: Ie(t),
|
|
5103
5114
|
audio: Ps(n),
|
|
5104
|
-
additional:
|
|
5115
|
+
additional: tt(
|
|
5105
5116
|
n ?? e ?? t
|
|
5106
5117
|
)
|
|
5107
5118
|
}), Ls = ({
|
|
@@ -5110,11 +5121,11 @@ const Xe = ["collected"], Os = () => new M(Xe), Ne = () => "performance" in wind
|
|
|
5110
5121
|
videoReceiverSecondStats: t,
|
|
5111
5122
|
synchronizationSources: s
|
|
5112
5123
|
}) => ({
|
|
5113
|
-
video:
|
|
5124
|
+
video: ve({
|
|
5114
5125
|
videoReceiversStats: e,
|
|
5115
5126
|
synchronizationSourcesVideo: s.video
|
|
5116
5127
|
}),
|
|
5117
|
-
secondVideo:
|
|
5128
|
+
secondVideo: ve({
|
|
5118
5129
|
videoReceiversStats: t,
|
|
5119
5130
|
synchronizationSourcesVideo: s.video
|
|
5120
5131
|
}),
|
|
@@ -5122,7 +5133,7 @@ const Xe = ["collected"], Os = () => new M(Xe), Ne = () => "performance" in wind
|
|
|
5122
5133
|
audioReceiverStats: n,
|
|
5123
5134
|
synchronizationSourcesAudio: s.audio
|
|
5124
5135
|
}),
|
|
5125
|
-
additional:
|
|
5136
|
+
additional: tt(
|
|
5126
5137
|
n ?? e ?? t
|
|
5127
5138
|
)
|
|
5128
5139
|
}), ws = ({
|
|
@@ -5155,7 +5166,7 @@ const Xe = ["collected"], Os = () => new M(Xe), Ne = () => "performance" in wind
|
|
|
5155
5166
|
}, u = {
|
|
5156
5167
|
trackIdentifier: c[0]?.track.id,
|
|
5157
5168
|
item: c[0]?.getSynchronizationSources()[0]
|
|
5158
|
-
},
|
|
5169
|
+
}, g = {
|
|
5159
5170
|
audio: h,
|
|
5160
5171
|
video: u
|
|
5161
5172
|
};
|
|
@@ -5173,16 +5184,16 @@ const Xe = ["collected"], Os = () => new M(Xe), Ne = () => "performance" in wind
|
|
|
5173
5184
|
I,
|
|
5174
5185
|
U,
|
|
5175
5186
|
B,
|
|
5176
|
-
|
|
5187
|
+
ot
|
|
5177
5188
|
] = E;
|
|
5178
5189
|
return {
|
|
5179
|
-
synchronizationSources:
|
|
5190
|
+
synchronizationSources: g,
|
|
5180
5191
|
audioSenderStats: N,
|
|
5181
5192
|
videoSenderFirstStats: y,
|
|
5182
5193
|
videoSenderSecondStats: I,
|
|
5183
5194
|
audioReceiverStats: U,
|
|
5184
5195
|
videoReceiverFirstStats: B,
|
|
5185
|
-
videoReceiverSecondStats:
|
|
5196
|
+
videoReceiverSecondStats: ot
|
|
5186
5197
|
};
|
|
5187
5198
|
});
|
|
5188
5199
|
}, ks = (n) => {
|
|
@@ -5193,7 +5204,7 @@ class Fs {
|
|
|
5193
5204
|
setTimeoutRequest;
|
|
5194
5205
|
requesterAllStatistics = new K(Us);
|
|
5195
5206
|
constructor() {
|
|
5196
|
-
this.events = Os(), this.setTimeoutRequest = new
|
|
5207
|
+
this.events = Os(), this.setTimeoutRequest = new be();
|
|
5197
5208
|
}
|
|
5198
5209
|
get requested() {
|
|
5199
5210
|
return this.setTimeoutRequest.requested;
|
|
@@ -5229,10 +5240,10 @@ class Fs {
|
|
|
5229
5240
|
collectStatistics = (e, {
|
|
5230
5241
|
onError: t
|
|
5231
5242
|
}) => {
|
|
5232
|
-
const s =
|
|
5243
|
+
const s = Ae();
|
|
5233
5244
|
this.requestAllStatistics(e).then((i) => {
|
|
5234
5245
|
this.events.trigger("collected", ws(i));
|
|
5235
|
-
const a =
|
|
5246
|
+
const a = Ae() - s;
|
|
5236
5247
|
let o = $;
|
|
5237
5248
|
a > 48 ? o = $ * 4 : a > 32 ? o = $ * 3 : a > 16 && (o = $ * 2), this.start(e, {
|
|
5238
5249
|
onError: t,
|
|
@@ -5333,7 +5344,7 @@ class $s {
|
|
|
5333
5344
|
return e === void 0 || t === void 0 ? !1 : e === 0 ? t > 0 : Math.abs(t - e) / e >= 0.25;
|
|
5334
5345
|
}
|
|
5335
5346
|
subscribe() {
|
|
5336
|
-
this.callManager.on("peerconnection:confirmed", this.handleStarted), this.callManager.on("failed", this.handleEnded), this.callManager.on("ended", this.handleEnded), this.statsPeerConnection.on("collected", this.handleStatsCollected);
|
|
5347
|
+
this.callManager.on("peerconnection:confirmed", this.handleStarted), this.callManager.on("recv-session-started", this.handleRecvSessionStarted), this.callManager.on("recv-session-ended", this.handleRecvSessionEnded), this.callManager.on("recv-quality-changed", this.handleRecvQualityChanged), this.callManager.on("failed", this.handleEnded), this.callManager.on("ended", this.handleEnded), this.statsPeerConnection.on("collected", this.handleStatsCollected);
|
|
5337
5348
|
}
|
|
5338
5349
|
handleStatsCollected = (e) => {
|
|
5339
5350
|
this.previousAvailableStats = this.availableStats, this.availableStats = e, this.maybeSendStats();
|
|
@@ -5341,6 +5352,15 @@ class $s {
|
|
|
5341
5352
|
handleStarted = () => {
|
|
5342
5353
|
this.statsPeerConnection.start(this.callManager.getActivePeerConnection);
|
|
5343
5354
|
};
|
|
5355
|
+
handleRecvSessionStarted = () => {
|
|
5356
|
+
this.statsPeerConnection.start(this.callManager.getActivePeerConnection);
|
|
5357
|
+
};
|
|
5358
|
+
handleRecvSessionEnded = () => {
|
|
5359
|
+
this.statsPeerConnection.start(this.callManager.getActivePeerConnection);
|
|
5360
|
+
};
|
|
5361
|
+
handleRecvQualityChanged = () => {
|
|
5362
|
+
this.statsPeerConnection.start(this.callManager.getActivePeerConnection);
|
|
5363
|
+
};
|
|
5344
5364
|
handleEnded = () => {
|
|
5345
5365
|
this.statsPeerConnection.stop(), this.availableStats = void 0, this.previousAvailableStats = void 0;
|
|
5346
5366
|
};
|
|
@@ -5368,7 +5388,7 @@ const Gs = (n, e) => n.filter((s) => e.some((i) => i.clockRate === s.clockRate &
|
|
|
5368
5388
|
} catch (s) {
|
|
5369
5389
|
d("setCodecPreferences error", s);
|
|
5370
5390
|
}
|
|
5371
|
-
},
|
|
5391
|
+
}, Qs = (n) => [...n.keys()].map((e) => n.get(e)), Ws = (n, e) => Qs(n).find((t) => t?.type === e), Ys = async (n) => n.getStats().then((e) => Ws(e, "codec")?.mimeType);
|
|
5372
5392
|
class zs {
|
|
5373
5393
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
5374
5394
|
async getCodecFromSender(e) {
|
|
@@ -5376,7 +5396,7 @@ class zs {
|
|
|
5376
5396
|
}
|
|
5377
5397
|
}
|
|
5378
5398
|
class Js {
|
|
5379
|
-
stackPromises =
|
|
5399
|
+
stackPromises = Oe({
|
|
5380
5400
|
noRunIsNotActual: !0
|
|
5381
5401
|
});
|
|
5382
5402
|
/**
|
|
@@ -5407,15 +5427,15 @@ class js {
|
|
|
5407
5427
|
this.onSetParameters = e, this.taskQueue = new Js();
|
|
5408
5428
|
}
|
|
5409
5429
|
async setEncodingsToSender(e, t) {
|
|
5410
|
-
return this.taskQueue.add(async () =>
|
|
5430
|
+
return this.taskQueue.add(async () => Fe(e, t, this.onSetParameters));
|
|
5411
5431
|
}
|
|
5412
5432
|
stop() {
|
|
5413
5433
|
this.taskQueue.stop();
|
|
5414
5434
|
}
|
|
5415
5435
|
}
|
|
5416
|
-
const
|
|
5436
|
+
const de = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), Xs = 1e6, D = (n) => n * Xs, nt = D(0.06), st = D(4), Ks = (n) => n <= 64 ? nt : n <= 128 ? D(0.12) : n <= 256 ? D(0.25) : n <= 384 ? D(0.32) : n <= 426 ? D(0.38) : n <= 640 ? D(0.5) : n <= 848 ? D(0.7) : n <= 1280 ? D(1) : n <= 1920 ? D(2) : st, Zs = "av1", ei = (n) => de(n, Zs), ti = 0.6, Se = (n, e) => ei(e) ? n * ti : n, ni = (n) => Se(nt, n), si = (n) => Se(st, n), fe = (n, e) => {
|
|
5417
5437
|
const t = Ks(n);
|
|
5418
|
-
return
|
|
5438
|
+
return Se(t, e);
|
|
5419
5439
|
}, ie = 1, ii = ({
|
|
5420
5440
|
videoTrack: n,
|
|
5421
5441
|
targetSize: e
|
|
@@ -5456,7 +5476,7 @@ class ri {
|
|
|
5456
5476
|
if (!i?.track)
|
|
5457
5477
|
return { ...this.resultNoChanged, sender: i };
|
|
5458
5478
|
const r = await this.codecProvider.getCodecFromSender(i);
|
|
5459
|
-
if (
|
|
5479
|
+
if (de(r, this.ignoreForCodec))
|
|
5460
5480
|
return { ...this.resultNoChanged, sender: i };
|
|
5461
5481
|
const { mainCam: a, resolutionMainCam: o } = t ?? {};
|
|
5462
5482
|
return this.processSender(
|
|
@@ -5468,6 +5488,25 @@ class ri {
|
|
|
5468
5488
|
}
|
|
5469
5489
|
).then((c) => ({ ...c, sender: i }));
|
|
5470
5490
|
}
|
|
5491
|
+
/**
|
|
5492
|
+
* Сбрасывает все эффекты балансировки — восстанавливает параметры на основе разрешения трека
|
|
5493
|
+
* @param connection - RTCPeerConnection для получения отправителей
|
|
5494
|
+
* @returns Promise с результатом сброса
|
|
5495
|
+
*/
|
|
5496
|
+
async reset(e) {
|
|
5497
|
+
const t = e.getSenders(), s = this.senderFinder.findVideoSender(t);
|
|
5498
|
+
if (!s?.track)
|
|
5499
|
+
return { ...this.resultNoChanged, sender: s };
|
|
5500
|
+
const i = await this.codecProvider.getCodecFromSender(s);
|
|
5501
|
+
if (de(i, this.ignoreForCodec))
|
|
5502
|
+
return { ...this.resultNoChanged, sender: s };
|
|
5503
|
+
const r = {
|
|
5504
|
+
sender: s,
|
|
5505
|
+
codec: i,
|
|
5506
|
+
videoTrack: s.track
|
|
5507
|
+
};
|
|
5508
|
+
return { ...await this.setBitrateByTrackResolution(r), sender: s };
|
|
5509
|
+
}
|
|
5471
5510
|
/**
|
|
5472
5511
|
* Обрабатывает отправитель в зависимости от команды управления
|
|
5473
5512
|
* @param context - Контекст балансировки
|
|
@@ -5508,7 +5547,7 @@ class ri {
|
|
|
5508
5547
|
* @returns Promise с результатом
|
|
5509
5548
|
*/
|
|
5510
5549
|
async setBitrateByTrackResolution(e) {
|
|
5511
|
-
const { sender: t, videoTrack: s, codec: i } = e, a = s.getSettings().width, o = a === void 0 ? si(i) :
|
|
5550
|
+
const { sender: t, videoTrack: s, codec: i } = e, a = s.getSettings().width, o = a === void 0 ? si(i) : fe(a, i);
|
|
5512
5551
|
return this.parametersSetter.setEncodingsToSender(t, {
|
|
5513
5552
|
scaleResolutionDownBy: 1,
|
|
5514
5553
|
maxBitrate: o
|
|
@@ -5527,11 +5566,11 @@ class ri {
|
|
|
5527
5566
|
}, h = ii({
|
|
5528
5567
|
videoTrack: a,
|
|
5529
5568
|
targetSize: c
|
|
5530
|
-
}), u =
|
|
5569
|
+
}), u = fe(c.width, o), g = {
|
|
5531
5570
|
scaleResolutionDownBy: h,
|
|
5532
5571
|
maxBitrate: u
|
|
5533
5572
|
};
|
|
5534
|
-
return this.parametersSetter.setEncodingsToSender(r,
|
|
5573
|
+
return this.parametersSetter.setEncodingsToSender(r, g);
|
|
5535
5574
|
}
|
|
5536
5575
|
}
|
|
5537
5576
|
const ai = (n) => n.find((e) => e.track?.kind === "video");
|
|
@@ -5554,7 +5593,7 @@ class ci {
|
|
|
5554
5593
|
pollIntervalMs: e = 1e3,
|
|
5555
5594
|
maxPollIntervalMs: t
|
|
5556
5595
|
}) {
|
|
5557
|
-
this.pollIntervalMs = e, this.maxPollIntervalMs = t ?? e * 16, this.currentPollIntervalMs = this.pollIntervalMs, this.setTimeoutRequest = new
|
|
5596
|
+
this.pollIntervalMs = e, this.maxPollIntervalMs = t ?? e * 16, this.currentPollIntervalMs = this.pollIntervalMs, this.setTimeoutRequest = new be();
|
|
5558
5597
|
}
|
|
5559
5598
|
/**
|
|
5560
5599
|
* Проверяет актуальный video-sender и (при необходимости) перенастраивает наблюдение.
|
|
@@ -5658,13 +5697,19 @@ class hi {
|
|
|
5658
5697
|
* Отписывается от событий и сбрасывает состояние
|
|
5659
5698
|
*/
|
|
5660
5699
|
unsubscribe() {
|
|
5661
|
-
this.eventHandler.unsubscribe(), this.
|
|
5700
|
+
this.eventHandler.unsubscribe(), this.reset();
|
|
5662
5701
|
}
|
|
5663
5702
|
/**
|
|
5664
|
-
* Сбрасывает состояние балансировщика
|
|
5703
|
+
* Сбрасывает состояние балансировщика и восстанавливает параметры отправителя
|
|
5665
5704
|
*/
|
|
5666
5705
|
reset() {
|
|
5667
|
-
|
|
5706
|
+
this.clearState();
|
|
5707
|
+
const e = this.getConnection();
|
|
5708
|
+
e ? this.senderBalancer.reset(e).catch((t) => {
|
|
5709
|
+
d("reset sender encodings: error", t);
|
|
5710
|
+
}).finally(() => {
|
|
5711
|
+
this.parametersSetterWithQueue.stop();
|
|
5712
|
+
}) : this.parametersSetterWithQueue.stop();
|
|
5668
5713
|
}
|
|
5669
5714
|
/**
|
|
5670
5715
|
* Выполняет балансировку на основе текущего состояния
|
|
@@ -5681,6 +5726,9 @@ class hi {
|
|
|
5681
5726
|
});
|
|
5682
5727
|
}), t;
|
|
5683
5728
|
}
|
|
5729
|
+
clearState() {
|
|
5730
|
+
delete this.serverHeaders, this.trackMonitor.unsubscribe();
|
|
5731
|
+
}
|
|
5684
5732
|
/**
|
|
5685
5733
|
* Обработчик событий управления главной камерой
|
|
5686
5734
|
* @param headers - Заголовки от сервера
|
|
@@ -5691,12 +5739,12 @@ class hi {
|
|
|
5691
5739
|
});
|
|
5692
5740
|
};
|
|
5693
5741
|
}
|
|
5694
|
-
const
|
|
5742
|
+
const it = [
|
|
5695
5743
|
"balancing-scheduled",
|
|
5696
5744
|
"balancing-started",
|
|
5697
5745
|
"balancing-stopped",
|
|
5698
5746
|
"parameters-updated"
|
|
5699
|
-
], li = () => new M(
|
|
5747
|
+
], li = () => new M(it);
|
|
5700
5748
|
class ui {
|
|
5701
5749
|
isBalancingActive = !1;
|
|
5702
5750
|
events;
|
|
@@ -5756,7 +5804,7 @@ class ui {
|
|
|
5756
5804
|
this.events.off(e, t);
|
|
5757
5805
|
}
|
|
5758
5806
|
subscribe() {
|
|
5759
|
-
this.callManager.on("peerconnection:confirmed", this.handleCallStarted), this.callManager.on("ended", this.handleCallEnded), this.callManager.on("failed", this.handleCallEnded);
|
|
5807
|
+
this.callManager.on("peerconnection:confirmed", this.handleCallStarted), this.callManager.on("recv-session-started", this.handleRecvSessionStarted), this.callManager.on("recv-session-ended", this.handleRecvSessionEnded), this.callManager.on("recv-quality-changed", this.handleRecvQualityChanged), this.callManager.on("ended", this.handleCallEnded), this.callManager.on("failed", this.handleCallEnded);
|
|
5760
5808
|
}
|
|
5761
5809
|
handleCallStarted = () => {
|
|
5762
5810
|
this.scheduleBalancingStart();
|
|
@@ -5764,6 +5812,15 @@ class ui {
|
|
|
5764
5812
|
handleCallEnded = () => {
|
|
5765
5813
|
this.stopBalancing();
|
|
5766
5814
|
};
|
|
5815
|
+
handleRecvSessionStarted = () => {
|
|
5816
|
+
this.stopBalancing();
|
|
5817
|
+
};
|
|
5818
|
+
handleRecvSessionEnded = () => {
|
|
5819
|
+
this.scheduleBalancingStart();
|
|
5820
|
+
};
|
|
5821
|
+
handleRecvQualityChanged = () => {
|
|
5822
|
+
this.stopBalancing();
|
|
5823
|
+
};
|
|
5767
5824
|
scheduleBalancingStart() {
|
|
5768
5825
|
this.clearStartTimer(), this.startBalancingTimer = setTimeout(() => {
|
|
5769
5826
|
this.startBalancingTimer = void 0, this.startBalancing().catch((e) => {
|
|
@@ -5775,7 +5832,7 @@ class ui {
|
|
|
5775
5832
|
this.startBalancingTimer && (clearTimeout(this.startBalancingTimer), this.startBalancingTimer = void 0);
|
|
5776
5833
|
}
|
|
5777
5834
|
}
|
|
5778
|
-
const
|
|
5835
|
+
const rt = "no-inbound-frames", at = [rt], gi = () => new M(at);
|
|
5779
5836
|
class Ti {
|
|
5780
5837
|
events;
|
|
5781
5838
|
statsManager;
|
|
@@ -5794,7 +5851,7 @@ class Ti {
|
|
|
5794
5851
|
return this.events.on(e, t);
|
|
5795
5852
|
}
|
|
5796
5853
|
handleStatsCollected = () => {
|
|
5797
|
-
this.hasNoIncomingFrames() && this.events.trigger(
|
|
5854
|
+
this.hasNoIncomingFrames() && this.events.trigger(rt, {});
|
|
5798
5855
|
};
|
|
5799
5856
|
hasNoIncomingFrames = () => this.statsManager.isInvalidInboundFrames && this.isMutedMainVideoTrack;
|
|
5800
5857
|
subscribe() {
|
|
@@ -5835,12 +5892,12 @@ class Ei {
|
|
|
5835
5892
|
d("cancel recover main stream"), this.renegotiateThrottled.cancel(), this.renegotiateRequester.cancelRequest();
|
|
5836
5893
|
}
|
|
5837
5894
|
}
|
|
5838
|
-
const
|
|
5895
|
+
const Ci = 1e6, mi = je.map((n) => `auto-connect:${n}`), pi = We.map((n) => `connection:${n}`), Ri = Ve.map((n) => `call:${n}`), Ni = ye.map((n) => `api:${n}`), Ai = Xe.map((n) => `incoming-call:${n}`), Ii = He.map((n) => `presentation:${n}`), vi = et.map((n) => `stats:${n}`), fi = it.map((n) => `video-balancer:${n}`), Mi = at.map((n) => `main-stream-health:${n}`), _i = Ze.map((n) => `session:${n}`), bi = [
|
|
5839
5896
|
"disconnected-from-out-of-call",
|
|
5840
5897
|
"connected-with-configuration-from-out-of-call",
|
|
5841
5898
|
"stopped-presentation-by-server-command"
|
|
5842
5899
|
], Oi = [
|
|
5843
|
-
...
|
|
5900
|
+
...mi,
|
|
5844
5901
|
...pi,
|
|
5845
5902
|
...Ri,
|
|
5846
5903
|
...Ni,
|
|
@@ -5852,7 +5909,7 @@ const mi = 1e6, Ci = Ye.map((n) => `auto-connect:${n}`), pi = xe.map((n) => `con
|
|
|
5852
5909
|
..._i,
|
|
5853
5910
|
...bi
|
|
5854
5911
|
], Pi = () => new M(Oi);
|
|
5855
|
-
class
|
|
5912
|
+
class Qi {
|
|
5856
5913
|
events;
|
|
5857
5914
|
connectionManager;
|
|
5858
5915
|
connectionQueueManager;
|
|
@@ -5878,12 +5935,12 @@ class Wi {
|
|
|
5878
5935
|
} = {}) {
|
|
5879
5936
|
this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events = Pi(), this.apiManager = new Mt(), this.connectionManager = new Xn({ JsSIP: e }), this.connectionQueueManager = new Kn({
|
|
5880
5937
|
connectionManager: this.connectionManager
|
|
5881
|
-
}), this.contentedStreamManager = new
|
|
5938
|
+
}), this.contentedStreamManager = new Cs(), this.callManager = new Mn(
|
|
5882
5939
|
{ contentedStreamManager: this.contentedStreamManager },
|
|
5883
5940
|
{ sendOffer: this.sendOffer }
|
|
5884
5941
|
), this.incomingCallManager = new vs(this.connectionManager), this.presentationManager = new yn({
|
|
5885
5942
|
callManager: this.callManager,
|
|
5886
|
-
maxBitrate:
|
|
5943
|
+
maxBitrate: Ci
|
|
5887
5944
|
}), this.statsManager = new $s({
|
|
5888
5945
|
callManager: this.callManager,
|
|
5889
5946
|
apiManager: this.apiManager
|
|
@@ -6092,9 +6149,9 @@ class Wi {
|
|
|
6092
6149
|
}), this.apiManager.on("presentation:must-stop", () => {
|
|
6093
6150
|
this.mayBeStopPresentationAndNotify();
|
|
6094
6151
|
}), this.apiManager.on("failed-send-room-direct-p2p", ({ error: e }) => {
|
|
6095
|
-
const t = new
|
|
6152
|
+
const t = new Me();
|
|
6096
6153
|
t.body = e instanceof Error ? e.message : String(e);
|
|
6097
|
-
const s =
|
|
6154
|
+
const s = _e.causes.INTERNAL_ERROR;
|
|
6098
6155
|
this.callManager.failed(t, s).catch((i) => {
|
|
6099
6156
|
d("Failed to end call after failed:", i);
|
|
6100
6157
|
});
|
|
@@ -6140,19 +6197,19 @@ class Wi {
|
|
|
6140
6197
|
}
|
|
6141
6198
|
export {
|
|
6142
6199
|
Ht as D,
|
|
6143
|
-
|
|
6200
|
+
qe as E,
|
|
6144
6201
|
Zt as O,
|
|
6145
6202
|
bt as P,
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6203
|
+
Qi as S,
|
|
6204
|
+
we as a,
|
|
6205
|
+
Fe as b,
|
|
6149
6206
|
re as c,
|
|
6150
6207
|
ae as d,
|
|
6151
6208
|
Vn as e,
|
|
6152
6209
|
ps as f,
|
|
6153
6210
|
zn as g,
|
|
6154
|
-
|
|
6155
|
-
|
|
6211
|
+
Le as h,
|
|
6212
|
+
De as i,
|
|
6156
6213
|
bn as j,
|
|
6157
6214
|
R as k,
|
|
6158
6215
|
d as l,
|