sip-connector 19.8.3 → 19.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -101
- package/dist/{@SipConnector-BmkeKEDD.js → @SipConnector-BpypVXj0.js} +580 -746
- package/dist/@SipConnector-CR3DyIpB.cjs +1 -0
- 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/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 +0 -2
- package/dist/SipConnector/eventNames.d.ts +1 -1
- 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,18 +1,18 @@
|
|
|
1
|
-
import { TypedEvents as
|
|
2
|
-
import
|
|
1
|
+
import { TypedEvents as O } from "events-constructor";
|
|
2
|
+
import H from "debug";
|
|
3
3
|
import { CancelableRequest as x, isCanceledError as pe } from "@krivega/cancelable-promise";
|
|
4
|
-
import { resolveRequesterByTimeout as _e, requesterByTimeoutsWithFailCalls as Me, DelayRequester as fe, hasCanceledError as
|
|
5
|
-
import { hasCanceledError as
|
|
6
|
-
import { setup as Oe, createActor as
|
|
7
|
-
import { createStackPromises as te, isPromiseIsNotActualError as
|
|
4
|
+
import { resolveRequesterByTimeout as _e, requesterByTimeoutsWithFailCalls as Me, DelayRequester as fe, hasCanceledError as Pe, SetTimeoutRequest as Z } from "@krivega/timeout-requester";
|
|
5
|
+
import { hasCanceledError as ve, repeatedCallsAsync as ee } from "repeated-calls";
|
|
6
|
+
import { setup as Oe, createActor as De } from "xstate";
|
|
7
|
+
import { createStackPromises as te, isPromiseIsNotActualError as be } from "stack-promises";
|
|
8
8
|
import "ua-parser-js";
|
|
9
9
|
import "sequent-promises";
|
|
10
|
-
const G = "sip-connector",
|
|
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 || {}),
|
|
10
|
+
const G = "sip-connector", h = H(G), qn = () => {
|
|
11
|
+
H.enable(G);
|
|
12
|
+
}, Wn = () => {
|
|
13
|
+
H.enable(`-${G}`);
|
|
14
|
+
}, ye = "Error decline with 603", we = 1006, Ue = (n) => typeof n == "object" && n !== null && "code" in n && n.code === we, Le = (n) => n.message === ye;
|
|
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 || {}), D = /* @__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))(D || {}), 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 || {}), P = /* @__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))(P || {}), 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 || {}), Be = /* @__PURE__ */ ((n) => (n.AUDIO = "AUDIO", n.VIDEO = "VIDEO", n.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", n))(Be || {}), 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
16
|
const ne = [
|
|
17
17
|
"participation:accepting-word-request",
|
|
18
18
|
"participation:cancelling-word-request",
|
|
@@ -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,10 +41,9 @@ const ne = [
|
|
|
40
41
|
"availableSecondRemoteStream",
|
|
41
42
|
"notAvailableSecondRemoteStream",
|
|
42
43
|
"mustStopPresentation",
|
|
43
|
-
"newDTMF"
|
|
44
|
-
"restart"
|
|
44
|
+
"newDTMF"
|
|
45
45
|
];
|
|
46
|
-
var
|
|
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
47
|
class Fe {
|
|
48
48
|
events;
|
|
49
49
|
connectionManager;
|
|
@@ -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(ne), this.subscribe();
|
|
56
56
|
}
|
|
57
57
|
async waitChannels() {
|
|
58
58
|
return this.wait(g.CHANNELS);
|
|
@@ -62,54 +62,54 @@ 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)}`, c = [
|
|
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
|
-
extraHeaders:
|
|
95
|
+
extraHeaders: c
|
|
96
96
|
});
|
|
97
97
|
}
|
|
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 = {}) {
|
|
108
|
-
const s = this.getEstablishedRTCSessionProtected(), a = e === "mic" ? 0 : 1,
|
|
108
|
+
const s = this.getEstablishedRTCSessionProtected(), a = e === "mic" ? 0 : 1, c = [`${u.MEDIA_TYPE}: ${a}`];
|
|
109
109
|
return s.sendInfo(p.REFUSAL, void 0, {
|
|
110
110
|
noTerminateWhenError: !0,
|
|
111
111
|
...t,
|
|
112
|
-
extraHeaders:
|
|
112
|
+
extraHeaders: c
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
115
|
async sendRefusalToTurnOnMic(e = {}) {
|
|
@@ -149,9 +149,9 @@ class Fe {
|
|
|
149
149
|
noTerminateWhenError: !0,
|
|
150
150
|
...e,
|
|
151
151
|
extraHeaders: s
|
|
152
|
-
}).catch((
|
|
153
|
-
if (Le(
|
|
154
|
-
throw
|
|
152
|
+
}).catch((i) => {
|
|
153
|
+
if (Le(i))
|
|
154
|
+
throw i;
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
on(e, t) {
|
|
@@ -191,115 +191,111 @@ class Fe {
|
|
|
191
191
|
this.handleNotify(s);
|
|
192
192
|
}
|
|
193
193
|
} catch (t) {
|
|
194
|
-
|
|
194
|
+
h("error parse notify", t);
|
|
195
195
|
}
|
|
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;
|
|
251
251
|
}
|
|
252
252
|
default:
|
|
253
|
-
|
|
253
|
+
h("unknown cmd", e);
|
|
254
254
|
}
|
|
255
255
|
};
|
|
256
256
|
handleNewInfo = (e) => {
|
|
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(
|
|
260
|
+
const { request: s } = e, i = s, r = i.getHeader(u.CONTENT_TYPE);
|
|
261
|
+
if (r !== void 0)
|
|
262
|
+
switch (r) {
|
|
263
|
+
case D.ENTER_ROOM: {
|
|
264
|
+
this.triggerEnterRoom(i), this.maybeTriggerChannels(i);
|
|
265
265
|
break;
|
|
266
266
|
}
|
|
267
|
-
case
|
|
268
|
-
this.maybeHandleNotify(
|
|
267
|
+
case D.NOTIFY: {
|
|
268
|
+
this.maybeHandleNotify(i);
|
|
269
269
|
break;
|
|
270
270
|
}
|
|
271
|
-
case
|
|
272
|
-
this.triggerShareState(
|
|
271
|
+
case D.SHARE_STATE: {
|
|
272
|
+
this.triggerShareState(i);
|
|
273
273
|
break;
|
|
274
274
|
}
|
|
275
|
-
case
|
|
276
|
-
this.triggerMainCamControl(
|
|
275
|
+
case D.MAIN_CAM: {
|
|
276
|
+
this.triggerMainCamControl(i);
|
|
277
277
|
break;
|
|
278
278
|
}
|
|
279
|
-
case
|
|
280
|
-
this.triggerMicControl(
|
|
279
|
+
case D.MIC: {
|
|
280
|
+
this.triggerMicControl(i);
|
|
281
281
|
break;
|
|
282
282
|
}
|
|
283
|
-
case
|
|
284
|
-
this.triggerUseLicense(
|
|
283
|
+
case D.USE_LICENSE: {
|
|
284
|
+
this.triggerUseLicense(i);
|
|
285
285
|
break;
|
|
286
286
|
}
|
|
287
|
-
case
|
|
288
|
-
this.maybeTriggerParticipantMoveRequest(
|
|
289
|
-
break;
|
|
290
|
-
}
|
|
291
|
-
case P.RESTART: {
|
|
292
|
-
this.triggerRestart(r);
|
|
287
|
+
case D.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),
|
|
425
|
-
if (t ===
|
|
426
|
-
this.events.trigger(g.ADMIN_START_MAIN_CAM, { isSyncForced:
|
|
422
|
+
const t = e.getHeader(u.MAIN_CAM), s = e.getHeader(u.MEDIA_SYNC), i = s === V.ADMIN_SYNC_FORCED;
|
|
423
|
+
if (t === P.ADMIN_START_MAIN_CAM) {
|
|
424
|
+
this.events.trigger(g.ADMIN_START_MAIN_CAM, { isSyncForced: i });
|
|
427
425
|
return;
|
|
428
426
|
}
|
|
429
|
-
if (t ===
|
|
430
|
-
this.events.trigger(g.ADMIN_STOP_MAIN_CAM, { isSyncForced:
|
|
427
|
+
if (t === P.ADMIN_STOP_MAIN_CAM) {
|
|
428
|
+
this.events.trigger(g.ADMIN_STOP_MAIN_CAM, { isSyncForced: i });
|
|
431
429
|
return;
|
|
432
430
|
}
|
|
433
|
-
(t ===
|
|
434
|
-
const
|
|
431
|
+
(t === P.RESUME_MAIN_CAM || t === P.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 ke(n) {
|
|
448
|
+
return (e) => `sip:${e}@${n}`;
|
|
449
|
+
}
|
|
450
|
+
const $e = (n, e) => () => Math.floor(Math.random() * (e - n)) + n, se = (n) => n.trim().replaceAll(" ", "_"), qe = $e(1e5, 99999999), We = (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 || {}), Ve = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))(Ve || {});
|
|
455
|
+
const ie = [
|
|
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
|
+
], He = [
|
|
488
483
|
"peerconnection:confirmed",
|
|
489
484
|
"peerconnection:ontrack",
|
|
490
485
|
"ended:fromserver",
|
|
491
486
|
"call-status-changed"
|
|
492
487
|
], re = [
|
|
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) => {
|
|
488
|
+
...ie,
|
|
489
|
+
...He
|
|
490
|
+
], xe = (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
|
|
526
|
-
return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" &&
|
|
501
|
+
const i = t === "recvonly" ? [] : n.getAudioTracks(), r = e === "recvonly" ? [] : n.getVideoTracks(), a = [...i, ...r], o = new MediaStream(a);
|
|
502
|
+
return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" && xe(o, s), o;
|
|
527
503
|
};
|
|
528
504
|
var ae = /* @__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))(ae || {});
|
|
529
|
-
class
|
|
505
|
+
class Ge {
|
|
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,24 +519,24 @@ 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
|
-
directionVideo:
|
|
526
|
+
directionVideo: c,
|
|
551
527
|
directionAudio: d,
|
|
552
528
|
contentHint: T,
|
|
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(
|
|
563
|
-
directionVideo:
|
|
538
|
+
mediaStream: B(i, {
|
|
539
|
+
directionVideo: c,
|
|
564
540
|
directionAudio: d,
|
|
565
541
|
contentHint: T
|
|
566
542
|
}),
|
|
@@ -575,12 +551,12 @@ class Qe {
|
|
|
575
551
|
// так как в методе call создается RTCSession
|
|
576
552
|
// и после создания нет возможности подписаться на события peerconnection через subscribeToSessionEvents
|
|
577
553
|
eventHandlers: this.events.triggers,
|
|
578
|
-
extraHeaders:
|
|
579
|
-
directionVideo:
|
|
554
|
+
extraHeaders: r,
|
|
555
|
+
directionVideo: c,
|
|
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() {
|
|
@@ -596,26 +572,26 @@ 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
|
-
offerToReceiveAudio:
|
|
579
|
+
offerToReceiveAudio: c,
|
|
604
580
|
offerToReceiveVideo: d,
|
|
605
581
|
contentHint: T,
|
|
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
|
-
offerToReceiveAudio:
|
|
594
|
+
offerToReceiveAudio: c,
|
|
619
595
|
offerToReceiveVideo: d
|
|
620
596
|
},
|
|
621
597
|
mediaStream: B(t, {
|
|
@@ -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, c), this.events.on(N.ENDED, c);
|
|
667
638
|
}, o = () => {
|
|
668
|
-
this.events.off(
|
|
669
|
-
},
|
|
670
|
-
|
|
639
|
+
this.events.off(N.FAILED, c), this.events.off(N.ENDED, c);
|
|
640
|
+
}, c = (l) => {
|
|
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 = ie.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,20 +669,20 @@ 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();
|
|
705
676
|
};
|
|
706
677
|
}
|
|
707
|
-
class
|
|
678
|
+
class Qe {
|
|
708
679
|
remoteStreams = {};
|
|
709
680
|
reset() {
|
|
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,25 +690,31 @@ 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
|
|
729
|
-
t.push(
|
|
699
|
+
const c = this.generateStream(r, o);
|
|
700
|
+
t.push(c);
|
|
730
701
|
}), t;
|
|
731
702
|
}
|
|
732
703
|
generateAudioStreams(e) {
|
|
733
704
|
return e.map((t) => this.generateAudioStream(t));
|
|
734
705
|
}
|
|
735
706
|
}
|
|
736
|
-
class
|
|
737
|
-
|
|
707
|
+
class Ye {
|
|
708
|
+
events;
|
|
709
|
+
isPendingCall = !1;
|
|
710
|
+
isPendingAnswer = !1;
|
|
711
|
+
rtcSession;
|
|
712
|
+
remoteStreams = {};
|
|
713
|
+
callConfiguration = {};
|
|
714
|
+
remoteStreamsManager = new Qe();
|
|
738
715
|
mcuSession;
|
|
739
|
-
constructor(
|
|
740
|
-
|
|
716
|
+
constructor() {
|
|
717
|
+
this.events = new O(re), this.mcuSession = new Ge(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
|
}));
|
|
@@ -776,103 +771,54 @@ 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 ze = (n, e) => (n.degradationPreference = e.degradationPreference, n), Xe = (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
|
-
}, oe = (n) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== n,
|
|
849
|
-
if (
|
|
794
|
+
}, oe = (n) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== n, Je = oe(), Ke = (n, e) => {
|
|
795
|
+
if (Je(n, e))
|
|
850
796
|
return n;
|
|
851
|
-
},
|
|
852
|
-
const t = n.maxBitrate, s =
|
|
797
|
+
}, je = (n, e) => {
|
|
798
|
+
const t = n.maxBitrate, s = Ke(e, t);
|
|
853
799
|
return s !== void 0 && (n.maxBitrate = s), n;
|
|
854
|
-
}, ce = 1,
|
|
800
|
+
}, ce = 1, Ze = oe(
|
|
855
801
|
ce
|
|
856
|
-
),
|
|
802
|
+
), et = (n, e) => {
|
|
857
803
|
const t = n === void 0 ? void 0 : Math.max(n, ce);
|
|
858
|
-
if (t !== void 0 &&
|
|
804
|
+
if (t !== void 0 && Ze(
|
|
859
805
|
t,
|
|
860
806
|
e
|
|
861
807
|
))
|
|
862
808
|
return t;
|
|
863
|
-
},
|
|
864
|
-
const t = n.scaleResolutionDownBy, s =
|
|
809
|
+
}, tt = (n, e) => {
|
|
810
|
+
const t = n.scaleResolutionDownBy, s = et(
|
|
865
811
|
e,
|
|
866
812
|
t
|
|
867
813
|
);
|
|
868
814
|
return s !== void 0 && (n.scaleResolutionDownBy = s), n;
|
|
869
|
-
},
|
|
815
|
+
}, nt = (n, e) => {
|
|
870
816
|
const t = e.encodings?.length ?? 0;
|
|
871
|
-
return
|
|
872
|
-
const
|
|
873
|
-
|
|
817
|
+
return Xe(n, t), n.encodings.forEach((s, i) => {
|
|
818
|
+
const r = (e?.encodings ?? [])[i], a = r?.maxBitrate, o = r?.scaleResolutionDownBy;
|
|
819
|
+
je(s, a), tt(s, o);
|
|
874
820
|
}), n;
|
|
875
|
-
},
|
|
821
|
+
}, st = (n, e) => {
|
|
876
822
|
if (n.codecs?.length !== e.codecs?.length)
|
|
877
823
|
return !0;
|
|
878
824
|
for (let t = 0; t < (n.codecs?.length ?? 0); t++)
|
|
@@ -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
|
+
}, it = async (n, e) => {
|
|
893
839
|
const t = n.getParameters(), s = JSON.parse(
|
|
894
840
|
JSON.stringify(t)
|
|
895
841
|
);
|
|
896
|
-
|
|
897
|
-
const
|
|
898
|
-
return
|
|
842
|
+
nt(t, e), ze(t, e);
|
|
843
|
+
const i = st(s, t);
|
|
844
|
+
return i && await n.setParameters(t), { parameters: t, isChanged: i };
|
|
899
845
|
}, he = async (n, e, t) => {
|
|
900
|
-
const { isChanged: s, parameters:
|
|
846
|
+
const { isChanged: s, parameters: i } = await it(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
|
+
}, rt = (n, e) => n.find((t) => t.track !== null && e.getTracks().includes(t.track)), at = async (n, e, t) => {
|
|
856
|
+
const s = rt(n, e);
|
|
911
857
|
if (s)
|
|
912
858
|
return he(s, { maxBitrate: t });
|
|
913
859
|
};
|
|
914
|
-
var
|
|
860
|
+
var v = /* @__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))(v || {});
|
|
915
861
|
const de = [
|
|
916
862
|
"presentation:start",
|
|
917
863
|
"presentation:started",
|
|
918
864
|
"presentation:end",
|
|
919
865
|
"presentation:ended",
|
|
920
866
|
"presentation:failed"
|
|
921
|
-
],
|
|
922
|
-
class
|
|
867
|
+
], ot = 1, Vn = (n) => ve(n);
|
|
868
|
+
class ct {
|
|
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(de), this.subscribe();
|
|
935
881
|
}
|
|
936
882
|
get isPendingPresentation() {
|
|
937
883
|
return !!this.promisePendingStartPresentation || !!this.promisePendingStopPresentation;
|
|
@@ -939,20 +885,20 @@ 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
|
-
const
|
|
892
|
+
const c = this.getRtcSessionProtected();
|
|
947
893
|
if (this.streamPresentationCurrent)
|
|
948
894
|
throw new Error("Presentation is already started");
|
|
949
895
|
return this.sendPresentationWithDuplicatedCalls(e, {
|
|
950
|
-
rtcSession:
|
|
896
|
+
rtcSession: c,
|
|
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(v.FAILED_PRESENTATION, a), r;
|
|
917
|
+
}) : t && this.events.trigger(v.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(v.START_PRESENTATION, e);
|
|
1011
957
|
}), this.callManager.on("presentation:started", (e) => {
|
|
1012
|
-
this.events.trigger(
|
|
958
|
+
this.events.trigger(v.STARTED_PRESENTATION, e);
|
|
1013
959
|
}), this.callManager.on("presentation:end", (e) => {
|
|
1014
|
-
this.events.trigger(
|
|
960
|
+
this.events.trigger(v.END_PRESENTATION, e);
|
|
1015
961
|
}), this.callManager.on("presentation:ended", (e) => {
|
|
1016
|
-
this.events.trigger(
|
|
962
|
+
this.events.trigger(v.ENDED_PRESENTATION, e);
|
|
1017
963
|
}), this.callManager.on("presentation:failed", (e) => {
|
|
1018
|
-
this.events.trigger(
|
|
964
|
+
this.events.trigger(v.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: ot
|
|
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
981
|
return this.cancelableSendPresentationWithRepeatedCalls = ee({
|
|
1036
982
|
targetFunction: a,
|
|
1037
983
|
isComplete: o,
|
|
1038
984
|
isRejectAsValid: !0,
|
|
1039
|
-
...
|
|
1040
|
-
}), this.cancelableSendPresentationWithRepeatedCalls.then((
|
|
985
|
+
...r
|
|
986
|
+
}), this.cancelableSendPresentationWithRepeatedCalls.then((c) => c);
|
|
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
|
-
onAddedTransceiver:
|
|
994
|
+
onAddedTransceiver: c
|
|
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
|
-
onAddedTransceiver:
|
|
1003
|
+
onAddedTransceiver: c
|
|
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(v.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 at(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 ht {
|
|
1094
1040
|
data;
|
|
1095
1041
|
getUa;
|
|
1096
1042
|
constructor(e) {
|
|
@@ -1181,7 +1127,7 @@ const le = [
|
|
|
1181
1127
|
"registrationFailed",
|
|
1182
1128
|
"newMessage",
|
|
1183
1129
|
"sipEvent"
|
|
1184
|
-
],
|
|
1130
|
+
], dt = [
|
|
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
|
-
], ue = [...le, ...
|
|
1193
|
-
class
|
|
1138
|
+
], ue = [...le, ...dt], lt = 3;
|
|
1139
|
+
class ut {
|
|
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", se(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
|
|
1240
|
-
return
|
|
1183
|
+
connectWithDuplicatedCalls = async (e, { callLimit: t = lt } = {}) => {
|
|
1184
|
+
const s = async () => this.connectInner(e), i = (r) => {
|
|
1185
|
+
const c = this.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), d = r != null && !Ue(r);
|
|
1186
|
+
return c || d;
|
|
1241
1187
|
};
|
|
1242
1188
|
return this.stateMachine.startConnect(), this.cancelableConnectWithRepeatedCalls = ee({
|
|
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,11 +1214,11 @@ 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
|
-
connectionRecoveryMinInterval:
|
|
1221
|
+
connectionRecoveryMinInterval: c,
|
|
1276
1222
|
connectionRecoveryMaxInterval: d,
|
|
1277
1223
|
userAgent: T,
|
|
1278
1224
|
displayName: S = "",
|
|
@@ -1286,25 +1232,25 @@ 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,
|
|
1298
1244
|
registerExpires: o,
|
|
1299
|
-
connectionRecoveryMinInterval:
|
|
1245
|
+
connectionRecoveryMinInterval: c,
|
|
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,22 +1258,22 @@ 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 = ((c, d) => {
|
|
1317
1263
|
if (this.getConnectionConfiguration()?.register === !0)
|
|
1318
|
-
return this.registrationManager.subscribeToStartEvents(
|
|
1264
|
+
return this.registrationManager.subscribeToStartEvents(c, d);
|
|
1319
1265
|
const S = C.CONNECTED, l = [C.DISCONNECTED];
|
|
1320
|
-
return this.events.on(S,
|
|
1266
|
+
return this.events.on(S, c), l.forEach((E) => {
|
|
1321
1267
|
this.events.on(E, d);
|
|
1322
1268
|
}), () => {
|
|
1323
|
-
this.events.off(S,
|
|
1269
|
+
this.events.off(S, c), l.forEach((E) => {
|
|
1324
1270
|
this.events.off(E, d);
|
|
1325
1271
|
});
|
|
1326
1272
|
};
|
|
1327
1273
|
})(() => {
|
|
1328
|
-
|
|
1329
|
-
}, (
|
|
1330
|
-
|
|
1274
|
+
i?.(), e(s);
|
|
1275
|
+
}, (c) => {
|
|
1276
|
+
i?.(), t(c);
|
|
1331
1277
|
}), s.start();
|
|
1332
1278
|
});
|
|
1333
1279
|
cancelConnectWithRepeatedCalls() {
|
|
@@ -1344,17 +1290,17 @@ class Tt {
|
|
|
1344
1290
|
}
|
|
1345
1291
|
}
|
|
1346
1292
|
var ge = /* @__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))(ge || {});
|
|
1347
|
-
const
|
|
1293
|
+
const gt = Oe({
|
|
1348
1294
|
types: {
|
|
1349
1295
|
context: {},
|
|
1350
1296
|
events: {}
|
|
1351
1297
|
},
|
|
1352
1298
|
actions: {
|
|
1353
1299
|
logTransition: (n, e) => {
|
|
1354
|
-
|
|
1300
|
+
h(`State transition: ${e.from} -> ${e.to} (${e.event})`);
|
|
1355
1301
|
},
|
|
1356
1302
|
logStateChange: (n, e) => {
|
|
1357
|
-
|
|
1303
|
+
h("ConnectionStateMachine state changed", e.state);
|
|
1358
1304
|
}
|
|
1359
1305
|
}
|
|
1360
1306
|
}).createMachine({
|
|
@@ -1658,17 +1604,17 @@ const St = Oe({
|
|
|
1658
1604
|
}
|
|
1659
1605
|
}
|
|
1660
1606
|
});
|
|
1661
|
-
class
|
|
1607
|
+
class Tt {
|
|
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(gt), 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
|
}
|
|
@@ -1759,7 +1705,7 @@ class Ct {
|
|
|
1759
1705
|
sendEvent(e) {
|
|
1760
1706
|
const t = this.actor.getSnapshot(), s = { type: e };
|
|
1761
1707
|
if (!t.can(s)) {
|
|
1762
|
-
|
|
1708
|
+
h(
|
|
1763
1709
|
`Invalid transition: ${s.type} from ${this.state}. Event cannot be processed in current state.`
|
|
1764
1710
|
);
|
|
1765
1711
|
return;
|
|
@@ -1820,7 +1766,7 @@ class Ct {
|
|
|
1820
1766
|
};
|
|
1821
1767
|
}
|
|
1822
1768
|
}
|
|
1823
|
-
class
|
|
1769
|
+
class St {
|
|
1824
1770
|
events;
|
|
1825
1771
|
getUaProtected;
|
|
1826
1772
|
constructor(e) {
|
|
@@ -1842,22 +1788,22 @@ class Et {
|
|
|
1842
1788
|
try {
|
|
1843
1789
|
await this.unregister();
|
|
1844
1790
|
} catch (e) {
|
|
1845
|
-
|
|
1791
|
+
h("tryRegister", e);
|
|
1846
1792
|
}
|
|
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 Ct {
|
|
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,19 +1844,19 @@ 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
|
-
return new Promise((o,
|
|
1851
|
+
return new Promise((o, c) => {
|
|
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
|
+
c(E);
|
|
1914
1860
|
};
|
|
1915
1861
|
T.once(C.DISCONNECTED, S);
|
|
1916
1862
|
const l = () => {
|
|
@@ -1922,11 +1868,11 @@ class At {
|
|
|
1922
1868
|
});
|
|
1923
1869
|
}
|
|
1924
1870
|
}
|
|
1925
|
-
const
|
|
1871
|
+
const Et = (n) => {
|
|
1926
1872
|
const e = [];
|
|
1927
1873
|
return n !== void 0 && n !== "" && e.push(`X-Vinteo-Remote: ${n}`), e;
|
|
1928
1874
|
};
|
|
1929
|
-
class
|
|
1875
|
+
class b {
|
|
1930
1876
|
JsSIP;
|
|
1931
1877
|
constructor(e) {
|
|
1932
1878
|
this.JsSIP = e;
|
|
@@ -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,75 +1897,75 @@ 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() : `${qe()}`;
|
|
1955
1901
|
}
|
|
1956
1902
|
static buildExtraHeaders(e, t) {
|
|
1957
|
-
const s = e !== void 0 && e !== "" ?
|
|
1903
|
+
const s = e !== void 0 && e !== "" ? Et(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
|
-
registerExpires:
|
|
1914
|
+
registerExpires: c = 300,
|
|
1969
1915
|
// 5 minutes in sec
|
|
1970
1916
|
connectionRecoveryMinInterval: d = 2,
|
|
1971
1917
|
connectionRecoveryMaxInterval: T = 6,
|
|
1972
1918
|
userAgent: S
|
|
1973
1919
|
}) {
|
|
1974
|
-
|
|
1920
|
+
b.validateParametersConnection({
|
|
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 =
|
|
1927
|
+
const l = b.resolveAuthorizationUser(a, e), E = ke(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:
|
|
1932
|
+
uri: m,
|
|
1933
|
+
display_name: se(i),
|
|
1988
1934
|
user_agent: S,
|
|
1989
1935
|
sdpSemantics: "unified-plan",
|
|
1990
|
-
sockets: [
|
|
1936
|
+
sockets: [R],
|
|
1991
1937
|
session_timers: o,
|
|
1992
|
-
register_expires:
|
|
1938
|
+
register_expires: c,
|
|
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 = b.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
|
|
2017
|
-
|
|
2018
|
-
}), { ua:
|
|
1962
|
+
const c = le.find((d) => d === o);
|
|
1963
|
+
c && r.on(c, a);
|
|
1964
|
+
}), { ua: r, helpers: i };
|
|
2019
1965
|
}
|
|
2020
1966
|
}
|
|
2021
|
-
const Te = "Not ready for connection",
|
|
2022
|
-
class
|
|
1967
|
+
const Te = "Not ready for connection", At = (n) => n instanceof Error && n.message === Te, Nt = () => new Error(Te), Rt = async (n) => typeof n == "function" ? n() : n;
|
|
1968
|
+
class It {
|
|
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(ue), this.uaFactory = new b(e), this.registrationManager = new St({
|
|
2035
1981
|
events: this.events,
|
|
2036
1982
|
getUaProtected: this.getUaProtected
|
|
2037
|
-
}), this.stateMachine = new
|
|
1983
|
+
}), this.stateMachine = new Tt(this.events), this.configurationManager = new ht({
|
|
2038
1984
|
getUa: this.getUa
|
|
2039
|
-
}), this.sipOperations = new
|
|
1985
|
+
}), this.sipOperations = new Ct({
|
|
2040
1986
|
uaFactory: this.uaFactory,
|
|
2041
1987
|
getUaProtected: this.getUaProtected
|
|
2042
|
-
}), this.connectionFlow = new
|
|
1988
|
+
}), this.connectionFlow = new ut({
|
|
2043
1989
|
JsSIP: this.JsSIP,
|
|
2044
1990
|
events: this.events,
|
|
2045
1991
|
uaFactory: this.uaFactory,
|
|
@@ -2086,13 +2032,13 @@ class pt {
|
|
|
2086
2032
|
return this.stateMachine.state;
|
|
2087
2033
|
}
|
|
2088
2034
|
get isRegistered() {
|
|
2089
|
-
return
|
|
2035
|
+
return b.isRegisteredUA(this.ua);
|
|
2090
2036
|
}
|
|
2091
2037
|
get isRegisterConfig() {
|
|
2092
2038
|
return this.configurationManager.isRegister();
|
|
2093
2039
|
}
|
|
2094
2040
|
connect = async (e, t) => this.disconnect().catch((s) => {
|
|
2095
|
-
|
|
2041
|
+
h("connect: disconnect error", s);
|
|
2096
2042
|
}).then(async () => this.connectWithProcessError(e, t));
|
|
2097
2043
|
set = async ({ displayName: e }) => this.connectionFlow.set({ displayName: e });
|
|
2098
2044
|
disconnect = async () => {
|
|
@@ -2141,26 +2087,26 @@ 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 Nt();
|
|
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
|
};
|
|
2154
|
-
processConnect = async (e, t) => (this.events.trigger(C.CONNECT_STARTED, {}),
|
|
2100
|
+
processConnect = async (e, t) => (this.events.trigger(C.CONNECT_STARTED, {}), Rt(e).then((s) => (this.events.trigger(C.CONNECT_PARAMETERS_RESOLVE_SUCCESS, s), s)).catch((s) => {
|
|
2155
2101
|
throw this.events.trigger(C.CONNECT_PARAMETERS_RESOLVE_FAILED, s), s;
|
|
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 mt {
|
|
2164
2110
|
connectionManager;
|
|
2165
2111
|
stackPromises = te({
|
|
2166
2112
|
noRunIsNotActual: !0
|
|
@@ -2174,11 +2120,11 @@ class _t {
|
|
|
2174
2120
|
this.stackPromises.stop();
|
|
2175
2121
|
}
|
|
2176
2122
|
}
|
|
2177
|
-
const Y = 0,
|
|
2178
|
-
class
|
|
2123
|
+
const Y = 0, pt = 30;
|
|
2124
|
+
class _t {
|
|
2179
2125
|
countInner = Y;
|
|
2180
2126
|
initialCount = Y;
|
|
2181
|
-
limitInner =
|
|
2127
|
+
limitInner = pt;
|
|
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 Mt {
|
|
2215
2161
|
connectionManager;
|
|
2216
2162
|
interval;
|
|
2217
2163
|
checkTelephonyByTimeout = void 0;
|
|
@@ -2233,8 +2179,8 @@ class vt {
|
|
|
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,
|
|
@@ -2256,28 +2202,28 @@ const Se = [
|
|
|
2256
2202
|
"changed-attempt-status",
|
|
2257
2203
|
"stop-attempts-by-error",
|
|
2258
2204
|
"limit-reached-attempts"
|
|
2259
|
-
],
|
|
2260
|
-
class
|
|
2205
|
+
], ft = 15e3, Pt = 2;
|
|
2206
|
+
class vt {
|
|
2261
2207
|
connectionManager;
|
|
2262
2208
|
pingServerByTimeoutWithFailCalls;
|
|
2263
2209
|
constructor({ connectionManager: e }) {
|
|
2264
|
-
this.connectionManager = e, this.pingServerByTimeoutWithFailCalls = Me(
|
|
2210
|
+
this.connectionManager = e, this.pingServerByTimeoutWithFailCalls = Me(Pt, {
|
|
2265
2211
|
whenPossibleRequest: async () => {
|
|
2266
2212
|
},
|
|
2267
|
-
requestInterval:
|
|
2268
|
-
request: async () => (
|
|
2269
|
-
|
|
2213
|
+
requestInterval: ft,
|
|
2214
|
+
request: async () => (h("ping"), this.connectionManager.ping().then(() => {
|
|
2215
|
+
h("ping success");
|
|
2270
2216
|
}))
|
|
2271
2217
|
});
|
|
2272
2218
|
}
|
|
2273
2219
|
start({ onFailRequest: e }) {
|
|
2274
|
-
this.pingServerByTimeoutWithFailCalls.start(void 0, { onFailRequest: e }).catch(
|
|
2220
|
+
this.pingServerByTimeoutWithFailCalls.start(void 0, { onFailRequest: e }).catch(h);
|
|
2275
2221
|
}
|
|
2276
2222
|
stop() {
|
|
2277
2223
|
this.pingServerByTimeoutWithFailCalls.stop();
|
|
2278
2224
|
}
|
|
2279
2225
|
}
|
|
2280
|
-
class
|
|
2226
|
+
class Ot {
|
|
2281
2227
|
callManager;
|
|
2282
2228
|
pingServerRequester;
|
|
2283
2229
|
disposeCallStatusChange;
|
|
@@ -2285,17 +2231,17 @@ class Dt {
|
|
|
2285
2231
|
connectionManager: e,
|
|
2286
2232
|
callManager: t
|
|
2287
2233
|
}) {
|
|
2288
|
-
this.callManager = t, this.pingServerRequester = new
|
|
2234
|
+
this.callManager = t, this.pingServerRequester = new vt({
|
|
2289
2235
|
connectionManager: e
|
|
2290
2236
|
});
|
|
2291
2237
|
}
|
|
2292
2238
|
start({ onFailRequest: e }) {
|
|
2293
|
-
|
|
2239
|
+
h("start"), this.disposeCallStatusChange = this.callManager.on("call-status-changed", () => {
|
|
2294
2240
|
this.handleCallStatusChange({ onFailRequest: e });
|
|
2295
2241
|
}), this.handleCallStatusChange({ onFailRequest: e });
|
|
2296
2242
|
}
|
|
2297
2243
|
stop() {
|
|
2298
|
-
|
|
2244
|
+
h("stop"), this.pingServerRequester.stop(), this.unsubscribeCallStatusChange();
|
|
2299
2245
|
}
|
|
2300
2246
|
unsubscribeCallStatusChange() {
|
|
2301
2247
|
this.disposeCallStatusChange?.(), this.disposeCallStatusChange = void 0;
|
|
@@ -2304,7 +2250,7 @@ class Dt {
|
|
|
2304
2250
|
this.callManager.isCallActive ? this.pingServerRequester.stop() : this.pingServerRequester.start({ onFailRequest: e });
|
|
2305
2251
|
}
|
|
2306
2252
|
}
|
|
2307
|
-
class
|
|
2253
|
+
class Dt {
|
|
2308
2254
|
connectionManager;
|
|
2309
2255
|
callManager;
|
|
2310
2256
|
isRegistrationFailed = !1;
|
|
@@ -2338,12 +2284,12 @@ class bt {
|
|
|
2338
2284
|
this.isRegistrationFailed = !1;
|
|
2339
2285
|
}
|
|
2340
2286
|
}
|
|
2341
|
-
const
|
|
2287
|
+
const bt = 3e3, yt = 15e3, z = {
|
|
2342
2288
|
LIMIT_REACHED: "Limit reached",
|
|
2343
2289
|
FAILED_TO_RECONNECT: "Failed to reconnect"
|
|
2344
|
-
},
|
|
2345
|
-
},
|
|
2346
|
-
class
|
|
2290
|
+
}, wt = async () => {
|
|
2291
|
+
}, Ut = (n) => !0;
|
|
2292
|
+
class Lt {
|
|
2347
2293
|
events;
|
|
2348
2294
|
connectionManager;
|
|
2349
2295
|
connectionQueueManager;
|
|
@@ -2361,29 +2307,29 @@ class Ft {
|
|
|
2361
2307
|
connectionQueueManager: e,
|
|
2362
2308
|
connectionManager: t,
|
|
2363
2309
|
callManager: s
|
|
2364
|
-
},
|
|
2365
|
-
const
|
|
2366
|
-
this.connectionQueueManager = e, this.connectionManager = t, this.onBeforeRetry =
|
|
2310
|
+
}, i) {
|
|
2311
|
+
const r = i?.onBeforeRetry ?? wt, a = i?.canRetryOnError ?? Ut;
|
|
2312
|
+
this.connectionQueueManager = e, this.connectionManager = t, this.onBeforeRetry = r, this.canRetryOnError = a, this.networkInterfacesSubscriber = i?.networkInterfacesSubscriber, this.resumeFromSleepModeSubscriber = i?.resumeFromSleepModeSubscriber, this.events = new O(Se), this.checkTelephonyRequester = new Mt({
|
|
2367
2313
|
connectionManager: t,
|
|
2368
|
-
interval:
|
|
2369
|
-
}), this.pingServerIfNotActiveCallRequester = new
|
|
2314
|
+
interval: i?.checkTelephonyRequestInterval ?? yt
|
|
2315
|
+
}), this.pingServerIfNotActiveCallRequester = new Ot({
|
|
2370
2316
|
connectionManager: t,
|
|
2371
2317
|
callManager: s
|
|
2372
|
-
}), this.registrationFailedOutOfCallSubscriber = new
|
|
2318
|
+
}), this.registrationFailedOutOfCallSubscriber = new Dt({
|
|
2373
2319
|
connectionManager: t,
|
|
2374
2320
|
callManager: s
|
|
2375
|
-
}), this.attemptsState = new
|
|
2321
|
+
}), this.attemptsState = new _t({
|
|
2376
2322
|
onStatusChange: this.emitStatusChange
|
|
2377
|
-
}), this.cancelableRequestBeforeRetry = new x(
|
|
2378
|
-
|
|
2323
|
+
}), this.cancelableRequestBeforeRetry = new x(r), this.delayBetweenAttempts = new fe(
|
|
2324
|
+
i?.timeoutBetweenAttempts ?? bt
|
|
2379
2325
|
);
|
|
2380
2326
|
}
|
|
2381
2327
|
start(e) {
|
|
2382
|
-
|
|
2328
|
+
h("auto connector start"), this.restartConnectionAttempts(e), this.subscribeToHardwareTriggers(e);
|
|
2383
2329
|
}
|
|
2384
2330
|
stop() {
|
|
2385
|
-
|
|
2386
|
-
|
|
2331
|
+
h("auto connector stop"), this.unsubscribeFromHardwareTriggers(), this.stopConnectionFlow().catch((e) => {
|
|
2332
|
+
h("auto connector stop from stop method: error", e);
|
|
2387
2333
|
});
|
|
2388
2334
|
}
|
|
2389
2335
|
on(e, t) {
|
|
@@ -2402,78 +2348,78 @@ class Ft {
|
|
|
2402
2348
|
this.events.off(e, t);
|
|
2403
2349
|
}
|
|
2404
2350
|
restartConnectionAttempts(e) {
|
|
2405
|
-
|
|
2406
|
-
|
|
2351
|
+
h("auto connector restart connection attempts"), this.stopConnectionFlow().then(async () => this.attemptConnection(e)).catch((t) => {
|
|
2352
|
+
h("auto connector failed to restart connection attempts:", t);
|
|
2407
2353
|
});
|
|
2408
2354
|
}
|
|
2409
2355
|
async stopConnectionFlow() {
|
|
2410
|
-
|
|
2356
|
+
h("stopConnectionFlow"), this.stopAttempts(), this.stopConnectTriggers(), await this.connectionQueueManager.disconnect();
|
|
2411
2357
|
}
|
|
2412
2358
|
stopAttempts() {
|
|
2413
2359
|
this.attemptsState.isAttemptInProgress && this.connectionQueueManager.stop(), this.delayBetweenAttempts.cancelRequest(), this.cancelableRequestBeforeRetry.cancelRequest(), this.attemptsState.reset();
|
|
2414
2360
|
}
|
|
2415
2361
|
stopConnectTriggers() {
|
|
2416
|
-
|
|
2362
|
+
h("stopConnectTriggers"), this.stopPingRequester(), this.checkTelephonyRequester.stop(), this.registrationFailedOutOfCallSubscriber.unsubscribe();
|
|
2417
2363
|
}
|
|
2418
2364
|
startCheckTelephony(e) {
|
|
2419
|
-
|
|
2365
|
+
h("startCheckTelephony"), this.checkTelephonyRequester.start({
|
|
2420
2366
|
onBeforeRequest: async () => (await this.onBeforeRetry(), e.getParameters()),
|
|
2421
2367
|
onSuccessRequest: () => {
|
|
2422
|
-
|
|
2368
|
+
h("startCheckTelephony: onSuccessRequest"), this.connectIfDisconnected(e);
|
|
2423
2369
|
},
|
|
2424
2370
|
onFailRequest: (t) => {
|
|
2425
|
-
|
|
2371
|
+
h("startCheckTelephony: onFailRequest", t.message);
|
|
2426
2372
|
}
|
|
2427
2373
|
});
|
|
2428
2374
|
}
|
|
2429
2375
|
async attemptConnection(e) {
|
|
2430
|
-
if (
|
|
2431
|
-
|
|
2376
|
+
if (h("attemptConnection: attempts.count", this.attemptsState.count), this.events.trigger(_.BEFORE_ATTEMPT, {}), this.stopConnectTriggers(), this.attemptsState.hasLimitReached()) {
|
|
2377
|
+
h("attemptConnection: limit reached"), this.handleLimitReached(e);
|
|
2432
2378
|
return;
|
|
2433
2379
|
}
|
|
2434
2380
|
return this.attemptsState.startAttempt(), this.attemptsState.increment(), this.executeConnectionAttempt(e);
|
|
2435
2381
|
}
|
|
2436
2382
|
async executeConnectionAttempt(e) {
|
|
2437
2383
|
try {
|
|
2438
|
-
await this.connectionQueueManager.connect(e.getParameters, e.options),
|
|
2384
|
+
await this.connectionQueueManager.connect(e.getParameters, e.options), h("executeConnectionAttempt: success"), this.handleSucceededAttempt(e);
|
|
2439
2385
|
} catch (t) {
|
|
2440
2386
|
this.handleConnectionError(t, e);
|
|
2441
2387
|
}
|
|
2442
2388
|
}
|
|
2443
2389
|
handleConnectionError(e, t) {
|
|
2444
|
-
if (
|
|
2390
|
+
if (At(e)) {
|
|
2445
2391
|
this.attemptsState.finishAttempt(), this.events.trigger(_.STOP_ATTEMPTS_BY_ERROR, e);
|
|
2446
2392
|
return;
|
|
2447
2393
|
}
|
|
2448
2394
|
if (!this.canRetryOnError(e)) {
|
|
2449
|
-
|
|
2395
|
+
h("executeConnectionAttempt: error does not allow retry", e), this.attemptsState.finishAttempt(), this.events.trigger(_.STOP_ATTEMPTS_BY_ERROR, e);
|
|
2450
2396
|
return;
|
|
2451
2397
|
}
|
|
2452
|
-
if (
|
|
2453
|
-
|
|
2398
|
+
if (be(e)) {
|
|
2399
|
+
h("executeConnectionAttempt: not actual error", e), this.attemptsState.finishAttempt(), this.events.trigger(_.CANCELLED_ATTEMPTS, e);
|
|
2454
2400
|
return;
|
|
2455
2401
|
}
|
|
2456
|
-
|
|
2402
|
+
h("executeConnectionAttempt: error", e), this.scheduleReconnect(t);
|
|
2457
2403
|
}
|
|
2458
2404
|
handleLimitReached(e) {
|
|
2459
2405
|
this.attemptsState.finishAttempt(), this.events.trigger(_.LIMIT_REACHED_ATTEMPTS, new Error(z.LIMIT_REACHED)), this.startCheckTelephony(e);
|
|
2460
2406
|
}
|
|
2461
2407
|
handleSucceededAttempt(e) {
|
|
2462
|
-
|
|
2408
|
+
h("handleSucceededAttempt"), this.subscribeToConnectTriggers(e), this.events.trigger(_.SUCCESS);
|
|
2463
2409
|
}
|
|
2464
2410
|
subscribeToConnectTriggers(e) {
|
|
2465
2411
|
this.startPingRequester(e), this.registrationFailedOutOfCallSubscriber.subscribe(() => {
|
|
2466
|
-
|
|
2412
|
+
h("registrationFailedOutOfCallListener callback"), this.restartConnectionAttempts(e);
|
|
2467
2413
|
});
|
|
2468
2414
|
}
|
|
2469
2415
|
subscribeToHardwareTriggers(e) {
|
|
2470
|
-
this.unsubscribeFromHardwareTriggers(),
|
|
2416
|
+
this.unsubscribeFromHardwareTriggers(), h("subscribeToHardwareTriggers"), this.networkInterfacesSubscriber?.subscribe({
|
|
2471
2417
|
onChange: () => {
|
|
2472
|
-
|
|
2418
|
+
h("networkInterfacesSubscriber onChange"), this.restartConnectionAttempts(e);
|
|
2473
2419
|
},
|
|
2474
2420
|
onUnavailable: () => {
|
|
2475
|
-
|
|
2476
|
-
|
|
2421
|
+
h("networkInterfacesSubscriber onUnavailable"), this.stopConnectionFlow().catch((t) => {
|
|
2422
|
+
h(
|
|
2477
2423
|
"auto connector stop from networkInterfacesSubscriber onUnavailable: error",
|
|
2478
2424
|
t
|
|
2479
2425
|
);
|
|
@@ -2481,12 +2427,12 @@ class Ft {
|
|
|
2481
2427
|
}
|
|
2482
2428
|
}), this.resumeFromSleepModeSubscriber?.subscribe({
|
|
2483
2429
|
onResume: () => {
|
|
2484
|
-
|
|
2430
|
+
h("resumeFromSleepModeSubscriber onResume"), this.restartConnectionAttempts(e);
|
|
2485
2431
|
}
|
|
2486
2432
|
});
|
|
2487
2433
|
}
|
|
2488
2434
|
unsubscribeFromHardwareTriggers() {
|
|
2489
|
-
|
|
2435
|
+
h("unsubscribeFromHardwareTriggers"), this.networkInterfacesSubscriber?.unsubscribe(), this.resumeFromSleepModeSubscriber?.unsubscribe();
|
|
2490
2436
|
}
|
|
2491
2437
|
stopPingRequester() {
|
|
2492
2438
|
this.pingServerIfNotActiveCallRequester.stop();
|
|
@@ -2494,18 +2440,18 @@ class Ft {
|
|
|
2494
2440
|
startPingRequester(e) {
|
|
2495
2441
|
this.pingServerIfNotActiveCallRequester.start({
|
|
2496
2442
|
onFailRequest: () => {
|
|
2497
|
-
|
|
2443
|
+
h("pingRequester: onFailRequest"), this.restartConnectionAttempts(e);
|
|
2498
2444
|
}
|
|
2499
2445
|
});
|
|
2500
2446
|
}
|
|
2501
2447
|
connectIfDisconnected(e) {
|
|
2502
2448
|
const t = this.isConnectionUnavailable();
|
|
2503
|
-
|
|
2449
|
+
h("connectIfDisconnected: isUnavailable", t), t ? this.restartConnectionAttempts(e) : (this.stopConnectTriggers(), this.events.trigger(_.SUCCESS));
|
|
2504
2450
|
}
|
|
2505
2451
|
scheduleReconnect(e) {
|
|
2506
|
-
|
|
2452
|
+
h("scheduleReconnect"), this.delayBetweenAttempts.request().then(async () => (h("scheduleReconnect: delayBetweenAttempts success"), this.cancelableRequestBeforeRetry.request())).then(async () => (h("scheduleReconnect: onBeforeRetry success"), this.attemptConnection(e))).catch((t) => {
|
|
2507
2453
|
const s = t instanceof Error ? t : new Error(z.FAILED_TO_RECONNECT);
|
|
2508
|
-
this.attemptsState.finishAttempt(), pe(t) ||
|
|
2454
|
+
this.attemptsState.finishAttempt(), pe(t) || Pe(t) ? this.events.trigger(_.CANCELLED_ATTEMPTS, s) : this.events.trigger(_.FAILED_ALL_ATTEMPTS, s), h("scheduleReconnect: error", t);
|
|
2509
2455
|
});
|
|
2510
2456
|
}
|
|
2511
2457
|
isConnectionUnavailable() {
|
|
@@ -2522,13 +2468,13 @@ const Ce = [
|
|
|
2522
2468
|
"declinedIncomingCall",
|
|
2523
2469
|
"terminatedIncomingCall",
|
|
2524
2470
|
"failedIncomingCall"
|
|
2525
|
-
],
|
|
2526
|
-
class
|
|
2471
|
+
], Bt = 486, Ft = 487;
|
|
2472
|
+
class kt {
|
|
2527
2473
|
events;
|
|
2528
2474
|
incomingRTCSession;
|
|
2529
2475
|
connectionManager;
|
|
2530
2476
|
constructor(e) {
|
|
2531
|
-
this.connectionManager = e, this.events = new
|
|
2477
|
+
this.connectionManager = e, this.events = new O(Ce), this.start();
|
|
2532
2478
|
}
|
|
2533
2479
|
get remoteCallerData() {
|
|
2534
2480
|
return {
|
|
@@ -2558,19 +2504,19 @@ class qt {
|
|
|
2558
2504
|
return this.removeIncomingSession(), e;
|
|
2559
2505
|
};
|
|
2560
2506
|
async declineToIncomingCall({
|
|
2561
|
-
statusCode: e =
|
|
2507
|
+
statusCode: e = Ft
|
|
2562
2508
|
} = {}) {
|
|
2563
2509
|
return new Promise((t, s) => {
|
|
2564
2510
|
try {
|
|
2565
|
-
const
|
|
2566
|
-
this.removeIncomingSession(), this.events.trigger(w.DECLINED_INCOMING_CALL,
|
|
2567
|
-
} catch (
|
|
2568
|
-
s(
|
|
2511
|
+
const i = this.getIncomingRTCSession(), r = this.remoteCallerData;
|
|
2512
|
+
this.removeIncomingSession(), this.events.trigger(w.DECLINED_INCOMING_CALL, r), i.terminate({ status_code: e }), t();
|
|
2513
|
+
} catch (i) {
|
|
2514
|
+
s(i);
|
|
2569
2515
|
}
|
|
2570
2516
|
});
|
|
2571
2517
|
}
|
|
2572
2518
|
async busyIncomingCall() {
|
|
2573
|
-
return this.declineToIncomingCall({ statusCode:
|
|
2519
|
+
return this.declineToIncomingCall({ statusCode: Bt });
|
|
2574
2520
|
}
|
|
2575
2521
|
on(e, t) {
|
|
2576
2522
|
return this.events.on(e, t);
|
|
@@ -2610,12 +2556,12 @@ class qt {
|
|
|
2610
2556
|
delete this.incomingRTCSession;
|
|
2611
2557
|
}
|
|
2612
2558
|
}
|
|
2613
|
-
const
|
|
2559
|
+
const y = 1e3;
|
|
2614
2560
|
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
2561
|
const Ee = ["collected"], X = () => "performance" in window ? performance.now() : Date.now(), U = (n) => [...n.keys()].reduce((e, t) => {
|
|
2616
2562
|
const s = n.get(t);
|
|
2617
2563
|
return s === void 0 ? e : { ...e, [s.type]: s };
|
|
2618
|
-
}, {}),
|
|
2564
|
+
}, {}), $t = (n) => {
|
|
2619
2565
|
if (!n)
|
|
2620
2566
|
return {
|
|
2621
2567
|
outboundRtp: void 0,
|
|
@@ -2661,7 +2607,7 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2661
2607
|
codec: t[A.CODEC],
|
|
2662
2608
|
synchronizationSources: e
|
|
2663
2609
|
};
|
|
2664
|
-
},
|
|
2610
|
+
}, qt = ({
|
|
2665
2611
|
audioReceiverStats: n,
|
|
2666
2612
|
synchronizationSourcesAudio: e
|
|
2667
2613
|
}) => {
|
|
@@ -2703,11 +2649,11 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2703
2649
|
}) => ({
|
|
2704
2650
|
video: J(e),
|
|
2705
2651
|
secondVideo: J(t),
|
|
2706
|
-
audio:
|
|
2652
|
+
audio: $t(n),
|
|
2707
2653
|
additional: Ae(
|
|
2708
2654
|
n ?? e ?? t
|
|
2709
2655
|
)
|
|
2710
|
-
}),
|
|
2656
|
+
}), Vt = ({
|
|
2711
2657
|
audioReceiverStats: n,
|
|
2712
2658
|
videoReceiverFirstStats: e,
|
|
2713
2659
|
videoReceiverSecondStats: t,
|
|
@@ -2721,59 +2667,59 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2721
2667
|
videoReceiversStats: t,
|
|
2722
2668
|
synchronizationSourcesVideo: s.video
|
|
2723
2669
|
}),
|
|
2724
|
-
audio:
|
|
2670
|
+
audio: qt({
|
|
2725
2671
|
audioReceiverStats: n,
|
|
2726
2672
|
synchronizationSourcesAudio: s.audio
|
|
2727
2673
|
}),
|
|
2728
2674
|
additional: Ae(
|
|
2729
2675
|
n ?? e ?? t
|
|
2730
2676
|
)
|
|
2731
|
-
}),
|
|
2677
|
+
}), Ht = ({
|
|
2732
2678
|
audioSenderStats: n,
|
|
2733
2679
|
videoSenderFirstStats: e,
|
|
2734
2680
|
videoSenderSecondStats: t,
|
|
2735
2681
|
audioReceiverStats: s,
|
|
2736
|
-
videoReceiverFirstStats:
|
|
2737
|
-
videoReceiverSecondStats:
|
|
2682
|
+
videoReceiverFirstStats: i,
|
|
2683
|
+
videoReceiverSecondStats: r,
|
|
2738
2684
|
synchronizationSources: a
|
|
2739
2685
|
}) => {
|
|
2740
2686
|
const o = Wt({
|
|
2741
2687
|
audioSenderStats: n,
|
|
2742
2688
|
videoSenderFirstStats: e,
|
|
2743
2689
|
videoSenderSecondStats: t
|
|
2744
|
-
}),
|
|
2690
|
+
}), c = Vt({
|
|
2745
2691
|
audioReceiverStats: s,
|
|
2746
|
-
videoReceiverFirstStats:
|
|
2747
|
-
videoReceiverSecondStats:
|
|
2692
|
+
videoReceiverFirstStats: i,
|
|
2693
|
+
videoReceiverSecondStats: r,
|
|
2748
2694
|
synchronizationSources: a
|
|
2749
2695
|
});
|
|
2750
2696
|
return {
|
|
2751
2697
|
outbound: o,
|
|
2752
|
-
inbound:
|
|
2698
|
+
inbound: c
|
|
2753
2699
|
};
|
|
2754
|
-
},
|
|
2755
|
-
const e = "audio", t = "video", s = n.getSenders(),
|
|
2700
|
+
}, xt = async (n) => {
|
|
2701
|
+
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), c = a.filter((l) => l.track.kind === t), d = {
|
|
2756
2702
|
trackIdentifier: o?.track.id,
|
|
2757
2703
|
item: o?.getSynchronizationSources()[0]
|
|
2758
2704
|
}, T = {
|
|
2759
|
-
trackIdentifier:
|
|
2760
|
-
item:
|
|
2705
|
+
trackIdentifier: c[0]?.track.id,
|
|
2706
|
+
item: c[0]?.getSynchronizationSources()[0]
|
|
2761
2707
|
}, S = {
|
|
2762
2708
|
audio: d,
|
|
2763
2709
|
video: T
|
|
2764
2710
|
};
|
|
2765
2711
|
return Promise.all([
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2712
|
+
i?.getStats() ?? Promise.resolve(void 0),
|
|
2713
|
+
r[0]?.getStats() ?? Promise.resolve(void 0),
|
|
2714
|
+
r[1]?.getStats() ?? Promise.resolve(void 0),
|
|
2769
2715
|
o?.getStats() ?? Promise.resolve(void 0),
|
|
2770
|
-
|
|
2771
|
-
|
|
2716
|
+
c[0]?.getStats() ?? Promise.resolve(void 0),
|
|
2717
|
+
c[1]?.getStats() ?? Promise.resolve(void 0)
|
|
2772
2718
|
]).then((l) => {
|
|
2773
2719
|
const [
|
|
2774
2720
|
E,
|
|
2775
|
-
|
|
2776
|
-
|
|
2721
|
+
m,
|
|
2722
|
+
R,
|
|
2777
2723
|
M,
|
|
2778
2724
|
F,
|
|
2779
2725
|
k
|
|
@@ -2781,29 +2727,29 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2781
2727
|
return {
|
|
2782
2728
|
synchronizationSources: S,
|
|
2783
2729
|
audioSenderStats: E,
|
|
2784
|
-
videoSenderFirstStats:
|
|
2785
|
-
videoSenderSecondStats:
|
|
2730
|
+
videoSenderFirstStats: m,
|
|
2731
|
+
videoSenderSecondStats: R,
|
|
2786
2732
|
audioReceiverStats: M,
|
|
2787
2733
|
videoReceiverFirstStats: F,
|
|
2788
2734
|
videoReceiverSecondStats: k
|
|
2789
2735
|
};
|
|
2790
2736
|
});
|
|
2791
|
-
},
|
|
2792
|
-
|
|
2737
|
+
}, Gt = (n) => {
|
|
2738
|
+
h(String(n));
|
|
2793
2739
|
};
|
|
2794
|
-
class
|
|
2740
|
+
class Qt {
|
|
2795
2741
|
events;
|
|
2796
2742
|
setTimeoutRequest;
|
|
2797
|
-
requesterAllStatistics = new x(
|
|
2743
|
+
requesterAllStatistics = new x(xt);
|
|
2798
2744
|
constructor() {
|
|
2799
|
-
this.events = new
|
|
2745
|
+
this.events = new O(Ee), this.setTimeoutRequest = new Z();
|
|
2800
2746
|
}
|
|
2801
2747
|
get requested() {
|
|
2802
2748
|
return this.setTimeoutRequest.requested;
|
|
2803
2749
|
}
|
|
2804
2750
|
start(e, {
|
|
2805
|
-
interval: t =
|
|
2806
|
-
onError: s =
|
|
2751
|
+
interval: t = y,
|
|
2752
|
+
onError: s = Gt
|
|
2807
2753
|
} = {}) {
|
|
2808
2754
|
this.stop(), this.setTimeoutRequest.request(() => {
|
|
2809
2755
|
this.collectStatistics(e, {
|
|
@@ -2833,20 +2779,20 @@ class zt {
|
|
|
2833
2779
|
onError: t
|
|
2834
2780
|
}) => {
|
|
2835
2781
|
const s = X();
|
|
2836
|
-
this.requesterAllStatistics.request(e).then((
|
|
2837
|
-
this.events.trigger("collected",
|
|
2782
|
+
this.requesterAllStatistics.request(e).then((i) => {
|
|
2783
|
+
this.events.trigger("collected", Ht(i));
|
|
2838
2784
|
const a = X() - s;
|
|
2839
|
-
let o =
|
|
2840
|
-
a > 48 ? o =
|
|
2785
|
+
let o = y;
|
|
2786
|
+
a > 48 ? o = y * 4 : a > 32 ? o = y * 3 : a > 16 && (o = y * 2), this.start(e, {
|
|
2841
2787
|
onError: t,
|
|
2842
2788
|
interval: o
|
|
2843
2789
|
});
|
|
2844
|
-
}).catch((
|
|
2845
|
-
t && t(
|
|
2790
|
+
}).catch((i) => {
|
|
2791
|
+
t && t(i);
|
|
2846
2792
|
});
|
|
2847
2793
|
};
|
|
2848
2794
|
}
|
|
2849
|
-
class
|
|
2795
|
+
class Yt {
|
|
2850
2796
|
availableIncomingBitrate;
|
|
2851
2797
|
statsPeerConnection;
|
|
2852
2798
|
callManager;
|
|
@@ -2856,7 +2802,7 @@ class Xt {
|
|
|
2856
2802
|
callManager: e,
|
|
2857
2803
|
apiManager: t
|
|
2858
2804
|
}) {
|
|
2859
|
-
this.callManager = e, this.apiManager = t, this.statsPeerConnection = new
|
|
2805
|
+
this.callManager = e, this.apiManager = t, this.statsPeerConnection = new Qt(), this.subscribe();
|
|
2860
2806
|
}
|
|
2861
2807
|
get events() {
|
|
2862
2808
|
return this.statsPeerConnection.events;
|
|
@@ -2894,144 +2840,36 @@ class Xt {
|
|
|
2894
2840
|
};
|
|
2895
2841
|
maybeSendStats() {
|
|
2896
2842
|
this.availableIncomingBitrate !== void 0 && this.hasAvailableIncomingBitrateChangedQuarter() && this.apiManager.sendStats({ availableIncomingBitrate: this.availableIncomingBitrate }).catch((e) => {
|
|
2897
|
-
|
|
2843
|
+
h("Failed to send stats", e);
|
|
2898
2844
|
});
|
|
2899
2845
|
}
|
|
2900
2846
|
}
|
|
2901
|
-
const
|
|
2902
|
-
const e = RTCRtpSender.getCapabilities(n), t = RTCRtpReceiver.getCapabilities(n), s = e === null ? [] : e.codecs,
|
|
2903
|
-
return
|
|
2904
|
-
},
|
|
2905
|
-
const
|
|
2847
|
+
const zt = (n, e) => n.filter((s) => e.some((i) => i.clockRate === s.clockRate && i.mimeType === s.mimeType && i.channels === s.channels && i.sdpFmtpLine === s.sdpFmtpLine)), Xt = (n) => {
|
|
2848
|
+
const e = RTCRtpSender.getCapabilities(n), t = RTCRtpReceiver.getCapabilities(n), s = e === null ? [] : e.codecs, i = t === null ? [] : t.codecs;
|
|
2849
|
+
return zt(s, i);
|
|
2850
|
+
}, Jt = (n, e) => e === void 0 || e.length === 0 ? n : n.sort((t, s) => {
|
|
2851
|
+
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
2852
|
return a - o;
|
|
2907
|
-
}),
|
|
2853
|
+
}), Kt = (n, e) => e === void 0 || e.length === 0 ? n : n.filter((t) => !e.includes(t.mimeType)), jt = (n, {
|
|
2908
2854
|
preferredMimeTypesVideoCodecs: e,
|
|
2909
2855
|
excludeMimeTypesVideoCodecs: t
|
|
2910
2856
|
}) => {
|
|
2911
2857
|
try {
|
|
2912
2858
|
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(
|
|
2859
|
+
const s = Xt("video"), i = Kt(s, t), r = Jt(i, e);
|
|
2860
|
+
n.setCodecPreferences(r);
|
|
2915
2861
|
}
|
|
2916
2862
|
} catch (s) {
|
|
2917
|
-
|
|
2918
|
-
}
|
|
2919
|
-
};
|
|
2920
|
-
class tn {
|
|
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;
|
|
2863
|
+
h("setCodecPreferences error", s);
|
|
2980
2864
|
}
|
|
2981
|
-
|
|
2982
|
-
|
|
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 {
|
|
2865
|
+
}, Zt = (n) => [...n.keys()].map((e) => n.get(e)), en = (n, e) => Zt(n).find((t) => t?.type === e), tn = async (n) => n.getStats().then((e) => en(e, "codec")?.mimeType);
|
|
2866
|
+
class nn {
|
|
3029
2867
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
3030
2868
|
async getCodecFromSender(e) {
|
|
3031
|
-
return await
|
|
2869
|
+
return await tn(e) ?? "";
|
|
3032
2870
|
}
|
|
3033
2871
|
}
|
|
3034
|
-
class
|
|
2872
|
+
class sn {
|
|
3035
2873
|
stackPromises = te({
|
|
3036
2874
|
noRunIsNotActual: !0
|
|
3037
2875
|
});
|
|
@@ -3052,15 +2890,15 @@ class on {
|
|
|
3052
2890
|
*/
|
|
3053
2891
|
async run() {
|
|
3054
2892
|
return this.stackPromises().catch((e) => {
|
|
3055
|
-
|
|
2893
|
+
h("TaskQueue: error", e);
|
|
3056
2894
|
});
|
|
3057
2895
|
}
|
|
3058
2896
|
}
|
|
3059
|
-
class
|
|
2897
|
+
class rn {
|
|
3060
2898
|
taskQueue;
|
|
3061
2899
|
onSetParameters;
|
|
3062
2900
|
constructor(e) {
|
|
3063
|
-
this.onSetParameters = e, this.taskQueue = new
|
|
2901
|
+
this.onSetParameters = e, this.taskQueue = new sn();
|
|
3064
2902
|
}
|
|
3065
2903
|
async setEncodingsToSender(e, t) {
|
|
3066
2904
|
return this.taskQueue.add(async () => he(e, t, this.onSetParameters));
|
|
@@ -3069,17 +2907,17 @@ class cn {
|
|
|
3069
2907
|
this.taskQueue.stop();
|
|
3070
2908
|
}
|
|
3071
2909
|
}
|
|
3072
|
-
const
|
|
3073
|
-
const t =
|
|
2910
|
+
const Ne = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), an = 1e6, f = (n) => n * an, Re = f(0.06), Ie = f(4), on = (n) => n <= 64 ? Re : 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) : Ie, cn = "av1", hn = (n) => Ne(n, cn), dn = 0.6, Q = (n, e) => hn(e) ? n * dn : n, ln = (n) => Q(Re, n), un = (n) => Q(Ie, n), j = (n, e) => {
|
|
2911
|
+
const t = on(n);
|
|
3074
2912
|
return Q(t, e);
|
|
3075
|
-
}, $ = 1,
|
|
2913
|
+
}, $ = 1, gn = ({
|
|
3076
2914
|
videoTrack: n,
|
|
3077
2915
|
targetSize: e
|
|
3078
2916
|
}) => {
|
|
3079
|
-
const t = n.getSettings(), s = t.width,
|
|
3080
|
-
return Math.max(
|
|
2917
|
+
const t = n.getSettings(), s = t.width, i = t.height, r = s === void 0 ? $ : s / e.width, a = i === void 0 ? $ : i / e.height;
|
|
2918
|
+
return Math.max(r, a, $);
|
|
3081
2919
|
};
|
|
3082
|
-
class
|
|
2920
|
+
class Tn {
|
|
3083
2921
|
ignoreForCodec;
|
|
3084
2922
|
senderFinder;
|
|
3085
2923
|
codecProvider;
|
|
@@ -3098,8 +2936,8 @@ class En {
|
|
|
3098
2936
|
senderFinder: e,
|
|
3099
2937
|
codecProvider: t,
|
|
3100
2938
|
parametersSetter: s
|
|
3101
|
-
},
|
|
3102
|
-
this.senderFinder = e, this.codecProvider = t, this.parametersSetter = s, this.ignoreForCodec =
|
|
2939
|
+
}, i) {
|
|
2940
|
+
this.senderFinder = e, this.codecProvider = t, this.parametersSetter = s, this.ignoreForCodec = i.ignoreForCodec;
|
|
3103
2941
|
}
|
|
3104
2942
|
/**
|
|
3105
2943
|
* Выполняет балансировку на основе заголовков от сервера
|
|
@@ -3108,21 +2946,21 @@ class En {
|
|
|
3108
2946
|
* @returns Promise с результатом балансировки
|
|
3109
2947
|
*/
|
|
3110
2948
|
async balance(e, t) {
|
|
3111
|
-
const s = e.getSenders(),
|
|
3112
|
-
if (!
|
|
3113
|
-
return { ...this.resultNoChanged, sender:
|
|
3114
|
-
const
|
|
3115
|
-
if (
|
|
3116
|
-
return { ...this.resultNoChanged, sender:
|
|
2949
|
+
const s = e.getSenders(), i = this.senderFinder.findVideoSender(s);
|
|
2950
|
+
if (!i?.track)
|
|
2951
|
+
return { ...this.resultNoChanged, sender: i };
|
|
2952
|
+
const r = await this.codecProvider.getCodecFromSender(i);
|
|
2953
|
+
if (Ne(r, this.ignoreForCodec))
|
|
2954
|
+
return { ...this.resultNoChanged, sender: i };
|
|
3117
2955
|
const { mainCam: a, resolutionMainCam: o } = t ?? {};
|
|
3118
2956
|
return this.processSender(
|
|
3119
2957
|
{ mainCam: a, resolutionMainCam: o },
|
|
3120
2958
|
{
|
|
3121
|
-
sender:
|
|
3122
|
-
codec:
|
|
3123
|
-
videoTrack:
|
|
2959
|
+
sender: i,
|
|
2960
|
+
codec: r,
|
|
2961
|
+
videoTrack: i.track
|
|
3124
2962
|
}
|
|
3125
|
-
).then((
|
|
2963
|
+
).then((c) => ({ ...c, sender: i }));
|
|
3126
2964
|
}
|
|
3127
2965
|
/**
|
|
3128
2966
|
* Обрабатывает отправитель в зависимости от команды управления
|
|
@@ -3130,16 +2968,16 @@ class En {
|
|
|
3130
2968
|
* @returns Promise с результатом обработки
|
|
3131
2969
|
*/
|
|
3132
2970
|
async processSender(e, t) {
|
|
3133
|
-
const { mainCam: s, resolutionMainCam:
|
|
2971
|
+
const { mainCam: s, resolutionMainCam: i } = e;
|
|
3134
2972
|
switch (s) {
|
|
3135
|
-
case
|
|
2973
|
+
case P.PAUSE_MAIN_CAM:
|
|
3136
2974
|
return this.downgradeResolutionSender(t);
|
|
3137
|
-
case
|
|
2975
|
+
case P.RESUME_MAIN_CAM:
|
|
3138
2976
|
return this.setBitrateByTrackResolution(t);
|
|
3139
|
-
case
|
|
3140
|
-
return
|
|
3141
|
-
case
|
|
3142
|
-
case
|
|
2977
|
+
case P.MAX_MAIN_CAM_RESOLUTION:
|
|
2978
|
+
return i !== void 0 ? this.setResolutionSender(i, t) : this.setBitrateByTrackResolution(t);
|
|
2979
|
+
case P.ADMIN_STOP_MAIN_CAM:
|
|
2980
|
+
case P.ADMIN_START_MAIN_CAM:
|
|
3143
2981
|
case void 0:
|
|
3144
2982
|
return this.setBitrateByTrackResolution(t);
|
|
3145
2983
|
default:
|
|
@@ -3152,11 +2990,11 @@ class En {
|
|
|
3152
2990
|
* @returns Promise с результатом
|
|
3153
2991
|
*/
|
|
3154
2992
|
async downgradeResolutionSender(e) {
|
|
3155
|
-
const { sender: t, codec: s } = e,
|
|
2993
|
+
const { sender: t, codec: s } = e, i = {
|
|
3156
2994
|
scaleResolutionDownBy: 200,
|
|
3157
|
-
maxBitrate:
|
|
2995
|
+
maxBitrate: ln(s)
|
|
3158
2996
|
};
|
|
3159
|
-
return this.parametersSetter.setEncodingsToSender(t,
|
|
2997
|
+
return this.parametersSetter.setEncodingsToSender(t, i);
|
|
3160
2998
|
}
|
|
3161
2999
|
/**
|
|
3162
3000
|
* Устанавливает битрейт на основе разрешения трека
|
|
@@ -3164,7 +3002,7 @@ class En {
|
|
|
3164
3002
|
* @returns Promise с результатом
|
|
3165
3003
|
*/
|
|
3166
3004
|
async setBitrateByTrackResolution(e) {
|
|
3167
|
-
const { sender: t, videoTrack: s, codec:
|
|
3005
|
+
const { sender: t, videoTrack: s, codec: i } = e, a = s.getSettings().width, o = a === void 0 ? un(i) : j(a, i);
|
|
3168
3006
|
return this.parametersSetter.setEncodingsToSender(t, {
|
|
3169
3007
|
scaleResolutionDownBy: 1,
|
|
3170
3008
|
maxBitrate: o
|
|
@@ -3177,27 +3015,27 @@ class En {
|
|
|
3177
3015
|
* @returns Promise с результатом
|
|
3178
3016
|
*/
|
|
3179
3017
|
async setResolutionSender(e, t) {
|
|
3180
|
-
const [s,
|
|
3018
|
+
const [s, i] = e.split("x"), { sender: r, videoTrack: a, codec: o } = t, c = {
|
|
3181
3019
|
width: Number(s),
|
|
3182
|
-
height: Number(
|
|
3183
|
-
}, d =
|
|
3020
|
+
height: Number(i)
|
|
3021
|
+
}, d = gn({
|
|
3184
3022
|
videoTrack: a,
|
|
3185
|
-
targetSize:
|
|
3186
|
-
}), T = j(
|
|
3023
|
+
targetSize: c
|
|
3024
|
+
}), T = j(c.width, o), S = {
|
|
3187
3025
|
scaleResolutionDownBy: d,
|
|
3188
3026
|
maxBitrate: T
|
|
3189
3027
|
};
|
|
3190
|
-
return this.parametersSetter.setEncodingsToSender(
|
|
3028
|
+
return this.parametersSetter.setEncodingsToSender(r, S);
|
|
3191
3029
|
}
|
|
3192
3030
|
}
|
|
3193
|
-
const
|
|
3194
|
-
class
|
|
3031
|
+
const Sn = (n) => n.find((e) => e.track?.kind === "video");
|
|
3032
|
+
class Cn {
|
|
3195
3033
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
3196
3034
|
findVideoSender(e) {
|
|
3197
|
-
return
|
|
3035
|
+
return Sn(e);
|
|
3198
3036
|
}
|
|
3199
3037
|
}
|
|
3200
|
-
class
|
|
3038
|
+
class En {
|
|
3201
3039
|
currentSender;
|
|
3202
3040
|
originalReplaceTrack;
|
|
3203
3041
|
lastWidth;
|
|
@@ -3229,8 +3067,8 @@ class Nn {
|
|
|
3229
3067
|
attachSender(e, t) {
|
|
3230
3068
|
this.currentSender = e;
|
|
3231
3069
|
const s = e.replaceTrack.bind(e);
|
|
3232
|
-
this.originalReplaceTrack = s, e.replaceTrack = async (
|
|
3233
|
-
await s(
|
|
3070
|
+
this.originalReplaceTrack = s, e.replaceTrack = async (i) => {
|
|
3071
|
+
await s(i), this.attachTrack(t, i ?? void 0), t();
|
|
3234
3072
|
}, this.attachTrack(t, e.track);
|
|
3235
3073
|
}
|
|
3236
3074
|
detachSender() {
|
|
@@ -3239,8 +3077,8 @@ class Nn {
|
|
|
3239
3077
|
attachTrack(e, t) {
|
|
3240
3078
|
if (this.detachTrack(), !t)
|
|
3241
3079
|
return;
|
|
3242
|
-
const { width: s, height:
|
|
3243
|
-
this.lastWidth = s, this.lastHeight =
|
|
3080
|
+
const { width: s, height: i } = t.getSettings();
|
|
3081
|
+
this.lastWidth = s, this.lastHeight = i, this.currentPollIntervalMs = this.pollIntervalMs, this.schedulePoll(t, e);
|
|
3244
3082
|
}
|
|
3245
3083
|
/**
|
|
3246
3084
|
* Периодически опрашивает track с экспоненциальной адаптацией частоты.
|
|
@@ -3249,8 +3087,8 @@ class Nn {
|
|
|
3249
3087
|
*/
|
|
3250
3088
|
schedulePoll(e, t) {
|
|
3251
3089
|
const s = () => {
|
|
3252
|
-
const { width:
|
|
3253
|
-
|
|
3090
|
+
const { width: i, height: r } = e.getSettings();
|
|
3091
|
+
i !== this.lastWidth || r !== this.lastHeight ? (this.lastWidth = i, this.lastHeight = r, this.currentPollIntervalMs = this.pollIntervalMs, t()) : this.currentPollIntervalMs = Math.min(
|
|
3254
3092
|
this.currentPollIntervalMs * 2,
|
|
3255
3093
|
this.maxPollIntervalMs
|
|
3256
3094
|
), this.setTimeoutRequest.request(s, this.currentPollIntervalMs);
|
|
@@ -3261,7 +3099,7 @@ class Nn {
|
|
|
3261
3099
|
this.setTimeoutRequest.cancelRequest(), this.lastWidth = void 0, this.lastHeight = void 0;
|
|
3262
3100
|
}
|
|
3263
3101
|
}
|
|
3264
|
-
class
|
|
3102
|
+
class An {
|
|
3265
3103
|
apiManager;
|
|
3266
3104
|
currentHandler;
|
|
3267
3105
|
constructor(e) {
|
|
@@ -3281,7 +3119,7 @@ class mn {
|
|
|
3281
3119
|
this.currentHandler && (this.apiManager.off("main-cam-control", this.currentHandler), this.currentHandler = void 0);
|
|
3282
3120
|
}
|
|
3283
3121
|
}
|
|
3284
|
-
class
|
|
3122
|
+
class Nn {
|
|
3285
3123
|
eventHandler;
|
|
3286
3124
|
senderBalancer;
|
|
3287
3125
|
parametersSetterWithQueue;
|
|
@@ -3290,19 +3128,19 @@ class In {
|
|
|
3290
3128
|
trackMonitor;
|
|
3291
3129
|
constructor(e, t, {
|
|
3292
3130
|
ignoreForCodec: s,
|
|
3293
|
-
onSetParameters:
|
|
3294
|
-
pollIntervalMs:
|
|
3131
|
+
onSetParameters: i,
|
|
3132
|
+
pollIntervalMs: r
|
|
3295
3133
|
} = {}) {
|
|
3296
|
-
this.getConnection = t, this.eventHandler = new
|
|
3134
|
+
this.getConnection = t, this.eventHandler = new An(e), this.parametersSetterWithQueue = new rn(i), this.senderBalancer = new Tn(
|
|
3297
3135
|
{
|
|
3298
|
-
senderFinder: new
|
|
3299
|
-
codecProvider: new
|
|
3136
|
+
senderFinder: new Cn(),
|
|
3137
|
+
codecProvider: new nn(),
|
|
3300
3138
|
parametersSetter: this.parametersSetterWithQueue
|
|
3301
3139
|
},
|
|
3302
3140
|
{
|
|
3303
3141
|
ignoreForCodec: s
|
|
3304
3142
|
}
|
|
3305
|
-
), this.trackMonitor = new
|
|
3143
|
+
), this.trackMonitor = new En({ pollIntervalMs: r });
|
|
3306
3144
|
}
|
|
3307
3145
|
/**
|
|
3308
3146
|
* Подписывается на события управления главной камерой
|
|
@@ -3333,7 +3171,7 @@ class In {
|
|
|
3333
3171
|
const t = await this.senderBalancer.balance(e, this.serverHeaders);
|
|
3334
3172
|
return this.trackMonitor.subscribe(t.sender, () => {
|
|
3335
3173
|
this.balance().catch((s) => {
|
|
3336
|
-
|
|
3174
|
+
h("balance on track change: error", s);
|
|
3337
3175
|
});
|
|
3338
3176
|
}), t;
|
|
3339
3177
|
}
|
|
@@ -3343,17 +3181,17 @@ class In {
|
|
|
3343
3181
|
*/
|
|
3344
3182
|
handleMainCamControl = (e) => {
|
|
3345
3183
|
this.serverHeaders = e, this.balance().catch((t) => {
|
|
3346
|
-
|
|
3184
|
+
h("handleMainCamControl: error", t);
|
|
3347
3185
|
});
|
|
3348
3186
|
};
|
|
3349
3187
|
}
|
|
3350
|
-
const
|
|
3188
|
+
const me = [
|
|
3351
3189
|
"balancing-scheduled",
|
|
3352
3190
|
"balancing-started",
|
|
3353
3191
|
"balancing-stopped",
|
|
3354
3192
|
"parameters-updated"
|
|
3355
3193
|
];
|
|
3356
|
-
class
|
|
3194
|
+
class Rn {
|
|
3357
3195
|
isBalancingActive = !1;
|
|
3358
3196
|
events;
|
|
3359
3197
|
callManager;
|
|
@@ -3361,13 +3199,13 @@ class pn {
|
|
|
3361
3199
|
videoSendingBalancer;
|
|
3362
3200
|
startBalancingTimer;
|
|
3363
3201
|
constructor(e, t, s = {}) {
|
|
3364
|
-
this.events = new
|
|
3202
|
+
this.events = new O(me), this.callManager = e, this.balancingStartDelay = s.balancingStartDelay ?? 1e4, this.videoSendingBalancer = new Nn(
|
|
3365
3203
|
t,
|
|
3366
3204
|
() => e.connection,
|
|
3367
3205
|
{
|
|
3368
3206
|
...s,
|
|
3369
|
-
onSetParameters: (
|
|
3370
|
-
this.events.trigger("parameters-updated",
|
|
3207
|
+
onSetParameters: (i) => {
|
|
3208
|
+
this.events.trigger("parameters-updated", i), s.onSetParameters?.(i);
|
|
3371
3209
|
}
|
|
3372
3210
|
}
|
|
3373
3211
|
), this.subscribe();
|
|
@@ -3423,7 +3261,7 @@ class pn {
|
|
|
3423
3261
|
scheduleBalancingStart() {
|
|
3424
3262
|
this.clearStartTimer(), this.startBalancingTimer = setTimeout(() => {
|
|
3425
3263
|
this.startBalancingTimer = void 0, this.startBalancing().catch((e) => {
|
|
3426
|
-
|
|
3264
|
+
h("startBalancing: error", e);
|
|
3427
3265
|
});
|
|
3428
3266
|
}, this.balancingStartDelay), this.events.trigger("balancing-scheduled", { delay: this.balancingStartDelay });
|
|
3429
3267
|
}
|
|
@@ -3431,17 +3269,17 @@ class pn {
|
|
|
3431
3269
|
this.startBalancingTimer && (clearTimeout(this.startBalancingTimer), this.startBalancingTimer = void 0);
|
|
3432
3270
|
}
|
|
3433
3271
|
}
|
|
3434
|
-
const
|
|
3272
|
+
const In = 1e6, mn = Se.map((n) => `auto-connect:${n}`), pn = ue.map((n) => `connection:${n}`), _n = re.map((n) => `call:${n}`), Mn = ne.map((n) => `api:${n}`), fn = Ce.map((n) => `incoming-call:${n}`), Pn = de.map((n) => `presentation:${n}`), vn = Ee.map((n) => `stats:${n}`), On = me.map((n) => `video-balancer:${n}`), Dn = [
|
|
3273
|
+
...mn,
|
|
3274
|
+
...pn,
|
|
3275
|
+
..._n,
|
|
3435
3276
|
...Mn,
|
|
3436
3277
|
...fn,
|
|
3437
|
-
...vn,
|
|
3438
3278
|
...Pn,
|
|
3439
|
-
...
|
|
3440
|
-
...
|
|
3441
|
-
...Dn,
|
|
3442
|
-
...bn
|
|
3279
|
+
...vn,
|
|
3280
|
+
...On
|
|
3443
3281
|
];
|
|
3444
|
-
class
|
|
3282
|
+
class Hn {
|
|
3445
3283
|
events;
|
|
3446
3284
|
connectionManager;
|
|
3447
3285
|
connectionQueueManager;
|
|
@@ -3452,40 +3290,36 @@ class Qn {
|
|
|
3452
3290
|
presentationManager;
|
|
3453
3291
|
statsManager;
|
|
3454
3292
|
videoSendingBalancerManager;
|
|
3455
|
-
transceiverManager;
|
|
3456
3293
|
preferredMimeTypesVideoCodecs;
|
|
3457
3294
|
excludeMimeTypesVideoCodecs;
|
|
3458
3295
|
constructor({ JsSIP: e }, {
|
|
3459
3296
|
preferredMimeTypesVideoCodecs: t,
|
|
3460
3297
|
excludeMimeTypesVideoCodecs: s,
|
|
3461
|
-
videoBalancerOptions:
|
|
3462
|
-
autoConnectorOptions:
|
|
3298
|
+
videoBalancerOptions: i,
|
|
3299
|
+
autoConnectorOptions: r
|
|
3463
3300
|
} = {}) {
|
|
3464
|
-
this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events = new
|
|
3301
|
+
this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events = new O(Dn), this.connectionManager = new It({ JsSIP: e }), this.connectionQueueManager = new mt({
|
|
3465
3302
|
connectionManager: this.connectionManager
|
|
3466
|
-
}), this.callManager = new
|
|
3303
|
+
}), this.callManager = new Ye(), this.apiManager = new Fe({
|
|
3467
3304
|
connectionManager: this.connectionManager,
|
|
3468
3305
|
callManager: this.callManager
|
|
3469
|
-
}), this.incomingCallManager = new
|
|
3306
|
+
}), this.incomingCallManager = new kt(this.connectionManager), this.presentationManager = new ct({
|
|
3470
3307
|
callManager: this.callManager,
|
|
3471
|
-
maxBitrate:
|
|
3472
|
-
}), this.statsManager = new
|
|
3308
|
+
maxBitrate: In
|
|
3309
|
+
}), this.statsManager = new Yt({
|
|
3473
3310
|
callManager: this.callManager,
|
|
3474
3311
|
apiManager: this.apiManager
|
|
3475
|
-
}), this.autoConnectorManager = new
|
|
3312
|
+
}), this.autoConnectorManager = new Lt(
|
|
3476
3313
|
{
|
|
3477
3314
|
connectionQueueManager: this.connectionQueueManager,
|
|
3478
3315
|
connectionManager: this.connectionManager,
|
|
3479
3316
|
callManager: this.callManager
|
|
3480
3317
|
},
|
|
3481
|
-
|
|
3482
|
-
), this.
|
|
3483
|
-
callManager: this.callManager,
|
|
3484
|
-
apiManager: this.apiManager
|
|
3485
|
-
}), this.videoSendingBalancerManager = new pn(
|
|
3318
|
+
r
|
|
3319
|
+
), this.videoSendingBalancerManager = new Rn(
|
|
3486
3320
|
this.callManager,
|
|
3487
3321
|
this.apiManager,
|
|
3488
|
-
|
|
3322
|
+
i
|
|
3489
3323
|
), this.subscribe();
|
|
3490
3324
|
}
|
|
3491
3325
|
get requestedConnection() {
|
|
@@ -3585,7 +3419,7 @@ class Qn {
|
|
|
3585
3419
|
getRemoteStreams = () => this.callManager.getRemoteStreams();
|
|
3586
3420
|
replaceMediaStream = async (...e) => this.callManager.replaceMediaStream(...e);
|
|
3587
3421
|
async startPresentation(e, t = {}) {
|
|
3588
|
-
const { isP2P: s, callLimit:
|
|
3422
|
+
const { isP2P: s, callLimit: i, onAddedTransceiver: r, ...a } = t;
|
|
3589
3423
|
return this.presentationManager.startPresentation(
|
|
3590
3424
|
async () => {
|
|
3591
3425
|
s === !0 ? (await this.apiManager.sendMustStopPresentationP2P(), await this.apiManager.askPermissionToStartPresentationP2P()) : await this.apiManager.askPermissionToStartPresentation();
|
|
@@ -3593,9 +3427,9 @@ class Qn {
|
|
|
3593
3427
|
e,
|
|
3594
3428
|
{
|
|
3595
3429
|
...a,
|
|
3596
|
-
onAddedTransceiver: this.resolveHandleAddTransceiver(
|
|
3430
|
+
onAddedTransceiver: this.resolveHandleAddTransceiver(r)
|
|
3597
3431
|
},
|
|
3598
|
-
|
|
3432
|
+
i === void 0 ? void 0 : { callLimit: i }
|
|
3599
3433
|
);
|
|
3600
3434
|
}
|
|
3601
3435
|
async stopPresentation(e = {}) {
|
|
@@ -3605,15 +3439,15 @@ class Qn {
|
|
|
3605
3439
|
});
|
|
3606
3440
|
}
|
|
3607
3441
|
async updatePresentation(e, t = {}) {
|
|
3608
|
-
const { isP2P: s, onAddedTransceiver:
|
|
3442
|
+
const { isP2P: s, onAddedTransceiver: i, ...r } = t;
|
|
3609
3443
|
return this.presentationManager.updatePresentation(
|
|
3610
3444
|
async () => {
|
|
3611
3445
|
s === !0 ? (await this.apiManager.sendMustStopPresentationP2P(), await this.apiManager.askPermissionToStartPresentationP2P()) : await this.apiManager.askPermissionToStartPresentation();
|
|
3612
3446
|
},
|
|
3613
3447
|
e,
|
|
3614
3448
|
{
|
|
3615
|
-
...
|
|
3616
|
-
onAddedTransceiver: this.resolveHandleAddTransceiver(
|
|
3449
|
+
...r,
|
|
3450
|
+
onAddedTransceiver: this.resolveHandleAddTransceiver(i)
|
|
3617
3451
|
}
|
|
3618
3452
|
);
|
|
3619
3453
|
}
|
|
@@ -3660,7 +3494,7 @@ class Qn {
|
|
|
3660
3494
|
return this.apiManager.askPermissionToEnableCam(...e);
|
|
3661
3495
|
}
|
|
3662
3496
|
setCodecPreferences(e) {
|
|
3663
|
-
|
|
3497
|
+
jt(e, {
|
|
3664
3498
|
preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
|
|
3665
3499
|
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
3666
3500
|
});
|
|
@@ -3669,30 +3503,30 @@ class Qn {
|
|
|
3669
3503
|
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);
|
|
3670
3504
|
}
|
|
3671
3505
|
bridgeEvents = (e, t) => {
|
|
3672
|
-
t.events.eachTriggers((s,
|
|
3673
|
-
t.on(
|
|
3674
|
-
this.events.trigger(`${e}:${
|
|
3506
|
+
t.events.eachTriggers((s, i) => {
|
|
3507
|
+
t.on(i, (r) => {
|
|
3508
|
+
this.events.trigger(`${e}:${i}`, r);
|
|
3675
3509
|
});
|
|
3676
3510
|
});
|
|
3677
3511
|
};
|
|
3678
|
-
resolveHandleAddTransceiver = (e) => async (t, s,
|
|
3679
|
-
this.setCodecPreferences(t), await e?.(t, s,
|
|
3512
|
+
resolveHandleAddTransceiver = (e) => async (t, s, i) => {
|
|
3513
|
+
this.setCodecPreferences(t), await e?.(t, s, i);
|
|
3680
3514
|
};
|
|
3681
3515
|
}
|
|
3682
3516
|
export {
|
|
3683
3517
|
ae as E,
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3518
|
+
Ve as O,
|
|
3519
|
+
Hn as S,
|
|
3520
|
+
it as a,
|
|
3687
3521
|
Be as b,
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3522
|
+
Vn as c,
|
|
3523
|
+
Wn as d,
|
|
3524
|
+
qn as e,
|
|
3691
3525
|
A as f,
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3526
|
+
Qt as g,
|
|
3527
|
+
At as h,
|
|
3528
|
+
tn as i,
|
|
3529
|
+
h as l,
|
|
3696
3530
|
B as p,
|
|
3697
3531
|
he as s
|
|
3698
3532
|
};
|