sip-connector 19.9.0 → 20.1.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 +131 -37
- package/dist/{@SipConnector-BpypVXj0.js → @SipConnector-BTzZa4hh.js} +862 -554
- package/dist/@SipConnector-DL_XXmJn.cjs +1 -0
- package/dist/ApiManager/eventNames.d.ts +10 -3
- package/dist/CallManager/@CallManager.d.ts +18 -4
- package/dist/CallManager/MCUSession.d.ts +0 -1
- package/dist/CallManager/RecvSession.d.ts +1 -1
- package/dist/CallManager/RemoteStreamsManager.d.ts +20 -5
- package/dist/CallManager/RoleManager.d.ts +31 -0
- package/dist/CallManager/eventNames.d.ts +9 -2
- package/dist/CallManager/index.d.ts +1 -1
- package/dist/CallManager/types.d.ts +17 -5
- package/dist/ConnectionManager/@ConnectionManager.d.ts +2 -2
- package/dist/ConnectionManager/ConfigurationManager.d.ts +6 -1
- package/dist/ConnectionManager/ConnectionFlow.d.ts +5 -4
- package/dist/ConnectionManager/SipOperations.d.ts +2 -2
- package/dist/ConnectionManager/UAFactory.d.ts +4 -4
- package/dist/SipConnector/@SipConnector.d.ts +4 -2
- package/dist/SipConnector/eventNames.d.ts +1 -1
- package/dist/SipConnectorFacade/@SipConnectorFacade.d.ts +0 -2
- package/dist/VideoSendingBalancer/__fixtures__/createMockTrack.d.ts +1 -1
- package/dist/__fixtures__/RTCPeerConnectionMock.d.ts +1 -1
- package/dist/__fixtures__/index.d.ts +4 -4
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +23 -21
- package/dist/index.cjs +1 -1
- package/dist/index.js +156 -171
- package/dist/tools/__fixtures__/connectToServer.d.ts +15 -15
- package/dist/tools/__fixtures__/permissions.d.ts +2 -2
- package/dist/tools/__fixtures__/processRequest.d.ts +2 -2
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/sendOffer.d.ts +39 -0
- package/dist/utils/utils.d.ts +1 -1
- package/package.json +4 -4
- package/dist/@SipConnector-CR3DyIpB.cjs +0 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { TypedEvents as O } from "events-constructor";
|
|
2
|
-
import
|
|
3
|
-
import { CancelableRequest as x, isCanceledError as
|
|
4
|
-
import { resolveRequesterByTimeout as
|
|
5
|
-
import { hasCanceledError as
|
|
6
|
-
import { setup as
|
|
7
|
-
import { createStackPromises as
|
|
2
|
+
import V from "debug";
|
|
3
|
+
import { CancelableRequest as x, isCanceledError as Pe } from "@krivega/cancelable-promise";
|
|
4
|
+
import { resolveRequesterByTimeout as Oe, requesterByTimeoutsWithFailCalls as ye, DelayRequester as De, hasCanceledError as be, SetTimeoutRequest as ne } from "@krivega/timeout-requester";
|
|
5
|
+
import { hasCanceledError as we, repeatedCallsAsync as se } from "repeated-calls";
|
|
6
|
+
import { setup as Ue, createActor as Le } from "xstate";
|
|
7
|
+
import { createStackPromises as ie, isPromiseIsNotActualError as Be } from "stack-promises";
|
|
8
8
|
import "ua-parser-js";
|
|
9
9
|
import "sequent-promises";
|
|
10
|
-
const
|
|
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.AUDIO_ID = "X-WEBRTC-AUDIOID", n))(u || {}),
|
|
16
|
-
const
|
|
10
|
+
const Q = "sip-connector", h = V(Q), Jn = () => {
|
|
11
|
+
V.enable(Q);
|
|
12
|
+
}, Kn = () => {
|
|
13
|
+
V.enable(`-${Q}`);
|
|
14
|
+
}, ke = "Error decline with 603", Fe = 1006, $e = (n) => typeof n == "object" && n !== null && "code" in n && n.code === Fe, qe = (n) => n.message === ke;
|
|
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 || {}), B = /* @__PURE__ */ ((n) => (n.AVAILABLE_SECOND_REMOTE_STREAM = "YOUCANRECEIVECONTENT", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "CONTENTEND", n.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", n))(B || {}), W = /* @__PURE__ */ ((n) => (n.SPECTATOR = "SPECTATOR", n.PARTICIPANT = "PARTICIPANT", n))(W || {}), y = /* @__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))(y || {}), m = /* @__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))(m || {}), M = /* @__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))(M || {}), H = /* @__PURE__ */ ((n) => (n.ADMIN_STOP_MIC = "ADMINSTOPMIC", n.ADMIN_START_MIC = "ADMINSTARTMIC", n))(H || {}), G = /* @__PURE__ */ ((n) => (n.ADMIN_SYNC_FORCED = "1", n.ADMIN_SYNC_NOT_FORCED = "0", n))(G || {}), We = /* @__PURE__ */ ((n) => (n.AUDIO = "AUDIO", n.VIDEO = "VIDEO", n.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", n))(We || {}), l = /* @__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_SYNTHETIC = "participant:move-request-to-spectators-synthetic", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_WITH_AUDIO_ID = "participant:move-request-to-spectators-with-audio-id", n.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS = "participant:move-request-to-participants", n.PARTICIPATION_ACCEPTING_WORD_REQUEST = "participation:accepting-word-request", n.PARTICIPATION_CANCELLING_WORD_REQUEST = "participation:cancelling-word-request", n.WEBCAST_STARTED = "webcast:started", n.WEBCAST_STOPPED = "webcast:stopped", n.ACCOUNT_CHANGED = "account:changed", n.ACCOUNT_DELETED = "account:deleted", n.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))(l || {});
|
|
16
|
+
const re = [
|
|
17
17
|
"participation:accepting-word-request",
|
|
18
18
|
"participation:cancelling-word-request",
|
|
19
19
|
"participant:move-request-to-stream",
|
|
@@ -26,6 +26,7 @@ const ne = [
|
|
|
26
26
|
"participant:added-to-list-moderators",
|
|
27
27
|
"participant:removed-from-list-moderators",
|
|
28
28
|
"participant:move-request-to-spectators",
|
|
29
|
+
"participant:move-request-to-spectators-synthetic",
|
|
29
30
|
"participant:move-request-to-spectators-with-audio-id",
|
|
30
31
|
"participant:move-request-to-participants",
|
|
31
32
|
"channels",
|
|
@@ -43,8 +44,8 @@ const ne = [
|
|
|
43
44
|
"mustStopPresentation",
|
|
44
45
|
"newDTMF"
|
|
45
46
|
];
|
|
46
|
-
var
|
|
47
|
-
class
|
|
47
|
+
var N = /* @__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))(N || {});
|
|
48
|
+
class He {
|
|
48
49
|
events;
|
|
49
50
|
connectionManager;
|
|
50
51
|
callManager;
|
|
@@ -52,13 +53,13 @@ class Fe {
|
|
|
52
53
|
connectionManager: e,
|
|
53
54
|
callManager: t
|
|
54
55
|
}) {
|
|
55
|
-
this.connectionManager = e, this.callManager = t, this.events = new O(
|
|
56
|
+
this.connectionManager = e, this.callManager = t, this.events = new O(re), this.subscribe();
|
|
56
57
|
}
|
|
57
58
|
async waitChannels() {
|
|
58
|
-
return this.wait(
|
|
59
|
+
return this.wait(l.CHANNELS);
|
|
59
60
|
}
|
|
60
61
|
async waitSyncMediaState() {
|
|
61
|
-
return this.wait(
|
|
62
|
+
return this.wait(l.ADMIN_FORCE_SYNC_MEDIA_STATE);
|
|
62
63
|
}
|
|
63
64
|
async sendDTMF(e) {
|
|
64
65
|
return new Promise((t, s) => {
|
|
@@ -81,7 +82,7 @@ class Fe {
|
|
|
81
82
|
i,
|
|
82
83
|
r
|
|
83
84
|
];
|
|
84
|
-
return s.sendInfo(
|
|
85
|
+
return s.sendInfo(m.CHANNELS, void 0, { extraHeaders: a });
|
|
85
86
|
}
|
|
86
87
|
async sendMediaState({ cam: e, mic: t }, s = {}) {
|
|
87
88
|
const i = this.getEstablishedRTCSessionProtected(), r = `${u.MEDIA_STATE}: currentstate`, a = `${u.MAIN_CAM_STATE}: ${Number(e)}`, o = `${u.MIC_STATE}: ${Number(t)}`, c = [
|
|
@@ -89,7 +90,7 @@ class Fe {
|
|
|
89
90
|
a,
|
|
90
91
|
o
|
|
91
92
|
];
|
|
92
|
-
return i.sendInfo(
|
|
93
|
+
return i.sendInfo(m.MEDIA_STATE, void 0, {
|
|
93
94
|
noTerminateWhenError: !0,
|
|
94
95
|
...s,
|
|
95
96
|
extraHeaders: c
|
|
@@ -99,14 +100,14 @@ class Fe {
|
|
|
99
100
|
availableIncomingBitrate: e
|
|
100
101
|
}) {
|
|
101
102
|
const t = this.getEstablishedRTCSessionProtected(), i = [`${u.AVAILABLE_INCOMING_BITRATE}: ${e}`];
|
|
102
|
-
return t.sendInfo(
|
|
103
|
+
return t.sendInfo(m.STATS, void 0, {
|
|
103
104
|
noTerminateWhenError: !0,
|
|
104
105
|
extraHeaders: i
|
|
105
106
|
});
|
|
106
107
|
}
|
|
107
108
|
async sendRefusalToTurnOn(e, t = {}) {
|
|
108
109
|
const s = this.getEstablishedRTCSessionProtected(), a = e === "mic" ? 0 : 1, c = [`${u.MEDIA_TYPE}: ${a}`];
|
|
109
|
-
return s.sendInfo(
|
|
110
|
+
return s.sendInfo(m.REFUSAL, void 0, {
|
|
110
111
|
noTerminateWhenError: !0,
|
|
111
112
|
...t,
|
|
112
113
|
extraHeaders: c
|
|
@@ -119,38 +120,38 @@ class Fe {
|
|
|
119
120
|
return this.sendRefusalToTurnOn("cam", { noTerminateWhenError: !0, ...e });
|
|
120
121
|
}
|
|
121
122
|
async sendMustStopPresentationP2P() {
|
|
122
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
123
|
+
await this.getEstablishedRTCSessionProtected().sendInfo(m.SHARE_STATE, void 0, {
|
|
123
124
|
extraHeaders: [u.MUST_STOP_PRESENTATION_P2P]
|
|
124
125
|
});
|
|
125
126
|
}
|
|
126
127
|
async sendStoppedPresentationP2P() {
|
|
127
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
128
|
+
await this.getEstablishedRTCSessionProtected().sendInfo(m.SHARE_STATE, void 0, {
|
|
128
129
|
extraHeaders: [u.STOP_PRESENTATION_P2P]
|
|
129
130
|
});
|
|
130
131
|
}
|
|
131
132
|
async sendStoppedPresentation() {
|
|
132
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
133
|
+
await this.getEstablishedRTCSessionProtected().sendInfo(m.SHARE_STATE, void 0, {
|
|
133
134
|
extraHeaders: [u.STOP_PRESENTATION]
|
|
134
135
|
});
|
|
135
136
|
}
|
|
136
137
|
async askPermissionToStartPresentationP2P() {
|
|
137
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
138
|
+
await this.getEstablishedRTCSessionProtected().sendInfo(m.SHARE_STATE, void 0, {
|
|
138
139
|
extraHeaders: [u.START_PRESENTATION_P2P]
|
|
139
140
|
});
|
|
140
141
|
}
|
|
141
142
|
async askPermissionToStartPresentation() {
|
|
142
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
143
|
+
await this.getEstablishedRTCSessionProtected().sendInfo(m.SHARE_STATE, void 0, {
|
|
143
144
|
extraHeaders: [u.START_PRESENTATION]
|
|
144
145
|
});
|
|
145
146
|
}
|
|
146
147
|
async askPermissionToEnableCam(e = {}) {
|
|
147
148
|
const t = this.getEstablishedRTCSessionProtected(), s = [u.ENABLE_MAIN_CAM];
|
|
148
|
-
return t.sendInfo(
|
|
149
|
+
return t.sendInfo(m.MAIN_CAM, void 0, {
|
|
149
150
|
noTerminateWhenError: !0,
|
|
150
151
|
...e,
|
|
151
152
|
extraHeaders: s
|
|
152
153
|
}).catch((i) => {
|
|
153
|
-
if (
|
|
154
|
+
if (qe(i))
|
|
154
155
|
throw i;
|
|
155
156
|
});
|
|
156
157
|
}
|
|
@@ -196,55 +197,55 @@ class Fe {
|
|
|
196
197
|
};
|
|
197
198
|
handleNotify = (e) => {
|
|
198
199
|
switch (e.cmd) {
|
|
199
|
-
case
|
|
200
|
+
case N.CHANNELS: {
|
|
200
201
|
const t = e;
|
|
201
202
|
this.triggerChannelsNotify(t);
|
|
202
203
|
break;
|
|
203
204
|
}
|
|
204
|
-
case
|
|
205
|
+
case N.WEBCAST_STARTED: {
|
|
205
206
|
const t = e;
|
|
206
207
|
this.triggerWebcastStartedNotify(t);
|
|
207
208
|
break;
|
|
208
209
|
}
|
|
209
|
-
case
|
|
210
|
+
case N.WEBCAST_STOPPED: {
|
|
210
211
|
const t = e;
|
|
211
212
|
this.triggerWebcastStoppedNotify(t);
|
|
212
213
|
break;
|
|
213
214
|
}
|
|
214
|
-
case
|
|
215
|
+
case N.ADDED_TO_LIST_MODERATORS: {
|
|
215
216
|
const t = e;
|
|
216
217
|
this.triggerAddedToListModeratorsNotify(t);
|
|
217
218
|
break;
|
|
218
219
|
}
|
|
219
|
-
case
|
|
220
|
+
case N.REMOVED_FROM_LIST_MODERATORS: {
|
|
220
221
|
const t = e;
|
|
221
222
|
this.triggerRemovedFromListModeratorsNotify(t);
|
|
222
223
|
break;
|
|
223
224
|
}
|
|
224
|
-
case
|
|
225
|
+
case N.ACCEPTING_WORD_REQUEST: {
|
|
225
226
|
const t = e;
|
|
226
227
|
this.triggerParticipationAcceptingWordRequest(t);
|
|
227
228
|
break;
|
|
228
229
|
}
|
|
229
|
-
case
|
|
230
|
+
case N.CANCELLING_WORD_REQUEST: {
|
|
230
231
|
const t = e;
|
|
231
232
|
this.triggerParticipationCancellingWordRequest(t);
|
|
232
233
|
break;
|
|
233
234
|
}
|
|
234
|
-
case
|
|
235
|
+
case N.MOVE_REQUEST_TO_STREAM: {
|
|
235
236
|
const t = e;
|
|
236
237
|
this.triggerParticipantMoveRequestToStream(t);
|
|
237
238
|
break;
|
|
238
239
|
}
|
|
239
|
-
case
|
|
240
|
+
case N.ACCOUNT_CHANGED: {
|
|
240
241
|
this.triggerAccountChangedNotify();
|
|
241
242
|
break;
|
|
242
243
|
}
|
|
243
|
-
case
|
|
244
|
+
case N.ACCOUNT_DELETED: {
|
|
244
245
|
this.triggerAccountDeletedNotify();
|
|
245
246
|
break;
|
|
246
247
|
}
|
|
247
|
-
case
|
|
248
|
+
case N.CONFERENCE_PARTICIPANT_TOKEN_ISSUED: {
|
|
248
249
|
const t = e;
|
|
249
250
|
this.triggerConferenceParticipantTokenIssued(t);
|
|
250
251
|
break;
|
|
@@ -260,31 +261,31 @@ class Fe {
|
|
|
260
261
|
const { request: s } = e, i = s, r = i.getHeader(u.CONTENT_TYPE);
|
|
261
262
|
if (r !== void 0)
|
|
262
263
|
switch (r) {
|
|
263
|
-
case
|
|
264
|
+
case y.ENTER_ROOM: {
|
|
264
265
|
this.triggerEnterRoom(i), this.maybeTriggerChannels(i);
|
|
265
266
|
break;
|
|
266
267
|
}
|
|
267
|
-
case
|
|
268
|
+
case y.NOTIFY: {
|
|
268
269
|
this.maybeHandleNotify(i);
|
|
269
270
|
break;
|
|
270
271
|
}
|
|
271
|
-
case
|
|
272
|
+
case y.SHARE_STATE: {
|
|
272
273
|
this.triggerShareState(i);
|
|
273
274
|
break;
|
|
274
275
|
}
|
|
275
|
-
case
|
|
276
|
+
case y.MAIN_CAM: {
|
|
276
277
|
this.triggerMainCamControl(i);
|
|
277
278
|
break;
|
|
278
279
|
}
|
|
279
|
-
case
|
|
280
|
+
case y.MIC: {
|
|
280
281
|
this.triggerMicControl(i);
|
|
281
282
|
break;
|
|
282
283
|
}
|
|
283
|
-
case
|
|
284
|
+
case y.USE_LICENSE: {
|
|
284
285
|
this.triggerUseLicense(i);
|
|
285
286
|
break;
|
|
286
287
|
}
|
|
287
|
-
case
|
|
288
|
+
case y.PARTICIPANT_STATE: {
|
|
288
289
|
this.maybeTriggerParticipantMoveRequest(i);
|
|
289
290
|
break;
|
|
290
291
|
}
|
|
@@ -295,7 +296,7 @@ class Fe {
|
|
|
295
296
|
inputChannels: t,
|
|
296
297
|
outputChannels: s
|
|
297
298
|
};
|
|
298
|
-
this.events.trigger(
|
|
299
|
+
this.events.trigger(l.CHANNELS_NOTIFY, i);
|
|
299
300
|
};
|
|
300
301
|
triggerWebcastStartedNotify = ({
|
|
301
302
|
body: { conference: e, type: t }
|
|
@@ -304,7 +305,7 @@ class Fe {
|
|
|
304
305
|
conference: e,
|
|
305
306
|
type: t
|
|
306
307
|
};
|
|
307
|
-
this.events.trigger(
|
|
308
|
+
this.events.trigger(l.WEBCAST_STARTED, s);
|
|
308
309
|
};
|
|
309
310
|
triggerWebcastStoppedNotify = ({
|
|
310
311
|
body: { conference: e, type: t }
|
|
@@ -313,7 +314,7 @@ class Fe {
|
|
|
313
314
|
conference: e,
|
|
314
315
|
type: t
|
|
315
316
|
};
|
|
316
|
-
this.events.trigger(
|
|
317
|
+
this.events.trigger(l.WEBCAST_STOPPED, s);
|
|
317
318
|
};
|
|
318
319
|
triggerAddedToListModeratorsNotify = ({
|
|
319
320
|
conference: e
|
|
@@ -322,7 +323,7 @@ class Fe {
|
|
|
322
323
|
conference: e
|
|
323
324
|
};
|
|
324
325
|
this.events.trigger(
|
|
325
|
-
|
|
326
|
+
l.PARTICIPANT_ADDED_TO_LIST_MODERATORS,
|
|
326
327
|
t
|
|
327
328
|
);
|
|
328
329
|
};
|
|
@@ -333,7 +334,7 @@ class Fe {
|
|
|
333
334
|
conference: e
|
|
334
335
|
};
|
|
335
336
|
this.events.trigger(
|
|
336
|
-
|
|
337
|
+
l.PARTICIPANT_REMOVED_FROM_LIST_MODERATORS,
|
|
337
338
|
t
|
|
338
339
|
);
|
|
339
340
|
};
|
|
@@ -343,7 +344,7 @@ class Fe {
|
|
|
343
344
|
const t = {
|
|
344
345
|
conference: e
|
|
345
346
|
};
|
|
346
|
-
this.events.trigger(
|
|
347
|
+
this.events.trigger(l.PARTICIPATION_ACCEPTING_WORD_REQUEST, t);
|
|
347
348
|
};
|
|
348
349
|
triggerParticipationCancellingWordRequest = ({
|
|
349
350
|
body: { conference: e }
|
|
@@ -351,7 +352,7 @@ class Fe {
|
|
|
351
352
|
const t = {
|
|
352
353
|
conference: e
|
|
353
354
|
};
|
|
354
|
-
this.events.trigger(
|
|
355
|
+
this.events.trigger(l.PARTICIPATION_CANCELLING_WORD_REQUEST, t);
|
|
355
356
|
};
|
|
356
357
|
triggerParticipantMoveRequestToStream = ({
|
|
357
358
|
body: { conference: e }
|
|
@@ -359,13 +360,13 @@ class Fe {
|
|
|
359
360
|
const t = {
|
|
360
361
|
conference: e
|
|
361
362
|
};
|
|
362
|
-
this.events.trigger(
|
|
363
|
+
this.events.trigger(l.PARTICIPANT_MOVE_REQUEST_TO_STREAM, t);
|
|
363
364
|
};
|
|
364
365
|
triggerAccountChangedNotify = () => {
|
|
365
|
-
this.events.trigger(
|
|
366
|
+
this.events.trigger(l.ACCOUNT_CHANGED, {});
|
|
366
367
|
};
|
|
367
368
|
triggerAccountDeletedNotify = () => {
|
|
368
|
-
this.events.trigger(
|
|
369
|
+
this.events.trigger(l.ACCOUNT_DELETED, {});
|
|
369
370
|
};
|
|
370
371
|
triggerConferenceParticipantTokenIssued = ({
|
|
371
372
|
body: { conference: e, participant: t, jwt: s }
|
|
@@ -376,7 +377,7 @@ class Fe {
|
|
|
376
377
|
jwt: s
|
|
377
378
|
};
|
|
378
379
|
this.events.trigger(
|
|
379
|
-
|
|
380
|
+
l.CONFERENCE_PARTICIPANT_TOKEN_ISSUED,
|
|
380
381
|
i
|
|
381
382
|
);
|
|
382
383
|
};
|
|
@@ -387,72 +388,68 @@ class Fe {
|
|
|
387
388
|
inputChannels: t,
|
|
388
389
|
outputChannels: s
|
|
389
390
|
};
|
|
390
|
-
this.events.trigger(
|
|
391
|
+
this.events.trigger(l.CHANNELS, i);
|
|
391
392
|
}
|
|
392
393
|
};
|
|
393
394
|
triggerEnterRoom = (e) => {
|
|
394
395
|
const t = e.getHeader(u.CONTENT_ENTER_ROOM), s = e.getHeader(u.PARTICIPANT_NAME);
|
|
395
|
-
this.events.trigger(
|
|
396
|
+
this.events.trigger(l.ENTER_ROOM, { room: t, participantName: s });
|
|
396
397
|
};
|
|
397
398
|
triggerShareState = (e) => {
|
|
398
399
|
const t = e.getHeader(u.CONTENT_SHARE_STATE);
|
|
399
400
|
if (t !== void 0)
|
|
400
401
|
switch (t) {
|
|
401
|
-
case
|
|
402
|
-
this.events.trigger(
|
|
402
|
+
case B.AVAILABLE_SECOND_REMOTE_STREAM: {
|
|
403
|
+
this.events.trigger(l.AVAILABLE_SECOND_REMOTE_STREAM, {});
|
|
403
404
|
break;
|
|
404
405
|
}
|
|
405
|
-
case
|
|
406
|
-
this.events.trigger(
|
|
406
|
+
case B.NOT_AVAILABLE_SECOND_REMOTE_STREAM: {
|
|
407
|
+
this.events.trigger(l.NOT_AVAILABLE_SECOND_REMOTE_STREAM, {});
|
|
407
408
|
break;
|
|
408
409
|
}
|
|
409
|
-
case
|
|
410
|
-
this.events.trigger(
|
|
410
|
+
case B.MUST_STOP_PRESENTATION: {
|
|
411
|
+
this.events.trigger(l.MUST_STOP_PRESENTATION, {});
|
|
411
412
|
break;
|
|
412
413
|
}
|
|
413
414
|
}
|
|
414
415
|
};
|
|
415
416
|
maybeTriggerParticipantMoveRequest = (e) => {
|
|
416
417
|
const t = e.getHeader(u.CONTENT_PARTICIPANT_STATE), s = e.getHeader(u.AUDIO_ID);
|
|
417
|
-
t ===
|
|
418
|
+
t === W.SPECTATOR && (s ? (this.events.trigger(l.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_WITH_AUDIO_ID, {
|
|
418
419
|
audioId: s
|
|
419
|
-
})
|
|
420
|
+
}), this.events.trigger(l.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS, {
|
|
421
|
+
isSynthetic: !1,
|
|
422
|
+
audioId: s
|
|
423
|
+
})) : (this.events.trigger(l.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_SYNTHETIC, {}), this.events.trigger(l.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS, { isSynthetic: !0 }))), t === W.PARTICIPANT && this.events.trigger(l.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS, {});
|
|
420
424
|
};
|
|
421
425
|
triggerMainCamControl = (e) => {
|
|
422
|
-
const t = e.getHeader(u.MAIN_CAM), s = e.getHeader(u.MEDIA_SYNC), i = s ===
|
|
423
|
-
if (t ===
|
|
424
|
-
this.events.trigger(
|
|
426
|
+
const t = e.getHeader(u.MAIN_CAM), s = e.getHeader(u.MEDIA_SYNC), i = s === G.ADMIN_SYNC_FORCED;
|
|
427
|
+
if (t === M.ADMIN_START_MAIN_CAM) {
|
|
428
|
+
this.events.trigger(l.ADMIN_START_MAIN_CAM, { isSyncForced: i });
|
|
425
429
|
return;
|
|
426
430
|
}
|
|
427
|
-
if (t ===
|
|
428
|
-
this.events.trigger(
|
|
431
|
+
if (t === M.ADMIN_STOP_MAIN_CAM) {
|
|
432
|
+
this.events.trigger(l.ADMIN_STOP_MAIN_CAM, { isSyncForced: i });
|
|
429
433
|
return;
|
|
430
434
|
}
|
|
431
|
-
(t ===
|
|
435
|
+
(t === M.RESUME_MAIN_CAM || t === M.PAUSE_MAIN_CAM) && s !== void 0 && this.events.trigger(l.ADMIN_FORCE_SYNC_MEDIA_STATE, { isSyncForced: i });
|
|
432
436
|
const r = e.getHeader(u.MAIN_CAM_RESOLUTION);
|
|
433
|
-
this.events.trigger(
|
|
437
|
+
this.events.trigger(l.MAIN_CAM_CONTROL, {
|
|
434
438
|
mainCam: t,
|
|
435
439
|
resolutionMainCam: r
|
|
436
440
|
});
|
|
437
441
|
};
|
|
438
442
|
triggerMicControl = (e) => {
|
|
439
|
-
const t = e.getHeader(u.MIC), i = e.getHeader(u.MEDIA_SYNC) ===
|
|
440
|
-
t ===
|
|
443
|
+
const t = e.getHeader(u.MIC), i = e.getHeader(u.MEDIA_SYNC) === G.ADMIN_SYNC_FORCED;
|
|
444
|
+
t === H.ADMIN_START_MIC ? this.events.trigger(l.ADMIN_START_MIC, { isSyncForced: i }) : t === H.ADMIN_STOP_MIC && this.events.trigger(l.ADMIN_STOP_MIC, { isSyncForced: i });
|
|
441
445
|
};
|
|
442
446
|
triggerUseLicense = (e) => {
|
|
443
447
|
const t = e.getHeader(u.CONTENT_USE_LICENSE);
|
|
444
|
-
this.events.trigger(
|
|
448
|
+
this.events.trigger(l.USE_LICENSE, t);
|
|
445
449
|
};
|
|
446
450
|
}
|
|
447
|
-
|
|
448
|
-
|
|
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 = [
|
|
451
|
+
var R = /* @__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.REMOTE_STREAMS_CHANGED = "remote-streams-changed", n))(R || {}), Ge = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))(Ge || {});
|
|
452
|
+
const ae = [
|
|
456
453
|
"peerconnection",
|
|
457
454
|
"connecting",
|
|
458
455
|
"sending",
|
|
@@ -479,19 +476,20 @@ const ie = [
|
|
|
479
476
|
"peerconnection:createanswerfailed",
|
|
480
477
|
"peerconnection:setlocaldescriptionfailed",
|
|
481
478
|
"peerconnection:setremotedescriptionfailed"
|
|
482
|
-
],
|
|
479
|
+
], Ve = [
|
|
483
480
|
"peerconnection:confirmed",
|
|
484
481
|
"peerconnection:ontrack",
|
|
485
482
|
"ended:fromserver",
|
|
486
|
-
"call-status-changed"
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
...
|
|
483
|
+
"call-status-changed",
|
|
484
|
+
"remote-streams-changed"
|
|
485
|
+
], oe = [
|
|
486
|
+
...ae,
|
|
487
|
+
...Ve
|
|
490
488
|
], xe = (n, e) => {
|
|
491
489
|
n.getVideoTracks().forEach((s) => {
|
|
492
490
|
"contentHint" in s && s.contentHint !== e && (s.contentHint = e);
|
|
493
491
|
});
|
|
494
|
-
},
|
|
492
|
+
}, k = (n, {
|
|
495
493
|
directionVideo: e,
|
|
496
494
|
directionAudio: t,
|
|
497
495
|
contentHint: s
|
|
@@ -501,14 +499,14 @@ const ie = [
|
|
|
501
499
|
const i = t === "recvonly" ? [] : n.getAudioTracks(), r = e === "recvonly" ? [] : n.getVideoTracks(), a = [...i, ...r], o = new MediaStream(a);
|
|
502
500
|
return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" && xe(o, s), o;
|
|
503
501
|
};
|
|
504
|
-
var
|
|
505
|
-
class
|
|
502
|
+
var ce = /* @__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))(ce || {});
|
|
503
|
+
class Qe {
|
|
506
504
|
events;
|
|
507
505
|
rtcSession;
|
|
508
506
|
disposers = /* @__PURE__ */ new Set();
|
|
509
507
|
onReset;
|
|
510
508
|
constructor(e, { onReset: t }) {
|
|
511
|
-
this.events = e, this.onReset = t, e.on(
|
|
509
|
+
this.events = e, this.onReset = t, e.on(R.FAILED, this.handleEnded), e.on(R.ENDED, this.handleEnded);
|
|
512
510
|
}
|
|
513
511
|
get connection() {
|
|
514
512
|
return this.rtcSession?.connection;
|
|
@@ -521,49 +519,48 @@ class Ge {
|
|
|
521
519
|
number: s,
|
|
522
520
|
mediaStream: i,
|
|
523
521
|
extraHeaders: r = [],
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
contentHint: T,
|
|
522
|
+
iceServers: a,
|
|
523
|
+
directionVideo: o,
|
|
524
|
+
directionAudio: c,
|
|
525
|
+
contentHint: d,
|
|
529
526
|
offerToReceiveAudio: S = !0,
|
|
530
|
-
offerToReceiveVideo:
|
|
531
|
-
degradationPreference:
|
|
532
|
-
sendEncodings:
|
|
533
|
-
onAddedTransceiver:
|
|
534
|
-
}) => new Promise((
|
|
535
|
-
this.handleCall(
|
|
536
|
-
F
|
|
527
|
+
offerToReceiveVideo: g = !0,
|
|
528
|
+
degradationPreference: T,
|
|
529
|
+
sendEncodings: p,
|
|
530
|
+
onAddedTransceiver: v
|
|
531
|
+
}) => new Promise((A, D) => {
|
|
532
|
+
this.handleCall().then(A).catch((F) => {
|
|
533
|
+
D(F);
|
|
537
534
|
}), this.rtcSession = e.call(t(s), {
|
|
538
|
-
mediaStream:
|
|
539
|
-
directionVideo:
|
|
540
|
-
directionAudio:
|
|
541
|
-
contentHint:
|
|
535
|
+
mediaStream: k(i, {
|
|
536
|
+
directionVideo: o,
|
|
537
|
+
directionAudio: c,
|
|
538
|
+
contentHint: d
|
|
542
539
|
}),
|
|
543
540
|
pcConfig: {
|
|
544
|
-
iceServers:
|
|
541
|
+
iceServers: a
|
|
545
542
|
},
|
|
546
543
|
rtcOfferConstraints: {
|
|
547
544
|
offerToReceiveAudio: S,
|
|
548
|
-
offerToReceiveVideo:
|
|
545
|
+
offerToReceiveVideo: g
|
|
549
546
|
},
|
|
550
547
|
// необходимо передавать в методе call, чтобы подписаться на события peerconnection,
|
|
551
548
|
// так как в методе call создается RTCSession
|
|
552
549
|
// и после создания нет возможности подписаться на события peerconnection через subscribeToSessionEvents
|
|
553
550
|
eventHandlers: this.events.triggers,
|
|
554
551
|
extraHeaders: r,
|
|
555
|
-
directionVideo:
|
|
556
|
-
directionAudio:
|
|
557
|
-
degradationPreference:
|
|
558
|
-
sendEncodings:
|
|
559
|
-
onAddedTransceiver:
|
|
552
|
+
directionVideo: o,
|
|
553
|
+
directionAudio: c,
|
|
554
|
+
degradationPreference: T,
|
|
555
|
+
sendEncodings: p,
|
|
556
|
+
onAddedTransceiver: v
|
|
560
557
|
});
|
|
561
558
|
});
|
|
562
559
|
async endCall() {
|
|
563
560
|
const { rtcSession: e } = this;
|
|
564
561
|
if (e && !e.isEnded())
|
|
565
562
|
return e.terminateAsync({
|
|
566
|
-
cause:
|
|
563
|
+
cause: ce.CANCELED
|
|
567
564
|
}).finally(() => {
|
|
568
565
|
this.reset();
|
|
569
566
|
});
|
|
@@ -571,52 +568,48 @@ class Ge {
|
|
|
571
568
|
}
|
|
572
569
|
answerToIncomingCall = async (e, {
|
|
573
570
|
mediaStream: t,
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
contentHint: T,
|
|
571
|
+
extraHeaders: s = [],
|
|
572
|
+
iceServers: i,
|
|
573
|
+
directionVideo: r,
|
|
574
|
+
directionAudio: a,
|
|
575
|
+
offerToReceiveAudio: o,
|
|
576
|
+
offerToReceiveVideo: c,
|
|
577
|
+
contentHint: d,
|
|
582
578
|
degradationPreference: S,
|
|
583
|
-
sendEncodings:
|
|
584
|
-
onAddedTransceiver:
|
|
585
|
-
}) => new Promise((
|
|
579
|
+
sendEncodings: g,
|
|
580
|
+
onAddedTransceiver: T
|
|
581
|
+
}) => new Promise((p, v) => {
|
|
586
582
|
try {
|
|
587
|
-
this.rtcSession = e, this.subscribeToSessionEvents(e), this.handleCall(
|
|
588
|
-
|
|
583
|
+
this.rtcSession = e, this.subscribeToSessionEvents(e), this.handleCall().then(p).catch((A) => {
|
|
584
|
+
v(A);
|
|
589
585
|
}), e.answer({
|
|
590
586
|
pcConfig: {
|
|
591
|
-
iceServers:
|
|
587
|
+
iceServers: i
|
|
592
588
|
},
|
|
593
589
|
rtcOfferConstraints: {
|
|
594
|
-
offerToReceiveAudio:
|
|
595
|
-
offerToReceiveVideo:
|
|
590
|
+
offerToReceiveAudio: o,
|
|
591
|
+
offerToReceiveVideo: c
|
|
596
592
|
},
|
|
597
|
-
mediaStream:
|
|
598
|
-
directionVideo:
|
|
599
|
-
directionAudio:
|
|
600
|
-
contentHint:
|
|
593
|
+
mediaStream: k(t, {
|
|
594
|
+
directionVideo: r,
|
|
595
|
+
directionAudio: a,
|
|
596
|
+
contentHint: d
|
|
601
597
|
}),
|
|
602
|
-
extraHeaders:
|
|
603
|
-
directionVideo:
|
|
604
|
-
directionAudio:
|
|
598
|
+
extraHeaders: s,
|
|
599
|
+
directionVideo: r,
|
|
600
|
+
directionAudio: a,
|
|
605
601
|
degradationPreference: S,
|
|
606
|
-
sendEncodings:
|
|
607
|
-
onAddedTransceiver:
|
|
602
|
+
sendEncodings: g,
|
|
603
|
+
onAddedTransceiver: T
|
|
608
604
|
});
|
|
609
|
-
} catch (
|
|
610
|
-
|
|
605
|
+
} catch (A) {
|
|
606
|
+
v(A);
|
|
611
607
|
}
|
|
612
608
|
});
|
|
613
|
-
getRemoteTracks() {
|
|
614
|
-
return this.connection ? this.connection.getReceivers().map(({ track: s }) => s) : void 0;
|
|
615
|
-
}
|
|
616
609
|
async replaceMediaStream(e, t) {
|
|
617
610
|
if (!this.rtcSession)
|
|
618
611
|
throw new Error("No rtcSession established");
|
|
619
|
-
const { contentHint: s } = t ?? {}, i =
|
|
612
|
+
const { contentHint: s } = t ?? {}, i = k(e, { contentHint: s });
|
|
620
613
|
if (i === void 0)
|
|
621
614
|
throw new Error("No preparedMediaStream");
|
|
622
615
|
return this.rtcSession.replaceMediaStream(i, t);
|
|
@@ -626,37 +619,35 @@ class Ge {
|
|
|
626
619
|
throw new Error("No rtcSession established");
|
|
627
620
|
return this.rtcSession.restartIce(e);
|
|
628
621
|
}
|
|
629
|
-
handleCall = async ({
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
this.events.
|
|
622
|
+
handleCall = async () => new Promise((e, t) => {
|
|
623
|
+
const s = () => {
|
|
624
|
+
this.events.on(R.PEER_CONNECTION, d), this.events.on(R.CONFIRMED, S);
|
|
625
|
+
}, i = () => {
|
|
626
|
+
this.events.off(R.PEER_CONNECTION, d), this.events.off(R.CONFIRMED, S);
|
|
634
627
|
}, r = () => {
|
|
635
|
-
this.events.
|
|
628
|
+
this.events.on(R.FAILED, o), this.events.on(R.ENDED, o);
|
|
636
629
|
}, a = () => {
|
|
637
|
-
this.events.
|
|
638
|
-
}, o = () => {
|
|
639
|
-
|
|
640
|
-
}, c = (l) => {
|
|
641
|
-
r(), o(), s(l);
|
|
630
|
+
this.events.off(R.FAILED, o), this.events.off(R.ENDED, o);
|
|
631
|
+
}, o = (g) => {
|
|
632
|
+
i(), a(), t(g);
|
|
642
633
|
};
|
|
643
|
-
let
|
|
644
|
-
const
|
|
645
|
-
|
|
646
|
-
const
|
|
647
|
-
this.events.trigger(
|
|
634
|
+
let c;
|
|
635
|
+
const d = ({ peerconnection: g }) => {
|
|
636
|
+
c = g;
|
|
637
|
+
const T = (p) => {
|
|
638
|
+
this.events.trigger(R.PEER_CONNECTION_ONTRACK, p);
|
|
648
639
|
};
|
|
649
|
-
|
|
650
|
-
|
|
640
|
+
g.addEventListener("track", T), this.disposers.add(() => {
|
|
641
|
+
g.removeEventListener("track", T);
|
|
651
642
|
});
|
|
652
643
|
}, S = () => {
|
|
653
|
-
|
|
644
|
+
c !== void 0 && this.events.trigger(R.PEER_CONNECTION_CONFIRMED, c), i(), a(), e(c);
|
|
654
645
|
};
|
|
655
|
-
|
|
646
|
+
s(), r();
|
|
656
647
|
});
|
|
657
648
|
subscribeToSessionEvents(e) {
|
|
658
649
|
this.events.eachTriggers((t, s) => {
|
|
659
|
-
const i =
|
|
650
|
+
const i = ae.find((r) => r === s);
|
|
660
651
|
i && (e.on(i, t), this.disposers.add(() => {
|
|
661
652
|
e.off(i, t);
|
|
662
653
|
}));
|
|
@@ -669,52 +660,233 @@ class Ge {
|
|
|
669
660
|
}
|
|
670
661
|
handleEnded = (e) => {
|
|
671
662
|
const { originator: t } = e;
|
|
672
|
-
t === "remote" && this.events.trigger(
|
|
663
|
+
t === "remote" && this.events.trigger(R.ENDED_FROM_SERVER, e), this.reset();
|
|
673
664
|
};
|
|
674
665
|
reset = () => {
|
|
675
666
|
delete this.rtcSession, this.unsubscribeFromSessionEvents(), this.onReset();
|
|
676
667
|
};
|
|
677
668
|
}
|
|
678
|
-
class
|
|
679
|
-
|
|
669
|
+
class Ye {
|
|
670
|
+
config;
|
|
671
|
+
tools;
|
|
672
|
+
connection;
|
|
673
|
+
constructor(e, t) {
|
|
674
|
+
this.config = e, this.tools = t, this.connection = new RTCPeerConnection(e.pcConfig), this.addTransceivers();
|
|
675
|
+
}
|
|
676
|
+
get settings() {
|
|
677
|
+
return this.config;
|
|
678
|
+
}
|
|
679
|
+
get peerConnection() {
|
|
680
|
+
return this.connection;
|
|
681
|
+
}
|
|
682
|
+
close() {
|
|
683
|
+
this.connection.close();
|
|
684
|
+
}
|
|
685
|
+
async call(e) {
|
|
686
|
+
const t = this.waitForTracks(), s = await this.createOffer(), i = await this.tools.sendOffer(
|
|
687
|
+
{ conferenceNumber: e, quality: this.config.quality, audioChannel: this.config.audioChannel },
|
|
688
|
+
s
|
|
689
|
+
);
|
|
690
|
+
await this.setRemoteDescription(i), await t;
|
|
691
|
+
}
|
|
692
|
+
async createOffer() {
|
|
693
|
+
const e = await this.connection.createOffer();
|
|
694
|
+
return await this.connection.setLocalDescription(e), e;
|
|
695
|
+
}
|
|
696
|
+
async setRemoteDescription(e) {
|
|
697
|
+
return this.connection.setRemoteDescription(e);
|
|
698
|
+
}
|
|
699
|
+
async waitForTracks() {
|
|
700
|
+
return new Promise((e) => {
|
|
701
|
+
const t = /* @__PURE__ */ new Set(), s = (i) => {
|
|
702
|
+
const { track: r } = i;
|
|
703
|
+
t.add(r.kind), t.has("audio") && t.has("video") && (this.connection.removeEventListener("track", s), e());
|
|
704
|
+
};
|
|
705
|
+
this.connection.addEventListener("track", s);
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
addTransceivers() {
|
|
709
|
+
this.addRecvOnlyTransceiver("audio"), this.addRecvOnlyTransceiver("video"), this.addRecvOnlyTransceiver("video"), this.addRecvOnlyTransceiver("video"), this.addRecvOnlyTransceiver("video");
|
|
710
|
+
}
|
|
711
|
+
addRecvOnlyTransceiver(e) {
|
|
712
|
+
const t = {
|
|
713
|
+
direction: "recvonly"
|
|
714
|
+
};
|
|
715
|
+
return this.connection.addTransceiver(e, t);
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
const he = (n) => n.getSettings(), ze = (n, e) => {
|
|
719
|
+
const t = he(n);
|
|
720
|
+
let s = e;
|
|
721
|
+
s ??= n.label;
|
|
722
|
+
let i = t?.msid;
|
|
723
|
+
return i ??= s, i ??= n.id, i;
|
|
724
|
+
}, Xe = (n, e) => {
|
|
725
|
+
const t = he(n);
|
|
726
|
+
let s = e;
|
|
727
|
+
return s ??= t?.msid, s ??= n.label, (s && s.length > 0 ? s : void 0) ?? n.id;
|
|
728
|
+
};
|
|
729
|
+
class z {
|
|
730
|
+
participantGroups = /* @__PURE__ */ new Map();
|
|
731
|
+
trackToGroup = /* @__PURE__ */ new Map();
|
|
732
|
+
trackDisposers = /* @__PURE__ */ new Map();
|
|
680
733
|
reset() {
|
|
681
|
-
this.
|
|
682
|
-
|
|
683
|
-
|
|
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;
|
|
686
|
-
}
|
|
687
|
-
generateAudioStream(e) {
|
|
688
|
-
const { id: t } = e, s = this.remoteStreams[t] ?? new MediaStream();
|
|
689
|
-
return s.addTrack(e), this.remoteStreams[t] = s, s;
|
|
690
|
-
}
|
|
691
|
-
generateStreams(e) {
|
|
692
|
-
const t = [];
|
|
693
|
-
return e.forEach((s, i) => {
|
|
694
|
-
if (s.kind === "audio")
|
|
695
|
-
return;
|
|
696
|
-
const r = s, a = e[i - 1];
|
|
697
|
-
let o;
|
|
698
|
-
a?.kind === "audio" && (o = a);
|
|
699
|
-
const c = this.generateStream(r, o);
|
|
700
|
-
t.push(c);
|
|
701
|
-
}), t;
|
|
734
|
+
this.participantGroups.clear(), this.trackToGroup.clear(), this.trackDisposers.forEach((e) => {
|
|
735
|
+
e();
|
|
736
|
+
}), this.trackDisposers.clear();
|
|
702
737
|
}
|
|
703
|
-
|
|
704
|
-
|
|
738
|
+
addTrack(e, {
|
|
739
|
+
onRemoved: t,
|
|
740
|
+
streamHint: s
|
|
741
|
+
} = {}) {
|
|
742
|
+
const i = Xe(e, s), r = ze(e, s);
|
|
743
|
+
if (this.trackToGroup.has(e.id))
|
|
744
|
+
return { isAdded: !1 };
|
|
745
|
+
const a = this.getParticipantGroups(i);
|
|
746
|
+
let o = a.get(r);
|
|
747
|
+
o || (o = {
|
|
748
|
+
participantId: i,
|
|
749
|
+
groupId: r,
|
|
750
|
+
stream: new MediaStream(),
|
|
751
|
+
trackIds: /* @__PURE__ */ new Set()
|
|
752
|
+
}, a.set(r, o)), o.stream.addTrack(e), o.trackIds.add(e.id), this.trackToGroup.set(e.id, { participantId: i, groupId: r });
|
|
753
|
+
const c = () => {
|
|
754
|
+
this.disposeTrackListener(e.id), this.removeTrack(e.id) && t?.({ trackId: e.id, participantId: i });
|
|
755
|
+
};
|
|
756
|
+
return e.addEventListener("ended", c), this.trackDisposers.set(e.id, () => {
|
|
757
|
+
e.removeEventListener("ended", c);
|
|
758
|
+
}), { isAdded: !0, participantId: i };
|
|
759
|
+
}
|
|
760
|
+
removeTrack(e) {
|
|
761
|
+
this.disposeTrackListener(e);
|
|
762
|
+
const t = this.trackToGroup.get(e);
|
|
763
|
+
if (!t)
|
|
764
|
+
return !1;
|
|
765
|
+
const { participantId: s, groupId: i } = t, r = this.participantGroups.get(s), a = r?.get(i);
|
|
766
|
+
if (!a)
|
|
767
|
+
return this.trackToGroup.delete(e), !1;
|
|
768
|
+
const o = a.stream.getTracks().find((c) => c.id === e);
|
|
769
|
+
return o && a.stream.removeTrack(o), a.trackIds.delete(e), this.trackToGroup.delete(e), a.trackIds.size === 0 && (r?.delete(i), r?.size === 0 && this.participantGroups.delete(s)), !0;
|
|
770
|
+
}
|
|
771
|
+
removeStaleTracks(e, t) {
|
|
772
|
+
const s = this.participantGroups.get(e);
|
|
773
|
+
if (!s)
|
|
774
|
+
return !1;
|
|
775
|
+
let i = !1;
|
|
776
|
+
return [...s.values()].forEach((a) => {
|
|
777
|
+
[...a.trackIds].filter((c) => !t.includes(c)).forEach((c) => {
|
|
778
|
+
const d = this.removeTrack(c);
|
|
779
|
+
i ||= d;
|
|
780
|
+
});
|
|
781
|
+
}), i;
|
|
782
|
+
}
|
|
783
|
+
getStreams(e) {
|
|
784
|
+
if (e !== void 0) {
|
|
785
|
+
const t = this.participantGroups.get(e);
|
|
786
|
+
return t ? [...t.values()].map((s) => s.stream) : [];
|
|
787
|
+
}
|
|
788
|
+
return [...this.participantGroups.values()].flatMap((t) => [...t.values()]).map((t) => t.stream);
|
|
789
|
+
}
|
|
790
|
+
disposeTrackListener(e) {
|
|
791
|
+
const t = this.trackDisposers.get(e);
|
|
792
|
+
t && (t(), this.trackDisposers.delete(e));
|
|
793
|
+
}
|
|
794
|
+
getParticipantGroups(e) {
|
|
795
|
+
const t = this.participantGroups.get(e);
|
|
796
|
+
if (t)
|
|
797
|
+
return t;
|
|
798
|
+
const s = /* @__PURE__ */ new Map();
|
|
799
|
+
return this.participantGroups.set(e, s), s;
|
|
705
800
|
}
|
|
706
801
|
}
|
|
707
|
-
|
|
802
|
+
const $ = {
|
|
803
|
+
type: "participant"
|
|
804
|
+
}, Je = {
|
|
805
|
+
type: "spectator_synthetic"
|
|
806
|
+
}, Ke = (n) => ({
|
|
807
|
+
type: "spectator",
|
|
808
|
+
recvParams: n
|
|
809
|
+
});
|
|
810
|
+
class f {
|
|
811
|
+
role = $;
|
|
812
|
+
mainManager;
|
|
813
|
+
recvManager;
|
|
814
|
+
onRoleChanged;
|
|
815
|
+
constructor({
|
|
816
|
+
mainManager: e,
|
|
817
|
+
recvManager: t
|
|
818
|
+
}, s) {
|
|
819
|
+
this.mainManager = e, this.recvManager = t, this.onRoleChanged = s;
|
|
820
|
+
}
|
|
821
|
+
static hasParticipant(e) {
|
|
822
|
+
return e.type === "participant";
|
|
823
|
+
}
|
|
824
|
+
static hasSpectatorSynthetic(e) {
|
|
825
|
+
return e.type === "spectator_synthetic";
|
|
826
|
+
}
|
|
827
|
+
static hasSpectator(e) {
|
|
828
|
+
return e.type === "spectator";
|
|
829
|
+
}
|
|
830
|
+
getRole() {
|
|
831
|
+
return this.role;
|
|
832
|
+
}
|
|
833
|
+
setCallRoleParticipant() {
|
|
834
|
+
this.changeRole($);
|
|
835
|
+
}
|
|
836
|
+
setCallRoleSpectatorSynthetic() {
|
|
837
|
+
this.changeRole(Je);
|
|
838
|
+
}
|
|
839
|
+
setCallRoleSpectator(e) {
|
|
840
|
+
this.changeRole(Ke(e));
|
|
841
|
+
}
|
|
842
|
+
changeRole(e) {
|
|
843
|
+
const t = this.role;
|
|
844
|
+
if (t.type !== e.type) {
|
|
845
|
+
this.setRole(e);
|
|
846
|
+
return;
|
|
847
|
+
}
|
|
848
|
+
f.hasSpectator(e) && f.hasSpectator(t) && t.recvParams.audioId !== e.recvParams.audioId && this.setRole(e);
|
|
849
|
+
}
|
|
850
|
+
reset() {
|
|
851
|
+
this.role = $, this.recvManager.reset();
|
|
852
|
+
}
|
|
853
|
+
getActiveManager() {
|
|
854
|
+
return this.hasSpectator() ? this.recvManager : this.mainManager;
|
|
855
|
+
}
|
|
856
|
+
hasParticipant() {
|
|
857
|
+
return f.hasParticipant(this.role);
|
|
858
|
+
}
|
|
859
|
+
hasSpectatorSynthetic() {
|
|
860
|
+
return f.hasSpectatorSynthetic(this.role);
|
|
861
|
+
}
|
|
862
|
+
hasSpectator() {
|
|
863
|
+
return f.hasSpectator(this.role);
|
|
864
|
+
}
|
|
865
|
+
setRole(e) {
|
|
866
|
+
const t = this.role;
|
|
867
|
+
this.role = e, this.onRoleChanged?.({ previous: t, next: e });
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
const X = (n) => n.streams[0]?.id;
|
|
871
|
+
class je {
|
|
708
872
|
events;
|
|
709
873
|
isPendingCall = !1;
|
|
710
874
|
isPendingAnswer = !1;
|
|
711
875
|
rtcSession;
|
|
712
|
-
remoteStreams = {};
|
|
713
876
|
callConfiguration = {};
|
|
714
|
-
|
|
877
|
+
mainRemoteStreamsManager = new z();
|
|
878
|
+
recvRemoteStreamsManager = new z();
|
|
879
|
+
roleManager = new f(
|
|
880
|
+
{ mainManager: this.mainRemoteStreamsManager, recvManager: this.recvRemoteStreamsManager },
|
|
881
|
+
(e) => {
|
|
882
|
+
this.onRoleChanged(e);
|
|
883
|
+
}
|
|
884
|
+
);
|
|
715
885
|
mcuSession;
|
|
886
|
+
recvSession;
|
|
887
|
+
disposeRecvSessionTrackListener;
|
|
716
888
|
constructor() {
|
|
717
|
-
this.events = new O(
|
|
889
|
+
this.events = new O(oe), this.mcuSession = new Qe(this.events, { onReset: this.reset }), this.subscribeCallStatusChange(), this.subscribeMcuRemoteTrackEvents();
|
|
718
890
|
}
|
|
719
891
|
get requested() {
|
|
720
892
|
return this.isPendingCall || this.isPendingAnswer;
|
|
@@ -761,9 +933,16 @@ class Ye {
|
|
|
761
933
|
return { ...this.callConfiguration };
|
|
762
934
|
}
|
|
763
935
|
getRemoteStreams() {
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
936
|
+
return this.getActiveStreamsManager().getStreams();
|
|
937
|
+
}
|
|
938
|
+
setCallRoleParticipant() {
|
|
939
|
+
this.roleManager.setCallRoleParticipant();
|
|
940
|
+
}
|
|
941
|
+
setCallRoleSpectatorSynthetic() {
|
|
942
|
+
this.roleManager.setCallRoleSpectatorSynthetic();
|
|
943
|
+
}
|
|
944
|
+
setCallRoleSpectator(e) {
|
|
945
|
+
this.roleManager.setCallRoleSpectator(e);
|
|
767
946
|
}
|
|
768
947
|
async replaceMediaStream(e, t) {
|
|
769
948
|
return this.mcuSession.replaceMediaStream(e, t);
|
|
@@ -772,53 +951,121 @@ class Ye {
|
|
|
772
951
|
return this.mcuSession.restartIce(e);
|
|
773
952
|
}
|
|
774
953
|
reset = () => {
|
|
775
|
-
this.
|
|
954
|
+
this.mainRemoteStreamsManager.reset(), this.callConfiguration.number = void 0, this.callConfiguration.answer = !1, this.roleManager.reset(), this.stopRecvSession();
|
|
776
955
|
};
|
|
777
956
|
subscribeCallStatusChange() {
|
|
778
957
|
let { isCallActive: e } = this;
|
|
779
|
-
const { ACCEPTED: t, CONFIRMED: s, ENDED: i, FAILED: r } =
|
|
958
|
+
const { ACCEPTED: t, CONFIRMED: s, ENDED: i, FAILED: r } = R;
|
|
780
959
|
this.onRace([t, s, i, r], () => {
|
|
781
960
|
e = this.maybeTriggerCallStatus(e);
|
|
782
961
|
});
|
|
783
962
|
}
|
|
784
963
|
maybeTriggerCallStatus(e) {
|
|
785
964
|
const t = this.isCallActive;
|
|
786
|
-
return t !== e && this.events.trigger(
|
|
965
|
+
return t !== e && this.events.trigger(R.CALL_STATUS_CHANGED, { isCallActive: t }), t;
|
|
966
|
+
}
|
|
967
|
+
subscribeMcuRemoteTrackEvents() {
|
|
968
|
+
this.on(R.PEER_CONNECTION_ONTRACK, (e) => {
|
|
969
|
+
this.addRemoteTrack(this.mainRemoteStreamsManager, e.track, X(e));
|
|
970
|
+
});
|
|
971
|
+
}
|
|
972
|
+
addRemoteTrack(e, t, s) {
|
|
973
|
+
const i = e.addTrack(t, {
|
|
974
|
+
streamHint: s,
|
|
975
|
+
onRemoved: (r) => {
|
|
976
|
+
this.emitRemoteStreamsChanged(e, "removed", {
|
|
977
|
+
trackId: r.trackId,
|
|
978
|
+
participantId: r.participantId
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
});
|
|
982
|
+
i.isAdded && this.emitRemoteStreamsChanged(e, "added", {
|
|
983
|
+
trackId: t.id,
|
|
984
|
+
participantId: i.participantId
|
|
985
|
+
});
|
|
986
|
+
}
|
|
987
|
+
emitRemoteStreamsChanged(e, t, { trackId: s, participantId: i }) {
|
|
988
|
+
const r = this.getActiveStreamsManager();
|
|
989
|
+
if (e !== r)
|
|
990
|
+
return;
|
|
991
|
+
const a = [...r.getStreams()];
|
|
992
|
+
this.events.trigger(R.REMOTE_STREAMS_CHANGED, {
|
|
993
|
+
participantId: i,
|
|
994
|
+
changeType: t,
|
|
995
|
+
trackId: s,
|
|
996
|
+
streams: a
|
|
997
|
+
});
|
|
787
998
|
}
|
|
999
|
+
getActiveStreamsManager() {
|
|
1000
|
+
return this.roleManager.getActiveManager();
|
|
1001
|
+
}
|
|
1002
|
+
attachRecvSessionTracks(e) {
|
|
1003
|
+
const { peerConnection: t } = e, s = (i) => {
|
|
1004
|
+
this.addRemoteTrack(this.recvRemoteStreamsManager, i.track, X(i));
|
|
1005
|
+
};
|
|
1006
|
+
t.addEventListener("track", s), this.disposeRecvSessionTrackListener = () => {
|
|
1007
|
+
t.removeEventListener("track", s);
|
|
1008
|
+
};
|
|
1009
|
+
}
|
|
1010
|
+
startRecvSession(e, t) {
|
|
1011
|
+
const { number: s } = this.callConfiguration;
|
|
1012
|
+
if (s === void 0)
|
|
1013
|
+
return;
|
|
1014
|
+
this.stopRecvSession();
|
|
1015
|
+
const i = {
|
|
1016
|
+
quality: "high",
|
|
1017
|
+
audioChannel: e
|
|
1018
|
+
}, r = new Ye(i, { sendOffer: t });
|
|
1019
|
+
this.recvSession = r, this.recvRemoteStreamsManager.reset(), this.attachRecvSessionTracks(r), r.call(s).catch(() => {
|
|
1020
|
+
this.stopRecvSession();
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
stopRecvSession() {
|
|
1024
|
+
this.recvSession?.close(), this.recvSession = void 0, this.disposeRecvSessionTrackListener?.(), this.disposeRecvSessionTrackListener = void 0, this.recvRemoteStreamsManager.reset();
|
|
1025
|
+
}
|
|
1026
|
+
onRoleChanged = ({
|
|
1027
|
+
previous: e,
|
|
1028
|
+
next: t
|
|
1029
|
+
}) => {
|
|
1030
|
+
if (f.hasSpectator(e) && !f.hasSpectator(t) && this.stopRecvSession(), f.hasSpectator(t)) {
|
|
1031
|
+
const s = t.recvParams;
|
|
1032
|
+
this.startRecvSession(s.audioId, s.sendOffer);
|
|
1033
|
+
}
|
|
1034
|
+
};
|
|
788
1035
|
}
|
|
789
|
-
const
|
|
1036
|
+
const Ze = (n, e) => (n.degradationPreference = e.degradationPreference, n), et = (n, e) => {
|
|
790
1037
|
n.encodings ??= [];
|
|
791
1038
|
for (let t = n.encodings.length; t < e; t += 1)
|
|
792
1039
|
n.encodings.push({});
|
|
793
1040
|
return n;
|
|
794
|
-
},
|
|
795
|
-
if (
|
|
1041
|
+
}, de = (n) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== n, tt = de(), nt = (n, e) => {
|
|
1042
|
+
if (tt(n, e))
|
|
796
1043
|
return n;
|
|
797
|
-
},
|
|
798
|
-
const t = n.maxBitrate, s =
|
|
1044
|
+
}, st = (n, e) => {
|
|
1045
|
+
const t = n.maxBitrate, s = nt(e, t);
|
|
799
1046
|
return s !== void 0 && (n.maxBitrate = s), n;
|
|
800
|
-
},
|
|
801
|
-
|
|
802
|
-
),
|
|
803
|
-
const t = n === void 0 ? void 0 : Math.max(n,
|
|
804
|
-
if (t !== void 0 &&
|
|
1047
|
+
}, le = 1, it = de(
|
|
1048
|
+
le
|
|
1049
|
+
), rt = (n, e) => {
|
|
1050
|
+
const t = n === void 0 ? void 0 : Math.max(n, le);
|
|
1051
|
+
if (t !== void 0 && it(
|
|
805
1052
|
t,
|
|
806
1053
|
e
|
|
807
1054
|
))
|
|
808
1055
|
return t;
|
|
809
|
-
},
|
|
810
|
-
const t = n.scaleResolutionDownBy, s =
|
|
1056
|
+
}, at = (n, e) => {
|
|
1057
|
+
const t = n.scaleResolutionDownBy, s = rt(
|
|
811
1058
|
e,
|
|
812
1059
|
t
|
|
813
1060
|
);
|
|
814
1061
|
return s !== void 0 && (n.scaleResolutionDownBy = s), n;
|
|
815
|
-
},
|
|
1062
|
+
}, ot = (n, e) => {
|
|
816
1063
|
const t = e.encodings?.length ?? 0;
|
|
817
|
-
return
|
|
1064
|
+
return et(n, t), n.encodings.forEach((s, i) => {
|
|
818
1065
|
const r = (e?.encodings ?? [])[i], a = r?.maxBitrate, o = r?.scaleResolutionDownBy;
|
|
819
|
-
|
|
1066
|
+
st(s, a), at(s, o);
|
|
820
1067
|
}), n;
|
|
821
|
-
},
|
|
1068
|
+
}, ct = (n, e) => {
|
|
822
1069
|
if (n.codecs?.length !== e.codecs?.length)
|
|
823
1070
|
return !0;
|
|
824
1071
|
for (let t = 0; t < (n.codecs?.length ?? 0); t++)
|
|
@@ -835,15 +1082,15 @@ const ze = (n, e) => (n.degradationPreference = e.degradationPreference, n), Xe
|
|
|
835
1082
|
if (JSON.stringify(n.encodings[t]) !== JSON.stringify(e.encodings[t]))
|
|
836
1083
|
return !0;
|
|
837
1084
|
return n.rtcp?.cname !== e.rtcp?.cname || n.rtcp?.reducedSize !== e.rtcp?.reducedSize || n.degradationPreference !== e.degradationPreference;
|
|
838
|
-
},
|
|
1085
|
+
}, ht = async (n, e) => {
|
|
839
1086
|
const t = n.getParameters(), s = JSON.parse(
|
|
840
1087
|
JSON.stringify(t)
|
|
841
1088
|
);
|
|
842
|
-
|
|
843
|
-
const i =
|
|
1089
|
+
ot(t, e), Ze(t, e);
|
|
1090
|
+
const i = ct(s, t);
|
|
844
1091
|
return i && await n.setParameters(t), { parameters: t, isChanged: i };
|
|
845
|
-
},
|
|
846
|
-
const { isChanged: s, parameters: i } = await
|
|
1092
|
+
}, ue = async (n, e, t) => {
|
|
1093
|
+
const { isChanged: s, parameters: i } = await ht(n, {
|
|
847
1094
|
encodings: [
|
|
848
1095
|
{
|
|
849
1096
|
scaleResolutionDownBy: e.scaleResolutionDownBy,
|
|
@@ -852,20 +1099,20 @@ const ze = (n, e) => (n.degradationPreference = e.degradationPreference, n), Xe
|
|
|
852
1099
|
]
|
|
853
1100
|
});
|
|
854
1101
|
return s && t && t(i), { isChanged: s, parameters: i };
|
|
855
|
-
},
|
|
856
|
-
const s =
|
|
1102
|
+
}, dt = (n, e) => n.find((t) => t.track !== null && e.getTracks().includes(t.track)), lt = async (n, e, t) => {
|
|
1103
|
+
const s = dt(n, e);
|
|
857
1104
|
if (s)
|
|
858
|
-
return
|
|
1105
|
+
return ue(s, { maxBitrate: t });
|
|
859
1106
|
};
|
|
860
|
-
var
|
|
861
|
-
const
|
|
1107
|
+
var P = /* @__PURE__ */ ((n) => (n.START_PRESENTATION = "presentation:start", n.STARTED_PRESENTATION = "presentation:started", n.END_PRESENTATION = "presentation:end", n.ENDED_PRESENTATION = "presentation:ended", n.FAILED_PRESENTATION = "presentation:failed", n))(P || {});
|
|
1108
|
+
const ge = [
|
|
862
1109
|
"presentation:start",
|
|
863
1110
|
"presentation:started",
|
|
864
1111
|
"presentation:end",
|
|
865
1112
|
"presentation:ended",
|
|
866
1113
|
"presentation:failed"
|
|
867
|
-
],
|
|
868
|
-
class
|
|
1114
|
+
], ut = 1, jn = (n) => we(n);
|
|
1115
|
+
class gt {
|
|
869
1116
|
events;
|
|
870
1117
|
promisePendingStartPresentation;
|
|
871
1118
|
promisePendingStopPresentation;
|
|
@@ -877,7 +1124,7 @@ class ct {
|
|
|
877
1124
|
callManager: e,
|
|
878
1125
|
maxBitrate: t
|
|
879
1126
|
}) {
|
|
880
|
-
this.callManager = e, this.maxBitrate = t, this.events = new O(
|
|
1127
|
+
this.callManager = e, this.maxBitrate = t, this.events = new O(ge), this.subscribe();
|
|
881
1128
|
}
|
|
882
1129
|
get isPendingPresentation() {
|
|
883
1130
|
return !!this.promisePendingStartPresentation || !!this.promisePendingStopPresentation;
|
|
@@ -913,8 +1160,8 @@ class ct {
|
|
|
913
1160
|
const i = this.callManager.getEstablishedRTCSession();
|
|
914
1161
|
return i && t ? s = e().then(async () => i.stopPresentation(t)).catch((r) => {
|
|
915
1162
|
const a = r instanceof Error ? r : new Error(String(r));
|
|
916
|
-
throw this.events.trigger(
|
|
917
|
-
}) : t && this.events.trigger(
|
|
1163
|
+
throw this.events.trigger(P.FAILED_PRESENTATION, a), r;
|
|
1164
|
+
}) : t && this.events.trigger(P.ENDED_PRESENTATION, t), this.promisePendingStopPresentation = s, s.finally(() => {
|
|
918
1165
|
this.resetPresentation();
|
|
919
1166
|
});
|
|
920
1167
|
}
|
|
@@ -953,15 +1200,15 @@ class ct {
|
|
|
953
1200
|
}
|
|
954
1201
|
subscribe() {
|
|
955
1202
|
this.callManager.on("presentation:start", (e) => {
|
|
956
|
-
this.events.trigger(
|
|
1203
|
+
this.events.trigger(P.START_PRESENTATION, e);
|
|
957
1204
|
}), this.callManager.on("presentation:started", (e) => {
|
|
958
|
-
this.events.trigger(
|
|
1205
|
+
this.events.trigger(P.STARTED_PRESENTATION, e);
|
|
959
1206
|
}), this.callManager.on("presentation:end", (e) => {
|
|
960
|
-
this.events.trigger(
|
|
1207
|
+
this.events.trigger(P.END_PRESENTATION, e);
|
|
961
1208
|
}), this.callManager.on("presentation:ended", (e) => {
|
|
962
|
-
this.events.trigger(
|
|
1209
|
+
this.events.trigger(P.ENDED_PRESENTATION, e);
|
|
963
1210
|
}), this.callManager.on("presentation:failed", (e) => {
|
|
964
|
-
this.events.trigger(
|
|
1211
|
+
this.events.trigger(P.FAILED_PRESENTATION, e);
|
|
965
1212
|
}), this.callManager.on("failed", this.handleEnded), this.callManager.on("ended", this.handleEnded);
|
|
966
1213
|
}
|
|
967
1214
|
async sendPresentationWithDuplicatedCalls(e, {
|
|
@@ -969,7 +1216,7 @@ class ct {
|
|
|
969
1216
|
stream: s,
|
|
970
1217
|
presentationOptions: i,
|
|
971
1218
|
options: r = {
|
|
972
|
-
callLimit:
|
|
1219
|
+
callLimit: ut
|
|
973
1220
|
}
|
|
974
1221
|
}) {
|
|
975
1222
|
const a = async () => this.sendPresentation(
|
|
@@ -978,7 +1225,7 @@ class ct {
|
|
|
978
1225
|
s,
|
|
979
1226
|
i
|
|
980
1227
|
), o = () => !!this.streamPresentationCurrent;
|
|
981
|
-
return this.cancelableSendPresentationWithRepeatedCalls =
|
|
1228
|
+
return this.cancelableSendPresentationWithRepeatedCalls = se({
|
|
982
1229
|
targetFunction: a,
|
|
983
1230
|
isComplete: o,
|
|
984
1231
|
isRejectAsValid: !0,
|
|
@@ -993,20 +1240,20 @@ class ct {
|
|
|
993
1240
|
sendEncodings: o,
|
|
994
1241
|
onAddedTransceiver: c
|
|
995
1242
|
}) {
|
|
996
|
-
const d =
|
|
1243
|
+
const d = k(s, { contentHint: r });
|
|
997
1244
|
if (d === void 0)
|
|
998
1245
|
throw new Error("No streamPresentationTarget");
|
|
999
1246
|
this.streamPresentationCurrent = d;
|
|
1000
|
-
const
|
|
1247
|
+
const S = e().then(async () => t.startPresentation(d, i, {
|
|
1001
1248
|
degradationPreference: a,
|
|
1002
1249
|
sendEncodings: o,
|
|
1003
1250
|
onAddedTransceiver: c
|
|
1004
|
-
})).then(this.setMaxBitrate).then(() => s).catch((
|
|
1251
|
+
})).then(this.setMaxBitrate).then(() => s).catch((g) => {
|
|
1005
1252
|
this.removeStreamPresentationCurrent();
|
|
1006
|
-
const
|
|
1007
|
-
throw this.events.trigger(
|
|
1253
|
+
const T = g instanceof Error ? g : new Error(String(g));
|
|
1254
|
+
throw this.events.trigger(P.FAILED_PRESENTATION, T), g;
|
|
1008
1255
|
});
|
|
1009
|
-
return this.promisePendingStartPresentation =
|
|
1256
|
+
return this.promisePendingStartPresentation = S, S.finally(() => {
|
|
1010
1257
|
this.promisePendingStartPresentation = void 0;
|
|
1011
1258
|
});
|
|
1012
1259
|
}
|
|
@@ -1015,7 +1262,7 @@ class ct {
|
|
|
1015
1262
|
if (!e || !t || s === void 0)
|
|
1016
1263
|
return;
|
|
1017
1264
|
const i = e.getSenders();
|
|
1018
|
-
await
|
|
1265
|
+
await lt(i, t, s);
|
|
1019
1266
|
};
|
|
1020
1267
|
getRtcSessionProtected = () => {
|
|
1021
1268
|
const e = this.callManager.getEstablishedRTCSession();
|
|
@@ -1036,7 +1283,7 @@ class ct {
|
|
|
1036
1283
|
delete this.streamPresentationCurrent;
|
|
1037
1284
|
}
|
|
1038
1285
|
}
|
|
1039
|
-
class
|
|
1286
|
+
class Tt {
|
|
1040
1287
|
data;
|
|
1041
1288
|
getUa;
|
|
1042
1289
|
constructor(e) {
|
|
@@ -1086,7 +1333,13 @@ class ht {
|
|
|
1086
1333
|
return this.data?.register === !0;
|
|
1087
1334
|
}
|
|
1088
1335
|
/**
|
|
1089
|
-
* Получает SIP сервер
|
|
1336
|
+
* Получает SIP сервер IP из конфигурации
|
|
1337
|
+
*/
|
|
1338
|
+
getSipServerIp() {
|
|
1339
|
+
return this.data?.sipServerIp;
|
|
1340
|
+
}
|
|
1341
|
+
/**
|
|
1342
|
+
* Получает SIP сервер URL (WebSocket) из конфигурации
|
|
1090
1343
|
*/
|
|
1091
1344
|
getSipServerUrl() {
|
|
1092
1345
|
return this.data?.sipServerUrl;
|
|
@@ -1117,7 +1370,7 @@ class ht {
|
|
|
1117
1370
|
}
|
|
1118
1371
|
}
|
|
1119
1372
|
var C = /* @__PURE__ */ ((n) => (n.CONNECTING = "connecting", n.CONNECTED = "connected", n.DISCONNECTED = "disconnected", n.DISCONNECTING = "disconnecting", n.NEW_RTC_SESSION = "newRTCSession", n.REGISTERED = "registered", n.UNREGISTERED = "unregistered", n.REGISTRATION_FAILED = "registrationFailed", n.NEW_MESSAGE = "newMessage", n.SIP_EVENT = "sipEvent", n.CONNECT_STARTED = "connect-started", n.CONNECT_SUCCEEDED = "connect-succeeded", n.CONNECT_FAILED = "connect-failed", n.CONNECT_PARAMETERS_RESOLVE_SUCCESS = "connect-parameters-resolve-success", n.CONNECT_PARAMETERS_RESOLVE_FAILED = "connect-parameters-resolve-failed", n.CONNECTED_WITH_CONFIGURATION = "connected-with-configuration", n))(C || {});
|
|
1120
|
-
const
|
|
1373
|
+
const Te = [
|
|
1121
1374
|
"connecting",
|
|
1122
1375
|
"connected",
|
|
1123
1376
|
"disconnected",
|
|
@@ -1127,7 +1380,7 @@ const le = [
|
|
|
1127
1380
|
"registrationFailed",
|
|
1128
1381
|
"newMessage",
|
|
1129
1382
|
"sipEvent"
|
|
1130
|
-
],
|
|
1383
|
+
], St = [
|
|
1131
1384
|
"disconnecting",
|
|
1132
1385
|
"connect-started",
|
|
1133
1386
|
"connect-succeeded",
|
|
@@ -1135,8 +1388,12 @@ const le = [
|
|
|
1135
1388
|
"connect-parameters-resolve-success",
|
|
1136
1389
|
"connect-parameters-resolve-failed",
|
|
1137
1390
|
"connected-with-configuration"
|
|
1138
|
-
],
|
|
1139
|
-
|
|
1391
|
+
], Se = [...Te, ...St];
|
|
1392
|
+
function Ct(n) {
|
|
1393
|
+
return (e) => `sip:${e}@${n}`;
|
|
1394
|
+
}
|
|
1395
|
+
const Et = (n, e) => () => Math.floor(Math.random() * (e - n)) + n, Ce = (n) => n.trim().replaceAll(" ", "_"), pt = Et(1e5, 99999999), Rt = 3;
|
|
1396
|
+
class At {
|
|
1140
1397
|
cancelableConnectWithRepeatedCalls;
|
|
1141
1398
|
JsSIP;
|
|
1142
1399
|
events;
|
|
@@ -1148,10 +1405,10 @@ class ut {
|
|
|
1148
1405
|
getConnectionConfiguration;
|
|
1149
1406
|
setConnectionConfiguration;
|
|
1150
1407
|
updateConnectionConfiguration;
|
|
1151
|
-
|
|
1408
|
+
setGetUri;
|
|
1152
1409
|
setSocket;
|
|
1153
1410
|
constructor(e) {
|
|
1154
|
-
this.JsSIP = e.JsSIP, this.events = e.events, this.uaFactory = e.uaFactory, this.stateMachine = e.stateMachine, this.registrationManager = e.registrationManager, this.getUa = e.getUa, this.setUa = e.setUa, this.getConnectionConfiguration = e.getConnectionConfiguration, this.setConnectionConfiguration = e.setConnectionConfiguration, this.updateConnectionConfiguration = e.updateConnectionConfiguration, this.
|
|
1411
|
+
this.JsSIP = e.JsSIP, this.events = e.events, this.uaFactory = e.uaFactory, this.stateMachine = e.stateMachine, this.registrationManager = e.registrationManager, this.getUa = e.getUa, this.setUa = e.setUa, this.getConnectionConfiguration = e.getConnectionConfiguration, this.setConnectionConfiguration = e.setConnectionConfiguration, this.updateConnectionConfiguration = e.updateConnectionConfiguration, this.setGetUri = e.setGetUri, this.setSocket = e.setSocket, this.proxyEvents();
|
|
1155
1412
|
}
|
|
1156
1413
|
connect = async (e, t) => (this.cancelRequests(), this.connectWithDuplicatedCalls(e, t));
|
|
1157
1414
|
set = async ({ displayName: e }) => new Promise((t, s) => {
|
|
@@ -1162,7 +1419,7 @@ class ut {
|
|
|
1162
1419
|
}
|
|
1163
1420
|
let r = !1;
|
|
1164
1421
|
const a = this.getConnectionConfiguration();
|
|
1165
|
-
e !== void 0 && e !== a?.displayName && (r = i.set("display_name",
|
|
1422
|
+
e !== void 0 && e !== a?.displayName && (r = i.set("display_name", Ce(e)), this.updateConnectionConfiguration("displayName", e));
|
|
1166
1423
|
const o = r;
|
|
1167
1424
|
o ? t(o) : s(new Error("nothing changed"));
|
|
1168
1425
|
});
|
|
@@ -1180,12 +1437,12 @@ class ut {
|
|
|
1180
1437
|
cancelRequests() {
|
|
1181
1438
|
this.cancelConnectWithRepeatedCalls();
|
|
1182
1439
|
}
|
|
1183
|
-
connectWithDuplicatedCalls = async (e, { callLimit: t =
|
|
1440
|
+
connectWithDuplicatedCalls = async (e, { callLimit: t = Rt } = {}) => {
|
|
1184
1441
|
const s = async () => this.connectInner(e), i = (r) => {
|
|
1185
|
-
const c = this.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), d = r != null &&
|
|
1442
|
+
const c = this.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), d = r != null && !$e(r);
|
|
1186
1443
|
return c || d;
|
|
1187
1444
|
};
|
|
1188
|
-
return this.stateMachine.startConnect(), this.cancelableConnectWithRepeatedCalls =
|
|
1445
|
+
return this.stateMachine.startConnect(), this.cancelableConnectWithRepeatedCalls = se({
|
|
1189
1446
|
targetFunction: s,
|
|
1190
1447
|
isComplete: i,
|
|
1191
1448
|
callLimit: t,
|
|
@@ -1213,44 +1470,45 @@ class ut {
|
|
|
1213
1470
|
initUa = async ({
|
|
1214
1471
|
user: e,
|
|
1215
1472
|
password: t,
|
|
1216
|
-
|
|
1217
|
-
|
|
1473
|
+
sipServerIp: s,
|
|
1474
|
+
sipServerUrl: i,
|
|
1218
1475
|
remoteAddress: r,
|
|
1219
1476
|
sessionTimers: a,
|
|
1220
1477
|
registerExpires: o,
|
|
1221
1478
|
connectionRecoveryMinInterval: c,
|
|
1222
1479
|
connectionRecoveryMaxInterval: d,
|
|
1223
|
-
userAgent:
|
|
1224
|
-
displayName:
|
|
1225
|
-
register:
|
|
1226
|
-
extraHeaders:
|
|
1480
|
+
userAgent: S,
|
|
1481
|
+
displayName: g = "",
|
|
1482
|
+
register: T = !1,
|
|
1483
|
+
extraHeaders: p = []
|
|
1227
1484
|
}) => {
|
|
1228
1485
|
this.stateMachine.startInitUa(), this.setConnectionConfiguration({
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1486
|
+
sipServerIp: s,
|
|
1487
|
+
sipServerUrl: i,
|
|
1488
|
+
displayName: g,
|
|
1489
|
+
register: T,
|
|
1232
1490
|
user: e,
|
|
1233
1491
|
password: t
|
|
1234
1492
|
}), this.getUa() && await this.disconnect();
|
|
1235
|
-
const { ua:
|
|
1493
|
+
const { ua: A, helpers: D } = this.uaFactory.createUAWithConfiguration(
|
|
1236
1494
|
{
|
|
1237
1495
|
user: e,
|
|
1238
1496
|
password: t,
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
displayName:
|
|
1242
|
-
register:
|
|
1497
|
+
sipServerIp: s,
|
|
1498
|
+
sipServerUrl: i,
|
|
1499
|
+
displayName: g,
|
|
1500
|
+
register: T,
|
|
1243
1501
|
sessionTimers: a,
|
|
1244
1502
|
registerExpires: o,
|
|
1245
1503
|
connectionRecoveryMinInterval: c,
|
|
1246
1504
|
connectionRecoveryMaxInterval: d,
|
|
1247
|
-
userAgent:
|
|
1505
|
+
userAgent: S,
|
|
1248
1506
|
remoteAddress: r,
|
|
1249
|
-
extraHeaders:
|
|
1507
|
+
extraHeaders: p
|
|
1250
1508
|
},
|
|
1251
1509
|
this.events
|
|
1252
1510
|
);
|
|
1253
|
-
return this.setUa(
|
|
1511
|
+
return this.setUa(A), this.setGetUri(D.getUri), this.setSocket(D.socket), A;
|
|
1254
1512
|
};
|
|
1255
1513
|
start = async () => new Promise((e, t) => {
|
|
1256
1514
|
const s = this.getUa();
|
|
@@ -1262,12 +1520,12 @@ class ut {
|
|
|
1262
1520
|
i = ((c, d) => {
|
|
1263
1521
|
if (this.getConnectionConfiguration()?.register === !0)
|
|
1264
1522
|
return this.registrationManager.subscribeToStartEvents(c, d);
|
|
1265
|
-
const
|
|
1266
|
-
return this.events.on(
|
|
1267
|
-
this.events.on(
|
|
1523
|
+
const g = C.CONNECTED, T = [C.DISCONNECTED];
|
|
1524
|
+
return this.events.on(g, c), T.forEach((p) => {
|
|
1525
|
+
this.events.on(p, d);
|
|
1268
1526
|
}), () => {
|
|
1269
|
-
this.events.off(
|
|
1270
|
-
this.events.off(
|
|
1527
|
+
this.events.off(g, c), T.forEach((p) => {
|
|
1528
|
+
this.events.off(p, d);
|
|
1271
1529
|
});
|
|
1272
1530
|
};
|
|
1273
1531
|
})(() => {
|
|
@@ -1289,8 +1547,8 @@ class ut {
|
|
|
1289
1547
|
});
|
|
1290
1548
|
}
|
|
1291
1549
|
}
|
|
1292
|
-
var
|
|
1293
|
-
const
|
|
1550
|
+
var Ee = /* @__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))(Ee || {});
|
|
1551
|
+
const Nt = Ue({
|
|
1294
1552
|
types: {
|
|
1295
1553
|
context: {},
|
|
1296
1554
|
events: {}
|
|
@@ -1604,14 +1862,14 @@ const gt = Oe({
|
|
|
1604
1862
|
}
|
|
1605
1863
|
}
|
|
1606
1864
|
});
|
|
1607
|
-
class
|
|
1865
|
+
class mt {
|
|
1608
1866
|
actor;
|
|
1609
1867
|
stateChangeListeners = /* @__PURE__ */ new Set();
|
|
1610
1868
|
events;
|
|
1611
1869
|
unsubscribeFromEvents;
|
|
1612
1870
|
actorSubscription;
|
|
1613
1871
|
constructor(e) {
|
|
1614
|
-
this.events = e, this.actor =
|
|
1872
|
+
this.events = e, this.actor = Le(Nt), this.actorSubscription = this.actor.subscribe((t) => {
|
|
1615
1873
|
const s = t.value;
|
|
1616
1874
|
this.stateChangeListeners.forEach((i) => {
|
|
1617
1875
|
i(s);
|
|
@@ -1697,7 +1955,7 @@ class Tt {
|
|
|
1697
1955
|
return this.actor.getSnapshot().can({ type: e });
|
|
1698
1956
|
}
|
|
1699
1957
|
getValidEvents() {
|
|
1700
|
-
return Object.values(
|
|
1958
|
+
return Object.values(Ee).filter((e) => this.canTransition(e));
|
|
1701
1959
|
}
|
|
1702
1960
|
hasState(e) {
|
|
1703
1961
|
return this.actor.getSnapshot().matches(e);
|
|
@@ -1766,7 +2024,7 @@ class Tt {
|
|
|
1766
2024
|
};
|
|
1767
2025
|
}
|
|
1768
2026
|
}
|
|
1769
|
-
class
|
|
2027
|
+
class It {
|
|
1770
2028
|
events;
|
|
1771
2029
|
getUaProtected;
|
|
1772
2030
|
constructor(e) {
|
|
@@ -1803,7 +2061,7 @@ class St {
|
|
|
1803
2061
|
};
|
|
1804
2062
|
}
|
|
1805
2063
|
}
|
|
1806
|
-
class
|
|
2064
|
+
class _t {
|
|
1807
2065
|
uaFactory;
|
|
1808
2066
|
getUaProtected;
|
|
1809
2067
|
constructor(e) {
|
|
@@ -1843,32 +2101,32 @@ class Ct {
|
|
|
1843
2101
|
async checkTelephony({
|
|
1844
2102
|
userAgent: e,
|
|
1845
2103
|
displayName: t,
|
|
1846
|
-
|
|
1847
|
-
|
|
2104
|
+
sipServerIp: s,
|
|
2105
|
+
sipServerUrl: i,
|
|
1848
2106
|
remoteAddress: r,
|
|
1849
2107
|
extraHeaders: a
|
|
1850
2108
|
}) {
|
|
1851
2109
|
return new Promise((o, c) => {
|
|
1852
2110
|
const { configuration: d } = this.uaFactory.createConfiguration({
|
|
1853
|
-
|
|
2111
|
+
sipServerUrl: i,
|
|
1854
2112
|
displayName: t,
|
|
1855
2113
|
userAgent: e,
|
|
1856
|
-
|
|
1857
|
-
}),
|
|
1858
|
-
const
|
|
1859
|
-
c(
|
|
2114
|
+
sipServerIp: s
|
|
2115
|
+
}), S = this.uaFactory.createUA({ ...d, remoteAddress: r, extraHeaders: a }), g = () => {
|
|
2116
|
+
const p = new Error("Telephony is not available");
|
|
2117
|
+
c(p);
|
|
1860
2118
|
};
|
|
1861
|
-
|
|
1862
|
-
const
|
|
1863
|
-
|
|
2119
|
+
S.once(C.DISCONNECTED, g);
|
|
2120
|
+
const T = () => {
|
|
2121
|
+
S.removeAllListeners(), S.once(C.DISCONNECTED, () => {
|
|
1864
2122
|
o();
|
|
1865
|
-
}),
|
|
2123
|
+
}), S.stop();
|
|
1866
2124
|
};
|
|
1867
|
-
|
|
2125
|
+
S.once(C.CONNECTED, T), S.start();
|
|
1868
2126
|
});
|
|
1869
2127
|
}
|
|
1870
2128
|
}
|
|
1871
|
-
const
|
|
2129
|
+
const Mt = (n) => {
|
|
1872
2130
|
const e = [];
|
|
1873
2131
|
return n !== void 0 && n !== "" && e.push(`X-Vinteo-Remote: ${n}`), e;
|
|
1874
2132
|
};
|
|
@@ -1884,64 +2142,64 @@ class b {
|
|
|
1884
2142
|
register: e,
|
|
1885
2143
|
password: t,
|
|
1886
2144
|
user: s,
|
|
1887
|
-
|
|
1888
|
-
|
|
2145
|
+
sipServerIp: i,
|
|
2146
|
+
sipServerUrl: r
|
|
1889
2147
|
}) {
|
|
1890
2148
|
if (!i)
|
|
1891
|
-
throw new Error("
|
|
2149
|
+
throw new Error("sipServerIp is required");
|
|
1892
2150
|
if (!r)
|
|
1893
|
-
throw new Error("
|
|
2151
|
+
throw new Error("sipServerUrl is required");
|
|
1894
2152
|
if (e && (t === void 0 || t === ""))
|
|
1895
2153
|
throw new Error("password is required for authorized connection");
|
|
1896
2154
|
if (e && (s === void 0 || s === ""))
|
|
1897
2155
|
throw new Error("user is required for authorized connection");
|
|
1898
2156
|
}
|
|
1899
2157
|
static resolveAuthorizationUser(e, t) {
|
|
1900
|
-
return e && t !== void 0 && t.trim() !== "" ? t.trim() : `${
|
|
2158
|
+
return e && t !== void 0 && t.trim() !== "" ? t.trim() : `${pt()}`;
|
|
1901
2159
|
}
|
|
1902
2160
|
static buildExtraHeaders(e, t) {
|
|
1903
|
-
const s = e !== void 0 && e !== "" ?
|
|
2161
|
+
const s = e !== void 0 && e !== "" ? Mt(e) : [];
|
|
1904
2162
|
return t === void 0 ? s : [...s, ...t];
|
|
1905
2163
|
}
|
|
1906
2164
|
createConfiguration({
|
|
1907
2165
|
user: e,
|
|
1908
2166
|
password: t,
|
|
1909
|
-
|
|
2167
|
+
sipServerUrl: s,
|
|
1910
2168
|
displayName: i = "",
|
|
1911
|
-
|
|
2169
|
+
sipServerIp: r,
|
|
1912
2170
|
register: a = !1,
|
|
1913
2171
|
sessionTimers: o = !1,
|
|
1914
2172
|
registerExpires: c = 300,
|
|
1915
2173
|
// 5 minutes in sec
|
|
1916
2174
|
connectionRecoveryMinInterval: d = 2,
|
|
1917
|
-
connectionRecoveryMaxInterval:
|
|
1918
|
-
userAgent:
|
|
2175
|
+
connectionRecoveryMaxInterval: S = 6,
|
|
2176
|
+
userAgent: g
|
|
1919
2177
|
}) {
|
|
1920
2178
|
b.validateParametersConnection({
|
|
1921
2179
|
register: a,
|
|
1922
2180
|
password: t,
|
|
1923
2181
|
user: e,
|
|
1924
|
-
|
|
1925
|
-
|
|
2182
|
+
sipServerIp: r,
|
|
2183
|
+
sipServerUrl: s
|
|
1926
2184
|
});
|
|
1927
|
-
const
|
|
2185
|
+
const T = b.resolveAuthorizationUser(a, e), p = Ct(r), v = p(T), A = new this.JsSIP.WebSocketInterface(`wss://${s}/webrtc/wss/`);
|
|
1928
2186
|
return {
|
|
1929
2187
|
configuration: {
|
|
1930
2188
|
password: t,
|
|
1931
2189
|
register: a,
|
|
1932
|
-
uri:
|
|
1933
|
-
display_name:
|
|
1934
|
-
user_agent:
|
|
2190
|
+
uri: v,
|
|
2191
|
+
display_name: Ce(i),
|
|
2192
|
+
user_agent: g,
|
|
1935
2193
|
sdpSemantics: "unified-plan",
|
|
1936
|
-
sockets: [
|
|
2194
|
+
sockets: [A],
|
|
1937
2195
|
session_timers: o,
|
|
1938
2196
|
register_expires: c,
|
|
1939
2197
|
connection_recovery_min_interval: d,
|
|
1940
|
-
connection_recovery_max_interval:
|
|
2198
|
+
connection_recovery_max_interval: S
|
|
1941
2199
|
},
|
|
1942
2200
|
helpers: {
|
|
1943
|
-
socket:
|
|
1944
|
-
|
|
2201
|
+
socket: A,
|
|
2202
|
+
getUri: p
|
|
1945
2203
|
}
|
|
1946
2204
|
};
|
|
1947
2205
|
}
|
|
@@ -1959,13 +2217,13 @@ class b {
|
|
|
1959
2217
|
extraHeaders: e.extraHeaders
|
|
1960
2218
|
});
|
|
1961
2219
|
return t.eachTriggers((a, o) => {
|
|
1962
|
-
const c =
|
|
2220
|
+
const c = Te.find((d) => d === o);
|
|
1963
2221
|
c && r.on(c, a);
|
|
1964
2222
|
}), { ua: r, helpers: i };
|
|
1965
2223
|
}
|
|
1966
2224
|
}
|
|
1967
|
-
const
|
|
1968
|
-
class
|
|
2225
|
+
const pe = "Not ready for connection", ft = (n) => n instanceof Error && n.message === pe, vt = () => new Error(pe), Pt = async (n) => typeof n == "function" ? n() : n;
|
|
2226
|
+
class Ot {
|
|
1969
2227
|
events;
|
|
1970
2228
|
ua;
|
|
1971
2229
|
socket;
|
|
@@ -1977,15 +2235,15 @@ class It {
|
|
|
1977
2235
|
configurationManager;
|
|
1978
2236
|
JsSIP;
|
|
1979
2237
|
constructor({ JsSIP: e }) {
|
|
1980
|
-
this.JsSIP = e, this.events = new O(
|
|
2238
|
+
this.JsSIP = e, this.events = new O(Se), this.uaFactory = new b(e), this.registrationManager = new It({
|
|
1981
2239
|
events: this.events,
|
|
1982
2240
|
getUaProtected: this.getUaProtected
|
|
1983
|
-
}), this.stateMachine = new
|
|
2241
|
+
}), this.stateMachine = new mt(this.events), this.configurationManager = new Tt({
|
|
1984
2242
|
getUa: this.getUa
|
|
1985
|
-
}), this.sipOperations = new
|
|
2243
|
+
}), this.sipOperations = new _t({
|
|
1986
2244
|
uaFactory: this.uaFactory,
|
|
1987
2245
|
getUaProtected: this.getUaProtected
|
|
1988
|
-
}), this.connectionFlow = new
|
|
2246
|
+
}), this.connectionFlow = new At({
|
|
1989
2247
|
JsSIP: this.JsSIP,
|
|
1990
2248
|
events: this.events,
|
|
1991
2249
|
uaFactory: this.uaFactory,
|
|
@@ -2002,8 +2260,8 @@ class It {
|
|
|
2002
2260
|
setUa: (t) => {
|
|
2003
2261
|
this.ua = t;
|
|
2004
2262
|
},
|
|
2005
|
-
|
|
2006
|
-
this.
|
|
2263
|
+
setGetUri: (t) => {
|
|
2264
|
+
this.getUri = t;
|
|
2007
2265
|
},
|
|
2008
2266
|
setSocket: (t) => {
|
|
2009
2267
|
this.socket = t;
|
|
@@ -2078,7 +2336,7 @@ class It {
|
|
|
2078
2336
|
this.stateMachine.destroy();
|
|
2079
2337
|
}
|
|
2080
2338
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
2081
|
-
|
|
2339
|
+
getUri = (e) => e;
|
|
2082
2340
|
getUaProtected = () => {
|
|
2083
2341
|
if (!this.ua)
|
|
2084
2342
|
throw new Error("UA not initialized");
|
|
@@ -2087,7 +2345,7 @@ class It {
|
|
|
2087
2345
|
getUa = () => this.ua;
|
|
2088
2346
|
connectWithProcessError = async (e, t) => {
|
|
2089
2347
|
if (!(t?.hasReadyForConnection?.() ?? !0))
|
|
2090
|
-
throw
|
|
2348
|
+
throw vt();
|
|
2091
2349
|
return this.processConnect(e, t).catch(async (i) => {
|
|
2092
2350
|
const r = i;
|
|
2093
2351
|
return this.disconnect().then(() => {
|
|
@@ -2097,7 +2355,7 @@ class It {
|
|
|
2097
2355
|
});
|
|
2098
2356
|
});
|
|
2099
2357
|
};
|
|
2100
|
-
processConnect = async (e, t) => (this.events.trigger(C.CONNECT_STARTED, {}),
|
|
2358
|
+
processConnect = async (e, t) => (this.events.trigger(C.CONNECT_STARTED, {}), Pt(e).then((s) => (this.events.trigger(C.CONNECT_PARAMETERS_RESOLVE_SUCCESS, s), s)).catch((s) => {
|
|
2101
2359
|
throw this.events.trigger(C.CONNECT_PARAMETERS_RESOLVE_FAILED, s), s;
|
|
2102
2360
|
}).then(async (s) => this.connectionFlow.connect(s, t)).then((s) => (this.events.trigger(C.CONNECT_SUCCEEDED, {
|
|
2103
2361
|
...s
|
|
@@ -2106,9 +2364,9 @@ class It {
|
|
|
2106
2364
|
throw this.events.trigger(C.CONNECT_FAILED, i), i;
|
|
2107
2365
|
}));
|
|
2108
2366
|
}
|
|
2109
|
-
class
|
|
2367
|
+
class yt {
|
|
2110
2368
|
connectionManager;
|
|
2111
|
-
stackPromises =
|
|
2369
|
+
stackPromises = ie({
|
|
2112
2370
|
noRunIsNotActual: !0
|
|
2113
2371
|
});
|
|
2114
2372
|
constructor({ connectionManager: e }) {
|
|
@@ -2120,11 +2378,11 @@ class mt {
|
|
|
2120
2378
|
this.stackPromises.stop();
|
|
2121
2379
|
}
|
|
2122
2380
|
}
|
|
2123
|
-
const
|
|
2124
|
-
class
|
|
2125
|
-
countInner =
|
|
2126
|
-
initialCount =
|
|
2127
|
-
limitInner =
|
|
2381
|
+
const J = 0, Dt = 30;
|
|
2382
|
+
class bt {
|
|
2383
|
+
countInner = J;
|
|
2384
|
+
initialCount = J;
|
|
2385
|
+
limitInner = Dt;
|
|
2128
2386
|
isInProgress = !1;
|
|
2129
2387
|
onStatusChange;
|
|
2130
2388
|
constructor({
|
|
@@ -2157,7 +2415,7 @@ class _t {
|
|
|
2157
2415
|
this.countInner = this.initialCount, this.finishAttempt();
|
|
2158
2416
|
}
|
|
2159
2417
|
}
|
|
2160
|
-
class
|
|
2418
|
+
class wt {
|
|
2161
2419
|
connectionManager;
|
|
2162
2420
|
interval;
|
|
2163
2421
|
checkTelephonyByTimeout = void 0;
|
|
@@ -2173,7 +2431,7 @@ class Mt {
|
|
|
2173
2431
|
onSuccessRequest: t,
|
|
2174
2432
|
onFailRequest: s
|
|
2175
2433
|
}) {
|
|
2176
|
-
this.stop(), this.cancelableBeforeRequest = new x(e), this.checkTelephonyByTimeout =
|
|
2434
|
+
this.stop(), this.cancelableBeforeRequest = new x(e), this.checkTelephonyByTimeout = Oe({
|
|
2177
2435
|
isDontStopOnFail: !0,
|
|
2178
2436
|
requestInterval: this.interval,
|
|
2179
2437
|
request: async () => {
|
|
@@ -2193,8 +2451,8 @@ class Mt {
|
|
|
2193
2451
|
this.checkTelephonyByTimeout?.stop(), this.checkTelephonyByTimeout = void 0, this.cancelableBeforeRequest?.cancelRequest(), this.cancelableBeforeRequest = void 0;
|
|
2194
2452
|
}
|
|
2195
2453
|
}
|
|
2196
|
-
var
|
|
2197
|
-
const
|
|
2454
|
+
var I = /* @__PURE__ */ ((n) => (n.BEFORE_ATTEMPT = "before-attempt", n.SUCCESS = "success", n.FAILED_ALL_ATTEMPTS = "failed-all-attempts", n.CANCELLED_ATTEMPTS = "cancelled-attempts", n.CHANGED_ATTEMPT_STATUS = "changed-attempt-status", n.STOP_ATTEMPTS_BY_ERROR = "stop-attempts-by-error", n.LIMIT_REACHED_ATTEMPTS = "limit-reached-attempts", n))(I || {});
|
|
2455
|
+
const Re = [
|
|
2198
2456
|
"before-attempt",
|
|
2199
2457
|
"success",
|
|
2200
2458
|
"failed-all-attempts",
|
|
@@ -2202,15 +2460,15 @@ const Se = [
|
|
|
2202
2460
|
"changed-attempt-status",
|
|
2203
2461
|
"stop-attempts-by-error",
|
|
2204
2462
|
"limit-reached-attempts"
|
|
2205
|
-
],
|
|
2206
|
-
class
|
|
2463
|
+
], Ut = 15e3, Lt = 2;
|
|
2464
|
+
class Bt {
|
|
2207
2465
|
connectionManager;
|
|
2208
2466
|
pingServerByTimeoutWithFailCalls;
|
|
2209
2467
|
constructor({ connectionManager: e }) {
|
|
2210
|
-
this.connectionManager = e, this.pingServerByTimeoutWithFailCalls =
|
|
2468
|
+
this.connectionManager = e, this.pingServerByTimeoutWithFailCalls = ye(Lt, {
|
|
2211
2469
|
whenPossibleRequest: async () => {
|
|
2212
2470
|
},
|
|
2213
|
-
requestInterval:
|
|
2471
|
+
requestInterval: Ut,
|
|
2214
2472
|
request: async () => (h("ping"), this.connectionManager.ping().then(() => {
|
|
2215
2473
|
h("ping success");
|
|
2216
2474
|
}))
|
|
@@ -2223,7 +2481,7 @@ class vt {
|
|
|
2223
2481
|
this.pingServerByTimeoutWithFailCalls.stop();
|
|
2224
2482
|
}
|
|
2225
2483
|
}
|
|
2226
|
-
class
|
|
2484
|
+
class kt {
|
|
2227
2485
|
callManager;
|
|
2228
2486
|
pingServerRequester;
|
|
2229
2487
|
disposeCallStatusChange;
|
|
@@ -2231,7 +2489,7 @@ class Ot {
|
|
|
2231
2489
|
connectionManager: e,
|
|
2232
2490
|
callManager: t
|
|
2233
2491
|
}) {
|
|
2234
|
-
this.callManager = t, this.pingServerRequester = new
|
|
2492
|
+
this.callManager = t, this.pingServerRequester = new Bt({
|
|
2235
2493
|
connectionManager: e
|
|
2236
2494
|
});
|
|
2237
2495
|
}
|
|
@@ -2250,7 +2508,7 @@ class Ot {
|
|
|
2250
2508
|
this.callManager.isCallActive ? this.pingServerRequester.stop() : this.pingServerRequester.start({ onFailRequest: e });
|
|
2251
2509
|
}
|
|
2252
2510
|
}
|
|
2253
|
-
class
|
|
2511
|
+
class Ft {
|
|
2254
2512
|
connectionManager;
|
|
2255
2513
|
callManager;
|
|
2256
2514
|
isRegistrationFailed = !1;
|
|
@@ -2284,12 +2542,12 @@ class Dt {
|
|
|
2284
2542
|
this.isRegistrationFailed = !1;
|
|
2285
2543
|
}
|
|
2286
2544
|
}
|
|
2287
|
-
const
|
|
2545
|
+
const $t = 3e3, qt = 15e3, K = {
|
|
2288
2546
|
LIMIT_REACHED: "Limit reached",
|
|
2289
2547
|
FAILED_TO_RECONNECT: "Failed to reconnect"
|
|
2290
|
-
},
|
|
2291
|
-
},
|
|
2292
|
-
class
|
|
2548
|
+
}, Wt = async () => {
|
|
2549
|
+
}, Ht = (n) => !0;
|
|
2550
|
+
class Gt {
|
|
2293
2551
|
events;
|
|
2294
2552
|
connectionManager;
|
|
2295
2553
|
connectionQueueManager;
|
|
@@ -2308,20 +2566,20 @@ class Lt {
|
|
|
2308
2566
|
connectionManager: t,
|
|
2309
2567
|
callManager: s
|
|
2310
2568
|
}, i) {
|
|
2311
|
-
const r = i?.onBeforeRetry ??
|
|
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(
|
|
2569
|
+
const r = i?.onBeforeRetry ?? Wt, a = i?.canRetryOnError ?? Ht;
|
|
2570
|
+
this.connectionQueueManager = e, this.connectionManager = t, this.onBeforeRetry = r, this.canRetryOnError = a, this.networkInterfacesSubscriber = i?.networkInterfacesSubscriber, this.resumeFromSleepModeSubscriber = i?.resumeFromSleepModeSubscriber, this.events = new O(Re), this.checkTelephonyRequester = new wt({
|
|
2313
2571
|
connectionManager: t,
|
|
2314
|
-
interval: i?.checkTelephonyRequestInterval ??
|
|
2315
|
-
}), this.pingServerIfNotActiveCallRequester = new
|
|
2572
|
+
interval: i?.checkTelephonyRequestInterval ?? qt
|
|
2573
|
+
}), this.pingServerIfNotActiveCallRequester = new kt({
|
|
2316
2574
|
connectionManager: t,
|
|
2317
2575
|
callManager: s
|
|
2318
|
-
}), this.registrationFailedOutOfCallSubscriber = new
|
|
2576
|
+
}), this.registrationFailedOutOfCallSubscriber = new Ft({
|
|
2319
2577
|
connectionManager: t,
|
|
2320
2578
|
callManager: s
|
|
2321
|
-
}), this.attemptsState = new
|
|
2579
|
+
}), this.attemptsState = new bt({
|
|
2322
2580
|
onStatusChange: this.emitStatusChange
|
|
2323
|
-
}), this.cancelableRequestBeforeRetry = new x(r), this.delayBetweenAttempts = new
|
|
2324
|
-
i?.timeoutBetweenAttempts ??
|
|
2581
|
+
}), this.cancelableRequestBeforeRetry = new x(r), this.delayBetweenAttempts = new De(
|
|
2582
|
+
i?.timeoutBetweenAttempts ?? $t
|
|
2325
2583
|
);
|
|
2326
2584
|
}
|
|
2327
2585
|
start(e) {
|
|
@@ -2373,7 +2631,7 @@ class Lt {
|
|
|
2373
2631
|
});
|
|
2374
2632
|
}
|
|
2375
2633
|
async attemptConnection(e) {
|
|
2376
|
-
if (h("attemptConnection: attempts.count", this.attemptsState.count), this.events.trigger(
|
|
2634
|
+
if (h("attemptConnection: attempts.count", this.attemptsState.count), this.events.trigger(I.BEFORE_ATTEMPT, {}), this.stopConnectTriggers(), this.attemptsState.hasLimitReached()) {
|
|
2377
2635
|
h("attemptConnection: limit reached"), this.handleLimitReached(e);
|
|
2378
2636
|
return;
|
|
2379
2637
|
}
|
|
@@ -2387,25 +2645,25 @@ class Lt {
|
|
|
2387
2645
|
}
|
|
2388
2646
|
}
|
|
2389
2647
|
handleConnectionError(e, t) {
|
|
2390
|
-
if (
|
|
2391
|
-
this.attemptsState.finishAttempt(), this.events.trigger(
|
|
2648
|
+
if (ft(e)) {
|
|
2649
|
+
this.attemptsState.finishAttempt(), this.events.trigger(I.STOP_ATTEMPTS_BY_ERROR, e);
|
|
2392
2650
|
return;
|
|
2393
2651
|
}
|
|
2394
2652
|
if (!this.canRetryOnError(e)) {
|
|
2395
|
-
h("executeConnectionAttempt: error does not allow retry", e), this.attemptsState.finishAttempt(), this.events.trigger(
|
|
2653
|
+
h("executeConnectionAttempt: error does not allow retry", e), this.attemptsState.finishAttempt(), this.events.trigger(I.STOP_ATTEMPTS_BY_ERROR, e);
|
|
2396
2654
|
return;
|
|
2397
2655
|
}
|
|
2398
|
-
if (
|
|
2399
|
-
h("executeConnectionAttempt: not actual error", e), this.attemptsState.finishAttempt(), this.events.trigger(
|
|
2656
|
+
if (Be(e)) {
|
|
2657
|
+
h("executeConnectionAttempt: not actual error", e), this.attemptsState.finishAttempt(), this.events.trigger(I.CANCELLED_ATTEMPTS, e);
|
|
2400
2658
|
return;
|
|
2401
2659
|
}
|
|
2402
2660
|
h("executeConnectionAttempt: error", e), this.scheduleReconnect(t);
|
|
2403
2661
|
}
|
|
2404
2662
|
handleLimitReached(e) {
|
|
2405
|
-
this.attemptsState.finishAttempt(), this.events.trigger(
|
|
2663
|
+
this.attemptsState.finishAttempt(), this.events.trigger(I.LIMIT_REACHED_ATTEMPTS, new Error(K.LIMIT_REACHED)), this.startCheckTelephony(e);
|
|
2406
2664
|
}
|
|
2407
2665
|
handleSucceededAttempt(e) {
|
|
2408
|
-
h("handleSucceededAttempt"), this.subscribeToConnectTriggers(e), this.events.trigger(
|
|
2666
|
+
h("handleSucceededAttempt"), this.subscribeToConnectTriggers(e), this.events.trigger(I.SUCCESS);
|
|
2409
2667
|
}
|
|
2410
2668
|
subscribeToConnectTriggers(e) {
|
|
2411
2669
|
this.startPingRequester(e), this.registrationFailedOutOfCallSubscriber.subscribe(() => {
|
|
@@ -2446,12 +2704,12 @@ class Lt {
|
|
|
2446
2704
|
}
|
|
2447
2705
|
connectIfDisconnected(e) {
|
|
2448
2706
|
const t = this.isConnectionUnavailable();
|
|
2449
|
-
h("connectIfDisconnected: isUnavailable", t), t ? this.restartConnectionAttempts(e) : (this.stopConnectTriggers(), this.events.trigger(
|
|
2707
|
+
h("connectIfDisconnected: isUnavailable", t), t ? this.restartConnectionAttempts(e) : (this.stopConnectTriggers(), this.events.trigger(I.SUCCESS));
|
|
2450
2708
|
}
|
|
2451
2709
|
scheduleReconnect(e) {
|
|
2452
2710
|
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) => {
|
|
2453
|
-
const s = t instanceof Error ? t : new Error(
|
|
2454
|
-
this.attemptsState.finishAttempt(),
|
|
2711
|
+
const s = t instanceof Error ? t : new Error(K.FAILED_TO_RECONNECT);
|
|
2712
|
+
this.attemptsState.finishAttempt(), Pe(t) || be(t) ? this.events.trigger(I.CANCELLED_ATTEMPTS, s) : this.events.trigger(I.FAILED_ALL_ATTEMPTS, s), h("scheduleReconnect: error", t);
|
|
2455
2713
|
});
|
|
2456
2714
|
}
|
|
2457
2715
|
isConnectionUnavailable() {
|
|
@@ -2459,22 +2717,22 @@ class Lt {
|
|
|
2459
2717
|
return e || t || s;
|
|
2460
2718
|
}
|
|
2461
2719
|
emitStatusChange = ({ isInProgress: e }) => {
|
|
2462
|
-
this.events.trigger(
|
|
2720
|
+
this.events.trigger(I.CHANGED_ATTEMPT_STATUS, { isInProgress: e });
|
|
2463
2721
|
};
|
|
2464
2722
|
}
|
|
2465
|
-
var
|
|
2466
|
-
const
|
|
2723
|
+
var U = /* @__PURE__ */ ((n) => (n.INCOMING_CALL = "incomingCall", n.DECLINED_INCOMING_CALL = "declinedIncomingCall", n.TERMINATED_INCOMING_CALL = "terminatedIncomingCall", n.FAILED_INCOMING_CALL = "failedIncomingCall", n))(U || {});
|
|
2724
|
+
const Ae = [
|
|
2467
2725
|
"incomingCall",
|
|
2468
2726
|
"declinedIncomingCall",
|
|
2469
2727
|
"terminatedIncomingCall",
|
|
2470
2728
|
"failedIncomingCall"
|
|
2471
|
-
],
|
|
2472
|
-
class
|
|
2729
|
+
], Vt = 486, xt = 487;
|
|
2730
|
+
class Qt {
|
|
2473
2731
|
events;
|
|
2474
2732
|
incomingRTCSession;
|
|
2475
2733
|
connectionManager;
|
|
2476
2734
|
constructor(e) {
|
|
2477
|
-
this.connectionManager = e, this.events = new O(
|
|
2735
|
+
this.connectionManager = e, this.events = new O(Ae), this.start();
|
|
2478
2736
|
}
|
|
2479
2737
|
get remoteCallerData() {
|
|
2480
2738
|
return {
|
|
@@ -2504,19 +2762,19 @@ class kt {
|
|
|
2504
2762
|
return this.removeIncomingSession(), e;
|
|
2505
2763
|
};
|
|
2506
2764
|
async declineToIncomingCall({
|
|
2507
|
-
statusCode: e =
|
|
2765
|
+
statusCode: e = xt
|
|
2508
2766
|
} = {}) {
|
|
2509
2767
|
return new Promise((t, s) => {
|
|
2510
2768
|
try {
|
|
2511
2769
|
const i = this.getIncomingRTCSession(), r = this.remoteCallerData;
|
|
2512
|
-
this.removeIncomingSession(), this.events.trigger(
|
|
2770
|
+
this.removeIncomingSession(), this.events.trigger(U.DECLINED_INCOMING_CALL, r), i.terminate({ status_code: e }), t();
|
|
2513
2771
|
} catch (i) {
|
|
2514
2772
|
s(i);
|
|
2515
2773
|
}
|
|
2516
2774
|
});
|
|
2517
2775
|
}
|
|
2518
2776
|
async busyIncomingCall() {
|
|
2519
|
-
return this.declineToIncomingCall({ statusCode:
|
|
2777
|
+
return this.declineToIncomingCall({ statusCode: Vt });
|
|
2520
2778
|
}
|
|
2521
2779
|
on(e, t) {
|
|
2522
2780
|
return this.events.on(e, t);
|
|
@@ -2549,19 +2807,49 @@ class kt {
|
|
|
2549
2807
|
this.incomingRTCSession = e;
|
|
2550
2808
|
const t = this.remoteCallerData;
|
|
2551
2809
|
e.on("failed", (s) => {
|
|
2552
|
-
this.removeIncomingSession(), s.originator === "local" ? this.events.trigger(
|
|
2553
|
-
}), this.events.trigger(
|
|
2810
|
+
this.removeIncomingSession(), s.originator === "local" ? this.events.trigger(U.TERMINATED_INCOMING_CALL, t) : this.events.trigger(U.FAILED_INCOMING_CALL, t);
|
|
2811
|
+
}), this.events.trigger(U.INCOMING_CALL, t);
|
|
2554
2812
|
}
|
|
2555
2813
|
removeIncomingSession() {
|
|
2556
2814
|
delete this.incomingRTCSession;
|
|
2557
2815
|
}
|
|
2558
2816
|
}
|
|
2559
|
-
const
|
|
2560
|
-
var
|
|
2561
|
-
const
|
|
2817
|
+
const w = 1e3;
|
|
2818
|
+
var E = /* @__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))(E || {});
|
|
2819
|
+
const Ne = ["collected"], Yt = "api/v2/rtp2webrtc/offer", zt = async ({
|
|
2820
|
+
serverUrl: n,
|
|
2821
|
+
conferenceNumber: e,
|
|
2822
|
+
quality: t,
|
|
2823
|
+
audio: s,
|
|
2824
|
+
offer: i
|
|
2825
|
+
}) => {
|
|
2826
|
+
const r = new URL(
|
|
2827
|
+
`https://${n.replace(/\/$/, "")}/${Yt}/${encodeURIComponent(e)}`
|
|
2828
|
+
);
|
|
2829
|
+
r.searchParams.set("quality", t), r.searchParams.set("audio", String(s));
|
|
2830
|
+
const a = await fetch(r.toString(), {
|
|
2831
|
+
method: "POST",
|
|
2832
|
+
headers: {
|
|
2833
|
+
"Content-Type": "application/json"
|
|
2834
|
+
},
|
|
2835
|
+
referrerPolicy: "no-referrer",
|
|
2836
|
+
credentials: "same-origin",
|
|
2837
|
+
body: JSON.stringify(i)
|
|
2838
|
+
});
|
|
2839
|
+
if (!a.ok)
|
|
2840
|
+
throw new Error(`sendOffer failed with status ${a.status}`);
|
|
2841
|
+
const o = await a.json();
|
|
2842
|
+
return {
|
|
2843
|
+
type: o.type,
|
|
2844
|
+
sdp: o.sdp,
|
|
2845
|
+
toJSON() {
|
|
2846
|
+
return o;
|
|
2847
|
+
}
|
|
2848
|
+
};
|
|
2849
|
+
}, j = () => "performance" in window ? performance.now() : Date.now(), L = (n) => [...n.keys()].reduce((e, t) => {
|
|
2562
2850
|
const s = n.get(t);
|
|
2563
2851
|
return s === void 0 ? e : { ...e, [s.type]: s };
|
|
2564
|
-
}, {}),
|
|
2852
|
+
}, {}), Xt = (n) => {
|
|
2565
2853
|
if (!n)
|
|
2566
2854
|
return {
|
|
2567
2855
|
outboundRtp: void 0,
|
|
@@ -2569,14 +2857,14 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2569
2857
|
mediaSource: void 0,
|
|
2570
2858
|
remoteInboundRtp: void 0
|
|
2571
2859
|
};
|
|
2572
|
-
const e =
|
|
2860
|
+
const e = L(n);
|
|
2573
2861
|
return {
|
|
2574
|
-
outboundRtp: e[
|
|
2575
|
-
codec: e[
|
|
2576
|
-
mediaSource: e[
|
|
2577
|
-
remoteInboundRtp: e[
|
|
2862
|
+
outboundRtp: e[E.OUTBOUND_RTP],
|
|
2863
|
+
codec: e[E.CODEC],
|
|
2864
|
+
mediaSource: e[E.MEDIA_SOURCE],
|
|
2865
|
+
remoteInboundRtp: e[E.REMOTE_INBOUND_RTP]
|
|
2578
2866
|
};
|
|
2579
|
-
},
|
|
2867
|
+
}, Z = (n) => {
|
|
2580
2868
|
if (!n)
|
|
2581
2869
|
return {
|
|
2582
2870
|
outboundRtp: void 0,
|
|
@@ -2584,14 +2872,14 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2584
2872
|
mediaSource: void 0,
|
|
2585
2873
|
remoteInboundRtp: void 0
|
|
2586
2874
|
};
|
|
2587
|
-
const e =
|
|
2875
|
+
const e = L(n);
|
|
2588
2876
|
return {
|
|
2589
|
-
outboundRtp: e[
|
|
2590
|
-
codec: e[
|
|
2591
|
-
mediaSource: e[
|
|
2592
|
-
remoteInboundRtp: e[
|
|
2877
|
+
outboundRtp: e[E.OUTBOUND_RTP],
|
|
2878
|
+
codec: e[E.CODEC],
|
|
2879
|
+
mediaSource: e[E.MEDIA_SOURCE],
|
|
2880
|
+
remoteInboundRtp: e[E.REMOTE_INBOUND_RTP]
|
|
2593
2881
|
};
|
|
2594
|
-
},
|
|
2882
|
+
}, ee = ({
|
|
2595
2883
|
videoReceiversStats: n,
|
|
2596
2884
|
synchronizationSourcesVideo: e
|
|
2597
2885
|
}) => {
|
|
@@ -2601,13 +2889,13 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2601
2889
|
codec: void 0,
|
|
2602
2890
|
synchronizationSources: e
|
|
2603
2891
|
};
|
|
2604
|
-
const t =
|
|
2892
|
+
const t = L(n);
|
|
2605
2893
|
return {
|
|
2606
|
-
inboundRtp: t[
|
|
2607
|
-
codec: t[
|
|
2894
|
+
inboundRtp: t[E.INBOUND_RTP],
|
|
2895
|
+
codec: t[E.CODEC],
|
|
2608
2896
|
synchronizationSources: e
|
|
2609
2897
|
};
|
|
2610
|
-
},
|
|
2898
|
+
}, Jt = ({
|
|
2611
2899
|
audioReceiverStats: n,
|
|
2612
2900
|
synchronizationSourcesAudio: e
|
|
2613
2901
|
}) => {
|
|
@@ -2618,14 +2906,14 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2618
2906
|
remoteOutboundRtp: void 0,
|
|
2619
2907
|
synchronizationSources: e
|
|
2620
2908
|
};
|
|
2621
|
-
const t =
|
|
2909
|
+
const t = L(n);
|
|
2622
2910
|
return {
|
|
2623
|
-
inboundRtp: t[
|
|
2624
|
-
codec: t[
|
|
2625
|
-
remoteOutboundRtp: t[
|
|
2911
|
+
inboundRtp: t[E.INBOUND_RTP],
|
|
2912
|
+
codec: t[E.CODEC],
|
|
2913
|
+
remoteOutboundRtp: t[E.REMOTE_OUTBOUND_RTP],
|
|
2626
2914
|
synchronizationSources: e
|
|
2627
2915
|
};
|
|
2628
|
-
},
|
|
2916
|
+
}, me = (n) => {
|
|
2629
2917
|
if (!n)
|
|
2630
2918
|
return {
|
|
2631
2919
|
candidatePair: void 0,
|
|
@@ -2634,47 +2922,47 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2634
2922
|
remoteCandidate: void 0,
|
|
2635
2923
|
transport: void 0
|
|
2636
2924
|
};
|
|
2637
|
-
const e =
|
|
2925
|
+
const e = L(n);
|
|
2638
2926
|
return {
|
|
2639
|
-
candidatePair: e[
|
|
2640
|
-
certificate: e[
|
|
2641
|
-
localCandidate: e[
|
|
2642
|
-
remoteCandidate: e[
|
|
2643
|
-
transport: e[
|
|
2927
|
+
candidatePair: e[E.CANDIDATE_PAIR],
|
|
2928
|
+
certificate: e[E.CERTIFICATE],
|
|
2929
|
+
localCandidate: e[E.LOCAL_CANDIDATE],
|
|
2930
|
+
remoteCandidate: e[E.REMOTE_CANDIDATE],
|
|
2931
|
+
transport: e[E.TRANSPORT]
|
|
2644
2932
|
};
|
|
2645
|
-
},
|
|
2933
|
+
}, Kt = ({
|
|
2646
2934
|
audioSenderStats: n,
|
|
2647
2935
|
videoSenderFirstStats: e,
|
|
2648
2936
|
videoSenderSecondStats: t
|
|
2649
2937
|
}) => ({
|
|
2650
|
-
video:
|
|
2651
|
-
secondVideo:
|
|
2652
|
-
audio:
|
|
2653
|
-
additional:
|
|
2938
|
+
video: Z(e),
|
|
2939
|
+
secondVideo: Z(t),
|
|
2940
|
+
audio: Xt(n),
|
|
2941
|
+
additional: me(
|
|
2654
2942
|
n ?? e ?? t
|
|
2655
2943
|
)
|
|
2656
|
-
}),
|
|
2944
|
+
}), jt = ({
|
|
2657
2945
|
audioReceiverStats: n,
|
|
2658
2946
|
videoReceiverFirstStats: e,
|
|
2659
2947
|
videoReceiverSecondStats: t,
|
|
2660
2948
|
synchronizationSources: s
|
|
2661
2949
|
}) => ({
|
|
2662
|
-
video:
|
|
2950
|
+
video: ee({
|
|
2663
2951
|
videoReceiversStats: e,
|
|
2664
2952
|
synchronizationSourcesVideo: s.video
|
|
2665
2953
|
}),
|
|
2666
|
-
secondVideo:
|
|
2954
|
+
secondVideo: ee({
|
|
2667
2955
|
videoReceiversStats: t,
|
|
2668
2956
|
synchronizationSourcesVideo: s.video
|
|
2669
2957
|
}),
|
|
2670
|
-
audio:
|
|
2958
|
+
audio: Jt({
|
|
2671
2959
|
audioReceiverStats: n,
|
|
2672
2960
|
synchronizationSourcesAudio: s.audio
|
|
2673
2961
|
}),
|
|
2674
|
-
additional:
|
|
2962
|
+
additional: me(
|
|
2675
2963
|
n ?? e ?? t
|
|
2676
2964
|
)
|
|
2677
|
-
}),
|
|
2965
|
+
}), Zt = ({
|
|
2678
2966
|
audioSenderStats: n,
|
|
2679
2967
|
videoSenderFirstStats: e,
|
|
2680
2968
|
videoSenderSecondStats: t,
|
|
@@ -2683,11 +2971,11 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2683
2971
|
videoReceiverSecondStats: r,
|
|
2684
2972
|
synchronizationSources: a
|
|
2685
2973
|
}) => {
|
|
2686
|
-
const o =
|
|
2974
|
+
const o = Kt({
|
|
2687
2975
|
audioSenderStats: n,
|
|
2688
2976
|
videoSenderFirstStats: e,
|
|
2689
2977
|
videoSenderSecondStats: t
|
|
2690
|
-
}), c =
|
|
2978
|
+
}), c = jt({
|
|
2691
2979
|
audioReceiverStats: s,
|
|
2692
2980
|
videoReceiverFirstStats: i,
|
|
2693
2981
|
videoReceiverSecondStats: r,
|
|
@@ -2697,16 +2985,16 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2697
2985
|
outbound: o,
|
|
2698
2986
|
inbound: c
|
|
2699
2987
|
};
|
|
2700
|
-
},
|
|
2701
|
-
const e = "audio", t = "video", s = n.getSenders(), i = s.find((
|
|
2988
|
+
}, en = async (n) => {
|
|
2989
|
+
const e = "audio", t = "video", s = n.getSenders(), i = s.find((T) => T.track?.kind === e), r = s.filter((T) => T.track?.kind === t), a = n.getReceivers(), o = a.find((T) => T.track.kind === e), c = a.filter((T) => T.track.kind === t), d = {
|
|
2702
2990
|
trackIdentifier: o?.track.id,
|
|
2703
2991
|
item: o?.getSynchronizationSources()[0]
|
|
2704
|
-
},
|
|
2992
|
+
}, S = {
|
|
2705
2993
|
trackIdentifier: c[0]?.track.id,
|
|
2706
2994
|
item: c[0]?.getSynchronizationSources()[0]
|
|
2707
|
-
},
|
|
2995
|
+
}, g = {
|
|
2708
2996
|
audio: d,
|
|
2709
|
-
video:
|
|
2997
|
+
video: S
|
|
2710
2998
|
};
|
|
2711
2999
|
return Promise.all([
|
|
2712
3000
|
i?.getStats() ?? Promise.resolve(void 0),
|
|
@@ -2715,41 +3003,41 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2715
3003
|
o?.getStats() ?? Promise.resolve(void 0),
|
|
2716
3004
|
c[0]?.getStats() ?? Promise.resolve(void 0),
|
|
2717
3005
|
c[1]?.getStats() ?? Promise.resolve(void 0)
|
|
2718
|
-
]).then((
|
|
3006
|
+
]).then((T) => {
|
|
2719
3007
|
const [
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
3008
|
+
p,
|
|
3009
|
+
v,
|
|
3010
|
+
A,
|
|
3011
|
+
D,
|
|
2724
3012
|
F,
|
|
2725
|
-
|
|
2726
|
-
] =
|
|
3013
|
+
ve
|
|
3014
|
+
] = T;
|
|
2727
3015
|
return {
|
|
2728
|
-
synchronizationSources:
|
|
2729
|
-
audioSenderStats:
|
|
2730
|
-
videoSenderFirstStats:
|
|
2731
|
-
videoSenderSecondStats:
|
|
2732
|
-
audioReceiverStats:
|
|
3016
|
+
synchronizationSources: g,
|
|
3017
|
+
audioSenderStats: p,
|
|
3018
|
+
videoSenderFirstStats: v,
|
|
3019
|
+
videoSenderSecondStats: A,
|
|
3020
|
+
audioReceiverStats: D,
|
|
2733
3021
|
videoReceiverFirstStats: F,
|
|
2734
|
-
videoReceiverSecondStats:
|
|
3022
|
+
videoReceiverSecondStats: ve
|
|
2735
3023
|
};
|
|
2736
3024
|
});
|
|
2737
|
-
},
|
|
3025
|
+
}, tn = (n) => {
|
|
2738
3026
|
h(String(n));
|
|
2739
3027
|
};
|
|
2740
|
-
class
|
|
3028
|
+
class nn {
|
|
2741
3029
|
events;
|
|
2742
3030
|
setTimeoutRequest;
|
|
2743
|
-
requesterAllStatistics = new x(
|
|
3031
|
+
requesterAllStatistics = new x(en);
|
|
2744
3032
|
constructor() {
|
|
2745
|
-
this.events = new O(
|
|
3033
|
+
this.events = new O(Ne), this.setTimeoutRequest = new ne();
|
|
2746
3034
|
}
|
|
2747
3035
|
get requested() {
|
|
2748
3036
|
return this.setTimeoutRequest.requested;
|
|
2749
3037
|
}
|
|
2750
3038
|
start(e, {
|
|
2751
|
-
interval: t =
|
|
2752
|
-
onError: s =
|
|
3039
|
+
interval: t = w,
|
|
3040
|
+
onError: s = tn
|
|
2753
3041
|
} = {}) {
|
|
2754
3042
|
this.stop(), this.setTimeoutRequest.request(() => {
|
|
2755
3043
|
this.collectStatistics(e, {
|
|
@@ -2778,12 +3066,12 @@ class Qt {
|
|
|
2778
3066
|
collectStatistics = (e, {
|
|
2779
3067
|
onError: t
|
|
2780
3068
|
}) => {
|
|
2781
|
-
const s =
|
|
3069
|
+
const s = j();
|
|
2782
3070
|
this.requesterAllStatistics.request(e).then((i) => {
|
|
2783
|
-
this.events.trigger("collected",
|
|
2784
|
-
const a =
|
|
2785
|
-
let o =
|
|
2786
|
-
a > 48 ? o =
|
|
3071
|
+
this.events.trigger("collected", Zt(i));
|
|
3072
|
+
const a = j() - s;
|
|
3073
|
+
let o = w;
|
|
3074
|
+
a > 48 ? o = w * 4 : a > 32 ? o = w * 3 : a > 16 && (o = w * 2), this.start(e, {
|
|
2787
3075
|
onError: t,
|
|
2788
3076
|
interval: o
|
|
2789
3077
|
});
|
|
@@ -2792,7 +3080,7 @@ class Qt {
|
|
|
2792
3080
|
});
|
|
2793
3081
|
};
|
|
2794
3082
|
}
|
|
2795
|
-
class
|
|
3083
|
+
class sn {
|
|
2796
3084
|
availableIncomingBitrate;
|
|
2797
3085
|
statsPeerConnection;
|
|
2798
3086
|
callManager;
|
|
@@ -2802,7 +3090,7 @@ class Yt {
|
|
|
2802
3090
|
callManager: e,
|
|
2803
3091
|
apiManager: t
|
|
2804
3092
|
}) {
|
|
2805
|
-
this.callManager = e, this.apiManager = t, this.statsPeerConnection = new
|
|
3093
|
+
this.callManager = e, this.apiManager = t, this.statsPeerConnection = new nn(), this.subscribe();
|
|
2806
3094
|
}
|
|
2807
3095
|
get events() {
|
|
2808
3096
|
return this.statsPeerConnection.events;
|
|
@@ -2844,33 +3132,33 @@ class Yt {
|
|
|
2844
3132
|
});
|
|
2845
3133
|
}
|
|
2846
3134
|
}
|
|
2847
|
-
const
|
|
3135
|
+
const rn = (n, e) => n.filter((s) => e.some((i) => i.clockRate === s.clockRate && i.mimeType === s.mimeType && i.channels === s.channels && i.sdpFmtpLine === s.sdpFmtpLine)), an = (n) => {
|
|
2848
3136
|
const e = RTCRtpSender.getCapabilities(n), t = RTCRtpReceiver.getCapabilities(n), s = e === null ? [] : e.codecs, i = t === null ? [] : t.codecs;
|
|
2849
|
-
return
|
|
2850
|
-
},
|
|
3137
|
+
return rn(s, i);
|
|
3138
|
+
}, on = (n, e) => e === void 0 || e.length === 0 ? n : n.sort((t, s) => {
|
|
2851
3139
|
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;
|
|
2852
3140
|
return a - o;
|
|
2853
|
-
}),
|
|
3141
|
+
}), cn = (n, e) => e === void 0 || e.length === 0 ? n : n.filter((t) => !e.includes(t.mimeType)), hn = (n, {
|
|
2854
3142
|
preferredMimeTypesVideoCodecs: e,
|
|
2855
3143
|
excludeMimeTypesVideoCodecs: t
|
|
2856
3144
|
}) => {
|
|
2857
3145
|
try {
|
|
2858
3146
|
if (typeof n.setCodecPreferences == "function" && n.sender.track?.kind === "video" && (e !== void 0 && e.length > 0 || t !== void 0 && t.length > 0)) {
|
|
2859
|
-
const s =
|
|
3147
|
+
const s = an("video"), i = cn(s, t), r = on(i, e);
|
|
2860
3148
|
n.setCodecPreferences(r);
|
|
2861
3149
|
}
|
|
2862
3150
|
} catch (s) {
|
|
2863
3151
|
h("setCodecPreferences error", s);
|
|
2864
3152
|
}
|
|
2865
|
-
},
|
|
2866
|
-
class
|
|
3153
|
+
}, dn = (n) => [...n.keys()].map((e) => n.get(e)), ln = (n, e) => dn(n).find((t) => t?.type === e), un = async (n) => n.getStats().then((e) => ln(e, "codec")?.mimeType);
|
|
3154
|
+
class gn {
|
|
2867
3155
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
2868
3156
|
async getCodecFromSender(e) {
|
|
2869
|
-
return await
|
|
3157
|
+
return await un(e) ?? "";
|
|
2870
3158
|
}
|
|
2871
3159
|
}
|
|
2872
|
-
class
|
|
2873
|
-
stackPromises =
|
|
3160
|
+
class Tn {
|
|
3161
|
+
stackPromises = ie({
|
|
2874
3162
|
noRunIsNotActual: !0
|
|
2875
3163
|
});
|
|
2876
3164
|
/**
|
|
@@ -2894,30 +3182,30 @@ class sn {
|
|
|
2894
3182
|
});
|
|
2895
3183
|
}
|
|
2896
3184
|
}
|
|
2897
|
-
class
|
|
3185
|
+
class Sn {
|
|
2898
3186
|
taskQueue;
|
|
2899
3187
|
onSetParameters;
|
|
2900
3188
|
constructor(e) {
|
|
2901
|
-
this.onSetParameters = e, this.taskQueue = new
|
|
3189
|
+
this.onSetParameters = e, this.taskQueue = new Tn();
|
|
2902
3190
|
}
|
|
2903
3191
|
async setEncodingsToSender(e, t) {
|
|
2904
|
-
return this.taskQueue.add(async () =>
|
|
3192
|
+
return this.taskQueue.add(async () => ue(e, t, this.onSetParameters));
|
|
2905
3193
|
}
|
|
2906
3194
|
stop() {
|
|
2907
3195
|
this.taskQueue.stop();
|
|
2908
3196
|
}
|
|
2909
3197
|
}
|
|
2910
|
-
const
|
|
2911
|
-
const t =
|
|
2912
|
-
return
|
|
2913
|
-
},
|
|
3198
|
+
const Ie = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), Cn = 1e6, _ = (n) => n * Cn, _e = _(0.06), Me = _(4), En = (n) => n <= 64 ? _e : n <= 128 ? _(0.12) : n <= 256 ? _(0.25) : n <= 384 ? _(0.32) : n <= 426 ? _(0.38) : n <= 640 ? _(0.5) : n <= 848 ? _(0.7) : n <= 1280 ? _(1) : n <= 1920 ? _(2) : Me, pn = "av1", Rn = (n) => Ie(n, pn), An = 0.6, Y = (n, e) => Rn(e) ? n * An : n, Nn = (n) => Y(_e, n), mn = (n) => Y(Me, n), te = (n, e) => {
|
|
3199
|
+
const t = En(n);
|
|
3200
|
+
return Y(t, e);
|
|
3201
|
+
}, q = 1, In = ({
|
|
2914
3202
|
videoTrack: n,
|
|
2915
3203
|
targetSize: e
|
|
2916
3204
|
}) => {
|
|
2917
|
-
const t = n.getSettings(), s = t.width, i = t.height, r = s === void 0 ?
|
|
2918
|
-
return Math.max(r, a,
|
|
3205
|
+
const t = n.getSettings(), s = t.width, i = t.height, r = s === void 0 ? q : s / e.width, a = i === void 0 ? q : i / e.height;
|
|
3206
|
+
return Math.max(r, a, q);
|
|
2919
3207
|
};
|
|
2920
|
-
class
|
|
3208
|
+
class _n {
|
|
2921
3209
|
ignoreForCodec;
|
|
2922
3210
|
senderFinder;
|
|
2923
3211
|
codecProvider;
|
|
@@ -2950,7 +3238,7 @@ class Tn {
|
|
|
2950
3238
|
if (!i?.track)
|
|
2951
3239
|
return { ...this.resultNoChanged, sender: i };
|
|
2952
3240
|
const r = await this.codecProvider.getCodecFromSender(i);
|
|
2953
|
-
if (
|
|
3241
|
+
if (Ie(r, this.ignoreForCodec))
|
|
2954
3242
|
return { ...this.resultNoChanged, sender: i };
|
|
2955
3243
|
const { mainCam: a, resolutionMainCam: o } = t ?? {};
|
|
2956
3244
|
return this.processSender(
|
|
@@ -2970,14 +3258,14 @@ class Tn {
|
|
|
2970
3258
|
async processSender(e, t) {
|
|
2971
3259
|
const { mainCam: s, resolutionMainCam: i } = e;
|
|
2972
3260
|
switch (s) {
|
|
2973
|
-
case
|
|
3261
|
+
case M.PAUSE_MAIN_CAM:
|
|
2974
3262
|
return this.downgradeResolutionSender(t);
|
|
2975
|
-
case
|
|
3263
|
+
case M.RESUME_MAIN_CAM:
|
|
2976
3264
|
return this.setBitrateByTrackResolution(t);
|
|
2977
|
-
case
|
|
3265
|
+
case M.MAX_MAIN_CAM_RESOLUTION:
|
|
2978
3266
|
return i !== void 0 ? this.setResolutionSender(i, t) : this.setBitrateByTrackResolution(t);
|
|
2979
|
-
case
|
|
2980
|
-
case
|
|
3267
|
+
case M.ADMIN_STOP_MAIN_CAM:
|
|
3268
|
+
case M.ADMIN_START_MAIN_CAM:
|
|
2981
3269
|
case void 0:
|
|
2982
3270
|
return this.setBitrateByTrackResolution(t);
|
|
2983
3271
|
default:
|
|
@@ -2992,7 +3280,7 @@ class Tn {
|
|
|
2992
3280
|
async downgradeResolutionSender(e) {
|
|
2993
3281
|
const { sender: t, codec: s } = e, i = {
|
|
2994
3282
|
scaleResolutionDownBy: 200,
|
|
2995
|
-
maxBitrate:
|
|
3283
|
+
maxBitrate: Nn(s)
|
|
2996
3284
|
};
|
|
2997
3285
|
return this.parametersSetter.setEncodingsToSender(t, i);
|
|
2998
3286
|
}
|
|
@@ -3002,7 +3290,7 @@ class Tn {
|
|
|
3002
3290
|
* @returns Promise с результатом
|
|
3003
3291
|
*/
|
|
3004
3292
|
async setBitrateByTrackResolution(e) {
|
|
3005
|
-
const { sender: t, videoTrack: s, codec: i } = e, a = s.getSettings().width, o = a === void 0 ?
|
|
3293
|
+
const { sender: t, videoTrack: s, codec: i } = e, a = s.getSettings().width, o = a === void 0 ? mn(i) : te(a, i);
|
|
3006
3294
|
return this.parametersSetter.setEncodingsToSender(t, {
|
|
3007
3295
|
scaleResolutionDownBy: 1,
|
|
3008
3296
|
maxBitrate: o
|
|
@@ -3018,24 +3306,24 @@ class Tn {
|
|
|
3018
3306
|
const [s, i] = e.split("x"), { sender: r, videoTrack: a, codec: o } = t, c = {
|
|
3019
3307
|
width: Number(s),
|
|
3020
3308
|
height: Number(i)
|
|
3021
|
-
}, d =
|
|
3309
|
+
}, d = In({
|
|
3022
3310
|
videoTrack: a,
|
|
3023
3311
|
targetSize: c
|
|
3024
|
-
}),
|
|
3312
|
+
}), S = te(c.width, o), g = {
|
|
3025
3313
|
scaleResolutionDownBy: d,
|
|
3026
|
-
maxBitrate:
|
|
3314
|
+
maxBitrate: S
|
|
3027
3315
|
};
|
|
3028
|
-
return this.parametersSetter.setEncodingsToSender(r,
|
|
3316
|
+
return this.parametersSetter.setEncodingsToSender(r, g);
|
|
3029
3317
|
}
|
|
3030
3318
|
}
|
|
3031
|
-
const
|
|
3032
|
-
class
|
|
3319
|
+
const Mn = (n) => n.find((e) => e.track?.kind === "video");
|
|
3320
|
+
class fn {
|
|
3033
3321
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
3034
3322
|
findVideoSender(e) {
|
|
3035
|
-
return
|
|
3323
|
+
return Mn(e);
|
|
3036
3324
|
}
|
|
3037
3325
|
}
|
|
3038
|
-
class
|
|
3326
|
+
class vn {
|
|
3039
3327
|
currentSender;
|
|
3040
3328
|
originalReplaceTrack;
|
|
3041
3329
|
lastWidth;
|
|
@@ -3048,7 +3336,7 @@ class En {
|
|
|
3048
3336
|
pollIntervalMs: e = 1e3,
|
|
3049
3337
|
maxPollIntervalMs: t
|
|
3050
3338
|
}) {
|
|
3051
|
-
this.pollIntervalMs = e, this.maxPollIntervalMs = t ?? e * 16, this.currentPollIntervalMs = this.pollIntervalMs, this.setTimeoutRequest = new
|
|
3339
|
+
this.pollIntervalMs = e, this.maxPollIntervalMs = t ?? e * 16, this.currentPollIntervalMs = this.pollIntervalMs, this.setTimeoutRequest = new ne();
|
|
3052
3340
|
}
|
|
3053
3341
|
/**
|
|
3054
3342
|
* Проверяет актуальный video-sender и (при необходимости) перенастраивает наблюдение.
|
|
@@ -3099,7 +3387,7 @@ class En {
|
|
|
3099
3387
|
this.setTimeoutRequest.cancelRequest(), this.lastWidth = void 0, this.lastHeight = void 0;
|
|
3100
3388
|
}
|
|
3101
3389
|
}
|
|
3102
|
-
class
|
|
3390
|
+
class Pn {
|
|
3103
3391
|
apiManager;
|
|
3104
3392
|
currentHandler;
|
|
3105
3393
|
constructor(e) {
|
|
@@ -3119,7 +3407,7 @@ class An {
|
|
|
3119
3407
|
this.currentHandler && (this.apiManager.off("main-cam-control", this.currentHandler), this.currentHandler = void 0);
|
|
3120
3408
|
}
|
|
3121
3409
|
}
|
|
3122
|
-
class
|
|
3410
|
+
class On {
|
|
3123
3411
|
eventHandler;
|
|
3124
3412
|
senderBalancer;
|
|
3125
3413
|
parametersSetterWithQueue;
|
|
@@ -3131,16 +3419,16 @@ class Nn {
|
|
|
3131
3419
|
onSetParameters: i,
|
|
3132
3420
|
pollIntervalMs: r
|
|
3133
3421
|
} = {}) {
|
|
3134
|
-
this.getConnection = t, this.eventHandler = new
|
|
3422
|
+
this.getConnection = t, this.eventHandler = new Pn(e), this.parametersSetterWithQueue = new Sn(i), this.senderBalancer = new _n(
|
|
3135
3423
|
{
|
|
3136
|
-
senderFinder: new
|
|
3137
|
-
codecProvider: new
|
|
3424
|
+
senderFinder: new fn(),
|
|
3425
|
+
codecProvider: new gn(),
|
|
3138
3426
|
parametersSetter: this.parametersSetterWithQueue
|
|
3139
3427
|
},
|
|
3140
3428
|
{
|
|
3141
3429
|
ignoreForCodec: s
|
|
3142
3430
|
}
|
|
3143
|
-
), this.trackMonitor = new
|
|
3431
|
+
), this.trackMonitor = new vn({ pollIntervalMs: r });
|
|
3144
3432
|
}
|
|
3145
3433
|
/**
|
|
3146
3434
|
* Подписывается на события управления главной камерой
|
|
@@ -3185,13 +3473,13 @@ class Nn {
|
|
|
3185
3473
|
});
|
|
3186
3474
|
};
|
|
3187
3475
|
}
|
|
3188
|
-
const
|
|
3476
|
+
const fe = [
|
|
3189
3477
|
"balancing-scheduled",
|
|
3190
3478
|
"balancing-started",
|
|
3191
3479
|
"balancing-stopped",
|
|
3192
3480
|
"parameters-updated"
|
|
3193
3481
|
];
|
|
3194
|
-
class
|
|
3482
|
+
class yn {
|
|
3195
3483
|
isBalancingActive = !1;
|
|
3196
3484
|
events;
|
|
3197
3485
|
callManager;
|
|
@@ -3199,7 +3487,7 @@ class Rn {
|
|
|
3199
3487
|
videoSendingBalancer;
|
|
3200
3488
|
startBalancingTimer;
|
|
3201
3489
|
constructor(e, t, s = {}) {
|
|
3202
|
-
this.events = new O(
|
|
3490
|
+
this.events = new O(fe), this.callManager = e, this.balancingStartDelay = s.balancingStartDelay ?? 1e4, this.videoSendingBalancer = new On(
|
|
3203
3491
|
t,
|
|
3204
3492
|
() => e.connection,
|
|
3205
3493
|
{
|
|
@@ -3269,17 +3557,17 @@ class Rn {
|
|
|
3269
3557
|
this.startBalancingTimer && (clearTimeout(this.startBalancingTimer), this.startBalancingTimer = void 0);
|
|
3270
3558
|
}
|
|
3271
3559
|
}
|
|
3272
|
-
const
|
|
3273
|
-
...
|
|
3274
|
-
...
|
|
3275
|
-
...
|
|
3276
|
-
...
|
|
3277
|
-
...
|
|
3278
|
-
...
|
|
3279
|
-
...
|
|
3280
|
-
|
|
3560
|
+
const Dn = 1e6, bn = Re.map((n) => `auto-connect:${n}`), wn = Se.map((n) => `connection:${n}`), Un = oe.map((n) => `call:${n}`), Ln = re.map((n) => `api:${n}`), Bn = Ae.map((n) => `incoming-call:${n}`), kn = ge.map((n) => `presentation:${n}`), Fn = Ne.map((n) => `stats:${n}`), $n = fe.map((n) => `video-balancer:${n}`), qn = [
|
|
3561
|
+
...bn,
|
|
3562
|
+
...wn,
|
|
3563
|
+
...Un,
|
|
3564
|
+
...Ln,
|
|
3565
|
+
...Bn,
|
|
3566
|
+
...kn,
|
|
3567
|
+
...Fn,
|
|
3568
|
+
...$n
|
|
3281
3569
|
];
|
|
3282
|
-
class
|
|
3570
|
+
class Zn {
|
|
3283
3571
|
events;
|
|
3284
3572
|
connectionManager;
|
|
3285
3573
|
connectionQueueManager;
|
|
@@ -3298,25 +3586,25 @@ class Hn {
|
|
|
3298
3586
|
videoBalancerOptions: i,
|
|
3299
3587
|
autoConnectorOptions: r
|
|
3300
3588
|
} = {}) {
|
|
3301
|
-
this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events = new O(
|
|
3589
|
+
this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events = new O(qn), this.connectionManager = new Ot({ JsSIP: e }), this.connectionQueueManager = new yt({
|
|
3302
3590
|
connectionManager: this.connectionManager
|
|
3303
|
-
}), this.callManager = new
|
|
3591
|
+
}), this.callManager = new je(), this.apiManager = new He({
|
|
3304
3592
|
connectionManager: this.connectionManager,
|
|
3305
3593
|
callManager: this.callManager
|
|
3306
|
-
}), this.incomingCallManager = new
|
|
3594
|
+
}), this.incomingCallManager = new Qt(this.connectionManager), this.presentationManager = new gt({
|
|
3307
3595
|
callManager: this.callManager,
|
|
3308
|
-
maxBitrate:
|
|
3309
|
-
}), this.statsManager = new
|
|
3596
|
+
maxBitrate: Dn
|
|
3597
|
+
}), this.statsManager = new sn({
|
|
3310
3598
|
callManager: this.callManager,
|
|
3311
3599
|
apiManager: this.apiManager
|
|
3312
|
-
}), this.autoConnectorManager = new
|
|
3600
|
+
}), this.autoConnectorManager = new Gt(
|
|
3313
3601
|
{
|
|
3314
3602
|
connectionQueueManager: this.connectionQueueManager,
|
|
3315
3603
|
connectionManager: this.connectionManager,
|
|
3316
3604
|
callManager: this.callManager
|
|
3317
3605
|
},
|
|
3318
3606
|
r
|
|
3319
|
-
), this.videoSendingBalancerManager = new
|
|
3607
|
+
), this.videoSendingBalancerManager = new yn(
|
|
3320
3608
|
this.callManager,
|
|
3321
3609
|
this.apiManager,
|
|
3322
3610
|
i
|
|
@@ -3384,7 +3672,7 @@ class Hn {
|
|
|
3384
3672
|
checkTelephony = async (e) => this.connectionManager.checkTelephony(e);
|
|
3385
3673
|
isConfigured = () => this.connectionManager.isConfigured();
|
|
3386
3674
|
getConnectionConfiguration = () => this.connectionManager.getConnectionConfiguration();
|
|
3387
|
-
|
|
3675
|
+
getUri = (e) => this.connectionManager.getUri(e);
|
|
3388
3676
|
startAutoConnect = (...e) => {
|
|
3389
3677
|
this.autoConnectorManager.start(...e);
|
|
3390
3678
|
};
|
|
@@ -3393,14 +3681,10 @@ class Hn {
|
|
|
3393
3681
|
};
|
|
3394
3682
|
call = async (e) => {
|
|
3395
3683
|
const { onAddedTransceiver: t, ...s } = e;
|
|
3396
|
-
return this.callManager.startCall(
|
|
3397
|
-
|
|
3398
|
-
this.
|
|
3399
|
-
|
|
3400
|
-
...s,
|
|
3401
|
-
onAddedTransceiver: this.resolveHandleAddTransceiver(t)
|
|
3402
|
-
}
|
|
3403
|
-
);
|
|
3684
|
+
return this.callManager.startCall(this.connectionManager.getUaProtected(), this.getUri, {
|
|
3685
|
+
...s,
|
|
3686
|
+
onAddedTransceiver: this.resolveHandleAddTransceiver(t)
|
|
3687
|
+
});
|
|
3404
3688
|
};
|
|
3405
3689
|
hangUp = async () => this.callManager.endCall();
|
|
3406
3690
|
answerToIncomingCall = async (e) => {
|
|
@@ -3493,14 +3777,37 @@ class Hn {
|
|
|
3493
3777
|
async askPermissionToEnableCam(...e) {
|
|
3494
3778
|
return this.apiManager.askPermissionToEnableCam(...e);
|
|
3495
3779
|
}
|
|
3780
|
+
subscribeChangeRole() {
|
|
3781
|
+
this.apiManager.on("participant:move-request-to-participants", () => {
|
|
3782
|
+
this.callManager.setCallRoleParticipant();
|
|
3783
|
+
}), this.apiManager.on("participant:move-request-to-spectators-synthetic", () => {
|
|
3784
|
+
this.callManager.setCallRoleSpectatorSynthetic(), this.stopPresentation().catch(() => {
|
|
3785
|
+
});
|
|
3786
|
+
}), this.apiManager.on("participant:move-request-to-spectators-with-audio-id", ({ audioId: e }) => {
|
|
3787
|
+
this.callManager.setCallRoleSpectator({ audioId: e, sendOffer: this.sendOffer }), this.stopPresentation().catch(() => {
|
|
3788
|
+
});
|
|
3789
|
+
});
|
|
3790
|
+
}
|
|
3791
|
+
sendOffer = async (e, t) => {
|
|
3792
|
+
const i = this.connectionManager.getConnectionConfiguration()?.sipServerUrl;
|
|
3793
|
+
if (i === void 0)
|
|
3794
|
+
throw new Error("No sipServerUrl for sendOffer");
|
|
3795
|
+
return zt({
|
|
3796
|
+
serverUrl: i,
|
|
3797
|
+
offer: t,
|
|
3798
|
+
conferenceNumber: e.conferenceNumber,
|
|
3799
|
+
quality: e.quality,
|
|
3800
|
+
audio: e.audioChannel
|
|
3801
|
+
});
|
|
3802
|
+
};
|
|
3496
3803
|
setCodecPreferences(e) {
|
|
3497
|
-
|
|
3804
|
+
hn(e, {
|
|
3498
3805
|
preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
|
|
3499
3806
|
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
3500
3807
|
});
|
|
3501
3808
|
}
|
|
3502
3809
|
subscribe() {
|
|
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);
|
|
3810
|
+
this.bridgeEvents("auto-connect", this.autoConnectorManager), this.bridgeEvents("connection", this.connectionManager), this.bridgeEvents("call", this.callManager), this.bridgeEvents("api", this.apiManager), this.bridgeEvents("incoming-call", this.incomingCallManager), this.bridgeEvents("presentation", this.presentationManager), this.bridgeEvents("stats", this.statsManager), this.bridgeEvents("video-balancer", this.videoSendingBalancerManager), this.subscribeChangeRole();
|
|
3504
3811
|
}
|
|
3505
3812
|
bridgeEvents = (e, t) => {
|
|
3506
3813
|
t.events.eachTriggers((s, i) => {
|
|
@@ -3514,19 +3821,20 @@ class Hn {
|
|
|
3514
3821
|
};
|
|
3515
3822
|
}
|
|
3516
3823
|
export {
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3824
|
+
ce as E,
|
|
3825
|
+
Ge as O,
|
|
3826
|
+
Zn as S,
|
|
3827
|
+
ue as a,
|
|
3828
|
+
ht as b,
|
|
3829
|
+
We as c,
|
|
3830
|
+
Kn as d,
|
|
3831
|
+
Jn as e,
|
|
3832
|
+
jn as f,
|
|
3833
|
+
E as g,
|
|
3834
|
+
ft as h,
|
|
3835
|
+
nn as i,
|
|
3836
|
+
un as j,
|
|
3529
3837
|
h as l,
|
|
3530
|
-
|
|
3531
|
-
|
|
3838
|
+
k as p,
|
|
3839
|
+
zt as s
|
|
3532
3840
|
};
|