sip-connector 22.0.0 → 23.0.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/dist/{@SipConnector-OAqRbRF0.js → @SipConnector-CmHfa0Ce.js} +891 -667
- package/dist/@SipConnector-DwgaqxCG.cjs +1 -0
- package/dist/ApiManager/@ApiManager.d.ts +8 -10
- package/dist/ApiManager/constants.d.ts +80 -44
- package/dist/ApiManager/events.d.ts +7 -5
- package/dist/ApiManager/getHeader.d.ts +3 -0
- package/dist/ApiManager/index.d.ts +3 -2
- package/dist/CallManager/@CallManager.d.ts +7 -1
- package/dist/CallManager/StreamsChangeTracker.d.ts +35 -0
- package/dist/CallManager/StreamsManagerProvider.d.ts +11 -3
- package/dist/ConnectionManager/ConnectionStateMachine.d.ts +0 -2
- package/dist/ContentedStreamManager/@ContentedStreamManager.d.ts +19 -0
- package/dist/ContentedStreamManager/ContentedStreamStateMachine.d.ts +52 -0
- package/dist/ContentedStreamManager/events.d.ts +15 -0
- package/dist/ContentedStreamManager/index.d.ts +4 -0
- package/dist/ContentedStreamManager/types.d.ts +7 -0
- package/dist/SipConnector/@SipConnector.d.ts +2 -5
- package/dist/SipConnectorFacade/@SipConnectorFacade.d.ts +3 -3
- package/dist/StatsPeerConnection/@StatsPeerConnection.d.ts +2 -1
- package/dist/VideoSendingBalancer/types.d.ts +2 -2
- package/dist/__fixtures__/createManagers.d.ts +12 -0
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +22 -22
- package/dist/tools/BaseStateMachine.d.ts +2 -0
- package/package.json +1 -1
- package/dist/@SipConnector-mL9nMhkX.cjs +0 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { TypedEvents as
|
|
3
|
-
import { CancelableRequest as
|
|
4
|
-
import { resolveRequesterByTimeout as
|
|
5
|
-
import { hasCanceledError as
|
|
6
|
-
import { createActor as
|
|
7
|
-
import { createStackPromises as
|
|
1
|
+
import Z from "debug";
|
|
2
|
+
import { TypedEvents as R } from "events-constructor";
|
|
3
|
+
import { CancelableRequest as Y, isCanceledError as Qe } from "@krivega/cancelable-promise";
|
|
4
|
+
import { resolveRequesterByTimeout as Ye, requesterByTimeoutsWithFailCalls as Xe, DelayRequester as Je, hasCanceledError as ze, SetTimeoutRequest as ue } from "@krivega/timeout-requester";
|
|
5
|
+
import { hasCanceledError as je, repeatedCallsAsync as Te } from "repeated-calls";
|
|
6
|
+
import { createActor as Ke, setup as G, assign as M } from "xstate";
|
|
7
|
+
import { createStackPromises as Ee, isPromiseIsNotActualError as Ze } from "stack-promises";
|
|
8
8
|
import "ua-parser-js";
|
|
9
9
|
import "sequent-promises";
|
|
10
|
-
import
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
var
|
|
17
|
-
const
|
|
10
|
+
import et from "lodash";
|
|
11
|
+
const ee = "sip-connector", d = Z(ee), oi = () => {
|
|
12
|
+
Z.enable(ee);
|
|
13
|
+
}, ci = () => {
|
|
14
|
+
Z.enable(`-${ee}`);
|
|
15
|
+
}, tt = "Error decline with 603", nt = 1006, st = (n) => typeof n == "object" && n !== null && "code" in n && n.code === nt, it = (n) => n.message === tt;
|
|
16
|
+
var W = /* @__PURE__ */ ((n) => (n.SPECTATOR = "SPECTATOR", n.PARTICIPANT = "PARTICIPANT", n))(W || {}), y = /* @__PURE__ */ ((n) => (n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n.ENTER_ROOM = "application/vinteo.webrtc.roomname", n.MIC = "application/vinteo.webrtc.mic", n.USE_LICENSE = "application/vinteo.webrtc.uselic", n.PARTICIPANT_STATE = "application/vinteo.webrtc.partstate", n.NOTIFY = "application/vinteo.webrtc.notify", n))(y || {}), _ = /* @__PURE__ */ ((n) => (n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n.CHANNELS = "application/vinteo.webrtc.channels", n.MEDIA_STATE = "application/vinteo.webrtc.mediastate", n.REFUSAL = "application/vinteo.webrtc.refusal", n.STATS = "application/vinteo.webrtc.stats", n))(_ || {}), f = /* @__PURE__ */ ((n) => (n.PAUSE_MAIN_CAM = "PAUSEMAINCAM", n.RESUME_MAIN_CAM = "RESUMEMAINCAM", n.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", n.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", n.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", n))(f || {}), x = /* @__PURE__ */ ((n) => (n.ADMIN_STOP_MIC = "ADMINSTOPMIC", n.ADMIN_START_MIC = "ADMINSTARTMIC", n))(x || {}), Se = /* @__PURE__ */ ((n) => (n.H264 = "H264", n.VP8 = "VP8", n.VP9 = "VP9", n.AV1 = "AV1", n))(Se || {}), h = /* @__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.CONTENTED_STREAM_STATE = "x-webrtc-share-state", n.CONTENTED_STREAM_CODEC = "x-webrtc-share-codec", n.AVAILABLE_INCOMING_BITRATE = "X-WEBRTC-AVAILABLE-INCOMING-BITRATE", n.AUDIO_TRACK_COUNT = "X-WEBRTC-AUDIO-TRACK-COUNT", n.VIDEO_TRACK_COUNT = "X-WEBRTC-VIDEO-TRACK-COUNT", n.TRACKS_DIRECTION = "X-WEBRTC-TRACKS-DIRECTION", n.AUDIO_ID = "X-WEBRTC-AUDIOID", n))(h || {}), $ = /* @__PURE__ */ ((n) => (n.AVAILABLE_CONTENTED_STREAM = "YOUCANRECEIVECONTENT", n.NOT_AVAILABLE_CONTENTED_STREAM = "CONTENTEND", n.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", n))($ || {}), U = /* @__PURE__ */ ((n) => (n.AVAILABLE_CONTENTED_STREAM = "x-webrtc-share-state: YOUCANRECEIVECONTENT", n.NOT_AVAILABLE_CONTENTED_STREAM = "x-webrtc-share-state: CONTENTEND", n.ACK_PERMISSION_TO_START_PRESENTATION = "x-webrtc-share-state: LETMESTARTPRESENTATION", n.STOPPED_CLIENT_PRESENTATION = "x-webrtc-share-state: STOPPRESENTATION", n.ENABLE_MAIN_CAM = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE: LETMESTARTMAINCAM", n))(U || {}), Q = /* @__PURE__ */ ((n) => (n.ADMIN_SYNC_FORCED = "1", n.ADMIN_SYNC_NOT_FORCED = "0", n))(Q || {}), Ce = /* @__PURE__ */ ((n) => (n.AUDIO = "AUDIO", n.VIDEO = "VIDEO", n.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", n))(Ce || {}), g = /* @__PURE__ */ ((n) => (n.ENTER_ROOM = "enter-room", n.MAIN_CAM_CONTROL = "main-cam-control", n.USE_LICENSE = "use-license", n.NEW_DTMF = "new-dtmf", n.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "conference:participant-token-issued", n.CONTENTED_STREAM_AVAILABLE = "contented-stream:available", n.CONTENTED_STREAM_NOT_AVAILABLE = "contented-stream:not-available", n.PRESENTATION_MUST_STOP = "presentation:must-stop", n.CHANNELS_ALL = "channels:all", n.CHANNELS_NOTIFY = "channels:notify", n.PARTICIPANT_ADDED_TO_LIST_MODERATORS = "participant:added-to-list-moderators", n.PARTICIPANT_REMOVED_FROM_LIST_MODERATORS = "participant:removed-from-list-moderators", n.PARTICIPANT_MOVE_REQUEST_TO_STREAM = "participant:move-request-to-stream", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS = "participant:move-request-to-spectators", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_SYNTHETIC = "participant:move-request-to-spectators-synthetic", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_WITH_AUDIO_ID = "participant:move-request-to-spectators-with-audio-id", n.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS = "participant:move-request-to-participants", n.PARTICIPATION_ACCEPTING_WORD_REQUEST = "participation:accepting-word-request", n.PARTICIPATION_CANCELLING_WORD_REQUEST = "participation:cancelling-word-request", n.WEBCAST_STARTED = "webcast:started", n.WEBCAST_STOPPED = "webcast:stopped", n.ACCOUNT_CHANGED = "account:changed", n.ACCOUNT_DELETED = "account:deleted", n.ADMIN_START_MAIN_CAM = "admin:start-main-cam", n.ADMIN_STOP_MAIN_CAM = "admin:stop-main-cam", n.ADMIN_START_MIC = "admin:start-mic", n.ADMIN_STOP_MIC = "admin:stop-mic", n.ADMIN_FORCE_SYNC_MEDIA_STATE = "admin:force-sync-media-state", n))(g || {});
|
|
17
|
+
const pe = [
|
|
18
18
|
"enter-room",
|
|
19
19
|
"main-cam-control",
|
|
20
20
|
"use-license",
|
|
@@ -43,23 +43,76 @@ const ge = [
|
|
|
43
43
|
"admin:start-mic",
|
|
44
44
|
"admin:stop-mic",
|
|
45
45
|
"admin:force-sync-media-state"
|
|
46
|
-
],
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
], rt = () => new R(pe), at = (n) => typeof n == "string" && n.trim().length > 0, L = (n, e) => {
|
|
47
|
+
const t = e.toLowerCase(), s = Object.entries(n).find(([, i]) => typeof i == "string" && i.toLowerCase() === t);
|
|
48
|
+
return s ? s[1] : void 0;
|
|
49
|
+
}, ot = (n) => typeof n == "string" && !Number.isNaN(Number(n)) && Number.isFinite(Number(n)), ct = (n) => {
|
|
50
|
+
if (ot(n))
|
|
51
|
+
return Number(n);
|
|
52
|
+
}, N = (n, e) => {
|
|
53
|
+
const t = n.getHeader(e);
|
|
54
|
+
if (!at(t))
|
|
55
|
+
return;
|
|
56
|
+
const s = t.toLowerCase();
|
|
57
|
+
switch (e) {
|
|
58
|
+
case h.CONTENT_ENTER_ROOM:
|
|
59
|
+
case h.PARTICIPANT_NAME:
|
|
60
|
+
case h.INPUT_CHANNELS:
|
|
61
|
+
case h.OUTPUT_CHANNELS:
|
|
62
|
+
case h.TRACKS_DIRECTION:
|
|
63
|
+
case h.AUDIO_ID:
|
|
64
|
+
case h.MAIN_CAM_RESOLUTION:
|
|
65
|
+
case h.MEDIA_STATE:
|
|
66
|
+
case h.NOTIFY:
|
|
67
|
+
case h.CONTENT_ENABLE_MEDIA_DEVICE:
|
|
68
|
+
return s;
|
|
69
|
+
case h.MEDIA_TYPE:
|
|
70
|
+
case h.MAIN_CAM_STATE:
|
|
71
|
+
case h.MIC_STATE:
|
|
72
|
+
case h.AVAILABLE_INCOMING_BITRATE:
|
|
73
|
+
case h.AUDIO_TRACK_COUNT:
|
|
74
|
+
case h.VIDEO_TRACK_COUNT:
|
|
75
|
+
return ct(s);
|
|
76
|
+
case h.CONTENTED_STREAM_CODEC:
|
|
77
|
+
return L(Se, s);
|
|
78
|
+
case h.CONTENT_TYPE:
|
|
79
|
+
return L(y, s);
|
|
80
|
+
case h.CONTENT_USE_LICENSE:
|
|
81
|
+
return L(Ce, s);
|
|
82
|
+
case h.MAIN_CAM:
|
|
83
|
+
return L(f, s);
|
|
84
|
+
case h.MIC:
|
|
85
|
+
return L(x, s);
|
|
86
|
+
case h.MEDIA_SYNC:
|
|
87
|
+
return L(Q, s);
|
|
88
|
+
case h.CONTENT_PARTICIPANT_STATE:
|
|
89
|
+
return L(W, s);
|
|
90
|
+
case h.CONTENTED_STREAM_STATE:
|
|
91
|
+
return L($, s);
|
|
92
|
+
default:
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
var I = /* @__PURE__ */ ((n) => (n.CHANNELS = "channels", n.WEBCAST_STARTED = "WebcastStarted", n.WEBCAST_STOPPED = "WebcastStopped", n.ACCOUNT_CHANGED = "accountChanged", n.ACCOUNT_DELETED = "accountDeleted", n.ADDED_TO_LIST_MODERATORS = "addedToListModerators", n.REMOVED_FROM_LIST_MODERATORS = "removedFromListModerators", n.ACCEPTING_WORD_REQUEST = "ParticipationRequestAccepted", n.CANCELLING_WORD_REQUEST = "ParticipationRequestRejected", n.MOVE_REQUEST_TO_STREAM = "ParticipantMovedToWebcast", n.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "ConferenceParticipantTokenIssued", n))(I || {});
|
|
97
|
+
class dt {
|
|
49
98
|
events;
|
|
50
|
-
connectionManager;
|
|
51
99
|
callManager;
|
|
52
|
-
constructor({
|
|
100
|
+
constructor() {
|
|
101
|
+
this.events = rt();
|
|
102
|
+
}
|
|
103
|
+
subscribe({
|
|
53
104
|
connectionManager: e,
|
|
54
105
|
callManager: t
|
|
55
106
|
}) {
|
|
56
|
-
this.
|
|
107
|
+
this.callManager = t, e.on("sipEvent", this.handleSipEvent), t.on("newInfo", this.handleNewInfo), t.on("newDTMF", ({ originator: s }) => {
|
|
108
|
+
this.events.trigger(g.NEW_DTMF, { originator: s });
|
|
109
|
+
});
|
|
57
110
|
}
|
|
58
111
|
async waitChannels() {
|
|
59
|
-
return this.wait(
|
|
112
|
+
return this.wait(g.CHANNELS_ALL);
|
|
60
113
|
}
|
|
61
114
|
async waitSyncMediaState() {
|
|
62
|
-
return this.wait(
|
|
115
|
+
return this.wait(g.ADMIN_FORCE_SYNC_MEDIA_STATE);
|
|
63
116
|
}
|
|
64
117
|
async sendDTMF(e) {
|
|
65
118
|
return new Promise((t, s) => {
|
|
@@ -69,7 +122,7 @@ class tt {
|
|
|
69
122
|
} catch (r) {
|
|
70
123
|
s(r);
|
|
71
124
|
}
|
|
72
|
-
i && (this.callManager
|
|
125
|
+
i && (this.callManager?.once("newDTMF", ({ originator: r }) => {
|
|
73
126
|
r === "local" && t();
|
|
74
127
|
}), i.sendDTMF(e, {
|
|
75
128
|
duration: 120,
|
|
@@ -78,19 +131,19 @@ class tt {
|
|
|
78
131
|
});
|
|
79
132
|
}
|
|
80
133
|
async sendChannels({ inputChannels: e, outputChannels: t }) {
|
|
81
|
-
const s = this.getEstablishedRTCSessionProtected(), i = `${
|
|
134
|
+
const s = this.getEstablishedRTCSessionProtected(), i = `${h.INPUT_CHANNELS}: ${e}`, r = `${h.OUTPUT_CHANNELS}: ${t}`, a = [
|
|
82
135
|
i,
|
|
83
136
|
r
|
|
84
137
|
];
|
|
85
|
-
return s.sendInfo(
|
|
138
|
+
return s.sendInfo(_.CHANNELS, void 0, { extraHeaders: a });
|
|
86
139
|
}
|
|
87
140
|
async sendMediaState({ cam: e, mic: t }, s = {}) {
|
|
88
|
-
const i = this.getEstablishedRTCSessionProtected(), r = `${
|
|
141
|
+
const i = this.getEstablishedRTCSessionProtected(), r = `${h.MEDIA_STATE}: currentstate`, a = `${h.MAIN_CAM_STATE}: ${Number(e)}`, o = `${h.MIC_STATE}: ${Number(t)}`, c = [
|
|
89
142
|
r,
|
|
90
143
|
a,
|
|
91
144
|
o
|
|
92
145
|
];
|
|
93
|
-
return i.sendInfo(
|
|
146
|
+
return i.sendInfo(_.MEDIA_STATE, void 0, {
|
|
94
147
|
noTerminateWhenError: !0,
|
|
95
148
|
...s,
|
|
96
149
|
extraHeaders: c
|
|
@@ -99,15 +152,15 @@ class tt {
|
|
|
99
152
|
async sendStats({
|
|
100
153
|
availableIncomingBitrate: e
|
|
101
154
|
}) {
|
|
102
|
-
const t = this.getEstablishedRTCSessionProtected(), i = [`${
|
|
103
|
-
return t.sendInfo(
|
|
155
|
+
const t = this.getEstablishedRTCSessionProtected(), i = [`${h.AVAILABLE_INCOMING_BITRATE}: ${e}`];
|
|
156
|
+
return t.sendInfo(_.STATS, void 0, {
|
|
104
157
|
noTerminateWhenError: !0,
|
|
105
158
|
extraHeaders: i
|
|
106
159
|
});
|
|
107
160
|
}
|
|
108
161
|
async sendRefusalToTurnOn(e, t = {}) {
|
|
109
|
-
const s = this.getEstablishedRTCSessionProtected(), a = e === "mic" ? 0 : 1, c = [`${
|
|
110
|
-
return s.sendInfo(
|
|
162
|
+
const s = this.getEstablishedRTCSessionProtected(), a = e === "mic" ? 0 : 1, c = [`${h.MEDIA_TYPE}: ${a}`];
|
|
163
|
+
return s.sendInfo(_.REFUSAL, void 0, {
|
|
111
164
|
noTerminateWhenError: !0,
|
|
112
165
|
...t,
|
|
113
166
|
extraHeaders: c
|
|
@@ -119,39 +172,34 @@ class tt {
|
|
|
119
172
|
async sendRefusalToTurnOnCam(e = {}) {
|
|
120
173
|
return this.sendRefusalToTurnOn("cam", { noTerminateWhenError: !0, ...e });
|
|
121
174
|
}
|
|
122
|
-
async
|
|
123
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
124
|
-
extraHeaders: [
|
|
175
|
+
async sendAvailableContentedStream() {
|
|
176
|
+
await this.getEstablishedRTCSessionProtected().sendInfo(_.SHARE_STATE, void 0, {
|
|
177
|
+
extraHeaders: [U.AVAILABLE_CONTENTED_STREAM]
|
|
125
178
|
});
|
|
126
179
|
}
|
|
127
|
-
async
|
|
128
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
129
|
-
extraHeaders: [
|
|
180
|
+
async askPermissionToStartPresentation() {
|
|
181
|
+
await this.getEstablishedRTCSessionProtected().sendInfo(_.SHARE_STATE, void 0, {
|
|
182
|
+
extraHeaders: [U.ACK_PERMISSION_TO_START_PRESENTATION]
|
|
130
183
|
});
|
|
131
184
|
}
|
|
132
185
|
async sendStoppedPresentation() {
|
|
133
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
134
|
-
extraHeaders: [
|
|
186
|
+
await this.getEstablishedRTCSessionProtected().sendInfo(_.SHARE_STATE, void 0, {
|
|
187
|
+
extraHeaders: [U.STOPPED_CLIENT_PRESENTATION]
|
|
135
188
|
});
|
|
136
189
|
}
|
|
137
|
-
async
|
|
138
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
139
|
-
extraHeaders: [
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
async askPermissionToStartPresentation() {
|
|
143
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(I.SHARE_STATE, void 0, {
|
|
144
|
-
extraHeaders: [T.START_PRESENTATION]
|
|
190
|
+
async sendNotAvailableContentedStream() {
|
|
191
|
+
await this.getEstablishedRTCSessionProtected().sendInfo(_.SHARE_STATE, void 0, {
|
|
192
|
+
extraHeaders: [U.NOT_AVAILABLE_CONTENTED_STREAM]
|
|
145
193
|
});
|
|
146
194
|
}
|
|
147
195
|
async askPermissionToEnableCam(e = {}) {
|
|
148
|
-
const t = this.getEstablishedRTCSessionProtected(), s = [
|
|
149
|
-
return t.sendInfo(
|
|
196
|
+
const t = this.getEstablishedRTCSessionProtected(), s = [U.ENABLE_MAIN_CAM];
|
|
197
|
+
return t.sendInfo(_.MAIN_CAM, void 0, {
|
|
150
198
|
noTerminateWhenError: !0,
|
|
151
199
|
...e,
|
|
152
200
|
extraHeaders: s
|
|
153
201
|
}).catch((i) => {
|
|
154
|
-
if (
|
|
202
|
+
if (it(i))
|
|
155
203
|
throw i;
|
|
156
204
|
});
|
|
157
205
|
}
|
|
@@ -171,22 +219,17 @@ class tt {
|
|
|
171
219
|
this.events.off(e, t);
|
|
172
220
|
}
|
|
173
221
|
getEstablishedRTCSessionProtected = () => {
|
|
174
|
-
const e = this.callManager
|
|
222
|
+
const e = this.callManager?.getEstablishedRTCSession();
|
|
175
223
|
if (!e)
|
|
176
224
|
throw new Error("No rtcSession established");
|
|
177
225
|
return e;
|
|
178
226
|
};
|
|
179
|
-
subscribe() {
|
|
180
|
-
this.connectionManager.on("sipEvent", this.handleSipEvent), this.callManager.on("newInfo", this.handleNewInfo), this.callManager.on("newDTMF", (e) => {
|
|
181
|
-
this.events.trigger(l.NEW_DTMF, e);
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
227
|
handleSipEvent = ({ request: e }) => {
|
|
185
228
|
this.maybeHandleNotify(e);
|
|
186
229
|
};
|
|
187
230
|
maybeHandleNotify = (e) => {
|
|
188
231
|
try {
|
|
189
|
-
const t = e.getHeader(
|
|
232
|
+
const t = e.getHeader(h.NOTIFY);
|
|
190
233
|
if (t) {
|
|
191
234
|
const s = JSON.parse(t);
|
|
192
235
|
this.handleNotify(s);
|
|
@@ -197,55 +240,55 @@ class tt {
|
|
|
197
240
|
};
|
|
198
241
|
handleNotify = (e) => {
|
|
199
242
|
switch (e.cmd) {
|
|
200
|
-
case
|
|
243
|
+
case I.CHANNELS: {
|
|
201
244
|
const t = e;
|
|
202
245
|
this.triggerChannelsNotify(t);
|
|
203
246
|
break;
|
|
204
247
|
}
|
|
205
|
-
case
|
|
248
|
+
case I.WEBCAST_STARTED: {
|
|
206
249
|
const t = e;
|
|
207
250
|
this.triggerWebcastStartedNotify(t);
|
|
208
251
|
break;
|
|
209
252
|
}
|
|
210
|
-
case
|
|
253
|
+
case I.WEBCAST_STOPPED: {
|
|
211
254
|
const t = e;
|
|
212
255
|
this.triggerWebcastStoppedNotify(t);
|
|
213
256
|
break;
|
|
214
257
|
}
|
|
215
|
-
case
|
|
258
|
+
case I.ADDED_TO_LIST_MODERATORS: {
|
|
216
259
|
const t = e;
|
|
217
260
|
this.triggerAddedToListModeratorsNotify(t);
|
|
218
261
|
break;
|
|
219
262
|
}
|
|
220
|
-
case
|
|
263
|
+
case I.REMOVED_FROM_LIST_MODERATORS: {
|
|
221
264
|
const t = e;
|
|
222
265
|
this.triggerRemovedFromListModeratorsNotify(t);
|
|
223
266
|
break;
|
|
224
267
|
}
|
|
225
|
-
case
|
|
268
|
+
case I.ACCEPTING_WORD_REQUEST: {
|
|
226
269
|
const t = e;
|
|
227
270
|
this.triggerParticipationAcceptingWordRequest(t);
|
|
228
271
|
break;
|
|
229
272
|
}
|
|
230
|
-
case
|
|
273
|
+
case I.CANCELLING_WORD_REQUEST: {
|
|
231
274
|
const t = e;
|
|
232
275
|
this.triggerParticipationCancellingWordRequest(t);
|
|
233
276
|
break;
|
|
234
277
|
}
|
|
235
|
-
case
|
|
278
|
+
case I.MOVE_REQUEST_TO_STREAM: {
|
|
236
279
|
const t = e;
|
|
237
280
|
this.triggerParticipantMoveRequestToStream(t);
|
|
238
281
|
break;
|
|
239
282
|
}
|
|
240
|
-
case
|
|
283
|
+
case I.ACCOUNT_CHANGED: {
|
|
241
284
|
this.triggerAccountChangedNotify();
|
|
242
285
|
break;
|
|
243
286
|
}
|
|
244
|
-
case
|
|
287
|
+
case I.ACCOUNT_DELETED: {
|
|
245
288
|
this.triggerAccountDeletedNotify();
|
|
246
289
|
break;
|
|
247
290
|
}
|
|
248
|
-
case
|
|
291
|
+
case I.CONFERENCE_PARTICIPANT_TOKEN_ISSUED: {
|
|
249
292
|
const t = e;
|
|
250
293
|
this.triggerConferenceParticipantTokenIssued(t);
|
|
251
294
|
break;
|
|
@@ -258,34 +301,34 @@ class tt {
|
|
|
258
301
|
const { originator: t } = e;
|
|
259
302
|
if (t !== "remote")
|
|
260
303
|
return;
|
|
261
|
-
const { request: s } = e, i = s, r = i.
|
|
304
|
+
const { request: s } = e, i = s, r = N(i, h.CONTENT_TYPE);
|
|
262
305
|
if (r !== void 0)
|
|
263
306
|
switch (r) {
|
|
264
|
-
case
|
|
307
|
+
case y.ENTER_ROOM: {
|
|
265
308
|
this.triggerEnterRoom(i), this.maybeTriggerChannels(i);
|
|
266
309
|
break;
|
|
267
310
|
}
|
|
268
|
-
case
|
|
311
|
+
case y.NOTIFY: {
|
|
269
312
|
this.maybeHandleNotify(i);
|
|
270
313
|
break;
|
|
271
314
|
}
|
|
272
|
-
case
|
|
273
|
-
this.
|
|
315
|
+
case y.SHARE_STATE: {
|
|
316
|
+
this.triggerContentedStreamState(i);
|
|
274
317
|
break;
|
|
275
318
|
}
|
|
276
|
-
case
|
|
319
|
+
case y.MAIN_CAM: {
|
|
277
320
|
this.triggerMainCamControl(i);
|
|
278
321
|
break;
|
|
279
322
|
}
|
|
280
|
-
case
|
|
323
|
+
case y.MIC: {
|
|
281
324
|
this.triggerMicControl(i);
|
|
282
325
|
break;
|
|
283
326
|
}
|
|
284
|
-
case
|
|
327
|
+
case y.USE_LICENSE: {
|
|
285
328
|
this.triggerUseLicense(i);
|
|
286
329
|
break;
|
|
287
330
|
}
|
|
288
|
-
case
|
|
331
|
+
case y.PARTICIPANT_STATE: {
|
|
289
332
|
this.maybeTriggerParticipantMoveRequest(i);
|
|
290
333
|
break;
|
|
291
334
|
}
|
|
@@ -296,7 +339,7 @@ class tt {
|
|
|
296
339
|
inputChannels: t,
|
|
297
340
|
outputChannels: s
|
|
298
341
|
};
|
|
299
|
-
this.events.trigger(
|
|
342
|
+
this.events.trigger(g.CHANNELS_NOTIFY, i);
|
|
300
343
|
};
|
|
301
344
|
triggerWebcastStartedNotify = ({
|
|
302
345
|
body: { conference: e, type: t }
|
|
@@ -305,7 +348,7 @@ class tt {
|
|
|
305
348
|
conference: e,
|
|
306
349
|
type: t
|
|
307
350
|
};
|
|
308
|
-
this.events.trigger(
|
|
351
|
+
this.events.trigger(g.WEBCAST_STARTED, s);
|
|
309
352
|
};
|
|
310
353
|
triggerWebcastStoppedNotify = ({
|
|
311
354
|
body: { conference: e, type: t }
|
|
@@ -314,7 +357,7 @@ class tt {
|
|
|
314
357
|
conference: e,
|
|
315
358
|
type: t
|
|
316
359
|
};
|
|
317
|
-
this.events.trigger(
|
|
360
|
+
this.events.trigger(g.WEBCAST_STOPPED, s);
|
|
318
361
|
};
|
|
319
362
|
triggerAddedToListModeratorsNotify = ({
|
|
320
363
|
conference: e
|
|
@@ -323,7 +366,7 @@ class tt {
|
|
|
323
366
|
conference: e
|
|
324
367
|
};
|
|
325
368
|
this.events.trigger(
|
|
326
|
-
|
|
369
|
+
g.PARTICIPANT_ADDED_TO_LIST_MODERATORS,
|
|
327
370
|
t
|
|
328
371
|
);
|
|
329
372
|
};
|
|
@@ -334,7 +377,7 @@ class tt {
|
|
|
334
377
|
conference: e
|
|
335
378
|
};
|
|
336
379
|
this.events.trigger(
|
|
337
|
-
|
|
380
|
+
g.PARTICIPANT_REMOVED_FROM_LIST_MODERATORS,
|
|
338
381
|
t
|
|
339
382
|
);
|
|
340
383
|
};
|
|
@@ -344,7 +387,7 @@ class tt {
|
|
|
344
387
|
const t = {
|
|
345
388
|
conference: e
|
|
346
389
|
};
|
|
347
|
-
this.events.trigger(
|
|
390
|
+
this.events.trigger(g.PARTICIPATION_ACCEPTING_WORD_REQUEST, t);
|
|
348
391
|
};
|
|
349
392
|
triggerParticipationCancellingWordRequest = ({
|
|
350
393
|
body: { conference: e }
|
|
@@ -352,7 +395,7 @@ class tt {
|
|
|
352
395
|
const t = {
|
|
353
396
|
conference: e
|
|
354
397
|
};
|
|
355
|
-
this.events.trigger(
|
|
398
|
+
this.events.trigger(g.PARTICIPATION_CANCELLING_WORD_REQUEST, t);
|
|
356
399
|
};
|
|
357
400
|
triggerParticipantMoveRequestToStream = ({
|
|
358
401
|
body: { conference: e }
|
|
@@ -360,13 +403,13 @@ class tt {
|
|
|
360
403
|
const t = {
|
|
361
404
|
conference: e
|
|
362
405
|
};
|
|
363
|
-
this.events.trigger(
|
|
406
|
+
this.events.trigger(g.PARTICIPANT_MOVE_REQUEST_TO_STREAM, t);
|
|
364
407
|
};
|
|
365
408
|
triggerAccountChangedNotify = () => {
|
|
366
|
-
this.events.trigger(
|
|
409
|
+
this.events.trigger(g.ACCOUNT_CHANGED, {});
|
|
367
410
|
};
|
|
368
411
|
triggerAccountDeletedNotify = () => {
|
|
369
|
-
this.events.trigger(
|
|
412
|
+
this.events.trigger(g.ACCOUNT_DELETED, {});
|
|
370
413
|
};
|
|
371
414
|
triggerConferenceParticipantTokenIssued = ({
|
|
372
415
|
body: { conference: e, participant: t, jwt: s }
|
|
@@ -377,82 +420,91 @@ class tt {
|
|
|
377
420
|
jwt: s
|
|
378
421
|
};
|
|
379
422
|
this.events.trigger(
|
|
380
|
-
|
|
423
|
+
g.CONFERENCE_PARTICIPANT_TOKEN_ISSUED,
|
|
381
424
|
i
|
|
382
425
|
);
|
|
383
426
|
};
|
|
384
427
|
maybeTriggerChannels = (e) => {
|
|
385
|
-
const t = e.
|
|
386
|
-
if (t && s) {
|
|
428
|
+
const t = N(e, h.INPUT_CHANNELS), s = N(e, h.OUTPUT_CHANNELS);
|
|
429
|
+
if (t !== void 0 && s !== void 0) {
|
|
387
430
|
const i = {
|
|
388
431
|
inputChannels: t,
|
|
389
432
|
outputChannels: s
|
|
390
433
|
};
|
|
391
|
-
this.events.trigger(
|
|
434
|
+
this.events.trigger(g.CHANNELS_ALL, i);
|
|
392
435
|
}
|
|
393
436
|
};
|
|
394
437
|
triggerEnterRoom = (e) => {
|
|
395
|
-
const t = e.
|
|
396
|
-
this.events.trigger(
|
|
438
|
+
const t = N(e, h.CONTENT_ENTER_ROOM), s = N(e, h.PARTICIPANT_NAME);
|
|
439
|
+
t !== void 0 && this.events.trigger(g.ENTER_ROOM, { room: t, participantName: s });
|
|
397
440
|
};
|
|
398
|
-
|
|
399
|
-
const t = e.
|
|
441
|
+
triggerContentedStreamState = (e) => {
|
|
442
|
+
const t = N(e, h.CONTENTED_STREAM_STATE);
|
|
400
443
|
if (t !== void 0)
|
|
401
444
|
switch (t) {
|
|
402
|
-
case
|
|
403
|
-
|
|
445
|
+
case $.AVAILABLE_CONTENTED_STREAM: {
|
|
446
|
+
const s = N(e, h.CONTENTED_STREAM_CODEC);
|
|
447
|
+
this.events.trigger(g.CONTENTED_STREAM_AVAILABLE, { codec: s });
|
|
404
448
|
break;
|
|
405
449
|
}
|
|
406
|
-
case
|
|
407
|
-
this.events.trigger(
|
|
450
|
+
case $.NOT_AVAILABLE_CONTENTED_STREAM: {
|
|
451
|
+
this.events.trigger(g.CONTENTED_STREAM_NOT_AVAILABLE, {});
|
|
408
452
|
break;
|
|
409
453
|
}
|
|
410
|
-
case
|
|
411
|
-
this.events.trigger(
|
|
454
|
+
case $.MUST_STOP_PRESENTATION: {
|
|
455
|
+
this.events.trigger(g.PRESENTATION_MUST_STOP, {});
|
|
412
456
|
break;
|
|
413
457
|
}
|
|
414
458
|
}
|
|
415
459
|
};
|
|
416
460
|
maybeTriggerParticipantMoveRequest = (e) => {
|
|
417
|
-
const t = e.
|
|
418
|
-
t ===
|
|
461
|
+
const t = N(e, h.CONTENT_PARTICIPANT_STATE), s = N(e, h.AUDIO_ID);
|
|
462
|
+
t === W.SPECTATOR && (s === void 0 ? (this.events.trigger(g.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_SYNTHETIC, {}), this.events.trigger(g.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS, { isSynthetic: !0 })) : (this.events.trigger(g.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_WITH_AUDIO_ID, {
|
|
419
463
|
audioId: s
|
|
420
|
-
}), this.events.trigger(
|
|
464
|
+
}), this.events.trigger(g.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS, {
|
|
421
465
|
isSynthetic: !1,
|
|
422
466
|
audioId: s
|
|
423
|
-
}))
|
|
467
|
+
}))), t === W.PARTICIPANT && this.events.trigger(g.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS, {});
|
|
424
468
|
};
|
|
425
469
|
triggerMainCamControl = (e) => {
|
|
426
|
-
const t = e.
|
|
427
|
-
if (t ===
|
|
428
|
-
this.events.trigger(
|
|
470
|
+
const t = N(e, h.MAIN_CAM), s = N(e, h.MEDIA_SYNC), i = s === Q.ADMIN_SYNC_FORCED;
|
|
471
|
+
if (t === f.ADMIN_START_MAIN_CAM) {
|
|
472
|
+
this.events.trigger(g.ADMIN_START_MAIN_CAM, { isSyncForced: i });
|
|
429
473
|
return;
|
|
430
474
|
}
|
|
431
|
-
if (t ===
|
|
432
|
-
this.events.trigger(
|
|
475
|
+
if (t === f.ADMIN_STOP_MAIN_CAM) {
|
|
476
|
+
this.events.trigger(g.ADMIN_STOP_MAIN_CAM, { isSyncForced: i });
|
|
433
477
|
return;
|
|
434
478
|
}
|
|
435
|
-
(t ===
|
|
436
|
-
const r = e.
|
|
437
|
-
this.events.trigger(
|
|
479
|
+
(t === f.RESUME_MAIN_CAM || t === f.PAUSE_MAIN_CAM) && s !== void 0 && this.events.trigger(g.ADMIN_FORCE_SYNC_MEDIA_STATE, { isSyncForced: i });
|
|
480
|
+
const r = N(e, h.MAIN_CAM_RESOLUTION);
|
|
481
|
+
this.events.trigger(g.MAIN_CAM_CONTROL, {
|
|
438
482
|
mainCam: t,
|
|
439
483
|
resolutionMainCam: r
|
|
440
484
|
});
|
|
441
485
|
};
|
|
442
486
|
triggerMicControl = (e) => {
|
|
443
|
-
const t = e.
|
|
444
|
-
t ===
|
|
487
|
+
const t = N(e, h.MIC), i = N(e, h.MEDIA_SYNC) === Q.ADMIN_SYNC_FORCED;
|
|
488
|
+
t === x.ADMIN_START_MIC ? this.events.trigger(g.ADMIN_START_MIC, { isSyncForced: i }) : t === x.ADMIN_STOP_MIC && this.events.trigger(g.ADMIN_STOP_MIC, { isSyncForced: i });
|
|
445
489
|
};
|
|
446
490
|
triggerUseLicense = (e) => {
|
|
447
|
-
const t = e.
|
|
448
|
-
this.events.trigger(
|
|
491
|
+
const t = N(e, h.CONTENT_USE_LICENSE);
|
|
492
|
+
t !== void 0 && this.events.trigger(g.USE_LICENSE, t);
|
|
449
493
|
};
|
|
450
494
|
}
|
|
451
|
-
class
|
|
495
|
+
class V {
|
|
452
496
|
actor;
|
|
453
497
|
subscriptions = [];
|
|
498
|
+
stateChangeListeners = /* @__PURE__ */ new Set();
|
|
454
499
|
constructor(e) {
|
|
455
|
-
this.actor =
|
|
500
|
+
this.actor = Ke(e), this.actor.start(), this.addSubscription(
|
|
501
|
+
this.subscribe((t) => {
|
|
502
|
+
const s = t.value;
|
|
503
|
+
this.stateChangeListeners.forEach((i) => {
|
|
504
|
+
i(s);
|
|
505
|
+
});
|
|
506
|
+
})
|
|
507
|
+
);
|
|
456
508
|
}
|
|
457
509
|
get actorRef() {
|
|
458
510
|
return this.actor;
|
|
@@ -470,8 +522,13 @@ class q {
|
|
|
470
522
|
const t = this.actor.subscribe(e);
|
|
471
523
|
return this.addSubscription(t), t;
|
|
472
524
|
}
|
|
525
|
+
onStateChange(e) {
|
|
526
|
+
return this.stateChangeListeners.add(e), () => {
|
|
527
|
+
this.stateChangeListeners.delete(e);
|
|
528
|
+
};
|
|
529
|
+
}
|
|
473
530
|
stop() {
|
|
474
|
-
this.subscriptions.forEach((e) => {
|
|
531
|
+
this.stateChangeListeners.clear(), this.subscriptions.forEach((e) => {
|
|
475
532
|
e();
|
|
476
533
|
}), this.subscriptions.length = 0, this.actor.stop();
|
|
477
534
|
}
|
|
@@ -482,17 +539,17 @@ class q {
|
|
|
482
539
|
return this.subscriptions.push(t), t;
|
|
483
540
|
}
|
|
484
541
|
}
|
|
485
|
-
var
|
|
486
|
-
const
|
|
542
|
+
var ht = /* @__PURE__ */ ((n) => (n.IDLE = "call:idle", n.CONNECTING = "call:connecting", n.ACCEPTED = "call:accepted", n.IN_CALL = "call:inCall", n.ENDED = "call:ended", n.FAILED = "call:failed", n))(ht || {});
|
|
543
|
+
const lt = G({
|
|
487
544
|
types: {
|
|
488
545
|
context: {},
|
|
489
546
|
events: {}
|
|
490
547
|
},
|
|
491
548
|
actions: {
|
|
492
|
-
rememberError:
|
|
549
|
+
rememberError: M(({ event: n }) => "error" in n && n.error !== void 0 ? {
|
|
493
550
|
lastError: n.error instanceof Error ? n.error : new Error(JSON.stringify(n.error))
|
|
494
551
|
} : { lastError: void 0 }),
|
|
495
|
-
resetError:
|
|
552
|
+
resetError: M({ lastError: void 0 })
|
|
496
553
|
}
|
|
497
554
|
}).createMachine({
|
|
498
555
|
id: "call",
|
|
@@ -566,9 +623,9 @@ const st = $({
|
|
|
566
623
|
}
|
|
567
624
|
}
|
|
568
625
|
});
|
|
569
|
-
class
|
|
626
|
+
class gt extends V {
|
|
570
627
|
constructor(e) {
|
|
571
|
-
super(
|
|
628
|
+
super(lt), this.subscribeToEvents(e);
|
|
572
629
|
}
|
|
573
630
|
get isIdle() {
|
|
574
631
|
return this.state === "call:idle";
|
|
@@ -633,8 +690,8 @@ class it extends q {
|
|
|
633
690
|
);
|
|
634
691
|
}
|
|
635
692
|
}
|
|
636
|
-
var S = /* @__PURE__ */ ((n) => (n.PEER_CONNECTION = "peerconnection", n.CONNECTING = "connecting", n.SENDING = "sending", n.PROGRESS = "progress", n.ACCEPTED = "accepted", n.CONFIRMED = "confirmed", n.ENDED = "ended", n.FAILED = "failed", n.NEW_DTMF = "newDTMF", n.NEW_INFO = "newInfo", n.HOLD = "hold", n.UNHOLD = "unhold", n.MUTED = "muted", n.UNMUTED = "unmuted", n.REINVITE = "reinvite", n.UPDATE = "update", n.REFER = "refer", n.REPLACES = "replaces", n.SDP = "sdp", n.ICE_CANDIDATE = "icecandidate", n.GET_USER_MEDIA_FAILED = "getusermediafailed", n.PEER_CONNECTION_CREATE_OFFER_FAILED = "peerconnection:createofferfailed", n.PEER_CONNECTION_CREATE_ANSWER_FAILED = "peerconnection:createanswerfailed", n.PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED = "peerconnection:setlocaldescriptionfailed", n.PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED = "peerconnection:setremotedescriptionfailed", n.START_PRESENTATION = "presentation:start", n.STARTED_PRESENTATION = "presentation:started", n.END_PRESENTATION = "presentation:end", n.ENDED_PRESENTATION = "presentation:ended", n.FAILED_PRESENTATION = "presentation:failed", n.PEER_CONNECTION_CONFIRMED = "peerconnection:confirmed", n.PEER_CONNECTION_ONTRACK = "peerconnection:ontrack", n.ENDED_FROM_SERVER = "ended:fromserver", n.CALL_STATUS_CHANGED = "call-status-changed", n.REMOTE_TRACKS_CHANGED = "remote-tracks-changed", n.REMOTE_STREAMS_CHANGED = "remote-streams-changed", n))(S || {}),
|
|
637
|
-
const
|
|
693
|
+
var S = /* @__PURE__ */ ((n) => (n.PEER_CONNECTION = "peerconnection", n.CONNECTING = "connecting", n.SENDING = "sending", n.PROGRESS = "progress", n.ACCEPTED = "accepted", n.CONFIRMED = "confirmed", n.ENDED = "ended", n.FAILED = "failed", n.NEW_DTMF = "newDTMF", n.NEW_INFO = "newInfo", n.HOLD = "hold", n.UNHOLD = "unhold", n.MUTED = "muted", n.UNMUTED = "unmuted", n.REINVITE = "reinvite", n.UPDATE = "update", n.REFER = "refer", n.REPLACES = "replaces", n.SDP = "sdp", n.ICE_CANDIDATE = "icecandidate", n.GET_USER_MEDIA_FAILED = "getusermediafailed", n.PEER_CONNECTION_CREATE_OFFER_FAILED = "peerconnection:createofferfailed", n.PEER_CONNECTION_CREATE_ANSWER_FAILED = "peerconnection:createanswerfailed", n.PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED = "peerconnection:setlocaldescriptionfailed", n.PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED = "peerconnection:setremotedescriptionfailed", n.START_PRESENTATION = "presentation:start", n.STARTED_PRESENTATION = "presentation:started", n.END_PRESENTATION = "presentation:end", n.ENDED_PRESENTATION = "presentation:ended", n.FAILED_PRESENTATION = "presentation:failed", n.PEER_CONNECTION_CONFIRMED = "peerconnection:confirmed", n.PEER_CONNECTION_ONTRACK = "peerconnection:ontrack", n.ENDED_FROM_SERVER = "ended:fromserver", n.CALL_STATUS_CHANGED = "call-status-changed", n.REMOTE_TRACKS_CHANGED = "remote-tracks-changed", n.REMOTE_STREAMS_CHANGED = "remote-streams-changed", n))(S || {}), ut = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))(ut || {});
|
|
694
|
+
const me = [
|
|
638
695
|
"peerconnection",
|
|
639
696
|
"connecting",
|
|
640
697
|
"sending",
|
|
@@ -665,21 +722,21 @@ const ue = [
|
|
|
665
722
|
"peerconnection:createanswerfailed",
|
|
666
723
|
"peerconnection:setlocaldescriptionfailed",
|
|
667
724
|
"peerconnection:setremotedescriptionfailed"
|
|
668
|
-
],
|
|
725
|
+
], Tt = [
|
|
669
726
|
"peerconnection:confirmed",
|
|
670
727
|
"peerconnection:ontrack",
|
|
671
728
|
"ended:fromserver",
|
|
672
729
|
"call-status-changed",
|
|
673
730
|
"remote-tracks-changed",
|
|
674
731
|
"remote-streams-changed"
|
|
675
|
-
],
|
|
676
|
-
...
|
|
677
|
-
...
|
|
678
|
-
],
|
|
732
|
+
], Ne = [
|
|
733
|
+
...me,
|
|
734
|
+
...Tt
|
|
735
|
+
], Et = () => new R(Ne), St = (n, e) => {
|
|
679
736
|
n.getVideoTracks().forEach((s) => {
|
|
680
737
|
"contentHint" in s && s.contentHint !== e && (s.contentHint = e);
|
|
681
738
|
});
|
|
682
|
-
},
|
|
739
|
+
}, H = (n, {
|
|
683
740
|
directionVideo: e,
|
|
684
741
|
directionAudio: t,
|
|
685
742
|
contentHint: s
|
|
@@ -687,10 +744,10 @@ const ue = [
|
|
|
687
744
|
if (!n || e === "recvonly" && t === "recvonly")
|
|
688
745
|
return;
|
|
689
746
|
const i = t === "recvonly" ? [] : n.getAudioTracks(), r = e === "recvonly" ? [] : n.getVideoTracks(), a = [...i, ...r], o = new MediaStream(a);
|
|
690
|
-
return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" &&
|
|
747
|
+
return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" && St(o, s), o;
|
|
691
748
|
};
|
|
692
|
-
var
|
|
693
|
-
class
|
|
749
|
+
var Ae = /* @__PURE__ */ ((n) => (n.BYE = "Terminated", n.WEBRTC_ERROR = "WebRTC Error", n.CANCELED = "Canceled", n.REQUEST_TIMEOUT = "Request Timeout", n.REJECTED = "Rejected", n.REDIRECTED = "Redirected", n.UNAVAILABLE = "Unavailable", n.NOT_FOUND = "Not Found", n.ADDRESS_INCOMPLETE = "Address Incomplete", n.INCOMPATIBLE_SDP = "Incompatible SDP", n.BAD_MEDIA_DESCRIPTION = "Bad Media Description", n))(Ae || {});
|
|
750
|
+
class Ct {
|
|
694
751
|
events;
|
|
695
752
|
rtcSession;
|
|
696
753
|
disposers = /* @__PURE__ */ new Set();
|
|
@@ -717,27 +774,27 @@ class dt {
|
|
|
717
774
|
iceServers: a,
|
|
718
775
|
directionVideo: o,
|
|
719
776
|
directionAudio: c,
|
|
720
|
-
contentHint:
|
|
721
|
-
offerToReceiveAudio:
|
|
722
|
-
offerToReceiveVideo:
|
|
777
|
+
contentHint: l,
|
|
778
|
+
offerToReceiveAudio: T = !0,
|
|
779
|
+
offerToReceiveVideo: u = !0,
|
|
723
780
|
degradationPreference: E,
|
|
724
781
|
sendEncodings: m,
|
|
725
|
-
onAddedTransceiver:
|
|
726
|
-
}) => new Promise((
|
|
727
|
-
this.handleCall().then(
|
|
728
|
-
|
|
782
|
+
onAddedTransceiver: D
|
|
783
|
+
}) => new Promise((A, w) => {
|
|
784
|
+
this.handleCall().then(A).catch((X) => {
|
|
785
|
+
w(X);
|
|
729
786
|
}), this.rtcSession = e.call(t(s), {
|
|
730
|
-
mediaStream:
|
|
787
|
+
mediaStream: H(i, {
|
|
731
788
|
directionVideo: o,
|
|
732
789
|
directionAudio: c,
|
|
733
|
-
contentHint:
|
|
790
|
+
contentHint: l
|
|
734
791
|
}),
|
|
735
792
|
pcConfig: {
|
|
736
793
|
iceServers: a
|
|
737
794
|
},
|
|
738
795
|
rtcOfferConstraints: {
|
|
739
|
-
offerToReceiveAudio:
|
|
740
|
-
offerToReceiveVideo:
|
|
796
|
+
offerToReceiveAudio: T,
|
|
797
|
+
offerToReceiveVideo: u
|
|
741
798
|
},
|
|
742
799
|
// необходимо передавать в методе call, чтобы подписаться на события peerconnection,
|
|
743
800
|
// так как в методе call создается RTCSession
|
|
@@ -748,14 +805,14 @@ class dt {
|
|
|
748
805
|
directionAudio: c,
|
|
749
806
|
degradationPreference: E,
|
|
750
807
|
sendEncodings: m,
|
|
751
|
-
onAddedTransceiver:
|
|
808
|
+
onAddedTransceiver: D
|
|
752
809
|
});
|
|
753
810
|
});
|
|
754
811
|
async endCall() {
|
|
755
812
|
const { rtcSession: e } = this;
|
|
756
813
|
if (e && !e.isEnded())
|
|
757
814
|
return e.terminateAsync({
|
|
758
|
-
cause:
|
|
815
|
+
cause: Ae.CANCELED
|
|
759
816
|
}).finally(() => {
|
|
760
817
|
this.reset();
|
|
761
818
|
});
|
|
@@ -769,14 +826,14 @@ class dt {
|
|
|
769
826
|
directionAudio: a,
|
|
770
827
|
offerToReceiveAudio: o,
|
|
771
828
|
offerToReceiveVideo: c,
|
|
772
|
-
contentHint:
|
|
773
|
-
degradationPreference:
|
|
774
|
-
sendEncodings:
|
|
829
|
+
contentHint: l,
|
|
830
|
+
degradationPreference: T,
|
|
831
|
+
sendEncodings: u,
|
|
775
832
|
onAddedTransceiver: E
|
|
776
|
-
}) => new Promise((m,
|
|
833
|
+
}) => new Promise((m, D) => {
|
|
777
834
|
try {
|
|
778
|
-
this.rtcSession = e, this.subscribeToSessionEvents(e), this.handleCall().then(m).catch((
|
|
779
|
-
|
|
835
|
+
this.rtcSession = e, this.subscribeToSessionEvents(e), this.handleCall().then(m).catch((A) => {
|
|
836
|
+
D(A);
|
|
780
837
|
}), e.answer({
|
|
781
838
|
pcConfig: {
|
|
782
839
|
iceServers: i
|
|
@@ -785,26 +842,26 @@ class dt {
|
|
|
785
842
|
offerToReceiveAudio: o,
|
|
786
843
|
offerToReceiveVideo: c
|
|
787
844
|
},
|
|
788
|
-
mediaStream:
|
|
845
|
+
mediaStream: H(t, {
|
|
789
846
|
directionVideo: r,
|
|
790
847
|
directionAudio: a,
|
|
791
|
-
contentHint:
|
|
848
|
+
contentHint: l
|
|
792
849
|
}),
|
|
793
850
|
extraHeaders: s,
|
|
794
851
|
directionVideo: r,
|
|
795
852
|
directionAudio: a,
|
|
796
|
-
degradationPreference:
|
|
797
|
-
sendEncodings:
|
|
853
|
+
degradationPreference: T,
|
|
854
|
+
sendEncodings: u,
|
|
798
855
|
onAddedTransceiver: E
|
|
799
856
|
});
|
|
800
|
-
} catch (
|
|
801
|
-
|
|
857
|
+
} catch (A) {
|
|
858
|
+
D(A);
|
|
802
859
|
}
|
|
803
860
|
});
|
|
804
861
|
async replaceMediaStream(e, t) {
|
|
805
862
|
if (!this.rtcSession)
|
|
806
863
|
throw new Error("No rtcSession established");
|
|
807
|
-
const { contentHint: s } = t ?? {}, i =
|
|
864
|
+
const { contentHint: s } = t ?? {}, i = H(e, { contentHint: s });
|
|
808
865
|
if (i === void 0)
|
|
809
866
|
throw new Error("No preparedMediaStream");
|
|
810
867
|
return this.rtcSession.replaceMediaStream(i, t);
|
|
@@ -816,33 +873,33 @@ class dt {
|
|
|
816
873
|
}
|
|
817
874
|
handleCall = async () => new Promise((e, t) => {
|
|
818
875
|
const s = () => {
|
|
819
|
-
this.events.on(S.PEER_CONNECTION,
|
|
876
|
+
this.events.on(S.PEER_CONNECTION, l), this.events.on(S.CONFIRMED, T);
|
|
820
877
|
}, i = () => {
|
|
821
|
-
this.events.off(S.PEER_CONNECTION,
|
|
878
|
+
this.events.off(S.PEER_CONNECTION, l), this.events.off(S.CONFIRMED, T);
|
|
822
879
|
}, r = () => {
|
|
823
880
|
this.events.on(S.FAILED, o), this.events.on(S.ENDED, o);
|
|
824
881
|
}, a = () => {
|
|
825
882
|
this.events.off(S.FAILED, o), this.events.off(S.ENDED, o);
|
|
826
|
-
}, o = (
|
|
827
|
-
i(), a(), t(
|
|
883
|
+
}, o = (u) => {
|
|
884
|
+
i(), a(), t(u);
|
|
828
885
|
};
|
|
829
886
|
let c;
|
|
830
|
-
const
|
|
831
|
-
c =
|
|
887
|
+
const l = ({ peerconnection: u }) => {
|
|
888
|
+
c = u;
|
|
832
889
|
const E = (m) => {
|
|
833
890
|
this.events.trigger(S.PEER_CONNECTION_ONTRACK, m);
|
|
834
891
|
};
|
|
835
|
-
|
|
836
|
-
|
|
892
|
+
u.addEventListener("track", E), this.disposers.add(() => {
|
|
893
|
+
u.removeEventListener("track", E);
|
|
837
894
|
});
|
|
838
|
-
},
|
|
895
|
+
}, T = () => {
|
|
839
896
|
c !== void 0 && this.events.trigger(S.PEER_CONNECTION_CONFIRMED, c), i(), a(), e(c);
|
|
840
897
|
};
|
|
841
898
|
s(), r();
|
|
842
899
|
});
|
|
843
900
|
subscribeToSessionEvents(e) {
|
|
844
901
|
this.events.eachTriggers((t, s) => {
|
|
845
|
-
const i =
|
|
902
|
+
const i = me.find((r) => r === s);
|
|
846
903
|
i && (e.on(i, t), this.disposers.add(() => {
|
|
847
904
|
e.off(i, t);
|
|
848
905
|
}));
|
|
@@ -861,7 +918,7 @@ class dt {
|
|
|
861
918
|
delete this.rtcSession, this.unsubscribeFromSessionEvents(), this.onReset();
|
|
862
919
|
};
|
|
863
920
|
}
|
|
864
|
-
class
|
|
921
|
+
class pt {
|
|
865
922
|
config;
|
|
866
923
|
tools;
|
|
867
924
|
connection;
|
|
@@ -910,18 +967,18 @@ class ht {
|
|
|
910
967
|
return this.connection.addTransceiver(e, t);
|
|
911
968
|
}
|
|
912
969
|
}
|
|
913
|
-
const
|
|
914
|
-
const t =
|
|
970
|
+
const Re = (n) => n.getSettings(), mt = (n, e) => {
|
|
971
|
+
const t = Re(n);
|
|
915
972
|
let s = e;
|
|
916
973
|
s ??= n.label;
|
|
917
974
|
let i = t?.msid;
|
|
918
975
|
return i ??= s, i ??= n.id, i;
|
|
919
|
-
},
|
|
920
|
-
const t =
|
|
976
|
+
}, Nt = (n, e) => {
|
|
977
|
+
const t = Re(n);
|
|
921
978
|
let s = e;
|
|
922
979
|
return s ??= t?.msid, s ??= n.label, (s && s.length > 0 ? s : void 0) ?? n.id;
|
|
923
980
|
};
|
|
924
|
-
class
|
|
981
|
+
class se {
|
|
925
982
|
participantGroups = /* @__PURE__ */ new Map();
|
|
926
983
|
trackToGroup = /* @__PURE__ */ new Map();
|
|
927
984
|
trackDisposers = /* @__PURE__ */ new Map();
|
|
@@ -938,28 +995,28 @@ class Z {
|
|
|
938
995
|
onRemoved: t,
|
|
939
996
|
streamHint: s
|
|
940
997
|
} = {}) {
|
|
941
|
-
const i =
|
|
998
|
+
const i = Nt(e, s), r = mt(e, s);
|
|
942
999
|
if (this.trackToGroup.has(e.id))
|
|
943
1000
|
return { isAddedTrack: !1, isAddedStream: !1 };
|
|
944
1001
|
const a = this.getParticipantGroups(i), o = a.get(r), c = !o;
|
|
945
|
-
let
|
|
946
|
-
|
|
1002
|
+
let l = o;
|
|
1003
|
+
l || (l = {
|
|
947
1004
|
participantId: i,
|
|
948
1005
|
groupId: r,
|
|
949
1006
|
stream: new MediaStream(),
|
|
950
1007
|
trackIds: /* @__PURE__ */ new Set()
|
|
951
|
-
}, a.set(r,
|
|
952
|
-
const
|
|
1008
|
+
}, a.set(r, l)), l.stream.addTrack(e), l.trackIds.add(e.id), this.trackToGroup.set(e.id, { participantId: i, groupId: r });
|
|
1009
|
+
const T = () => {
|
|
953
1010
|
this.disposeTrackListener(e.id);
|
|
954
|
-
const
|
|
955
|
-
|
|
1011
|
+
const u = this.removeTrack(e.id);
|
|
1012
|
+
u.isRemovedTrack && t?.({
|
|
956
1013
|
participantId: i,
|
|
957
1014
|
trackId: e.id,
|
|
958
|
-
isRemovedStream:
|
|
1015
|
+
isRemovedStream: u.isRemovedStream
|
|
959
1016
|
});
|
|
960
1017
|
};
|
|
961
|
-
return e.addEventListener("ended",
|
|
962
|
-
e.removeEventListener("ended",
|
|
1018
|
+
return e.addEventListener("ended", T), this.trackDisposers.set(e.id, () => {
|
|
1019
|
+
e.removeEventListener("ended", T);
|
|
963
1020
|
}), { isAddedTrack: !0, isAddedStream: c, participantId: i };
|
|
964
1021
|
}
|
|
965
1022
|
removeTrack(e) {
|
|
@@ -970,7 +1027,7 @@ class Z {
|
|
|
970
1027
|
const { participantId: s, groupId: i } = t, r = this.participantGroups.get(s), a = r?.get(i);
|
|
971
1028
|
if (!a)
|
|
972
1029
|
return this.trackToGroup.delete(e), { isRemovedTrack: !1, isRemovedStream: !1 };
|
|
973
|
-
const o = a.stream.getTracks().find((
|
|
1030
|
+
const o = a.stream.getTracks().find((l) => l.id === e);
|
|
974
1031
|
o && a.stream.removeTrack(o), a.trackIds.delete(e), this.trackToGroup.delete(e);
|
|
975
1032
|
const c = a.trackIds.size === 0;
|
|
976
1033
|
return c && (r?.delete(i), r?.size === 0 && this.participantGroups.delete(s)), { isRemovedTrack: !0, isRemovedStream: c };
|
|
@@ -982,8 +1039,8 @@ class Z {
|
|
|
982
1039
|
let i = !1;
|
|
983
1040
|
return [...s.values()].forEach((a) => {
|
|
984
1041
|
[...a.trackIds].filter((c) => !t.includes(c)).forEach((c) => {
|
|
985
|
-
const
|
|
986
|
-
i ||=
|
|
1042
|
+
const l = this.removeTrack(c);
|
|
1043
|
+
i ||= l.isRemovedTrack;
|
|
987
1044
|
});
|
|
988
1045
|
}), i;
|
|
989
1046
|
}
|
|
@@ -1006,16 +1063,16 @@ class Z {
|
|
|
1006
1063
|
return this.participantGroups.set(e, s), s;
|
|
1007
1064
|
}
|
|
1008
1065
|
}
|
|
1009
|
-
const
|
|
1066
|
+
const J = {
|
|
1010
1067
|
type: "participant"
|
|
1011
|
-
},
|
|
1068
|
+
}, At = {
|
|
1012
1069
|
type: "spectator_synthetic"
|
|
1013
|
-
},
|
|
1070
|
+
}, Rt = (n) => ({
|
|
1014
1071
|
type: "spectator",
|
|
1015
1072
|
recvParams: n
|
|
1016
1073
|
});
|
|
1017
|
-
class
|
|
1018
|
-
role =
|
|
1074
|
+
class O {
|
|
1075
|
+
role = J;
|
|
1019
1076
|
onRoleChanged;
|
|
1020
1077
|
constructor(e) {
|
|
1021
1078
|
this.onRoleChanged = e;
|
|
@@ -1033,13 +1090,13 @@ class _ {
|
|
|
1033
1090
|
return this.role;
|
|
1034
1091
|
}
|
|
1035
1092
|
setCallRoleParticipant() {
|
|
1036
|
-
this.changeRole(
|
|
1093
|
+
this.changeRole(J);
|
|
1037
1094
|
}
|
|
1038
1095
|
setCallRoleSpectatorSynthetic() {
|
|
1039
|
-
this.changeRole(
|
|
1096
|
+
this.changeRole(At);
|
|
1040
1097
|
}
|
|
1041
1098
|
setCallRoleSpectator(e) {
|
|
1042
|
-
this.changeRole(
|
|
1099
|
+
this.changeRole(Rt(e));
|
|
1043
1100
|
}
|
|
1044
1101
|
changeRole(e) {
|
|
1045
1102
|
const t = this.role;
|
|
@@ -1047,69 +1104,118 @@ class _ {
|
|
|
1047
1104
|
this.setRole(e);
|
|
1048
1105
|
return;
|
|
1049
1106
|
}
|
|
1050
|
-
|
|
1107
|
+
O.hasSpectator(e) && O.hasSpectator(t) && t.recvParams.audioId !== e.recvParams.audioId && this.setRole(e);
|
|
1051
1108
|
}
|
|
1052
1109
|
reset() {
|
|
1053
|
-
this.role =
|
|
1110
|
+
this.role = J;
|
|
1054
1111
|
}
|
|
1055
1112
|
hasParticipant() {
|
|
1056
|
-
return
|
|
1113
|
+
return O.hasParticipant(this.role);
|
|
1057
1114
|
}
|
|
1058
1115
|
hasSpectatorSynthetic() {
|
|
1059
|
-
return
|
|
1116
|
+
return O.hasSpectatorSynthetic(this.role);
|
|
1060
1117
|
}
|
|
1061
1118
|
hasSpectator() {
|
|
1062
|
-
return
|
|
1119
|
+
return O.hasSpectator(this.role);
|
|
1063
1120
|
}
|
|
1064
1121
|
setRole(e) {
|
|
1065
1122
|
const t = this.role;
|
|
1066
1123
|
this.role = e, this.onRoleChanged?.({ previous: t, next: e });
|
|
1067
1124
|
}
|
|
1068
1125
|
}
|
|
1069
|
-
const
|
|
1070
|
-
|
|
1126
|
+
const It = (n, e) => {
|
|
1127
|
+
if (!n || !e)
|
|
1128
|
+
return n === e;
|
|
1129
|
+
const t = n.mainStream?.id, s = e.mainStream?.id, i = n.contentedStream?.id, r = e.contentedStream?.id;
|
|
1130
|
+
return t === s && i === r;
|
|
1131
|
+
};
|
|
1132
|
+
class vt {
|
|
1133
|
+
lastEmittedStreams;
|
|
1134
|
+
/**
|
|
1135
|
+
* Проверяет, изменились ли streams с последнего сохраненного состояния
|
|
1136
|
+
* @param streams - Текущие streams для проверки
|
|
1137
|
+
* @returns true, если streams изменились
|
|
1138
|
+
*/
|
|
1139
|
+
hasChanged(e) {
|
|
1140
|
+
return !It(this.lastEmittedStreams, e);
|
|
1141
|
+
}
|
|
1142
|
+
/**
|
|
1143
|
+
* Сохраняет текущие streams как последнее эмитнутое состояние
|
|
1144
|
+
* @param streams - Streams для сохранения
|
|
1145
|
+
*/
|
|
1146
|
+
updateLastEmittedStreams(e) {
|
|
1147
|
+
this.lastEmittedStreams = e;
|
|
1148
|
+
}
|
|
1149
|
+
/**
|
|
1150
|
+
* Получает последние эмитнутые streams
|
|
1151
|
+
* @returns Последние сохраненные streams или undefined
|
|
1152
|
+
*/
|
|
1153
|
+
getLastEmittedStreams() {
|
|
1154
|
+
return this.lastEmittedStreams;
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Сбрасывает состояние трекера
|
|
1158
|
+
*/
|
|
1159
|
+
reset() {
|
|
1160
|
+
this.lastEmittedStreams = void 0;
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
const ft = "default", Mt = "dual", ie = (n) => [...n.getTracks()].some((e) => e.label.includes(Mt));
|
|
1164
|
+
class _t {
|
|
1071
1165
|
mainRemoteStreamsManager;
|
|
1072
1166
|
recvRemoteStreamsManager;
|
|
1073
1167
|
constructor(e, t) {
|
|
1074
1168
|
this.mainRemoteStreamsManager = e, this.recvRemoteStreamsManager = t;
|
|
1075
1169
|
}
|
|
1076
|
-
getActiveStreamsManagerTools(
|
|
1077
|
-
|
|
1170
|
+
getActiveStreamsManagerTools({
|
|
1171
|
+
isSpectator: e,
|
|
1172
|
+
stateInfo: t
|
|
1173
|
+
}) {
|
|
1174
|
+
return e ? this.getRecvRemoteStreamsManagerTools({ stateInfo: t }) : this.getMainRemoteStreamsManagerTools({ stateInfo: t });
|
|
1078
1175
|
}
|
|
1079
|
-
getMainRemoteStreamsManagerTools(
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1176
|
+
getMainRemoteStreamsManagerTools({
|
|
1177
|
+
stateInfo: e
|
|
1178
|
+
}) {
|
|
1179
|
+
const t = this.mainRemoteStreamsManager;
|
|
1180
|
+
return { manager: t, getRemoteStreams: () => {
|
|
1181
|
+
const i = t.getStreams(), r = i.find((o) => !ie(o)), a = e.isAvailable ? i.find((o) => ie(o)) : void 0;
|
|
1182
|
+
return { mainStream: r, contentedStream: a };
|
|
1084
1183
|
} };
|
|
1085
1184
|
}
|
|
1086
|
-
getRecvRemoteStreamsManagerTools(
|
|
1087
|
-
|
|
1088
|
-
|
|
1185
|
+
getRecvRemoteStreamsManagerTools({
|
|
1186
|
+
stateInfo: e
|
|
1187
|
+
}) {
|
|
1188
|
+
const t = this.recvRemoteStreamsManager;
|
|
1189
|
+
return { manager: t, getRemoteStreams: () => {
|
|
1190
|
+
const i = t.getStreams(ft);
|
|
1191
|
+
return { mainStream: i[0], contentedStream: e.isAvailable ? i[1] : void 0 };
|
|
1192
|
+
} };
|
|
1089
1193
|
}
|
|
1090
1194
|
}
|
|
1091
|
-
const
|
|
1092
|
-
class
|
|
1195
|
+
const re = (n) => n.streams[0]?.id;
|
|
1196
|
+
class bt {
|
|
1093
1197
|
events;
|
|
1094
1198
|
callStateMachine;
|
|
1095
1199
|
isPendingCall = !1;
|
|
1096
1200
|
isPendingAnswer = !1;
|
|
1097
1201
|
rtcSession;
|
|
1098
1202
|
conferenceStateManager;
|
|
1099
|
-
mainRemoteStreamsManager = new
|
|
1100
|
-
recvRemoteStreamsManager = new
|
|
1203
|
+
mainRemoteStreamsManager = new se();
|
|
1204
|
+
recvRemoteStreamsManager = new se();
|
|
1101
1205
|
streamsManagerProvider;
|
|
1102
|
-
|
|
1206
|
+
contentedStreamManager;
|
|
1207
|
+
roleManager = new O((e) => {
|
|
1103
1208
|
this.onRoleChanged(e);
|
|
1104
1209
|
});
|
|
1105
1210
|
mcuSession;
|
|
1106
1211
|
recvSession;
|
|
1107
1212
|
disposeRecvSessionTrackListener;
|
|
1108
|
-
|
|
1109
|
-
|
|
1213
|
+
streamsChangeTracker = new vt();
|
|
1214
|
+
constructor(e, t) {
|
|
1215
|
+
this.conferenceStateManager = e, this.contentedStreamManager = t, this.events = Et(), this.mcuSession = new Ct(this.events, { onReset: this.reset }), this.callStateMachine = new gt(this.events), this.streamsManagerProvider = new _t(
|
|
1110
1216
|
this.mainRemoteStreamsManager,
|
|
1111
1217
|
this.recvRemoteStreamsManager
|
|
1112
|
-
), this.subscribeCallStatusChange(), this.subscribeMcuRemoteTrackEvents();
|
|
1218
|
+
), this.subscribeCallStatusChange(), this.subscribeMcuRemoteTrackEvents(), this.subscribeContentedStreamEvents();
|
|
1113
1219
|
}
|
|
1114
1220
|
get callActor() {
|
|
1115
1221
|
return this.callStateMachine.actorRef;
|
|
@@ -1127,6 +1233,9 @@ class Ct {
|
|
|
1127
1233
|
getStreamsManagerProvider() {
|
|
1128
1234
|
return this.streamsManagerProvider;
|
|
1129
1235
|
}
|
|
1236
|
+
getContentedStreamManager() {
|
|
1237
|
+
return this.contentedStreamManager;
|
|
1238
|
+
}
|
|
1130
1239
|
getEstablishedRTCSession = () => this.mcuSession.getEstablishedRTCSession();
|
|
1131
1240
|
on(e, t) {
|
|
1132
1241
|
return this.events.on(e, t);
|
|
@@ -1173,6 +1282,7 @@ class Ct {
|
|
|
1173
1282
|
const { getRemoteStreams: e } = this.getActiveStreamsManagerTools();
|
|
1174
1283
|
return e();
|
|
1175
1284
|
}
|
|
1285
|
+
getActivePeerConnection = () => this.roleManager.hasSpectator() ? this.recvSession?.peerConnection : this.mcuSession.connection;
|
|
1176
1286
|
setCallRoleParticipant() {
|
|
1177
1287
|
this.roleManager.setCallRoleParticipant();
|
|
1178
1288
|
}
|
|
@@ -1189,7 +1299,7 @@ class Ct {
|
|
|
1189
1299
|
return this.mcuSession.restartIce(e);
|
|
1190
1300
|
}
|
|
1191
1301
|
reset = () => {
|
|
1192
|
-
this.mainRemoteStreamsManager.reset(), this.conferenceStateManager.updateState({ number: void 0, answer: !1 }), this.roleManager.reset(), this.recvRemoteStreamsManager.reset(), this.stopRecvSession();
|
|
1302
|
+
this.mainRemoteStreamsManager.reset(), this.conferenceStateManager.updateState({ number: void 0, answer: !1 }), this.roleManager.reset(), this.recvRemoteStreamsManager.reset(), this.stopRecvSession(), this.streamsChangeTracker.reset();
|
|
1193
1303
|
};
|
|
1194
1304
|
subscribeCallStatusChange() {
|
|
1195
1305
|
let { isCallActive: e } = this;
|
|
@@ -1204,7 +1314,7 @@ class Ct {
|
|
|
1204
1314
|
}
|
|
1205
1315
|
subscribeMcuRemoteTrackEvents() {
|
|
1206
1316
|
this.on(S.PEER_CONNECTION_ONTRACK, (e) => {
|
|
1207
|
-
this.addRemoteTrack(this.mainRemoteStreamsManager, e.track,
|
|
1317
|
+
this.addRemoteTrack(this.mainRemoteStreamsManager, e.track, re(e));
|
|
1208
1318
|
});
|
|
1209
1319
|
}
|
|
1210
1320
|
addRemoteTrack(e, t, s) {
|
|
@@ -1247,16 +1357,17 @@ class Ct {
|
|
|
1247
1357
|
});
|
|
1248
1358
|
}
|
|
1249
1359
|
emitEventChangedRemoteStreams(e) {
|
|
1250
|
-
this.events.trigger(S.REMOTE_STREAMS_CHANGED, { streams: e });
|
|
1360
|
+
this.streamsChangeTracker.hasChanged(e) && (this.streamsChangeTracker.updateLastEmittedStreams(e), this.events.trigger(S.REMOTE_STREAMS_CHANGED, { streams: e }));
|
|
1251
1361
|
}
|
|
1252
1362
|
getActiveStreamsManagerTools() {
|
|
1253
|
-
return this.streamsManagerProvider.getActiveStreamsManagerTools(
|
|
1254
|
-
this.roleManager.hasSpectator()
|
|
1255
|
-
|
|
1363
|
+
return this.streamsManagerProvider.getActiveStreamsManagerTools({
|
|
1364
|
+
isSpectator: this.roleManager.hasSpectator(),
|
|
1365
|
+
stateInfo: this.contentedStreamManager.getStateInfo()
|
|
1366
|
+
});
|
|
1256
1367
|
}
|
|
1257
1368
|
attachRecvSessionTracks(e) {
|
|
1258
1369
|
const { peerConnection: t } = e, s = (i) => {
|
|
1259
|
-
this.addRemoteTrack(this.recvRemoteStreamsManager, i.track,
|
|
1370
|
+
this.addRemoteTrack(this.recvRemoteStreamsManager, i.track, re(i));
|
|
1260
1371
|
};
|
|
1261
1372
|
t.addEventListener("track", s), this.disposeRecvSessionTrackListener = () => {
|
|
1262
1373
|
t.removeEventListener("track", s);
|
|
@@ -1270,7 +1381,7 @@ class Ct {
|
|
|
1270
1381
|
const i = {
|
|
1271
1382
|
quality: "high",
|
|
1272
1383
|
audioChannel: e
|
|
1273
|
-
}, r = new
|
|
1384
|
+
}, r = new pt(i, { sendOffer: t });
|
|
1274
1385
|
this.recvSession = r, this.recvRemoteStreamsManager.reset(), this.attachRecvSessionTracks(r), r.call(s).catch(() => {
|
|
1275
1386
|
this.stopRecvSession();
|
|
1276
1387
|
});
|
|
@@ -1282,45 +1393,52 @@ class Ct {
|
|
|
1282
1393
|
previous: e,
|
|
1283
1394
|
next: t
|
|
1284
1395
|
}) => {
|
|
1285
|
-
if (
|
|
1396
|
+
if (O.hasSpectator(e) && !O.hasSpectator(t) && (this.stopRecvSession(), this.emitEventChangedRemoteStreams(this.getRemoteStreams())), O.hasSpectator(t)) {
|
|
1286
1397
|
const s = t.recvParams;
|
|
1287
1398
|
this.startRecvSession(s.audioId, s.sendOffer);
|
|
1288
1399
|
}
|
|
1289
1400
|
};
|
|
1401
|
+
subscribeContentedStreamEvents() {
|
|
1402
|
+
this.contentedStreamManager.on("available", () => {
|
|
1403
|
+
this.emitEventChangedRemoteStreams(this.getRemoteStreams());
|
|
1404
|
+
}), this.contentedStreamManager.on("not-available", () => {
|
|
1405
|
+
this.emitEventChangedRemoteStreams(this.getRemoteStreams());
|
|
1406
|
+
});
|
|
1407
|
+
}
|
|
1290
1408
|
}
|
|
1291
|
-
const
|
|
1409
|
+
const Ot = (n, e) => (n.degradationPreference = e.degradationPreference, n), Dt = (n, e) => {
|
|
1292
1410
|
n.encodings ??= [];
|
|
1293
1411
|
for (let t = n.encodings.length; t < e; t += 1)
|
|
1294
1412
|
n.encodings.push({});
|
|
1295
1413
|
return n;
|
|
1296
|
-
},
|
|
1297
|
-
if (
|
|
1414
|
+
}, Ie = (n) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== n, Pt = Ie(), yt = (n, e) => {
|
|
1415
|
+
if (Pt(n, e))
|
|
1298
1416
|
return n;
|
|
1299
|
-
},
|
|
1300
|
-
const t = n.maxBitrate, s =
|
|
1417
|
+
}, Lt = (n, e) => {
|
|
1418
|
+
const t = n.maxBitrate, s = yt(e, t);
|
|
1301
1419
|
return s !== void 0 && (n.maxBitrate = s), n;
|
|
1302
|
-
},
|
|
1303
|
-
|
|
1304
|
-
),
|
|
1305
|
-
const t = n === void 0 ? void 0 : Math.max(n,
|
|
1306
|
-
if (t !== void 0 &&
|
|
1420
|
+
}, ve = 1, wt = Ie(
|
|
1421
|
+
ve
|
|
1422
|
+
), Ut = (n, e) => {
|
|
1423
|
+
const t = n === void 0 ? void 0 : Math.max(n, ve);
|
|
1424
|
+
if (t !== void 0 && wt(
|
|
1307
1425
|
t,
|
|
1308
1426
|
e
|
|
1309
1427
|
))
|
|
1310
1428
|
return t;
|
|
1311
|
-
},
|
|
1312
|
-
const t = n.scaleResolutionDownBy, s =
|
|
1429
|
+
}, Ft = (n, e) => {
|
|
1430
|
+
const t = n.scaleResolutionDownBy, s = Ut(
|
|
1313
1431
|
e,
|
|
1314
1432
|
t
|
|
1315
1433
|
);
|
|
1316
1434
|
return s !== void 0 && (n.scaleResolutionDownBy = s), n;
|
|
1317
|
-
},
|
|
1435
|
+
}, Bt = (n, e) => {
|
|
1318
1436
|
const t = e.encodings?.length ?? 0;
|
|
1319
|
-
return
|
|
1437
|
+
return Dt(n, t), n.encodings.forEach((s, i) => {
|
|
1320
1438
|
const r = (e?.encodings ?? [])[i], a = r?.maxBitrate, o = r?.scaleResolutionDownBy;
|
|
1321
|
-
|
|
1439
|
+
Lt(s, a), Ft(s, o);
|
|
1322
1440
|
}), n;
|
|
1323
|
-
},
|
|
1441
|
+
}, kt = (n, e) => {
|
|
1324
1442
|
if (n.codecs?.length !== e.codecs?.length)
|
|
1325
1443
|
return !0;
|
|
1326
1444
|
for (let t = 0; t < (n.codecs?.length ?? 0); t++)
|
|
@@ -1337,15 +1455,15 @@ const mt = (n, e) => (n.degradationPreference = e.degradationPreference, n), Nt
|
|
|
1337
1455
|
if (JSON.stringify(n.encodings[t]) !== JSON.stringify(e.encodings[t]))
|
|
1338
1456
|
return !0;
|
|
1339
1457
|
return n.rtcp?.cname !== e.rtcp?.cname || n.rtcp?.reducedSize !== e.rtcp?.reducedSize || n.degradationPreference !== e.degradationPreference;
|
|
1340
|
-
},
|
|
1458
|
+
}, $t = async (n, e) => {
|
|
1341
1459
|
const t = n.getParameters(), s = JSON.parse(
|
|
1342
1460
|
JSON.stringify(t)
|
|
1343
1461
|
);
|
|
1344
|
-
|
|
1345
|
-
const i =
|
|
1462
|
+
Bt(t, e), Ot(t, e);
|
|
1463
|
+
const i = kt(s, t);
|
|
1346
1464
|
return i && await n.setParameters(t), { parameters: t, isChanged: i };
|
|
1347
|
-
},
|
|
1348
|
-
const { isChanged: s, parameters: i } = await
|
|
1465
|
+
}, fe = async (n, e, t) => {
|
|
1466
|
+
const { isChanged: s, parameters: i } = await $t(n, {
|
|
1349
1467
|
encodings: [
|
|
1350
1468
|
{
|
|
1351
1469
|
scaleResolutionDownBy: e.scaleResolutionDownBy,
|
|
@@ -1354,21 +1472,21 @@ const mt = (n, e) => (n.degradationPreference = e.degradationPreference, n), Nt
|
|
|
1354
1472
|
]
|
|
1355
1473
|
});
|
|
1356
1474
|
return s && t && t(i), { isChanged: s, parameters: i };
|
|
1357
|
-
},
|
|
1358
|
-
const s =
|
|
1475
|
+
}, Gt = (n, e) => n.find((t) => t.track !== null && e.getTracks().includes(t.track)), Vt = async (n, e, t) => {
|
|
1476
|
+
const s = Gt(n, e);
|
|
1359
1477
|
if (s)
|
|
1360
|
-
return
|
|
1478
|
+
return fe(s, { maxBitrate: t });
|
|
1361
1479
|
};
|
|
1362
1480
|
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 || {});
|
|
1363
|
-
const
|
|
1481
|
+
const Me = [
|
|
1364
1482
|
"presentation:start",
|
|
1365
1483
|
"presentation:started",
|
|
1366
1484
|
"presentation:end",
|
|
1367
1485
|
"presentation:ended",
|
|
1368
1486
|
"presentation:failed"
|
|
1369
|
-
],
|
|
1370
|
-
var
|
|
1371
|
-
const
|
|
1487
|
+
], qt = () => new R(Me);
|
|
1488
|
+
var Ht = /* @__PURE__ */ ((n) => (n.IDLE = "presentation:idle", n.STARTING = "presentation:starting", n.ACTIVE = "presentation:active", n.STOPPING = "presentation:stopping", n.FAILED = "presentation:failed", n))(Ht || {});
|
|
1489
|
+
const Wt = G({
|
|
1372
1490
|
types: {
|
|
1373
1491
|
context: {},
|
|
1374
1492
|
events: {}
|
|
@@ -1380,10 +1498,10 @@ const Lt = $({
|
|
|
1380
1498
|
logStateChange: (n, e) => {
|
|
1381
1499
|
d("PresentationStateMachine state changed", e.state);
|
|
1382
1500
|
},
|
|
1383
|
-
setError:
|
|
1501
|
+
setError: M(({ event: n }) => "error" in n && n.error !== void 0 ? {
|
|
1384
1502
|
lastError: n.error instanceof Error ? n.error : new Error(JSON.stringify(n.error))
|
|
1385
1503
|
} : { lastError: void 0 }),
|
|
1386
|
-
clearError:
|
|
1504
|
+
clearError: M({ lastError: void 0 })
|
|
1387
1505
|
}
|
|
1388
1506
|
}).createMachine({
|
|
1389
1507
|
id: "presentation",
|
|
@@ -1693,9 +1811,9 @@ const Lt = $({
|
|
|
1693
1811
|
}
|
|
1694
1812
|
}
|
|
1695
1813
|
});
|
|
1696
|
-
class
|
|
1814
|
+
class xt extends V {
|
|
1697
1815
|
constructor(e) {
|
|
1698
|
-
super(
|
|
1816
|
+
super(Wt), this.subscribeCallEvents(e);
|
|
1699
1817
|
}
|
|
1700
1818
|
get isIdle() {
|
|
1701
1819
|
return this.state === "presentation:idle";
|
|
@@ -1765,8 +1883,8 @@ class Ut extends q {
|
|
|
1765
1883
|
);
|
|
1766
1884
|
}
|
|
1767
1885
|
}
|
|
1768
|
-
const
|
|
1769
|
-
class
|
|
1886
|
+
const Qt = 1, di = (n) => je(n);
|
|
1887
|
+
class Yt {
|
|
1770
1888
|
events;
|
|
1771
1889
|
presentationStateMachine;
|
|
1772
1890
|
promisePendingStartPresentation;
|
|
@@ -1779,7 +1897,7 @@ class kt {
|
|
|
1779
1897
|
callManager: e,
|
|
1780
1898
|
maxBitrate: t
|
|
1781
1899
|
}) {
|
|
1782
|
-
this.callManager = e, this.maxBitrate = t, this.events =
|
|
1900
|
+
this.callManager = e, this.maxBitrate = t, this.events = qt(), this.presentationStateMachine = new xt(this.callManager.events), this.subscribe();
|
|
1783
1901
|
}
|
|
1784
1902
|
get presentationActor() {
|
|
1785
1903
|
return this.presentationStateMachine.actorRef;
|
|
@@ -1877,7 +1995,7 @@ class kt {
|
|
|
1877
1995
|
stream: s,
|
|
1878
1996
|
presentationOptions: i,
|
|
1879
1997
|
options: r = {
|
|
1880
|
-
callLimit:
|
|
1998
|
+
callLimit: Qt
|
|
1881
1999
|
}
|
|
1882
2000
|
}) {
|
|
1883
2001
|
const a = async () => this.sendPresentation(
|
|
@@ -1886,7 +2004,7 @@ class kt {
|
|
|
1886
2004
|
s,
|
|
1887
2005
|
i
|
|
1888
2006
|
), o = () => !!this.streamPresentationCurrent;
|
|
1889
|
-
return this.cancelableSendPresentationWithRepeatedCalls =
|
|
2007
|
+
return this.cancelableSendPresentationWithRepeatedCalls = Te({
|
|
1890
2008
|
targetFunction: a,
|
|
1891
2009
|
isComplete: o,
|
|
1892
2010
|
isRejectAsValid: !0,
|
|
@@ -1901,20 +2019,20 @@ class kt {
|
|
|
1901
2019
|
sendEncodings: o,
|
|
1902
2020
|
onAddedTransceiver: c
|
|
1903
2021
|
}) {
|
|
1904
|
-
const
|
|
1905
|
-
if (
|
|
2022
|
+
const l = H(s, { contentHint: r });
|
|
2023
|
+
if (l === void 0)
|
|
1906
2024
|
throw new Error("No streamPresentationTarget");
|
|
1907
|
-
this.streamPresentationCurrent =
|
|
1908
|
-
const
|
|
2025
|
+
this.streamPresentationCurrent = l;
|
|
2026
|
+
const T = e().then(async () => t.startPresentation(l, i, {
|
|
1909
2027
|
degradationPreference: a,
|
|
1910
2028
|
sendEncodings: o,
|
|
1911
2029
|
onAddedTransceiver: c
|
|
1912
|
-
})).then(this.setMaxBitrate).then(() => s).catch((
|
|
2030
|
+
})).then(this.setMaxBitrate).then(() => s).catch((u) => {
|
|
1913
2031
|
this.removeStreamPresentationCurrent();
|
|
1914
|
-
const E =
|
|
1915
|
-
throw this.events.trigger(P.FAILED_PRESENTATION, E),
|
|
2032
|
+
const E = u instanceof Error ? u : new Error(String(u));
|
|
2033
|
+
throw this.events.trigger(P.FAILED_PRESENTATION, E), u;
|
|
1916
2034
|
});
|
|
1917
|
-
return this.promisePendingStartPresentation =
|
|
2035
|
+
return this.promisePendingStartPresentation = T, T.finally(() => {
|
|
1918
2036
|
this.promisePendingStartPresentation = void 0;
|
|
1919
2037
|
});
|
|
1920
2038
|
}
|
|
@@ -1923,7 +2041,7 @@ class kt {
|
|
|
1923
2041
|
if (!e || !t || s === void 0)
|
|
1924
2042
|
return;
|
|
1925
2043
|
const i = e.getSenders();
|
|
1926
|
-
await
|
|
2044
|
+
await Vt(i, t, s);
|
|
1927
2045
|
};
|
|
1928
2046
|
getRtcSessionProtected = () => {
|
|
1929
2047
|
const e = this.callManager.getEstablishedRTCSession();
|
|
@@ -1944,7 +2062,7 @@ class kt {
|
|
|
1944
2062
|
delete this.streamPresentationCurrent;
|
|
1945
2063
|
}
|
|
1946
2064
|
}
|
|
1947
|
-
class
|
|
2065
|
+
class Xt {
|
|
1948
2066
|
data;
|
|
1949
2067
|
getUa;
|
|
1950
2068
|
constructor(e) {
|
|
@@ -2030,8 +2148,8 @@ class Bt {
|
|
|
2030
2148
|
return this.data?.register === !0;
|
|
2031
2149
|
}
|
|
2032
2150
|
}
|
|
2033
|
-
var
|
|
2034
|
-
const
|
|
2151
|
+
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 || {});
|
|
2152
|
+
const _e = [
|
|
2035
2153
|
"connecting",
|
|
2036
2154
|
"connected",
|
|
2037
2155
|
"disconnected",
|
|
@@ -2041,7 +2159,7 @@ const Re = [
|
|
|
2041
2159
|
"registrationFailed",
|
|
2042
2160
|
"newMessage",
|
|
2043
2161
|
"sipEvent"
|
|
2044
|
-
],
|
|
2162
|
+
], Jt = [
|
|
2045
2163
|
"disconnecting",
|
|
2046
2164
|
"connect-started",
|
|
2047
2165
|
"connect-succeeded",
|
|
@@ -2049,12 +2167,12 @@ const Re = [
|
|
|
2049
2167
|
"connect-parameters-resolve-success",
|
|
2050
2168
|
"connect-parameters-resolve-failed",
|
|
2051
2169
|
"connected-with-configuration"
|
|
2052
|
-
],
|
|
2053
|
-
function
|
|
2170
|
+
], be = [..._e, ...Jt], zt = () => new R(be);
|
|
2171
|
+
function jt(n) {
|
|
2054
2172
|
return (e) => `sip:${e}@${n}`;
|
|
2055
2173
|
}
|
|
2056
|
-
const
|
|
2057
|
-
class
|
|
2174
|
+
const Kt = (n, e) => () => Math.floor(Math.random() * (e - n)) + n, Oe = (n) => n.trim().replaceAll(" ", "_"), Zt = Kt(1e5, 99999999), en = 3;
|
|
2175
|
+
class tn {
|
|
2058
2176
|
cancelableConnectWithRepeatedCalls;
|
|
2059
2177
|
JsSIP;
|
|
2060
2178
|
events;
|
|
@@ -2080,30 +2198,30 @@ class xt {
|
|
|
2080
2198
|
}
|
|
2081
2199
|
let r = !1;
|
|
2082
2200
|
const a = this.getConnectionConfiguration();
|
|
2083
|
-
e !== void 0 && e !== a?.displayName && (r = i.set("display_name",
|
|
2201
|
+
e !== void 0 && e !== a?.displayName && (r = i.set("display_name", Oe(e)), this.updateConnectionConfiguration("displayName", e));
|
|
2084
2202
|
const o = r;
|
|
2085
2203
|
o ? t(o) : s(new Error("nothing changed"));
|
|
2086
2204
|
});
|
|
2087
2205
|
disconnect = async () => {
|
|
2088
|
-
this.events.trigger(
|
|
2206
|
+
this.events.trigger(C.DISCONNECTING, {});
|
|
2089
2207
|
const e = new Promise((s) => {
|
|
2090
|
-
this.events.once(
|
|
2208
|
+
this.events.once(C.DISCONNECTED, () => {
|
|
2091
2209
|
s();
|
|
2092
2210
|
});
|
|
2093
2211
|
}), t = this.getUa();
|
|
2094
|
-
return t ? t.stop() : this.events.trigger(
|
|
2212
|
+
return t ? t.stop() : this.events.trigger(C.DISCONNECTED, { socket: {}, error: !1 }), e.finally(() => {
|
|
2095
2213
|
t?.removeAllListeners(), this.setUa(void 0), this.stateMachine.reset();
|
|
2096
2214
|
});
|
|
2097
2215
|
};
|
|
2098
2216
|
cancelRequests() {
|
|
2099
2217
|
this.cancelConnectWithRepeatedCalls();
|
|
2100
2218
|
}
|
|
2101
|
-
connectWithDuplicatedCalls = async (e, { callLimit: t =
|
|
2219
|
+
connectWithDuplicatedCalls = async (e, { callLimit: t = en } = {}) => {
|
|
2102
2220
|
const s = async () => this.connectInner(e), i = (r) => {
|
|
2103
|
-
const c = this.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e),
|
|
2104
|
-
return c ||
|
|
2221
|
+
const c = this.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), l = r != null && !st(r);
|
|
2222
|
+
return c || l;
|
|
2105
2223
|
};
|
|
2106
|
-
return this.stateMachine.startConnect(), this.cancelableConnectWithRepeatedCalls =
|
|
2224
|
+
return this.stateMachine.startConnect(), this.cancelableConnectWithRepeatedCalls = Te({
|
|
2107
2225
|
targetFunction: s,
|
|
2108
2226
|
isComplete: i,
|
|
2109
2227
|
callLimit: t,
|
|
@@ -2137,39 +2255,39 @@ class xt {
|
|
|
2137
2255
|
sessionTimers: a,
|
|
2138
2256
|
registerExpires: o,
|
|
2139
2257
|
connectionRecoveryMinInterval: c,
|
|
2140
|
-
connectionRecoveryMaxInterval:
|
|
2141
|
-
userAgent:
|
|
2142
|
-
displayName:
|
|
2258
|
+
connectionRecoveryMaxInterval: l,
|
|
2259
|
+
userAgent: T,
|
|
2260
|
+
displayName: u = "",
|
|
2143
2261
|
register: E = !1,
|
|
2144
2262
|
extraHeaders: m = []
|
|
2145
2263
|
}) => {
|
|
2146
2264
|
this.stateMachine.startInitUa(), this.setConnectionConfiguration({
|
|
2147
2265
|
sipServerIp: s,
|
|
2148
2266
|
sipServerUrl: i,
|
|
2149
|
-
displayName:
|
|
2267
|
+
displayName: u,
|
|
2150
2268
|
register: E,
|
|
2151
2269
|
user: e,
|
|
2152
2270
|
password: t
|
|
2153
2271
|
}), this.getUa() && await this.disconnect();
|
|
2154
|
-
const { ua:
|
|
2272
|
+
const { ua: A, helpers: w } = this.uaFactory.createUAWithConfiguration(
|
|
2155
2273
|
{
|
|
2156
2274
|
user: e,
|
|
2157
2275
|
password: t,
|
|
2158
2276
|
sipServerIp: s,
|
|
2159
2277
|
sipServerUrl: i,
|
|
2160
|
-
displayName:
|
|
2278
|
+
displayName: u,
|
|
2161
2279
|
register: E,
|
|
2162
2280
|
sessionTimers: a,
|
|
2163
2281
|
registerExpires: o,
|
|
2164
2282
|
connectionRecoveryMinInterval: c,
|
|
2165
|
-
connectionRecoveryMaxInterval:
|
|
2166
|
-
userAgent:
|
|
2283
|
+
connectionRecoveryMaxInterval: l,
|
|
2284
|
+
userAgent: T,
|
|
2167
2285
|
remoteAddress: r,
|
|
2168
2286
|
extraHeaders: m
|
|
2169
2287
|
},
|
|
2170
2288
|
this.events
|
|
2171
2289
|
);
|
|
2172
|
-
return this.setUa(
|
|
2290
|
+
return this.setUa(A), this.setGetUri(w.getUri), this.setSocket(w.socket), A;
|
|
2173
2291
|
};
|
|
2174
2292
|
start = async () => new Promise((e, t) => {
|
|
2175
2293
|
const s = this.getUa();
|
|
@@ -2178,15 +2296,15 @@ class xt {
|
|
|
2178
2296
|
return;
|
|
2179
2297
|
}
|
|
2180
2298
|
let i;
|
|
2181
|
-
i = ((c,
|
|
2299
|
+
i = ((c, l) => {
|
|
2182
2300
|
if (this.getConnectionConfiguration()?.register === !0)
|
|
2183
|
-
return this.registrationManager.subscribeToStartEvents(c,
|
|
2184
|
-
const
|
|
2185
|
-
return this.events.on(
|
|
2186
|
-
this.events.on(m,
|
|
2301
|
+
return this.registrationManager.subscribeToStartEvents(c, l);
|
|
2302
|
+
const u = C.CONNECTED, E = [C.DISCONNECTED];
|
|
2303
|
+
return this.events.on(u, c), E.forEach((m) => {
|
|
2304
|
+
this.events.on(m, l);
|
|
2187
2305
|
}), () => {
|
|
2188
|
-
this.events.off(
|
|
2189
|
-
this.events.off(m,
|
|
2306
|
+
this.events.off(u, c), E.forEach((m) => {
|
|
2307
|
+
this.events.off(m, l);
|
|
2190
2308
|
});
|
|
2191
2309
|
};
|
|
2192
2310
|
})(() => {
|
|
@@ -2199,17 +2317,17 @@ class xt {
|
|
|
2199
2317
|
this.cancelableConnectWithRepeatedCalls?.cancel();
|
|
2200
2318
|
}
|
|
2201
2319
|
proxyEvents() {
|
|
2202
|
-
this.events.on(
|
|
2320
|
+
this.events.on(C.CONNECTED, () => {
|
|
2203
2321
|
const e = this.getConnectionConfiguration(), t = this.getUa();
|
|
2204
|
-
e !== void 0 && t !== void 0 && this.events.trigger(
|
|
2322
|
+
e !== void 0 && t !== void 0 && this.events.trigger(C.CONNECTED_WITH_CONFIGURATION, {
|
|
2205
2323
|
...e,
|
|
2206
2324
|
ua: t
|
|
2207
2325
|
});
|
|
2208
2326
|
});
|
|
2209
2327
|
}
|
|
2210
2328
|
}
|
|
2211
|
-
var
|
|
2212
|
-
const
|
|
2329
|
+
var nn = /* @__PURE__ */ ((n) => (n.IDLE = "connection:idle", n.PREPARING = "connection:preparing", n.CONNECTING = "connection:connecting", n.CONNECTED = "connection:connected", n.REGISTERED = "connection:registered", n.ESTABLISHED = "connection:established", n.DISCONNECTED = "connection:disconnected", n.FAILED = "connection:failed", n))(nn || {}), De = /* @__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))(De || {});
|
|
2330
|
+
const sn = Object.values(De), rn = G({
|
|
2213
2331
|
types: {
|
|
2214
2332
|
context: {},
|
|
2215
2333
|
events: {}
|
|
@@ -2221,13 +2339,13 @@ const Yt = Object.values(fe), Xt = $({
|
|
|
2221
2339
|
logStateChange: (n, e) => {
|
|
2222
2340
|
d("ConnectionStateMachine state changed", e.state);
|
|
2223
2341
|
},
|
|
2224
|
-
setError:
|
|
2342
|
+
setError: M({
|
|
2225
2343
|
error: ({ event: n }) => {
|
|
2226
2344
|
if (n.type === "CONNECTION_FAILED" && "error" in n)
|
|
2227
2345
|
return n.error;
|
|
2228
2346
|
}
|
|
2229
2347
|
}),
|
|
2230
|
-
clearError:
|
|
2348
|
+
clearError: M({
|
|
2231
2349
|
error: () => {
|
|
2232
2350
|
}
|
|
2233
2351
|
})
|
|
@@ -2589,19 +2707,11 @@ const Yt = Object.values(fe), Xt = $({
|
|
|
2589
2707
|
}
|
|
2590
2708
|
}
|
|
2591
2709
|
});
|
|
2592
|
-
class
|
|
2593
|
-
stateChangeListeners = /* @__PURE__ */ new Set();
|
|
2710
|
+
class an extends V {
|
|
2594
2711
|
events;
|
|
2595
2712
|
unsubscribeFromEvents;
|
|
2596
2713
|
constructor(e) {
|
|
2597
|
-
super(
|
|
2598
|
-
this.subscribe((t) => {
|
|
2599
|
-
const s = t.value;
|
|
2600
|
-
this.stateChangeListeners.forEach((i) => {
|
|
2601
|
-
i(s);
|
|
2602
|
-
});
|
|
2603
|
-
})
|
|
2604
|
-
), this.subscribeToEvents();
|
|
2714
|
+
super(rn), this.events = e, this.subscribeToEvents();
|
|
2605
2715
|
}
|
|
2606
2716
|
get isIdle() {
|
|
2607
2717
|
return this.hasState(
|
|
@@ -2677,18 +2787,13 @@ class Jt extends q {
|
|
|
2677
2787
|
this.toIdle();
|
|
2678
2788
|
}
|
|
2679
2789
|
destroy() {
|
|
2680
|
-
this.
|
|
2681
|
-
}
|
|
2682
|
-
onStateChange(e) {
|
|
2683
|
-
return this.stateChangeListeners.add(e), () => {
|
|
2684
|
-
this.stateChangeListeners.delete(e);
|
|
2685
|
-
};
|
|
2790
|
+
this.unsubscribeFromEvents?.(), this.stop();
|
|
2686
2791
|
}
|
|
2687
2792
|
canTransition(e) {
|
|
2688
2793
|
return this.getSnapshot().can({ type: e });
|
|
2689
2794
|
}
|
|
2690
2795
|
getValidEvents() {
|
|
2691
|
-
return
|
|
2796
|
+
return sn.filter((e) => this.canTransition(e));
|
|
2692
2797
|
}
|
|
2693
2798
|
hasState(e) {
|
|
2694
2799
|
return this.getSnapshot().matches(e);
|
|
@@ -2760,7 +2865,7 @@ class Jt extends q {
|
|
|
2760
2865
|
this.toFailed(e instanceof Error ? e : void 0);
|
|
2761
2866
|
};
|
|
2762
2867
|
}
|
|
2763
|
-
class
|
|
2868
|
+
class on {
|
|
2764
2869
|
events;
|
|
2765
2870
|
getUaProtected;
|
|
2766
2871
|
constructor(e) {
|
|
@@ -2769,13 +2874,13 @@ class zt {
|
|
|
2769
2874
|
async register() {
|
|
2770
2875
|
const e = this.getUaProtected();
|
|
2771
2876
|
return new Promise((t, s) => {
|
|
2772
|
-
e.on(
|
|
2877
|
+
e.on(C.REGISTERED, t), e.on(C.REGISTRATION_FAILED, s), e.register();
|
|
2773
2878
|
});
|
|
2774
2879
|
}
|
|
2775
2880
|
async unregister() {
|
|
2776
2881
|
const e = this.getUaProtected();
|
|
2777
2882
|
return new Promise((t) => {
|
|
2778
|
-
e.on(
|
|
2883
|
+
e.on(C.UNREGISTERED, t), e.unregister();
|
|
2779
2884
|
});
|
|
2780
2885
|
}
|
|
2781
2886
|
async tryRegister() {
|
|
@@ -2787,7 +2892,7 @@ class zt {
|
|
|
2787
2892
|
return this.register();
|
|
2788
2893
|
}
|
|
2789
2894
|
subscribeToStartEvents(e, t) {
|
|
2790
|
-
const s =
|
|
2895
|
+
const s = C.REGISTERED, i = [C.REGISTRATION_FAILED, C.DISCONNECTED];
|
|
2791
2896
|
return this.events.on(s, e), i.forEach((r) => {
|
|
2792
2897
|
this.events.on(r, t);
|
|
2793
2898
|
}), () => {
|
|
@@ -2797,7 +2902,7 @@ class zt {
|
|
|
2797
2902
|
};
|
|
2798
2903
|
}
|
|
2799
2904
|
}
|
|
2800
|
-
class
|
|
2905
|
+
class cn {
|
|
2801
2906
|
uaFactory;
|
|
2802
2907
|
getUaProtected;
|
|
2803
2908
|
constructor(e) {
|
|
@@ -2843,30 +2948,30 @@ class Kt {
|
|
|
2843
2948
|
extraHeaders: a
|
|
2844
2949
|
}) {
|
|
2845
2950
|
return new Promise((o, c) => {
|
|
2846
|
-
const { configuration:
|
|
2951
|
+
const { configuration: l } = this.uaFactory.createConfiguration({
|
|
2847
2952
|
sipServerUrl: i,
|
|
2848
2953
|
displayName: t,
|
|
2849
2954
|
userAgent: e,
|
|
2850
2955
|
sipServerIp: s
|
|
2851
|
-
}),
|
|
2956
|
+
}), T = this.uaFactory.createUA({ ...l, remoteAddress: r, extraHeaders: a }), u = () => {
|
|
2852
2957
|
const m = new Error("Telephony is not available");
|
|
2853
2958
|
c(m);
|
|
2854
2959
|
};
|
|
2855
|
-
|
|
2960
|
+
T.once(C.DISCONNECTED, u);
|
|
2856
2961
|
const E = () => {
|
|
2857
|
-
|
|
2962
|
+
T.removeAllListeners(), T.once(C.DISCONNECTED, () => {
|
|
2858
2963
|
o();
|
|
2859
|
-
}),
|
|
2964
|
+
}), T.stop();
|
|
2860
2965
|
};
|
|
2861
|
-
|
|
2966
|
+
T.once(C.CONNECTED, E), T.start();
|
|
2862
2967
|
});
|
|
2863
2968
|
}
|
|
2864
2969
|
}
|
|
2865
|
-
const
|
|
2970
|
+
const dn = (n) => {
|
|
2866
2971
|
const e = [];
|
|
2867
2972
|
return n !== void 0 && n !== "" && e.push(`X-Vinteo-Remote: ${n}`), e;
|
|
2868
2973
|
};
|
|
2869
|
-
class
|
|
2974
|
+
class F {
|
|
2870
2975
|
JsSIP;
|
|
2871
2976
|
constructor(e) {
|
|
2872
2977
|
this.JsSIP = e;
|
|
@@ -2891,10 +2996,10 @@ class w {
|
|
|
2891
2996
|
throw new Error("user is required for authorized connection");
|
|
2892
2997
|
}
|
|
2893
2998
|
static resolveAuthorizationUser(e, t) {
|
|
2894
|
-
return e && t !== void 0 && t.trim() !== "" ? t.trim() : `${
|
|
2999
|
+
return e && t !== void 0 && t.trim() !== "" ? t.trim() : `${Zt()}`;
|
|
2895
3000
|
}
|
|
2896
3001
|
static buildExtraHeaders(e, t) {
|
|
2897
|
-
const s = e !== void 0 && e !== "" ?
|
|
3002
|
+
const s = e !== void 0 && e !== "" ? dn(e) : [];
|
|
2898
3003
|
return t === void 0 ? s : [...s, ...t];
|
|
2899
3004
|
}
|
|
2900
3005
|
createConfiguration({
|
|
@@ -2907,40 +3012,40 @@ class w {
|
|
|
2907
3012
|
sessionTimers: o = !1,
|
|
2908
3013
|
registerExpires: c = 300,
|
|
2909
3014
|
// 5 minutes in sec
|
|
2910
|
-
connectionRecoveryMinInterval:
|
|
2911
|
-
connectionRecoveryMaxInterval:
|
|
2912
|
-
userAgent:
|
|
3015
|
+
connectionRecoveryMinInterval: l = 2,
|
|
3016
|
+
connectionRecoveryMaxInterval: T = 6,
|
|
3017
|
+
userAgent: u
|
|
2913
3018
|
}) {
|
|
2914
|
-
|
|
3019
|
+
F.validateParametersConnection({
|
|
2915
3020
|
register: a,
|
|
2916
3021
|
password: t,
|
|
2917
3022
|
user: e,
|
|
2918
3023
|
sipServerIp: r,
|
|
2919
3024
|
sipServerUrl: s
|
|
2920
3025
|
});
|
|
2921
|
-
const E =
|
|
3026
|
+
const E = F.resolveAuthorizationUser(a, e), m = jt(r), D = m(E), A = new this.JsSIP.WebSocketInterface(`wss://${s}/webrtc/wss/`);
|
|
2922
3027
|
return {
|
|
2923
3028
|
configuration: {
|
|
2924
3029
|
password: t,
|
|
2925
3030
|
register: a,
|
|
2926
|
-
uri:
|
|
2927
|
-
display_name:
|
|
2928
|
-
user_agent:
|
|
3031
|
+
uri: D,
|
|
3032
|
+
display_name: Oe(i),
|
|
3033
|
+
user_agent: u,
|
|
2929
3034
|
sdpSemantics: "unified-plan",
|
|
2930
|
-
sockets: [
|
|
3035
|
+
sockets: [A],
|
|
2931
3036
|
session_timers: o,
|
|
2932
3037
|
register_expires: c,
|
|
2933
|
-
connection_recovery_min_interval:
|
|
2934
|
-
connection_recovery_max_interval:
|
|
3038
|
+
connection_recovery_min_interval: l,
|
|
3039
|
+
connection_recovery_max_interval: T
|
|
2935
3040
|
},
|
|
2936
3041
|
helpers: {
|
|
2937
|
-
socket:
|
|
3042
|
+
socket: A,
|
|
2938
3043
|
getUri: m
|
|
2939
3044
|
}
|
|
2940
3045
|
};
|
|
2941
3046
|
}
|
|
2942
3047
|
createUA({ remoteAddress: e, extraHeaders: t, ...s }) {
|
|
2943
|
-
const i = new this.JsSIP.UA(s), r =
|
|
3048
|
+
const i = new this.JsSIP.UA(s), r = F.buildExtraHeaders(e, t);
|
|
2944
3049
|
return r.length > 0 && i.registrator().setExtraHeaders(r), i;
|
|
2945
3050
|
}
|
|
2946
3051
|
/**
|
|
@@ -2953,13 +3058,13 @@ class w {
|
|
|
2953
3058
|
extraHeaders: e.extraHeaders
|
|
2954
3059
|
});
|
|
2955
3060
|
return t.eachTriggers((a, o) => {
|
|
2956
|
-
const c =
|
|
3061
|
+
const c = _e.find((l) => l === o);
|
|
2957
3062
|
c && r.on(c, a);
|
|
2958
3063
|
}), { ua: r, helpers: i };
|
|
2959
3064
|
}
|
|
2960
3065
|
}
|
|
2961
|
-
const
|
|
2962
|
-
class
|
|
3066
|
+
const Pe = "Not ready for connection", hn = (n) => n instanceof Error && n.message === Pe, ln = () => new Error(Pe), gn = async (n) => typeof n == "function" ? n() : n;
|
|
3067
|
+
class un {
|
|
2963
3068
|
events;
|
|
2964
3069
|
ua;
|
|
2965
3070
|
socket;
|
|
@@ -2971,15 +3076,15 @@ class nn {
|
|
|
2971
3076
|
configurationManager;
|
|
2972
3077
|
JsSIP;
|
|
2973
3078
|
constructor({ JsSIP: e }) {
|
|
2974
|
-
this.JsSIP = e, this.events =
|
|
3079
|
+
this.JsSIP = e, this.events = zt(), this.uaFactory = new F(e), this.registrationManager = new on({
|
|
2975
3080
|
events: this.events,
|
|
2976
3081
|
getUaProtected: this.getUaProtected
|
|
2977
|
-
}), this.stateMachine = new
|
|
3082
|
+
}), this.stateMachine = new an(this.events), this.configurationManager = new Xt({
|
|
2978
3083
|
getUa: this.getUa
|
|
2979
|
-
}), this.sipOperations = new
|
|
3084
|
+
}), this.sipOperations = new cn({
|
|
2980
3085
|
uaFactory: this.uaFactory,
|
|
2981
3086
|
getUaProtected: this.getUaProtected
|
|
2982
|
-
}), this.connectionFlow = new
|
|
3087
|
+
}), this.connectionFlow = new tn({
|
|
2983
3088
|
JsSIP: this.JsSIP,
|
|
2984
3089
|
events: this.events,
|
|
2985
3090
|
uaFactory: this.uaFactory,
|
|
@@ -3029,7 +3134,7 @@ class nn {
|
|
|
3029
3134
|
return this.stateMachine.state;
|
|
3030
3135
|
}
|
|
3031
3136
|
get isRegistered() {
|
|
3032
|
-
return
|
|
3137
|
+
return F.isRegisteredUA(this.ua);
|
|
3033
3138
|
}
|
|
3034
3139
|
get isRegisterConfig() {
|
|
3035
3140
|
return this.configurationManager.isRegister();
|
|
@@ -3084,7 +3189,7 @@ class nn {
|
|
|
3084
3189
|
getUa = () => this.ua;
|
|
3085
3190
|
connectWithProcessError = async (e, t) => {
|
|
3086
3191
|
if (!(t?.hasReadyForConnection?.() ?? !0))
|
|
3087
|
-
throw
|
|
3192
|
+
throw ln();
|
|
3088
3193
|
return this.processConnect(e, t).catch(async (i) => {
|
|
3089
3194
|
const r = i;
|
|
3090
3195
|
return this.disconnect().then(() => {
|
|
@@ -3094,18 +3199,18 @@ class nn {
|
|
|
3094
3199
|
});
|
|
3095
3200
|
});
|
|
3096
3201
|
};
|
|
3097
|
-
processConnect = async (e, t) => (this.events.trigger(
|
|
3098
|
-
throw this.events.trigger(
|
|
3099
|
-
}).then(async (s) => this.connectionFlow.connect(s, t)).then((s) => (this.events.trigger(
|
|
3202
|
+
processConnect = async (e, t) => (this.events.trigger(C.CONNECT_STARTED, {}), gn(e).then((s) => (this.events.trigger(C.CONNECT_PARAMETERS_RESOLVE_SUCCESS, s), s)).catch((s) => {
|
|
3203
|
+
throw this.events.trigger(C.CONNECT_PARAMETERS_RESOLVE_FAILED, s), s;
|
|
3204
|
+
}).then(async (s) => this.connectionFlow.connect(s, t)).then((s) => (this.events.trigger(C.CONNECT_SUCCEEDED, {
|
|
3100
3205
|
...s
|
|
3101
3206
|
}), s)).catch((s) => {
|
|
3102
3207
|
const i = s ?? new Error("Failed to connect to server");
|
|
3103
|
-
throw this.events.trigger(
|
|
3208
|
+
throw this.events.trigger(C.CONNECT_FAILED, i), i;
|
|
3104
3209
|
}));
|
|
3105
3210
|
}
|
|
3106
|
-
class
|
|
3211
|
+
class Tn {
|
|
3107
3212
|
connectionManager;
|
|
3108
|
-
stackPromises =
|
|
3213
|
+
stackPromises = Ee({
|
|
3109
3214
|
noRunIsNotActual: !0
|
|
3110
3215
|
});
|
|
3111
3216
|
constructor({ connectionManager: e }) {
|
|
@@ -3117,11 +3222,11 @@ class sn {
|
|
|
3117
3222
|
this.stackPromises.stop();
|
|
3118
3223
|
}
|
|
3119
3224
|
}
|
|
3120
|
-
const
|
|
3121
|
-
class
|
|
3122
|
-
countInner =
|
|
3123
|
-
initialCount =
|
|
3124
|
-
limitInner =
|
|
3225
|
+
const ae = 0, En = 30;
|
|
3226
|
+
class Sn {
|
|
3227
|
+
countInner = ae;
|
|
3228
|
+
initialCount = ae;
|
|
3229
|
+
limitInner = En;
|
|
3125
3230
|
isInProgress = !1;
|
|
3126
3231
|
onStatusChange;
|
|
3127
3232
|
constructor({
|
|
@@ -3154,7 +3259,7 @@ class an {
|
|
|
3154
3259
|
this.countInner = this.initialCount, this.finishAttempt();
|
|
3155
3260
|
}
|
|
3156
3261
|
}
|
|
3157
|
-
class
|
|
3262
|
+
class Cn {
|
|
3158
3263
|
connectionManager;
|
|
3159
3264
|
interval;
|
|
3160
3265
|
checkTelephonyByTimeout = void 0;
|
|
@@ -3170,7 +3275,7 @@ class on {
|
|
|
3170
3275
|
onSuccessRequest: t,
|
|
3171
3276
|
onFailRequest: s
|
|
3172
3277
|
}) {
|
|
3173
|
-
this.stop(), this.cancelableBeforeRequest = new
|
|
3278
|
+
this.stop(), this.cancelableBeforeRequest = new Y(e), this.checkTelephonyByTimeout = Ye({
|
|
3174
3279
|
isDontStopOnFail: !0,
|
|
3175
3280
|
requestInterval: this.interval,
|
|
3176
3281
|
request: async () => {
|
|
@@ -3190,8 +3295,8 @@ class on {
|
|
|
3190
3295
|
this.checkTelephonyByTimeout?.stop(), this.checkTelephonyByTimeout = void 0, this.cancelableBeforeRequest?.cancelRequest(), this.cancelableBeforeRequest = void 0;
|
|
3191
3296
|
}
|
|
3192
3297
|
}
|
|
3193
|
-
var
|
|
3194
|
-
const
|
|
3298
|
+
var v = /* @__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))(v || {});
|
|
3299
|
+
const ye = [
|
|
3195
3300
|
"before-attempt",
|
|
3196
3301
|
"success",
|
|
3197
3302
|
"failed-all-attempts",
|
|
@@ -3199,8 +3304,8 @@ const Me = [
|
|
|
3199
3304
|
"changed-attempt-status",
|
|
3200
3305
|
"stop-attempts-by-error",
|
|
3201
3306
|
"limit-reached-attempts"
|
|
3202
|
-
],
|
|
3203
|
-
class
|
|
3307
|
+
], pn = () => new R(ye);
|
|
3308
|
+
class te {
|
|
3204
3309
|
callManager;
|
|
3205
3310
|
disposers = [];
|
|
3206
3311
|
constructor({ callManager: e }) {
|
|
@@ -3225,15 +3330,15 @@ class K {
|
|
|
3225
3330
|
this.callManager.isCallActive ? e?.() : t();
|
|
3226
3331
|
}
|
|
3227
3332
|
}
|
|
3228
|
-
const
|
|
3229
|
-
class
|
|
3333
|
+
const mn = 15e3, Nn = 2;
|
|
3334
|
+
class An {
|
|
3230
3335
|
connectionManager;
|
|
3231
3336
|
pingServerByTimeoutWithFailCalls;
|
|
3232
3337
|
constructor({ connectionManager: e }) {
|
|
3233
|
-
this.connectionManager = e, this.pingServerByTimeoutWithFailCalls =
|
|
3338
|
+
this.connectionManager = e, this.pingServerByTimeoutWithFailCalls = Xe(Nn, {
|
|
3234
3339
|
whenPossibleRequest: async () => {
|
|
3235
3340
|
},
|
|
3236
|
-
requestInterval:
|
|
3341
|
+
requestInterval: mn,
|
|
3237
3342
|
request: async () => (d("ping"), this.connectionManager.ping().then(() => {
|
|
3238
3343
|
d("ping success");
|
|
3239
3344
|
}))
|
|
@@ -3246,16 +3351,16 @@ class ln {
|
|
|
3246
3351
|
this.pingServerByTimeoutWithFailCalls.stop();
|
|
3247
3352
|
}
|
|
3248
3353
|
}
|
|
3249
|
-
class
|
|
3354
|
+
class Rn {
|
|
3250
3355
|
pingServerRequester;
|
|
3251
3356
|
notActiveCallSubscriber;
|
|
3252
3357
|
constructor({
|
|
3253
3358
|
connectionManager: e,
|
|
3254
3359
|
callManager: t
|
|
3255
3360
|
}) {
|
|
3256
|
-
this.pingServerRequester = new
|
|
3361
|
+
this.pingServerRequester = new An({
|
|
3257
3362
|
connectionManager: e
|
|
3258
|
-
}), this.notActiveCallSubscriber = new
|
|
3363
|
+
}), this.notActiveCallSubscriber = new te({ callManager: t });
|
|
3259
3364
|
}
|
|
3260
3365
|
start({ onFailRequest: e }) {
|
|
3261
3366
|
d("start"), this.notActiveCallSubscriber.subscribe({
|
|
@@ -3274,7 +3379,7 @@ class gn {
|
|
|
3274
3379
|
this.notActiveCallSubscriber.unsubscribe();
|
|
3275
3380
|
}
|
|
3276
3381
|
}
|
|
3277
|
-
class
|
|
3382
|
+
class In {
|
|
3278
3383
|
connectionManager;
|
|
3279
3384
|
isRegistrationFailed = !1;
|
|
3280
3385
|
disposers = [];
|
|
@@ -3283,7 +3388,7 @@ class un {
|
|
|
3283
3388
|
connectionManager: e,
|
|
3284
3389
|
callManager: t
|
|
3285
3390
|
}) {
|
|
3286
|
-
this.connectionManager = e, this.notActiveCallSubscriber = new
|
|
3391
|
+
this.connectionManager = e, this.notActiveCallSubscriber = new te({ callManager: t });
|
|
3287
3392
|
}
|
|
3288
3393
|
subscribe(e) {
|
|
3289
3394
|
this.unsubscribe(), this.disposers.push(
|
|
@@ -3310,12 +3415,12 @@ class un {
|
|
|
3310
3415
|
this.isRegistrationFailed = !1;
|
|
3311
3416
|
}
|
|
3312
3417
|
}
|
|
3313
|
-
const
|
|
3418
|
+
const vn = 3e3, fn = 15e3, oe = {
|
|
3314
3419
|
LIMIT_REACHED: "Limit reached",
|
|
3315
3420
|
FAILED_TO_RECONNECT: "Failed to reconnect"
|
|
3316
|
-
},
|
|
3317
|
-
},
|
|
3318
|
-
class
|
|
3421
|
+
}, Mn = async () => {
|
|
3422
|
+
}, _n = (n) => !0;
|
|
3423
|
+
class bn {
|
|
3319
3424
|
events;
|
|
3320
3425
|
connectionManager;
|
|
3321
3426
|
connectionQueueManager;
|
|
@@ -3335,21 +3440,21 @@ class Cn {
|
|
|
3335
3440
|
connectionManager: t,
|
|
3336
3441
|
callManager: s
|
|
3337
3442
|
}, i) {
|
|
3338
|
-
const r = i?.onBeforeRetry ??
|
|
3339
|
-
this.connectionQueueManager = e, this.connectionManager = t, this.onBeforeRetry = r, this.canRetryOnError = a, this.networkInterfacesSubscriber = i?.networkInterfacesSubscriber, this.resumeFromSleepModeSubscriber = i?.resumeFromSleepModeSubscriber, this.events =
|
|
3443
|
+
const r = i?.onBeforeRetry ?? Mn, a = i?.canRetryOnError ?? _n;
|
|
3444
|
+
this.connectionQueueManager = e, this.connectionManager = t, this.onBeforeRetry = r, this.canRetryOnError = a, this.networkInterfacesSubscriber = i?.networkInterfacesSubscriber, this.resumeFromSleepModeSubscriber = i?.resumeFromSleepModeSubscriber, this.events = pn(), this.checkTelephonyRequester = new Cn({
|
|
3340
3445
|
connectionManager: t,
|
|
3341
|
-
interval: i?.checkTelephonyRequestInterval ??
|
|
3342
|
-
}), this.pingServerIfNotActiveCallRequester = new
|
|
3446
|
+
interval: i?.checkTelephonyRequestInterval ?? fn
|
|
3447
|
+
}), this.pingServerIfNotActiveCallRequester = new Rn({
|
|
3343
3448
|
connectionManager: t,
|
|
3344
3449
|
callManager: s
|
|
3345
|
-
}), this.registrationFailedOutOfCallSubscriber = new
|
|
3450
|
+
}), this.registrationFailedOutOfCallSubscriber = new In({
|
|
3346
3451
|
connectionManager: t,
|
|
3347
3452
|
callManager: s
|
|
3348
|
-
}), this.attemptsState = new
|
|
3453
|
+
}), this.attemptsState = new Sn({
|
|
3349
3454
|
onStatusChange: this.emitStatusChange
|
|
3350
|
-
}), this.cancelableRequestBeforeRetry = new
|
|
3351
|
-
i?.timeoutBetweenAttempts ??
|
|
3352
|
-
), this.notActiveCallSubscriber = new
|
|
3455
|
+
}), this.cancelableRequestBeforeRetry = new Y(r), this.delayBetweenAttempts = new Je(
|
|
3456
|
+
i?.timeoutBetweenAttempts ?? vn
|
|
3457
|
+
), this.notActiveCallSubscriber = new te({ callManager: s });
|
|
3353
3458
|
}
|
|
3354
3459
|
start(e) {
|
|
3355
3460
|
d("auto connector start"), this.restartConnectionAttempts(e), this.subscribeToNotActiveCall(e);
|
|
@@ -3400,7 +3505,7 @@ class Cn {
|
|
|
3400
3505
|
});
|
|
3401
3506
|
}
|
|
3402
3507
|
async attemptConnection(e) {
|
|
3403
|
-
if (d("attemptConnection: attempts.count", this.attemptsState.count), this.events.trigger(
|
|
3508
|
+
if (d("attemptConnection: attempts.count", this.attemptsState.count), this.events.trigger(v.BEFORE_ATTEMPT, {}), this.stopConnectTriggers(), this.attemptsState.hasLimitReached()) {
|
|
3404
3509
|
d("attemptConnection: limit reached"), this.handleLimitReached(e);
|
|
3405
3510
|
return;
|
|
3406
3511
|
}
|
|
@@ -3414,25 +3519,25 @@ class Cn {
|
|
|
3414
3519
|
}
|
|
3415
3520
|
}
|
|
3416
3521
|
handleConnectionError(e, t) {
|
|
3417
|
-
if (
|
|
3418
|
-
this.attemptsState.finishAttempt(), this.events.trigger(
|
|
3522
|
+
if (hn(e)) {
|
|
3523
|
+
this.attemptsState.finishAttempt(), this.events.trigger(v.STOP_ATTEMPTS_BY_ERROR, e);
|
|
3419
3524
|
return;
|
|
3420
3525
|
}
|
|
3421
3526
|
if (!this.canRetryOnError(e)) {
|
|
3422
|
-
d("executeConnectionAttempt: error does not allow retry", e), this.attemptsState.finishAttempt(), this.events.trigger(
|
|
3527
|
+
d("executeConnectionAttempt: error does not allow retry", e), this.attemptsState.finishAttempt(), this.events.trigger(v.STOP_ATTEMPTS_BY_ERROR, e);
|
|
3423
3528
|
return;
|
|
3424
3529
|
}
|
|
3425
|
-
if (
|
|
3426
|
-
d("executeConnectionAttempt: not actual error", e), this.attemptsState.finishAttempt(), this.events.trigger(
|
|
3530
|
+
if (Ze(e)) {
|
|
3531
|
+
d("executeConnectionAttempt: not actual error", e), this.attemptsState.finishAttempt(), this.events.trigger(v.CANCELLED_ATTEMPTS, e);
|
|
3427
3532
|
return;
|
|
3428
3533
|
}
|
|
3429
3534
|
d("executeConnectionAttempt: error", e), this.scheduleReconnect(t);
|
|
3430
3535
|
}
|
|
3431
3536
|
handleLimitReached(e) {
|
|
3432
|
-
this.attemptsState.finishAttempt(), this.events.trigger(
|
|
3537
|
+
this.attemptsState.finishAttempt(), this.events.trigger(v.LIMIT_REACHED_ATTEMPTS, new Error(oe.LIMIT_REACHED)), this.startCheckTelephony(e);
|
|
3433
3538
|
}
|
|
3434
3539
|
handleSucceededAttempt(e) {
|
|
3435
|
-
d("handleSucceededAttempt"), this.subscribeToConnectTriggers(e), this.events.trigger(
|
|
3540
|
+
d("handleSucceededAttempt"), this.subscribeToConnectTriggers(e), this.events.trigger(v.SUCCESS);
|
|
3436
3541
|
}
|
|
3437
3542
|
subscribeToConnectTriggers(e) {
|
|
3438
3543
|
this.startPingRequester(e), this.registrationFailedOutOfCallSubscriber.subscribe(() => {
|
|
@@ -3486,12 +3591,12 @@ class Cn {
|
|
|
3486
3591
|
}
|
|
3487
3592
|
connectIfDisconnected(e) {
|
|
3488
3593
|
const t = this.isConnectionUnavailable();
|
|
3489
|
-
d("connectIfDisconnected: isUnavailable", t), t ? this.restartConnectionAttempts(e) : (this.stopConnectTriggers(), this.events.trigger(
|
|
3594
|
+
d("connectIfDisconnected: isUnavailable", t), t ? this.restartConnectionAttempts(e) : (this.stopConnectTriggers(), this.events.trigger(v.SUCCESS));
|
|
3490
3595
|
}
|
|
3491
3596
|
scheduleReconnect(e) {
|
|
3492
3597
|
d("scheduleReconnect"), this.delayBetweenAttempts.request().then(async () => (d("scheduleReconnect: delayBetweenAttempts success"), this.cancelableRequestBeforeRetry.request())).then(async () => (d("scheduleReconnect: onBeforeRetry success"), this.attemptConnection(e))).catch((t) => {
|
|
3493
|
-
const s = t instanceof Error ? t : new Error(
|
|
3494
|
-
this.attemptsState.finishAttempt(),
|
|
3598
|
+
const s = t instanceof Error ? t : new Error(oe.FAILED_TO_RECONNECT);
|
|
3599
|
+
this.attemptsState.finishAttempt(), Qe(t) || ze(t) ? this.events.trigger(v.CANCELLED_ATTEMPTS, s) : this.events.trigger(v.FAILED_ALL_ATTEMPTS, s), d("scheduleReconnect: error", t);
|
|
3495
3600
|
});
|
|
3496
3601
|
}
|
|
3497
3602
|
isConnectionUnavailable() {
|
|
@@ -3499,30 +3604,30 @@ class Cn {
|
|
|
3499
3604
|
return e || t || s;
|
|
3500
3605
|
}
|
|
3501
3606
|
emitStatusChange = ({ isInProgress: e }) => {
|
|
3502
|
-
this.events.trigger(
|
|
3607
|
+
this.events.trigger(v.CHANGED_ATTEMPT_STATUS, { isInProgress: e });
|
|
3503
3608
|
};
|
|
3504
3609
|
}
|
|
3505
|
-
var
|
|
3506
|
-
const
|
|
3507
|
-
class
|
|
3610
|
+
var j = /* @__PURE__ */ ((n) => (n.STATE_CHANGED = "state-changed", n.STATE_RESET = "state-reset", n))(j || {});
|
|
3611
|
+
const Le = ["state-changed", "state-reset"], On = () => new R(Le);
|
|
3612
|
+
class Dn {
|
|
3508
3613
|
events;
|
|
3509
3614
|
state = {};
|
|
3510
3615
|
constructor() {
|
|
3511
|
-
this.events =
|
|
3616
|
+
this.events = On();
|
|
3512
3617
|
}
|
|
3513
3618
|
getState() {
|
|
3514
3619
|
return { ...this.state };
|
|
3515
3620
|
}
|
|
3516
3621
|
updateState(e) {
|
|
3517
3622
|
const t = { ...this.state };
|
|
3518
|
-
this.state = { ...this.state, ...e }, this.events.trigger(
|
|
3623
|
+
this.state = { ...this.state, ...e }, this.events.trigger(j.STATE_CHANGED, {
|
|
3519
3624
|
previous: t,
|
|
3520
3625
|
current: this.state,
|
|
3521
3626
|
updates: e
|
|
3522
3627
|
});
|
|
3523
3628
|
}
|
|
3524
3629
|
reset() {
|
|
3525
|
-
this.state = {}, this.events.trigger(
|
|
3630
|
+
this.state = {}, this.events.trigger(j.STATE_RESET, {});
|
|
3526
3631
|
}
|
|
3527
3632
|
getToken() {
|
|
3528
3633
|
return this.state.token;
|
|
@@ -3558,15 +3663,142 @@ class Nn {
|
|
|
3558
3663
|
this.events.off(e, t);
|
|
3559
3664
|
}
|
|
3560
3665
|
}
|
|
3561
|
-
|
|
3562
|
-
|
|
3666
|
+
const Pn = G({
|
|
3667
|
+
types: {
|
|
3668
|
+
context: {},
|
|
3669
|
+
events: {}
|
|
3670
|
+
},
|
|
3671
|
+
actions: {
|
|
3672
|
+
setCodec: M(({ event: n }) => "codec" in n ? { codec: n.codec } : {}),
|
|
3673
|
+
clearCodec: M({ codec: void 0 })
|
|
3674
|
+
}
|
|
3675
|
+
}).createMachine({
|
|
3676
|
+
id: "contented-stream",
|
|
3677
|
+
initial: "contented-stream:not-available",
|
|
3678
|
+
context: {},
|
|
3679
|
+
states: {
|
|
3680
|
+
"contented-stream:not-available": {
|
|
3681
|
+
on: {
|
|
3682
|
+
"CONTENTED_STREAM.AVAILABLE": {
|
|
3683
|
+
target: "contented-stream:available",
|
|
3684
|
+
actions: "setCodec"
|
|
3685
|
+
}
|
|
3686
|
+
}
|
|
3687
|
+
},
|
|
3688
|
+
"contented-stream:available": {
|
|
3689
|
+
on: {
|
|
3690
|
+
"CONTENTED_STREAM.NOT_AVAILABLE": {
|
|
3691
|
+
target: "contented-stream:not-available",
|
|
3692
|
+
actions: "clearCodec"
|
|
3693
|
+
},
|
|
3694
|
+
"CONTENTED_STREAM.AVAILABLE": {
|
|
3695
|
+
target: "contented-stream:available",
|
|
3696
|
+
actions: "setCodec",
|
|
3697
|
+
reenter: !0
|
|
3698
|
+
},
|
|
3699
|
+
"CONTENTED_STREAM.RESET": {
|
|
3700
|
+
target: "contented-stream:not-available",
|
|
3701
|
+
actions: "clearCodec"
|
|
3702
|
+
}
|
|
3703
|
+
}
|
|
3704
|
+
}
|
|
3705
|
+
}
|
|
3706
|
+
});
|
|
3707
|
+
class yn extends V {
|
|
3708
|
+
constructor() {
|
|
3709
|
+
super(Pn);
|
|
3710
|
+
}
|
|
3711
|
+
get isAvailable() {
|
|
3712
|
+
return this.state === "contented-stream:available";
|
|
3713
|
+
}
|
|
3714
|
+
get isNotAvailable() {
|
|
3715
|
+
return this.state === "contented-stream:not-available";
|
|
3716
|
+
}
|
|
3717
|
+
get codec() {
|
|
3718
|
+
return this.getSnapshot().context.codec;
|
|
3719
|
+
}
|
|
3720
|
+
getStateInfo() {
|
|
3721
|
+
return {
|
|
3722
|
+
isAvailable: this.isAvailable,
|
|
3723
|
+
codec: this.codec
|
|
3724
|
+
};
|
|
3725
|
+
}
|
|
3726
|
+
reset() {
|
|
3727
|
+
this.send({ type: "CONTENTED_STREAM.RESET" });
|
|
3728
|
+
}
|
|
3729
|
+
send(e) {
|
|
3730
|
+
if (!this.getSnapshot().can(e)) {
|
|
3731
|
+
console.warn(
|
|
3732
|
+
`[ContentedStreamStateMachine] Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`
|
|
3733
|
+
);
|
|
3734
|
+
return;
|
|
3735
|
+
}
|
|
3736
|
+
super.send(e);
|
|
3737
|
+
}
|
|
3738
|
+
subscribeToApiEvents(e) {
|
|
3739
|
+
this.addSubscription(
|
|
3740
|
+
e.on("contented-stream:available", (t) => {
|
|
3741
|
+
this.send({ type: "CONTENTED_STREAM.AVAILABLE", codec: t.codec });
|
|
3742
|
+
})
|
|
3743
|
+
), this.addSubscription(
|
|
3744
|
+
e.on("contented-stream:not-available", () => {
|
|
3745
|
+
this.send({ type: "CONTENTED_STREAM.NOT_AVAILABLE" });
|
|
3746
|
+
})
|
|
3747
|
+
);
|
|
3748
|
+
}
|
|
3749
|
+
}
|
|
3750
|
+
var K = /* @__PURE__ */ ((n) => (n.AVAILABLE = "available", n.NOT_AVAILABLE = "not-available", n))(K || {});
|
|
3751
|
+
const Ln = [
|
|
3752
|
+
"available",
|
|
3753
|
+
"not-available"
|
|
3754
|
+
/* NOT_AVAILABLE */
|
|
3755
|
+
], wn = () => new R(Ln);
|
|
3756
|
+
class Un {
|
|
3757
|
+
events;
|
|
3758
|
+
stateMachine;
|
|
3759
|
+
constructor() {
|
|
3760
|
+
this.events = wn(), this.stateMachine = new yn(), this.proxyEvents();
|
|
3761
|
+
}
|
|
3762
|
+
get isAvailable() {
|
|
3763
|
+
return this.stateMachine.isAvailable;
|
|
3764
|
+
}
|
|
3765
|
+
get codec() {
|
|
3766
|
+
return this.stateMachine.codec;
|
|
3767
|
+
}
|
|
3768
|
+
getStateInfo() {
|
|
3769
|
+
return this.stateMachine.getStateInfo();
|
|
3770
|
+
}
|
|
3771
|
+
reset() {
|
|
3772
|
+
this.stateMachine.reset();
|
|
3773
|
+
}
|
|
3774
|
+
on(e, t) {
|
|
3775
|
+
return this.events.on(e, t);
|
|
3776
|
+
}
|
|
3777
|
+
once(e, t) {
|
|
3778
|
+
return this.events.once(e, t);
|
|
3779
|
+
}
|
|
3780
|
+
off(e, t) {
|
|
3781
|
+
this.events.off(e, t);
|
|
3782
|
+
}
|
|
3783
|
+
subscribeToApiEvents(e) {
|
|
3784
|
+
this.stateMachine.subscribeToApiEvents(e.events);
|
|
3785
|
+
}
|
|
3786
|
+
proxyEvents() {
|
|
3787
|
+
this.stateMachine.onStateChange(() => {
|
|
3788
|
+
const e = this.getStateInfo();
|
|
3789
|
+
e.isAvailable ? this.events.trigger(K.AVAILABLE, { codec: e.codec }) : this.events.trigger(K.NOT_AVAILABLE, {});
|
|
3790
|
+
});
|
|
3791
|
+
}
|
|
3792
|
+
}
|
|
3793
|
+
var k = /* @__PURE__ */ ((n) => (n.RINGING = "ringing", n.DECLINED_INCOMING_CALL = "declinedIncomingCall", n.TERMINATED_INCOMING_CALL = "terminatedIncomingCall", n.FAILED_INCOMING_CALL = "failedIncomingCall", n))(k || {});
|
|
3794
|
+
const we = [
|
|
3563
3795
|
"ringing",
|
|
3564
3796
|
"declinedIncomingCall",
|
|
3565
3797
|
"terminatedIncomingCall",
|
|
3566
3798
|
"failedIncomingCall"
|
|
3567
|
-
],
|
|
3568
|
-
var
|
|
3569
|
-
const
|
|
3799
|
+
], Fn = () => new R(we);
|
|
3800
|
+
var Bn = /* @__PURE__ */ ((n) => (n.IDLE = "incoming:idle", n.RINGING = "incoming:ringing", n.CONSUMED = "incoming:consumed", n.DECLINED = "incoming:declined", n.TERMINATED = "incoming:terminated", n.FAILED = "incoming:failed", n))(Bn || {});
|
|
3801
|
+
const kn = G({
|
|
3570
3802
|
types: {
|
|
3571
3803
|
context: {},
|
|
3572
3804
|
events: {}
|
|
@@ -3578,11 +3810,11 @@ const In = $({
|
|
|
3578
3810
|
logStateChange: (n, e) => {
|
|
3579
3811
|
d("IncomingCallStateMachine state changed", e.state);
|
|
3580
3812
|
},
|
|
3581
|
-
rememberIncoming:
|
|
3813
|
+
rememberIncoming: M(({ event: n }) => {
|
|
3582
3814
|
const { data: e } = n;
|
|
3583
3815
|
return { remoteCallerData: e, lastReason: void 0 };
|
|
3584
3816
|
}),
|
|
3585
|
-
rememberReason:
|
|
3817
|
+
rememberReason: M(({ event: n, context: e }) => n.type === "INCOMING.CONSUMED" ? {
|
|
3586
3818
|
remoteCallerData: e.remoteCallerData,
|
|
3587
3819
|
lastReason: "incoming:consumed"
|
|
3588
3820
|
/* CONSUMED */
|
|
@@ -3599,7 +3831,7 @@ const In = $({
|
|
|
3599
3831
|
lastReason: "incoming:failed"
|
|
3600
3832
|
/* FAILED */
|
|
3601
3833
|
}),
|
|
3602
|
-
clearIncoming:
|
|
3834
|
+
clearIncoming: M(() => ({ remoteCallerData: void 0, lastReason: void 0 }))
|
|
3603
3835
|
}
|
|
3604
3836
|
}).createMachine({
|
|
3605
3837
|
id: "incoming",
|
|
@@ -3898,9 +4130,9 @@ const In = $({
|
|
|
3898
4130
|
}
|
|
3899
4131
|
}
|
|
3900
4132
|
});
|
|
3901
|
-
class
|
|
4133
|
+
class $n extends V {
|
|
3902
4134
|
constructor({ incomingEvents: e, connectionEvents: t }) {
|
|
3903
|
-
super(
|
|
4135
|
+
super(kn), this.subscribeIncomingEvents(e), this.subscribeConnectionEvents(t);
|
|
3904
4136
|
}
|
|
3905
4137
|
get isIdle() {
|
|
3906
4138
|
return this.state === "incoming:idle";
|
|
@@ -3968,15 +4200,15 @@ class fn extends q {
|
|
|
3968
4200
|
}
|
|
3969
4201
|
subscribeConnectionEvents(e) {
|
|
3970
4202
|
this.addSubscription(
|
|
3971
|
-
e.on(
|
|
4203
|
+
e.on(C.DISCONNECTED, () => {
|
|
3972
4204
|
this.toClearIncoming();
|
|
3973
4205
|
})
|
|
3974
4206
|
), this.addSubscription(
|
|
3975
|
-
e.on(
|
|
4207
|
+
e.on(C.REGISTRATION_FAILED, () => {
|
|
3976
4208
|
this.toClearIncoming();
|
|
3977
4209
|
})
|
|
3978
4210
|
), this.addSubscription(
|
|
3979
|
-
e.on(
|
|
4211
|
+
e.on(C.CONNECT_FAILED, () => {
|
|
3980
4212
|
this.toClearIncoming();
|
|
3981
4213
|
})
|
|
3982
4214
|
);
|
|
@@ -3985,14 +4217,14 @@ class fn extends q {
|
|
|
3985
4217
|
this.send({ type: "INCOMING.CLEAR" });
|
|
3986
4218
|
}
|
|
3987
4219
|
}
|
|
3988
|
-
const
|
|
3989
|
-
class
|
|
4220
|
+
const Gn = 486, Vn = 487;
|
|
4221
|
+
class qn {
|
|
3990
4222
|
events;
|
|
3991
4223
|
incomingStateMachine;
|
|
3992
4224
|
incomingRTCSession;
|
|
3993
4225
|
connectionManager;
|
|
3994
4226
|
constructor(e) {
|
|
3995
|
-
this.connectionManager = e, this.events =
|
|
4227
|
+
this.connectionManager = e, this.events = Fn(), this.incomingStateMachine = new $n({
|
|
3996
4228
|
incomingEvents: this.events,
|
|
3997
4229
|
connectionEvents: this.connectionManager.events
|
|
3998
4230
|
}), this.start();
|
|
@@ -4028,19 +4260,19 @@ class _n {
|
|
|
4028
4260
|
return this.incomingStateMachine.toConsumed(), this.removeIncomingSession(), e;
|
|
4029
4261
|
};
|
|
4030
4262
|
async declineToIncomingCall({
|
|
4031
|
-
statusCode: e =
|
|
4263
|
+
statusCode: e = Vn
|
|
4032
4264
|
} = {}) {
|
|
4033
4265
|
return new Promise((t, s) => {
|
|
4034
4266
|
try {
|
|
4035
4267
|
const i = this.getIncomingRTCSession(), r = this.remoteCallerData;
|
|
4036
|
-
this.removeIncomingSession(), this.events.trigger(
|
|
4268
|
+
this.removeIncomingSession(), this.events.trigger(k.DECLINED_INCOMING_CALL, r), i.terminate({ status_code: e }), t();
|
|
4037
4269
|
} catch (i) {
|
|
4038
4270
|
s(i);
|
|
4039
4271
|
}
|
|
4040
4272
|
});
|
|
4041
4273
|
}
|
|
4042
4274
|
async busyIncomingCall() {
|
|
4043
|
-
return this.declineToIncomingCall({ statusCode:
|
|
4275
|
+
return this.declineToIncomingCall({ statusCode: Gn });
|
|
4044
4276
|
}
|
|
4045
4277
|
on(e, t) {
|
|
4046
4278
|
return this.events.on(e, t);
|
|
@@ -4073,33 +4305,33 @@ class _n {
|
|
|
4073
4305
|
this.incomingRTCSession = e;
|
|
4074
4306
|
const t = this.remoteCallerData;
|
|
4075
4307
|
e.on("failed", (s) => {
|
|
4076
|
-
this.removeIncomingSession(), s.originator === "local" ? this.events.trigger(
|
|
4077
|
-
}), this.events.trigger(
|
|
4308
|
+
this.removeIncomingSession(), s.originator === "local" ? this.events.trigger(k.TERMINATED_INCOMING_CALL, t) : this.events.trigger(k.FAILED_INCOMING_CALL, t);
|
|
4309
|
+
}), this.events.trigger(k.RINGING, t);
|
|
4078
4310
|
}
|
|
4079
4311
|
removeIncomingSession() {
|
|
4080
4312
|
delete this.incomingRTCSession;
|
|
4081
4313
|
}
|
|
4082
4314
|
}
|
|
4083
|
-
var
|
|
4084
|
-
const
|
|
4315
|
+
var Ue = /* @__PURE__ */ ((n) => (n.SNAPSHOT_CHANGED = "snapshot-changed", n))(Ue || {});
|
|
4316
|
+
const Fe = ["snapshot-changed"], Hn = () => new R(Fe), Wn = (n, e) => Object.is(n, e), ce = (n) => ({
|
|
4085
4317
|
connection: n.connection.getSnapshot(),
|
|
4086
4318
|
call: n.call.getSnapshot(),
|
|
4087
4319
|
incoming: n.incoming.getSnapshot(),
|
|
4088
4320
|
presentation: n.presentation.getSnapshot()
|
|
4089
4321
|
});
|
|
4090
|
-
class
|
|
4322
|
+
class xn {
|
|
4091
4323
|
events;
|
|
4092
4324
|
actors;
|
|
4093
4325
|
currentSnapshot;
|
|
4094
4326
|
subscribers = /* @__PURE__ */ new Set();
|
|
4095
4327
|
actorSubscriptions = [];
|
|
4096
4328
|
constructor(e) {
|
|
4097
|
-
this.events =
|
|
4329
|
+
this.events = Hn(), this.actors = {
|
|
4098
4330
|
connection: e.connectionManager.connectionActor,
|
|
4099
4331
|
call: e.callManager.callActor,
|
|
4100
4332
|
incoming: e.incomingCallManager.incomingActor,
|
|
4101
4333
|
presentation: e.presentationManager.presentationActor
|
|
4102
|
-
}, this.currentSnapshot =
|
|
4334
|
+
}, this.currentSnapshot = ce(this.actors), this.actorSubscriptions.push(
|
|
4103
4335
|
this.actors.connection.subscribe(this.notifySubscribers),
|
|
4104
4336
|
this.actors.call.subscribe(this.notifySubscribers),
|
|
4105
4337
|
this.actors.incoming.subscribe(this.notifySubscribers),
|
|
@@ -4110,14 +4342,14 @@ class bn {
|
|
|
4110
4342
|
return this.currentSnapshot;
|
|
4111
4343
|
}
|
|
4112
4344
|
subscribe(e, t, s) {
|
|
4113
|
-
const i = typeof t == "function", r = i ? e : (
|
|
4345
|
+
const i = typeof t == "function", r = i ? e : (T) => T, a = i ? t : e, o = (i ? s : void 0) ?? Wn, c = r(this.currentSnapshot), l = {
|
|
4114
4346
|
selector: r,
|
|
4115
4347
|
listener: a,
|
|
4116
4348
|
equals: o,
|
|
4117
4349
|
current: c
|
|
4118
4350
|
};
|
|
4119
|
-
return this.subscribers.add(
|
|
4120
|
-
this.subscribers.delete(
|
|
4351
|
+
return this.subscribers.add(l), () => {
|
|
4352
|
+
this.subscribers.delete(l);
|
|
4121
4353
|
};
|
|
4122
4354
|
}
|
|
4123
4355
|
stop() {
|
|
@@ -4133,20 +4365,20 @@ class bn {
|
|
|
4133
4365
|
}
|
|
4134
4366
|
notifySubscribers = () => {
|
|
4135
4367
|
const e = this.currentSnapshot;
|
|
4136
|
-
this.currentSnapshot =
|
|
4368
|
+
this.currentSnapshot = ce(this.actors);
|
|
4137
4369
|
for (const t of this.subscribers) {
|
|
4138
4370
|
const s = t.selector(this.currentSnapshot);
|
|
4139
4371
|
t.equals(t.current, s) || (t.current = s, t.listener(s));
|
|
4140
4372
|
}
|
|
4141
|
-
this.events.trigger(
|
|
4373
|
+
this.events.trigger(Ue.SNAPSHOT_CHANGED, {
|
|
4142
4374
|
previous: e,
|
|
4143
4375
|
current: this.currentSnapshot
|
|
4144
4376
|
});
|
|
4145
4377
|
};
|
|
4146
4378
|
}
|
|
4147
|
-
const
|
|
4148
|
-
var
|
|
4149
|
-
const
|
|
4379
|
+
const B = 1e3;
|
|
4380
|
+
var p = /* @__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))(p || {});
|
|
4381
|
+
const Be = ["collected"], Qn = () => new R(Be), Yn = "api/v2/rtp2webrtc/offer", Xn = async ({
|
|
4150
4382
|
serverUrl: n,
|
|
4151
4383
|
conferenceNumber: e,
|
|
4152
4384
|
quality: t,
|
|
@@ -4155,7 +4387,7 @@ const De = ["collected"], Dn = () => new A(De), yn = "api/v2/rtp2webrtc/offer",
|
|
|
4155
4387
|
token: r
|
|
4156
4388
|
}) => {
|
|
4157
4389
|
const a = new URL(
|
|
4158
|
-
`https://${n.replace(/\/$/, "")}/${
|
|
4390
|
+
`https://${n.replace(/\/$/, "")}/${Yn}/${encodeURIComponent(e)}`
|
|
4159
4391
|
);
|
|
4160
4392
|
a.searchParams.set("quality", t), a.searchParams.set("audio", String(s));
|
|
4161
4393
|
const o = {
|
|
@@ -4170,18 +4402,18 @@ const De = ["collected"], Dn = () => new A(De), yn = "api/v2/rtp2webrtc/offer",
|
|
|
4170
4402
|
});
|
|
4171
4403
|
if (!c.ok)
|
|
4172
4404
|
throw new Error(`sendOffer failed with status ${c.status}`);
|
|
4173
|
-
const
|
|
4405
|
+
const l = await c.json();
|
|
4174
4406
|
return {
|
|
4175
|
-
type:
|
|
4176
|
-
sdp:
|
|
4407
|
+
type: l.type,
|
|
4408
|
+
sdp: l.sdp,
|
|
4177
4409
|
toJSON() {
|
|
4178
|
-
return
|
|
4410
|
+
return l;
|
|
4179
4411
|
}
|
|
4180
4412
|
};
|
|
4181
|
-
},
|
|
4413
|
+
}, de = () => "performance" in window ? performance.now() : Date.now(), q = (n) => [...n.keys()].reduce((e, t) => {
|
|
4182
4414
|
const s = n.get(t);
|
|
4183
4415
|
return s === void 0 ? e : { ...e, [s.type]: s };
|
|
4184
|
-
}, {}),
|
|
4416
|
+
}, {}), Jn = (n) => {
|
|
4185
4417
|
if (!n)
|
|
4186
4418
|
return {
|
|
4187
4419
|
outboundRtp: void 0,
|
|
@@ -4189,14 +4421,14 @@ const De = ["collected"], Dn = () => new A(De), yn = "api/v2/rtp2webrtc/offer",
|
|
|
4189
4421
|
mediaSource: void 0,
|
|
4190
4422
|
remoteInboundRtp: void 0
|
|
4191
4423
|
};
|
|
4192
|
-
const e =
|
|
4424
|
+
const e = q(n);
|
|
4193
4425
|
return {
|
|
4194
|
-
outboundRtp: e[
|
|
4195
|
-
codec: e[
|
|
4196
|
-
mediaSource: e[
|
|
4197
|
-
remoteInboundRtp: e[
|
|
4426
|
+
outboundRtp: e[p.OUTBOUND_RTP],
|
|
4427
|
+
codec: e[p.CODEC],
|
|
4428
|
+
mediaSource: e[p.MEDIA_SOURCE],
|
|
4429
|
+
remoteInboundRtp: e[p.REMOTE_INBOUND_RTP]
|
|
4198
4430
|
};
|
|
4199
|
-
},
|
|
4431
|
+
}, he = (n) => {
|
|
4200
4432
|
if (!n)
|
|
4201
4433
|
return {
|
|
4202
4434
|
outboundRtp: void 0,
|
|
@@ -4204,14 +4436,14 @@ const De = ["collected"], Dn = () => new A(De), yn = "api/v2/rtp2webrtc/offer",
|
|
|
4204
4436
|
mediaSource: void 0,
|
|
4205
4437
|
remoteInboundRtp: void 0
|
|
4206
4438
|
};
|
|
4207
|
-
const e =
|
|
4439
|
+
const e = q(n);
|
|
4208
4440
|
return {
|
|
4209
|
-
outboundRtp: e[
|
|
4210
|
-
codec: e[
|
|
4211
|
-
mediaSource: e[
|
|
4212
|
-
remoteInboundRtp: e[
|
|
4441
|
+
outboundRtp: e[p.OUTBOUND_RTP],
|
|
4442
|
+
codec: e[p.CODEC],
|
|
4443
|
+
mediaSource: e[p.MEDIA_SOURCE],
|
|
4444
|
+
remoteInboundRtp: e[p.REMOTE_INBOUND_RTP]
|
|
4213
4445
|
};
|
|
4214
|
-
},
|
|
4446
|
+
}, le = ({
|
|
4215
4447
|
videoReceiversStats: n,
|
|
4216
4448
|
synchronizationSourcesVideo: e
|
|
4217
4449
|
}) => {
|
|
@@ -4221,13 +4453,13 @@ const De = ["collected"], Dn = () => new A(De), yn = "api/v2/rtp2webrtc/offer",
|
|
|
4221
4453
|
codec: void 0,
|
|
4222
4454
|
synchronizationSources: e
|
|
4223
4455
|
};
|
|
4224
|
-
const t =
|
|
4456
|
+
const t = q(n);
|
|
4225
4457
|
return {
|
|
4226
|
-
inboundRtp: t[
|
|
4227
|
-
codec: t[
|
|
4458
|
+
inboundRtp: t[p.INBOUND_RTP],
|
|
4459
|
+
codec: t[p.CODEC],
|
|
4228
4460
|
synchronizationSources: e
|
|
4229
4461
|
};
|
|
4230
|
-
},
|
|
4462
|
+
}, zn = ({
|
|
4231
4463
|
audioReceiverStats: n,
|
|
4232
4464
|
synchronizationSourcesAudio: e
|
|
4233
4465
|
}) => {
|
|
@@ -4238,14 +4470,14 @@ const De = ["collected"], Dn = () => new A(De), yn = "api/v2/rtp2webrtc/offer",
|
|
|
4238
4470
|
remoteOutboundRtp: void 0,
|
|
4239
4471
|
synchronizationSources: e
|
|
4240
4472
|
};
|
|
4241
|
-
const t =
|
|
4473
|
+
const t = q(n);
|
|
4242
4474
|
return {
|
|
4243
|
-
inboundRtp: t[
|
|
4244
|
-
codec: t[
|
|
4245
|
-
remoteOutboundRtp: t[
|
|
4475
|
+
inboundRtp: t[p.INBOUND_RTP],
|
|
4476
|
+
codec: t[p.CODEC],
|
|
4477
|
+
remoteOutboundRtp: t[p.REMOTE_OUTBOUND_RTP],
|
|
4246
4478
|
synchronizationSources: e
|
|
4247
4479
|
};
|
|
4248
|
-
},
|
|
4480
|
+
}, ke = (n) => {
|
|
4249
4481
|
if (!n)
|
|
4250
4482
|
return {
|
|
4251
4483
|
candidatePair: void 0,
|
|
@@ -4254,47 +4486,47 @@ const De = ["collected"], Dn = () => new A(De), yn = "api/v2/rtp2webrtc/offer",
|
|
|
4254
4486
|
remoteCandidate: void 0,
|
|
4255
4487
|
transport: void 0
|
|
4256
4488
|
};
|
|
4257
|
-
const e =
|
|
4489
|
+
const e = q(n);
|
|
4258
4490
|
return {
|
|
4259
|
-
candidatePair: e[
|
|
4260
|
-
certificate: e[
|
|
4261
|
-
localCandidate: e[
|
|
4262
|
-
remoteCandidate: e[
|
|
4263
|
-
transport: e[
|
|
4491
|
+
candidatePair: e[p.CANDIDATE_PAIR],
|
|
4492
|
+
certificate: e[p.CERTIFICATE],
|
|
4493
|
+
localCandidate: e[p.LOCAL_CANDIDATE],
|
|
4494
|
+
remoteCandidate: e[p.REMOTE_CANDIDATE],
|
|
4495
|
+
transport: e[p.TRANSPORT]
|
|
4264
4496
|
};
|
|
4265
|
-
},
|
|
4497
|
+
}, jn = ({
|
|
4266
4498
|
audioSenderStats: n,
|
|
4267
4499
|
videoSenderFirstStats: e,
|
|
4268
4500
|
videoSenderSecondStats: t
|
|
4269
4501
|
}) => ({
|
|
4270
|
-
video:
|
|
4271
|
-
secondVideo:
|
|
4272
|
-
audio:
|
|
4273
|
-
additional:
|
|
4502
|
+
video: he(e),
|
|
4503
|
+
secondVideo: he(t),
|
|
4504
|
+
audio: Jn(n),
|
|
4505
|
+
additional: ke(
|
|
4274
4506
|
n ?? e ?? t
|
|
4275
4507
|
)
|
|
4276
|
-
}),
|
|
4508
|
+
}), Kn = ({
|
|
4277
4509
|
audioReceiverStats: n,
|
|
4278
4510
|
videoReceiverFirstStats: e,
|
|
4279
4511
|
videoReceiverSecondStats: t,
|
|
4280
4512
|
synchronizationSources: s
|
|
4281
4513
|
}) => ({
|
|
4282
|
-
video:
|
|
4514
|
+
video: le({
|
|
4283
4515
|
videoReceiversStats: e,
|
|
4284
4516
|
synchronizationSourcesVideo: s.video
|
|
4285
4517
|
}),
|
|
4286
|
-
secondVideo:
|
|
4518
|
+
secondVideo: le({
|
|
4287
4519
|
videoReceiversStats: t,
|
|
4288
4520
|
synchronizationSourcesVideo: s.video
|
|
4289
4521
|
}),
|
|
4290
|
-
audio:
|
|
4522
|
+
audio: zn({
|
|
4291
4523
|
audioReceiverStats: n,
|
|
4292
4524
|
synchronizationSourcesAudio: s.audio
|
|
4293
4525
|
}),
|
|
4294
|
-
additional:
|
|
4526
|
+
additional: ke(
|
|
4295
4527
|
n ?? e ?? t
|
|
4296
4528
|
)
|
|
4297
|
-
}),
|
|
4529
|
+
}), Zn = ({
|
|
4298
4530
|
audioSenderStats: n,
|
|
4299
4531
|
videoSenderFirstStats: e,
|
|
4300
4532
|
videoSenderSecondStats: t,
|
|
@@ -4303,11 +4535,11 @@ const De = ["collected"], Dn = () => new A(De), yn = "api/v2/rtp2webrtc/offer",
|
|
|
4303
4535
|
videoReceiverSecondStats: r,
|
|
4304
4536
|
synchronizationSources: a
|
|
4305
4537
|
}) => {
|
|
4306
|
-
const o =
|
|
4538
|
+
const o = jn({
|
|
4307
4539
|
audioSenderStats: n,
|
|
4308
4540
|
videoSenderFirstStats: e,
|
|
4309
4541
|
videoSenderSecondStats: t
|
|
4310
|
-
}), c =
|
|
4542
|
+
}), c = Kn({
|
|
4311
4543
|
audioReceiverStats: s,
|
|
4312
4544
|
videoReceiverFirstStats: i,
|
|
4313
4545
|
videoReceiverSecondStats: r,
|
|
@@ -4317,16 +4549,16 @@ const De = ["collected"], Dn = () => new A(De), yn = "api/v2/rtp2webrtc/offer",
|
|
|
4317
4549
|
outbound: o,
|
|
4318
4550
|
inbound: c
|
|
4319
4551
|
};
|
|
4320
|
-
},
|
|
4321
|
-
const e = "audio", t = "video", s = n.getSenders(), i = s.find((E) => E.track?.kind === e), r = s.filter((E) => E.track?.kind === t), a = n.getReceivers(), o = a.find((E) => E.track.kind === e), c = a.filter((E) => E.track.kind === t),
|
|
4552
|
+
}, es = async (n) => {
|
|
4553
|
+
const e = "audio", t = "video", s = n.getSenders(), i = s.find((E) => E.track?.kind === e), r = s.filter((E) => E.track?.kind === t), a = n.getReceivers(), o = a.find((E) => E.track.kind === e), c = a.filter((E) => E.track.kind === t), l = {
|
|
4322
4554
|
trackIdentifier: o?.track.id,
|
|
4323
4555
|
item: o?.getSynchronizationSources()[0]
|
|
4324
|
-
},
|
|
4556
|
+
}, T = {
|
|
4325
4557
|
trackIdentifier: c[0]?.track.id,
|
|
4326
4558
|
item: c[0]?.getSynchronizationSources()[0]
|
|
4327
|
-
},
|
|
4328
|
-
audio:
|
|
4329
|
-
video:
|
|
4559
|
+
}, u = {
|
|
4560
|
+
audio: l,
|
|
4561
|
+
video: T
|
|
4330
4562
|
};
|
|
4331
4563
|
return Promise.all([
|
|
4332
4564
|
i?.getStats() ?? Promise.resolve(void 0),
|
|
@@ -4338,38 +4570,38 @@ const De = ["collected"], Dn = () => new A(De), yn = "api/v2/rtp2webrtc/offer",
|
|
|
4338
4570
|
]).then((E) => {
|
|
4339
4571
|
const [
|
|
4340
4572
|
m,
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4573
|
+
D,
|
|
4574
|
+
A,
|
|
4575
|
+
w,
|
|
4576
|
+
X,
|
|
4577
|
+
xe
|
|
4346
4578
|
] = E;
|
|
4347
4579
|
return {
|
|
4348
|
-
synchronizationSources:
|
|
4580
|
+
synchronizationSources: u,
|
|
4349
4581
|
audioSenderStats: m,
|
|
4350
|
-
videoSenderFirstStats:
|
|
4351
|
-
videoSenderSecondStats:
|
|
4352
|
-
audioReceiverStats:
|
|
4353
|
-
videoReceiverFirstStats:
|
|
4354
|
-
videoReceiverSecondStats:
|
|
4582
|
+
videoSenderFirstStats: D,
|
|
4583
|
+
videoSenderSecondStats: A,
|
|
4584
|
+
audioReceiverStats: w,
|
|
4585
|
+
videoReceiverFirstStats: X,
|
|
4586
|
+
videoReceiverSecondStats: xe
|
|
4355
4587
|
};
|
|
4356
4588
|
});
|
|
4357
|
-
},
|
|
4589
|
+
}, ts = (n) => {
|
|
4358
4590
|
d(String(n));
|
|
4359
4591
|
};
|
|
4360
|
-
class
|
|
4592
|
+
class ns {
|
|
4361
4593
|
events;
|
|
4362
4594
|
setTimeoutRequest;
|
|
4363
|
-
requesterAllStatistics = new
|
|
4595
|
+
requesterAllStatistics = new Y(es);
|
|
4364
4596
|
constructor() {
|
|
4365
|
-
this.events =
|
|
4597
|
+
this.events = Qn(), this.setTimeoutRequest = new ue();
|
|
4366
4598
|
}
|
|
4367
4599
|
get requested() {
|
|
4368
4600
|
return this.setTimeoutRequest.requested;
|
|
4369
4601
|
}
|
|
4370
4602
|
start(e, {
|
|
4371
|
-
interval: t =
|
|
4372
|
-
onError: s =
|
|
4603
|
+
interval: t = B,
|
|
4604
|
+
onError: s = ts
|
|
4373
4605
|
} = {}) {
|
|
4374
4606
|
this.stop(), this.setTimeoutRequest.request(() => {
|
|
4375
4607
|
this.collectStatistics(e, {
|
|
@@ -4398,12 +4630,12 @@ class qn {
|
|
|
4398
4630
|
collectStatistics = (e, {
|
|
4399
4631
|
onError: t
|
|
4400
4632
|
}) => {
|
|
4401
|
-
const s =
|
|
4402
|
-
this.
|
|
4403
|
-
this.events.trigger("collected",
|
|
4404
|
-
const a =
|
|
4405
|
-
let o =
|
|
4406
|
-
a > 48 ? o =
|
|
4633
|
+
const s = de();
|
|
4634
|
+
this.requestAllStatistics(e).then((i) => {
|
|
4635
|
+
this.events.trigger("collected", Zn(i));
|
|
4636
|
+
const a = de() - s;
|
|
4637
|
+
let o = B;
|
|
4638
|
+
a > 48 ? o = B * 4 : a > 32 ? o = B * 3 : a > 16 && (o = B * 2), this.start(e, {
|
|
4407
4639
|
onError: t,
|
|
4408
4640
|
interval: o
|
|
4409
4641
|
});
|
|
@@ -4411,9 +4643,15 @@ class qn {
|
|
|
4411
4643
|
t && t(i);
|
|
4412
4644
|
});
|
|
4413
4645
|
};
|
|
4646
|
+
requestAllStatistics = async (e) => {
|
|
4647
|
+
const t = e();
|
|
4648
|
+
if (t === void 0)
|
|
4649
|
+
throw new Error("failed to collect statistics: peerConnection is not defined");
|
|
4650
|
+
return this.requesterAllStatistics.request(t);
|
|
4651
|
+
};
|
|
4414
4652
|
}
|
|
4415
|
-
const
|
|
4416
|
-
class
|
|
4653
|
+
const ss = 500;
|
|
4654
|
+
class is {
|
|
4417
4655
|
statsPeerConnection;
|
|
4418
4656
|
availableStats;
|
|
4419
4657
|
previousAvailableStats;
|
|
@@ -4423,7 +4661,7 @@ class Vn {
|
|
|
4423
4661
|
callManager: e,
|
|
4424
4662
|
apiManager: t
|
|
4425
4663
|
}) {
|
|
4426
|
-
this.callManager = e, this.apiManager = t, this.statsPeerConnection = new
|
|
4664
|
+
this.callManager = e, this.apiManager = t, this.statsPeerConnection = new ns(), this.subscribe();
|
|
4427
4665
|
}
|
|
4428
4666
|
get events() {
|
|
4429
4667
|
return this.statsPeerConnection.events;
|
|
@@ -4473,7 +4711,7 @@ class Vn {
|
|
|
4473
4711
|
return this.previousInboundRtp?.packetsReceived;
|
|
4474
4712
|
}
|
|
4475
4713
|
get isReceivingPackets() {
|
|
4476
|
-
const e = this.packetsReceived !== void 0 && this.packetsReceived >=
|
|
4714
|
+
const e = this.packetsReceived !== void 0 && this.packetsReceived >= ss, t = this.packetsReceived !== this.previousPacketsReceived;
|
|
4477
4715
|
return e && t;
|
|
4478
4716
|
}
|
|
4479
4717
|
on(e, t) {
|
|
@@ -4501,8 +4739,8 @@ class Vn {
|
|
|
4501
4739
|
handleStatsCollected = (e) => {
|
|
4502
4740
|
this.previousAvailableStats = this.availableStats, this.availableStats = e, this.maybeSendStats();
|
|
4503
4741
|
};
|
|
4504
|
-
handleStarted = (
|
|
4505
|
-
this.statsPeerConnection.start(
|
|
4742
|
+
handleStarted = () => {
|
|
4743
|
+
this.statsPeerConnection.start(this.callManager.getActivePeerConnection);
|
|
4506
4744
|
};
|
|
4507
4745
|
handleEnded = () => {
|
|
4508
4746
|
this.statsPeerConnection.stop(), this.availableStats = void 0, this.previousAvailableStats = void 0;
|
|
@@ -4513,33 +4751,33 @@ class Vn {
|
|
|
4513
4751
|
});
|
|
4514
4752
|
}
|
|
4515
4753
|
}
|
|
4516
|
-
const
|
|
4754
|
+
const rs = (n, e) => n.filter((s) => e.some((i) => i.clockRate === s.clockRate && i.mimeType === s.mimeType && i.channels === s.channels && i.sdpFmtpLine === s.sdpFmtpLine)), as = (n) => {
|
|
4517
4755
|
const e = RTCRtpSender.getCapabilities(n), t = RTCRtpReceiver.getCapabilities(n), s = e === null ? [] : e.codecs, i = t === null ? [] : t.codecs;
|
|
4518
|
-
return
|
|
4519
|
-
},
|
|
4756
|
+
return rs(s, i);
|
|
4757
|
+
}, os = (n, e) => e === void 0 || e.length === 0 ? n : n.sort((t, s) => {
|
|
4520
4758
|
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;
|
|
4521
4759
|
return a - o;
|
|
4522
|
-
}),
|
|
4760
|
+
}), cs = (n, e) => e === void 0 || e.length === 0 ? n : n.filter((t) => !e.includes(t.mimeType)), ds = (n, {
|
|
4523
4761
|
preferredMimeTypesVideoCodecs: e,
|
|
4524
4762
|
excludeMimeTypesVideoCodecs: t
|
|
4525
4763
|
}) => {
|
|
4526
4764
|
try {
|
|
4527
4765
|
if (typeof n.setCodecPreferences == "function" && n.sender.track?.kind === "video" && (e !== void 0 && e.length > 0 || t !== void 0 && t.length > 0)) {
|
|
4528
|
-
const s =
|
|
4766
|
+
const s = as("video"), i = cs(s, t), r = os(i, e);
|
|
4529
4767
|
n.setCodecPreferences(r);
|
|
4530
4768
|
}
|
|
4531
4769
|
} catch (s) {
|
|
4532
4770
|
d("setCodecPreferences error", s);
|
|
4533
4771
|
}
|
|
4534
|
-
},
|
|
4535
|
-
class
|
|
4772
|
+
}, hs = (n) => [...n.keys()].map((e) => n.get(e)), ls = (n, e) => hs(n).find((t) => t?.type === e), gs = async (n) => n.getStats().then((e) => ls(e, "codec")?.mimeType);
|
|
4773
|
+
class us {
|
|
4536
4774
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
4537
4775
|
async getCodecFromSender(e) {
|
|
4538
|
-
return await
|
|
4776
|
+
return await gs(e) ?? "";
|
|
4539
4777
|
}
|
|
4540
4778
|
}
|
|
4541
|
-
class
|
|
4542
|
-
stackPromises =
|
|
4779
|
+
class Ts {
|
|
4780
|
+
stackPromises = Ee({
|
|
4543
4781
|
noRunIsNotActual: !0
|
|
4544
4782
|
});
|
|
4545
4783
|
/**
|
|
@@ -4563,30 +4801,30 @@ class Zn {
|
|
|
4563
4801
|
});
|
|
4564
4802
|
}
|
|
4565
4803
|
}
|
|
4566
|
-
class
|
|
4804
|
+
class Es {
|
|
4567
4805
|
taskQueue;
|
|
4568
4806
|
onSetParameters;
|
|
4569
4807
|
constructor(e) {
|
|
4570
|
-
this.onSetParameters = e, this.taskQueue = new
|
|
4808
|
+
this.onSetParameters = e, this.taskQueue = new Ts();
|
|
4571
4809
|
}
|
|
4572
4810
|
async setEncodingsToSender(e, t) {
|
|
4573
|
-
return this.taskQueue.add(async () =>
|
|
4811
|
+
return this.taskQueue.add(async () => fe(e, t, this.onSetParameters));
|
|
4574
4812
|
}
|
|
4575
4813
|
stop() {
|
|
4576
4814
|
this.taskQueue.stop();
|
|
4577
4815
|
}
|
|
4578
4816
|
}
|
|
4579
|
-
const
|
|
4580
|
-
const t =
|
|
4581
|
-
return
|
|
4582
|
-
},
|
|
4817
|
+
const $e = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), Ss = 1e6, b = (n) => n * Ss, Ge = b(0.06), Ve = b(4), Cs = (n) => n <= 64 ? Ge : n <= 128 ? b(0.12) : n <= 256 ? b(0.25) : n <= 384 ? b(0.32) : n <= 426 ? b(0.38) : n <= 640 ? b(0.5) : n <= 848 ? b(0.7) : n <= 1280 ? b(1) : n <= 1920 ? b(2) : Ve, ps = "av1", ms = (n) => $e(n, ps), Ns = 0.6, ne = (n, e) => ms(e) ? n * Ns : n, As = (n) => ne(Ge, n), Rs = (n) => ne(Ve, n), ge = (n, e) => {
|
|
4818
|
+
const t = Cs(n);
|
|
4819
|
+
return ne(t, e);
|
|
4820
|
+
}, z = 1, Is = ({
|
|
4583
4821
|
videoTrack: n,
|
|
4584
4822
|
targetSize: e
|
|
4585
4823
|
}) => {
|
|
4586
|
-
const t = n.getSettings(), s = t.width, i = t.height, r = s === void 0 ?
|
|
4587
|
-
return Math.max(r, a,
|
|
4824
|
+
const t = n.getSettings(), s = t.width, i = t.height, r = s === void 0 ? z : s / e.width, a = i === void 0 ? z : i / e.height;
|
|
4825
|
+
return Math.max(r, a, z);
|
|
4588
4826
|
};
|
|
4589
|
-
class
|
|
4827
|
+
class vs {
|
|
4590
4828
|
ignoreForCodec;
|
|
4591
4829
|
senderFinder;
|
|
4592
4830
|
codecProvider;
|
|
@@ -4619,7 +4857,7 @@ class ds {
|
|
|
4619
4857
|
if (!i?.track)
|
|
4620
4858
|
return { ...this.resultNoChanged, sender: i };
|
|
4621
4859
|
const r = await this.codecProvider.getCodecFromSender(i);
|
|
4622
|
-
if (
|
|
4860
|
+
if ($e(r, this.ignoreForCodec))
|
|
4623
4861
|
return { ...this.resultNoChanged, sender: i };
|
|
4624
4862
|
const { mainCam: a, resolutionMainCam: o } = t ?? {};
|
|
4625
4863
|
return this.processSender(
|
|
@@ -4639,14 +4877,14 @@ class ds {
|
|
|
4639
4877
|
async processSender(e, t) {
|
|
4640
4878
|
const { mainCam: s, resolutionMainCam: i } = e;
|
|
4641
4879
|
switch (s) {
|
|
4642
|
-
case
|
|
4880
|
+
case f.PAUSE_MAIN_CAM:
|
|
4643
4881
|
return this.downgradeResolutionSender(t);
|
|
4644
|
-
case
|
|
4882
|
+
case f.RESUME_MAIN_CAM:
|
|
4645
4883
|
return this.setBitrateByTrackResolution(t);
|
|
4646
|
-
case
|
|
4884
|
+
case f.MAX_MAIN_CAM_RESOLUTION:
|
|
4647
4885
|
return i !== void 0 ? this.setResolutionSender(i, t) : this.setBitrateByTrackResolution(t);
|
|
4648
|
-
case
|
|
4649
|
-
case
|
|
4886
|
+
case f.ADMIN_STOP_MAIN_CAM:
|
|
4887
|
+
case f.ADMIN_START_MAIN_CAM:
|
|
4650
4888
|
case void 0:
|
|
4651
4889
|
return this.setBitrateByTrackResolution(t);
|
|
4652
4890
|
default:
|
|
@@ -4661,7 +4899,7 @@ class ds {
|
|
|
4661
4899
|
async downgradeResolutionSender(e) {
|
|
4662
4900
|
const { sender: t, codec: s } = e, i = {
|
|
4663
4901
|
scaleResolutionDownBy: 200,
|
|
4664
|
-
maxBitrate:
|
|
4902
|
+
maxBitrate: As(s)
|
|
4665
4903
|
};
|
|
4666
4904
|
return this.parametersSetter.setEncodingsToSender(t, i);
|
|
4667
4905
|
}
|
|
@@ -4671,7 +4909,7 @@ class ds {
|
|
|
4671
4909
|
* @returns Promise с результатом
|
|
4672
4910
|
*/
|
|
4673
4911
|
async setBitrateByTrackResolution(e) {
|
|
4674
|
-
const { sender: t, videoTrack: s, codec: i } = e, a = s.getSettings().width, o = a === void 0 ?
|
|
4912
|
+
const { sender: t, videoTrack: s, codec: i } = e, a = s.getSettings().width, o = a === void 0 ? Rs(i) : ge(a, i);
|
|
4675
4913
|
return this.parametersSetter.setEncodingsToSender(t, {
|
|
4676
4914
|
scaleResolutionDownBy: 1,
|
|
4677
4915
|
maxBitrate: o
|
|
@@ -4687,24 +4925,24 @@ class ds {
|
|
|
4687
4925
|
const [s, i] = e.split("x"), { sender: r, videoTrack: a, codec: o } = t, c = {
|
|
4688
4926
|
width: Number(s),
|
|
4689
4927
|
height: Number(i)
|
|
4690
|
-
},
|
|
4928
|
+
}, l = Is({
|
|
4691
4929
|
videoTrack: a,
|
|
4692
4930
|
targetSize: c
|
|
4693
|
-
}),
|
|
4694
|
-
scaleResolutionDownBy:
|
|
4695
|
-
maxBitrate:
|
|
4931
|
+
}), T = ge(c.width, o), u = {
|
|
4932
|
+
scaleResolutionDownBy: l,
|
|
4933
|
+
maxBitrate: T
|
|
4696
4934
|
};
|
|
4697
|
-
return this.parametersSetter.setEncodingsToSender(r,
|
|
4935
|
+
return this.parametersSetter.setEncodingsToSender(r, u);
|
|
4698
4936
|
}
|
|
4699
4937
|
}
|
|
4700
|
-
const
|
|
4701
|
-
class
|
|
4938
|
+
const fs = (n) => n.find((e) => e.track?.kind === "video");
|
|
4939
|
+
class Ms {
|
|
4702
4940
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
4703
4941
|
findVideoSender(e) {
|
|
4704
|
-
return
|
|
4942
|
+
return fs(e);
|
|
4705
4943
|
}
|
|
4706
4944
|
}
|
|
4707
|
-
class
|
|
4945
|
+
class _s {
|
|
4708
4946
|
currentSender;
|
|
4709
4947
|
originalReplaceTrack;
|
|
4710
4948
|
lastWidth;
|
|
@@ -4717,7 +4955,7 @@ class gs {
|
|
|
4717
4955
|
pollIntervalMs: e = 1e3,
|
|
4718
4956
|
maxPollIntervalMs: t
|
|
4719
4957
|
}) {
|
|
4720
|
-
this.pollIntervalMs = e, this.maxPollIntervalMs = t ?? e * 16, this.currentPollIntervalMs = this.pollIntervalMs, this.setTimeoutRequest = new
|
|
4958
|
+
this.pollIntervalMs = e, this.maxPollIntervalMs = t ?? e * 16, this.currentPollIntervalMs = this.pollIntervalMs, this.setTimeoutRequest = new ue();
|
|
4721
4959
|
}
|
|
4722
4960
|
/**
|
|
4723
4961
|
* Проверяет актуальный video-sender и (при необходимости) перенастраивает наблюдение.
|
|
@@ -4768,7 +5006,7 @@ class gs {
|
|
|
4768
5006
|
this.setTimeoutRequest.cancelRequest(), this.lastWidth = void 0, this.lastHeight = void 0;
|
|
4769
5007
|
}
|
|
4770
5008
|
}
|
|
4771
|
-
class
|
|
5009
|
+
class bs {
|
|
4772
5010
|
apiManager;
|
|
4773
5011
|
currentHandler;
|
|
4774
5012
|
constructor(e) {
|
|
@@ -4788,7 +5026,7 @@ class us {
|
|
|
4788
5026
|
this.currentHandler && (this.apiManager.off("main-cam-control", this.currentHandler), this.currentHandler = void 0);
|
|
4789
5027
|
}
|
|
4790
5028
|
}
|
|
4791
|
-
class
|
|
5029
|
+
class Os {
|
|
4792
5030
|
eventHandler;
|
|
4793
5031
|
senderBalancer;
|
|
4794
5032
|
parametersSetterWithQueue;
|
|
@@ -4800,16 +5038,16 @@ class Ts {
|
|
|
4800
5038
|
onSetParameters: i,
|
|
4801
5039
|
pollIntervalMs: r
|
|
4802
5040
|
} = {}) {
|
|
4803
|
-
this.getConnection = t, this.eventHandler = new
|
|
5041
|
+
this.getConnection = t, this.eventHandler = new bs(e), this.parametersSetterWithQueue = new Es(i), this.senderBalancer = new vs(
|
|
4804
5042
|
{
|
|
4805
|
-
senderFinder: new
|
|
4806
|
-
codecProvider: new
|
|
5043
|
+
senderFinder: new Ms(),
|
|
5044
|
+
codecProvider: new us(),
|
|
4807
5045
|
parametersSetter: this.parametersSetterWithQueue
|
|
4808
5046
|
},
|
|
4809
5047
|
{
|
|
4810
5048
|
ignoreForCodec: s
|
|
4811
5049
|
}
|
|
4812
|
-
), this.trackMonitor = new
|
|
5050
|
+
), this.trackMonitor = new _s({ pollIntervalMs: r });
|
|
4813
5051
|
}
|
|
4814
5052
|
/**
|
|
4815
5053
|
* Подписывается на события управления главной камерой
|
|
@@ -4854,13 +5092,13 @@ class Ts {
|
|
|
4854
5092
|
});
|
|
4855
5093
|
};
|
|
4856
5094
|
}
|
|
4857
|
-
const
|
|
5095
|
+
const qe = [
|
|
4858
5096
|
"balancing-scheduled",
|
|
4859
5097
|
"balancing-started",
|
|
4860
5098
|
"balancing-stopped",
|
|
4861
5099
|
"parameters-updated"
|
|
4862
|
-
],
|
|
4863
|
-
class
|
|
5100
|
+
], Ds = () => new R(qe);
|
|
5101
|
+
class Ps {
|
|
4864
5102
|
isBalancingActive = !1;
|
|
4865
5103
|
events;
|
|
4866
5104
|
callManager;
|
|
@@ -4868,7 +5106,7 @@ class Ss {
|
|
|
4868
5106
|
videoSendingBalancer;
|
|
4869
5107
|
startBalancingTimer;
|
|
4870
5108
|
constructor(e, t, s = {}) {
|
|
4871
|
-
this.events =
|
|
5109
|
+
this.events = Ds(), this.callManager = e, this.balancingStartDelay = s.balancingStartDelay ?? 1e4, this.videoSendingBalancer = new Os(
|
|
4872
5110
|
t,
|
|
4873
5111
|
() => e.connection,
|
|
4874
5112
|
{
|
|
@@ -4938,13 +5176,13 @@ class Ss {
|
|
|
4938
5176
|
this.startBalancingTimer && (clearTimeout(this.startBalancingTimer), this.startBalancingTimer = void 0);
|
|
4939
5177
|
}
|
|
4940
5178
|
}
|
|
4941
|
-
const
|
|
4942
|
-
class
|
|
5179
|
+
const He = "no-inbound-frames", We = [He], ys = () => new R(We);
|
|
5180
|
+
class Ls {
|
|
4943
5181
|
events;
|
|
4944
5182
|
statsManager;
|
|
4945
5183
|
callManager;
|
|
4946
5184
|
constructor(e, t) {
|
|
4947
|
-
this.statsManager = e, this.callManager = t, this.events =
|
|
5185
|
+
this.statsManager = e, this.callManager = t, this.events = ys(), this.subscribe();
|
|
4948
5186
|
}
|
|
4949
5187
|
get mainVideoTrack() {
|
|
4950
5188
|
return this.callManager.getMainRemoteStream()?.getVideoTracks()[0];
|
|
@@ -4957,20 +5195,20 @@ class Cs {
|
|
|
4957
5195
|
return this.events.on(e, t);
|
|
4958
5196
|
}
|
|
4959
5197
|
handleStatsCollected = () => {
|
|
4960
|
-
this.hasNoIncomingFrames() && this.events.trigger(
|
|
5198
|
+
this.hasNoIncomingFrames() && this.events.trigger(He, {});
|
|
4961
5199
|
};
|
|
4962
5200
|
hasNoIncomingFrames = () => this.statsManager.isInvalidInboundFrames && this.isMutedMainVideoTrack;
|
|
4963
5201
|
subscribe() {
|
|
4964
5202
|
this.statsManager.on("collected", this.handleStatsCollected);
|
|
4965
5203
|
}
|
|
4966
5204
|
}
|
|
4967
|
-
const
|
|
4968
|
-
class
|
|
5205
|
+
const ws = 3e3;
|
|
5206
|
+
class Us {
|
|
4969
5207
|
renegotiateRequester;
|
|
4970
5208
|
renegotiateThrottled;
|
|
4971
5209
|
callManager;
|
|
4972
|
-
constructor(e, t =
|
|
4973
|
-
this.callManager = e, this.renegotiateRequester = new
|
|
5210
|
+
constructor(e, t = ws) {
|
|
5211
|
+
this.callManager = e, this.renegotiateRequester = new Y(e.renegotiate.bind(e)), this.renegotiateThrottled = et.throttle(
|
|
4974
5212
|
this.requestRenegotiate.bind(this),
|
|
4975
5213
|
t
|
|
4976
5214
|
), this.subscribe();
|
|
@@ -4998,29 +5236,30 @@ class Ns {
|
|
|
4998
5236
|
d("cancel recover main stream"), this.renegotiateThrottled.cancel(), this.renegotiateRequester.cancelRequest();
|
|
4999
5237
|
}
|
|
5000
5238
|
}
|
|
5001
|
-
const
|
|
5239
|
+
const Fs = 1e6, Bs = ye.map((n) => `auto-connect:${n}`), ks = be.map((n) => `connection:${n}`), $s = Ne.map((n) => `call:${n}`), Gs = Le.map((n) => `conference-state:${n}`), Vs = pe.map((n) => `api:${n}`), qs = we.map((n) => `incoming-call:${n}`), Hs = Me.map((n) => `presentation:${n}`), Ws = Be.map((n) => `stats:${n}`), xs = qe.map((n) => `video-balancer:${n}`), Qs = We.map((n) => `main-stream-health:${n}`), Ys = Fe.map((n) => `session:${n}`), Xs = [
|
|
5002
5240
|
"disconnected-from-out-of-call",
|
|
5003
5241
|
"connected-with-configuration-from-out-of-call",
|
|
5004
5242
|
"stopped-presentation-by-server-command"
|
|
5005
|
-
],
|
|
5006
|
-
...
|
|
5007
|
-
...
|
|
5008
|
-
|
|
5009
|
-
...
|
|
5010
|
-
...
|
|
5011
|
-
...
|
|
5012
|
-
...
|
|
5013
|
-
...
|
|
5014
|
-
...
|
|
5015
|
-
...
|
|
5016
|
-
...
|
|
5017
|
-
...
|
|
5018
|
-
],
|
|
5019
|
-
class
|
|
5243
|
+
], Js = [
|
|
5244
|
+
...Bs,
|
|
5245
|
+
...ks,
|
|
5246
|
+
...$s,
|
|
5247
|
+
...Gs,
|
|
5248
|
+
...Vs,
|
|
5249
|
+
...qs,
|
|
5250
|
+
...Hs,
|
|
5251
|
+
...Ws,
|
|
5252
|
+
...xs,
|
|
5253
|
+
...Qs,
|
|
5254
|
+
...Ys,
|
|
5255
|
+
...Xs
|
|
5256
|
+
], zs = () => new R(Js);
|
|
5257
|
+
class hi {
|
|
5020
5258
|
events;
|
|
5021
5259
|
connectionManager;
|
|
5022
5260
|
connectionQueueManager;
|
|
5023
5261
|
conferenceStateManager;
|
|
5262
|
+
contentedStreamManager;
|
|
5024
5263
|
callManager;
|
|
5025
5264
|
autoConnectorManager;
|
|
5026
5265
|
apiManager;
|
|
@@ -5039,33 +5278,33 @@ class Js {
|
|
|
5039
5278
|
videoBalancerOptions: i,
|
|
5040
5279
|
autoConnectorOptions: r
|
|
5041
5280
|
} = {}) {
|
|
5042
|
-
this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events =
|
|
5281
|
+
this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events = zs(), this.apiManager = new dt(), this.connectionManager = new un({ JsSIP: e }), this.connectionQueueManager = new Tn({
|
|
5043
5282
|
connectionManager: this.connectionManager
|
|
5044
|
-
}), this.conferenceStateManager = new
|
|
5045
|
-
connectionManager: this.connectionManager,
|
|
5046
|
-
callManager: this.callManager
|
|
5047
|
-
}), this.incomingCallManager = new _n(this.connectionManager), this.presentationManager = new kt({
|
|
5283
|
+
}), this.conferenceStateManager = new Dn(), this.contentedStreamManager = new Un(), this.callManager = new bt(this.conferenceStateManager, this.contentedStreamManager), this.incomingCallManager = new qn(this.connectionManager), this.presentationManager = new Yt({
|
|
5048
5284
|
callManager: this.callManager,
|
|
5049
|
-
maxBitrate:
|
|
5050
|
-
}), this.statsManager = new
|
|
5285
|
+
maxBitrate: Fs
|
|
5286
|
+
}), this.statsManager = new is({
|
|
5051
5287
|
callManager: this.callManager,
|
|
5052
5288
|
apiManager: this.apiManager
|
|
5053
|
-
}), this.autoConnectorManager = new
|
|
5289
|
+
}), this.autoConnectorManager = new bn(
|
|
5054
5290
|
{
|
|
5055
5291
|
connectionQueueManager: this.connectionQueueManager,
|
|
5056
5292
|
connectionManager: this.connectionManager,
|
|
5057
5293
|
callManager: this.callManager
|
|
5058
5294
|
},
|
|
5059
5295
|
r
|
|
5060
|
-
), this.videoSendingBalancerManager = new
|
|
5296
|
+
), this.videoSendingBalancerManager = new Ps(
|
|
5061
5297
|
this.callManager,
|
|
5062
5298
|
this.apiManager,
|
|
5063
5299
|
i
|
|
5064
|
-
), this.mainStreamHealthMonitor = new
|
|
5300
|
+
), this.mainStreamHealthMonitor = new Ls(this.statsManager, this.callManager), this.mainStreamRecovery = new Us(this.callManager), this.sessionManager = new xn({
|
|
5065
5301
|
connectionManager: this.connectionManager,
|
|
5066
5302
|
callManager: this.callManager,
|
|
5067
5303
|
incomingCallManager: this.incomingCallManager,
|
|
5068
5304
|
presentationManager: this.presentationManager
|
|
5305
|
+
}), this.contentedStreamManager.subscribeToApiEvents(this.apiManager), this.apiManager.subscribe({
|
|
5306
|
+
connectionManager: this.connectionManager,
|
|
5307
|
+
callManager: this.callManager
|
|
5069
5308
|
}), this.subscribe();
|
|
5070
5309
|
}
|
|
5071
5310
|
get requestedConnection() {
|
|
@@ -5170,7 +5409,7 @@ class Js {
|
|
|
5170
5409
|
const { isP2P: s, callLimit: i, onAddedTransceiver: r, ...a } = t;
|
|
5171
5410
|
return this.presentationManager.startPresentation(
|
|
5172
5411
|
async () => {
|
|
5173
|
-
s === !0 ?
|
|
5412
|
+
await (s === !0 ? this.apiManager.sendAvailableContentedStream() : this.apiManager.askPermissionToStartPresentation());
|
|
5174
5413
|
},
|
|
5175
5414
|
e,
|
|
5176
5415
|
{
|
|
@@ -5183,14 +5422,14 @@ class Js {
|
|
|
5183
5422
|
async stopPresentation(e = {}) {
|
|
5184
5423
|
const { isP2P: t } = e;
|
|
5185
5424
|
return this.presentationManager.stopPresentation(async () => {
|
|
5186
|
-
await (t === !0 ? this.apiManager.
|
|
5425
|
+
await (t === !0 ? this.apiManager.sendNotAvailableContentedStream() : this.apiManager.sendStoppedPresentation());
|
|
5187
5426
|
});
|
|
5188
5427
|
}
|
|
5189
5428
|
async updatePresentation(e, t = {}) {
|
|
5190
5429
|
const { isP2P: s, onAddedTransceiver: i, ...r } = t;
|
|
5191
5430
|
return this.presentationManager.updatePresentation(
|
|
5192
5431
|
async () => {
|
|
5193
|
-
s === !0 ?
|
|
5432
|
+
await (s === !0 ? this.apiManager.sendAvailableContentedStream() : this.apiManager.askPermissionToStartPresentation());
|
|
5194
5433
|
},
|
|
5195
5434
|
e,
|
|
5196
5435
|
{
|
|
@@ -5223,21 +5462,6 @@ class Js {
|
|
|
5223
5462
|
async sendRefusalToTurnOnCam(...e) {
|
|
5224
5463
|
return this.apiManager.sendRefusalToTurnOnCam(...e);
|
|
5225
5464
|
}
|
|
5226
|
-
async sendMustStopPresentationP2P(...e) {
|
|
5227
|
-
return this.apiManager.sendMustStopPresentationP2P(...e);
|
|
5228
|
-
}
|
|
5229
|
-
async sendStoppedPresentationP2P(...e) {
|
|
5230
|
-
return this.apiManager.sendStoppedPresentationP2P(...e);
|
|
5231
|
-
}
|
|
5232
|
-
async sendStoppedPresentation(...e) {
|
|
5233
|
-
return this.apiManager.sendStoppedPresentation(...e);
|
|
5234
|
-
}
|
|
5235
|
-
async askPermissionToStartPresentationP2P(...e) {
|
|
5236
|
-
return this.apiManager.askPermissionToStartPresentationP2P(...e);
|
|
5237
|
-
}
|
|
5238
|
-
async askPermissionToStartPresentation(...e) {
|
|
5239
|
-
return this.apiManager.askPermissionToStartPresentation(...e);
|
|
5240
|
-
}
|
|
5241
5465
|
async askPermissionToEnableCam(...e) {
|
|
5242
5466
|
return this.apiManager.askPermissionToEnableCam(...e);
|
|
5243
5467
|
}
|
|
@@ -5280,7 +5504,7 @@ class Js {
|
|
|
5280
5504
|
if (i === void 0)
|
|
5281
5505
|
throw new Error("No sipServerUrl for sendOffer");
|
|
5282
5506
|
const r = this.conferenceStateManager.getToken();
|
|
5283
|
-
return
|
|
5507
|
+
return Xn({
|
|
5284
5508
|
serverUrl: i,
|
|
5285
5509
|
offer: t,
|
|
5286
5510
|
token: r,
|
|
@@ -5290,7 +5514,7 @@ class Js {
|
|
|
5290
5514
|
});
|
|
5291
5515
|
};
|
|
5292
5516
|
setCodecPreferences(e) {
|
|
5293
|
-
|
|
5517
|
+
ds(e, {
|
|
5294
5518
|
preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
|
|
5295
5519
|
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
5296
5520
|
});
|
|
@@ -5315,24 +5539,24 @@ class Js {
|
|
|
5315
5539
|
};
|
|
5316
5540
|
}
|
|
5317
5541
|
export {
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5542
|
+
Ae as E,
|
|
5543
|
+
ut as O,
|
|
5544
|
+
hi as S,
|
|
5545
|
+
nn as a,
|
|
5546
|
+
ht as b,
|
|
5547
|
+
Bn as c,
|
|
5548
|
+
fe as d,
|
|
5549
|
+
$t as e,
|
|
5550
|
+
Ce as f,
|
|
5551
|
+
ci as g,
|
|
5552
|
+
hn as h,
|
|
5553
|
+
oi as i,
|
|
5554
|
+
di as j,
|
|
5555
|
+
p as k,
|
|
5332
5556
|
d as l,
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5557
|
+
ns as m,
|
|
5558
|
+
gs as n,
|
|
5559
|
+
Ht as o,
|
|
5560
|
+
H as p,
|
|
5561
|
+
Xn as s
|
|
5338
5562
|
};
|