sip-connector 19.7.1 → 19.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@SipConnector-BLD-EPG1.cjs +1 -0
- package/dist/{@SipConnector-Dlsv1V3D.js → @SipConnector-Ce87V-66.js} +432 -394
- package/dist/CallManager/@CallManager.d.ts +2 -4
- package/dist/CallManager/AbstractCallStrategy.d.ts +2 -9
- package/dist/CallManager/MCUCallStrategy.d.ts +3 -10
- package/dist/CallManager/MCUSession.d.ts +33 -0
- package/dist/CallManager/types.d.ts +19 -2
- package/dist/ConnectionManager/ConnectionFlow.d.ts +1 -0
- package/dist/ConnectionManager/eventNames.d.ts +4 -2
- package/dist/ConnectionManager/index.d.ts +1 -1
- package/dist/SipConnector/@SipConnector.d.ts +0 -1
- package/dist/SipConnector/eventNames.d.ts +1 -1
- package/dist/VideoSendingBalancer/__fixtures__/createMockTrack.d.ts +1 -1
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/package.json +13 -13
- package/dist/@SipConnector-CwZJgOxs.cjs +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { Events as
|
|
1
|
+
import { Events as F, TypedEvents as w } from "events-constructor";
|
|
2
2
|
import x from "debug";
|
|
3
3
|
import { CancelableRequest as G, isCanceledError as _e } from "@krivega/cancelable-promise";
|
|
4
|
-
import { resolveRequesterByTimeout as Me, requesterByTimeoutsWithFailCalls as
|
|
4
|
+
import { resolveRequesterByTimeout as Me, requesterByTimeoutsWithFailCalls as ve, DelayRequester as fe, hasCanceledError as Pe, SetTimeoutRequest as ee } from "@krivega/timeout-requester";
|
|
5
5
|
import { hasCanceledError as Oe, repeatedCallsAsync as te } from "repeated-calls";
|
|
6
|
-
import { setup as ye, createActor as
|
|
7
|
-
import { createStackPromises as ne, isPromiseIsNotActualError as
|
|
6
|
+
import { setup as ye, createActor as De } from "xstate";
|
|
7
|
+
import { createStackPromises as ne, isPromiseIsNotActualError as be } from "stack-promises";
|
|
8
8
|
import "ua-parser-js";
|
|
9
9
|
import "sequent-promises";
|
|
10
|
-
const Q = "sip-connector", c = x(Q),
|
|
10
|
+
const Q = "sip-connector", c = x(Q), xn = () => {
|
|
11
11
|
x.enable(Q);
|
|
12
|
-
},
|
|
12
|
+
}, Gn = () => {
|
|
13
13
|
x.enable(`-${Q}`);
|
|
14
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 l = /* @__PURE__ */ ((n) => (n.CONTENT_TYPE = "content-type", n.CONTENT_ENTER_ROOM = "x-webrtc-enter-room", n.CONTENT_USE_LICENSE = "X-WEBRTC-USE-LICENSE", n.PARTICIPANT_NAME = "X-WEBRTC-PARTICIPANT-NAME", n.INPUT_CHANNELS = "X-WEBRTC-INPUT-CHANNELS", n.OUTPUT_CHANNELS = "X-WEBRTC-OUTPUT-CHANNELS", n.MAIN_CAM = "X-WEBRTC-MAINCAM", n.MIC = "X-WEBRTC-MIC", n.MEDIA_SYNC = "X-WEBRTC-SYNC", n.MAIN_CAM_RESOLUTION = "X-WEBRTC-MAINCAM-RESOLUTION", n.MEDIA_STATE = "X-WEBRTC-MEDIA-STATE", n.MEDIA_TYPE = "X-Vinteo-Media-Type", n.MAIN_CAM_STATE = "X-Vinteo-MainCam-State", n.MIC_STATE = "X-Vinteo-Mic-State", n.CONTENT_PARTICIPANT_STATE = "X-WEBRTC-PARTSTATE", n.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))(l || {}),
|
|
15
|
+
var l = /* @__PURE__ */ ((n) => (n.CONTENT_TYPE = "content-type", n.CONTENT_ENTER_ROOM = "x-webrtc-enter-room", n.CONTENT_USE_LICENSE = "X-WEBRTC-USE-LICENSE", n.PARTICIPANT_NAME = "X-WEBRTC-PARTICIPANT-NAME", n.INPUT_CHANNELS = "X-WEBRTC-INPUT-CHANNELS", n.OUTPUT_CHANNELS = "X-WEBRTC-OUTPUT-CHANNELS", n.MAIN_CAM = "X-WEBRTC-MAINCAM", n.MIC = "X-WEBRTC-MIC", n.MEDIA_SYNC = "X-WEBRTC-SYNC", n.MAIN_CAM_RESOLUTION = "X-WEBRTC-MAINCAM-RESOLUTION", n.MEDIA_STATE = "X-WEBRTC-MEDIA-STATE", n.MEDIA_TYPE = "X-Vinteo-Media-Type", n.MAIN_CAM_STATE = "X-Vinteo-MainCam-State", n.MIC_STATE = "X-Vinteo-Mic-State", n.CONTENT_PARTICIPANT_STATE = "X-WEBRTC-PARTSTATE", n.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))(l || {}), L = /* @__PURE__ */ ((n) => (n.AVAILABLE_SECOND_REMOTE_STREAM = "YOUCANRECEIVECONTENT", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "CONTENTEND", n.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", n))(L || {}), V = /* @__PURE__ */ ((n) => (n.SPECTATOR = "SPECTATOR", n.PARTICIPANT = "PARTICIPANT", n))(V || {}), P = /* @__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.RESTART = "application/vinteo.webrtc.restart", n))(P || {}), 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 || {}), f = /* @__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))(f || {}), H = /* @__PURE__ */ ((n) => (n.ADMIN_STOP_MIC = "ADMINSTOPMIC", n.ADMIN_START_MIC = "ADMINSTARTMIC", n))(H || {}), W = /* @__PURE__ */ ((n) => (n.ADMIN_SYNC_FORCED = "1", n.ADMIN_SYNC_NOT_FORCED = "0", n))(W || {}), 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_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.RESTART = "restart", n))(g || {});
|
|
16
16
|
const se = [
|
|
17
17
|
"participation:accepting-word-request",
|
|
18
18
|
"participation:cancelling-word-request",
|
|
@@ -43,7 +43,7 @@ const se = [
|
|
|
43
43
|
"newDTMF",
|
|
44
44
|
"restart"
|
|
45
45
|
];
|
|
46
|
-
var
|
|
46
|
+
var m = /* @__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))(m || {});
|
|
47
47
|
class ke {
|
|
48
48
|
events;
|
|
49
49
|
connectionManager;
|
|
@@ -52,7 +52,7 @@ class ke {
|
|
|
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 F(se), this.subscribe();
|
|
56
56
|
}
|
|
57
57
|
async waitChannels() {
|
|
58
58
|
return this.wait(g.CHANNELS);
|
|
@@ -81,35 +81,35 @@ class ke {
|
|
|
81
81
|
i,
|
|
82
82
|
r
|
|
83
83
|
];
|
|
84
|
-
return s.sendInfo(
|
|
84
|
+
return s.sendInfo(p.CHANNELS, void 0, { extraHeaders: a });
|
|
85
85
|
}
|
|
86
86
|
async sendMediaState({ cam: e, mic: t }, s = {}) {
|
|
87
|
-
const i = this.getEstablishedRTCSessionProtected(), r = `${l.MEDIA_STATE}: currentstate`, a = `${l.MAIN_CAM_STATE}: ${Number(e)}`, o = `${l.MIC_STATE}: ${Number(t)}`,
|
|
87
|
+
const i = this.getEstablishedRTCSessionProtected(), r = `${l.MEDIA_STATE}: currentstate`, a = `${l.MAIN_CAM_STATE}: ${Number(e)}`, o = `${l.MIC_STATE}: ${Number(t)}`, h = [
|
|
88
88
|
r,
|
|
89
89
|
a,
|
|
90
90
|
o
|
|
91
91
|
];
|
|
92
|
-
return i.sendInfo(
|
|
92
|
+
return i.sendInfo(p.MEDIA_STATE, void 0, {
|
|
93
93
|
noTerminateWhenError: !0,
|
|
94
94
|
...s,
|
|
95
|
-
extraHeaders:
|
|
95
|
+
extraHeaders: h
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
async sendStats({
|
|
99
99
|
availableIncomingBitrate: e
|
|
100
100
|
}) {
|
|
101
101
|
const t = this.getEstablishedRTCSessionProtected(), i = [`${l.AVAILABLE_INCOMING_BITRATE}: ${e}`];
|
|
102
|
-
return t.sendInfo(
|
|
102
|
+
return t.sendInfo(p.STATS, void 0, {
|
|
103
103
|
noTerminateWhenError: !0,
|
|
104
104
|
extraHeaders: i
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
async sendRefusalToTurnOn(e, t = {}) {
|
|
108
|
-
const s = this.getEstablishedRTCSessionProtected(), a = e === "mic" ? 0 : 1,
|
|
109
|
-
return s.sendInfo(
|
|
108
|
+
const s = this.getEstablishedRTCSessionProtected(), a = e === "mic" ? 0 : 1, h = [`${l.MEDIA_TYPE}: ${a}`];
|
|
109
|
+
return s.sendInfo(p.REFUSAL, void 0, {
|
|
110
110
|
noTerminateWhenError: !0,
|
|
111
111
|
...t,
|
|
112
|
-
extraHeaders:
|
|
112
|
+
extraHeaders: h
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
115
|
async sendRefusalToTurnOnMic(e = {}) {
|
|
@@ -119,33 +119,33 @@ class ke {
|
|
|
119
119
|
return this.sendRefusalToTurnOn("cam", { noTerminateWhenError: !0, ...e });
|
|
120
120
|
}
|
|
121
121
|
async sendMustStopPresentationP2P() {
|
|
122
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
122
|
+
await this.getEstablishedRTCSessionProtected().sendInfo(p.SHARE_STATE, void 0, {
|
|
123
123
|
extraHeaders: [l.MUST_STOP_PRESENTATION_P2P]
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
126
|
async sendStoppedPresentationP2P() {
|
|
127
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
127
|
+
await this.getEstablishedRTCSessionProtected().sendInfo(p.SHARE_STATE, void 0, {
|
|
128
128
|
extraHeaders: [l.STOP_PRESENTATION_P2P]
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
131
|
async sendStoppedPresentation() {
|
|
132
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
132
|
+
await this.getEstablishedRTCSessionProtected().sendInfo(p.SHARE_STATE, void 0, {
|
|
133
133
|
extraHeaders: [l.STOP_PRESENTATION]
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
136
|
async askPermissionToStartPresentationP2P() {
|
|
137
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
137
|
+
await this.getEstablishedRTCSessionProtected().sendInfo(p.SHARE_STATE, void 0, {
|
|
138
138
|
extraHeaders: [l.START_PRESENTATION_P2P]
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
141
|
async askPermissionToStartPresentation() {
|
|
142
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
142
|
+
await this.getEstablishedRTCSessionProtected().sendInfo(p.SHARE_STATE, void 0, {
|
|
143
143
|
extraHeaders: [l.START_PRESENTATION]
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
146
|
async askPermissionToEnableCam(e = {}) {
|
|
147
147
|
const t = this.getEstablishedRTCSessionProtected(), s = [l.ENABLE_MAIN_CAM];
|
|
148
|
-
return t.sendInfo(
|
|
148
|
+
return t.sendInfo(p.MAIN_CAM, void 0, {
|
|
149
149
|
noTerminateWhenError: !0,
|
|
150
150
|
...e,
|
|
151
151
|
extraHeaders: s
|
|
@@ -200,55 +200,55 @@ class ke {
|
|
|
200
200
|
};
|
|
201
201
|
handleNotify = (e) => {
|
|
202
202
|
switch (e.cmd) {
|
|
203
|
-
case
|
|
203
|
+
case m.CHANNELS: {
|
|
204
204
|
const t = e;
|
|
205
205
|
this.triggerChannelsNotify(t);
|
|
206
206
|
break;
|
|
207
207
|
}
|
|
208
|
-
case
|
|
208
|
+
case m.WEBCAST_STARTED: {
|
|
209
209
|
const t = e;
|
|
210
210
|
this.triggerWebcastStartedNotify(t);
|
|
211
211
|
break;
|
|
212
212
|
}
|
|
213
|
-
case
|
|
213
|
+
case m.WEBCAST_STOPPED: {
|
|
214
214
|
const t = e;
|
|
215
215
|
this.triggerWebcastStoppedNotify(t);
|
|
216
216
|
break;
|
|
217
217
|
}
|
|
218
|
-
case
|
|
218
|
+
case m.ADDED_TO_LIST_MODERATORS: {
|
|
219
219
|
const t = e;
|
|
220
220
|
this.triggerAddedToListModeratorsNotify(t);
|
|
221
221
|
break;
|
|
222
222
|
}
|
|
223
|
-
case
|
|
223
|
+
case m.REMOVED_FROM_LIST_MODERATORS: {
|
|
224
224
|
const t = e;
|
|
225
225
|
this.triggerRemovedFromListModeratorsNotify(t);
|
|
226
226
|
break;
|
|
227
227
|
}
|
|
228
|
-
case
|
|
228
|
+
case m.ACCEPTING_WORD_REQUEST: {
|
|
229
229
|
const t = e;
|
|
230
230
|
this.triggerParticipationAcceptingWordRequest(t);
|
|
231
231
|
break;
|
|
232
232
|
}
|
|
233
|
-
case
|
|
233
|
+
case m.CANCELLING_WORD_REQUEST: {
|
|
234
234
|
const t = e;
|
|
235
235
|
this.triggerParticipationCancellingWordRequest(t);
|
|
236
236
|
break;
|
|
237
237
|
}
|
|
238
|
-
case
|
|
238
|
+
case m.MOVE_REQUEST_TO_STREAM: {
|
|
239
239
|
const t = e;
|
|
240
240
|
this.triggerParticipantMoveRequestToStream(t);
|
|
241
241
|
break;
|
|
242
242
|
}
|
|
243
|
-
case
|
|
243
|
+
case m.ACCOUNT_CHANGED: {
|
|
244
244
|
this.triggerAccountChangedNotify();
|
|
245
245
|
break;
|
|
246
246
|
}
|
|
247
|
-
case
|
|
247
|
+
case m.ACCOUNT_DELETED: {
|
|
248
248
|
this.triggerAccountDeletedNotify();
|
|
249
249
|
break;
|
|
250
250
|
}
|
|
251
|
-
case
|
|
251
|
+
case m.CONFERENCE_PARTICIPANT_TOKEN_ISSUED: {
|
|
252
252
|
const t = e;
|
|
253
253
|
this.triggerConferenceParticipantTokenIssued(t);
|
|
254
254
|
break;
|
|
@@ -406,15 +406,15 @@ class ke {
|
|
|
406
406
|
const t = e.getHeader(l.CONTENT_SHARE_STATE);
|
|
407
407
|
if (t !== void 0)
|
|
408
408
|
switch (t) {
|
|
409
|
-
case
|
|
409
|
+
case L.AVAILABLE_SECOND_REMOTE_STREAM: {
|
|
410
410
|
this.events.trigger(g.AVAILABLE_SECOND_REMOTE_STREAM, void 0);
|
|
411
411
|
break;
|
|
412
412
|
}
|
|
413
|
-
case
|
|
413
|
+
case L.NOT_AVAILABLE_SECOND_REMOTE_STREAM: {
|
|
414
414
|
this.events.trigger(g.NOT_AVAILABLE_SECOND_REMOTE_STREAM, void 0);
|
|
415
415
|
break;
|
|
416
416
|
}
|
|
417
|
-
case
|
|
417
|
+
case L.MUST_STOP_PRESENTATION: {
|
|
418
418
|
this.events.trigger(g.MUST_STOP_PRESENTATION, void 0);
|
|
419
419
|
break;
|
|
420
420
|
}
|
|
@@ -426,15 +426,15 @@ class ke {
|
|
|
426
426
|
};
|
|
427
427
|
triggerMainCamControl = (e) => {
|
|
428
428
|
const t = e.getHeader(l.MAIN_CAM), s = e.getHeader(l.MEDIA_SYNC), i = s === W.ADMIN_SYNC_FORCED;
|
|
429
|
-
if (t ===
|
|
429
|
+
if (t === f.ADMIN_START_MAIN_CAM) {
|
|
430
430
|
this.events.trigger(g.ADMIN_START_MAIN_CAM, { isSyncForced: i });
|
|
431
431
|
return;
|
|
432
432
|
}
|
|
433
|
-
if (t ===
|
|
433
|
+
if (t === f.ADMIN_STOP_MAIN_CAM) {
|
|
434
434
|
this.events.trigger(g.ADMIN_STOP_MAIN_CAM, { isSyncForced: i });
|
|
435
435
|
return;
|
|
436
436
|
}
|
|
437
|
-
(t ===
|
|
437
|
+
(t === f.RESUME_MAIN_CAM || t === f.PAUSE_MAIN_CAM) && s !== void 0 && this.events.trigger(g.ADMIN_FORCE_SYNC_MEDIA_STATE, { isSyncForced: i });
|
|
438
438
|
const r = e.getHeader(l.MAIN_CAM_RESOLUTION);
|
|
439
439
|
this.events.trigger(g.MAIN_CAM_CONTROL, {
|
|
440
440
|
mainCam: t,
|
|
@@ -496,28 +496,15 @@ const ie = [
|
|
|
496
496
|
], re = [
|
|
497
497
|
...ie,
|
|
498
498
|
...qe
|
|
499
|
-
]
|
|
500
|
-
|
|
501
|
-
"contentHint" in s && s.contentHint !== e && (s.contentHint = e);
|
|
502
|
-
});
|
|
503
|
-
}, F = (n, {
|
|
504
|
-
directionVideo: e,
|
|
505
|
-
directionAudio: t,
|
|
506
|
-
contentHint: s
|
|
507
|
-
} = {}) => {
|
|
508
|
-
if (!n || e === "recvonly" && t === "recvonly")
|
|
509
|
-
return;
|
|
510
|
-
const i = t === "recvonly" ? [] : n.getAudioTracks(), r = e === "recvonly" ? [] : n.getVideoTracks(), a = [...i, ...r], o = new MediaStream(a);
|
|
511
|
-
return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" && Ve(o, s), o;
|
|
512
|
-
};
|
|
513
|
-
function He(n) {
|
|
499
|
+
];
|
|
500
|
+
function Ve(n) {
|
|
514
501
|
return (e) => `sip:${e}@${n}`;
|
|
515
502
|
}
|
|
516
|
-
const
|
|
503
|
+
const He = (n, e) => () => Math.floor(Math.random() * (e - n)) + n, ae = (n) => n.trim().replaceAll(" ", "_"), We = He(1e5, 99999999), xe = (n) => n.some((t) => {
|
|
517
504
|
const { kind: s } = t;
|
|
518
505
|
return s === "video";
|
|
519
506
|
});
|
|
520
|
-
class
|
|
507
|
+
class Ge {
|
|
521
508
|
isPendingCall = !1;
|
|
522
509
|
isPendingAnswer = !1;
|
|
523
510
|
rtcSession;
|
|
@@ -528,44 +515,28 @@ class Qe {
|
|
|
528
515
|
this.events = e;
|
|
529
516
|
}
|
|
530
517
|
}
|
|
518
|
+
const Qe = (n, e) => {
|
|
519
|
+
n.getVideoTracks().forEach((s) => {
|
|
520
|
+
"contentHint" in s && s.contentHint !== e && (s.contentHint = e);
|
|
521
|
+
});
|
|
522
|
+
}, B = (n, {
|
|
523
|
+
directionVideo: e,
|
|
524
|
+
directionAudio: t,
|
|
525
|
+
contentHint: s
|
|
526
|
+
} = {}) => {
|
|
527
|
+
if (!n || e === "recvonly" && t === "recvonly")
|
|
528
|
+
return;
|
|
529
|
+
const i = t === "recvonly" ? [] : n.getAudioTracks(), r = e === "recvonly" ? [] : n.getVideoTracks(), a = [...i, ...r], o = new MediaStream(a);
|
|
530
|
+
return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" && Qe(o, s), o;
|
|
531
|
+
};
|
|
531
532
|
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 || {});
|
|
532
533
|
class Ye {
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
this.remoteStreams = {};
|
|
536
|
-
}
|
|
537
|
-
generateStream(e, t) {
|
|
538
|
-
const { id: s } = e, i = this.remoteStreams[s] ?? new MediaStream();
|
|
539
|
-
return t && i.addTrack(t), i.addTrack(e), this.remoteStreams[s] = i, i;
|
|
540
|
-
}
|
|
541
|
-
generateAudioStream(e) {
|
|
542
|
-
const { id: t } = e, s = this.remoteStreams[t] ?? new MediaStream();
|
|
543
|
-
return s.addTrack(e), this.remoteStreams[t] = s, s;
|
|
544
|
-
}
|
|
545
|
-
generateStreams(e) {
|
|
546
|
-
const t = [];
|
|
547
|
-
return e.forEach((s, i) => {
|
|
548
|
-
if (s.kind === "audio")
|
|
549
|
-
return;
|
|
550
|
-
const r = s, a = e[i - 1];
|
|
551
|
-
let o;
|
|
552
|
-
a?.kind === "audio" && (o = a);
|
|
553
|
-
const d = this.generateStream(r, o);
|
|
554
|
-
t.push(d);
|
|
555
|
-
}), t;
|
|
556
|
-
}
|
|
557
|
-
generateAudioStreams(e) {
|
|
558
|
-
return e.map((t) => this.generateAudioStream(t));
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
class ze extends Qe {
|
|
562
|
-
remoteStreamsManager = new Ye();
|
|
534
|
+
events;
|
|
535
|
+
rtcSession;
|
|
563
536
|
disposers = /* @__PURE__ */ new Set();
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
get requested() {
|
|
568
|
-
return this.isPendingCall || this.isPendingAnswer;
|
|
537
|
+
onReset;
|
|
538
|
+
constructor(e, { onReset: t }) {
|
|
539
|
+
this.events = e, this.onReset = t, e.on(R.FAILED, this.handleEnded), e.on(R.ENDED, this.handleEnded);
|
|
569
540
|
}
|
|
570
541
|
get connection() {
|
|
571
542
|
return this.rtcSession?.connection;
|
|
@@ -573,30 +544,28 @@ class ze extends Qe {
|
|
|
573
544
|
get isCallActive() {
|
|
574
545
|
return this.rtcSession?.isEstablished() === !0;
|
|
575
546
|
}
|
|
576
|
-
|
|
577
|
-
return this.rtcSession?.isEstablished() === !0 ? this.rtcSession : void 0;
|
|
578
|
-
}
|
|
547
|
+
getEstablishedRTCSession = () => this.rtcSession?.isEstablished() === !0 ? this.rtcSession : void 0;
|
|
579
548
|
startCall = async (e, t, {
|
|
580
549
|
number: s,
|
|
581
550
|
mediaStream: i,
|
|
582
551
|
extraHeaders: r = [],
|
|
583
552
|
ontrack: a,
|
|
584
553
|
iceServers: o,
|
|
585
|
-
directionVideo:
|
|
586
|
-
directionAudio:
|
|
554
|
+
directionVideo: h,
|
|
555
|
+
directionAudio: d,
|
|
587
556
|
contentHint: T,
|
|
588
557
|
offerToReceiveAudio: S = !0,
|
|
589
558
|
offerToReceiveVideo: u = !0,
|
|
590
559
|
degradationPreference: E,
|
|
591
|
-
sendEncodings:
|
|
592
|
-
onAddedTransceiver:
|
|
593
|
-
}) =>
|
|
594
|
-
this.
|
|
595
|
-
|
|
560
|
+
sendEncodings: I,
|
|
561
|
+
onAddedTransceiver: N
|
|
562
|
+
}) => new Promise((M, k) => {
|
|
563
|
+
this.handleCall({ ontrack: a }).then(M).catch(($) => {
|
|
564
|
+
k($);
|
|
596
565
|
}), this.rtcSession = e.call(t(s), {
|
|
597
|
-
mediaStream:
|
|
598
|
-
directionVideo:
|
|
599
|
-
directionAudio:
|
|
566
|
+
mediaStream: B(i, {
|
|
567
|
+
directionVideo: h,
|
|
568
|
+
directionAudio: d,
|
|
600
569
|
contentHint: T
|
|
601
570
|
}),
|
|
602
571
|
pcConfig: {
|
|
@@ -611,15 +580,13 @@ class ze extends Qe {
|
|
|
611
580
|
// и после создания нет возможности подписаться на события peerconnection через subscribeToSessionEvents
|
|
612
581
|
eventHandlers: this.events.triggers,
|
|
613
582
|
extraHeaders: r,
|
|
614
|
-
directionVideo:
|
|
615
|
-
directionAudio:
|
|
583
|
+
directionVideo: h,
|
|
584
|
+
directionAudio: d,
|
|
616
585
|
degradationPreference: E,
|
|
617
|
-
sendEncodings:
|
|
618
|
-
onAddedTransceiver:
|
|
586
|
+
sendEncodings: I,
|
|
587
|
+
onAddedTransceiver: N
|
|
619
588
|
});
|
|
620
|
-
})
|
|
621
|
-
this.isPendingCall = !1;
|
|
622
|
-
}));
|
|
589
|
+
});
|
|
623
590
|
async endCall() {
|
|
624
591
|
const { rtcSession: e } = this;
|
|
625
592
|
if (e && !e.isEnded())
|
|
@@ -637,26 +604,25 @@ class ze extends Qe {
|
|
|
637
604
|
iceServers: r,
|
|
638
605
|
directionVideo: a,
|
|
639
606
|
directionAudio: o,
|
|
640
|
-
offerToReceiveAudio:
|
|
641
|
-
offerToReceiveVideo:
|
|
607
|
+
offerToReceiveAudio: h,
|
|
608
|
+
offerToReceiveVideo: d,
|
|
642
609
|
contentHint: T,
|
|
643
610
|
degradationPreference: S,
|
|
644
611
|
sendEncodings: u,
|
|
645
612
|
onAddedTransceiver: E
|
|
646
|
-
}) =>
|
|
613
|
+
}) => new Promise((I, N) => {
|
|
647
614
|
try {
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
}), N.answer({
|
|
615
|
+
this.rtcSession = e, this.subscribeToSessionEvents(e), this.handleCall({ ontrack: s }).then(I).catch((M) => {
|
|
616
|
+
N(M);
|
|
617
|
+
}), e.answer({
|
|
652
618
|
pcConfig: {
|
|
653
619
|
iceServers: r
|
|
654
620
|
},
|
|
655
621
|
rtcOfferConstraints: {
|
|
656
|
-
offerToReceiveAudio:
|
|
657
|
-
offerToReceiveVideo:
|
|
622
|
+
offerToReceiveAudio: h,
|
|
623
|
+
offerToReceiveVideo: d
|
|
658
624
|
},
|
|
659
|
-
mediaStream:
|
|
625
|
+
mediaStream: B(t, {
|
|
660
626
|
directionVideo: a,
|
|
661
627
|
directionAudio: o,
|
|
662
628
|
contentHint: T
|
|
@@ -668,28 +634,17 @@ class ze extends Qe {
|
|
|
668
634
|
sendEncodings: u,
|
|
669
635
|
onAddedTransceiver: E
|
|
670
636
|
});
|
|
671
|
-
} catch (
|
|
672
|
-
|
|
637
|
+
} catch (M) {
|
|
638
|
+
N(M);
|
|
673
639
|
}
|
|
674
|
-
})
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
getEstablishedRTCSession() {
|
|
678
|
-
return this.rtcSession?.isEstablished() === !0 ? this.rtcSession : void 0;
|
|
679
|
-
}
|
|
680
|
-
getCallConfiguration() {
|
|
681
|
-
return { ...this.callConfiguration };
|
|
682
|
-
}
|
|
683
|
-
getRemoteStreams() {
|
|
684
|
-
if (!this.connection)
|
|
685
|
-
return;
|
|
686
|
-
const t = this.connection.getReceivers().map(({ track: s }) => s);
|
|
687
|
-
return Ge(t) ? this.remoteStreamsManager.generateStreams(t) : this.remoteStreamsManager.generateAudioStreams(t);
|
|
640
|
+
});
|
|
641
|
+
getRemoteTracks() {
|
|
642
|
+
return this.connection ? this.connection.getReceivers().map(({ track: s }) => s) : void 0;
|
|
688
643
|
}
|
|
689
644
|
async replaceMediaStream(e, t) {
|
|
690
645
|
if (!this.rtcSession)
|
|
691
646
|
throw new Error("No rtcSession established");
|
|
692
|
-
const { contentHint: s } = t ?? {}, i =
|
|
647
|
+
const { contentHint: s } = t ?? {}, i = B(e, { contentHint: s });
|
|
693
648
|
if (i === void 0)
|
|
694
649
|
throw new Error("No preparedMediaStream");
|
|
695
650
|
return this.rtcSession.replaceMediaStream(i, t);
|
|
@@ -712,23 +667,23 @@ class ze extends Qe {
|
|
|
712
667
|
}, r = () => {
|
|
713
668
|
this.events.off(R.PEER_CONNECTION, T), this.events.off(R.CONFIRMED, S);
|
|
714
669
|
}, a = () => {
|
|
715
|
-
this.events.on(R.FAILED,
|
|
670
|
+
this.events.on(R.FAILED, h), this.events.on(R.ENDED, h);
|
|
716
671
|
}, o = () => {
|
|
717
|
-
this.events.off(R.FAILED,
|
|
718
|
-
},
|
|
672
|
+
this.events.off(R.FAILED, h), this.events.off(R.ENDED, h);
|
|
673
|
+
}, h = (u) => {
|
|
719
674
|
r(), o(), s(u);
|
|
720
675
|
};
|
|
721
|
-
let
|
|
676
|
+
let d;
|
|
722
677
|
const T = ({ peerconnection: u }) => {
|
|
723
|
-
|
|
724
|
-
const E = (
|
|
725
|
-
this.events.trigger(R.PEER_CONNECTION_ONTRACK,
|
|
678
|
+
d = u;
|
|
679
|
+
const E = (I) => {
|
|
680
|
+
this.events.trigger(R.PEER_CONNECTION_ONTRACK, I), e && e(I);
|
|
726
681
|
};
|
|
727
682
|
u.addEventListener("track", E), this.disposers.add(() => {
|
|
728
683
|
u.removeEventListener("track", E);
|
|
729
684
|
});
|
|
730
685
|
}, S = () => {
|
|
731
|
-
|
|
686
|
+
d !== void 0 && this.events.trigger(R.PEER_CONNECTION_CONFIRMED, d), r(), o(), t(d);
|
|
732
687
|
};
|
|
733
688
|
i(), a();
|
|
734
689
|
});
|
|
@@ -750,14 +705,93 @@ class ze extends Qe {
|
|
|
750
705
|
t === "remote" && this.events.trigger(R.ENDED_FROM_SERVER, e), this.reset();
|
|
751
706
|
};
|
|
752
707
|
reset = () => {
|
|
753
|
-
delete this.rtcSession, this.
|
|
708
|
+
delete this.rtcSession, this.unsubscribeFromSessionEvents(), this.onReset();
|
|
754
709
|
};
|
|
755
710
|
}
|
|
756
|
-
class
|
|
711
|
+
class ze {
|
|
712
|
+
remoteStreams = {};
|
|
713
|
+
reset() {
|
|
714
|
+
this.remoteStreams = {};
|
|
715
|
+
}
|
|
716
|
+
generateStream(e, t) {
|
|
717
|
+
const { id: s } = e, i = this.remoteStreams[s] ?? new MediaStream();
|
|
718
|
+
return t && i.addTrack(t), i.addTrack(e), this.remoteStreams[s] = i, i;
|
|
719
|
+
}
|
|
720
|
+
generateAudioStream(e) {
|
|
721
|
+
const { id: t } = e, s = this.remoteStreams[t] ?? new MediaStream();
|
|
722
|
+
return s.addTrack(e), this.remoteStreams[t] = s, s;
|
|
723
|
+
}
|
|
724
|
+
generateStreams(e) {
|
|
725
|
+
const t = [];
|
|
726
|
+
return e.forEach((s, i) => {
|
|
727
|
+
if (s.kind === "audio")
|
|
728
|
+
return;
|
|
729
|
+
const r = s, a = e[i - 1];
|
|
730
|
+
let o;
|
|
731
|
+
a?.kind === "audio" && (o = a);
|
|
732
|
+
const h = this.generateStream(r, o);
|
|
733
|
+
t.push(h);
|
|
734
|
+
}), t;
|
|
735
|
+
}
|
|
736
|
+
generateAudioStreams(e) {
|
|
737
|
+
return e.map((t) => this.generateAudioStream(t));
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
class Xe extends Ge {
|
|
741
|
+
remoteStreamsManager = new ze();
|
|
742
|
+
mcuSession;
|
|
743
|
+
constructor(e) {
|
|
744
|
+
super(e), this.mcuSession = new Ye(e, { onReset: this.reset });
|
|
745
|
+
}
|
|
746
|
+
get requested() {
|
|
747
|
+
return this.isPendingCall || this.isPendingAnswer;
|
|
748
|
+
}
|
|
749
|
+
get connection() {
|
|
750
|
+
return this.mcuSession.connection;
|
|
751
|
+
}
|
|
752
|
+
get isCallActive() {
|
|
753
|
+
return this.mcuSession.isCallActive;
|
|
754
|
+
}
|
|
755
|
+
getEstablishedRTCSession = () => this.mcuSession.getEstablishedRTCSession();
|
|
756
|
+
startCall = async (e, t, s) => (this.isPendingCall = !0, this.callConfiguration.number = s.number, this.callConfiguration.answer = !1, this.mcuSession.startCall(e, t, s).finally(() => {
|
|
757
|
+
this.isPendingCall = !1;
|
|
758
|
+
}));
|
|
759
|
+
async endCall() {
|
|
760
|
+
return this.mcuSession.endCall();
|
|
761
|
+
}
|
|
762
|
+
answerToIncomingCall = async (e, t) => {
|
|
763
|
+
this.isPendingAnswer = !0;
|
|
764
|
+
const s = e();
|
|
765
|
+
return this.callConfiguration.answer = !0, this.callConfiguration.number = s.remote_identity.uri.user, this.mcuSession.answerToIncomingCall(s, t).finally(() => {
|
|
766
|
+
this.isPendingAnswer = !1;
|
|
767
|
+
});
|
|
768
|
+
};
|
|
769
|
+
getCallConfiguration() {
|
|
770
|
+
return { ...this.callConfiguration };
|
|
771
|
+
}
|
|
772
|
+
getRemoteStreams() {
|
|
773
|
+
const e = this.mcuSession.getRemoteTracks();
|
|
774
|
+
if (e)
|
|
775
|
+
return xe(e) ? this.remoteStreamsManager.generateStreams(e) : this.remoteStreamsManager.generateAudioStreams(e);
|
|
776
|
+
}
|
|
777
|
+
async replaceMediaStream(e, t) {
|
|
778
|
+
return this.mcuSession.replaceMediaStream(e, t);
|
|
779
|
+
}
|
|
780
|
+
async restartIce(e) {
|
|
781
|
+
return this.mcuSession.restartIce(e);
|
|
782
|
+
}
|
|
783
|
+
async addTransceiver(e, t) {
|
|
784
|
+
return this.mcuSession.addTransceiver(e, t);
|
|
785
|
+
}
|
|
786
|
+
reset = () => {
|
|
787
|
+
this.remoteStreamsManager.reset(), this.callConfiguration.number = void 0, this.callConfiguration.answer = !1;
|
|
788
|
+
};
|
|
789
|
+
}
|
|
790
|
+
class Je {
|
|
757
791
|
events;
|
|
758
792
|
strategy;
|
|
759
793
|
constructor(e) {
|
|
760
|
-
this.events = new
|
|
794
|
+
this.events = new w(re), this.strategy = e ?? new Xe(this.events), this.subscribeCallStatusChange();
|
|
761
795
|
}
|
|
762
796
|
get requested() {
|
|
763
797
|
return this.strategy.requested;
|
|
@@ -765,12 +799,10 @@ class Xe {
|
|
|
765
799
|
get connection() {
|
|
766
800
|
return this.strategy.connection;
|
|
767
801
|
}
|
|
768
|
-
get establishedRTCSession() {
|
|
769
|
-
return this.strategy.establishedRTCSession;
|
|
770
|
-
}
|
|
771
802
|
get isCallActive() {
|
|
772
803
|
return this.strategy.isCallActive;
|
|
773
804
|
}
|
|
805
|
+
getEstablishedRTCSession = () => this.strategy.getEstablishedRTCSession();
|
|
774
806
|
on(e, t) {
|
|
775
807
|
return this.events.on(e, t);
|
|
776
808
|
}
|
|
@@ -795,7 +827,6 @@ class Xe {
|
|
|
795
827
|
startCall = async (...e) => this.strategy.startCall(...e);
|
|
796
828
|
endCall = async () => this.strategy.endCall();
|
|
797
829
|
answerToIncomingCall = async (...e) => this.strategy.answerToIncomingCall(...e);
|
|
798
|
-
getEstablishedRTCSession = () => this.strategy.getEstablishedRTCSession();
|
|
799
830
|
getCallConfiguration = () => this.strategy.getCallConfiguration();
|
|
800
831
|
getRemoteStreams = () => this.strategy.getRemoteStreams();
|
|
801
832
|
addTransceiver = async (...e) => this.strategy.addTransceiver(...e);
|
|
@@ -813,39 +844,39 @@ class Xe {
|
|
|
813
844
|
return t !== e && this.events.trigger(R.CALL_STATUS_CHANGED, { isCallActive: t }), t;
|
|
814
845
|
}
|
|
815
846
|
}
|
|
816
|
-
const
|
|
847
|
+
const Ke = (n, e) => (n.degradationPreference = e.degradationPreference, n), je = (n, e) => {
|
|
817
848
|
n.encodings ??= [];
|
|
818
849
|
for (let t = n.encodings.length; t < e; t += 1)
|
|
819
850
|
n.encodings.push({});
|
|
820
851
|
return n;
|
|
821
|
-
}, ce = (n) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== n,
|
|
822
|
-
if (
|
|
852
|
+
}, ce = (n) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== n, Ze = ce(), et = (n, e) => {
|
|
853
|
+
if (Ze(n, e))
|
|
823
854
|
return n;
|
|
824
|
-
},
|
|
825
|
-
const t = n.maxBitrate, s =
|
|
855
|
+
}, tt = (n, e) => {
|
|
856
|
+
const t = n.maxBitrate, s = et(e, t);
|
|
826
857
|
return s !== void 0 && (n.maxBitrate = s), n;
|
|
827
|
-
},
|
|
828
|
-
|
|
829
|
-
),
|
|
830
|
-
const t = n === void 0 ? void 0 : Math.max(n,
|
|
831
|
-
if (t !== void 0 &&
|
|
858
|
+
}, he = 1, nt = ce(
|
|
859
|
+
he
|
|
860
|
+
), st = (n, e) => {
|
|
861
|
+
const t = n === void 0 ? void 0 : Math.max(n, he);
|
|
862
|
+
if (t !== void 0 && nt(
|
|
832
863
|
t,
|
|
833
864
|
e
|
|
834
865
|
))
|
|
835
866
|
return t;
|
|
836
|
-
},
|
|
837
|
-
const t = n.scaleResolutionDownBy, s =
|
|
867
|
+
}, it = (n, e) => {
|
|
868
|
+
const t = n.scaleResolutionDownBy, s = st(
|
|
838
869
|
e,
|
|
839
870
|
t
|
|
840
871
|
);
|
|
841
872
|
return s !== void 0 && (n.scaleResolutionDownBy = s), n;
|
|
842
|
-
},
|
|
873
|
+
}, rt = (n, e) => {
|
|
843
874
|
const t = e.encodings?.length ?? 0;
|
|
844
|
-
return
|
|
875
|
+
return je(n, t), n.encodings.forEach((s, i) => {
|
|
845
876
|
const r = (e?.encodings ?? [])[i], a = r?.maxBitrate, o = r?.scaleResolutionDownBy;
|
|
846
|
-
|
|
877
|
+
tt(s, a), it(s, o);
|
|
847
878
|
}), n;
|
|
848
|
-
},
|
|
879
|
+
}, at = (n, e) => {
|
|
849
880
|
if (n.codecs?.length !== e.codecs?.length)
|
|
850
881
|
return !0;
|
|
851
882
|
for (let t = 0; t < (n.codecs?.length ?? 0); t++)
|
|
@@ -862,15 +893,15 @@ const Je = (n, e) => (n.degradationPreference = e.degradationPreference, n), Ke
|
|
|
862
893
|
if (JSON.stringify(n.encodings[t]) !== JSON.stringify(e.encodings[t]))
|
|
863
894
|
return !0;
|
|
864
895
|
return n.rtcp?.cname !== e.rtcp?.cname || n.rtcp?.reducedSize !== e.rtcp?.reducedSize || n.degradationPreference !== e.degradationPreference;
|
|
865
|
-
},
|
|
896
|
+
}, ot = async (n, e) => {
|
|
866
897
|
const t = n.getParameters(), s = JSON.parse(
|
|
867
898
|
JSON.stringify(t)
|
|
868
899
|
);
|
|
869
|
-
|
|
870
|
-
const i =
|
|
900
|
+
rt(t, e), Ke(t, e);
|
|
901
|
+
const i = at(s, t);
|
|
871
902
|
return i && await n.setParameters(t), { parameters: t, isChanged: i };
|
|
872
|
-
},
|
|
873
|
-
const { isChanged: s, parameters: i } = await
|
|
903
|
+
}, de = async (n, e, t) => {
|
|
904
|
+
const { isChanged: s, parameters: i } = await ot(n, {
|
|
874
905
|
encodings: [
|
|
875
906
|
{
|
|
876
907
|
scaleResolutionDownBy: e.scaleResolutionDownBy,
|
|
@@ -879,10 +910,10 @@ const Je = (n, e) => (n.degradationPreference = e.degradationPreference, n), Ke
|
|
|
879
910
|
]
|
|
880
911
|
});
|
|
881
912
|
return s && t && t(i), { isChanged: s, parameters: i };
|
|
882
|
-
},
|
|
883
|
-
const s =
|
|
913
|
+
}, ct = (n, e) => n.find((t) => t.track !== null && e.getTracks().includes(t.track)), ht = async (n, e, t) => {
|
|
914
|
+
const s = ct(n, e);
|
|
884
915
|
if (s)
|
|
885
|
-
return
|
|
916
|
+
return de(s, { maxBitrate: t });
|
|
886
917
|
};
|
|
887
918
|
var O = /* @__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))(O || {});
|
|
888
919
|
const le = [
|
|
@@ -891,8 +922,8 @@ const le = [
|
|
|
891
922
|
"presentation:end",
|
|
892
923
|
"presentation:ended",
|
|
893
924
|
"presentation:failed"
|
|
894
|
-
], dt = 1,
|
|
895
|
-
class
|
|
925
|
+
], dt = 1, Qn = (n) => Oe(n);
|
|
926
|
+
class lt {
|
|
896
927
|
events;
|
|
897
928
|
promisePendingStartPresentation;
|
|
898
929
|
promisePendingStopPresentation;
|
|
@@ -904,7 +935,7 @@ class ht {
|
|
|
904
935
|
callManager: e,
|
|
905
936
|
maxBitrate: t
|
|
906
937
|
}) {
|
|
907
|
-
this.callManager = e, this.maxBitrate = t, this.events = new
|
|
938
|
+
this.callManager = e, this.maxBitrate = t, this.events = new F(le), this.subscribe();
|
|
908
939
|
}
|
|
909
940
|
get isPendingPresentation() {
|
|
910
941
|
return !!this.promisePendingStartPresentation || !!this.promisePendingStopPresentation;
|
|
@@ -916,11 +947,11 @@ class ht {
|
|
|
916
947
|
sendEncodings: r,
|
|
917
948
|
onAddedTransceiver: a
|
|
918
949
|
} = {}, o) {
|
|
919
|
-
const
|
|
950
|
+
const h = this.getRtcSessionProtected();
|
|
920
951
|
if (this.streamPresentationCurrent)
|
|
921
952
|
throw new Error("Presentation is already started");
|
|
922
953
|
return this.sendPresentationWithDuplicatedCalls(e, {
|
|
923
|
-
rtcSession:
|
|
954
|
+
rtcSession: h,
|
|
924
955
|
stream: t,
|
|
925
956
|
presentationOptions: {
|
|
926
957
|
isNeedReinvite: s,
|
|
@@ -1013,7 +1044,7 @@ class ht {
|
|
|
1013
1044
|
isComplete: o,
|
|
1014
1045
|
isRejectAsValid: !0,
|
|
1015
1046
|
...r
|
|
1016
|
-
}), this.cancelableSendPresentationWithRepeatedCalls.then((
|
|
1047
|
+
}), this.cancelableSendPresentationWithRepeatedCalls.then((h) => h);
|
|
1017
1048
|
}
|
|
1018
1049
|
// eslint-disable-next-line @typescript-eslint/max-params
|
|
1019
1050
|
async sendPresentation(e, t, s, {
|
|
@@ -1021,16 +1052,16 @@ class ht {
|
|
|
1021
1052
|
contentHint: r = "detail",
|
|
1022
1053
|
degradationPreference: a,
|
|
1023
1054
|
sendEncodings: o,
|
|
1024
|
-
onAddedTransceiver:
|
|
1055
|
+
onAddedTransceiver: h
|
|
1025
1056
|
}) {
|
|
1026
|
-
const
|
|
1027
|
-
if (
|
|
1057
|
+
const d = B(s, { contentHint: r });
|
|
1058
|
+
if (d === void 0)
|
|
1028
1059
|
throw new Error("No streamPresentationTarget");
|
|
1029
|
-
this.streamPresentationCurrent =
|
|
1030
|
-
const T = e().then(async () => t.startPresentation(
|
|
1060
|
+
this.streamPresentationCurrent = d;
|
|
1061
|
+
const T = e().then(async () => t.startPresentation(d, i, {
|
|
1031
1062
|
degradationPreference: a,
|
|
1032
1063
|
sendEncodings: o,
|
|
1033
|
-
onAddedTransceiver:
|
|
1064
|
+
onAddedTransceiver: h
|
|
1034
1065
|
})).then(this.setMaxBitrate).then(() => s).catch((S) => {
|
|
1035
1066
|
throw this.removeStreamPresentationCurrent(), this.events.trigger(O.FAILED_PRESENTATION, S), S;
|
|
1036
1067
|
});
|
|
@@ -1043,7 +1074,7 @@ class ht {
|
|
|
1043
1074
|
if (!e || !t || s === void 0)
|
|
1044
1075
|
return;
|
|
1045
1076
|
const i = e.getSenders();
|
|
1046
|
-
await
|
|
1077
|
+
await ht(i, t, s);
|
|
1047
1078
|
};
|
|
1048
1079
|
getRtcSessionProtected = () => {
|
|
1049
1080
|
const e = this.callManager.getEstablishedRTCSession();
|
|
@@ -1064,7 +1095,7 @@ class ht {
|
|
|
1064
1095
|
delete this.streamPresentationCurrent;
|
|
1065
1096
|
}
|
|
1066
1097
|
}
|
|
1067
|
-
class
|
|
1098
|
+
class ut {
|
|
1068
1099
|
data;
|
|
1069
1100
|
getUa;
|
|
1070
1101
|
constructor(e) {
|
|
@@ -1144,7 +1175,7 @@ class lt {
|
|
|
1144
1175
|
return this.data?.register === !0;
|
|
1145
1176
|
}
|
|
1146
1177
|
}
|
|
1147
|
-
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))(C || {});
|
|
1178
|
+
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 || {});
|
|
1148
1179
|
const ue = [
|
|
1149
1180
|
"connecting",
|
|
1150
1181
|
"connected",
|
|
@@ -1155,15 +1186,16 @@ const ue = [
|
|
|
1155
1186
|
"registrationFailed",
|
|
1156
1187
|
"newMessage",
|
|
1157
1188
|
"sipEvent"
|
|
1158
|
-
],
|
|
1189
|
+
], gt = [
|
|
1159
1190
|
"disconnecting",
|
|
1160
1191
|
"connect-started",
|
|
1161
1192
|
"connect-succeeded",
|
|
1162
1193
|
"connect-failed",
|
|
1163
1194
|
"connect-parameters-resolve-success",
|
|
1164
|
-
"connect-parameters-resolve-failed"
|
|
1165
|
-
|
|
1166
|
-
|
|
1195
|
+
"connect-parameters-resolve-failed",
|
|
1196
|
+
"connected-with-configuration"
|
|
1197
|
+
], ge = [...ue, ...gt], Tt = 3;
|
|
1198
|
+
class St {
|
|
1167
1199
|
cancelableConnectWithRepeatedCalls;
|
|
1168
1200
|
JsSIP;
|
|
1169
1201
|
events;
|
|
@@ -1178,7 +1210,7 @@ class Tt {
|
|
|
1178
1210
|
setSipServerUrl;
|
|
1179
1211
|
setSocket;
|
|
1180
1212
|
constructor(e) {
|
|
1181
|
-
this.JsSIP = e.JsSIP, this.events = e.events, this.uaFactory = e.uaFactory, this.stateMachine = e.stateMachine, this.registrationManager = e.registrationManager, this.getUa = e.getUa, this.setUa = e.setUa, this.getConnectionConfiguration = e.getConnectionConfiguration, this.setConnectionConfiguration = e.setConnectionConfiguration, this.updateConnectionConfiguration = e.updateConnectionConfiguration, this.setSipServerUrl = e.setSipServerUrl, this.setSocket = e.setSocket;
|
|
1213
|
+
this.JsSIP = e.JsSIP, this.events = e.events, this.uaFactory = e.uaFactory, this.stateMachine = e.stateMachine, this.registrationManager = e.registrationManager, this.getUa = e.getUa, this.setUa = e.setUa, this.getConnectionConfiguration = e.getConnectionConfiguration, this.setConnectionConfiguration = e.setConnectionConfiguration, this.updateConnectionConfiguration = e.updateConnectionConfiguration, this.setSipServerUrl = e.setSipServerUrl, this.setSocket = e.setSocket, this.proxyEvents();
|
|
1182
1214
|
}
|
|
1183
1215
|
connect = async (e, t) => (this.cancelRequests(), this.connectWithDuplicatedCalls(e, t));
|
|
1184
1216
|
set = async ({ displayName: e }) => new Promise((t, s) => {
|
|
@@ -1207,10 +1239,10 @@ class Tt {
|
|
|
1207
1239
|
cancelRequests() {
|
|
1208
1240
|
this.cancelConnectWithRepeatedCalls();
|
|
1209
1241
|
}
|
|
1210
|
-
connectWithDuplicatedCalls = async (e, { callLimit: t =
|
|
1242
|
+
connectWithDuplicatedCalls = async (e, { callLimit: t = Tt } = {}) => {
|
|
1211
1243
|
const s = async () => this.connectInner(e), i = (r) => {
|
|
1212
|
-
const
|
|
1213
|
-
return
|
|
1244
|
+
const h = this.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), d = r != null && !Le(r);
|
|
1245
|
+
return h || d;
|
|
1214
1246
|
};
|
|
1215
1247
|
return this.stateMachine.startConnect(), this.cancelableConnectWithRepeatedCalls = te({
|
|
1216
1248
|
targetFunction: s,
|
|
@@ -1245,8 +1277,8 @@ class Tt {
|
|
|
1245
1277
|
remoteAddress: r,
|
|
1246
1278
|
sessionTimers: a,
|
|
1247
1279
|
registerExpires: o,
|
|
1248
|
-
connectionRecoveryMinInterval:
|
|
1249
|
-
connectionRecoveryMaxInterval:
|
|
1280
|
+
connectionRecoveryMinInterval: h,
|
|
1281
|
+
connectionRecoveryMaxInterval: d,
|
|
1250
1282
|
userAgent: T,
|
|
1251
1283
|
displayName: S = "",
|
|
1252
1284
|
register: u = !1,
|
|
@@ -1259,7 +1291,7 @@ class Tt {
|
|
|
1259
1291
|
user: e,
|
|
1260
1292
|
password: t
|
|
1261
1293
|
}), this.getUa() && await this.disconnect();
|
|
1262
|
-
const { ua:
|
|
1294
|
+
const { ua: N, helpers: M } = this.uaFactory.createUAWithConfiguration(
|
|
1263
1295
|
{
|
|
1264
1296
|
user: e,
|
|
1265
1297
|
password: t,
|
|
@@ -1269,15 +1301,15 @@ class Tt {
|
|
|
1269
1301
|
register: u,
|
|
1270
1302
|
sessionTimers: a,
|
|
1271
1303
|
registerExpires: o,
|
|
1272
|
-
connectionRecoveryMinInterval:
|
|
1273
|
-
connectionRecoveryMaxInterval:
|
|
1304
|
+
connectionRecoveryMinInterval: h,
|
|
1305
|
+
connectionRecoveryMaxInterval: d,
|
|
1274
1306
|
userAgent: T,
|
|
1275
1307
|
remoteAddress: r,
|
|
1276
1308
|
extraHeaders: E
|
|
1277
1309
|
},
|
|
1278
1310
|
this.events
|
|
1279
1311
|
);
|
|
1280
|
-
return this.setUa(
|
|
1312
|
+
return this.setUa(N), this.setSipServerUrl(M.getSipServerUrl), this.setSocket(M.socket), N;
|
|
1281
1313
|
};
|
|
1282
1314
|
start = async () => new Promise((e, t) => {
|
|
1283
1315
|
const s = this.getUa();
|
|
@@ -1286,29 +1318,38 @@ class Tt {
|
|
|
1286
1318
|
return;
|
|
1287
1319
|
}
|
|
1288
1320
|
let i;
|
|
1289
|
-
i = ((
|
|
1321
|
+
i = ((h, d) => {
|
|
1290
1322
|
if (this.getConnectionConfiguration()?.register === !0)
|
|
1291
|
-
return this.registrationManager.subscribeToStartEvents(
|
|
1323
|
+
return this.registrationManager.subscribeToStartEvents(h, d);
|
|
1292
1324
|
const S = C.CONNECTED, u = [C.DISCONNECTED];
|
|
1293
|
-
return this.events.on(S,
|
|
1294
|
-
this.events.on(E,
|
|
1325
|
+
return this.events.on(S, h), u.forEach((E) => {
|
|
1326
|
+
this.events.on(E, d);
|
|
1295
1327
|
}), () => {
|
|
1296
|
-
this.events.off(S,
|
|
1297
|
-
this.events.off(E,
|
|
1328
|
+
this.events.off(S, h), u.forEach((E) => {
|
|
1329
|
+
this.events.off(E, d);
|
|
1298
1330
|
});
|
|
1299
1331
|
};
|
|
1300
1332
|
})(() => {
|
|
1301
1333
|
i?.(), e(s);
|
|
1302
|
-
}, (
|
|
1303
|
-
i?.(), t(
|
|
1334
|
+
}, (h) => {
|
|
1335
|
+
i?.(), t(h);
|
|
1304
1336
|
}), s.start();
|
|
1305
1337
|
});
|
|
1306
1338
|
cancelConnectWithRepeatedCalls() {
|
|
1307
1339
|
this.cancelableConnectWithRepeatedCalls?.cancel();
|
|
1308
1340
|
}
|
|
1341
|
+
proxyEvents() {
|
|
1342
|
+
this.events.on(C.CONNECTED, () => {
|
|
1343
|
+
const e = this.getConnectionConfiguration(), t = this.getUa();
|
|
1344
|
+
e !== void 0 && t !== void 0 && this.events.trigger(C.CONNECTED_WITH_CONFIGURATION, {
|
|
1345
|
+
...e,
|
|
1346
|
+
ua: t
|
|
1347
|
+
});
|
|
1348
|
+
});
|
|
1349
|
+
}
|
|
1309
1350
|
}
|
|
1310
1351
|
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 || {});
|
|
1311
|
-
const
|
|
1352
|
+
const Ct = ye({
|
|
1312
1353
|
types: {
|
|
1313
1354
|
context: {},
|
|
1314
1355
|
events: {}
|
|
@@ -1622,14 +1663,14 @@ const St = ye({
|
|
|
1622
1663
|
}
|
|
1623
1664
|
}
|
|
1624
1665
|
});
|
|
1625
|
-
class
|
|
1666
|
+
class Et {
|
|
1626
1667
|
actor;
|
|
1627
1668
|
stateChangeListeners = /* @__PURE__ */ new Set();
|
|
1628
1669
|
events;
|
|
1629
1670
|
unsubscribeFromEvents;
|
|
1630
1671
|
actorSubscription;
|
|
1631
1672
|
constructor(e) {
|
|
1632
|
-
this.events = e, this.actor =
|
|
1673
|
+
this.events = e, this.actor = De(Ct), this.actorSubscription = this.actor.subscribe((t) => {
|
|
1633
1674
|
const s = t.value;
|
|
1634
1675
|
this.stateChangeListeners.forEach((i) => {
|
|
1635
1676
|
i(s);
|
|
@@ -1784,7 +1825,7 @@ class Ct {
|
|
|
1784
1825
|
};
|
|
1785
1826
|
}
|
|
1786
1827
|
}
|
|
1787
|
-
class
|
|
1828
|
+
class At {
|
|
1788
1829
|
events;
|
|
1789
1830
|
getUaProtected;
|
|
1790
1831
|
constructor(e) {
|
|
@@ -1821,7 +1862,7 @@ class Et {
|
|
|
1821
1862
|
};
|
|
1822
1863
|
}
|
|
1823
1864
|
}
|
|
1824
|
-
class
|
|
1865
|
+
class Rt {
|
|
1825
1866
|
uaFactory;
|
|
1826
1867
|
getUaProtected;
|
|
1827
1868
|
constructor(e) {
|
|
@@ -1866,15 +1907,15 @@ class At {
|
|
|
1866
1907
|
remoteAddress: r,
|
|
1867
1908
|
extraHeaders: a
|
|
1868
1909
|
}) {
|
|
1869
|
-
return new Promise((o,
|
|
1870
|
-
const { configuration:
|
|
1910
|
+
return new Promise((o, h) => {
|
|
1911
|
+
const { configuration: d } = this.uaFactory.createConfiguration({
|
|
1871
1912
|
sipWebSocketServerURL: i,
|
|
1872
1913
|
displayName: t,
|
|
1873
1914
|
userAgent: e,
|
|
1874
1915
|
sipServerUrl: s
|
|
1875
|
-
}), T = this.uaFactory.createUA({ ...
|
|
1916
|
+
}), T = this.uaFactory.createUA({ ...d, remoteAddress: r, extraHeaders: a }), S = () => {
|
|
1876
1917
|
const E = new Error("Telephony is not available");
|
|
1877
|
-
|
|
1918
|
+
h(E);
|
|
1878
1919
|
};
|
|
1879
1920
|
T.once(C.DISCONNECTED, S);
|
|
1880
1921
|
const u = () => {
|
|
@@ -1886,7 +1927,7 @@ class At {
|
|
|
1886
1927
|
});
|
|
1887
1928
|
}
|
|
1888
1929
|
}
|
|
1889
|
-
const
|
|
1930
|
+
const Nt = (n) => {
|
|
1890
1931
|
const e = [];
|
|
1891
1932
|
return n !== void 0 && n !== "" && e.push(`X-Vinteo-Remote: ${n}`), e;
|
|
1892
1933
|
};
|
|
@@ -1915,10 +1956,10 @@ class y {
|
|
|
1915
1956
|
throw new Error("user is required for authorized connection");
|
|
1916
1957
|
}
|
|
1917
1958
|
static resolveAuthorizationUser(e, t) {
|
|
1918
|
-
return e && t !== void 0 && t.trim() !== "" ? t.trim() : `${
|
|
1959
|
+
return e && t !== void 0 && t.trim() !== "" ? t.trim() : `${We()}`;
|
|
1919
1960
|
}
|
|
1920
1961
|
static buildExtraHeaders(e, t) {
|
|
1921
|
-
const s = e !== void 0 && e !== "" ?
|
|
1962
|
+
const s = e !== void 0 && e !== "" ? Nt(e) : [];
|
|
1922
1963
|
return t === void 0 ? s : [...s, ...t];
|
|
1923
1964
|
}
|
|
1924
1965
|
createConfiguration({
|
|
@@ -1929,9 +1970,9 @@ class y {
|
|
|
1929
1970
|
sipServerUrl: r,
|
|
1930
1971
|
register: a = !1,
|
|
1931
1972
|
sessionTimers: o = !1,
|
|
1932
|
-
registerExpires:
|
|
1973
|
+
registerExpires: h = 300,
|
|
1933
1974
|
// 5 minutes in sec
|
|
1934
|
-
connectionRecoveryMinInterval:
|
|
1975
|
+
connectionRecoveryMinInterval: d = 2,
|
|
1935
1976
|
connectionRecoveryMaxInterval: T = 6,
|
|
1936
1977
|
userAgent: S
|
|
1937
1978
|
}) {
|
|
@@ -1942,23 +1983,23 @@ class y {
|
|
|
1942
1983
|
sipServerUrl: r,
|
|
1943
1984
|
sipWebSocketServerURL: s
|
|
1944
1985
|
});
|
|
1945
|
-
const u = y.resolveAuthorizationUser(a, e), E =
|
|
1986
|
+
const u = y.resolveAuthorizationUser(a, e), E = Ve(r), I = E(u), N = new this.JsSIP.WebSocketInterface(s);
|
|
1946
1987
|
return {
|
|
1947
1988
|
configuration: {
|
|
1948
1989
|
password: t,
|
|
1949
1990
|
register: a,
|
|
1950
|
-
uri:
|
|
1991
|
+
uri: I,
|
|
1951
1992
|
display_name: ae(i),
|
|
1952
1993
|
user_agent: S,
|
|
1953
1994
|
sdpSemantics: "unified-plan",
|
|
1954
|
-
sockets: [
|
|
1995
|
+
sockets: [N],
|
|
1955
1996
|
session_timers: o,
|
|
1956
|
-
register_expires:
|
|
1957
|
-
connection_recovery_min_interval:
|
|
1997
|
+
register_expires: h,
|
|
1998
|
+
connection_recovery_min_interval: d,
|
|
1958
1999
|
connection_recovery_max_interval: T
|
|
1959
2000
|
},
|
|
1960
2001
|
helpers: {
|
|
1961
|
-
socket:
|
|
2002
|
+
socket: N,
|
|
1962
2003
|
getSipServerUrl: E
|
|
1963
2004
|
}
|
|
1964
2005
|
};
|
|
@@ -1977,13 +2018,13 @@ class y {
|
|
|
1977
2018
|
extraHeaders: e.extraHeaders
|
|
1978
2019
|
});
|
|
1979
2020
|
return t.eachTriggers((a, o) => {
|
|
1980
|
-
const
|
|
1981
|
-
|
|
2021
|
+
const h = ue.find((d) => d === o);
|
|
2022
|
+
h && r.on(h, a);
|
|
1982
2023
|
}), { ua: r, helpers: i };
|
|
1983
2024
|
}
|
|
1984
2025
|
}
|
|
1985
|
-
const Se = "Not ready for connection",
|
|
1986
|
-
class
|
|
2026
|
+
const Se = "Not ready for connection", mt = (n) => n instanceof Error && n.message === Se, It = () => new Error(Se), pt = async (n) => typeof n == "function" ? n() : n;
|
|
2027
|
+
class _t {
|
|
1987
2028
|
events;
|
|
1988
2029
|
ua;
|
|
1989
2030
|
socket;
|
|
@@ -1995,15 +2036,15 @@ class mt {
|
|
|
1995
2036
|
configurationManager;
|
|
1996
2037
|
JsSIP;
|
|
1997
2038
|
constructor({ JsSIP: e }) {
|
|
1998
|
-
this.JsSIP = e, this.events = new
|
|
2039
|
+
this.JsSIP = e, this.events = new w(ge), this.uaFactory = new y(e), this.registrationManager = new At({
|
|
1999
2040
|
events: this.events,
|
|
2000
2041
|
getUaProtected: this.getUaProtected
|
|
2001
|
-
}), this.stateMachine = new
|
|
2042
|
+
}), this.stateMachine = new Et(this.events), this.configurationManager = new ut({
|
|
2002
2043
|
getUa: this.getUa
|
|
2003
|
-
}), this.sipOperations = new
|
|
2044
|
+
}), this.sipOperations = new Rt({
|
|
2004
2045
|
uaFactory: this.uaFactory,
|
|
2005
2046
|
getUaProtected: this.getUaProtected
|
|
2006
|
-
}), this.connectionFlow = new
|
|
2047
|
+
}), this.connectionFlow = new St({
|
|
2007
2048
|
JsSIP: this.JsSIP,
|
|
2008
2049
|
events: this.events,
|
|
2009
2050
|
uaFactory: this.uaFactory,
|
|
@@ -2105,7 +2146,7 @@ class mt {
|
|
|
2105
2146
|
getUa = () => this.ua;
|
|
2106
2147
|
connectWithProcessError = async (e, t) => {
|
|
2107
2148
|
if (!(t?.hasReadyForConnection?.() ?? !0))
|
|
2108
|
-
throw
|
|
2149
|
+
throw It();
|
|
2109
2150
|
return this.processConnect(e, t).catch(async (i) => {
|
|
2110
2151
|
const r = i;
|
|
2111
2152
|
return this.disconnect().then(() => {
|
|
@@ -2115,7 +2156,7 @@ class mt {
|
|
|
2115
2156
|
});
|
|
2116
2157
|
});
|
|
2117
2158
|
};
|
|
2118
|
-
processConnect = async (e, t) => (this.events.trigger(C.CONNECT_STARTED, {}),
|
|
2159
|
+
processConnect = async (e, t) => (this.events.trigger(C.CONNECT_STARTED, {}), pt(e).then((s) => (this.events.trigger(C.CONNECT_PARAMETERS_RESOLVE_SUCCESS, s), s)).catch((s) => {
|
|
2119
2160
|
throw this.events.trigger(C.CONNECT_PARAMETERS_RESOLVE_FAILED, s), s;
|
|
2120
2161
|
}).then(async (s) => this.connectionFlow.connect(s, t)).then((s) => (this.events.trigger(C.CONNECT_SUCCEEDED, {
|
|
2121
2162
|
...s
|
|
@@ -2124,7 +2165,7 @@ class mt {
|
|
|
2124
2165
|
throw this.events.trigger(C.CONNECT_FAILED, i), i;
|
|
2125
2166
|
}));
|
|
2126
2167
|
}
|
|
2127
|
-
class
|
|
2168
|
+
class Mt {
|
|
2128
2169
|
connectionManager;
|
|
2129
2170
|
stackPromises = ne({
|
|
2130
2171
|
noRunIsNotActual: !0
|
|
@@ -2138,11 +2179,11 @@ class _t {
|
|
|
2138
2179
|
this.stackPromises.stop();
|
|
2139
2180
|
}
|
|
2140
2181
|
}
|
|
2141
|
-
const z = 0,
|
|
2182
|
+
const z = 0, vt = 30;
|
|
2142
2183
|
class ft {
|
|
2143
2184
|
countInner = z;
|
|
2144
2185
|
initialCount = z;
|
|
2145
|
-
limitInner =
|
|
2186
|
+
limitInner = vt;
|
|
2146
2187
|
isInProgress = !1;
|
|
2147
2188
|
onStatusChange;
|
|
2148
2189
|
constructor({
|
|
@@ -2175,7 +2216,7 @@ class ft {
|
|
|
2175
2216
|
this.countInner = this.initialCount, this.finishAttempt();
|
|
2176
2217
|
}
|
|
2177
2218
|
}
|
|
2178
|
-
class
|
|
2219
|
+
class Pt {
|
|
2179
2220
|
connectionManager;
|
|
2180
2221
|
interval;
|
|
2181
2222
|
checkTelephonyByTimeout = void 0;
|
|
@@ -2211,7 +2252,7 @@ class vt {
|
|
|
2211
2252
|
this.checkTelephonyByTimeout?.stop(), this.checkTelephonyByTimeout = void 0, this.cancelableBeforeRequest?.cancelRequest(), this.cancelableBeforeRequest = void 0;
|
|
2212
2253
|
}
|
|
2213
2254
|
}
|
|
2214
|
-
var
|
|
2255
|
+
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))(_ || {});
|
|
2215
2256
|
const Ce = [
|
|
2216
2257
|
"before-attempt",
|
|
2217
2258
|
"success",
|
|
@@ -2220,15 +2261,15 @@ const Ce = [
|
|
|
2220
2261
|
"changed-attempt-status",
|
|
2221
2262
|
"stop-attempts-by-error",
|
|
2222
2263
|
"limit-reached-attempts"
|
|
2223
|
-
],
|
|
2224
|
-
class
|
|
2264
|
+
], Ot = 15e3, yt = 2;
|
|
2265
|
+
class Dt {
|
|
2225
2266
|
connectionManager;
|
|
2226
2267
|
pingServerByTimeoutWithFailCalls;
|
|
2227
2268
|
constructor({ connectionManager: e }) {
|
|
2228
|
-
this.connectionManager = e, this.pingServerByTimeoutWithFailCalls =
|
|
2269
|
+
this.connectionManager = e, this.pingServerByTimeoutWithFailCalls = ve(yt, {
|
|
2229
2270
|
whenPossibleRequest: async () => {
|
|
2230
2271
|
},
|
|
2231
|
-
requestInterval:
|
|
2272
|
+
requestInterval: Ot,
|
|
2232
2273
|
request: async () => (c("ping"), this.connectionManager.ping().then(() => {
|
|
2233
2274
|
c("ping success");
|
|
2234
2275
|
}))
|
|
@@ -2249,7 +2290,7 @@ class bt {
|
|
|
2249
2290
|
connectionManager: e,
|
|
2250
2291
|
callManager: t
|
|
2251
2292
|
}) {
|
|
2252
|
-
this.callManager = t, this.pingServerRequester = new
|
|
2293
|
+
this.callManager = t, this.pingServerRequester = new Dt({
|
|
2253
2294
|
connectionManager: e
|
|
2254
2295
|
});
|
|
2255
2296
|
}
|
|
@@ -2268,7 +2309,7 @@ class bt {
|
|
|
2268
2309
|
this.callManager.isCallActive ? this.pingServerRequester.stop() : this.pingServerRequester.start({ onFailRequest: e });
|
|
2269
2310
|
}
|
|
2270
2311
|
}
|
|
2271
|
-
class
|
|
2312
|
+
class wt {
|
|
2272
2313
|
connectionManager;
|
|
2273
2314
|
callManager;
|
|
2274
2315
|
isRegistrationFailed = !1;
|
|
@@ -2302,12 +2343,12 @@ class Dt {
|
|
|
2302
2343
|
this.isRegistrationFailed = !1;
|
|
2303
2344
|
}
|
|
2304
2345
|
}
|
|
2305
|
-
const
|
|
2346
|
+
const Ut = 3e3, Lt = 15e3, X = {
|
|
2306
2347
|
LIMIT_REACHED: "Limit reached",
|
|
2307
2348
|
FAILED_TO_RECONNECT: "Failed to reconnect"
|
|
2308
|
-
},
|
|
2309
|
-
},
|
|
2310
|
-
class
|
|
2349
|
+
}, Bt = async () => {
|
|
2350
|
+
}, Ft = (n) => !0;
|
|
2351
|
+
class kt {
|
|
2311
2352
|
events;
|
|
2312
2353
|
connectionManager;
|
|
2313
2354
|
connectionQueueManager;
|
|
@@ -2326,20 +2367,20 @@ class Ft {
|
|
|
2326
2367
|
connectionManager: t,
|
|
2327
2368
|
callManager: s
|
|
2328
2369
|
}, i) {
|
|
2329
|
-
const r = i?.onBeforeRetry ??
|
|
2330
|
-
this.connectionQueueManager = e, this.connectionManager = t, this.onBeforeRetry = r, this.canRetryOnError = a, this.networkInterfacesSubscriber = i?.networkInterfacesSubscriber, this.resumeFromSleepModeSubscriber = i?.resumeFromSleepModeSubscriber, this.events = new
|
|
2370
|
+
const r = i?.onBeforeRetry ?? Bt, a = i?.canRetryOnError ?? Ft;
|
|
2371
|
+
this.connectionQueueManager = e, this.connectionManager = t, this.onBeforeRetry = r, this.canRetryOnError = a, this.networkInterfacesSubscriber = i?.networkInterfacesSubscriber, this.resumeFromSleepModeSubscriber = i?.resumeFromSleepModeSubscriber, this.events = new w(Ce), this.checkTelephonyRequester = new Pt({
|
|
2331
2372
|
connectionManager: t,
|
|
2332
|
-
interval: i?.checkTelephonyRequestInterval ??
|
|
2373
|
+
interval: i?.checkTelephonyRequestInterval ?? Lt
|
|
2333
2374
|
}), this.pingServerIfNotActiveCallRequester = new bt({
|
|
2334
2375
|
connectionManager: t,
|
|
2335
2376
|
callManager: s
|
|
2336
|
-
}), this.registrationFailedOutOfCallSubscriber = new
|
|
2377
|
+
}), this.registrationFailedOutOfCallSubscriber = new wt({
|
|
2337
2378
|
connectionManager: t,
|
|
2338
2379
|
callManager: s
|
|
2339
2380
|
}), this.attemptsState = new ft({
|
|
2340
2381
|
onStatusChange: this.emitStatusChange
|
|
2341
|
-
}), this.cancelableRequestBeforeRetry = new G(r), this.delayBetweenAttempts = new
|
|
2342
|
-
i?.timeoutBetweenAttempts ??
|
|
2382
|
+
}), this.cancelableRequestBeforeRetry = new G(r), this.delayBetweenAttempts = new fe(
|
|
2383
|
+
i?.timeoutBetweenAttempts ?? Ut
|
|
2343
2384
|
);
|
|
2344
2385
|
}
|
|
2345
2386
|
start(e) {
|
|
@@ -2391,7 +2432,7 @@ class Ft {
|
|
|
2391
2432
|
});
|
|
2392
2433
|
}
|
|
2393
2434
|
async attemptConnection(e) {
|
|
2394
|
-
if (c("attemptConnection: attempts.count", this.attemptsState.count), this.events.trigger(
|
|
2435
|
+
if (c("attemptConnection: attempts.count", this.attemptsState.count), this.events.trigger(_.BEFORE_ATTEMPT, {}), this.stopConnectTriggers(), this.attemptsState.hasLimitReached()) {
|
|
2395
2436
|
c("attemptConnection: limit reached"), this.handleLimitReached(e);
|
|
2396
2437
|
return;
|
|
2397
2438
|
}
|
|
@@ -2405,25 +2446,25 @@ class Ft {
|
|
|
2405
2446
|
}
|
|
2406
2447
|
}
|
|
2407
2448
|
handleConnectionError(e, t) {
|
|
2408
|
-
if (
|
|
2409
|
-
this.attemptsState.finishAttempt(), this.
|
|
2449
|
+
if (mt(e)) {
|
|
2450
|
+
this.attemptsState.finishAttempt(), this.events.trigger(_.STOP_ATTEMPTS_BY_ERROR, e);
|
|
2410
2451
|
return;
|
|
2411
2452
|
}
|
|
2412
2453
|
if (!this.canRetryOnError(e)) {
|
|
2413
|
-
c("executeConnectionAttempt: error does not allow retry", e), this.attemptsState.finishAttempt(), this.events.trigger(
|
|
2454
|
+
c("executeConnectionAttempt: error does not allow retry", e), this.attemptsState.finishAttempt(), this.events.trigger(_.STOP_ATTEMPTS_BY_ERROR, e);
|
|
2414
2455
|
return;
|
|
2415
2456
|
}
|
|
2416
|
-
if (
|
|
2417
|
-
c("executeConnectionAttempt: not actual error", e), this.attemptsState.finishAttempt(), this.events.trigger(
|
|
2457
|
+
if (be(e)) {
|
|
2458
|
+
c("executeConnectionAttempt: not actual error", e), this.attemptsState.finishAttempt(), this.events.trigger(_.CANCELLED_ATTEMPTS, e);
|
|
2418
2459
|
return;
|
|
2419
2460
|
}
|
|
2420
2461
|
c("executeConnectionAttempt: error", e), this.scheduleReconnect(t);
|
|
2421
2462
|
}
|
|
2422
2463
|
handleLimitReached(e) {
|
|
2423
|
-
this.attemptsState.finishAttempt(), this.events.trigger(
|
|
2464
|
+
this.attemptsState.finishAttempt(), this.events.trigger(_.LIMIT_REACHED_ATTEMPTS, new Error(X.LIMIT_REACHED)), this.startCheckTelephony(e);
|
|
2424
2465
|
}
|
|
2425
2466
|
handleSucceededAttempt(e) {
|
|
2426
|
-
c("handleSucceededAttempt"), this.subscribeToConnectTriggers(e), this.events.trigger(
|
|
2467
|
+
c("handleSucceededAttempt"), this.subscribeToConnectTriggers(e), this.events.trigger(_.SUCCESS);
|
|
2427
2468
|
}
|
|
2428
2469
|
subscribeToConnectTriggers(e) {
|
|
2429
2470
|
this.startPingRequester(e), this.registrationFailedOutOfCallSubscriber.subscribe(() => {
|
|
@@ -2459,12 +2500,12 @@ class Ft {
|
|
|
2459
2500
|
}
|
|
2460
2501
|
connectIfDisconnected(e) {
|
|
2461
2502
|
const t = this.isConnectionUnavailable();
|
|
2462
|
-
c("connectIfDisconnected: isUnavailable", t), t ? this.restartConnectionAttempts(e) : (this.stopConnectTriggers(), this.events.trigger(
|
|
2503
|
+
c("connectIfDisconnected: isUnavailable", t), t ? this.restartConnectionAttempts(e) : (this.stopConnectTriggers(), this.events.trigger(_.SUCCESS));
|
|
2463
2504
|
}
|
|
2464
2505
|
scheduleReconnect(e) {
|
|
2465
2506
|
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) => {
|
|
2466
2507
|
const s = t instanceof Error ? t : new Error(X.FAILED_TO_RECONNECT);
|
|
2467
|
-
this.attemptsState.finishAttempt(), _e(t) || Pe(t) ? this.events.trigger(
|
|
2508
|
+
this.attemptsState.finishAttempt(), _e(t) || Pe(t) ? this.events.trigger(_.CANCELLED_ATTEMPTS, s) : this.events.trigger(_.FAILED_ALL_ATTEMPTS, s), c("scheduleReconnect: error", t);
|
|
2468
2509
|
});
|
|
2469
2510
|
}
|
|
2470
2511
|
isConnectionUnavailable() {
|
|
@@ -2472,22 +2513,22 @@ class Ft {
|
|
|
2472
2513
|
return e || t || s;
|
|
2473
2514
|
}
|
|
2474
2515
|
emitStatusChange = ({ isInProgress: e }) => {
|
|
2475
|
-
this.events.trigger(
|
|
2516
|
+
this.events.trigger(_.CHANGED_ATTEMPT_STATUS, { isInProgress: e });
|
|
2476
2517
|
};
|
|
2477
2518
|
}
|
|
2478
|
-
var
|
|
2519
|
+
var b = /* @__PURE__ */ ((n) => (n.INCOMING_CALL = "incomingCall", n.DECLINED_INCOMING_CALL = "declinedIncomingCall", n.TERMINATED_INCOMING_CALL = "terminatedIncomingCall", n.FAILED_INCOMING_CALL = "failedIncomingCall", n))(b || {});
|
|
2479
2520
|
const Ee = [
|
|
2480
2521
|
"incomingCall",
|
|
2481
2522
|
"declinedIncomingCall",
|
|
2482
2523
|
"terminatedIncomingCall",
|
|
2483
2524
|
"failedIncomingCall"
|
|
2484
|
-
],
|
|
2485
|
-
class
|
|
2525
|
+
], $t = 486, qt = 487;
|
|
2526
|
+
class Vt {
|
|
2486
2527
|
events;
|
|
2487
2528
|
incomingRTCSession;
|
|
2488
2529
|
connectionManager;
|
|
2489
2530
|
constructor(e) {
|
|
2490
|
-
this.connectionManager = e, this.events = new
|
|
2531
|
+
this.connectionManager = e, this.events = new F(Ee), this.start();
|
|
2491
2532
|
}
|
|
2492
2533
|
get remoteCallerData() {
|
|
2493
2534
|
return {
|
|
@@ -2517,19 +2558,19 @@ class qt {
|
|
|
2517
2558
|
return this.removeIncomingSession(), e;
|
|
2518
2559
|
};
|
|
2519
2560
|
async declineToIncomingCall({
|
|
2520
|
-
statusCode: e =
|
|
2561
|
+
statusCode: e = qt
|
|
2521
2562
|
} = {}) {
|
|
2522
2563
|
return new Promise((t, s) => {
|
|
2523
2564
|
try {
|
|
2524
2565
|
const i = this.getIncomingRTCSession(), r = this.remoteCallerData;
|
|
2525
|
-
this.removeIncomingSession(), this.events.trigger(
|
|
2566
|
+
this.removeIncomingSession(), this.events.trigger(b.DECLINED_INCOMING_CALL, r), i.terminate({ status_code: e }), t();
|
|
2526
2567
|
} catch (i) {
|
|
2527
2568
|
s(i);
|
|
2528
2569
|
}
|
|
2529
2570
|
});
|
|
2530
2571
|
}
|
|
2531
2572
|
async busyIncomingCall() {
|
|
2532
|
-
return this.declineToIncomingCall({ statusCode:
|
|
2573
|
+
return this.declineToIncomingCall({ statusCode: $t });
|
|
2533
2574
|
}
|
|
2534
2575
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
2535
2576
|
on(e, t) {
|
|
@@ -2566,8 +2607,8 @@ class qt {
|
|
|
2566
2607
|
this.incomingRTCSession = e;
|
|
2567
2608
|
const t = this.remoteCallerData;
|
|
2568
2609
|
e.on("failed", (s) => {
|
|
2569
|
-
this.removeIncomingSession(), s.originator === "local" ? this.events.trigger(
|
|
2570
|
-
}), this.events.trigger(
|
|
2610
|
+
this.removeIncomingSession(), s.originator === "local" ? this.events.trigger(b.TERMINATED_INCOMING_CALL, t) : this.events.trigger(b.FAILED_INCOMING_CALL, t);
|
|
2611
|
+
}), this.events.trigger(b.INCOMING_CALL, t);
|
|
2571
2612
|
}
|
|
2572
2613
|
removeIncomingSession() {
|
|
2573
2614
|
delete this.incomingRTCSession;
|
|
@@ -2575,10 +2616,10 @@ class qt {
|
|
|
2575
2616
|
}
|
|
2576
2617
|
const D = 1e3;
|
|
2577
2618
|
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 || {});
|
|
2578
|
-
const Ae = ["collected"], J = () => "performance" in window ? performance.now() : Date.now(),
|
|
2619
|
+
const Ae = ["collected"], J = () => "performance" in window ? performance.now() : Date.now(), U = (n) => [...n.keys()].reduce((e, t) => {
|
|
2579
2620
|
const s = n.get(t);
|
|
2580
2621
|
return s === void 0 ? e : { ...e, [s.type]: s };
|
|
2581
|
-
}, {}),
|
|
2622
|
+
}, {}), Ht = (n) => {
|
|
2582
2623
|
if (!n)
|
|
2583
2624
|
return {
|
|
2584
2625
|
outboundRtp: void 0,
|
|
@@ -2586,7 +2627,7 @@ const Ae = ["collected"], J = () => "performance" in window ? performance.now()
|
|
|
2586
2627
|
mediaSource: void 0,
|
|
2587
2628
|
remoteInboundRtp: void 0
|
|
2588
2629
|
};
|
|
2589
|
-
const e =
|
|
2630
|
+
const e = U(n);
|
|
2590
2631
|
return {
|
|
2591
2632
|
outboundRtp: e[A.OUTBOUND_RTP],
|
|
2592
2633
|
codec: e[A.CODEC],
|
|
@@ -2601,7 +2642,7 @@ const Ae = ["collected"], J = () => "performance" in window ? performance.now()
|
|
|
2601
2642
|
mediaSource: void 0,
|
|
2602
2643
|
remoteInboundRtp: void 0
|
|
2603
2644
|
};
|
|
2604
|
-
const e =
|
|
2645
|
+
const e = U(n);
|
|
2605
2646
|
return {
|
|
2606
2647
|
outboundRtp: e[A.OUTBOUND_RTP],
|
|
2607
2648
|
codec: e[A.CODEC],
|
|
@@ -2618,13 +2659,13 @@ const Ae = ["collected"], J = () => "performance" in window ? performance.now()
|
|
|
2618
2659
|
codec: void 0,
|
|
2619
2660
|
synchronizationSources: e
|
|
2620
2661
|
};
|
|
2621
|
-
const t =
|
|
2662
|
+
const t = U(n);
|
|
2622
2663
|
return {
|
|
2623
2664
|
inboundRtp: t[A.INBOUND_RTP],
|
|
2624
2665
|
codec: t[A.CODEC],
|
|
2625
2666
|
synchronizationSources: e
|
|
2626
2667
|
};
|
|
2627
|
-
},
|
|
2668
|
+
}, Wt = ({
|
|
2628
2669
|
audioReceiverStats: n,
|
|
2629
2670
|
synchronizationSourcesAudio: e
|
|
2630
2671
|
}) => {
|
|
@@ -2635,7 +2676,7 @@ const Ae = ["collected"], J = () => "performance" in window ? performance.now()
|
|
|
2635
2676
|
remoteOutboundRtp: void 0,
|
|
2636
2677
|
synchronizationSources: e
|
|
2637
2678
|
};
|
|
2638
|
-
const t =
|
|
2679
|
+
const t = U(n);
|
|
2639
2680
|
return {
|
|
2640
2681
|
inboundRtp: t[A.INBOUND_RTP],
|
|
2641
2682
|
codec: t[A.CODEC],
|
|
@@ -2651,7 +2692,7 @@ const Ae = ["collected"], J = () => "performance" in window ? performance.now()
|
|
|
2651
2692
|
remoteCandidate: void 0,
|
|
2652
2693
|
transport: void 0
|
|
2653
2694
|
};
|
|
2654
|
-
const e =
|
|
2695
|
+
const e = U(n);
|
|
2655
2696
|
return {
|
|
2656
2697
|
candidatePair: e[A.CANDIDATE_PAIR],
|
|
2657
2698
|
certificate: e[A.CERTIFICATE],
|
|
@@ -2659,18 +2700,18 @@ const Ae = ["collected"], J = () => "performance" in window ? performance.now()
|
|
|
2659
2700
|
remoteCandidate: e[A.REMOTE_CANDIDATE],
|
|
2660
2701
|
transport: e[A.TRANSPORT]
|
|
2661
2702
|
};
|
|
2662
|
-
},
|
|
2703
|
+
}, xt = ({
|
|
2663
2704
|
audioSenderStats: n,
|
|
2664
2705
|
videoSenderFirstStats: e,
|
|
2665
2706
|
videoSenderSecondStats: t
|
|
2666
2707
|
}) => ({
|
|
2667
2708
|
video: K(e),
|
|
2668
2709
|
secondVideo: K(t),
|
|
2669
|
-
audio:
|
|
2710
|
+
audio: Ht(n),
|
|
2670
2711
|
additional: Re(
|
|
2671
2712
|
n ?? e ?? t
|
|
2672
2713
|
)
|
|
2673
|
-
}),
|
|
2714
|
+
}), Gt = ({
|
|
2674
2715
|
audioReceiverStats: n,
|
|
2675
2716
|
videoReceiverFirstStats: e,
|
|
2676
2717
|
videoReceiverSecondStats: t,
|
|
@@ -2684,14 +2725,14 @@ const Ae = ["collected"], J = () => "performance" in window ? performance.now()
|
|
|
2684
2725
|
videoReceiversStats: t,
|
|
2685
2726
|
synchronizationSourcesVideo: s.video
|
|
2686
2727
|
}),
|
|
2687
|
-
audio:
|
|
2728
|
+
audio: Wt({
|
|
2688
2729
|
audioReceiverStats: n,
|
|
2689
2730
|
synchronizationSourcesAudio: s.audio
|
|
2690
2731
|
}),
|
|
2691
2732
|
additional: Re(
|
|
2692
2733
|
n ?? e ?? t
|
|
2693
2734
|
)
|
|
2694
|
-
}),
|
|
2735
|
+
}), Qt = ({
|
|
2695
2736
|
audioSenderStats: n,
|
|
2696
2737
|
videoSenderFirstStats: e,
|
|
2697
2738
|
videoSenderSecondStats: t,
|
|
@@ -2700,11 +2741,11 @@ const Ae = ["collected"], J = () => "performance" in window ? performance.now()
|
|
|
2700
2741
|
videoReceiverSecondStats: r,
|
|
2701
2742
|
synchronizationSources: a
|
|
2702
2743
|
}) => {
|
|
2703
|
-
const o =
|
|
2744
|
+
const o = xt({
|
|
2704
2745
|
audioSenderStats: n,
|
|
2705
2746
|
videoSenderFirstStats: e,
|
|
2706
2747
|
videoSenderSecondStats: t
|
|
2707
|
-
}),
|
|
2748
|
+
}), h = Gt({
|
|
2708
2749
|
audioReceiverStats: s,
|
|
2709
2750
|
videoReceiverFirstStats: i,
|
|
2710
2751
|
videoReceiverSecondStats: r,
|
|
@@ -2712,17 +2753,17 @@ const Ae = ["collected"], J = () => "performance" in window ? performance.now()
|
|
|
2712
2753
|
});
|
|
2713
2754
|
return {
|
|
2714
2755
|
outbound: o,
|
|
2715
|
-
inbound:
|
|
2756
|
+
inbound: h
|
|
2716
2757
|
};
|
|
2717
|
-
},
|
|
2718
|
-
const e = "audio", t = "video", s = n.getSenders(), i = s.find((u) => u.track?.kind === e), r = s.filter((u) => u.track?.kind === t), a = n.getReceivers(), o = a.find((u) => u.track.kind === e),
|
|
2758
|
+
}, Yt = async (n) => {
|
|
2759
|
+
const e = "audio", t = "video", s = n.getSenders(), i = s.find((u) => u.track?.kind === e), r = s.filter((u) => u.track?.kind === t), a = n.getReceivers(), o = a.find((u) => u.track.kind === e), h = a.filter((u) => u.track.kind === t), d = {
|
|
2719
2760
|
trackIdentifier: o?.track.id,
|
|
2720
2761
|
item: o?.getSynchronizationSources()[0]
|
|
2721
2762
|
}, T = {
|
|
2722
|
-
trackIdentifier:
|
|
2723
|
-
item:
|
|
2763
|
+
trackIdentifier: h[0]?.track.id,
|
|
2764
|
+
item: h[0]?.getSynchronizationSources()[0]
|
|
2724
2765
|
}, S = {
|
|
2725
|
-
audio:
|
|
2766
|
+
audio: d,
|
|
2726
2767
|
video: T
|
|
2727
2768
|
};
|
|
2728
2769
|
return Promise.all([
|
|
@@ -2730,43 +2771,43 @@ const Ae = ["collected"], J = () => "performance" in window ? performance.now()
|
|
|
2730
2771
|
r[0]?.getStats() ?? Promise.resolve(void 0),
|
|
2731
2772
|
r[1]?.getStats() ?? Promise.resolve(void 0),
|
|
2732
2773
|
o?.getStats() ?? Promise.resolve(void 0),
|
|
2733
|
-
|
|
2734
|
-
|
|
2774
|
+
h[0]?.getStats() ?? Promise.resolve(void 0),
|
|
2775
|
+
h[1]?.getStats() ?? Promise.resolve(void 0)
|
|
2735
2776
|
]).then((u) => {
|
|
2736
2777
|
const [
|
|
2737
2778
|
E,
|
|
2738
|
-
|
|
2739
|
-
p,
|
|
2779
|
+
I,
|
|
2740
2780
|
N,
|
|
2741
|
-
|
|
2781
|
+
M,
|
|
2782
|
+
k,
|
|
2742
2783
|
$
|
|
2743
2784
|
] = u;
|
|
2744
2785
|
return {
|
|
2745
2786
|
synchronizationSources: S,
|
|
2746
2787
|
audioSenderStats: E,
|
|
2747
|
-
videoSenderFirstStats:
|
|
2748
|
-
videoSenderSecondStats:
|
|
2749
|
-
audioReceiverStats:
|
|
2750
|
-
videoReceiverFirstStats:
|
|
2788
|
+
videoSenderFirstStats: I,
|
|
2789
|
+
videoSenderSecondStats: N,
|
|
2790
|
+
audioReceiverStats: M,
|
|
2791
|
+
videoReceiverFirstStats: k,
|
|
2751
2792
|
videoReceiverSecondStats: $
|
|
2752
2793
|
};
|
|
2753
2794
|
});
|
|
2754
|
-
},
|
|
2795
|
+
}, zt = (n) => {
|
|
2755
2796
|
c(String(n));
|
|
2756
2797
|
};
|
|
2757
|
-
class
|
|
2798
|
+
class Xt {
|
|
2758
2799
|
events;
|
|
2759
2800
|
setTimeoutRequest;
|
|
2760
|
-
requesterAllStatistics = new G(
|
|
2801
|
+
requesterAllStatistics = new G(Yt);
|
|
2761
2802
|
constructor() {
|
|
2762
|
-
this.events = new
|
|
2803
|
+
this.events = new w(Ae), this.setTimeoutRequest = new ee();
|
|
2763
2804
|
}
|
|
2764
2805
|
get requested() {
|
|
2765
2806
|
return this.setTimeoutRequest.requested;
|
|
2766
2807
|
}
|
|
2767
2808
|
start(e, {
|
|
2768
2809
|
interval: t = D,
|
|
2769
|
-
onError: s =
|
|
2810
|
+
onError: s = zt
|
|
2770
2811
|
} = {}) {
|
|
2771
2812
|
this.stop(), this.setTimeoutRequest.request(() => {
|
|
2772
2813
|
this.collectStatistics(e, {
|
|
@@ -2797,7 +2838,7 @@ class zt {
|
|
|
2797
2838
|
}) => {
|
|
2798
2839
|
const s = J();
|
|
2799
2840
|
this.requesterAllStatistics.request(e).then((i) => {
|
|
2800
|
-
this.events.trigger("collected",
|
|
2841
|
+
this.events.trigger("collected", Qt(i));
|
|
2801
2842
|
const a = J() - s;
|
|
2802
2843
|
let o = D;
|
|
2803
2844
|
a > 48 ? o = D * 4 : a > 32 ? o = D * 3 : a > 16 && (o = D * 2), this.start(e, {
|
|
@@ -2809,7 +2850,7 @@ class zt {
|
|
|
2809
2850
|
});
|
|
2810
2851
|
};
|
|
2811
2852
|
}
|
|
2812
|
-
class
|
|
2853
|
+
class Jt {
|
|
2813
2854
|
availableIncomingBitrate;
|
|
2814
2855
|
statsPeerConnection;
|
|
2815
2856
|
callManager;
|
|
@@ -2819,7 +2860,7 @@ class Xt {
|
|
|
2819
2860
|
callManager: e,
|
|
2820
2861
|
apiManager: t
|
|
2821
2862
|
}) {
|
|
2822
|
-
this.callManager = e, this.apiManager = t, this.statsPeerConnection = new
|
|
2863
|
+
this.callManager = e, this.apiManager = t, this.statsPeerConnection = new Xt(), this.subscribe();
|
|
2823
2864
|
}
|
|
2824
2865
|
get events() {
|
|
2825
2866
|
return this.statsPeerConnection.events;
|
|
@@ -2861,26 +2902,26 @@ class Xt {
|
|
|
2861
2902
|
});
|
|
2862
2903
|
}
|
|
2863
2904
|
}
|
|
2864
|
-
const
|
|
2905
|
+
const Kt = (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) => {
|
|
2865
2906
|
const e = RTCRtpSender.getCapabilities(n), t = RTCRtpReceiver.getCapabilities(n), s = e === null ? [] : e.codecs, i = t === null ? [] : t.codecs;
|
|
2866
|
-
return
|
|
2867
|
-
},
|
|
2907
|
+
return Kt(s, i);
|
|
2908
|
+
}, Zt = (n, e) => e === void 0 || e.length === 0 ? n : n.sort((t, s) => {
|
|
2868
2909
|
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;
|
|
2869
2910
|
return a - o;
|
|
2870
|
-
}),
|
|
2911
|
+
}), en = (n, e) => e === void 0 || e.length === 0 ? n : n.filter((t) => !e.includes(t.mimeType)), tn = (n, {
|
|
2871
2912
|
preferredMimeTypesVideoCodecs: e,
|
|
2872
2913
|
excludeMimeTypesVideoCodecs: t
|
|
2873
2914
|
}) => {
|
|
2874
2915
|
try {
|
|
2875
2916
|
if (typeof n.setCodecPreferences == "function" && n.sender.track?.kind === "video" && (e !== void 0 && e.length > 0 || t !== void 0 && t.length > 0)) {
|
|
2876
|
-
const s =
|
|
2917
|
+
const s = jt("video"), i = en(s, t), r = Zt(i, e);
|
|
2877
2918
|
n.setCodecPreferences(r);
|
|
2878
2919
|
}
|
|
2879
2920
|
} catch (s) {
|
|
2880
2921
|
c("setCodecPreferences error", s);
|
|
2881
2922
|
}
|
|
2882
2923
|
};
|
|
2883
|
-
class
|
|
2924
|
+
class nn {
|
|
2884
2925
|
/**
|
|
2885
2926
|
* Хранилище основных transceiver'ов
|
|
2886
2927
|
*/
|
|
@@ -2987,14 +3028,14 @@ class tn {
|
|
|
2987
3028
|
this.clear();
|
|
2988
3029
|
};
|
|
2989
3030
|
}
|
|
2990
|
-
const
|
|
2991
|
-
class
|
|
3031
|
+
const sn = (n) => [...n.keys()].map((e) => n.get(e)), rn = (n, e) => sn(n).find((t) => t?.type === e), an = async (n) => n.getStats().then((e) => rn(e, "codec")?.mimeType);
|
|
3032
|
+
class on {
|
|
2992
3033
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
2993
3034
|
async getCodecFromSender(e) {
|
|
2994
|
-
return await
|
|
3035
|
+
return await an(e) ?? "";
|
|
2995
3036
|
}
|
|
2996
3037
|
}
|
|
2997
|
-
class
|
|
3038
|
+
class cn {
|
|
2998
3039
|
stackPromises = ne({
|
|
2999
3040
|
noRunIsNotActual: !0
|
|
3000
3041
|
});
|
|
@@ -3019,30 +3060,30 @@ class on {
|
|
|
3019
3060
|
});
|
|
3020
3061
|
}
|
|
3021
3062
|
}
|
|
3022
|
-
class
|
|
3063
|
+
class hn {
|
|
3023
3064
|
taskQueue;
|
|
3024
3065
|
onSetParameters;
|
|
3025
3066
|
constructor(e) {
|
|
3026
|
-
this.onSetParameters = e, this.taskQueue = new
|
|
3067
|
+
this.onSetParameters = e, this.taskQueue = new cn();
|
|
3027
3068
|
}
|
|
3028
3069
|
async setEncodingsToSender(e, t) {
|
|
3029
|
-
return this.taskQueue.add(async () =>
|
|
3070
|
+
return this.taskQueue.add(async () => de(e, t, this.onSetParameters));
|
|
3030
3071
|
}
|
|
3031
3072
|
stop() {
|
|
3032
3073
|
this.taskQueue.stop();
|
|
3033
3074
|
}
|
|
3034
3075
|
}
|
|
3035
|
-
const Ne = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), dn = 1e6,
|
|
3036
|
-
const t =
|
|
3076
|
+
const Ne = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), dn = 1e6, v = (n) => n * dn, me = v(0.06), Ie = v(4), ln = (n) => n <= 64 ? me : n <= 128 ? v(0.12) : n <= 256 ? v(0.25) : n <= 384 ? v(0.32) : n <= 426 ? v(0.38) : n <= 640 ? v(0.5) : n <= 848 ? v(0.7) : n <= 1280 ? v(1) : n <= 1920 ? v(2) : Ie, un = "av1", gn = (n) => Ne(n, un), Tn = 0.6, Y = (n, e) => gn(e) ? n * Tn : n, Sn = (n) => Y(me, n), Cn = (n) => Y(Ie, n), Z = (n, e) => {
|
|
3077
|
+
const t = ln(n);
|
|
3037
3078
|
return Y(t, e);
|
|
3038
|
-
}, q = 1,
|
|
3079
|
+
}, q = 1, En = ({
|
|
3039
3080
|
videoTrack: n,
|
|
3040
3081
|
targetSize: e
|
|
3041
3082
|
}) => {
|
|
3042
3083
|
const t = n.getSettings(), s = t.width, i = t.height, r = s === void 0 ? q : s / e.width, a = i === void 0 ? q : i / e.height;
|
|
3043
3084
|
return Math.max(r, a, q);
|
|
3044
3085
|
};
|
|
3045
|
-
class
|
|
3086
|
+
class An {
|
|
3046
3087
|
ignoreForCodec;
|
|
3047
3088
|
senderFinder;
|
|
3048
3089
|
codecProvider;
|
|
@@ -3085,7 +3126,7 @@ class En {
|
|
|
3085
3126
|
codec: r,
|
|
3086
3127
|
videoTrack: i.track
|
|
3087
3128
|
}
|
|
3088
|
-
).then((
|
|
3129
|
+
).then((h) => ({ ...h, sender: i }));
|
|
3089
3130
|
}
|
|
3090
3131
|
/**
|
|
3091
3132
|
* Обрабатывает отправитель в зависимости от команды управления
|
|
@@ -3095,14 +3136,14 @@ class En {
|
|
|
3095
3136
|
async processSender(e, t) {
|
|
3096
3137
|
const { mainCam: s, resolutionMainCam: i } = e;
|
|
3097
3138
|
switch (s) {
|
|
3098
|
-
case
|
|
3139
|
+
case f.PAUSE_MAIN_CAM:
|
|
3099
3140
|
return this.downgradeResolutionSender(t);
|
|
3100
|
-
case
|
|
3141
|
+
case f.RESUME_MAIN_CAM:
|
|
3101
3142
|
return this.setBitrateByTrackResolution(t);
|
|
3102
|
-
case
|
|
3143
|
+
case f.MAX_MAIN_CAM_RESOLUTION:
|
|
3103
3144
|
return i !== void 0 ? this.setResolutionSender(i, t) : this.setBitrateByTrackResolution(t);
|
|
3104
|
-
case
|
|
3105
|
-
case
|
|
3145
|
+
case f.ADMIN_STOP_MAIN_CAM:
|
|
3146
|
+
case f.ADMIN_START_MAIN_CAM:
|
|
3106
3147
|
case void 0:
|
|
3107
3148
|
return this.setBitrateByTrackResolution(t);
|
|
3108
3149
|
default:
|
|
@@ -3117,7 +3158,7 @@ class En {
|
|
|
3117
3158
|
async downgradeResolutionSender(e) {
|
|
3118
3159
|
const { sender: t, codec: s } = e, i = {
|
|
3119
3160
|
scaleResolutionDownBy: 200,
|
|
3120
|
-
maxBitrate:
|
|
3161
|
+
maxBitrate: Sn(s)
|
|
3121
3162
|
};
|
|
3122
3163
|
return this.parametersSetter.setEncodingsToSender(t, i);
|
|
3123
3164
|
}
|
|
@@ -3127,7 +3168,7 @@ class En {
|
|
|
3127
3168
|
* @returns Promise с результатом
|
|
3128
3169
|
*/
|
|
3129
3170
|
async setBitrateByTrackResolution(e) {
|
|
3130
|
-
const { sender: t, videoTrack: s, codec: i } = e, a = s.getSettings().width, o = a === void 0 ?
|
|
3171
|
+
const { sender: t, videoTrack: s, codec: i } = e, a = s.getSettings().width, o = a === void 0 ? Cn(i) : Z(a, i);
|
|
3131
3172
|
return this.parametersSetter.setEncodingsToSender(t, {
|
|
3132
3173
|
scaleResolutionDownBy: 1,
|
|
3133
3174
|
maxBitrate: o
|
|
@@ -3140,27 +3181,27 @@ class En {
|
|
|
3140
3181
|
* @returns Promise с результатом
|
|
3141
3182
|
*/
|
|
3142
3183
|
async setResolutionSender(e, t) {
|
|
3143
|
-
const [s, i] = e.split("x"), { sender: r, videoTrack: a, codec: o } = t,
|
|
3184
|
+
const [s, i] = e.split("x"), { sender: r, videoTrack: a, codec: o } = t, h = {
|
|
3144
3185
|
width: Number(s),
|
|
3145
3186
|
height: Number(i)
|
|
3146
|
-
},
|
|
3187
|
+
}, d = En({
|
|
3147
3188
|
videoTrack: a,
|
|
3148
|
-
targetSize:
|
|
3149
|
-
}), T = Z(
|
|
3150
|
-
scaleResolutionDownBy:
|
|
3189
|
+
targetSize: h
|
|
3190
|
+
}), T = Z(h.width, o), S = {
|
|
3191
|
+
scaleResolutionDownBy: d,
|
|
3151
3192
|
maxBitrate: T
|
|
3152
3193
|
};
|
|
3153
3194
|
return this.parametersSetter.setEncodingsToSender(r, S);
|
|
3154
3195
|
}
|
|
3155
3196
|
}
|
|
3156
|
-
const
|
|
3157
|
-
class
|
|
3197
|
+
const Rn = (n) => n.find((e) => e.track?.kind === "video");
|
|
3198
|
+
class Nn {
|
|
3158
3199
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
3159
3200
|
findVideoSender(e) {
|
|
3160
|
-
return
|
|
3201
|
+
return Rn(e);
|
|
3161
3202
|
}
|
|
3162
3203
|
}
|
|
3163
|
-
class
|
|
3204
|
+
class mn {
|
|
3164
3205
|
currentSender;
|
|
3165
3206
|
originalReplaceTrack;
|
|
3166
3207
|
lastWidth;
|
|
@@ -3224,7 +3265,7 @@ class Nn {
|
|
|
3224
3265
|
this.setTimeoutRequest.cancelRequest(), this.lastWidth = void 0, this.lastHeight = void 0;
|
|
3225
3266
|
}
|
|
3226
3267
|
}
|
|
3227
|
-
class
|
|
3268
|
+
class In {
|
|
3228
3269
|
apiManager;
|
|
3229
3270
|
currentHandler;
|
|
3230
3271
|
constructor(e) {
|
|
@@ -3244,7 +3285,7 @@ class pn {
|
|
|
3244
3285
|
this.currentHandler && (this.apiManager.off("main-cam-control", this.currentHandler), this.currentHandler = void 0);
|
|
3245
3286
|
}
|
|
3246
3287
|
}
|
|
3247
|
-
class
|
|
3288
|
+
class pn {
|
|
3248
3289
|
eventHandler;
|
|
3249
3290
|
senderBalancer;
|
|
3250
3291
|
parametersSetterWithQueue;
|
|
@@ -3256,16 +3297,16 @@ class In {
|
|
|
3256
3297
|
onSetParameters: i,
|
|
3257
3298
|
pollIntervalMs: r
|
|
3258
3299
|
} = {}) {
|
|
3259
|
-
this.getConnection = t, this.eventHandler = new
|
|
3300
|
+
this.getConnection = t, this.eventHandler = new In(e), this.parametersSetterWithQueue = new hn(i), this.senderBalancer = new An(
|
|
3260
3301
|
{
|
|
3261
|
-
senderFinder: new
|
|
3262
|
-
codecProvider: new
|
|
3302
|
+
senderFinder: new Nn(),
|
|
3303
|
+
codecProvider: new on(),
|
|
3263
3304
|
parametersSetter: this.parametersSetterWithQueue
|
|
3264
3305
|
},
|
|
3265
3306
|
{
|
|
3266
3307
|
ignoreForCodec: s
|
|
3267
3308
|
}
|
|
3268
|
-
), this.trackMonitor = new
|
|
3309
|
+
), this.trackMonitor = new mn({ pollIntervalMs: r });
|
|
3269
3310
|
}
|
|
3270
3311
|
/**
|
|
3271
3312
|
* Подписывается на события управления главной камерой
|
|
@@ -3310,13 +3351,13 @@ class In {
|
|
|
3310
3351
|
});
|
|
3311
3352
|
};
|
|
3312
3353
|
}
|
|
3313
|
-
const
|
|
3354
|
+
const pe = [
|
|
3314
3355
|
"balancing-scheduled",
|
|
3315
3356
|
"balancing-started",
|
|
3316
3357
|
"balancing-stopped",
|
|
3317
3358
|
"parameters-updated"
|
|
3318
3359
|
];
|
|
3319
|
-
class
|
|
3360
|
+
class _n {
|
|
3320
3361
|
isBalancingActive = !1;
|
|
3321
3362
|
events;
|
|
3322
3363
|
callManager;
|
|
@@ -3324,7 +3365,7 @@ class mn {
|
|
|
3324
3365
|
videoSendingBalancer;
|
|
3325
3366
|
startBalancingTimer;
|
|
3326
3367
|
constructor(e, t, s = {}) {
|
|
3327
|
-
this.events = new
|
|
3368
|
+
this.events = new w(pe), this.callManager = e, this.balancingStartDelay = s.balancingStartDelay ?? 1e4, this.videoSendingBalancer = new pn(
|
|
3328
3369
|
t,
|
|
3329
3370
|
() => e.connection,
|
|
3330
3371
|
{
|
|
@@ -3394,17 +3435,17 @@ class mn {
|
|
|
3394
3435
|
this.startBalancingTimer && (clearTimeout(this.startBalancingTimer), this.startBalancingTimer = void 0);
|
|
3395
3436
|
}
|
|
3396
3437
|
}
|
|
3397
|
-
const
|
|
3398
|
-
...Mn,
|
|
3399
|
-
...fn,
|
|
3438
|
+
const Mn = 1e6, vn = Ce.map((n) => `auto-connect:${n}`), fn = ge.map((n) => `connection:${n}`), Pn = re.map((n) => `call:${n}`), On = se.map((n) => `api:${n}`), yn = Ee.map((n) => `incoming-call:${n}`), Dn = le.map((n) => `presentation:${n}`), bn = Ae.map((n) => `stats:${n}`), wn = pe.map((n) => `video-balancer:${n}`), Un = [
|
|
3400
3439
|
...vn,
|
|
3440
|
+
...fn,
|
|
3401
3441
|
...Pn,
|
|
3402
3442
|
...On,
|
|
3403
3443
|
...yn,
|
|
3444
|
+
...Dn,
|
|
3404
3445
|
...bn,
|
|
3405
|
-
...
|
|
3446
|
+
...wn
|
|
3406
3447
|
];
|
|
3407
|
-
class
|
|
3448
|
+
class Yn {
|
|
3408
3449
|
events;
|
|
3409
3450
|
connectionManager;
|
|
3410
3451
|
connectionQueueManager;
|
|
@@ -3424,28 +3465,28 @@ class Qn {
|
|
|
3424
3465
|
videoBalancerOptions: i,
|
|
3425
3466
|
autoConnectorOptions: r
|
|
3426
3467
|
} = {}) {
|
|
3427
|
-
this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events = new
|
|
3468
|
+
this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events = new F(Un), this.connectionManager = new _t({ JsSIP: e }), this.connectionQueueManager = new Mt({
|
|
3428
3469
|
connectionManager: this.connectionManager
|
|
3429
|
-
}), this.callManager = new
|
|
3470
|
+
}), this.callManager = new Je(), this.apiManager = new ke({
|
|
3430
3471
|
connectionManager: this.connectionManager,
|
|
3431
3472
|
callManager: this.callManager
|
|
3432
|
-
}), this.incomingCallManager = new
|
|
3473
|
+
}), this.incomingCallManager = new Vt(this.connectionManager), this.presentationManager = new lt({
|
|
3433
3474
|
callManager: this.callManager,
|
|
3434
|
-
maxBitrate:
|
|
3435
|
-
}), this.statsManager = new
|
|
3475
|
+
maxBitrate: Mn
|
|
3476
|
+
}), this.statsManager = new Jt({
|
|
3436
3477
|
callManager: this.callManager,
|
|
3437
3478
|
apiManager: this.apiManager
|
|
3438
|
-
}), this.autoConnectorManager = new
|
|
3479
|
+
}), this.autoConnectorManager = new kt(
|
|
3439
3480
|
{
|
|
3440
3481
|
connectionQueueManager: this.connectionQueueManager,
|
|
3441
3482
|
connectionManager: this.connectionManager,
|
|
3442
3483
|
callManager: this.callManager
|
|
3443
3484
|
},
|
|
3444
3485
|
r
|
|
3445
|
-
), this.transceiverManager = new
|
|
3486
|
+
), this.transceiverManager = new nn({
|
|
3446
3487
|
callManager: this.callManager,
|
|
3447
3488
|
apiManager: this.apiManager
|
|
3448
|
-
}), this.videoSendingBalancerManager = new
|
|
3489
|
+
}), this.videoSendingBalancerManager = new _n(
|
|
3449
3490
|
this.callManager,
|
|
3450
3491
|
this.apiManager,
|
|
3451
3492
|
i
|
|
@@ -3478,9 +3519,6 @@ class Qn {
|
|
|
3478
3519
|
get connection() {
|
|
3479
3520
|
return this.callManager.connection;
|
|
3480
3521
|
}
|
|
3481
|
-
get establishedRTCSession() {
|
|
3482
|
-
return this.callManager.establishedRTCSession;
|
|
3483
|
-
}
|
|
3484
3522
|
get isCallActive() {
|
|
3485
3523
|
return this.callManager.isCallActive;
|
|
3486
3524
|
}
|
|
@@ -3630,7 +3668,7 @@ class Qn {
|
|
|
3630
3668
|
return this.apiManager.askPermissionToEnableCam(...e);
|
|
3631
3669
|
}
|
|
3632
3670
|
setCodecPreferences(e) {
|
|
3633
|
-
|
|
3671
|
+
tn(e, {
|
|
3634
3672
|
preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
|
|
3635
3673
|
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
3636
3674
|
});
|
|
@@ -3652,17 +3690,17 @@ class Qn {
|
|
|
3652
3690
|
export {
|
|
3653
3691
|
oe as E,
|
|
3654
3692
|
$e as O,
|
|
3655
|
-
|
|
3656
|
-
|
|
3693
|
+
Yn as S,
|
|
3694
|
+
ot as a,
|
|
3657
3695
|
Fe as b,
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3696
|
+
Qn as c,
|
|
3697
|
+
Gn as d,
|
|
3698
|
+
xn as e,
|
|
3661
3699
|
A as f,
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3700
|
+
Xt as g,
|
|
3701
|
+
mt as h,
|
|
3702
|
+
an as i,
|
|
3665
3703
|
c as l,
|
|
3666
|
-
|
|
3667
|
-
|
|
3704
|
+
B as p,
|
|
3705
|
+
de as s
|
|
3668
3706
|
};
|