sip-connector 19.8.3 → 19.9.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/README.md +0 -101
- package/dist/@SipConnector-DhKRV_I3.cjs +1 -0
- package/dist/{@SipConnector-BmkeKEDD.js → @SipConnector-LWYRHYnw.js} +597 -714
- package/dist/ApiManager/@ApiManager.d.ts +0 -1
- package/dist/ApiManager/constants.d.ts +3 -8
- package/dist/ApiManager/eventNames.d.ts +7 -5
- package/dist/ApiManager/index.d.ts +0 -1
- package/dist/ApiManager/types.d.ts +0 -6
- package/dist/AutoConnectorManager/@AutoConnectorManager.d.ts +3 -0
- package/dist/AutoConnectorManager/NotActiveCallSubscriber.d.ts +15 -0
- package/dist/AutoConnectorManager/PingServerIfNotActiveCallRequester.d.ts +1 -3
- package/dist/AutoConnectorManager/RegistrationFailedOutOfCallSubscriber.d.ts +1 -1
- package/dist/CallManager/@CallManager.d.ts +30 -15
- package/dist/CallManager/MCUSession.d.ts +0 -1
- package/dist/CallManager/RecvSession.d.ts +29 -0
- package/dist/CallManager/index.d.ts +0 -1
- package/dist/CallManager/types.d.ts +13 -31
- package/dist/SipConnector/@SipConnector.d.ts +1 -2
- package/dist/SipConnector/eventNames.d.ts +4 -2
- package/dist/__fixtures__/RTCPeerConnectionMock.d.ts +13 -17
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +131 -130
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/package.json +13 -5
- package/dist/@SipConnector-BHakZWEK.cjs +0 -1
- package/dist/CallManager/AbstractCallStrategy.d.ts +0 -54
- package/dist/CallManager/MCUCallStrategy.d.ts +0 -31
- package/dist/TransceiverManager/@TransceiverManager.d.ts +0 -70
- package/dist/TransceiverManager/index.d.ts +0 -1
- package/dist/TransceiverManager/types.d.ts +0 -11
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { TypedEvents as
|
|
2
|
-
import
|
|
3
|
-
import { CancelableRequest as x, isCanceledError as
|
|
4
|
-
import { resolveRequesterByTimeout as
|
|
5
|
-
import { hasCanceledError as
|
|
6
|
-
import { setup as
|
|
7
|
-
import { createStackPromises as
|
|
1
|
+
import { TypedEvents as O } from "events-constructor";
|
|
2
|
+
import H from "debug";
|
|
3
|
+
import { CancelableRequest as x, isCanceledError as _e } from "@krivega/cancelable-promise";
|
|
4
|
+
import { resolveRequesterByTimeout as Me, requesterByTimeoutsWithFailCalls as fe, DelayRequester as ve, hasCanceledError as Pe, SetTimeoutRequest as ee } from "@krivega/timeout-requester";
|
|
5
|
+
import { hasCanceledError as Oe, repeatedCallsAsync as te } from "repeated-calls";
|
|
6
|
+
import { setup as be, createActor as De } from "xstate";
|
|
7
|
+
import { createStackPromises as ne, isPromiseIsNotActualError as ye } from "stack-promises";
|
|
8
8
|
import "ua-parser-js";
|
|
9
9
|
import "sequent-promises";
|
|
10
|
-
const G = "sip-connector", c =
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
var u = /* @__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.NOTIFY = "X-VINTEO-NOTIFY", n.CONTENT_ENABLE_MEDIA_DEVICE = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", n.CONTENT_SHARE_STATE = "x-webrtc-share-state", n.MUST_STOP_PRESENTATION_P2P = "x-webrtc-share-state: YOUMUSTSTOPSENDCONTENT", n.START_PRESENTATION_P2P = "x-webrtc-share-state: YOUCANRECEIVECONTENT", n.STOP_PRESENTATION_P2P = "x-webrtc-share-state: CONTENTEND", n.STOP_PRESENTATION = "x-webrtc-share-state: STOPPRESENTATION", n.START_PRESENTATION = "x-webrtc-share-state: LETMESTARTPRESENTATION", n.ENABLE_MAIN_CAM = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE: LETMESTARTMAINCAM", 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))(u || {}), L = /* @__PURE__ */ ((n) => (n.AVAILABLE_SECOND_REMOTE_STREAM = "YOUCANRECEIVECONTENT", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "CONTENTEND", n.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", n))(L || {}), q = /* @__PURE__ */ ((n) => (n.SPECTATOR = "SPECTATOR", n.PARTICIPANT = "PARTICIPANT", n))(q || {}),
|
|
16
|
-
const
|
|
10
|
+
const G = "sip-connector", c = H(G), Vn = () => {
|
|
11
|
+
H.enable(G);
|
|
12
|
+
}, Hn = () => {
|
|
13
|
+
H.enable(`-${G}`);
|
|
14
|
+
}, we = "Error decline with 603", Ue = 1006, Le = (n) => typeof n == "object" && n !== null && "code" in n && n.code === Ue, Be = (n) => n.message === we;
|
|
15
|
+
var u = /* @__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.NOTIFY = "X-VINTEO-NOTIFY", n.CONTENT_ENABLE_MEDIA_DEVICE = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", n.CONTENT_SHARE_STATE = "x-webrtc-share-state", n.MUST_STOP_PRESENTATION_P2P = "x-webrtc-share-state: YOUMUSTSTOPSENDCONTENT", n.START_PRESENTATION_P2P = "x-webrtc-share-state: YOUCANRECEIVECONTENT", n.STOP_PRESENTATION_P2P = "x-webrtc-share-state: CONTENTEND", n.STOP_PRESENTATION = "x-webrtc-share-state: STOPPRESENTATION", n.START_PRESENTATION = "x-webrtc-share-state: LETMESTARTPRESENTATION", n.ENABLE_MAIN_CAM = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE: LETMESTARTMAINCAM", 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.AUDIO_ID = "X-WEBRTC-AUDIOID", n))(u || {}), L = /* @__PURE__ */ ((n) => (n.AVAILABLE_SECOND_REMOTE_STREAM = "YOUCANRECEIVECONTENT", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "CONTENTEND", n.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", n))(L || {}), q = /* @__PURE__ */ ((n) => (n.SPECTATOR = "SPECTATOR", n.PARTICIPANT = "PARTICIPANT", n))(q || {}), b = /* @__PURE__ */ ((n) => (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.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n))(b || {}), p = /* @__PURE__ */ ((n) => (n.CHANNELS = "application/vinteo.webrtc.channels", n.MEDIA_STATE = "application/vinteo.webrtc.mediastate", n.REFUSAL = "application/vinteo.webrtc.refusal", n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n.STATS = "application/vinteo.webrtc.stats", n))(p || {}), v = /* @__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))(v || {}), W = /* @__PURE__ */ ((n) => (n.ADMIN_STOP_MIC = "ADMINSTOPMIC", n.ADMIN_START_MIC = "ADMINSTARTMIC", n))(W || {}), V = /* @__PURE__ */ ((n) => (n.ADMIN_SYNC_FORCED = "1", n.ADMIN_SYNC_NOT_FORCED = "0", n))(V || {}), Fe = /* @__PURE__ */ ((n) => (n.AUDIO = "AUDIO", n.VIDEO = "VIDEO", n.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", n))(Fe || {}), g = /* @__PURE__ */ ((n) => (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_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.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "conference:participant-token-issued", n.CHANNELS = "channels", n.ENTER_ROOM = "enterRoom", n.SHARE_STATE = "shareState", n.MAIN_CAM_CONTROL = "main-cam-control", n.USE_LICENSE = "useLicense", 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.AVAILABLE_SECOND_REMOTE_STREAM = "availableSecondRemoteStream", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "notAvailableSecondRemoteStream", n.MUST_STOP_PRESENTATION = "mustStopPresentation", n.NEW_DTMF = "newDTMF", n))(g || {});
|
|
16
|
+
const se = [
|
|
17
17
|
"participation:accepting-word-request",
|
|
18
18
|
"participation:cancelling-word-request",
|
|
19
19
|
"participant:move-request-to-stream",
|
|
@@ -26,6 +26,7 @@ const ne = [
|
|
|
26
26
|
"participant:added-to-list-moderators",
|
|
27
27
|
"participant:removed-from-list-moderators",
|
|
28
28
|
"participant:move-request-to-spectators",
|
|
29
|
+
"participant:move-request-to-spectators-with-audio-id",
|
|
29
30
|
"participant:move-request-to-participants",
|
|
30
31
|
"channels",
|
|
31
32
|
"enterRoom",
|
|
@@ -40,11 +41,10 @@ const ne = [
|
|
|
40
41
|
"availableSecondRemoteStream",
|
|
41
42
|
"notAvailableSecondRemoteStream",
|
|
42
43
|
"mustStopPresentation",
|
|
43
|
-
"newDTMF"
|
|
44
|
-
"restart"
|
|
44
|
+
"newDTMF"
|
|
45
45
|
];
|
|
46
|
-
var
|
|
47
|
-
class
|
|
46
|
+
var I = /* @__PURE__ */ ((n) => (n.CHANNELS = "channels", n.WEBCAST_STARTED = "WebcastStarted", n.WEBCAST_STOPPED = "WebcastStopped", n.ACCOUNT_CHANGED = "accountChanged", n.ACCOUNT_DELETED = "accountDeleted", n.ADDED_TO_LIST_MODERATORS = "addedToListModerators", n.REMOVED_FROM_LIST_MODERATORS = "removedFromListModerators", n.ACCEPTING_WORD_REQUEST = "ParticipationRequestAccepted", n.CANCELLING_WORD_REQUEST = "ParticipationRequestRejected", n.MOVE_REQUEST_TO_STREAM = "ParticipantMovedToWebcast", n.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "ConferenceParticipantTokenIssued", n))(I || {});
|
|
47
|
+
class ke {
|
|
48
48
|
events;
|
|
49
49
|
connectionManager;
|
|
50
50
|
callManager;
|
|
@@ -52,7 +52,7 @@ class Fe {
|
|
|
52
52
|
connectionManager: e,
|
|
53
53
|
callManager: t
|
|
54
54
|
}) {
|
|
55
|
-
this.connectionManager = e, this.callManager = t, this.events = new
|
|
55
|
+
this.connectionManager = e, this.callManager = t, this.events = new O(se), this.subscribe();
|
|
56
56
|
}
|
|
57
57
|
async waitChannels() {
|
|
58
58
|
return this.wait(g.CHANNELS);
|
|
@@ -62,34 +62,34 @@ class Fe {
|
|
|
62
62
|
}
|
|
63
63
|
async sendDTMF(e) {
|
|
64
64
|
return new Promise((t, s) => {
|
|
65
|
-
let
|
|
65
|
+
let i;
|
|
66
66
|
try {
|
|
67
|
-
|
|
68
|
-
} catch (
|
|
69
|
-
s(
|
|
67
|
+
i = this.getEstablishedRTCSessionProtected();
|
|
68
|
+
} catch (r) {
|
|
69
|
+
s(r);
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}),
|
|
71
|
+
i && (this.callManager.once("newDTMF", ({ originator: r }) => {
|
|
72
|
+
r === "local" && t();
|
|
73
|
+
}), i.sendDTMF(e, {
|
|
74
74
|
duration: 120,
|
|
75
75
|
interToneGap: 600
|
|
76
76
|
}));
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
async sendChannels({ inputChannels: e, outputChannels: t }) {
|
|
80
|
-
const s = this.getEstablishedRTCSessionProtected(),
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
const s = this.getEstablishedRTCSessionProtected(), i = `${u.INPUT_CHANNELS}: ${e}`, r = `${u.OUTPUT_CHANNELS}: ${t}`, a = [
|
|
81
|
+
i,
|
|
82
|
+
r
|
|
83
83
|
];
|
|
84
84
|
return s.sendInfo(p.CHANNELS, void 0, { extraHeaders: a });
|
|
85
85
|
}
|
|
86
86
|
async sendMediaState({ cam: e, mic: t }, s = {}) {
|
|
87
|
-
const
|
|
88
|
-
|
|
87
|
+
const i = this.getEstablishedRTCSessionProtected(), r = `${u.MEDIA_STATE}: currentstate`, a = `${u.MAIN_CAM_STATE}: ${Number(e)}`, o = `${u.MIC_STATE}: ${Number(t)}`, h = [
|
|
88
|
+
r,
|
|
89
89
|
a,
|
|
90
90
|
o
|
|
91
91
|
];
|
|
92
|
-
return
|
|
92
|
+
return i.sendInfo(p.MEDIA_STATE, void 0, {
|
|
93
93
|
noTerminateWhenError: !0,
|
|
94
94
|
...s,
|
|
95
95
|
extraHeaders: h
|
|
@@ -98,10 +98,10 @@ class Fe {
|
|
|
98
98
|
async sendStats({
|
|
99
99
|
availableIncomingBitrate: e
|
|
100
100
|
}) {
|
|
101
|
-
const t = this.getEstablishedRTCSessionProtected(),
|
|
101
|
+
const t = this.getEstablishedRTCSessionProtected(), i = [`${u.AVAILABLE_INCOMING_BITRATE}: ${e}`];
|
|
102
102
|
return t.sendInfo(p.STATS, void 0, {
|
|
103
103
|
noTerminateWhenError: !0,
|
|
104
|
-
extraHeaders:
|
|
104
|
+
extraHeaders: i
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
async sendRefusalToTurnOn(e, t = {}) {
|
|
@@ -149,9 +149,9 @@ class Fe {
|
|
|
149
149
|
noTerminateWhenError: !0,
|
|
150
150
|
...e,
|
|
151
151
|
extraHeaders: s
|
|
152
|
-
}).catch((
|
|
153
|
-
if (
|
|
154
|
-
throw
|
|
152
|
+
}).catch((i) => {
|
|
153
|
+
if (Be(i))
|
|
154
|
+
throw i;
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
on(e, t) {
|
|
@@ -196,55 +196,55 @@ class Fe {
|
|
|
196
196
|
};
|
|
197
197
|
handleNotify = (e) => {
|
|
198
198
|
switch (e.cmd) {
|
|
199
|
-
case
|
|
199
|
+
case I.CHANNELS: {
|
|
200
200
|
const t = e;
|
|
201
201
|
this.triggerChannelsNotify(t);
|
|
202
202
|
break;
|
|
203
203
|
}
|
|
204
|
-
case
|
|
204
|
+
case I.WEBCAST_STARTED: {
|
|
205
205
|
const t = e;
|
|
206
206
|
this.triggerWebcastStartedNotify(t);
|
|
207
207
|
break;
|
|
208
208
|
}
|
|
209
|
-
case
|
|
209
|
+
case I.WEBCAST_STOPPED: {
|
|
210
210
|
const t = e;
|
|
211
211
|
this.triggerWebcastStoppedNotify(t);
|
|
212
212
|
break;
|
|
213
213
|
}
|
|
214
|
-
case
|
|
214
|
+
case I.ADDED_TO_LIST_MODERATORS: {
|
|
215
215
|
const t = e;
|
|
216
216
|
this.triggerAddedToListModeratorsNotify(t);
|
|
217
217
|
break;
|
|
218
218
|
}
|
|
219
|
-
case
|
|
219
|
+
case I.REMOVED_FROM_LIST_MODERATORS: {
|
|
220
220
|
const t = e;
|
|
221
221
|
this.triggerRemovedFromListModeratorsNotify(t);
|
|
222
222
|
break;
|
|
223
223
|
}
|
|
224
|
-
case
|
|
224
|
+
case I.ACCEPTING_WORD_REQUEST: {
|
|
225
225
|
const t = e;
|
|
226
226
|
this.triggerParticipationAcceptingWordRequest(t);
|
|
227
227
|
break;
|
|
228
228
|
}
|
|
229
|
-
case
|
|
229
|
+
case I.CANCELLING_WORD_REQUEST: {
|
|
230
230
|
const t = e;
|
|
231
231
|
this.triggerParticipationCancellingWordRequest(t);
|
|
232
232
|
break;
|
|
233
233
|
}
|
|
234
|
-
case
|
|
234
|
+
case I.MOVE_REQUEST_TO_STREAM: {
|
|
235
235
|
const t = e;
|
|
236
236
|
this.triggerParticipantMoveRequestToStream(t);
|
|
237
237
|
break;
|
|
238
238
|
}
|
|
239
|
-
case
|
|
239
|
+
case I.ACCOUNT_CHANGED: {
|
|
240
240
|
this.triggerAccountChangedNotify();
|
|
241
241
|
break;
|
|
242
242
|
}
|
|
243
|
-
case
|
|
243
|
+
case I.ACCOUNT_DELETED: {
|
|
244
244
|
this.triggerAccountDeletedNotify();
|
|
245
245
|
break;
|
|
246
246
|
}
|
|
247
|
-
case
|
|
247
|
+
case I.CONFERENCE_PARTICIPANT_TOKEN_ISSUED: {
|
|
248
248
|
const t = e;
|
|
249
249
|
this.triggerConferenceParticipantTokenIssued(t);
|
|
250
250
|
break;
|
|
@@ -257,49 +257,45 @@ class Fe {
|
|
|
257
257
|
const { originator: t } = e;
|
|
258
258
|
if (t !== "remote")
|
|
259
259
|
return;
|
|
260
|
-
const { request: s } = e,
|
|
261
|
-
if (
|
|
262
|
-
switch (
|
|
263
|
-
case
|
|
264
|
-
this.triggerEnterRoom(
|
|
265
|
-
break;
|
|
266
|
-
}
|
|
267
|
-
case P.NOTIFY: {
|
|
268
|
-
this.maybeHandleNotify(r);
|
|
260
|
+
const { request: s } = e, i = s, r = i.getHeader(u.CONTENT_TYPE);
|
|
261
|
+
if (r !== void 0)
|
|
262
|
+
switch (r) {
|
|
263
|
+
case b.ENTER_ROOM: {
|
|
264
|
+
this.triggerEnterRoom(i), this.maybeTriggerChannels(i);
|
|
269
265
|
break;
|
|
270
266
|
}
|
|
271
|
-
case
|
|
272
|
-
this.
|
|
267
|
+
case b.NOTIFY: {
|
|
268
|
+
this.maybeHandleNotify(i);
|
|
273
269
|
break;
|
|
274
270
|
}
|
|
275
|
-
case
|
|
276
|
-
this.
|
|
271
|
+
case b.SHARE_STATE: {
|
|
272
|
+
this.triggerShareState(i);
|
|
277
273
|
break;
|
|
278
274
|
}
|
|
279
|
-
case
|
|
280
|
-
this.
|
|
275
|
+
case b.MAIN_CAM: {
|
|
276
|
+
this.triggerMainCamControl(i);
|
|
281
277
|
break;
|
|
282
278
|
}
|
|
283
|
-
case
|
|
284
|
-
this.
|
|
279
|
+
case b.MIC: {
|
|
280
|
+
this.triggerMicControl(i);
|
|
285
281
|
break;
|
|
286
282
|
}
|
|
287
|
-
case
|
|
288
|
-
this.
|
|
283
|
+
case b.USE_LICENSE: {
|
|
284
|
+
this.triggerUseLicense(i);
|
|
289
285
|
break;
|
|
290
286
|
}
|
|
291
|
-
case
|
|
292
|
-
this.
|
|
287
|
+
case b.PARTICIPANT_STATE: {
|
|
288
|
+
this.maybeTriggerParticipantMoveRequest(i);
|
|
293
289
|
break;
|
|
294
290
|
}
|
|
295
291
|
}
|
|
296
292
|
};
|
|
297
293
|
triggerChannelsNotify = (e) => {
|
|
298
|
-
const t = e.input, s = e.output,
|
|
294
|
+
const t = e.input, s = e.output, i = {
|
|
299
295
|
inputChannels: t,
|
|
300
296
|
outputChannels: s
|
|
301
297
|
};
|
|
302
|
-
this.events.trigger(g.CHANNELS_NOTIFY,
|
|
298
|
+
this.events.trigger(g.CHANNELS_NOTIFY, i);
|
|
303
299
|
};
|
|
304
300
|
triggerWebcastStartedNotify = ({
|
|
305
301
|
body: { conference: e, type: t }
|
|
@@ -374,24 +370,24 @@ class Fe {
|
|
|
374
370
|
triggerConferenceParticipantTokenIssued = ({
|
|
375
371
|
body: { conference: e, participant: t, jwt: s }
|
|
376
372
|
}) => {
|
|
377
|
-
const
|
|
373
|
+
const i = {
|
|
378
374
|
conference: e,
|
|
379
375
|
participant: t,
|
|
380
376
|
jwt: s
|
|
381
377
|
};
|
|
382
378
|
this.events.trigger(
|
|
383
379
|
g.CONFERENCE_PARTICIPANT_TOKEN_ISSUED,
|
|
384
|
-
|
|
380
|
+
i
|
|
385
381
|
);
|
|
386
382
|
};
|
|
387
383
|
maybeTriggerChannels = (e) => {
|
|
388
384
|
const t = e.getHeader(u.INPUT_CHANNELS), s = e.getHeader(u.OUTPUT_CHANNELS);
|
|
389
385
|
if (t && s) {
|
|
390
|
-
const
|
|
386
|
+
const i = {
|
|
391
387
|
inputChannels: t,
|
|
392
388
|
outputChannels: s
|
|
393
389
|
};
|
|
394
|
-
this.events.trigger(g.CHANNELS,
|
|
390
|
+
this.events.trigger(g.CHANNELS, i);
|
|
395
391
|
}
|
|
396
392
|
};
|
|
397
393
|
triggerEnterRoom = (e) => {
|
|
@@ -417,47 +413,46 @@ class Fe {
|
|
|
417
413
|
}
|
|
418
414
|
};
|
|
419
415
|
maybeTriggerParticipantMoveRequest = (e) => {
|
|
420
|
-
const t = e.getHeader(u.CONTENT_PARTICIPANT_STATE);
|
|
421
|
-
t === q.SPECTATOR &&
|
|
416
|
+
const t = e.getHeader(u.CONTENT_PARTICIPANT_STATE), s = e.getHeader(u.AUDIO_ID);
|
|
417
|
+
t === q.SPECTATOR && (s ? this.events.trigger(g.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_WITH_AUDIO_ID, {
|
|
418
|
+
audioId: s
|
|
419
|
+
}) : this.events.trigger(g.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS, {})), t === q.PARTICIPANT && this.events.trigger(g.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS, {});
|
|
422
420
|
};
|
|
423
421
|
triggerMainCamControl = (e) => {
|
|
424
|
-
const t = e.getHeader(u.MAIN_CAM), s = e.getHeader(u.MEDIA_SYNC),
|
|
422
|
+
const t = e.getHeader(u.MAIN_CAM), s = e.getHeader(u.MEDIA_SYNC), i = s === V.ADMIN_SYNC_FORCED;
|
|
425
423
|
if (t === v.ADMIN_START_MAIN_CAM) {
|
|
426
|
-
this.events.trigger(g.ADMIN_START_MAIN_CAM, { isSyncForced:
|
|
424
|
+
this.events.trigger(g.ADMIN_START_MAIN_CAM, { isSyncForced: i });
|
|
427
425
|
return;
|
|
428
426
|
}
|
|
429
427
|
if (t === v.ADMIN_STOP_MAIN_CAM) {
|
|
430
|
-
this.events.trigger(g.ADMIN_STOP_MAIN_CAM, { isSyncForced:
|
|
428
|
+
this.events.trigger(g.ADMIN_STOP_MAIN_CAM, { isSyncForced: i });
|
|
431
429
|
return;
|
|
432
430
|
}
|
|
433
|
-
(t === v.RESUME_MAIN_CAM || t === v.PAUSE_MAIN_CAM) && s !== void 0 && this.events.trigger(g.ADMIN_FORCE_SYNC_MEDIA_STATE, { isSyncForced:
|
|
434
|
-
const
|
|
431
|
+
(t === v.RESUME_MAIN_CAM || t === v.PAUSE_MAIN_CAM) && s !== void 0 && this.events.trigger(g.ADMIN_FORCE_SYNC_MEDIA_STATE, { isSyncForced: i });
|
|
432
|
+
const r = e.getHeader(u.MAIN_CAM_RESOLUTION);
|
|
435
433
|
this.events.trigger(g.MAIN_CAM_CONTROL, {
|
|
436
434
|
mainCam: t,
|
|
437
|
-
resolutionMainCam:
|
|
435
|
+
resolutionMainCam: r
|
|
438
436
|
});
|
|
439
437
|
};
|
|
440
438
|
triggerMicControl = (e) => {
|
|
441
|
-
const t = e.getHeader(u.MIC),
|
|
442
|
-
t ===
|
|
439
|
+
const t = e.getHeader(u.MIC), i = e.getHeader(u.MEDIA_SYNC) === V.ADMIN_SYNC_FORCED;
|
|
440
|
+
t === W.ADMIN_START_MIC ? this.events.trigger(g.ADMIN_START_MIC, { isSyncForced: i }) : t === W.ADMIN_STOP_MIC && this.events.trigger(g.ADMIN_STOP_MIC, { isSyncForced: i });
|
|
443
441
|
};
|
|
444
442
|
triggerUseLicense = (e) => {
|
|
445
443
|
const t = e.getHeader(u.CONTENT_USE_LICENSE);
|
|
446
444
|
this.events.trigger(g.USE_LICENSE, t);
|
|
447
445
|
};
|
|
448
|
-
triggerRestart = (e) => {
|
|
449
|
-
const t = e.getHeader(
|
|
450
|
-
u.TRACKS_DIRECTION
|
|
451
|
-
), s = Number(
|
|
452
|
-
e.getHeader(u.AUDIO_TRACK_COUNT)
|
|
453
|
-
), r = Number(
|
|
454
|
-
e.getHeader(u.VIDEO_TRACK_COUNT)
|
|
455
|
-
), i = { tracksDirection: t, audioTrackCount: s, videoTrackCount: r };
|
|
456
|
-
this.events.trigger(g.RESTART, i);
|
|
457
|
-
};
|
|
458
446
|
}
|
|
459
|
-
|
|
460
|
-
|
|
447
|
+
function $e(n) {
|
|
448
|
+
return (e) => `sip:${e}@${n}`;
|
|
449
|
+
}
|
|
450
|
+
const qe = (n, e) => () => Math.floor(Math.random() * (e - n)) + n, ie = (n) => n.trim().replaceAll(" ", "_"), We = qe(1e5, 99999999), Ve = (n) => n.some((t) => {
|
|
451
|
+
const { kind: s } = t;
|
|
452
|
+
return s === "video";
|
|
453
|
+
});
|
|
454
|
+
var N = /* @__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.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))(N || {}), He = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))(He || {});
|
|
455
|
+
const re = [
|
|
461
456
|
"peerconnection",
|
|
462
457
|
"connecting",
|
|
463
458
|
"sending",
|
|
@@ -484,34 +479,15 @@ const se = [
|
|
|
484
479
|
"peerconnection:createanswerfailed",
|
|
485
480
|
"peerconnection:setlocaldescriptionfailed",
|
|
486
481
|
"peerconnection:setremotedescriptionfailed"
|
|
487
|
-
],
|
|
482
|
+
], xe = [
|
|
488
483
|
"peerconnection:confirmed",
|
|
489
484
|
"peerconnection:ontrack",
|
|
490
485
|
"ended:fromserver",
|
|
491
486
|
"call-status-changed"
|
|
492
|
-
],
|
|
493
|
-
...
|
|
494
|
-
|
|
495
|
-
]
|
|
496
|
-
function qe(n) {
|
|
497
|
-
return (e) => `sip:${e}@${n}`;
|
|
498
|
-
}
|
|
499
|
-
const Ve = (n, e) => () => Math.floor(Math.random() * (e - n)) + n, ie = (n) => n.trim().replaceAll(" ", "_"), He = Ve(1e5, 99999999), We = (n) => n.some((t) => {
|
|
500
|
-
const { kind: s } = t;
|
|
501
|
-
return s === "video";
|
|
502
|
-
});
|
|
503
|
-
class xe {
|
|
504
|
-
isPendingCall = !1;
|
|
505
|
-
isPendingAnswer = !1;
|
|
506
|
-
rtcSession;
|
|
507
|
-
remoteStreams = {};
|
|
508
|
-
events;
|
|
509
|
-
callConfiguration = {};
|
|
510
|
-
constructor(e) {
|
|
511
|
-
this.events = e;
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
const Ge = (n, e) => {
|
|
487
|
+
], ae = [
|
|
488
|
+
...re,
|
|
489
|
+
...xe
|
|
490
|
+
], Ge = (n, e) => {
|
|
515
491
|
n.getVideoTracks().forEach((s) => {
|
|
516
492
|
"contentHint" in s && s.contentHint !== e && (s.contentHint = e);
|
|
517
493
|
});
|
|
@@ -522,17 +498,17 @@ const Ge = (n, e) => {
|
|
|
522
498
|
} = {}) => {
|
|
523
499
|
if (!n || e === "recvonly" && t === "recvonly")
|
|
524
500
|
return;
|
|
525
|
-
const
|
|
501
|
+
const i = t === "recvonly" ? [] : n.getAudioTracks(), r = e === "recvonly" ? [] : n.getVideoTracks(), a = [...i, ...r], o = new MediaStream(a);
|
|
526
502
|
return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" && Ge(o, s), o;
|
|
527
503
|
};
|
|
528
|
-
var
|
|
504
|
+
var oe = /* @__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))(oe || {});
|
|
529
505
|
class Qe {
|
|
530
506
|
events;
|
|
531
507
|
rtcSession;
|
|
532
508
|
disposers = /* @__PURE__ */ new Set();
|
|
533
509
|
onReset;
|
|
534
510
|
constructor(e, { onReset: t }) {
|
|
535
|
-
this.events = e, this.onReset = t, e.on(
|
|
511
|
+
this.events = e, this.onReset = t, e.on(N.FAILED, this.handleEnded), e.on(N.ENDED, this.handleEnded);
|
|
536
512
|
}
|
|
537
513
|
get connection() {
|
|
538
514
|
return this.rtcSession?.connection;
|
|
@@ -543,8 +519,8 @@ class Qe {
|
|
|
543
519
|
getEstablishedRTCSession = () => this.rtcSession?.isEstablished() === !0 ? this.rtcSession : void 0;
|
|
544
520
|
startCall = async (e, t, {
|
|
545
521
|
number: s,
|
|
546
|
-
mediaStream:
|
|
547
|
-
extraHeaders:
|
|
522
|
+
mediaStream: i,
|
|
523
|
+
extraHeaders: r = [],
|
|
548
524
|
ontrack: a,
|
|
549
525
|
iceServers: o,
|
|
550
526
|
directionVideo: h,
|
|
@@ -553,13 +529,13 @@ class Qe {
|
|
|
553
529
|
offerToReceiveAudio: S = !0,
|
|
554
530
|
offerToReceiveVideo: l = !0,
|
|
555
531
|
degradationPreference: E,
|
|
556
|
-
sendEncodings:
|
|
557
|
-
onAddedTransceiver:
|
|
532
|
+
sendEncodings: m,
|
|
533
|
+
onAddedTransceiver: R
|
|
558
534
|
}) => new Promise((M, F) => {
|
|
559
535
|
this.handleCall({ ontrack: a }).then(M).catch((k) => {
|
|
560
536
|
F(k);
|
|
561
537
|
}), this.rtcSession = e.call(t(s), {
|
|
562
|
-
mediaStream: B(
|
|
538
|
+
mediaStream: B(i, {
|
|
563
539
|
directionVideo: h,
|
|
564
540
|
directionAudio: d,
|
|
565
541
|
contentHint: T
|
|
@@ -575,19 +551,19 @@ class Qe {
|
|
|
575
551
|
// так как в методе call создается RTCSession
|
|
576
552
|
// и после создания нет возможности подписаться на события peerconnection через subscribeToSessionEvents
|
|
577
553
|
eventHandlers: this.events.triggers,
|
|
578
|
-
extraHeaders:
|
|
554
|
+
extraHeaders: r,
|
|
579
555
|
directionVideo: h,
|
|
580
556
|
directionAudio: d,
|
|
581
557
|
degradationPreference: E,
|
|
582
|
-
sendEncodings:
|
|
583
|
-
onAddedTransceiver:
|
|
558
|
+
sendEncodings: m,
|
|
559
|
+
onAddedTransceiver: R
|
|
584
560
|
});
|
|
585
561
|
});
|
|
586
562
|
async endCall() {
|
|
587
563
|
const { rtcSession: e } = this;
|
|
588
564
|
if (e && !e.isEnded())
|
|
589
565
|
return e.terminateAsync({
|
|
590
|
-
cause:
|
|
566
|
+
cause: oe.CANCELED
|
|
591
567
|
}).finally(() => {
|
|
592
568
|
this.reset();
|
|
593
569
|
});
|
|
@@ -596,8 +572,8 @@ class Qe {
|
|
|
596
572
|
answerToIncomingCall = async (e, {
|
|
597
573
|
mediaStream: t,
|
|
598
574
|
ontrack: s,
|
|
599
|
-
extraHeaders:
|
|
600
|
-
iceServers:
|
|
575
|
+
extraHeaders: i = [],
|
|
576
|
+
iceServers: r,
|
|
601
577
|
directionVideo: a,
|
|
602
578
|
directionAudio: o,
|
|
603
579
|
offerToReceiveAudio: h,
|
|
@@ -606,13 +582,13 @@ class Qe {
|
|
|
606
582
|
degradationPreference: S,
|
|
607
583
|
sendEncodings: l,
|
|
608
584
|
onAddedTransceiver: E
|
|
609
|
-
}) => new Promise((
|
|
585
|
+
}) => new Promise((m, R) => {
|
|
610
586
|
try {
|
|
611
|
-
this.rtcSession = e, this.subscribeToSessionEvents(e), this.handleCall({ ontrack: s }).then(
|
|
612
|
-
|
|
587
|
+
this.rtcSession = e, this.subscribeToSessionEvents(e), this.handleCall({ ontrack: s }).then(m).catch((M) => {
|
|
588
|
+
R(M);
|
|
613
589
|
}), e.answer({
|
|
614
590
|
pcConfig: {
|
|
615
|
-
iceServers:
|
|
591
|
+
iceServers: r
|
|
616
592
|
},
|
|
617
593
|
rtcOfferConstraints: {
|
|
618
594
|
offerToReceiveAudio: h,
|
|
@@ -623,7 +599,7 @@ class Qe {
|
|
|
623
599
|
directionAudio: o,
|
|
624
600
|
contentHint: T
|
|
625
601
|
}),
|
|
626
|
-
extraHeaders:
|
|
602
|
+
extraHeaders: i,
|
|
627
603
|
directionVideo: a,
|
|
628
604
|
directionAudio: o,
|
|
629
605
|
degradationPreference: S,
|
|
@@ -631,7 +607,7 @@ class Qe {
|
|
|
631
607
|
onAddedTransceiver: E
|
|
632
608
|
});
|
|
633
609
|
} catch (M) {
|
|
634
|
-
|
|
610
|
+
R(M);
|
|
635
611
|
}
|
|
636
612
|
});
|
|
637
613
|
getRemoteTracks() {
|
|
@@ -640,54 +616,49 @@ class Qe {
|
|
|
640
616
|
async replaceMediaStream(e, t) {
|
|
641
617
|
if (!this.rtcSession)
|
|
642
618
|
throw new Error("No rtcSession established");
|
|
643
|
-
const { contentHint: s } = t ?? {},
|
|
644
|
-
if (
|
|
619
|
+
const { contentHint: s } = t ?? {}, i = B(e, { contentHint: s });
|
|
620
|
+
if (i === void 0)
|
|
645
621
|
throw new Error("No preparedMediaStream");
|
|
646
|
-
return this.rtcSession.replaceMediaStream(
|
|
622
|
+
return this.rtcSession.replaceMediaStream(i, t);
|
|
647
623
|
}
|
|
648
624
|
async restartIce(e) {
|
|
649
625
|
if (!this.rtcSession)
|
|
650
626
|
throw new Error("No rtcSession established");
|
|
651
627
|
return this.rtcSession.restartIce(e);
|
|
652
628
|
}
|
|
653
|
-
async addTransceiver(e, t) {
|
|
654
|
-
if (!this.rtcSession)
|
|
655
|
-
throw new Error("No rtcSession established");
|
|
656
|
-
return this.rtcSession.addTransceiver(e, t);
|
|
657
|
-
}
|
|
658
629
|
handleCall = async ({
|
|
659
630
|
ontrack: e
|
|
660
631
|
}) => new Promise((t, s) => {
|
|
661
|
-
const
|
|
662
|
-
this.events.on(
|
|
663
|
-
},
|
|
664
|
-
this.events.off(
|
|
632
|
+
const i = () => {
|
|
633
|
+
this.events.on(N.PEER_CONNECTION, T), this.events.on(N.CONFIRMED, S);
|
|
634
|
+
}, r = () => {
|
|
635
|
+
this.events.off(N.PEER_CONNECTION, T), this.events.off(N.CONFIRMED, S);
|
|
665
636
|
}, a = () => {
|
|
666
|
-
this.events.on(
|
|
637
|
+
this.events.on(N.FAILED, h), this.events.on(N.ENDED, h);
|
|
667
638
|
}, o = () => {
|
|
668
|
-
this.events.off(
|
|
639
|
+
this.events.off(N.FAILED, h), this.events.off(N.ENDED, h);
|
|
669
640
|
}, h = (l) => {
|
|
670
|
-
|
|
641
|
+
r(), o(), s(l);
|
|
671
642
|
};
|
|
672
643
|
let d;
|
|
673
644
|
const T = ({ peerconnection: l }) => {
|
|
674
645
|
d = l;
|
|
675
|
-
const E = (
|
|
676
|
-
this.events.trigger(
|
|
646
|
+
const E = (m) => {
|
|
647
|
+
this.events.trigger(N.PEER_CONNECTION_ONTRACK, m), e && e(m);
|
|
677
648
|
};
|
|
678
649
|
l.addEventListener("track", E), this.disposers.add(() => {
|
|
679
650
|
l.removeEventListener("track", E);
|
|
680
651
|
});
|
|
681
652
|
}, S = () => {
|
|
682
|
-
d !== void 0 && this.events.trigger(
|
|
653
|
+
d !== void 0 && this.events.trigger(N.PEER_CONNECTION_CONFIRMED, d), r(), o(), t(d);
|
|
683
654
|
};
|
|
684
|
-
|
|
655
|
+
i(), a();
|
|
685
656
|
});
|
|
686
657
|
subscribeToSessionEvents(e) {
|
|
687
658
|
this.events.eachTriggers((t, s) => {
|
|
688
|
-
const
|
|
689
|
-
|
|
690
|
-
e.off(
|
|
659
|
+
const i = re.find((r) => r === s);
|
|
660
|
+
i && (e.on(i, t), this.disposers.add(() => {
|
|
661
|
+
e.off(i, t);
|
|
691
662
|
}));
|
|
692
663
|
});
|
|
693
664
|
}
|
|
@@ -698,7 +669,7 @@ class Qe {
|
|
|
698
669
|
}
|
|
699
670
|
handleEnded = (e) => {
|
|
700
671
|
const { originator: t } = e;
|
|
701
|
-
t === "remote" && this.events.trigger(
|
|
672
|
+
t === "remote" && this.events.trigger(N.ENDED_FROM_SERVER, e), this.reset();
|
|
702
673
|
};
|
|
703
674
|
reset = () => {
|
|
704
675
|
delete this.rtcSession, this.unsubscribeFromSessionEvents(), this.onReset();
|
|
@@ -710,8 +681,8 @@ class Ye {
|
|
|
710
681
|
this.remoteStreams = {};
|
|
711
682
|
}
|
|
712
683
|
generateStream(e, t) {
|
|
713
|
-
const { id: s } = e,
|
|
714
|
-
return t &&
|
|
684
|
+
const { id: s } = e, i = this.remoteStreams[s] ?? new MediaStream();
|
|
685
|
+
return t && i.addTrack(t), i.addTrack(e), this.remoteStreams[s] = i, i;
|
|
715
686
|
}
|
|
716
687
|
generateAudioStream(e) {
|
|
717
688
|
const { id: t } = e, s = this.remoteStreams[t] ?? new MediaStream();
|
|
@@ -719,13 +690,13 @@ class Ye {
|
|
|
719
690
|
}
|
|
720
691
|
generateStreams(e) {
|
|
721
692
|
const t = [];
|
|
722
|
-
return e.forEach((s,
|
|
693
|
+
return e.forEach((s, i) => {
|
|
723
694
|
if (s.kind === "audio")
|
|
724
695
|
return;
|
|
725
|
-
const
|
|
696
|
+
const r = s, a = e[i - 1];
|
|
726
697
|
let o;
|
|
727
698
|
a?.kind === "audio" && (o = a);
|
|
728
|
-
const h = this.generateStream(
|
|
699
|
+
const h = this.generateStream(r, o);
|
|
729
700
|
t.push(h);
|
|
730
701
|
}), t;
|
|
731
702
|
}
|
|
@@ -733,11 +704,17 @@ class Ye {
|
|
|
733
704
|
return e.map((t) => this.generateAudioStream(t));
|
|
734
705
|
}
|
|
735
706
|
}
|
|
736
|
-
class ze
|
|
707
|
+
class ze {
|
|
708
|
+
events;
|
|
709
|
+
isPendingCall = !1;
|
|
710
|
+
isPendingAnswer = !1;
|
|
711
|
+
rtcSession;
|
|
712
|
+
remoteStreams = {};
|
|
713
|
+
callConfiguration = {};
|
|
737
714
|
remoteStreamsManager = new Ye();
|
|
738
715
|
mcuSession;
|
|
739
|
-
constructor(
|
|
740
|
-
|
|
716
|
+
constructor() {
|
|
717
|
+
this.events = new O(ae), this.mcuSession = new Qe(this.events, { onReset: this.reset }), this.subscribeCallStatusChange();
|
|
741
718
|
}
|
|
742
719
|
get requested() {
|
|
743
720
|
return this.isPendingCall || this.isPendingAnswer;
|
|
@@ -749,6 +726,24 @@ class ze extends xe {
|
|
|
749
726
|
return this.mcuSession.isCallActive;
|
|
750
727
|
}
|
|
751
728
|
getEstablishedRTCSession = () => this.mcuSession.getEstablishedRTCSession();
|
|
729
|
+
on(e, t) {
|
|
730
|
+
return this.events.on(e, t);
|
|
731
|
+
}
|
|
732
|
+
onRace(e, t) {
|
|
733
|
+
return this.events.onRace(e, t);
|
|
734
|
+
}
|
|
735
|
+
once(e, t) {
|
|
736
|
+
return this.events.once(e, t);
|
|
737
|
+
}
|
|
738
|
+
onceRace(e, t) {
|
|
739
|
+
return this.events.onceRace(e, t);
|
|
740
|
+
}
|
|
741
|
+
async wait(e) {
|
|
742
|
+
return this.events.wait(e);
|
|
743
|
+
}
|
|
744
|
+
off(e, t) {
|
|
745
|
+
this.events.off(e, t);
|
|
746
|
+
}
|
|
752
747
|
startCall = async (e, t, s) => (this.isPendingCall = !0, this.callConfiguration.number = s.number, this.callConfiguration.answer = !1, this.mcuSession.startCall(e, t, s).finally(() => {
|
|
753
748
|
this.isPendingCall = !1;
|
|
754
749
|
}));
|
|
@@ -768,7 +763,7 @@ class ze extends xe {
|
|
|
768
763
|
getRemoteStreams() {
|
|
769
764
|
const e = this.mcuSession.getRemoteTracks();
|
|
770
765
|
if (e)
|
|
771
|
-
return
|
|
766
|
+
return Ve(e) ? this.remoteStreamsManager.generateStreams(e) : this.remoteStreamsManager.generateAudioStreams(e);
|
|
772
767
|
}
|
|
773
768
|
async replaceMediaStream(e, t) {
|
|
774
769
|
return this.mcuSession.replaceMediaStream(e, t);
|
|
@@ -776,101 +771,52 @@ class ze extends xe {
|
|
|
776
771
|
async restartIce(e) {
|
|
777
772
|
return this.mcuSession.restartIce(e);
|
|
778
773
|
}
|
|
779
|
-
async addTransceiver(e, t) {
|
|
780
|
-
return this.mcuSession.addTransceiver(e, t);
|
|
781
|
-
}
|
|
782
774
|
reset = () => {
|
|
783
775
|
this.remoteStreamsManager.reset(), this.callConfiguration.number = void 0, this.callConfiguration.answer = !1;
|
|
784
776
|
};
|
|
785
|
-
}
|
|
786
|
-
class Xe {
|
|
787
|
-
events;
|
|
788
|
-
strategy;
|
|
789
|
-
constructor(e) {
|
|
790
|
-
this.events = new y(re), this.strategy = e ?? new ze(this.events), this.subscribeCallStatusChange();
|
|
791
|
-
}
|
|
792
|
-
get requested() {
|
|
793
|
-
return this.strategy.requested;
|
|
794
|
-
}
|
|
795
|
-
get connection() {
|
|
796
|
-
return this.strategy.connection;
|
|
797
|
-
}
|
|
798
|
-
get isCallActive() {
|
|
799
|
-
return this.strategy.isCallActive;
|
|
800
|
-
}
|
|
801
|
-
getEstablishedRTCSession = () => this.strategy.getEstablishedRTCSession();
|
|
802
|
-
on(e, t) {
|
|
803
|
-
return this.events.on(e, t);
|
|
804
|
-
}
|
|
805
|
-
onRace(e, t) {
|
|
806
|
-
return this.events.onRace(e, t);
|
|
807
|
-
}
|
|
808
|
-
once(e, t) {
|
|
809
|
-
return this.events.once(e, t);
|
|
810
|
-
}
|
|
811
|
-
onceRace(e, t) {
|
|
812
|
-
return this.events.onceRace(e, t);
|
|
813
|
-
}
|
|
814
|
-
async wait(e) {
|
|
815
|
-
return this.events.wait(e);
|
|
816
|
-
}
|
|
817
|
-
off(e, t) {
|
|
818
|
-
this.events.off(e, t);
|
|
819
|
-
}
|
|
820
|
-
setStrategy(e) {
|
|
821
|
-
this.strategy = e;
|
|
822
|
-
}
|
|
823
|
-
startCall = async (...e) => this.strategy.startCall(...e);
|
|
824
|
-
endCall = async () => this.strategy.endCall();
|
|
825
|
-
answerToIncomingCall = async (...e) => this.strategy.answerToIncomingCall(...e);
|
|
826
|
-
getCallConfiguration = () => this.strategy.getCallConfiguration();
|
|
827
|
-
getRemoteStreams = () => this.strategy.getRemoteStreams();
|
|
828
|
-
addTransceiver = async (...e) => this.strategy.addTransceiver(...e);
|
|
829
|
-
replaceMediaStream = async (...e) => this.strategy.replaceMediaStream(...e);
|
|
830
|
-
restartIce = async (e) => this.strategy.restartIce(e);
|
|
831
777
|
subscribeCallStatusChange() {
|
|
832
778
|
let { isCallActive: e } = this;
|
|
833
|
-
const { ACCEPTED: t, CONFIRMED: s, ENDED:
|
|
834
|
-
this.onRace([t, s,
|
|
779
|
+
const { ACCEPTED: t, CONFIRMED: s, ENDED: i, FAILED: r } = N;
|
|
780
|
+
this.onRace([t, s, i, r], () => {
|
|
835
781
|
e = this.maybeTriggerCallStatus(e);
|
|
836
782
|
});
|
|
837
783
|
}
|
|
838
784
|
maybeTriggerCallStatus(e) {
|
|
839
785
|
const t = this.isCallActive;
|
|
840
|
-
return t !== e && this.events.trigger(
|
|
786
|
+
return t !== e && this.events.trigger(N.CALL_STATUS_CHANGED, { isCallActive: t }), t;
|
|
841
787
|
}
|
|
842
788
|
}
|
|
843
|
-
const
|
|
789
|
+
const Xe = (n, e) => (n.degradationPreference = e.degradationPreference, n), Je = (n, e) => {
|
|
844
790
|
n.encodings ??= [];
|
|
845
791
|
for (let t = n.encodings.length; t < e; t += 1)
|
|
846
792
|
n.encodings.push({});
|
|
847
793
|
return n;
|
|
848
|
-
},
|
|
849
|
-
if (
|
|
794
|
+
}, ce = (n) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== n, Ke = ce(), je = (n, e) => {
|
|
795
|
+
if (Ke(n, e))
|
|
850
796
|
return n;
|
|
851
|
-
},
|
|
852
|
-
const t = n.maxBitrate, s =
|
|
797
|
+
}, Ze = (n, e) => {
|
|
798
|
+
const t = n.maxBitrate, s = je(e, t);
|
|
853
799
|
return s !== void 0 && (n.maxBitrate = s), n;
|
|
854
|
-
},
|
|
855
|
-
|
|
856
|
-
),
|
|
857
|
-
const t = n === void 0 ? void 0 : Math.max(n,
|
|
858
|
-
if (t !== void 0 &&
|
|
800
|
+
}, he = 1, et = ce(
|
|
801
|
+
he
|
|
802
|
+
), tt = (n, e) => {
|
|
803
|
+
const t = n === void 0 ? void 0 : Math.max(n, he);
|
|
804
|
+
if (t !== void 0 && et(
|
|
859
805
|
t,
|
|
860
806
|
e
|
|
861
807
|
))
|
|
862
808
|
return t;
|
|
863
|
-
},
|
|
864
|
-
const t = n.scaleResolutionDownBy, s =
|
|
809
|
+
}, nt = (n, e) => {
|
|
810
|
+
const t = n.scaleResolutionDownBy, s = tt(
|
|
865
811
|
e,
|
|
866
812
|
t
|
|
867
813
|
);
|
|
868
814
|
return s !== void 0 && (n.scaleResolutionDownBy = s), n;
|
|
869
|
-
},
|
|
815
|
+
}, st = (n, e) => {
|
|
870
816
|
const t = e.encodings?.length ?? 0;
|
|
871
|
-
return
|
|
872
|
-
const
|
|
873
|
-
|
|
817
|
+
return Je(n, t), n.encodings.forEach((s, i) => {
|
|
818
|
+
const r = (e?.encodings ?? [])[i], a = r?.maxBitrate, o = r?.scaleResolutionDownBy;
|
|
819
|
+
Ze(s, a), nt(s, o);
|
|
874
820
|
}), n;
|
|
875
821
|
}, it = (n, e) => {
|
|
876
822
|
if (n.codecs?.length !== e.codecs?.length)
|
|
@@ -889,15 +835,15 @@ const Je = (n, e) => (n.degradationPreference = e.degradationPreference, n), Ke
|
|
|
889
835
|
if (JSON.stringify(n.encodings[t]) !== JSON.stringify(e.encodings[t]))
|
|
890
836
|
return !0;
|
|
891
837
|
return n.rtcp?.cname !== e.rtcp?.cname || n.rtcp?.reducedSize !== e.rtcp?.reducedSize || n.degradationPreference !== e.degradationPreference;
|
|
892
|
-
},
|
|
838
|
+
}, rt = async (n, e) => {
|
|
893
839
|
const t = n.getParameters(), s = JSON.parse(
|
|
894
840
|
JSON.stringify(t)
|
|
895
841
|
);
|
|
896
|
-
|
|
897
|
-
const
|
|
898
|
-
return
|
|
899
|
-
},
|
|
900
|
-
const { isChanged: s, parameters:
|
|
842
|
+
st(t, e), Xe(t, e);
|
|
843
|
+
const i = it(s, t);
|
|
844
|
+
return i && await n.setParameters(t), { parameters: t, isChanged: i };
|
|
845
|
+
}, de = async (n, e, t) => {
|
|
846
|
+
const { isChanged: s, parameters: i } = await rt(n, {
|
|
901
847
|
encodings: [
|
|
902
848
|
{
|
|
903
849
|
scaleResolutionDownBy: e.scaleResolutionDownBy,
|
|
@@ -905,21 +851,21 @@ const Je = (n, e) => (n.degradationPreference = e.degradationPreference, n), Ke
|
|
|
905
851
|
}
|
|
906
852
|
]
|
|
907
853
|
});
|
|
908
|
-
return s && t && t(
|
|
909
|
-
},
|
|
910
|
-
const s =
|
|
854
|
+
return s && t && t(i), { isChanged: s, parameters: i };
|
|
855
|
+
}, at = (n, e) => n.find((t) => t.track !== null && e.getTracks().includes(t.track)), ot = async (n, e, t) => {
|
|
856
|
+
const s = at(n, e);
|
|
911
857
|
if (s)
|
|
912
|
-
return
|
|
858
|
+
return de(s, { maxBitrate: t });
|
|
913
859
|
};
|
|
914
|
-
var
|
|
915
|
-
const
|
|
860
|
+
var P = /* @__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))(P || {});
|
|
861
|
+
const le = [
|
|
916
862
|
"presentation:start",
|
|
917
863
|
"presentation:started",
|
|
918
864
|
"presentation:end",
|
|
919
865
|
"presentation:ended",
|
|
920
866
|
"presentation:failed"
|
|
921
|
-
],
|
|
922
|
-
class
|
|
867
|
+
], ct = 1, xn = (n) => Oe(n);
|
|
868
|
+
class ht {
|
|
923
869
|
events;
|
|
924
870
|
promisePendingStartPresentation;
|
|
925
871
|
promisePendingStopPresentation;
|
|
@@ -931,7 +877,7 @@ class dt {
|
|
|
931
877
|
callManager: e,
|
|
932
878
|
maxBitrate: t
|
|
933
879
|
}) {
|
|
934
|
-
this.callManager = e, this.maxBitrate = t, this.events = new
|
|
880
|
+
this.callManager = e, this.maxBitrate = t, this.events = new O(le), this.subscribe();
|
|
935
881
|
}
|
|
936
882
|
get isPendingPresentation() {
|
|
937
883
|
return !!this.promisePendingStartPresentation || !!this.promisePendingStopPresentation;
|
|
@@ -939,8 +885,8 @@ class dt {
|
|
|
939
885
|
// eslint-disable-next-line @typescript-eslint/max-params
|
|
940
886
|
async startPresentation(e, t, {
|
|
941
887
|
isNeedReinvite: s,
|
|
942
|
-
contentHint:
|
|
943
|
-
sendEncodings:
|
|
888
|
+
contentHint: i,
|
|
889
|
+
sendEncodings: r,
|
|
944
890
|
onAddedTransceiver: a
|
|
945
891
|
} = {}, o) {
|
|
946
892
|
const h = this.getRtcSessionProtected();
|
|
@@ -951,8 +897,8 @@ class dt {
|
|
|
951
897
|
stream: t,
|
|
952
898
|
presentationOptions: {
|
|
953
899
|
isNeedReinvite: s,
|
|
954
|
-
contentHint:
|
|
955
|
-
sendEncodings:
|
|
900
|
+
contentHint: i,
|
|
901
|
+
sendEncodings: r,
|
|
956
902
|
onAddedTransceiver: a
|
|
957
903
|
},
|
|
958
904
|
options: o
|
|
@@ -964,18 +910,18 @@ class dt {
|
|
|
964
910
|
let s = this.promisePendingStartPresentation ?? Promise.resolve(void 0);
|
|
965
911
|
this.promisePendingStartPresentation && await this.promisePendingStartPresentation.catch(() => {
|
|
966
912
|
});
|
|
967
|
-
const
|
|
968
|
-
return
|
|
969
|
-
const a =
|
|
970
|
-
throw this.events.trigger(
|
|
971
|
-
}) : t && this.events.trigger(
|
|
913
|
+
const i = this.callManager.getEstablishedRTCSession();
|
|
914
|
+
return i && t ? s = e().then(async () => i.stopPresentation(t)).catch((r) => {
|
|
915
|
+
const a = r instanceof Error ? r : new Error(String(r));
|
|
916
|
+
throw this.events.trigger(P.FAILED_PRESENTATION, a), r;
|
|
917
|
+
}) : t && this.events.trigger(P.ENDED_PRESENTATION, t), this.promisePendingStopPresentation = s, s.finally(() => {
|
|
972
918
|
this.resetPresentation();
|
|
973
919
|
});
|
|
974
920
|
}
|
|
975
921
|
async updatePresentation(e, t, {
|
|
976
922
|
contentHint: s,
|
|
977
|
-
sendEncodings:
|
|
978
|
-
onAddedTransceiver:
|
|
923
|
+
sendEncodings: i,
|
|
924
|
+
onAddedTransceiver: r
|
|
979
925
|
} = {}) {
|
|
980
926
|
const a = this.getRtcSessionProtected();
|
|
981
927
|
if (!this.streamPresentationCurrent)
|
|
@@ -983,8 +929,8 @@ class dt {
|
|
|
983
929
|
return this.promisePendingStartPresentation && await this.promisePendingStartPresentation, this.sendPresentation(e, a, t, {
|
|
984
930
|
contentHint: s,
|
|
985
931
|
isNeedReinvite: !1,
|
|
986
|
-
sendEncodings:
|
|
987
|
-
onAddedTransceiver:
|
|
932
|
+
sendEncodings: i,
|
|
933
|
+
onAddedTransceiver: r
|
|
988
934
|
}).then(async (o) => (await this.setMaxBitrate(), o));
|
|
989
935
|
}
|
|
990
936
|
cancelSendPresentationWithRepeatedCalls() {
|
|
@@ -1007,58 +953,58 @@ class dt {
|
|
|
1007
953
|
}
|
|
1008
954
|
subscribe() {
|
|
1009
955
|
this.callManager.on("presentation:start", (e) => {
|
|
1010
|
-
this.events.trigger(
|
|
956
|
+
this.events.trigger(P.START_PRESENTATION, e);
|
|
1011
957
|
}), this.callManager.on("presentation:started", (e) => {
|
|
1012
|
-
this.events.trigger(
|
|
958
|
+
this.events.trigger(P.STARTED_PRESENTATION, e);
|
|
1013
959
|
}), this.callManager.on("presentation:end", (e) => {
|
|
1014
|
-
this.events.trigger(
|
|
960
|
+
this.events.trigger(P.END_PRESENTATION, e);
|
|
1015
961
|
}), this.callManager.on("presentation:ended", (e) => {
|
|
1016
|
-
this.events.trigger(
|
|
962
|
+
this.events.trigger(P.ENDED_PRESENTATION, e);
|
|
1017
963
|
}), this.callManager.on("presentation:failed", (e) => {
|
|
1018
|
-
this.events.trigger(
|
|
964
|
+
this.events.trigger(P.FAILED_PRESENTATION, e);
|
|
1019
965
|
}), this.callManager.on("failed", this.handleEnded), this.callManager.on("ended", this.handleEnded);
|
|
1020
966
|
}
|
|
1021
967
|
async sendPresentationWithDuplicatedCalls(e, {
|
|
1022
968
|
rtcSession: t,
|
|
1023
969
|
stream: s,
|
|
1024
|
-
presentationOptions:
|
|
1025
|
-
options:
|
|
1026
|
-
callLimit:
|
|
970
|
+
presentationOptions: i,
|
|
971
|
+
options: r = {
|
|
972
|
+
callLimit: ct
|
|
1027
973
|
}
|
|
1028
974
|
}) {
|
|
1029
975
|
const a = async () => this.sendPresentation(
|
|
1030
976
|
e,
|
|
1031
977
|
t,
|
|
1032
978
|
s,
|
|
1033
|
-
|
|
979
|
+
i
|
|
1034
980
|
), o = () => !!this.streamPresentationCurrent;
|
|
1035
|
-
return this.cancelableSendPresentationWithRepeatedCalls =
|
|
981
|
+
return this.cancelableSendPresentationWithRepeatedCalls = te({
|
|
1036
982
|
targetFunction: a,
|
|
1037
983
|
isComplete: o,
|
|
1038
984
|
isRejectAsValid: !0,
|
|
1039
|
-
...
|
|
985
|
+
...r
|
|
1040
986
|
}), this.cancelableSendPresentationWithRepeatedCalls.then((h) => h);
|
|
1041
987
|
}
|
|
1042
988
|
// eslint-disable-next-line @typescript-eslint/max-params
|
|
1043
989
|
async sendPresentation(e, t, s, {
|
|
1044
|
-
isNeedReinvite:
|
|
1045
|
-
contentHint:
|
|
990
|
+
isNeedReinvite: i = !0,
|
|
991
|
+
contentHint: r = "detail",
|
|
1046
992
|
degradationPreference: a,
|
|
1047
993
|
sendEncodings: o,
|
|
1048
994
|
onAddedTransceiver: h
|
|
1049
995
|
}) {
|
|
1050
|
-
const d = B(s, { contentHint:
|
|
996
|
+
const d = B(s, { contentHint: r });
|
|
1051
997
|
if (d === void 0)
|
|
1052
998
|
throw new Error("No streamPresentationTarget");
|
|
1053
999
|
this.streamPresentationCurrent = d;
|
|
1054
|
-
const T = e().then(async () => t.startPresentation(d,
|
|
1000
|
+
const T = e().then(async () => t.startPresentation(d, i, {
|
|
1055
1001
|
degradationPreference: a,
|
|
1056
1002
|
sendEncodings: o,
|
|
1057
1003
|
onAddedTransceiver: h
|
|
1058
1004
|
})).then(this.setMaxBitrate).then(() => s).catch((S) => {
|
|
1059
1005
|
this.removeStreamPresentationCurrent();
|
|
1060
1006
|
const l = S instanceof Error ? S : new Error(String(S));
|
|
1061
|
-
throw this.events.trigger(
|
|
1007
|
+
throw this.events.trigger(P.FAILED_PRESENTATION, l), S;
|
|
1062
1008
|
});
|
|
1063
1009
|
return this.promisePendingStartPresentation = T, T.finally(() => {
|
|
1064
1010
|
this.promisePendingStartPresentation = void 0;
|
|
@@ -1068,8 +1014,8 @@ class dt {
|
|
|
1068
1014
|
const { connection: e } = this.callManager, { streamPresentationCurrent: t } = this, { maxBitrate: s } = this;
|
|
1069
1015
|
if (!e || !t || s === void 0)
|
|
1070
1016
|
return;
|
|
1071
|
-
const
|
|
1072
|
-
await
|
|
1017
|
+
const i = e.getSenders();
|
|
1018
|
+
await ot(i, t, s);
|
|
1073
1019
|
};
|
|
1074
1020
|
getRtcSessionProtected = () => {
|
|
1075
1021
|
const e = this.callManager.getEstablishedRTCSession();
|
|
@@ -1090,7 +1036,7 @@ class dt {
|
|
|
1090
1036
|
delete this.streamPresentationCurrent;
|
|
1091
1037
|
}
|
|
1092
1038
|
}
|
|
1093
|
-
class
|
|
1039
|
+
class dt {
|
|
1094
1040
|
data;
|
|
1095
1041
|
getUa;
|
|
1096
1042
|
constructor(e) {
|
|
@@ -1171,7 +1117,7 @@ class lt {
|
|
|
1171
1117
|
}
|
|
1172
1118
|
}
|
|
1173
1119
|
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 || {});
|
|
1174
|
-
const
|
|
1120
|
+
const ue = [
|
|
1175
1121
|
"connecting",
|
|
1176
1122
|
"connected",
|
|
1177
1123
|
"disconnected",
|
|
@@ -1181,7 +1127,7 @@ const le = [
|
|
|
1181
1127
|
"registrationFailed",
|
|
1182
1128
|
"newMessage",
|
|
1183
1129
|
"sipEvent"
|
|
1184
|
-
],
|
|
1130
|
+
], lt = [
|
|
1185
1131
|
"disconnecting",
|
|
1186
1132
|
"connect-started",
|
|
1187
1133
|
"connect-succeeded",
|
|
@@ -1189,8 +1135,8 @@ const le = [
|
|
|
1189
1135
|
"connect-parameters-resolve-success",
|
|
1190
1136
|
"connect-parameters-resolve-failed",
|
|
1191
1137
|
"connected-with-configuration"
|
|
1192
|
-
],
|
|
1193
|
-
class
|
|
1138
|
+
], ge = [...ue, ...lt], ut = 3;
|
|
1139
|
+
class gt {
|
|
1194
1140
|
cancelableConnectWithRepeatedCalls;
|
|
1195
1141
|
JsSIP;
|
|
1196
1142
|
events;
|
|
@@ -1209,15 +1155,15 @@ class Tt {
|
|
|
1209
1155
|
}
|
|
1210
1156
|
connect = async (e, t) => (this.cancelRequests(), this.connectWithDuplicatedCalls(e, t));
|
|
1211
1157
|
set = async ({ displayName: e }) => new Promise((t, s) => {
|
|
1212
|
-
const
|
|
1213
|
-
if (!
|
|
1158
|
+
const i = this.getUa();
|
|
1159
|
+
if (!i) {
|
|
1214
1160
|
s(new Error("this.ua is not initialized"));
|
|
1215
1161
|
return;
|
|
1216
1162
|
}
|
|
1217
|
-
let
|
|
1163
|
+
let r = !1;
|
|
1218
1164
|
const a = this.getConnectionConfiguration();
|
|
1219
|
-
e !== void 0 && e !== a?.displayName && (
|
|
1220
|
-
const o =
|
|
1165
|
+
e !== void 0 && e !== a?.displayName && (r = i.set("display_name", ie(e)), this.updateConnectionConfiguration("displayName", e));
|
|
1166
|
+
const o = r;
|
|
1221
1167
|
o ? t(o) : s(new Error("nothing changed"));
|
|
1222
1168
|
});
|
|
1223
1169
|
disconnect = async () => {
|
|
@@ -1228,32 +1174,32 @@ class Tt {
|
|
|
1228
1174
|
});
|
|
1229
1175
|
}), t = this.getUa();
|
|
1230
1176
|
return t ? t.stop() : this.events.trigger(C.DISCONNECTED, { socket: {}, error: !1 }), e.finally(() => {
|
|
1231
|
-
this.setUa(void 0), this.stateMachine.reset();
|
|
1177
|
+
t?.removeAllListeners(), this.setUa(void 0), this.stateMachine.reset();
|
|
1232
1178
|
});
|
|
1233
1179
|
};
|
|
1234
1180
|
cancelRequests() {
|
|
1235
1181
|
this.cancelConnectWithRepeatedCalls();
|
|
1236
1182
|
}
|
|
1237
|
-
connectWithDuplicatedCalls = async (e, { callLimit: t =
|
|
1238
|
-
const s = async () => this.connectInner(e),
|
|
1239
|
-
const h = this.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), d =
|
|
1183
|
+
connectWithDuplicatedCalls = async (e, { callLimit: t = ut } = {}) => {
|
|
1184
|
+
const s = async () => this.connectInner(e), i = (r) => {
|
|
1185
|
+
const h = this.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), d = r != null && !Le(r);
|
|
1240
1186
|
return h || d;
|
|
1241
1187
|
};
|
|
1242
|
-
return this.stateMachine.startConnect(), this.cancelableConnectWithRepeatedCalls =
|
|
1188
|
+
return this.stateMachine.startConnect(), this.cancelableConnectWithRepeatedCalls = te({
|
|
1243
1189
|
targetFunction: s,
|
|
1244
|
-
isComplete:
|
|
1190
|
+
isComplete: i,
|
|
1245
1191
|
callLimit: t,
|
|
1246
1192
|
isRejectAsValid: !0,
|
|
1247
1193
|
isCheckBeforeCall: !1
|
|
1248
|
-
}), this.cancelableConnectWithRepeatedCalls.then((
|
|
1249
|
-
if ("ua" in
|
|
1250
|
-
return
|
|
1251
|
-
throw
|
|
1194
|
+
}), this.cancelableConnectWithRepeatedCalls.then((r) => {
|
|
1195
|
+
if ("ua" in r && r.ua instanceof this.JsSIP.UA)
|
|
1196
|
+
return r;
|
|
1197
|
+
throw r;
|
|
1252
1198
|
});
|
|
1253
1199
|
};
|
|
1254
1200
|
hasEqualConnectionConfiguration(e) {
|
|
1255
|
-
const { configuration: t } = this.uaFactory.createConfiguration(e),
|
|
1256
|
-
return
|
|
1201
|
+
const { configuration: t } = this.uaFactory.createConfiguration(e), i = this.getUa()?.configuration;
|
|
1202
|
+
return i ? i.password === t.password && i.register === t.register && i.uri.toString() === t.uri && i.display_name === t.display_name && i.user_agent === t.user_agent && i.sockets === t.sockets && i.session_timers === t.session_timers && i.register_expires === t.register_expires && i.connection_recovery_min_interval === t.connection_recovery_min_interval && i.connection_recovery_max_interval === t.connection_recovery_max_interval : !1;
|
|
1257
1203
|
}
|
|
1258
1204
|
connectInner = async (e) => this.initUa(e).then(async () => this.start()).then((t) => {
|
|
1259
1205
|
const s = this.getConnectionConfiguration();
|
|
@@ -1268,8 +1214,8 @@ class Tt {
|
|
|
1268
1214
|
user: e,
|
|
1269
1215
|
password: t,
|
|
1270
1216
|
sipServerUrl: s,
|
|
1271
|
-
sipWebSocketServerURL:
|
|
1272
|
-
remoteAddress:
|
|
1217
|
+
sipWebSocketServerURL: i,
|
|
1218
|
+
remoteAddress: r,
|
|
1273
1219
|
sessionTimers: a,
|
|
1274
1220
|
registerExpires: o,
|
|
1275
1221
|
connectionRecoveryMinInterval: h,
|
|
@@ -1286,12 +1232,12 @@ class Tt {
|
|
|
1286
1232
|
user: e,
|
|
1287
1233
|
password: t
|
|
1288
1234
|
}), this.getUa() && await this.disconnect();
|
|
1289
|
-
const { ua:
|
|
1235
|
+
const { ua: R, helpers: M } = this.uaFactory.createUAWithConfiguration(
|
|
1290
1236
|
{
|
|
1291
1237
|
user: e,
|
|
1292
1238
|
password: t,
|
|
1293
1239
|
sipServerUrl: s,
|
|
1294
|
-
sipWebSocketServerURL:
|
|
1240
|
+
sipWebSocketServerURL: i,
|
|
1295
1241
|
displayName: S,
|
|
1296
1242
|
register: l,
|
|
1297
1243
|
sessionTimers: a,
|
|
@@ -1299,12 +1245,12 @@ class Tt {
|
|
|
1299
1245
|
connectionRecoveryMinInterval: h,
|
|
1300
1246
|
connectionRecoveryMaxInterval: d,
|
|
1301
1247
|
userAgent: T,
|
|
1302
|
-
remoteAddress:
|
|
1248
|
+
remoteAddress: r,
|
|
1303
1249
|
extraHeaders: E
|
|
1304
1250
|
},
|
|
1305
1251
|
this.events
|
|
1306
1252
|
);
|
|
1307
|
-
return this.setUa(
|
|
1253
|
+
return this.setUa(R), this.setSipServerUrl(M.getSipServerUrl), this.setSocket(M.socket), R;
|
|
1308
1254
|
};
|
|
1309
1255
|
start = async () => new Promise((e, t) => {
|
|
1310
1256
|
const s = this.getUa();
|
|
@@ -1312,8 +1258,8 @@ class Tt {
|
|
|
1312
1258
|
t(new Error("this.ua is not initialized"));
|
|
1313
1259
|
return;
|
|
1314
1260
|
}
|
|
1315
|
-
let
|
|
1316
|
-
|
|
1261
|
+
let i;
|
|
1262
|
+
i = ((h, d) => {
|
|
1317
1263
|
if (this.getConnectionConfiguration()?.register === !0)
|
|
1318
1264
|
return this.registrationManager.subscribeToStartEvents(h, d);
|
|
1319
1265
|
const S = C.CONNECTED, l = [C.DISCONNECTED];
|
|
@@ -1325,9 +1271,9 @@ class Tt {
|
|
|
1325
1271
|
});
|
|
1326
1272
|
};
|
|
1327
1273
|
})(() => {
|
|
1328
|
-
|
|
1274
|
+
i?.(), e(s);
|
|
1329
1275
|
}, (h) => {
|
|
1330
|
-
|
|
1276
|
+
i?.(), t(h);
|
|
1331
1277
|
}), s.start();
|
|
1332
1278
|
});
|
|
1333
1279
|
cancelConnectWithRepeatedCalls() {
|
|
@@ -1343,8 +1289,8 @@ class Tt {
|
|
|
1343
1289
|
});
|
|
1344
1290
|
}
|
|
1345
1291
|
}
|
|
1346
|
-
var
|
|
1347
|
-
const
|
|
1292
|
+
var Te = /* @__PURE__ */ ((n) => (n.START_CONNECT = "START_CONNECT", n.START_INIT_UA = "START_INIT_UA", n.UA_CONNECTED = "UA_CONNECTED", n.UA_REGISTERED = "UA_REGISTERED", n.UA_UNREGISTERED = "UA_UNREGISTERED", n.UA_DISCONNECTED = "UA_DISCONNECTED", n.CONNECTION_FAILED = "CONNECTION_FAILED", n.RESET = "RESET", n))(Te || {});
|
|
1293
|
+
const Tt = be({
|
|
1348
1294
|
types: {
|
|
1349
1295
|
context: {},
|
|
1350
1296
|
events: {}
|
|
@@ -1658,17 +1604,17 @@ const St = Oe({
|
|
|
1658
1604
|
}
|
|
1659
1605
|
}
|
|
1660
1606
|
});
|
|
1661
|
-
class
|
|
1607
|
+
class St {
|
|
1662
1608
|
actor;
|
|
1663
1609
|
stateChangeListeners = /* @__PURE__ */ new Set();
|
|
1664
1610
|
events;
|
|
1665
1611
|
unsubscribeFromEvents;
|
|
1666
1612
|
actorSubscription;
|
|
1667
1613
|
constructor(e) {
|
|
1668
|
-
this.events = e, this.actor =
|
|
1614
|
+
this.events = e, this.actor = De(Tt), this.actorSubscription = this.actor.subscribe((t) => {
|
|
1669
1615
|
const s = t.value;
|
|
1670
|
-
this.stateChangeListeners.forEach((
|
|
1671
|
-
|
|
1616
|
+
this.stateChangeListeners.forEach((i) => {
|
|
1617
|
+
i(s);
|
|
1672
1618
|
});
|
|
1673
1619
|
}), this.actor.start(), this.subscribeToEvents();
|
|
1674
1620
|
}
|
|
@@ -1751,7 +1697,7 @@ class Ct {
|
|
|
1751
1697
|
return this.actor.getSnapshot().can({ type: e });
|
|
1752
1698
|
}
|
|
1753
1699
|
getValidEvents() {
|
|
1754
|
-
return Object.values(
|
|
1700
|
+
return Object.values(Te).filter((e) => this.canTransition(e));
|
|
1755
1701
|
}
|
|
1756
1702
|
hasState(e) {
|
|
1757
1703
|
return this.actor.getSnapshot().matches(e);
|
|
@@ -1820,7 +1766,7 @@ class Ct {
|
|
|
1820
1766
|
};
|
|
1821
1767
|
}
|
|
1822
1768
|
}
|
|
1823
|
-
class
|
|
1769
|
+
class Ct {
|
|
1824
1770
|
events;
|
|
1825
1771
|
getUaProtected;
|
|
1826
1772
|
constructor(e) {
|
|
@@ -1847,17 +1793,17 @@ class Et {
|
|
|
1847
1793
|
return this.register();
|
|
1848
1794
|
}
|
|
1849
1795
|
subscribeToStartEvents(e, t) {
|
|
1850
|
-
const s = C.REGISTERED,
|
|
1851
|
-
return this.events.on(s, e),
|
|
1852
|
-
this.events.on(
|
|
1796
|
+
const s = C.REGISTERED, i = [C.REGISTRATION_FAILED, C.DISCONNECTED];
|
|
1797
|
+
return this.events.on(s, e), i.forEach((r) => {
|
|
1798
|
+
this.events.on(r, t);
|
|
1853
1799
|
}), () => {
|
|
1854
|
-
this.events.off(s, e),
|
|
1855
|
-
this.events.off(
|
|
1800
|
+
this.events.off(s, e), i.forEach((r) => {
|
|
1801
|
+
this.events.off(r, t);
|
|
1856
1802
|
});
|
|
1857
1803
|
};
|
|
1858
1804
|
}
|
|
1859
1805
|
}
|
|
1860
|
-
class
|
|
1806
|
+
class Et {
|
|
1861
1807
|
uaFactory;
|
|
1862
1808
|
getUaProtected;
|
|
1863
1809
|
constructor(e) {
|
|
@@ -1867,14 +1813,14 @@ class At {
|
|
|
1867
1813
|
* Отправляет SIP OPTIONS запрос к указанному адресу
|
|
1868
1814
|
*/
|
|
1869
1815
|
async sendOptions(e, t, s) {
|
|
1870
|
-
const
|
|
1871
|
-
return new Promise((
|
|
1816
|
+
const i = this.getUaProtected();
|
|
1817
|
+
return new Promise((r, a) => {
|
|
1872
1818
|
try {
|
|
1873
|
-
|
|
1819
|
+
i.sendOptions(e, t, {
|
|
1874
1820
|
extraHeaders: s,
|
|
1875
1821
|
eventHandlers: {
|
|
1876
1822
|
succeeded: () => {
|
|
1877
|
-
|
|
1823
|
+
r();
|
|
1878
1824
|
},
|
|
1879
1825
|
failed: a
|
|
1880
1826
|
}
|
|
@@ -1888,8 +1834,8 @@ class At {
|
|
|
1888
1834
|
* Отправляет SIP OPTIONS запрос к собственному URI (ping)
|
|
1889
1835
|
*/
|
|
1890
1836
|
async ping(e, t) {
|
|
1891
|
-
const
|
|
1892
|
-
return this.sendOptions(
|
|
1837
|
+
const i = this.getUaProtected().configuration.uri;
|
|
1838
|
+
return this.sendOptions(i, e, t);
|
|
1893
1839
|
}
|
|
1894
1840
|
/**
|
|
1895
1841
|
* Проверяет доступность телефонии, создавая временное соединение
|
|
@@ -1898,17 +1844,17 @@ class At {
|
|
|
1898
1844
|
userAgent: e,
|
|
1899
1845
|
displayName: t,
|
|
1900
1846
|
sipServerUrl: s,
|
|
1901
|
-
sipWebSocketServerURL:
|
|
1902
|
-
remoteAddress:
|
|
1847
|
+
sipWebSocketServerURL: i,
|
|
1848
|
+
remoteAddress: r,
|
|
1903
1849
|
extraHeaders: a
|
|
1904
1850
|
}) {
|
|
1905
1851
|
return new Promise((o, h) => {
|
|
1906
1852
|
const { configuration: d } = this.uaFactory.createConfiguration({
|
|
1907
|
-
sipWebSocketServerURL:
|
|
1853
|
+
sipWebSocketServerURL: i,
|
|
1908
1854
|
displayName: t,
|
|
1909
1855
|
userAgent: e,
|
|
1910
1856
|
sipServerUrl: s
|
|
1911
|
-
}), T = this.uaFactory.createUA({ ...d, remoteAddress:
|
|
1857
|
+
}), T = this.uaFactory.createUA({ ...d, remoteAddress: r, extraHeaders: a }), S = () => {
|
|
1912
1858
|
const E = new Error("Telephony is not available");
|
|
1913
1859
|
h(E);
|
|
1914
1860
|
};
|
|
@@ -1922,7 +1868,7 @@ class At {
|
|
|
1922
1868
|
});
|
|
1923
1869
|
}
|
|
1924
1870
|
}
|
|
1925
|
-
const
|
|
1871
|
+
const At = (n) => {
|
|
1926
1872
|
const e = [];
|
|
1927
1873
|
return n !== void 0 && n !== "" && e.push(`X-Vinteo-Remote: ${n}`), e;
|
|
1928
1874
|
};
|
|
@@ -1938,12 +1884,12 @@ class D {
|
|
|
1938
1884
|
register: e,
|
|
1939
1885
|
password: t,
|
|
1940
1886
|
user: s,
|
|
1941
|
-
sipServerUrl:
|
|
1942
|
-
sipWebSocketServerURL:
|
|
1887
|
+
sipServerUrl: i,
|
|
1888
|
+
sipWebSocketServerURL: r
|
|
1943
1889
|
}) {
|
|
1944
|
-
if (!r)
|
|
1945
|
-
throw new Error("sipServerUrl is required");
|
|
1946
1890
|
if (!i)
|
|
1891
|
+
throw new Error("sipServerUrl is required");
|
|
1892
|
+
if (!r)
|
|
1947
1893
|
throw new Error("sipWebSocketServerURL is required");
|
|
1948
1894
|
if (e && (t === void 0 || t === ""))
|
|
1949
1895
|
throw new Error("password is required for authorized connection");
|
|
@@ -1951,18 +1897,18 @@ class D {
|
|
|
1951
1897
|
throw new Error("user is required for authorized connection");
|
|
1952
1898
|
}
|
|
1953
1899
|
static resolveAuthorizationUser(e, t) {
|
|
1954
|
-
return e && t !== void 0 && t.trim() !== "" ? t.trim() : `${
|
|
1900
|
+
return e && t !== void 0 && t.trim() !== "" ? t.trim() : `${We()}`;
|
|
1955
1901
|
}
|
|
1956
1902
|
static buildExtraHeaders(e, t) {
|
|
1957
|
-
const s = e !== void 0 && e !== "" ?
|
|
1903
|
+
const s = e !== void 0 && e !== "" ? At(e) : [];
|
|
1958
1904
|
return t === void 0 ? s : [...s, ...t];
|
|
1959
1905
|
}
|
|
1960
1906
|
createConfiguration({
|
|
1961
1907
|
user: e,
|
|
1962
1908
|
password: t,
|
|
1963
1909
|
sipWebSocketServerURL: s,
|
|
1964
|
-
displayName:
|
|
1965
|
-
sipServerUrl:
|
|
1910
|
+
displayName: i = "",
|
|
1911
|
+
sipServerUrl: r,
|
|
1966
1912
|
register: a = !1,
|
|
1967
1913
|
sessionTimers: o = !1,
|
|
1968
1914
|
registerExpires: h = 300,
|
|
@@ -1975,51 +1921,51 @@ class D {
|
|
|
1975
1921
|
register: a,
|
|
1976
1922
|
password: t,
|
|
1977
1923
|
user: e,
|
|
1978
|
-
sipServerUrl:
|
|
1924
|
+
sipServerUrl: r,
|
|
1979
1925
|
sipWebSocketServerURL: s
|
|
1980
1926
|
});
|
|
1981
|
-
const l = D.resolveAuthorizationUser(a, e), E =
|
|
1927
|
+
const l = D.resolveAuthorizationUser(a, e), E = $e(r), m = E(l), R = new this.JsSIP.WebSocketInterface(s);
|
|
1982
1928
|
return {
|
|
1983
1929
|
configuration: {
|
|
1984
1930
|
password: t,
|
|
1985
1931
|
register: a,
|
|
1986
|
-
uri:
|
|
1987
|
-
display_name: ie(
|
|
1932
|
+
uri: m,
|
|
1933
|
+
display_name: ie(i),
|
|
1988
1934
|
user_agent: S,
|
|
1989
1935
|
sdpSemantics: "unified-plan",
|
|
1990
|
-
sockets: [
|
|
1936
|
+
sockets: [R],
|
|
1991
1937
|
session_timers: o,
|
|
1992
1938
|
register_expires: h,
|
|
1993
1939
|
connection_recovery_min_interval: d,
|
|
1994
1940
|
connection_recovery_max_interval: T
|
|
1995
1941
|
},
|
|
1996
1942
|
helpers: {
|
|
1997
|
-
socket:
|
|
1943
|
+
socket: R,
|
|
1998
1944
|
getSipServerUrl: E
|
|
1999
1945
|
}
|
|
2000
1946
|
};
|
|
2001
1947
|
}
|
|
2002
1948
|
createUA({ remoteAddress: e, extraHeaders: t, ...s }) {
|
|
2003
|
-
const
|
|
2004
|
-
return
|
|
1949
|
+
const i = new this.JsSIP.UA(s), r = D.buildExtraHeaders(e, t);
|
|
1950
|
+
return r.length > 0 && i.registrator().setExtraHeaders(r), i;
|
|
2005
1951
|
}
|
|
2006
1952
|
/**
|
|
2007
1953
|
* Создает UA с полным жизненным циклом - конфигурация + создание + настройка событий
|
|
2008
1954
|
*/
|
|
2009
1955
|
createUAWithConfiguration(e, t) {
|
|
2010
|
-
const { configuration: s, helpers:
|
|
1956
|
+
const { configuration: s, helpers: i } = this.createConfiguration(e), r = this.createUA({
|
|
2011
1957
|
...s,
|
|
2012
1958
|
remoteAddress: e.remoteAddress,
|
|
2013
1959
|
extraHeaders: e.extraHeaders
|
|
2014
1960
|
});
|
|
2015
1961
|
return t.eachTriggers((a, o) => {
|
|
2016
|
-
const h =
|
|
2017
|
-
h &&
|
|
2018
|
-
}), { ua:
|
|
1962
|
+
const h = ue.find((d) => d === o);
|
|
1963
|
+
h && r.on(h, a);
|
|
1964
|
+
}), { ua: r, helpers: i };
|
|
2019
1965
|
}
|
|
2020
1966
|
}
|
|
2021
|
-
const
|
|
2022
|
-
class
|
|
1967
|
+
const Se = "Not ready for connection", Nt = (n) => n instanceof Error && n.message === Se, Rt = () => new Error(Se), It = async (n) => typeof n == "function" ? n() : n;
|
|
1968
|
+
class mt {
|
|
2023
1969
|
events;
|
|
2024
1970
|
ua;
|
|
2025
1971
|
socket;
|
|
@@ -2031,15 +1977,15 @@ class pt {
|
|
|
2031
1977
|
configurationManager;
|
|
2032
1978
|
JsSIP;
|
|
2033
1979
|
constructor({ JsSIP: e }) {
|
|
2034
|
-
this.JsSIP = e, this.events = new
|
|
1980
|
+
this.JsSIP = e, this.events = new O(ge), this.uaFactory = new D(e), this.registrationManager = new Ct({
|
|
2035
1981
|
events: this.events,
|
|
2036
1982
|
getUaProtected: this.getUaProtected
|
|
2037
|
-
}), this.stateMachine = new
|
|
1983
|
+
}), this.stateMachine = new St(this.events), this.configurationManager = new dt({
|
|
2038
1984
|
getUa: this.getUa
|
|
2039
|
-
}), this.sipOperations = new
|
|
1985
|
+
}), this.sipOperations = new Et({
|
|
2040
1986
|
uaFactory: this.uaFactory,
|
|
2041
1987
|
getUaProtected: this.getUaProtected
|
|
2042
|
-
}), this.connectionFlow = new
|
|
1988
|
+
}), this.connectionFlow = new gt({
|
|
2043
1989
|
JsSIP: this.JsSIP,
|
|
2044
1990
|
events: this.events,
|
|
2045
1991
|
uaFactory: this.uaFactory,
|
|
@@ -2141,13 +2087,13 @@ class pt {
|
|
|
2141
2087
|
getUa = () => this.ua;
|
|
2142
2088
|
connectWithProcessError = async (e, t) => {
|
|
2143
2089
|
if (!(t?.hasReadyForConnection?.() ?? !0))
|
|
2144
|
-
throw
|
|
2145
|
-
return this.processConnect(e, t).catch(async (
|
|
2146
|
-
const
|
|
2090
|
+
throw Rt();
|
|
2091
|
+
return this.processConnect(e, t).catch(async (i) => {
|
|
2092
|
+
const r = i;
|
|
2147
2093
|
return this.disconnect().then(() => {
|
|
2148
|
-
throw
|
|
2094
|
+
throw r;
|
|
2149
2095
|
}).catch(() => {
|
|
2150
|
-
throw
|
|
2096
|
+
throw r;
|
|
2151
2097
|
});
|
|
2152
2098
|
});
|
|
2153
2099
|
};
|
|
@@ -2156,13 +2102,13 @@ class pt {
|
|
|
2156
2102
|
}).then(async (s) => this.connectionFlow.connect(s, t)).then((s) => (this.events.trigger(C.CONNECT_SUCCEEDED, {
|
|
2157
2103
|
...s
|
|
2158
2104
|
}), s)).catch((s) => {
|
|
2159
|
-
const
|
|
2160
|
-
throw this.events.trigger(C.CONNECT_FAILED,
|
|
2105
|
+
const i = s ?? new Error("Failed to connect to server");
|
|
2106
|
+
throw this.events.trigger(C.CONNECT_FAILED, i), i;
|
|
2161
2107
|
}));
|
|
2162
2108
|
}
|
|
2163
|
-
class
|
|
2109
|
+
class pt {
|
|
2164
2110
|
connectionManager;
|
|
2165
|
-
stackPromises =
|
|
2111
|
+
stackPromises = ne({
|
|
2166
2112
|
noRunIsNotActual: !0
|
|
2167
2113
|
});
|
|
2168
2114
|
constructor({ connectionManager: e }) {
|
|
@@ -2174,11 +2120,11 @@ class _t {
|
|
|
2174
2120
|
this.stackPromises.stop();
|
|
2175
2121
|
}
|
|
2176
2122
|
}
|
|
2177
|
-
const
|
|
2178
|
-
class
|
|
2179
|
-
countInner =
|
|
2180
|
-
initialCount =
|
|
2181
|
-
limitInner =
|
|
2123
|
+
const z = 0, _t = 30;
|
|
2124
|
+
class Mt {
|
|
2125
|
+
countInner = z;
|
|
2126
|
+
initialCount = z;
|
|
2127
|
+
limitInner = _t;
|
|
2182
2128
|
isInProgress = !1;
|
|
2183
2129
|
onStatusChange;
|
|
2184
2130
|
constructor({
|
|
@@ -2211,7 +2157,7 @@ class ft {
|
|
|
2211
2157
|
this.countInner = this.initialCount, this.finishAttempt();
|
|
2212
2158
|
}
|
|
2213
2159
|
}
|
|
2214
|
-
class
|
|
2160
|
+
class ft {
|
|
2215
2161
|
connectionManager;
|
|
2216
2162
|
interval;
|
|
2217
2163
|
checkTelephonyByTimeout = void 0;
|
|
@@ -2227,14 +2173,14 @@ class vt {
|
|
|
2227
2173
|
onSuccessRequest: t,
|
|
2228
2174
|
onFailRequest: s
|
|
2229
2175
|
}) {
|
|
2230
|
-
this.stop(), this.cancelableBeforeRequest = new x(e), this.checkTelephonyByTimeout =
|
|
2176
|
+
this.stop(), this.cancelableBeforeRequest = new x(e), this.checkTelephonyByTimeout = Me({
|
|
2231
2177
|
isDontStopOnFail: !0,
|
|
2232
2178
|
requestInterval: this.interval,
|
|
2233
2179
|
request: async () => {
|
|
2234
2180
|
if (!this.cancelableBeforeRequest)
|
|
2235
2181
|
throw new Error("cancelableBeforeRequest is not defined");
|
|
2236
|
-
const
|
|
2237
|
-
return this.connectionManager.checkTelephony(
|
|
2182
|
+
const i = await this.cancelableBeforeRequest.request();
|
|
2183
|
+
return this.connectionManager.checkTelephony(i);
|
|
2238
2184
|
}
|
|
2239
2185
|
}), this.checkTelephonyByTimeout.start(void 0, {
|
|
2240
2186
|
onFailRequest: s,
|
|
@@ -2248,7 +2194,7 @@ class vt {
|
|
|
2248
2194
|
}
|
|
2249
2195
|
}
|
|
2250
2196
|
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))(_ || {});
|
|
2251
|
-
const
|
|
2197
|
+
const Ce = [
|
|
2252
2198
|
"before-attempt",
|
|
2253
2199
|
"success",
|
|
2254
2200
|
"failed-all-attempts",
|
|
@@ -2256,15 +2202,41 @@ const Se = [
|
|
|
2256
2202
|
"changed-attempt-status",
|
|
2257
2203
|
"stop-attempts-by-error",
|
|
2258
2204
|
"limit-reached-attempts"
|
|
2259
|
-
]
|
|
2260
|
-
class
|
|
2205
|
+
];
|
|
2206
|
+
class Q {
|
|
2207
|
+
callManager;
|
|
2208
|
+
disposers = [];
|
|
2209
|
+
constructor({ callManager: e }) {
|
|
2210
|
+
this.callManager = e;
|
|
2211
|
+
}
|
|
2212
|
+
subscribe(e) {
|
|
2213
|
+
this.unsubscribe(), this.disposers.push(
|
|
2214
|
+
this.callManager.on("call-status-changed", () => {
|
|
2215
|
+
this.handleCallStatusChange(e);
|
|
2216
|
+
})
|
|
2217
|
+
), this.handleCallStatusChange(e);
|
|
2218
|
+
}
|
|
2219
|
+
unsubscribe() {
|
|
2220
|
+
this.disposers.forEach((e) => {
|
|
2221
|
+
e();
|
|
2222
|
+
}), this.disposers = [];
|
|
2223
|
+
}
|
|
2224
|
+
handleCallStatusChange({
|
|
2225
|
+
onActive: e,
|
|
2226
|
+
onInactive: t
|
|
2227
|
+
}) {
|
|
2228
|
+
this.callManager.isCallActive ? e?.() : t();
|
|
2229
|
+
}
|
|
2230
|
+
}
|
|
2231
|
+
const vt = 15e3, Pt = 2;
|
|
2232
|
+
class Ot {
|
|
2261
2233
|
connectionManager;
|
|
2262
2234
|
pingServerByTimeoutWithFailCalls;
|
|
2263
2235
|
constructor({ connectionManager: e }) {
|
|
2264
|
-
this.connectionManager = e, this.pingServerByTimeoutWithFailCalls =
|
|
2236
|
+
this.connectionManager = e, this.pingServerByTimeoutWithFailCalls = fe(Pt, {
|
|
2265
2237
|
whenPossibleRequest: async () => {
|
|
2266
2238
|
},
|
|
2267
|
-
requestInterval:
|
|
2239
|
+
requestInterval: vt,
|
|
2268
2240
|
request: async () => (c("ping"), this.connectionManager.ping().then(() => {
|
|
2269
2241
|
c("ping success");
|
|
2270
2242
|
}))
|
|
@@ -2277,54 +2249,57 @@ class yt {
|
|
|
2277
2249
|
this.pingServerByTimeoutWithFailCalls.stop();
|
|
2278
2250
|
}
|
|
2279
2251
|
}
|
|
2280
|
-
class
|
|
2281
|
-
callManager;
|
|
2252
|
+
class bt {
|
|
2282
2253
|
pingServerRequester;
|
|
2283
|
-
|
|
2254
|
+
notActiveCallSubscriber;
|
|
2284
2255
|
constructor({
|
|
2285
2256
|
connectionManager: e,
|
|
2286
2257
|
callManager: t
|
|
2287
2258
|
}) {
|
|
2288
|
-
this.
|
|
2259
|
+
this.pingServerRequester = new Ot({
|
|
2289
2260
|
connectionManager: e
|
|
2290
|
-
});
|
|
2261
|
+
}), this.notActiveCallSubscriber = new Q({ callManager: t });
|
|
2291
2262
|
}
|
|
2292
2263
|
start({ onFailRequest: e }) {
|
|
2293
|
-
c("start"), this.
|
|
2294
|
-
|
|
2295
|
-
|
|
2264
|
+
c("start"), this.notActiveCallSubscriber.subscribe({
|
|
2265
|
+
onActive: () => {
|
|
2266
|
+
this.pingServerRequester.stop();
|
|
2267
|
+
},
|
|
2268
|
+
onInactive: () => {
|
|
2269
|
+
this.pingServerRequester.start({ onFailRequest: e });
|
|
2270
|
+
}
|
|
2271
|
+
});
|
|
2296
2272
|
}
|
|
2297
2273
|
stop() {
|
|
2298
2274
|
c("stop"), this.pingServerRequester.stop(), this.unsubscribeCallStatusChange();
|
|
2299
2275
|
}
|
|
2300
2276
|
unsubscribeCallStatusChange() {
|
|
2301
|
-
this.
|
|
2302
|
-
}
|
|
2303
|
-
handleCallStatusChange({ onFailRequest: e }) {
|
|
2304
|
-
this.callManager.isCallActive ? this.pingServerRequester.stop() : this.pingServerRequester.start({ onFailRequest: e });
|
|
2277
|
+
this.notActiveCallSubscriber.unsubscribe();
|
|
2305
2278
|
}
|
|
2306
2279
|
}
|
|
2307
|
-
class
|
|
2280
|
+
class Dt {
|
|
2308
2281
|
connectionManager;
|
|
2309
|
-
callManager;
|
|
2310
2282
|
isRegistrationFailed = !1;
|
|
2311
2283
|
disposers = [];
|
|
2284
|
+
notActiveCallSubscriber;
|
|
2312
2285
|
constructor({
|
|
2313
2286
|
connectionManager: e,
|
|
2314
2287
|
callManager: t
|
|
2315
2288
|
}) {
|
|
2316
|
-
this.connectionManager = e, this.
|
|
2289
|
+
this.connectionManager = e, this.notActiveCallSubscriber = new Q({ callManager: t });
|
|
2317
2290
|
}
|
|
2318
2291
|
subscribe(e) {
|
|
2319
2292
|
this.unsubscribe(), this.disposers.push(
|
|
2320
2293
|
this.connectionManager.on("registrationFailed", () => {
|
|
2321
2294
|
this.setIsRegistrationFailed();
|
|
2322
2295
|
})
|
|
2323
|
-
), this.
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
}
|
|
2327
|
-
)
|
|
2296
|
+
), this.notActiveCallSubscriber.subscribe({
|
|
2297
|
+
onInactive: () => {
|
|
2298
|
+
this.isRegistrationFailed && e();
|
|
2299
|
+
}
|
|
2300
|
+
}), this.disposers.push(() => {
|
|
2301
|
+
this.notActiveCallSubscriber.unsubscribe();
|
|
2302
|
+
});
|
|
2328
2303
|
}
|
|
2329
2304
|
unsubscribe() {
|
|
2330
2305
|
this.disposers.forEach((e) => {
|
|
@@ -2338,12 +2313,12 @@ class bt {
|
|
|
2338
2313
|
this.isRegistrationFailed = !1;
|
|
2339
2314
|
}
|
|
2340
2315
|
}
|
|
2341
|
-
const
|
|
2316
|
+
const yt = 3e3, wt = 15e3, X = {
|
|
2342
2317
|
LIMIT_REACHED: "Limit reached",
|
|
2343
2318
|
FAILED_TO_RECONNECT: "Failed to reconnect"
|
|
2344
|
-
},
|
|
2345
|
-
},
|
|
2346
|
-
class
|
|
2319
|
+
}, Ut = async () => {
|
|
2320
|
+
}, Lt = (n) => !0;
|
|
2321
|
+
class Bt {
|
|
2347
2322
|
events;
|
|
2348
2323
|
connectionManager;
|
|
2349
2324
|
connectionQueueManager;
|
|
@@ -2357,32 +2332,33 @@ class Ft {
|
|
|
2357
2332
|
canRetryOnError;
|
|
2358
2333
|
networkInterfacesSubscriber;
|
|
2359
2334
|
resumeFromSleepModeSubscriber;
|
|
2335
|
+
notActiveCallSubscriber;
|
|
2360
2336
|
constructor({
|
|
2361
2337
|
connectionQueueManager: e,
|
|
2362
2338
|
connectionManager: t,
|
|
2363
2339
|
callManager: s
|
|
2364
|
-
},
|
|
2365
|
-
const
|
|
2366
|
-
this.connectionQueueManager = e, this.connectionManager = t, this.onBeforeRetry =
|
|
2340
|
+
}, i) {
|
|
2341
|
+
const r = i?.onBeforeRetry ?? Ut, a = i?.canRetryOnError ?? Lt;
|
|
2342
|
+
this.connectionQueueManager = e, this.connectionManager = t, this.onBeforeRetry = r, this.canRetryOnError = a, this.networkInterfacesSubscriber = i?.networkInterfacesSubscriber, this.resumeFromSleepModeSubscriber = i?.resumeFromSleepModeSubscriber, this.events = new O(Ce), this.checkTelephonyRequester = new ft({
|
|
2367
2343
|
connectionManager: t,
|
|
2368
|
-
interval:
|
|
2369
|
-
}), this.pingServerIfNotActiveCallRequester = new
|
|
2344
|
+
interval: i?.checkTelephonyRequestInterval ?? wt
|
|
2345
|
+
}), this.pingServerIfNotActiveCallRequester = new bt({
|
|
2370
2346
|
connectionManager: t,
|
|
2371
2347
|
callManager: s
|
|
2372
|
-
}), this.registrationFailedOutOfCallSubscriber = new
|
|
2348
|
+
}), this.registrationFailedOutOfCallSubscriber = new Dt({
|
|
2373
2349
|
connectionManager: t,
|
|
2374
2350
|
callManager: s
|
|
2375
|
-
}), this.attemptsState = new
|
|
2351
|
+
}), this.attemptsState = new Mt({
|
|
2376
2352
|
onStatusChange: this.emitStatusChange
|
|
2377
|
-
}), this.cancelableRequestBeforeRetry = new x(
|
|
2378
|
-
|
|
2379
|
-
);
|
|
2353
|
+
}), this.cancelableRequestBeforeRetry = new x(r), this.delayBetweenAttempts = new ve(
|
|
2354
|
+
i?.timeoutBetweenAttempts ?? yt
|
|
2355
|
+
), this.notActiveCallSubscriber = new Q({ callManager: s });
|
|
2380
2356
|
}
|
|
2381
2357
|
start(e) {
|
|
2382
|
-
c("auto connector start"), this.restartConnectionAttempts(e), this.
|
|
2358
|
+
c("auto connector start"), this.restartConnectionAttempts(e), this.subscribeToNotActiveCall(e);
|
|
2383
2359
|
}
|
|
2384
2360
|
stop() {
|
|
2385
|
-
c("auto connector stop"), this.unsubscribeFromHardwareTriggers(), this.stopConnectionFlow().catch((e) => {
|
|
2361
|
+
c("auto connector stop"), this.unsubscribeFromNotActiveCall(), this.unsubscribeFromHardwareTriggers(), this.stopConnectionFlow().catch((e) => {
|
|
2386
2362
|
c("auto connector stop from stop method: error", e);
|
|
2387
2363
|
});
|
|
2388
2364
|
}
|
|
@@ -2449,14 +2425,14 @@ class Ft {
|
|
|
2449
2425
|
c("executeConnectionAttempt: error does not allow retry", e), this.attemptsState.finishAttempt(), this.events.trigger(_.STOP_ATTEMPTS_BY_ERROR, e);
|
|
2450
2426
|
return;
|
|
2451
2427
|
}
|
|
2452
|
-
if (
|
|
2428
|
+
if (ye(e)) {
|
|
2453
2429
|
c("executeConnectionAttempt: not actual error", e), this.attemptsState.finishAttempt(), this.events.trigger(_.CANCELLED_ATTEMPTS, e);
|
|
2454
2430
|
return;
|
|
2455
2431
|
}
|
|
2456
2432
|
c("executeConnectionAttempt: error", e), this.scheduleReconnect(t);
|
|
2457
2433
|
}
|
|
2458
2434
|
handleLimitReached(e) {
|
|
2459
|
-
this.attemptsState.finishAttempt(), this.events.trigger(_.LIMIT_REACHED_ATTEMPTS, new Error(
|
|
2435
|
+
this.attemptsState.finishAttempt(), this.events.trigger(_.LIMIT_REACHED_ATTEMPTS, new Error(X.LIMIT_REACHED)), this.startCheckTelephony(e);
|
|
2460
2436
|
}
|
|
2461
2437
|
handleSucceededAttempt(e) {
|
|
2462
2438
|
c("handleSucceededAttempt"), this.subscribeToConnectTriggers(e), this.events.trigger(_.SUCCESS);
|
|
@@ -2466,6 +2442,19 @@ class Ft {
|
|
|
2466
2442
|
c("registrationFailedOutOfCallListener callback"), this.restartConnectionAttempts(e);
|
|
2467
2443
|
});
|
|
2468
2444
|
}
|
|
2445
|
+
subscribeToNotActiveCall(e) {
|
|
2446
|
+
this.notActiveCallSubscriber.subscribe({
|
|
2447
|
+
onActive: () => {
|
|
2448
|
+
c("subscribeToNotActiveCall onActive"), this.unsubscribeFromHardwareTriggers();
|
|
2449
|
+
},
|
|
2450
|
+
onInactive: () => {
|
|
2451
|
+
c("subscribeToNotActiveCall onInactive"), this.subscribeToHardwareTriggers(e);
|
|
2452
|
+
}
|
|
2453
|
+
});
|
|
2454
|
+
}
|
|
2455
|
+
unsubscribeFromNotActiveCall() {
|
|
2456
|
+
this.notActiveCallSubscriber.unsubscribe();
|
|
2457
|
+
}
|
|
2469
2458
|
subscribeToHardwareTriggers(e) {
|
|
2470
2459
|
this.unsubscribeFromHardwareTriggers(), c("subscribeToHardwareTriggers"), this.networkInterfacesSubscriber?.subscribe({
|
|
2471
2460
|
onChange: () => {
|
|
@@ -2504,8 +2493,8 @@ class Ft {
|
|
|
2504
2493
|
}
|
|
2505
2494
|
scheduleReconnect(e) {
|
|
2506
2495
|
c("scheduleReconnect"), this.delayBetweenAttempts.request().then(async () => (c("scheduleReconnect: delayBetweenAttempts success"), this.cancelableRequestBeforeRetry.request())).then(async () => (c("scheduleReconnect: onBeforeRetry success"), this.attemptConnection(e))).catch((t) => {
|
|
2507
|
-
const s = t instanceof Error ? t : new Error(
|
|
2508
|
-
this.attemptsState.finishAttempt(),
|
|
2496
|
+
const s = t instanceof Error ? t : new Error(X.FAILED_TO_RECONNECT);
|
|
2497
|
+
this.attemptsState.finishAttempt(), _e(t) || Pe(t) ? this.events.trigger(_.CANCELLED_ATTEMPTS, s) : this.events.trigger(_.FAILED_ALL_ATTEMPTS, s), c("scheduleReconnect: error", t);
|
|
2509
2498
|
});
|
|
2510
2499
|
}
|
|
2511
2500
|
isConnectionUnavailable() {
|
|
@@ -2517,18 +2506,18 @@ class Ft {
|
|
|
2517
2506
|
};
|
|
2518
2507
|
}
|
|
2519
2508
|
var w = /* @__PURE__ */ ((n) => (n.INCOMING_CALL = "incomingCall", n.DECLINED_INCOMING_CALL = "declinedIncomingCall", n.TERMINATED_INCOMING_CALL = "terminatedIncomingCall", n.FAILED_INCOMING_CALL = "failedIncomingCall", n))(w || {});
|
|
2520
|
-
const
|
|
2509
|
+
const Ee = [
|
|
2521
2510
|
"incomingCall",
|
|
2522
2511
|
"declinedIncomingCall",
|
|
2523
2512
|
"terminatedIncomingCall",
|
|
2524
2513
|
"failedIncomingCall"
|
|
2525
|
-
],
|
|
2526
|
-
class
|
|
2514
|
+
], Ft = 486, kt = 487;
|
|
2515
|
+
class $t {
|
|
2527
2516
|
events;
|
|
2528
2517
|
incomingRTCSession;
|
|
2529
2518
|
connectionManager;
|
|
2530
2519
|
constructor(e) {
|
|
2531
|
-
this.connectionManager = e, this.events = new
|
|
2520
|
+
this.connectionManager = e, this.events = new O(Ee), this.start();
|
|
2532
2521
|
}
|
|
2533
2522
|
get remoteCallerData() {
|
|
2534
2523
|
return {
|
|
@@ -2558,19 +2547,19 @@ class qt {
|
|
|
2558
2547
|
return this.removeIncomingSession(), e;
|
|
2559
2548
|
};
|
|
2560
2549
|
async declineToIncomingCall({
|
|
2561
|
-
statusCode: e =
|
|
2550
|
+
statusCode: e = kt
|
|
2562
2551
|
} = {}) {
|
|
2563
2552
|
return new Promise((t, s) => {
|
|
2564
2553
|
try {
|
|
2565
|
-
const
|
|
2566
|
-
this.removeIncomingSession(), this.events.trigger(w.DECLINED_INCOMING_CALL,
|
|
2567
|
-
} catch (
|
|
2568
|
-
s(
|
|
2554
|
+
const i = this.getIncomingRTCSession(), r = this.remoteCallerData;
|
|
2555
|
+
this.removeIncomingSession(), this.events.trigger(w.DECLINED_INCOMING_CALL, r), i.terminate({ status_code: e }), t();
|
|
2556
|
+
} catch (i) {
|
|
2557
|
+
s(i);
|
|
2569
2558
|
}
|
|
2570
2559
|
});
|
|
2571
2560
|
}
|
|
2572
2561
|
async busyIncomingCall() {
|
|
2573
|
-
return this.declineToIncomingCall({ statusCode:
|
|
2562
|
+
return this.declineToIncomingCall({ statusCode: Ft });
|
|
2574
2563
|
}
|
|
2575
2564
|
on(e, t) {
|
|
2576
2565
|
return this.events.on(e, t);
|
|
@@ -2610,12 +2599,12 @@ class qt {
|
|
|
2610
2599
|
delete this.incomingRTCSession;
|
|
2611
2600
|
}
|
|
2612
2601
|
}
|
|
2613
|
-
const
|
|
2602
|
+
const y = 1e3;
|
|
2614
2603
|
var A = /* @__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))(A || {});
|
|
2615
|
-
const
|
|
2604
|
+
const Ae = ["collected"], J = () => "performance" in window ? performance.now() : Date.now(), U = (n) => [...n.keys()].reduce((e, t) => {
|
|
2616
2605
|
const s = n.get(t);
|
|
2617
2606
|
return s === void 0 ? e : { ...e, [s.type]: s };
|
|
2618
|
-
}, {}),
|
|
2607
|
+
}, {}), qt = (n) => {
|
|
2619
2608
|
if (!n)
|
|
2620
2609
|
return {
|
|
2621
2610
|
outboundRtp: void 0,
|
|
@@ -2630,7 +2619,7 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2630
2619
|
mediaSource: e[A.MEDIA_SOURCE],
|
|
2631
2620
|
remoteInboundRtp: e[A.REMOTE_INBOUND_RTP]
|
|
2632
2621
|
};
|
|
2633
|
-
},
|
|
2622
|
+
}, K = (n) => {
|
|
2634
2623
|
if (!n)
|
|
2635
2624
|
return {
|
|
2636
2625
|
outboundRtp: void 0,
|
|
@@ -2645,7 +2634,7 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2645
2634
|
mediaSource: e[A.MEDIA_SOURCE],
|
|
2646
2635
|
remoteInboundRtp: e[A.REMOTE_INBOUND_RTP]
|
|
2647
2636
|
};
|
|
2648
|
-
},
|
|
2637
|
+
}, j = ({
|
|
2649
2638
|
videoReceiversStats: n,
|
|
2650
2639
|
synchronizationSourcesVideo: e
|
|
2651
2640
|
}) => {
|
|
@@ -2661,7 +2650,7 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2661
2650
|
codec: t[A.CODEC],
|
|
2662
2651
|
synchronizationSources: e
|
|
2663
2652
|
};
|
|
2664
|
-
},
|
|
2653
|
+
}, Wt = ({
|
|
2665
2654
|
audioReceiverStats: n,
|
|
2666
2655
|
synchronizationSourcesAudio: e
|
|
2667
2656
|
}) => {
|
|
@@ -2679,7 +2668,7 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2679
2668
|
remoteOutboundRtp: t[A.REMOTE_OUTBOUND_RTP],
|
|
2680
2669
|
synchronizationSources: e
|
|
2681
2670
|
};
|
|
2682
|
-
},
|
|
2671
|
+
}, Ne = (n) => {
|
|
2683
2672
|
if (!n)
|
|
2684
2673
|
return {
|
|
2685
2674
|
candidatePair: void 0,
|
|
@@ -2696,63 +2685,63 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2696
2685
|
remoteCandidate: e[A.REMOTE_CANDIDATE],
|
|
2697
2686
|
transport: e[A.TRANSPORT]
|
|
2698
2687
|
};
|
|
2699
|
-
},
|
|
2688
|
+
}, Vt = ({
|
|
2700
2689
|
audioSenderStats: n,
|
|
2701
2690
|
videoSenderFirstStats: e,
|
|
2702
2691
|
videoSenderSecondStats: t
|
|
2703
2692
|
}) => ({
|
|
2704
|
-
video:
|
|
2705
|
-
secondVideo:
|
|
2706
|
-
audio:
|
|
2707
|
-
additional:
|
|
2693
|
+
video: K(e),
|
|
2694
|
+
secondVideo: K(t),
|
|
2695
|
+
audio: qt(n),
|
|
2696
|
+
additional: Ne(
|
|
2708
2697
|
n ?? e ?? t
|
|
2709
2698
|
)
|
|
2710
|
-
}),
|
|
2699
|
+
}), Ht = ({
|
|
2711
2700
|
audioReceiverStats: n,
|
|
2712
2701
|
videoReceiverFirstStats: e,
|
|
2713
2702
|
videoReceiverSecondStats: t,
|
|
2714
2703
|
synchronizationSources: s
|
|
2715
2704
|
}) => ({
|
|
2716
|
-
video:
|
|
2705
|
+
video: j({
|
|
2717
2706
|
videoReceiversStats: e,
|
|
2718
2707
|
synchronizationSourcesVideo: s.video
|
|
2719
2708
|
}),
|
|
2720
|
-
secondVideo:
|
|
2709
|
+
secondVideo: j({
|
|
2721
2710
|
videoReceiversStats: t,
|
|
2722
2711
|
synchronizationSourcesVideo: s.video
|
|
2723
2712
|
}),
|
|
2724
|
-
audio:
|
|
2713
|
+
audio: Wt({
|
|
2725
2714
|
audioReceiverStats: n,
|
|
2726
2715
|
synchronizationSourcesAudio: s.audio
|
|
2727
2716
|
}),
|
|
2728
|
-
additional:
|
|
2717
|
+
additional: Ne(
|
|
2729
2718
|
n ?? e ?? t
|
|
2730
2719
|
)
|
|
2731
|
-
}),
|
|
2720
|
+
}), xt = ({
|
|
2732
2721
|
audioSenderStats: n,
|
|
2733
2722
|
videoSenderFirstStats: e,
|
|
2734
2723
|
videoSenderSecondStats: t,
|
|
2735
2724
|
audioReceiverStats: s,
|
|
2736
|
-
videoReceiverFirstStats:
|
|
2737
|
-
videoReceiverSecondStats:
|
|
2725
|
+
videoReceiverFirstStats: i,
|
|
2726
|
+
videoReceiverSecondStats: r,
|
|
2738
2727
|
synchronizationSources: a
|
|
2739
2728
|
}) => {
|
|
2740
|
-
const o =
|
|
2729
|
+
const o = Vt({
|
|
2741
2730
|
audioSenderStats: n,
|
|
2742
2731
|
videoSenderFirstStats: e,
|
|
2743
2732
|
videoSenderSecondStats: t
|
|
2744
|
-
}), h =
|
|
2733
|
+
}), h = Ht({
|
|
2745
2734
|
audioReceiverStats: s,
|
|
2746
|
-
videoReceiverFirstStats:
|
|
2747
|
-
videoReceiverSecondStats:
|
|
2735
|
+
videoReceiverFirstStats: i,
|
|
2736
|
+
videoReceiverSecondStats: r,
|
|
2748
2737
|
synchronizationSources: a
|
|
2749
2738
|
});
|
|
2750
2739
|
return {
|
|
2751
2740
|
outbound: o,
|
|
2752
2741
|
inbound: h
|
|
2753
2742
|
};
|
|
2754
|
-
},
|
|
2755
|
-
const e = "audio", t = "video", s = n.getSenders(),
|
|
2743
|
+
}, Gt = async (n) => {
|
|
2744
|
+
const e = "audio", t = "video", s = n.getSenders(), i = s.find((l) => l.track?.kind === e), r = s.filter((l) => l.track?.kind === t), a = n.getReceivers(), o = a.find((l) => l.track.kind === e), h = a.filter((l) => l.track.kind === t), d = {
|
|
2756
2745
|
trackIdentifier: o?.track.id,
|
|
2757
2746
|
item: o?.getSynchronizationSources()[0]
|
|
2758
2747
|
}, T = {
|
|
@@ -2763,17 +2752,17 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2763
2752
|
video: T
|
|
2764
2753
|
};
|
|
2765
2754
|
return Promise.all([
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2755
|
+
i?.getStats() ?? Promise.resolve(void 0),
|
|
2756
|
+
r[0]?.getStats() ?? Promise.resolve(void 0),
|
|
2757
|
+
r[1]?.getStats() ?? Promise.resolve(void 0),
|
|
2769
2758
|
o?.getStats() ?? Promise.resolve(void 0),
|
|
2770
2759
|
h[0]?.getStats() ?? Promise.resolve(void 0),
|
|
2771
2760
|
h[1]?.getStats() ?? Promise.resolve(void 0)
|
|
2772
2761
|
]).then((l) => {
|
|
2773
2762
|
const [
|
|
2774
2763
|
E,
|
|
2775
|
-
|
|
2776
|
-
|
|
2764
|
+
m,
|
|
2765
|
+
R,
|
|
2777
2766
|
M,
|
|
2778
2767
|
F,
|
|
2779
2768
|
k
|
|
@@ -2781,29 +2770,29 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2781
2770
|
return {
|
|
2782
2771
|
synchronizationSources: S,
|
|
2783
2772
|
audioSenderStats: E,
|
|
2784
|
-
videoSenderFirstStats:
|
|
2785
|
-
videoSenderSecondStats:
|
|
2773
|
+
videoSenderFirstStats: m,
|
|
2774
|
+
videoSenderSecondStats: R,
|
|
2786
2775
|
audioReceiverStats: M,
|
|
2787
2776
|
videoReceiverFirstStats: F,
|
|
2788
2777
|
videoReceiverSecondStats: k
|
|
2789
2778
|
};
|
|
2790
2779
|
});
|
|
2791
|
-
},
|
|
2780
|
+
}, Qt = (n) => {
|
|
2792
2781
|
c(String(n));
|
|
2793
2782
|
};
|
|
2794
|
-
class
|
|
2783
|
+
class Yt {
|
|
2795
2784
|
events;
|
|
2796
2785
|
setTimeoutRequest;
|
|
2797
|
-
requesterAllStatistics = new x(
|
|
2786
|
+
requesterAllStatistics = new x(Gt);
|
|
2798
2787
|
constructor() {
|
|
2799
|
-
this.events = new
|
|
2788
|
+
this.events = new O(Ae), this.setTimeoutRequest = new ee();
|
|
2800
2789
|
}
|
|
2801
2790
|
get requested() {
|
|
2802
2791
|
return this.setTimeoutRequest.requested;
|
|
2803
2792
|
}
|
|
2804
2793
|
start(e, {
|
|
2805
|
-
interval: t =
|
|
2806
|
-
onError: s =
|
|
2794
|
+
interval: t = y,
|
|
2795
|
+
onError: s = Qt
|
|
2807
2796
|
} = {}) {
|
|
2808
2797
|
this.stop(), this.setTimeoutRequest.request(() => {
|
|
2809
2798
|
this.collectStatistics(e, {
|
|
@@ -2832,21 +2821,21 @@ class zt {
|
|
|
2832
2821
|
collectStatistics = (e, {
|
|
2833
2822
|
onError: t
|
|
2834
2823
|
}) => {
|
|
2835
|
-
const s =
|
|
2836
|
-
this.requesterAllStatistics.request(e).then((
|
|
2837
|
-
this.events.trigger("collected",
|
|
2838
|
-
const a =
|
|
2839
|
-
let o =
|
|
2840
|
-
a > 48 ? o =
|
|
2824
|
+
const s = J();
|
|
2825
|
+
this.requesterAllStatistics.request(e).then((i) => {
|
|
2826
|
+
this.events.trigger("collected", xt(i));
|
|
2827
|
+
const a = J() - s;
|
|
2828
|
+
let o = y;
|
|
2829
|
+
a > 48 ? o = y * 4 : a > 32 ? o = y * 3 : a > 16 && (o = y * 2), this.start(e, {
|
|
2841
2830
|
onError: t,
|
|
2842
2831
|
interval: o
|
|
2843
2832
|
});
|
|
2844
|
-
}).catch((
|
|
2845
|
-
t && t(
|
|
2833
|
+
}).catch((i) => {
|
|
2834
|
+
t && t(i);
|
|
2846
2835
|
});
|
|
2847
2836
|
};
|
|
2848
2837
|
}
|
|
2849
|
-
class
|
|
2838
|
+
class zt {
|
|
2850
2839
|
availableIncomingBitrate;
|
|
2851
2840
|
statsPeerConnection;
|
|
2852
2841
|
callManager;
|
|
@@ -2856,7 +2845,7 @@ class Xt {
|
|
|
2856
2845
|
callManager: e,
|
|
2857
2846
|
apiManager: t
|
|
2858
2847
|
}) {
|
|
2859
|
-
this.callManager = e, this.apiManager = t, this.statsPeerConnection = new
|
|
2848
|
+
this.callManager = e, this.apiManager = t, this.statsPeerConnection = new Yt(), this.subscribe();
|
|
2860
2849
|
}
|
|
2861
2850
|
get events() {
|
|
2862
2851
|
return this.statsPeerConnection.events;
|
|
@@ -2898,141 +2887,33 @@ class Xt {
|
|
|
2898
2887
|
});
|
|
2899
2888
|
}
|
|
2900
2889
|
}
|
|
2901
|
-
const
|
|
2902
|
-
const e = RTCRtpSender.getCapabilities(n), t = RTCRtpReceiver.getCapabilities(n), s = e === null ? [] : e.codecs,
|
|
2903
|
-
return
|
|
2904
|
-
},
|
|
2905
|
-
const
|
|
2890
|
+
const Xt = (n, e) => n.filter((s) => e.some((i) => i.clockRate === s.clockRate && i.mimeType === s.mimeType && i.channels === s.channels && i.sdpFmtpLine === s.sdpFmtpLine)), Jt = (n) => {
|
|
2891
|
+
const e = RTCRtpSender.getCapabilities(n), t = RTCRtpReceiver.getCapabilities(n), s = e === null ? [] : e.codecs, i = t === null ? [] : t.codecs;
|
|
2892
|
+
return Xt(s, i);
|
|
2893
|
+
}, Kt = (n, e) => e === void 0 || e.length === 0 ? n : n.sort((t, s) => {
|
|
2894
|
+
const i = e.indexOf(t.mimeType), r = e.indexOf(s.mimeType), a = i === -1 ? Number.MAX_VALUE : i, o = r === -1 ? Number.MAX_VALUE : r;
|
|
2906
2895
|
return a - o;
|
|
2907
|
-
}),
|
|
2896
|
+
}), jt = (n, e) => e === void 0 || e.length === 0 ? n : n.filter((t) => !e.includes(t.mimeType)), Zt = (n, {
|
|
2908
2897
|
preferredMimeTypesVideoCodecs: e,
|
|
2909
2898
|
excludeMimeTypesVideoCodecs: t
|
|
2910
2899
|
}) => {
|
|
2911
2900
|
try {
|
|
2912
2901
|
if (typeof n.setCodecPreferences == "function" && n.sender.track?.kind === "video" && (e !== void 0 && e.length > 0 || t !== void 0 && t.length > 0)) {
|
|
2913
|
-
const s =
|
|
2914
|
-
n.setCodecPreferences(
|
|
2902
|
+
const s = Jt("video"), i = jt(s, t), r = Kt(i, e);
|
|
2903
|
+
n.setCodecPreferences(r);
|
|
2915
2904
|
}
|
|
2916
2905
|
} catch (s) {
|
|
2917
2906
|
c("setCodecPreferences error", s);
|
|
2918
2907
|
}
|
|
2919
|
-
};
|
|
2920
|
-
class
|
|
2921
|
-
/**
|
|
2922
|
-
* Хранилище основных transceiver'ов
|
|
2923
|
-
*/
|
|
2924
|
-
transceivers = {};
|
|
2925
|
-
callManager;
|
|
2926
|
-
apiManager;
|
|
2927
|
-
constructor({
|
|
2928
|
-
callManager: e,
|
|
2929
|
-
apiManager: t
|
|
2930
|
-
}) {
|
|
2931
|
-
this.callManager = e, this.apiManager = t, this.subscribe();
|
|
2932
|
-
}
|
|
2933
|
-
/**
|
|
2934
|
-
* Сохраняет transceiver в соответствующем хранилище в зависимости от типа трека и mid
|
|
2935
|
-
*/
|
|
2936
|
-
storeTransceiver(e, t) {
|
|
2937
|
-
const { kind: s } = t;
|
|
2938
|
-
if (s === "audio")
|
|
2939
|
-
this.transceivers.mainAudio ??= e;
|
|
2940
|
-
else {
|
|
2941
|
-
const { mid: r } = e;
|
|
2942
|
-
r === "2" ? this.transceivers.presentationVideo ??= e : this.transceivers.mainVideo ??= e;
|
|
2943
|
-
}
|
|
2944
|
-
}
|
|
2945
|
-
/**
|
|
2946
|
-
* Возвращает все сохраненные transceiver'ы
|
|
2947
|
-
*/
|
|
2948
|
-
getTransceivers() {
|
|
2949
|
-
return { ...this.transceivers };
|
|
2950
|
-
}
|
|
2951
|
-
/**
|
|
2952
|
-
* Возвращает основной аудио transceiver
|
|
2953
|
-
*/
|
|
2954
|
-
getMainAudioTransceiver() {
|
|
2955
|
-
return this.transceivers.mainAudio;
|
|
2956
|
-
}
|
|
2957
|
-
/**
|
|
2958
|
-
* Возвращает основной видео transceiver
|
|
2959
|
-
*/
|
|
2960
|
-
getMainVideoTransceiver() {
|
|
2961
|
-
return this.transceivers.mainVideo;
|
|
2962
|
-
}
|
|
2963
|
-
/**
|
|
2964
|
-
* Возвращает презентационный видео transceiver
|
|
2965
|
-
*/
|
|
2966
|
-
getPresentationVideoTransceiver() {
|
|
2967
|
-
return this.transceivers.presentationVideo;
|
|
2968
|
-
}
|
|
2969
|
-
/**
|
|
2970
|
-
* Проверяет, есть ли сохраненный transceiver для указанного типа
|
|
2971
|
-
*/
|
|
2972
|
-
hasTransceiver(e) {
|
|
2973
|
-
return this.transceivers[e] !== void 0;
|
|
2974
|
-
}
|
|
2975
|
-
/**
|
|
2976
|
-
* Очищает все сохраненные transceiver'ы
|
|
2977
|
-
*/
|
|
2978
|
-
clear() {
|
|
2979
|
-
this.transceivers.mainVideo = void 0, this.transceivers.mainAudio = void 0, this.transceivers.presentationVideo = void 0;
|
|
2980
|
-
}
|
|
2981
|
-
/**
|
|
2982
|
-
* Возвращает количество сохраненных transceiver'ов
|
|
2983
|
-
*/
|
|
2984
|
-
getCount() {
|
|
2985
|
-
let e = 0;
|
|
2986
|
-
return this.transceivers.mainAudio && (e += 1), this.transceivers.mainVideo && (e += 1), this.transceivers.presentationVideo && (e += 1), e;
|
|
2987
|
-
}
|
|
2988
|
-
/**
|
|
2989
|
-
* Проверяет, пустое ли хранилище
|
|
2990
|
-
*/
|
|
2991
|
-
isEmpty() {
|
|
2992
|
-
return this.getCount() === 0;
|
|
2993
|
-
}
|
|
2994
|
-
/**
|
|
2995
|
-
* Обрабатывает событие restart от ApiManager
|
|
2996
|
-
*/
|
|
2997
|
-
handleRestart = (e) => {
|
|
2998
|
-
this.updateTransceivers(e).catch((t) => {
|
|
2999
|
-
c("Failed to update transceivers", t);
|
|
3000
|
-
}).finally(() => {
|
|
3001
|
-
this.callManager.restartIce().catch((t) => {
|
|
3002
|
-
c("Failed to restart ICE", t);
|
|
3003
|
-
});
|
|
3004
|
-
});
|
|
3005
|
-
};
|
|
3006
|
-
/**
|
|
3007
|
-
* Обновляет transceiver'ы в соответствии с данными restart
|
|
3008
|
-
*/
|
|
3009
|
-
updateTransceivers = async (e) => {
|
|
3010
|
-
const { videoTrackCount: t } = e;
|
|
3011
|
-
t === 2 && (this.getTransceivers().presentationVideo !== void 0 || await this.callManager.addTransceiver("video", {
|
|
3012
|
-
direction: "recvonly"
|
|
3013
|
-
}).catch((i) => {
|
|
3014
|
-
c("Failed to add presentation video transceiver", i);
|
|
3015
|
-
}));
|
|
3016
|
-
};
|
|
3017
|
-
subscribe() {
|
|
3018
|
-
this.callManager.on("peerconnection:ontrack", this.handleTrack), this.callManager.on("failed", this.handleEnded), this.callManager.on("ended", this.handleEnded), this.apiManager.on("restart", this.handleRestart);
|
|
3019
|
-
}
|
|
3020
|
-
handleTrack = (e) => {
|
|
3021
|
-
this.storeTransceiver(e.transceiver, e.track);
|
|
3022
|
-
};
|
|
3023
|
-
handleEnded = () => {
|
|
3024
|
-
this.clear();
|
|
3025
|
-
};
|
|
3026
|
-
}
|
|
3027
|
-
const nn = (n) => [...n.keys()].map((e) => n.get(e)), sn = (n, e) => nn(n).find((t) => t?.type === e), rn = async (n) => n.getStats().then((e) => sn(e, "codec")?.mimeType);
|
|
3028
|
-
class an {
|
|
2908
|
+
}, en = (n) => [...n.keys()].map((e) => n.get(e)), tn = (n, e) => en(n).find((t) => t?.type === e), nn = async (n) => n.getStats().then((e) => tn(e, "codec")?.mimeType);
|
|
2909
|
+
class sn {
|
|
3029
2910
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
3030
2911
|
async getCodecFromSender(e) {
|
|
3031
|
-
return await
|
|
2912
|
+
return await nn(e) ?? "";
|
|
3032
2913
|
}
|
|
3033
2914
|
}
|
|
3034
|
-
class
|
|
3035
|
-
stackPromises =
|
|
2915
|
+
class rn {
|
|
2916
|
+
stackPromises = ne({
|
|
3036
2917
|
noRunIsNotActual: !0
|
|
3037
2918
|
});
|
|
3038
2919
|
/**
|
|
@@ -3056,30 +2937,30 @@ class on {
|
|
|
3056
2937
|
});
|
|
3057
2938
|
}
|
|
3058
2939
|
}
|
|
3059
|
-
class
|
|
2940
|
+
class an {
|
|
3060
2941
|
taskQueue;
|
|
3061
2942
|
onSetParameters;
|
|
3062
2943
|
constructor(e) {
|
|
3063
|
-
this.onSetParameters = e, this.taskQueue = new
|
|
2944
|
+
this.onSetParameters = e, this.taskQueue = new rn();
|
|
3064
2945
|
}
|
|
3065
2946
|
async setEncodingsToSender(e, t) {
|
|
3066
|
-
return this.taskQueue.add(async () =>
|
|
2947
|
+
return this.taskQueue.add(async () => de(e, t, this.onSetParameters));
|
|
3067
2948
|
}
|
|
3068
2949
|
stop() {
|
|
3069
2950
|
this.taskQueue.stop();
|
|
3070
2951
|
}
|
|
3071
2952
|
}
|
|
3072
|
-
const Re = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()),
|
|
3073
|
-
const t =
|
|
3074
|
-
return
|
|
3075
|
-
}, $ = 1,
|
|
2953
|
+
const Re = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), on = 1e6, f = (n) => n * on, Ie = f(0.06), me = f(4), cn = (n) => n <= 64 ? Ie : n <= 128 ? f(0.12) : n <= 256 ? f(0.25) : n <= 384 ? f(0.32) : n <= 426 ? f(0.38) : n <= 640 ? f(0.5) : n <= 848 ? f(0.7) : n <= 1280 ? f(1) : n <= 1920 ? f(2) : me, hn = "av1", dn = (n) => Re(n, hn), ln = 0.6, Y = (n, e) => dn(e) ? n * ln : n, un = (n) => Y(Ie, n), gn = (n) => Y(me, n), Z = (n, e) => {
|
|
2954
|
+
const t = cn(n);
|
|
2955
|
+
return Y(t, e);
|
|
2956
|
+
}, $ = 1, Tn = ({
|
|
3076
2957
|
videoTrack: n,
|
|
3077
2958
|
targetSize: e
|
|
3078
2959
|
}) => {
|
|
3079
|
-
const t = n.getSettings(), s = t.width,
|
|
3080
|
-
return Math.max(
|
|
2960
|
+
const t = n.getSettings(), s = t.width, i = t.height, r = s === void 0 ? $ : s / e.width, a = i === void 0 ? $ : i / e.height;
|
|
2961
|
+
return Math.max(r, a, $);
|
|
3081
2962
|
};
|
|
3082
|
-
class
|
|
2963
|
+
class Sn {
|
|
3083
2964
|
ignoreForCodec;
|
|
3084
2965
|
senderFinder;
|
|
3085
2966
|
codecProvider;
|
|
@@ -3098,8 +2979,8 @@ class En {
|
|
|
3098
2979
|
senderFinder: e,
|
|
3099
2980
|
codecProvider: t,
|
|
3100
2981
|
parametersSetter: s
|
|
3101
|
-
},
|
|
3102
|
-
this.senderFinder = e, this.codecProvider = t, this.parametersSetter = s, this.ignoreForCodec =
|
|
2982
|
+
}, i) {
|
|
2983
|
+
this.senderFinder = e, this.codecProvider = t, this.parametersSetter = s, this.ignoreForCodec = i.ignoreForCodec;
|
|
3103
2984
|
}
|
|
3104
2985
|
/**
|
|
3105
2986
|
* Выполняет балансировку на основе заголовков от сервера
|
|
@@ -3108,21 +2989,21 @@ class En {
|
|
|
3108
2989
|
* @returns Promise с результатом балансировки
|
|
3109
2990
|
*/
|
|
3110
2991
|
async balance(e, t) {
|
|
3111
|
-
const s = e.getSenders(),
|
|
3112
|
-
if (!
|
|
3113
|
-
return { ...this.resultNoChanged, sender:
|
|
3114
|
-
const
|
|
3115
|
-
if (Re(
|
|
3116
|
-
return { ...this.resultNoChanged, sender:
|
|
2992
|
+
const s = e.getSenders(), i = this.senderFinder.findVideoSender(s);
|
|
2993
|
+
if (!i?.track)
|
|
2994
|
+
return { ...this.resultNoChanged, sender: i };
|
|
2995
|
+
const r = await this.codecProvider.getCodecFromSender(i);
|
|
2996
|
+
if (Re(r, this.ignoreForCodec))
|
|
2997
|
+
return { ...this.resultNoChanged, sender: i };
|
|
3117
2998
|
const { mainCam: a, resolutionMainCam: o } = t ?? {};
|
|
3118
2999
|
return this.processSender(
|
|
3119
3000
|
{ mainCam: a, resolutionMainCam: o },
|
|
3120
3001
|
{
|
|
3121
|
-
sender:
|
|
3122
|
-
codec:
|
|
3123
|
-
videoTrack:
|
|
3002
|
+
sender: i,
|
|
3003
|
+
codec: r,
|
|
3004
|
+
videoTrack: i.track
|
|
3124
3005
|
}
|
|
3125
|
-
).then((h) => ({ ...h, sender:
|
|
3006
|
+
).then((h) => ({ ...h, sender: i }));
|
|
3126
3007
|
}
|
|
3127
3008
|
/**
|
|
3128
3009
|
* Обрабатывает отправитель в зависимости от команды управления
|
|
@@ -3130,14 +3011,14 @@ class En {
|
|
|
3130
3011
|
* @returns Promise с результатом обработки
|
|
3131
3012
|
*/
|
|
3132
3013
|
async processSender(e, t) {
|
|
3133
|
-
const { mainCam: s, resolutionMainCam:
|
|
3014
|
+
const { mainCam: s, resolutionMainCam: i } = e;
|
|
3134
3015
|
switch (s) {
|
|
3135
3016
|
case v.PAUSE_MAIN_CAM:
|
|
3136
3017
|
return this.downgradeResolutionSender(t);
|
|
3137
3018
|
case v.RESUME_MAIN_CAM:
|
|
3138
3019
|
return this.setBitrateByTrackResolution(t);
|
|
3139
3020
|
case v.MAX_MAIN_CAM_RESOLUTION:
|
|
3140
|
-
return
|
|
3021
|
+
return i !== void 0 ? this.setResolutionSender(i, t) : this.setBitrateByTrackResolution(t);
|
|
3141
3022
|
case v.ADMIN_STOP_MAIN_CAM:
|
|
3142
3023
|
case v.ADMIN_START_MAIN_CAM:
|
|
3143
3024
|
case void 0:
|
|
@@ -3152,11 +3033,11 @@ class En {
|
|
|
3152
3033
|
* @returns Promise с результатом
|
|
3153
3034
|
*/
|
|
3154
3035
|
async downgradeResolutionSender(e) {
|
|
3155
|
-
const { sender: t, codec: s } = e,
|
|
3036
|
+
const { sender: t, codec: s } = e, i = {
|
|
3156
3037
|
scaleResolutionDownBy: 200,
|
|
3157
|
-
maxBitrate:
|
|
3038
|
+
maxBitrate: un(s)
|
|
3158
3039
|
};
|
|
3159
|
-
return this.parametersSetter.setEncodingsToSender(t,
|
|
3040
|
+
return this.parametersSetter.setEncodingsToSender(t, i);
|
|
3160
3041
|
}
|
|
3161
3042
|
/**
|
|
3162
3043
|
* Устанавливает битрейт на основе разрешения трека
|
|
@@ -3164,7 +3045,7 @@ class En {
|
|
|
3164
3045
|
* @returns Promise с результатом
|
|
3165
3046
|
*/
|
|
3166
3047
|
async setBitrateByTrackResolution(e) {
|
|
3167
|
-
const { sender: t, videoTrack: s, codec:
|
|
3048
|
+
const { sender: t, videoTrack: s, codec: i } = e, a = s.getSettings().width, o = a === void 0 ? gn(i) : Z(a, i);
|
|
3168
3049
|
return this.parametersSetter.setEncodingsToSender(t, {
|
|
3169
3050
|
scaleResolutionDownBy: 1,
|
|
3170
3051
|
maxBitrate: o
|
|
@@ -3177,27 +3058,27 @@ class En {
|
|
|
3177
3058
|
* @returns Promise с результатом
|
|
3178
3059
|
*/
|
|
3179
3060
|
async setResolutionSender(e, t) {
|
|
3180
|
-
const [s,
|
|
3061
|
+
const [s, i] = e.split("x"), { sender: r, videoTrack: a, codec: o } = t, h = {
|
|
3181
3062
|
width: Number(s),
|
|
3182
|
-
height: Number(
|
|
3183
|
-
}, d =
|
|
3063
|
+
height: Number(i)
|
|
3064
|
+
}, d = Tn({
|
|
3184
3065
|
videoTrack: a,
|
|
3185
3066
|
targetSize: h
|
|
3186
|
-
}), T =
|
|
3067
|
+
}), T = Z(h.width, o), S = {
|
|
3187
3068
|
scaleResolutionDownBy: d,
|
|
3188
3069
|
maxBitrate: T
|
|
3189
3070
|
};
|
|
3190
|
-
return this.parametersSetter.setEncodingsToSender(
|
|
3071
|
+
return this.parametersSetter.setEncodingsToSender(r, S);
|
|
3191
3072
|
}
|
|
3192
3073
|
}
|
|
3193
|
-
const
|
|
3194
|
-
class
|
|
3074
|
+
const Cn = (n) => n.find((e) => e.track?.kind === "video");
|
|
3075
|
+
class En {
|
|
3195
3076
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
3196
3077
|
findVideoSender(e) {
|
|
3197
|
-
return
|
|
3078
|
+
return Cn(e);
|
|
3198
3079
|
}
|
|
3199
3080
|
}
|
|
3200
|
-
class
|
|
3081
|
+
class An {
|
|
3201
3082
|
currentSender;
|
|
3202
3083
|
originalReplaceTrack;
|
|
3203
3084
|
lastWidth;
|
|
@@ -3210,7 +3091,7 @@ class Nn {
|
|
|
3210
3091
|
pollIntervalMs: e = 1e3,
|
|
3211
3092
|
maxPollIntervalMs: t
|
|
3212
3093
|
}) {
|
|
3213
|
-
this.pollIntervalMs = e, this.maxPollIntervalMs = t ?? e * 16, this.currentPollIntervalMs = this.pollIntervalMs, this.setTimeoutRequest = new
|
|
3094
|
+
this.pollIntervalMs = e, this.maxPollIntervalMs = t ?? e * 16, this.currentPollIntervalMs = this.pollIntervalMs, this.setTimeoutRequest = new ee();
|
|
3214
3095
|
}
|
|
3215
3096
|
/**
|
|
3216
3097
|
* Проверяет актуальный video-sender и (при необходимости) перенастраивает наблюдение.
|
|
@@ -3229,8 +3110,8 @@ class Nn {
|
|
|
3229
3110
|
attachSender(e, t) {
|
|
3230
3111
|
this.currentSender = e;
|
|
3231
3112
|
const s = e.replaceTrack.bind(e);
|
|
3232
|
-
this.originalReplaceTrack = s, e.replaceTrack = async (
|
|
3233
|
-
await s(
|
|
3113
|
+
this.originalReplaceTrack = s, e.replaceTrack = async (i) => {
|
|
3114
|
+
await s(i), this.attachTrack(t, i ?? void 0), t();
|
|
3234
3115
|
}, this.attachTrack(t, e.track);
|
|
3235
3116
|
}
|
|
3236
3117
|
detachSender() {
|
|
@@ -3239,8 +3120,8 @@ class Nn {
|
|
|
3239
3120
|
attachTrack(e, t) {
|
|
3240
3121
|
if (this.detachTrack(), !t)
|
|
3241
3122
|
return;
|
|
3242
|
-
const { width: s, height:
|
|
3243
|
-
this.lastWidth = s, this.lastHeight =
|
|
3123
|
+
const { width: s, height: i } = t.getSettings();
|
|
3124
|
+
this.lastWidth = s, this.lastHeight = i, this.currentPollIntervalMs = this.pollIntervalMs, this.schedulePoll(t, e);
|
|
3244
3125
|
}
|
|
3245
3126
|
/**
|
|
3246
3127
|
* Периодически опрашивает track с экспоненциальной адаптацией частоты.
|
|
@@ -3249,8 +3130,8 @@ class Nn {
|
|
|
3249
3130
|
*/
|
|
3250
3131
|
schedulePoll(e, t) {
|
|
3251
3132
|
const s = () => {
|
|
3252
|
-
const { width:
|
|
3253
|
-
|
|
3133
|
+
const { width: i, height: r } = e.getSettings();
|
|
3134
|
+
i !== this.lastWidth || r !== this.lastHeight ? (this.lastWidth = i, this.lastHeight = r, this.currentPollIntervalMs = this.pollIntervalMs, t()) : this.currentPollIntervalMs = Math.min(
|
|
3254
3135
|
this.currentPollIntervalMs * 2,
|
|
3255
3136
|
this.maxPollIntervalMs
|
|
3256
3137
|
), this.setTimeoutRequest.request(s, this.currentPollIntervalMs);
|
|
@@ -3261,7 +3142,7 @@ class Nn {
|
|
|
3261
3142
|
this.setTimeoutRequest.cancelRequest(), this.lastWidth = void 0, this.lastHeight = void 0;
|
|
3262
3143
|
}
|
|
3263
3144
|
}
|
|
3264
|
-
class
|
|
3145
|
+
class Nn {
|
|
3265
3146
|
apiManager;
|
|
3266
3147
|
currentHandler;
|
|
3267
3148
|
constructor(e) {
|
|
@@ -3281,7 +3162,7 @@ class mn {
|
|
|
3281
3162
|
this.currentHandler && (this.apiManager.off("main-cam-control", this.currentHandler), this.currentHandler = void 0);
|
|
3282
3163
|
}
|
|
3283
3164
|
}
|
|
3284
|
-
class
|
|
3165
|
+
class Rn {
|
|
3285
3166
|
eventHandler;
|
|
3286
3167
|
senderBalancer;
|
|
3287
3168
|
parametersSetterWithQueue;
|
|
@@ -3290,19 +3171,19 @@ class In {
|
|
|
3290
3171
|
trackMonitor;
|
|
3291
3172
|
constructor(e, t, {
|
|
3292
3173
|
ignoreForCodec: s,
|
|
3293
|
-
onSetParameters:
|
|
3294
|
-
pollIntervalMs:
|
|
3174
|
+
onSetParameters: i,
|
|
3175
|
+
pollIntervalMs: r
|
|
3295
3176
|
} = {}) {
|
|
3296
|
-
this.getConnection = t, this.eventHandler = new
|
|
3177
|
+
this.getConnection = t, this.eventHandler = new Nn(e), this.parametersSetterWithQueue = new an(i), this.senderBalancer = new Sn(
|
|
3297
3178
|
{
|
|
3298
|
-
senderFinder: new
|
|
3299
|
-
codecProvider: new
|
|
3179
|
+
senderFinder: new En(),
|
|
3180
|
+
codecProvider: new sn(),
|
|
3300
3181
|
parametersSetter: this.parametersSetterWithQueue
|
|
3301
3182
|
},
|
|
3302
3183
|
{
|
|
3303
3184
|
ignoreForCodec: s
|
|
3304
3185
|
}
|
|
3305
|
-
), this.trackMonitor = new
|
|
3186
|
+
), this.trackMonitor = new An({ pollIntervalMs: r });
|
|
3306
3187
|
}
|
|
3307
3188
|
/**
|
|
3308
3189
|
* Подписывается на события управления главной камерой
|
|
@@ -3347,13 +3228,13 @@ class In {
|
|
|
3347
3228
|
});
|
|
3348
3229
|
};
|
|
3349
3230
|
}
|
|
3350
|
-
const
|
|
3231
|
+
const pe = [
|
|
3351
3232
|
"balancing-scheduled",
|
|
3352
3233
|
"balancing-started",
|
|
3353
3234
|
"balancing-stopped",
|
|
3354
3235
|
"parameters-updated"
|
|
3355
3236
|
];
|
|
3356
|
-
class
|
|
3237
|
+
class In {
|
|
3357
3238
|
isBalancingActive = !1;
|
|
3358
3239
|
events;
|
|
3359
3240
|
callManager;
|
|
@@ -3361,13 +3242,13 @@ class pn {
|
|
|
3361
3242
|
videoSendingBalancer;
|
|
3362
3243
|
startBalancingTimer;
|
|
3363
3244
|
constructor(e, t, s = {}) {
|
|
3364
|
-
this.events = new
|
|
3245
|
+
this.events = new O(pe), this.callManager = e, this.balancingStartDelay = s.balancingStartDelay ?? 1e4, this.videoSendingBalancer = new Rn(
|
|
3365
3246
|
t,
|
|
3366
3247
|
() => e.connection,
|
|
3367
3248
|
{
|
|
3368
3249
|
...s,
|
|
3369
|
-
onSetParameters: (
|
|
3370
|
-
this.events.trigger("parameters-updated",
|
|
3250
|
+
onSetParameters: (i) => {
|
|
3251
|
+
this.events.trigger("parameters-updated", i), s.onSetParameters?.(i);
|
|
3371
3252
|
}
|
|
3372
3253
|
}
|
|
3373
3254
|
), this.subscribe();
|
|
@@ -3431,17 +3312,18 @@ class pn {
|
|
|
3431
3312
|
this.startBalancingTimer && (clearTimeout(this.startBalancingTimer), this.startBalancingTimer = void 0);
|
|
3432
3313
|
}
|
|
3433
3314
|
}
|
|
3434
|
-
const
|
|
3315
|
+
const mn = 1e6, pn = Ce.map((n) => `auto-connect:${n}`), _n = ge.map((n) => `connection:${n}`), Mn = ae.map((n) => `call:${n}`), fn = se.map((n) => `api:${n}`), vn = Ee.map((n) => `incoming-call:${n}`), Pn = le.map((n) => `presentation:${n}`), On = Ae.map((n) => `stats:${n}`), bn = pe.map((n) => `video-balancer:${n}`), Dn = ["disconnected-from-out-of-call"], yn = [
|
|
3316
|
+
...pn,
|
|
3317
|
+
..._n,
|
|
3435
3318
|
...Mn,
|
|
3436
3319
|
...fn,
|
|
3437
3320
|
...vn,
|
|
3438
3321
|
...Pn,
|
|
3439
3322
|
...On,
|
|
3440
|
-
...
|
|
3441
|
-
...Dn
|
|
3442
|
-
...bn
|
|
3323
|
+
...bn,
|
|
3324
|
+
...Dn
|
|
3443
3325
|
];
|
|
3444
|
-
class
|
|
3326
|
+
class Gn {
|
|
3445
3327
|
events;
|
|
3446
3328
|
connectionManager;
|
|
3447
3329
|
connectionQueueManager;
|
|
@@ -3452,40 +3334,36 @@ class Qn {
|
|
|
3452
3334
|
presentationManager;
|
|
3453
3335
|
statsManager;
|
|
3454
3336
|
videoSendingBalancerManager;
|
|
3455
|
-
transceiverManager;
|
|
3456
3337
|
preferredMimeTypesVideoCodecs;
|
|
3457
3338
|
excludeMimeTypesVideoCodecs;
|
|
3458
3339
|
constructor({ JsSIP: e }, {
|
|
3459
3340
|
preferredMimeTypesVideoCodecs: t,
|
|
3460
3341
|
excludeMimeTypesVideoCodecs: s,
|
|
3461
|
-
videoBalancerOptions:
|
|
3462
|
-
autoConnectorOptions:
|
|
3342
|
+
videoBalancerOptions: i,
|
|
3343
|
+
autoConnectorOptions: r
|
|
3463
3344
|
} = {}) {
|
|
3464
|
-
this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events = new
|
|
3345
|
+
this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events = new O(yn), this.connectionManager = new mt({ JsSIP: e }), this.connectionQueueManager = new pt({
|
|
3465
3346
|
connectionManager: this.connectionManager
|
|
3466
|
-
}), this.callManager = new
|
|
3347
|
+
}), this.callManager = new ze(), this.apiManager = new ke({
|
|
3467
3348
|
connectionManager: this.connectionManager,
|
|
3468
3349
|
callManager: this.callManager
|
|
3469
|
-
}), this.incomingCallManager = new
|
|
3350
|
+
}), this.incomingCallManager = new $t(this.connectionManager), this.presentationManager = new ht({
|
|
3470
3351
|
callManager: this.callManager,
|
|
3471
|
-
maxBitrate:
|
|
3472
|
-
}), this.statsManager = new
|
|
3352
|
+
maxBitrate: mn
|
|
3353
|
+
}), this.statsManager = new zt({
|
|
3473
3354
|
callManager: this.callManager,
|
|
3474
3355
|
apiManager: this.apiManager
|
|
3475
|
-
}), this.autoConnectorManager = new
|
|
3356
|
+
}), this.autoConnectorManager = new Bt(
|
|
3476
3357
|
{
|
|
3477
3358
|
connectionQueueManager: this.connectionQueueManager,
|
|
3478
3359
|
connectionManager: this.connectionManager,
|
|
3479
3360
|
callManager: this.callManager
|
|
3480
3361
|
},
|
|
3481
|
-
|
|
3482
|
-
), this.
|
|
3483
|
-
callManager: this.callManager,
|
|
3484
|
-
apiManager: this.apiManager
|
|
3485
|
-
}), this.videoSendingBalancerManager = new pn(
|
|
3362
|
+
r
|
|
3363
|
+
), this.videoSendingBalancerManager = new In(
|
|
3486
3364
|
this.callManager,
|
|
3487
3365
|
this.apiManager,
|
|
3488
|
-
|
|
3366
|
+
i
|
|
3489
3367
|
), this.subscribe();
|
|
3490
3368
|
}
|
|
3491
3369
|
get requestedConnection() {
|
|
@@ -3585,7 +3463,7 @@ class Qn {
|
|
|
3585
3463
|
getRemoteStreams = () => this.callManager.getRemoteStreams();
|
|
3586
3464
|
replaceMediaStream = async (...e) => this.callManager.replaceMediaStream(...e);
|
|
3587
3465
|
async startPresentation(e, t = {}) {
|
|
3588
|
-
const { isP2P: s, callLimit:
|
|
3466
|
+
const { isP2P: s, callLimit: i, onAddedTransceiver: r, ...a } = t;
|
|
3589
3467
|
return this.presentationManager.startPresentation(
|
|
3590
3468
|
async () => {
|
|
3591
3469
|
s === !0 ? (await this.apiManager.sendMustStopPresentationP2P(), await this.apiManager.askPermissionToStartPresentationP2P()) : await this.apiManager.askPermissionToStartPresentation();
|
|
@@ -3593,9 +3471,9 @@ class Qn {
|
|
|
3593
3471
|
e,
|
|
3594
3472
|
{
|
|
3595
3473
|
...a,
|
|
3596
|
-
onAddedTransceiver: this.resolveHandleAddTransceiver(
|
|
3474
|
+
onAddedTransceiver: this.resolveHandleAddTransceiver(r)
|
|
3597
3475
|
},
|
|
3598
|
-
|
|
3476
|
+
i === void 0 ? void 0 : { callLimit: i }
|
|
3599
3477
|
);
|
|
3600
3478
|
}
|
|
3601
3479
|
async stopPresentation(e = {}) {
|
|
@@ -3605,15 +3483,15 @@ class Qn {
|
|
|
3605
3483
|
});
|
|
3606
3484
|
}
|
|
3607
3485
|
async updatePresentation(e, t = {}) {
|
|
3608
|
-
const { isP2P: s, onAddedTransceiver:
|
|
3486
|
+
const { isP2P: s, onAddedTransceiver: i, ...r } = t;
|
|
3609
3487
|
return this.presentationManager.updatePresentation(
|
|
3610
3488
|
async () => {
|
|
3611
3489
|
s === !0 ? (await this.apiManager.sendMustStopPresentationP2P(), await this.apiManager.askPermissionToStartPresentationP2P()) : await this.apiManager.askPermissionToStartPresentation();
|
|
3612
3490
|
},
|
|
3613
3491
|
e,
|
|
3614
3492
|
{
|
|
3615
|
-
...
|
|
3616
|
-
onAddedTransceiver: this.resolveHandleAddTransceiver(
|
|
3493
|
+
...r,
|
|
3494
|
+
onAddedTransceiver: this.resolveHandleAddTransceiver(i)
|
|
3617
3495
|
}
|
|
3618
3496
|
);
|
|
3619
3497
|
}
|
|
@@ -3659,40 +3537,45 @@ class Qn {
|
|
|
3659
3537
|
async askPermissionToEnableCam(...e) {
|
|
3660
3538
|
return this.apiManager.askPermissionToEnableCam(...e);
|
|
3661
3539
|
}
|
|
3540
|
+
subscribeDisconnectedFromOutOfCall() {
|
|
3541
|
+
this.connectionManager.on("disconnected", () => {
|
|
3542
|
+
this.isCallActive || this.events.trigger("disconnected-from-out-of-call", {});
|
|
3543
|
+
});
|
|
3544
|
+
}
|
|
3662
3545
|
setCodecPreferences(e) {
|
|
3663
|
-
|
|
3546
|
+
Zt(e, {
|
|
3664
3547
|
preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
|
|
3665
3548
|
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
3666
3549
|
});
|
|
3667
3550
|
}
|
|
3668
3551
|
subscribe() {
|
|
3669
|
-
this.bridgeEvents("auto-connect", this.autoConnectorManager), this.bridgeEvents("connection", this.connectionManager), this.bridgeEvents("call", this.callManager), this.bridgeEvents("api", this.apiManager), this.bridgeEvents("incoming-call", this.incomingCallManager), this.bridgeEvents("presentation", this.presentationManager), this.bridgeEvents("stats", this.statsManager), this.bridgeEvents("video-balancer", this.videoSendingBalancerManager);
|
|
3552
|
+
this.bridgeEvents("auto-connect", this.autoConnectorManager), this.bridgeEvents("connection", this.connectionManager), this.bridgeEvents("call", this.callManager), this.bridgeEvents("api", this.apiManager), this.bridgeEvents("incoming-call", this.incomingCallManager), this.bridgeEvents("presentation", this.presentationManager), this.bridgeEvents("stats", this.statsManager), this.bridgeEvents("video-balancer", this.videoSendingBalancerManager), this.subscribeDisconnectedFromOutOfCall();
|
|
3670
3553
|
}
|
|
3671
3554
|
bridgeEvents = (e, t) => {
|
|
3672
|
-
t.events.eachTriggers((s,
|
|
3673
|
-
t.on(
|
|
3674
|
-
this.events.trigger(`${e}:${
|
|
3555
|
+
t.events.eachTriggers((s, i) => {
|
|
3556
|
+
t.on(i, (r) => {
|
|
3557
|
+
this.events.trigger(`${e}:${i}`, r);
|
|
3675
3558
|
});
|
|
3676
3559
|
});
|
|
3677
3560
|
};
|
|
3678
|
-
resolveHandleAddTransceiver = (e) => async (t, s,
|
|
3679
|
-
this.setCodecPreferences(t), await e?.(t, s,
|
|
3561
|
+
resolveHandleAddTransceiver = (e) => async (t, s, i) => {
|
|
3562
|
+
this.setCodecPreferences(t), await e?.(t, s, i);
|
|
3680
3563
|
};
|
|
3681
3564
|
}
|
|
3682
3565
|
export {
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3566
|
+
oe as E,
|
|
3567
|
+
He as O,
|
|
3568
|
+
Gn as S,
|
|
3569
|
+
rt as a,
|
|
3570
|
+
Fe as b,
|
|
3571
|
+
xn as c,
|
|
3572
|
+
Hn as d,
|
|
3573
|
+
Vn as e,
|
|
3691
3574
|
A as f,
|
|
3692
|
-
|
|
3575
|
+
Yt as g,
|
|
3693
3576
|
Nt as h,
|
|
3694
|
-
|
|
3577
|
+
nn as i,
|
|
3695
3578
|
c as l,
|
|
3696
3579
|
B as p,
|
|
3697
|
-
|
|
3580
|
+
de as s
|
|
3698
3581
|
};
|