sip-connector 21.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-CQ2xR48Y.js → @SipConnector-CmHfa0Ce.js} +892 -669
- 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 +40 -40
- 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/SipConnector/events.d.ts +2 -2
- 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__/constants.d.ts +5 -6
- package/dist/__fixtures__/createManagers.d.ts +12 -0
- package/dist/__fixtures__/eventNames.d.ts +3 -3
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +70 -71
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +11 -11
- package/dist/tools/BaseStateMachine.d.ts +2 -0
- package/package.json +4 -4
- package/dist/@SipConnector-B7rwpjv6.cjs +0 -1
|
@@ -1,63 +1,115 @@
|
|
|
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
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
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
|
+
"enter-room",
|
|
19
|
+
"main-cam-control",
|
|
20
|
+
"use-license",
|
|
21
|
+
"new-dtmf",
|
|
22
22
|
"conference:participant-token-issued",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
23
|
+
"contented-stream:available",
|
|
24
|
+
"contented-stream:not-available",
|
|
25
|
+
"presentation:must-stop",
|
|
26
|
+
"channels:all",
|
|
27
|
+
"channels:notify",
|
|
27
28
|
"participant:added-to-list-moderators",
|
|
28
29
|
"participant:removed-from-list-moderators",
|
|
30
|
+
"participant:move-request-to-stream",
|
|
29
31
|
"participant:move-request-to-spectators",
|
|
30
32
|
"participant:move-request-to-spectators-synthetic",
|
|
31
33
|
"participant:move-request-to-spectators-with-audio-id",
|
|
32
34
|
"participant:move-request-to-participants",
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"admin-
|
|
40
|
-
"admin-
|
|
41
|
-
"admin-
|
|
42
|
-
"admin-
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
35
|
+
"participation:accepting-word-request",
|
|
36
|
+
"participation:cancelling-word-request",
|
|
37
|
+
"webcast:started",
|
|
38
|
+
"webcast:stopped",
|
|
39
|
+
"account:changed",
|
|
40
|
+
"account:deleted",
|
|
41
|
+
"admin:start-main-cam",
|
|
42
|
+
"admin:stop-main-cam",
|
|
43
|
+
"admin:start-mic",
|
|
44
|
+
"admin:stop-mic",
|
|
45
|
+
"admin:force-sync-media-state"
|
|
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 {
|
|
50
98
|
events;
|
|
51
|
-
connectionManager;
|
|
52
99
|
callManager;
|
|
53
|
-
constructor({
|
|
100
|
+
constructor() {
|
|
101
|
+
this.events = rt();
|
|
102
|
+
}
|
|
103
|
+
subscribe({
|
|
54
104
|
connectionManager: e,
|
|
55
105
|
callManager: t
|
|
56
106
|
}) {
|
|
57
|
-
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
|
+
});
|
|
58
110
|
}
|
|
59
111
|
async waitChannels() {
|
|
60
|
-
return this.wait(g.
|
|
112
|
+
return this.wait(g.CHANNELS_ALL);
|
|
61
113
|
}
|
|
62
114
|
async waitSyncMediaState() {
|
|
63
115
|
return this.wait(g.ADMIN_FORCE_SYNC_MEDIA_STATE);
|
|
@@ -70,7 +122,7 @@ class tt {
|
|
|
70
122
|
} catch (r) {
|
|
71
123
|
s(r);
|
|
72
124
|
}
|
|
73
|
-
i && (this.callManager
|
|
125
|
+
i && (this.callManager?.once("newDTMF", ({ originator: r }) => {
|
|
74
126
|
r === "local" && t();
|
|
75
127
|
}), i.sendDTMF(e, {
|
|
76
128
|
duration: 120,
|
|
@@ -79,19 +131,19 @@ class tt {
|
|
|
79
131
|
});
|
|
80
132
|
}
|
|
81
133
|
async sendChannels({ inputChannels: e, outputChannels: t }) {
|
|
82
|
-
const s = this.getEstablishedRTCSessionProtected(), i = `${
|
|
134
|
+
const s = this.getEstablishedRTCSessionProtected(), i = `${h.INPUT_CHANNELS}: ${e}`, r = `${h.OUTPUT_CHANNELS}: ${t}`, a = [
|
|
83
135
|
i,
|
|
84
136
|
r
|
|
85
137
|
];
|
|
86
|
-
return s.sendInfo(
|
|
138
|
+
return s.sendInfo(_.CHANNELS, void 0, { extraHeaders: a });
|
|
87
139
|
}
|
|
88
140
|
async sendMediaState({ cam: e, mic: t }, s = {}) {
|
|
89
|
-
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 = [
|
|
90
142
|
r,
|
|
91
143
|
a,
|
|
92
144
|
o
|
|
93
145
|
];
|
|
94
|
-
return i.sendInfo(
|
|
146
|
+
return i.sendInfo(_.MEDIA_STATE, void 0, {
|
|
95
147
|
noTerminateWhenError: !0,
|
|
96
148
|
...s,
|
|
97
149
|
extraHeaders: c
|
|
@@ -100,15 +152,15 @@ class tt {
|
|
|
100
152
|
async sendStats({
|
|
101
153
|
availableIncomingBitrate: e
|
|
102
154
|
}) {
|
|
103
|
-
const t = this.getEstablishedRTCSessionProtected(), i = [`${
|
|
104
|
-
return t.sendInfo(
|
|
155
|
+
const t = this.getEstablishedRTCSessionProtected(), i = [`${h.AVAILABLE_INCOMING_BITRATE}: ${e}`];
|
|
156
|
+
return t.sendInfo(_.STATS, void 0, {
|
|
105
157
|
noTerminateWhenError: !0,
|
|
106
158
|
extraHeaders: i
|
|
107
159
|
});
|
|
108
160
|
}
|
|
109
161
|
async sendRefusalToTurnOn(e, t = {}) {
|
|
110
|
-
const s = this.getEstablishedRTCSessionProtected(), a = e === "mic" ? 0 : 1, c = [`${
|
|
111
|
-
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, {
|
|
112
164
|
noTerminateWhenError: !0,
|
|
113
165
|
...t,
|
|
114
166
|
extraHeaders: c
|
|
@@ -120,39 +172,34 @@ class tt {
|
|
|
120
172
|
async sendRefusalToTurnOnCam(e = {}) {
|
|
121
173
|
return this.sendRefusalToTurnOn("cam", { noTerminateWhenError: !0, ...e });
|
|
122
174
|
}
|
|
123
|
-
async
|
|
124
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
125
|
-
extraHeaders: [
|
|
175
|
+
async sendAvailableContentedStream() {
|
|
176
|
+
await this.getEstablishedRTCSessionProtected().sendInfo(_.SHARE_STATE, void 0, {
|
|
177
|
+
extraHeaders: [U.AVAILABLE_CONTENTED_STREAM]
|
|
126
178
|
});
|
|
127
179
|
}
|
|
128
|
-
async
|
|
129
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
130
|
-
extraHeaders: [
|
|
180
|
+
async askPermissionToStartPresentation() {
|
|
181
|
+
await this.getEstablishedRTCSessionProtected().sendInfo(_.SHARE_STATE, void 0, {
|
|
182
|
+
extraHeaders: [U.ACK_PERMISSION_TO_START_PRESENTATION]
|
|
131
183
|
});
|
|
132
184
|
}
|
|
133
185
|
async sendStoppedPresentation() {
|
|
134
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
135
|
-
extraHeaders: [
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
async askPermissionToStartPresentationP2P() {
|
|
139
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(I.SHARE_STATE, void 0, {
|
|
140
|
-
extraHeaders: [T.START_PRESENTATION_P2P]
|
|
186
|
+
await this.getEstablishedRTCSessionProtected().sendInfo(_.SHARE_STATE, void 0, {
|
|
187
|
+
extraHeaders: [U.STOPPED_CLIENT_PRESENTATION]
|
|
141
188
|
});
|
|
142
189
|
}
|
|
143
|
-
async
|
|
144
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
145
|
-
extraHeaders: [
|
|
190
|
+
async sendNotAvailableContentedStream() {
|
|
191
|
+
await this.getEstablishedRTCSessionProtected().sendInfo(_.SHARE_STATE, void 0, {
|
|
192
|
+
extraHeaders: [U.NOT_AVAILABLE_CONTENTED_STREAM]
|
|
146
193
|
});
|
|
147
194
|
}
|
|
148
195
|
async askPermissionToEnableCam(e = {}) {
|
|
149
|
-
const t = this.getEstablishedRTCSessionProtected(), s = [
|
|
150
|
-
return t.sendInfo(
|
|
196
|
+
const t = this.getEstablishedRTCSessionProtected(), s = [U.ENABLE_MAIN_CAM];
|
|
197
|
+
return t.sendInfo(_.MAIN_CAM, void 0, {
|
|
151
198
|
noTerminateWhenError: !0,
|
|
152
199
|
...e,
|
|
153
200
|
extraHeaders: s
|
|
154
201
|
}).catch((i) => {
|
|
155
|
-
if (
|
|
202
|
+
if (it(i))
|
|
156
203
|
throw i;
|
|
157
204
|
});
|
|
158
205
|
}
|
|
@@ -172,22 +219,17 @@ class tt {
|
|
|
172
219
|
this.events.off(e, t);
|
|
173
220
|
}
|
|
174
221
|
getEstablishedRTCSessionProtected = () => {
|
|
175
|
-
const e = this.callManager
|
|
222
|
+
const e = this.callManager?.getEstablishedRTCSession();
|
|
176
223
|
if (!e)
|
|
177
224
|
throw new Error("No rtcSession established");
|
|
178
225
|
return e;
|
|
179
226
|
};
|
|
180
|
-
subscribe() {
|
|
181
|
-
this.connectionManager.on("sipEvent", this.handleSipEvent), this.callManager.on("newInfo", this.handleNewInfo), this.callManager.on("newDTMF", (e) => {
|
|
182
|
-
this.events.trigger("newDTMF", e);
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
227
|
handleSipEvent = ({ request: e }) => {
|
|
186
228
|
this.maybeHandleNotify(e);
|
|
187
229
|
};
|
|
188
230
|
maybeHandleNotify = (e) => {
|
|
189
231
|
try {
|
|
190
|
-
const t = e.getHeader(
|
|
232
|
+
const t = e.getHeader(h.NOTIFY);
|
|
191
233
|
if (t) {
|
|
192
234
|
const s = JSON.parse(t);
|
|
193
235
|
this.handleNotify(s);
|
|
@@ -198,55 +240,55 @@ class tt {
|
|
|
198
240
|
};
|
|
199
241
|
handleNotify = (e) => {
|
|
200
242
|
switch (e.cmd) {
|
|
201
|
-
case
|
|
243
|
+
case I.CHANNELS: {
|
|
202
244
|
const t = e;
|
|
203
245
|
this.triggerChannelsNotify(t);
|
|
204
246
|
break;
|
|
205
247
|
}
|
|
206
|
-
case
|
|
248
|
+
case I.WEBCAST_STARTED: {
|
|
207
249
|
const t = e;
|
|
208
250
|
this.triggerWebcastStartedNotify(t);
|
|
209
251
|
break;
|
|
210
252
|
}
|
|
211
|
-
case
|
|
253
|
+
case I.WEBCAST_STOPPED: {
|
|
212
254
|
const t = e;
|
|
213
255
|
this.triggerWebcastStoppedNotify(t);
|
|
214
256
|
break;
|
|
215
257
|
}
|
|
216
|
-
case
|
|
258
|
+
case I.ADDED_TO_LIST_MODERATORS: {
|
|
217
259
|
const t = e;
|
|
218
260
|
this.triggerAddedToListModeratorsNotify(t);
|
|
219
261
|
break;
|
|
220
262
|
}
|
|
221
|
-
case
|
|
263
|
+
case I.REMOVED_FROM_LIST_MODERATORS: {
|
|
222
264
|
const t = e;
|
|
223
265
|
this.triggerRemovedFromListModeratorsNotify(t);
|
|
224
266
|
break;
|
|
225
267
|
}
|
|
226
|
-
case
|
|
268
|
+
case I.ACCEPTING_WORD_REQUEST: {
|
|
227
269
|
const t = e;
|
|
228
270
|
this.triggerParticipationAcceptingWordRequest(t);
|
|
229
271
|
break;
|
|
230
272
|
}
|
|
231
|
-
case
|
|
273
|
+
case I.CANCELLING_WORD_REQUEST: {
|
|
232
274
|
const t = e;
|
|
233
275
|
this.triggerParticipationCancellingWordRequest(t);
|
|
234
276
|
break;
|
|
235
277
|
}
|
|
236
|
-
case
|
|
278
|
+
case I.MOVE_REQUEST_TO_STREAM: {
|
|
237
279
|
const t = e;
|
|
238
280
|
this.triggerParticipantMoveRequestToStream(t);
|
|
239
281
|
break;
|
|
240
282
|
}
|
|
241
|
-
case
|
|
283
|
+
case I.ACCOUNT_CHANGED: {
|
|
242
284
|
this.triggerAccountChangedNotify();
|
|
243
285
|
break;
|
|
244
286
|
}
|
|
245
|
-
case
|
|
287
|
+
case I.ACCOUNT_DELETED: {
|
|
246
288
|
this.triggerAccountDeletedNotify();
|
|
247
289
|
break;
|
|
248
290
|
}
|
|
249
|
-
case
|
|
291
|
+
case I.CONFERENCE_PARTICIPANT_TOKEN_ISSUED: {
|
|
250
292
|
const t = e;
|
|
251
293
|
this.triggerConferenceParticipantTokenIssued(t);
|
|
252
294
|
break;
|
|
@@ -259,34 +301,34 @@ class tt {
|
|
|
259
301
|
const { originator: t } = e;
|
|
260
302
|
if (t !== "remote")
|
|
261
303
|
return;
|
|
262
|
-
const { request: s } = e, i = s, r = i.
|
|
304
|
+
const { request: s } = e, i = s, r = N(i, h.CONTENT_TYPE);
|
|
263
305
|
if (r !== void 0)
|
|
264
306
|
switch (r) {
|
|
265
|
-
case
|
|
307
|
+
case y.ENTER_ROOM: {
|
|
266
308
|
this.triggerEnterRoom(i), this.maybeTriggerChannels(i);
|
|
267
309
|
break;
|
|
268
310
|
}
|
|
269
|
-
case
|
|
311
|
+
case y.NOTIFY: {
|
|
270
312
|
this.maybeHandleNotify(i);
|
|
271
313
|
break;
|
|
272
314
|
}
|
|
273
|
-
case
|
|
274
|
-
this.
|
|
315
|
+
case y.SHARE_STATE: {
|
|
316
|
+
this.triggerContentedStreamState(i);
|
|
275
317
|
break;
|
|
276
318
|
}
|
|
277
|
-
case
|
|
319
|
+
case y.MAIN_CAM: {
|
|
278
320
|
this.triggerMainCamControl(i);
|
|
279
321
|
break;
|
|
280
322
|
}
|
|
281
|
-
case
|
|
323
|
+
case y.MIC: {
|
|
282
324
|
this.triggerMicControl(i);
|
|
283
325
|
break;
|
|
284
326
|
}
|
|
285
|
-
case
|
|
327
|
+
case y.USE_LICENSE: {
|
|
286
328
|
this.triggerUseLicense(i);
|
|
287
329
|
break;
|
|
288
330
|
}
|
|
289
|
-
case
|
|
331
|
+
case y.PARTICIPANT_STATE: {
|
|
290
332
|
this.maybeTriggerParticipantMoveRequest(i);
|
|
291
333
|
break;
|
|
292
334
|
}
|
|
@@ -383,77 +425,86 @@ class tt {
|
|
|
383
425
|
);
|
|
384
426
|
};
|
|
385
427
|
maybeTriggerChannels = (e) => {
|
|
386
|
-
const t = e.
|
|
387
|
-
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) {
|
|
388
430
|
const i = {
|
|
389
431
|
inputChannels: t,
|
|
390
432
|
outputChannels: s
|
|
391
433
|
};
|
|
392
|
-
this.events.trigger(g.
|
|
434
|
+
this.events.trigger(g.CHANNELS_ALL, i);
|
|
393
435
|
}
|
|
394
436
|
};
|
|
395
437
|
triggerEnterRoom = (e) => {
|
|
396
|
-
const t = e.
|
|
397
|
-
this.events.trigger(g.ENTER_ROOM, { room: t, participantName: s });
|
|
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 });
|
|
398
440
|
};
|
|
399
|
-
|
|
400
|
-
const t = e.
|
|
441
|
+
triggerContentedStreamState = (e) => {
|
|
442
|
+
const t = N(e, h.CONTENTED_STREAM_STATE);
|
|
401
443
|
if (t !== void 0)
|
|
402
444
|
switch (t) {
|
|
403
|
-
case
|
|
404
|
-
|
|
445
|
+
case $.AVAILABLE_CONTENTED_STREAM: {
|
|
446
|
+
const s = N(e, h.CONTENTED_STREAM_CODEC);
|
|
447
|
+
this.events.trigger(g.CONTENTED_STREAM_AVAILABLE, { codec: s });
|
|
405
448
|
break;
|
|
406
449
|
}
|
|
407
|
-
case
|
|
408
|
-
this.events.trigger(g.
|
|
450
|
+
case $.NOT_AVAILABLE_CONTENTED_STREAM: {
|
|
451
|
+
this.events.trigger(g.CONTENTED_STREAM_NOT_AVAILABLE, {});
|
|
409
452
|
break;
|
|
410
453
|
}
|
|
411
|
-
case
|
|
412
|
-
this.events.trigger(g.
|
|
454
|
+
case $.MUST_STOP_PRESENTATION: {
|
|
455
|
+
this.events.trigger(g.PRESENTATION_MUST_STOP, {});
|
|
413
456
|
break;
|
|
414
457
|
}
|
|
415
458
|
}
|
|
416
459
|
};
|
|
417
460
|
maybeTriggerParticipantMoveRequest = (e) => {
|
|
418
|
-
const t = e.
|
|
419
|
-
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, {
|
|
420
463
|
audioId: s
|
|
421
464
|
}), this.events.trigger(g.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS, {
|
|
422
465
|
isSynthetic: !1,
|
|
423
466
|
audioId: s
|
|
424
|
-
}))
|
|
467
|
+
}))), t === W.PARTICIPANT && this.events.trigger(g.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS, {});
|
|
425
468
|
};
|
|
426
469
|
triggerMainCamControl = (e) => {
|
|
427
|
-
const t = e.
|
|
428
|
-
if (t ===
|
|
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) {
|
|
429
472
|
this.events.trigger(g.ADMIN_START_MAIN_CAM, { isSyncForced: i });
|
|
430
473
|
return;
|
|
431
474
|
}
|
|
432
|
-
if (t ===
|
|
475
|
+
if (t === f.ADMIN_STOP_MAIN_CAM) {
|
|
433
476
|
this.events.trigger(g.ADMIN_STOP_MAIN_CAM, { isSyncForced: i });
|
|
434
477
|
return;
|
|
435
478
|
}
|
|
436
|
-
(t ===
|
|
437
|
-
const r = e.
|
|
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);
|
|
438
481
|
this.events.trigger(g.MAIN_CAM_CONTROL, {
|
|
439
482
|
mainCam: t,
|
|
440
483
|
resolutionMainCam: r
|
|
441
484
|
});
|
|
442
485
|
};
|
|
443
486
|
triggerMicControl = (e) => {
|
|
444
|
-
const t = e.
|
|
445
|
-
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 });
|
|
446
489
|
};
|
|
447
490
|
triggerUseLicense = (e) => {
|
|
448
|
-
const t = e.
|
|
449
|
-
this.events.trigger(g.USE_LICENSE, t);
|
|
491
|
+
const t = N(e, h.CONTENT_USE_LICENSE);
|
|
492
|
+
t !== void 0 && this.events.trigger(g.USE_LICENSE, t);
|
|
450
493
|
};
|
|
451
494
|
}
|
|
452
|
-
class
|
|
495
|
+
class V {
|
|
453
496
|
actor;
|
|
454
497
|
subscriptions = [];
|
|
498
|
+
stateChangeListeners = /* @__PURE__ */ new Set();
|
|
455
499
|
constructor(e) {
|
|
456
|
-
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
|
+
);
|
|
457
508
|
}
|
|
458
509
|
get actorRef() {
|
|
459
510
|
return this.actor;
|
|
@@ -471,8 +522,13 @@ class q {
|
|
|
471
522
|
const t = this.actor.subscribe(e);
|
|
472
523
|
return this.addSubscription(t), t;
|
|
473
524
|
}
|
|
525
|
+
onStateChange(e) {
|
|
526
|
+
return this.stateChangeListeners.add(e), () => {
|
|
527
|
+
this.stateChangeListeners.delete(e);
|
|
528
|
+
};
|
|
529
|
+
}
|
|
474
530
|
stop() {
|
|
475
|
-
this.subscriptions.forEach((e) => {
|
|
531
|
+
this.stateChangeListeners.clear(), this.subscriptions.forEach((e) => {
|
|
476
532
|
e();
|
|
477
533
|
}), this.subscriptions.length = 0, this.actor.stop();
|
|
478
534
|
}
|
|
@@ -483,17 +539,17 @@ class q {
|
|
|
483
539
|
return this.subscriptions.push(t), t;
|
|
484
540
|
}
|
|
485
541
|
}
|
|
486
|
-
var
|
|
487
|
-
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({
|
|
488
544
|
types: {
|
|
489
545
|
context: {},
|
|
490
546
|
events: {}
|
|
491
547
|
},
|
|
492
548
|
actions: {
|
|
493
|
-
rememberError:
|
|
549
|
+
rememberError: M(({ event: n }) => "error" in n && n.error !== void 0 ? {
|
|
494
550
|
lastError: n.error instanceof Error ? n.error : new Error(JSON.stringify(n.error))
|
|
495
551
|
} : { lastError: void 0 }),
|
|
496
|
-
resetError:
|
|
552
|
+
resetError: M({ lastError: void 0 })
|
|
497
553
|
}
|
|
498
554
|
}).createMachine({
|
|
499
555
|
id: "call",
|
|
@@ -567,9 +623,9 @@ const st = $({
|
|
|
567
623
|
}
|
|
568
624
|
}
|
|
569
625
|
});
|
|
570
|
-
class
|
|
626
|
+
class gt extends V {
|
|
571
627
|
constructor(e) {
|
|
572
|
-
super(
|
|
628
|
+
super(lt), this.subscribeToEvents(e);
|
|
573
629
|
}
|
|
574
630
|
get isIdle() {
|
|
575
631
|
return this.state === "call:idle";
|
|
@@ -634,8 +690,8 @@ class it extends q {
|
|
|
634
690
|
);
|
|
635
691
|
}
|
|
636
692
|
}
|
|
637
|
-
var
|
|
638
|
-
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 = [
|
|
639
695
|
"peerconnection",
|
|
640
696
|
"connecting",
|
|
641
697
|
"sending",
|
|
@@ -666,21 +722,21 @@ const ue = [
|
|
|
666
722
|
"peerconnection:createanswerfailed",
|
|
667
723
|
"peerconnection:setlocaldescriptionfailed",
|
|
668
724
|
"peerconnection:setremotedescriptionfailed"
|
|
669
|
-
],
|
|
725
|
+
], Tt = [
|
|
670
726
|
"peerconnection:confirmed",
|
|
671
727
|
"peerconnection:ontrack",
|
|
672
728
|
"ended:fromserver",
|
|
673
729
|
"call-status-changed",
|
|
674
730
|
"remote-tracks-changed",
|
|
675
731
|
"remote-streams-changed"
|
|
676
|
-
],
|
|
677
|
-
...
|
|
678
|
-
...
|
|
679
|
-
],
|
|
732
|
+
], Ne = [
|
|
733
|
+
...me,
|
|
734
|
+
...Tt
|
|
735
|
+
], Et = () => new R(Ne), St = (n, e) => {
|
|
680
736
|
n.getVideoTracks().forEach((s) => {
|
|
681
737
|
"contentHint" in s && s.contentHint !== e && (s.contentHint = e);
|
|
682
738
|
});
|
|
683
|
-
},
|
|
739
|
+
}, H = (n, {
|
|
684
740
|
directionVideo: e,
|
|
685
741
|
directionAudio: t,
|
|
686
742
|
contentHint: s
|
|
@@ -688,16 +744,16 @@ const ue = [
|
|
|
688
744
|
if (!n || e === "recvonly" && t === "recvonly")
|
|
689
745
|
return;
|
|
690
746
|
const i = t === "recvonly" ? [] : n.getAudioTracks(), r = e === "recvonly" ? [] : n.getVideoTracks(), a = [...i, ...r], o = new MediaStream(a);
|
|
691
|
-
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;
|
|
692
748
|
};
|
|
693
|
-
var
|
|
694
|
-
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 {
|
|
695
751
|
events;
|
|
696
752
|
rtcSession;
|
|
697
753
|
disposers = /* @__PURE__ */ new Set();
|
|
698
754
|
onReset;
|
|
699
755
|
constructor(e, { onReset: t }) {
|
|
700
|
-
this.events = e, this.onReset = t, e.on(
|
|
756
|
+
this.events = e, this.onReset = t, e.on(S.FAILED, this.handleEnded), e.on(S.ENDED, this.handleEnded);
|
|
701
757
|
}
|
|
702
758
|
get connection() {
|
|
703
759
|
return this.rtcSession?.connection;
|
|
@@ -718,27 +774,27 @@ class dt {
|
|
|
718
774
|
iceServers: a,
|
|
719
775
|
directionVideo: o,
|
|
720
776
|
directionAudio: c,
|
|
721
|
-
contentHint:
|
|
722
|
-
offerToReceiveAudio:
|
|
723
|
-
offerToReceiveVideo:
|
|
724
|
-
degradationPreference:
|
|
777
|
+
contentHint: l,
|
|
778
|
+
offerToReceiveAudio: T = !0,
|
|
779
|
+
offerToReceiveVideo: u = !0,
|
|
780
|
+
degradationPreference: E,
|
|
725
781
|
sendEncodings: m,
|
|
726
|
-
onAddedTransceiver:
|
|
727
|
-
}) => new Promise((
|
|
728
|
-
this.handleCall().then(
|
|
729
|
-
|
|
782
|
+
onAddedTransceiver: D
|
|
783
|
+
}) => new Promise((A, w) => {
|
|
784
|
+
this.handleCall().then(A).catch((X) => {
|
|
785
|
+
w(X);
|
|
730
786
|
}), this.rtcSession = e.call(t(s), {
|
|
731
|
-
mediaStream:
|
|
787
|
+
mediaStream: H(i, {
|
|
732
788
|
directionVideo: o,
|
|
733
789
|
directionAudio: c,
|
|
734
|
-
contentHint:
|
|
790
|
+
contentHint: l
|
|
735
791
|
}),
|
|
736
792
|
pcConfig: {
|
|
737
793
|
iceServers: a
|
|
738
794
|
},
|
|
739
795
|
rtcOfferConstraints: {
|
|
740
|
-
offerToReceiveAudio:
|
|
741
|
-
offerToReceiveVideo:
|
|
796
|
+
offerToReceiveAudio: T,
|
|
797
|
+
offerToReceiveVideo: u
|
|
742
798
|
},
|
|
743
799
|
// необходимо передавать в методе call, чтобы подписаться на события peerconnection,
|
|
744
800
|
// так как в методе call создается RTCSession
|
|
@@ -747,16 +803,16 @@ class dt {
|
|
|
747
803
|
extraHeaders: r,
|
|
748
804
|
directionVideo: o,
|
|
749
805
|
directionAudio: c,
|
|
750
|
-
degradationPreference:
|
|
806
|
+
degradationPreference: E,
|
|
751
807
|
sendEncodings: m,
|
|
752
|
-
onAddedTransceiver:
|
|
808
|
+
onAddedTransceiver: D
|
|
753
809
|
});
|
|
754
810
|
});
|
|
755
811
|
async endCall() {
|
|
756
812
|
const { rtcSession: e } = this;
|
|
757
813
|
if (e && !e.isEnded())
|
|
758
814
|
return e.terminateAsync({
|
|
759
|
-
cause:
|
|
815
|
+
cause: Ae.CANCELED
|
|
760
816
|
}).finally(() => {
|
|
761
817
|
this.reset();
|
|
762
818
|
});
|
|
@@ -770,14 +826,14 @@ class dt {
|
|
|
770
826
|
directionAudio: a,
|
|
771
827
|
offerToReceiveAudio: o,
|
|
772
828
|
offerToReceiveVideo: c,
|
|
773
|
-
contentHint:
|
|
774
|
-
degradationPreference:
|
|
775
|
-
sendEncodings:
|
|
776
|
-
onAddedTransceiver:
|
|
777
|
-
}) => new Promise((m,
|
|
829
|
+
contentHint: l,
|
|
830
|
+
degradationPreference: T,
|
|
831
|
+
sendEncodings: u,
|
|
832
|
+
onAddedTransceiver: E
|
|
833
|
+
}) => new Promise((m, D) => {
|
|
778
834
|
try {
|
|
779
|
-
this.rtcSession = e, this.subscribeToSessionEvents(e), this.handleCall().then(m).catch((
|
|
780
|
-
|
|
835
|
+
this.rtcSession = e, this.subscribeToSessionEvents(e), this.handleCall().then(m).catch((A) => {
|
|
836
|
+
D(A);
|
|
781
837
|
}), e.answer({
|
|
782
838
|
pcConfig: {
|
|
783
839
|
iceServers: i
|
|
@@ -786,26 +842,26 @@ class dt {
|
|
|
786
842
|
offerToReceiveAudio: o,
|
|
787
843
|
offerToReceiveVideo: c
|
|
788
844
|
},
|
|
789
|
-
mediaStream:
|
|
845
|
+
mediaStream: H(t, {
|
|
790
846
|
directionVideo: r,
|
|
791
847
|
directionAudio: a,
|
|
792
|
-
contentHint:
|
|
848
|
+
contentHint: l
|
|
793
849
|
}),
|
|
794
850
|
extraHeaders: s,
|
|
795
851
|
directionVideo: r,
|
|
796
852
|
directionAudio: a,
|
|
797
|
-
degradationPreference:
|
|
798
|
-
sendEncodings:
|
|
799
|
-
onAddedTransceiver:
|
|
853
|
+
degradationPreference: T,
|
|
854
|
+
sendEncodings: u,
|
|
855
|
+
onAddedTransceiver: E
|
|
800
856
|
});
|
|
801
|
-
} catch (
|
|
802
|
-
|
|
857
|
+
} catch (A) {
|
|
858
|
+
D(A);
|
|
803
859
|
}
|
|
804
860
|
});
|
|
805
861
|
async replaceMediaStream(e, t) {
|
|
806
862
|
if (!this.rtcSession)
|
|
807
863
|
throw new Error("No rtcSession established");
|
|
808
|
-
const { contentHint: s } = t ?? {}, i =
|
|
864
|
+
const { contentHint: s } = t ?? {}, i = H(e, { contentHint: s });
|
|
809
865
|
if (i === void 0)
|
|
810
866
|
throw new Error("No preparedMediaStream");
|
|
811
867
|
return this.rtcSession.replaceMediaStream(i, t);
|
|
@@ -817,33 +873,33 @@ class dt {
|
|
|
817
873
|
}
|
|
818
874
|
handleCall = async () => new Promise((e, t) => {
|
|
819
875
|
const s = () => {
|
|
820
|
-
this.events.on(
|
|
876
|
+
this.events.on(S.PEER_CONNECTION, l), this.events.on(S.CONFIRMED, T);
|
|
821
877
|
}, i = () => {
|
|
822
|
-
this.events.off(
|
|
878
|
+
this.events.off(S.PEER_CONNECTION, l), this.events.off(S.CONFIRMED, T);
|
|
823
879
|
}, r = () => {
|
|
824
|
-
this.events.on(
|
|
880
|
+
this.events.on(S.FAILED, o), this.events.on(S.ENDED, o);
|
|
825
881
|
}, a = () => {
|
|
826
|
-
this.events.off(
|
|
827
|
-
}, o = (
|
|
828
|
-
i(), a(), t(
|
|
882
|
+
this.events.off(S.FAILED, o), this.events.off(S.ENDED, o);
|
|
883
|
+
}, o = (u) => {
|
|
884
|
+
i(), a(), t(u);
|
|
829
885
|
};
|
|
830
886
|
let c;
|
|
831
|
-
const
|
|
832
|
-
c =
|
|
833
|
-
const
|
|
834
|
-
this.events.trigger(
|
|
887
|
+
const l = ({ peerconnection: u }) => {
|
|
888
|
+
c = u;
|
|
889
|
+
const E = (m) => {
|
|
890
|
+
this.events.trigger(S.PEER_CONNECTION_ONTRACK, m);
|
|
835
891
|
};
|
|
836
|
-
|
|
837
|
-
|
|
892
|
+
u.addEventListener("track", E), this.disposers.add(() => {
|
|
893
|
+
u.removeEventListener("track", E);
|
|
838
894
|
});
|
|
839
|
-
},
|
|
840
|
-
c !== void 0 && this.events.trigger(
|
|
895
|
+
}, T = () => {
|
|
896
|
+
c !== void 0 && this.events.trigger(S.PEER_CONNECTION_CONFIRMED, c), i(), a(), e(c);
|
|
841
897
|
};
|
|
842
898
|
s(), r();
|
|
843
899
|
});
|
|
844
900
|
subscribeToSessionEvents(e) {
|
|
845
901
|
this.events.eachTriggers((t, s) => {
|
|
846
|
-
const i =
|
|
902
|
+
const i = me.find((r) => r === s);
|
|
847
903
|
i && (e.on(i, t), this.disposers.add(() => {
|
|
848
904
|
e.off(i, t);
|
|
849
905
|
}));
|
|
@@ -856,13 +912,13 @@ class dt {
|
|
|
856
912
|
}
|
|
857
913
|
handleEnded = (e) => {
|
|
858
914
|
const { originator: t } = e;
|
|
859
|
-
t === "remote" && this.events.trigger(
|
|
915
|
+
t === "remote" && this.events.trigger(S.ENDED_FROM_SERVER, e), this.reset();
|
|
860
916
|
};
|
|
861
917
|
reset = () => {
|
|
862
918
|
delete this.rtcSession, this.unsubscribeFromSessionEvents(), this.onReset();
|
|
863
919
|
};
|
|
864
920
|
}
|
|
865
|
-
class
|
|
921
|
+
class pt {
|
|
866
922
|
config;
|
|
867
923
|
tools;
|
|
868
924
|
connection;
|
|
@@ -911,18 +967,18 @@ class ht {
|
|
|
911
967
|
return this.connection.addTransceiver(e, t);
|
|
912
968
|
}
|
|
913
969
|
}
|
|
914
|
-
const
|
|
915
|
-
const t =
|
|
970
|
+
const Re = (n) => n.getSettings(), mt = (n, e) => {
|
|
971
|
+
const t = Re(n);
|
|
916
972
|
let s = e;
|
|
917
973
|
s ??= n.label;
|
|
918
974
|
let i = t?.msid;
|
|
919
975
|
return i ??= s, i ??= n.id, i;
|
|
920
|
-
},
|
|
921
|
-
const t =
|
|
976
|
+
}, Nt = (n, e) => {
|
|
977
|
+
const t = Re(n);
|
|
922
978
|
let s = e;
|
|
923
979
|
return s ??= t?.msid, s ??= n.label, (s && s.length > 0 ? s : void 0) ?? n.id;
|
|
924
980
|
};
|
|
925
|
-
class
|
|
981
|
+
class se {
|
|
926
982
|
participantGroups = /* @__PURE__ */ new Map();
|
|
927
983
|
trackToGroup = /* @__PURE__ */ new Map();
|
|
928
984
|
trackDisposers = /* @__PURE__ */ new Map();
|
|
@@ -939,28 +995,28 @@ class Z {
|
|
|
939
995
|
onRemoved: t,
|
|
940
996
|
streamHint: s
|
|
941
997
|
} = {}) {
|
|
942
|
-
const i =
|
|
998
|
+
const i = Nt(e, s), r = mt(e, s);
|
|
943
999
|
if (this.trackToGroup.has(e.id))
|
|
944
1000
|
return { isAddedTrack: !1, isAddedStream: !1 };
|
|
945
1001
|
const a = this.getParticipantGroups(i), o = a.get(r), c = !o;
|
|
946
|
-
let
|
|
947
|
-
|
|
1002
|
+
let l = o;
|
|
1003
|
+
l || (l = {
|
|
948
1004
|
participantId: i,
|
|
949
1005
|
groupId: r,
|
|
950
1006
|
stream: new MediaStream(),
|
|
951
1007
|
trackIds: /* @__PURE__ */ new Set()
|
|
952
|
-
}, a.set(r,
|
|
953
|
-
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 = () => {
|
|
954
1010
|
this.disposeTrackListener(e.id);
|
|
955
|
-
const
|
|
956
|
-
|
|
1011
|
+
const u = this.removeTrack(e.id);
|
|
1012
|
+
u.isRemovedTrack && t?.({
|
|
957
1013
|
participantId: i,
|
|
958
1014
|
trackId: e.id,
|
|
959
|
-
isRemovedStream:
|
|
1015
|
+
isRemovedStream: u.isRemovedStream
|
|
960
1016
|
});
|
|
961
1017
|
};
|
|
962
|
-
return e.addEventListener("ended",
|
|
963
|
-
e.removeEventListener("ended",
|
|
1018
|
+
return e.addEventListener("ended", T), this.trackDisposers.set(e.id, () => {
|
|
1019
|
+
e.removeEventListener("ended", T);
|
|
964
1020
|
}), { isAddedTrack: !0, isAddedStream: c, participantId: i };
|
|
965
1021
|
}
|
|
966
1022
|
removeTrack(e) {
|
|
@@ -971,7 +1027,7 @@ class Z {
|
|
|
971
1027
|
const { participantId: s, groupId: i } = t, r = this.participantGroups.get(s), a = r?.get(i);
|
|
972
1028
|
if (!a)
|
|
973
1029
|
return this.trackToGroup.delete(e), { isRemovedTrack: !1, isRemovedStream: !1 };
|
|
974
|
-
const o = a.stream.getTracks().find((
|
|
1030
|
+
const o = a.stream.getTracks().find((l) => l.id === e);
|
|
975
1031
|
o && a.stream.removeTrack(o), a.trackIds.delete(e), this.trackToGroup.delete(e);
|
|
976
1032
|
const c = a.trackIds.size === 0;
|
|
977
1033
|
return c && (r?.delete(i), r?.size === 0 && this.participantGroups.delete(s)), { isRemovedTrack: !0, isRemovedStream: c };
|
|
@@ -983,8 +1039,8 @@ class Z {
|
|
|
983
1039
|
let i = !1;
|
|
984
1040
|
return [...s.values()].forEach((a) => {
|
|
985
1041
|
[...a.trackIds].filter((c) => !t.includes(c)).forEach((c) => {
|
|
986
|
-
const
|
|
987
|
-
i ||=
|
|
1042
|
+
const l = this.removeTrack(c);
|
|
1043
|
+
i ||= l.isRemovedTrack;
|
|
988
1044
|
});
|
|
989
1045
|
}), i;
|
|
990
1046
|
}
|
|
@@ -1007,16 +1063,16 @@ class Z {
|
|
|
1007
1063
|
return this.participantGroups.set(e, s), s;
|
|
1008
1064
|
}
|
|
1009
1065
|
}
|
|
1010
|
-
const
|
|
1066
|
+
const J = {
|
|
1011
1067
|
type: "participant"
|
|
1012
|
-
},
|
|
1068
|
+
}, At = {
|
|
1013
1069
|
type: "spectator_synthetic"
|
|
1014
|
-
},
|
|
1070
|
+
}, Rt = (n) => ({
|
|
1015
1071
|
type: "spectator",
|
|
1016
1072
|
recvParams: n
|
|
1017
1073
|
});
|
|
1018
|
-
class
|
|
1019
|
-
role =
|
|
1074
|
+
class O {
|
|
1075
|
+
role = J;
|
|
1020
1076
|
onRoleChanged;
|
|
1021
1077
|
constructor(e) {
|
|
1022
1078
|
this.onRoleChanged = e;
|
|
@@ -1034,13 +1090,13 @@ class _ {
|
|
|
1034
1090
|
return this.role;
|
|
1035
1091
|
}
|
|
1036
1092
|
setCallRoleParticipant() {
|
|
1037
|
-
this.changeRole(
|
|
1093
|
+
this.changeRole(J);
|
|
1038
1094
|
}
|
|
1039
1095
|
setCallRoleSpectatorSynthetic() {
|
|
1040
|
-
this.changeRole(
|
|
1096
|
+
this.changeRole(At);
|
|
1041
1097
|
}
|
|
1042
1098
|
setCallRoleSpectator(e) {
|
|
1043
|
-
this.changeRole(
|
|
1099
|
+
this.changeRole(Rt(e));
|
|
1044
1100
|
}
|
|
1045
1101
|
changeRole(e) {
|
|
1046
1102
|
const t = this.role;
|
|
@@ -1048,69 +1104,118 @@ class _ {
|
|
|
1048
1104
|
this.setRole(e);
|
|
1049
1105
|
return;
|
|
1050
1106
|
}
|
|
1051
|
-
|
|
1107
|
+
O.hasSpectator(e) && O.hasSpectator(t) && t.recvParams.audioId !== e.recvParams.audioId && this.setRole(e);
|
|
1052
1108
|
}
|
|
1053
1109
|
reset() {
|
|
1054
|
-
this.role =
|
|
1110
|
+
this.role = J;
|
|
1055
1111
|
}
|
|
1056
1112
|
hasParticipant() {
|
|
1057
|
-
return
|
|
1113
|
+
return O.hasParticipant(this.role);
|
|
1058
1114
|
}
|
|
1059
1115
|
hasSpectatorSynthetic() {
|
|
1060
|
-
return
|
|
1116
|
+
return O.hasSpectatorSynthetic(this.role);
|
|
1061
1117
|
}
|
|
1062
1118
|
hasSpectator() {
|
|
1063
|
-
return
|
|
1119
|
+
return O.hasSpectator(this.role);
|
|
1064
1120
|
}
|
|
1065
1121
|
setRole(e) {
|
|
1066
1122
|
const t = this.role;
|
|
1067
1123
|
this.role = e, this.onRoleChanged?.({ previous: t, next: e });
|
|
1068
1124
|
}
|
|
1069
1125
|
}
|
|
1070
|
-
const
|
|
1071
|
-
|
|
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 {
|
|
1072
1165
|
mainRemoteStreamsManager;
|
|
1073
1166
|
recvRemoteStreamsManager;
|
|
1074
1167
|
constructor(e, t) {
|
|
1075
1168
|
this.mainRemoteStreamsManager = e, this.recvRemoteStreamsManager = t;
|
|
1076
1169
|
}
|
|
1077
|
-
getActiveStreamsManagerTools(
|
|
1078
|
-
|
|
1170
|
+
getActiveStreamsManagerTools({
|
|
1171
|
+
isSpectator: e,
|
|
1172
|
+
stateInfo: t
|
|
1173
|
+
}) {
|
|
1174
|
+
return e ? this.getRecvRemoteStreamsManagerTools({ stateInfo: t }) : this.getMainRemoteStreamsManagerTools({ stateInfo: t });
|
|
1079
1175
|
}
|
|
1080
|
-
getMainRemoteStreamsManagerTools(
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
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 };
|
|
1085
1183
|
} };
|
|
1086
1184
|
}
|
|
1087
|
-
getRecvRemoteStreamsManagerTools(
|
|
1088
|
-
|
|
1089
|
-
|
|
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
|
+
} };
|
|
1090
1193
|
}
|
|
1091
1194
|
}
|
|
1092
|
-
const
|
|
1093
|
-
class
|
|
1195
|
+
const re = (n) => n.streams[0]?.id;
|
|
1196
|
+
class bt {
|
|
1094
1197
|
events;
|
|
1095
1198
|
callStateMachine;
|
|
1096
1199
|
isPendingCall = !1;
|
|
1097
1200
|
isPendingAnswer = !1;
|
|
1098
1201
|
rtcSession;
|
|
1099
1202
|
conferenceStateManager;
|
|
1100
|
-
mainRemoteStreamsManager = new
|
|
1101
|
-
recvRemoteStreamsManager = new
|
|
1203
|
+
mainRemoteStreamsManager = new se();
|
|
1204
|
+
recvRemoteStreamsManager = new se();
|
|
1102
1205
|
streamsManagerProvider;
|
|
1103
|
-
|
|
1206
|
+
contentedStreamManager;
|
|
1207
|
+
roleManager = new O((e) => {
|
|
1104
1208
|
this.onRoleChanged(e);
|
|
1105
1209
|
});
|
|
1106
1210
|
mcuSession;
|
|
1107
1211
|
recvSession;
|
|
1108
1212
|
disposeRecvSessionTrackListener;
|
|
1109
|
-
|
|
1110
|
-
|
|
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(
|
|
1111
1216
|
this.mainRemoteStreamsManager,
|
|
1112
1217
|
this.recvRemoteStreamsManager
|
|
1113
|
-
), this.subscribeCallStatusChange(), this.subscribeMcuRemoteTrackEvents();
|
|
1218
|
+
), this.subscribeCallStatusChange(), this.subscribeMcuRemoteTrackEvents(), this.subscribeContentedStreamEvents();
|
|
1114
1219
|
}
|
|
1115
1220
|
get callActor() {
|
|
1116
1221
|
return this.callStateMachine.actorRef;
|
|
@@ -1128,6 +1233,9 @@ class pt {
|
|
|
1128
1233
|
getStreamsManagerProvider() {
|
|
1129
1234
|
return this.streamsManagerProvider;
|
|
1130
1235
|
}
|
|
1236
|
+
getContentedStreamManager() {
|
|
1237
|
+
return this.contentedStreamManager;
|
|
1238
|
+
}
|
|
1131
1239
|
getEstablishedRTCSession = () => this.mcuSession.getEstablishedRTCSession();
|
|
1132
1240
|
on(e, t) {
|
|
1133
1241
|
return this.events.on(e, t);
|
|
@@ -1174,6 +1282,7 @@ class pt {
|
|
|
1174
1282
|
const { getRemoteStreams: e } = this.getActiveStreamsManagerTools();
|
|
1175
1283
|
return e();
|
|
1176
1284
|
}
|
|
1285
|
+
getActivePeerConnection = () => this.roleManager.hasSpectator() ? this.recvSession?.peerConnection : this.mcuSession.connection;
|
|
1177
1286
|
setCallRoleParticipant() {
|
|
1178
1287
|
this.roleManager.setCallRoleParticipant();
|
|
1179
1288
|
}
|
|
@@ -1190,22 +1299,22 @@ class pt {
|
|
|
1190
1299
|
return this.mcuSession.restartIce(e);
|
|
1191
1300
|
}
|
|
1192
1301
|
reset = () => {
|
|
1193
|
-
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();
|
|
1194
1303
|
};
|
|
1195
1304
|
subscribeCallStatusChange() {
|
|
1196
1305
|
let { isCallActive: e } = this;
|
|
1197
|
-
const { ACCEPTED: t, CONFIRMED: s, ENDED: i, FAILED: r } =
|
|
1306
|
+
const { ACCEPTED: t, CONFIRMED: s, ENDED: i, FAILED: r } = S;
|
|
1198
1307
|
this.onRace([t, s, i, r], () => {
|
|
1199
1308
|
e = this.maybeTriggerCallStatus(e);
|
|
1200
1309
|
});
|
|
1201
1310
|
}
|
|
1202
1311
|
maybeTriggerCallStatus(e) {
|
|
1203
1312
|
const t = this.isCallActive;
|
|
1204
|
-
return t !== e && this.events.trigger(
|
|
1313
|
+
return t !== e && this.events.trigger(S.CALL_STATUS_CHANGED, { isCallActive: t }), t;
|
|
1205
1314
|
}
|
|
1206
1315
|
subscribeMcuRemoteTrackEvents() {
|
|
1207
|
-
this.on(
|
|
1208
|
-
this.addRemoteTrack(this.mainRemoteStreamsManager, e.track,
|
|
1316
|
+
this.on(S.PEER_CONNECTION_ONTRACK, (e) => {
|
|
1317
|
+
this.addRemoteTrack(this.mainRemoteStreamsManager, e.track, re(e));
|
|
1209
1318
|
});
|
|
1210
1319
|
}
|
|
1211
1320
|
addRemoteTrack(e, t, s) {
|
|
@@ -1240,7 +1349,7 @@ class pt {
|
|
|
1240
1349
|
this.emitEventChangedRemoteTracks(c, t, { trackId: s, participantId: i }), (a || r) && this.emitEventChangedRemoteStreams(c);
|
|
1241
1350
|
}
|
|
1242
1351
|
emitEventChangedRemoteTracks(e, t, { trackId: s, participantId: i }) {
|
|
1243
|
-
this.events.trigger(
|
|
1352
|
+
this.events.trigger(S.REMOTE_TRACKS_CHANGED, {
|
|
1244
1353
|
streams: e,
|
|
1245
1354
|
changeType: t,
|
|
1246
1355
|
trackId: s,
|
|
@@ -1248,16 +1357,17 @@ class pt {
|
|
|
1248
1357
|
});
|
|
1249
1358
|
}
|
|
1250
1359
|
emitEventChangedRemoteStreams(e) {
|
|
1251
|
-
this.events.trigger(
|
|
1360
|
+
this.streamsChangeTracker.hasChanged(e) && (this.streamsChangeTracker.updateLastEmittedStreams(e), this.events.trigger(S.REMOTE_STREAMS_CHANGED, { streams: e }));
|
|
1252
1361
|
}
|
|
1253
1362
|
getActiveStreamsManagerTools() {
|
|
1254
|
-
return this.streamsManagerProvider.getActiveStreamsManagerTools(
|
|
1255
|
-
this.roleManager.hasSpectator()
|
|
1256
|
-
|
|
1363
|
+
return this.streamsManagerProvider.getActiveStreamsManagerTools({
|
|
1364
|
+
isSpectator: this.roleManager.hasSpectator(),
|
|
1365
|
+
stateInfo: this.contentedStreamManager.getStateInfo()
|
|
1366
|
+
});
|
|
1257
1367
|
}
|
|
1258
1368
|
attachRecvSessionTracks(e) {
|
|
1259
1369
|
const { peerConnection: t } = e, s = (i) => {
|
|
1260
|
-
this.addRemoteTrack(this.recvRemoteStreamsManager, i.track,
|
|
1370
|
+
this.addRemoteTrack(this.recvRemoteStreamsManager, i.track, re(i));
|
|
1261
1371
|
};
|
|
1262
1372
|
t.addEventListener("track", s), this.disposeRecvSessionTrackListener = () => {
|
|
1263
1373
|
t.removeEventListener("track", s);
|
|
@@ -1271,7 +1381,7 @@ class pt {
|
|
|
1271
1381
|
const i = {
|
|
1272
1382
|
quality: "high",
|
|
1273
1383
|
audioChannel: e
|
|
1274
|
-
}, r = new
|
|
1384
|
+
}, r = new pt(i, { sendOffer: t });
|
|
1275
1385
|
this.recvSession = r, this.recvRemoteStreamsManager.reset(), this.attachRecvSessionTracks(r), r.call(s).catch(() => {
|
|
1276
1386
|
this.stopRecvSession();
|
|
1277
1387
|
});
|
|
@@ -1283,45 +1393,52 @@ class pt {
|
|
|
1283
1393
|
previous: e,
|
|
1284
1394
|
next: t
|
|
1285
1395
|
}) => {
|
|
1286
|
-
if (
|
|
1396
|
+
if (O.hasSpectator(e) && !O.hasSpectator(t) && (this.stopRecvSession(), this.emitEventChangedRemoteStreams(this.getRemoteStreams())), O.hasSpectator(t)) {
|
|
1287
1397
|
const s = t.recvParams;
|
|
1288
1398
|
this.startRecvSession(s.audioId, s.sendOffer);
|
|
1289
1399
|
}
|
|
1290
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
|
+
}
|
|
1291
1408
|
}
|
|
1292
|
-
const
|
|
1409
|
+
const Ot = (n, e) => (n.degradationPreference = e.degradationPreference, n), Dt = (n, e) => {
|
|
1293
1410
|
n.encodings ??= [];
|
|
1294
1411
|
for (let t = n.encodings.length; t < e; t += 1)
|
|
1295
1412
|
n.encodings.push({});
|
|
1296
1413
|
return n;
|
|
1297
|
-
},
|
|
1298
|
-
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))
|
|
1299
1416
|
return n;
|
|
1300
|
-
},
|
|
1301
|
-
const t = n.maxBitrate, s =
|
|
1417
|
+
}, Lt = (n, e) => {
|
|
1418
|
+
const t = n.maxBitrate, s = yt(e, t);
|
|
1302
1419
|
return s !== void 0 && (n.maxBitrate = s), n;
|
|
1303
|
-
},
|
|
1304
|
-
|
|
1305
|
-
),
|
|
1306
|
-
const t = n === void 0 ? void 0 : Math.max(n,
|
|
1307
|
-
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(
|
|
1308
1425
|
t,
|
|
1309
1426
|
e
|
|
1310
1427
|
))
|
|
1311
1428
|
return t;
|
|
1312
|
-
},
|
|
1313
|
-
const t = n.scaleResolutionDownBy, s =
|
|
1429
|
+
}, Ft = (n, e) => {
|
|
1430
|
+
const t = n.scaleResolutionDownBy, s = Ut(
|
|
1314
1431
|
e,
|
|
1315
1432
|
t
|
|
1316
1433
|
);
|
|
1317
1434
|
return s !== void 0 && (n.scaleResolutionDownBy = s), n;
|
|
1318
|
-
},
|
|
1435
|
+
}, Bt = (n, e) => {
|
|
1319
1436
|
const t = e.encodings?.length ?? 0;
|
|
1320
|
-
return
|
|
1437
|
+
return Dt(n, t), n.encodings.forEach((s, i) => {
|
|
1321
1438
|
const r = (e?.encodings ?? [])[i], a = r?.maxBitrate, o = r?.scaleResolutionDownBy;
|
|
1322
|
-
|
|
1439
|
+
Lt(s, a), Ft(s, o);
|
|
1323
1440
|
}), n;
|
|
1324
|
-
},
|
|
1441
|
+
}, kt = (n, e) => {
|
|
1325
1442
|
if (n.codecs?.length !== e.codecs?.length)
|
|
1326
1443
|
return !0;
|
|
1327
1444
|
for (let t = 0; t < (n.codecs?.length ?? 0); t++)
|
|
@@ -1338,15 +1455,15 @@ const mt = (n, e) => (n.degradationPreference = e.degradationPreference, n), Nt
|
|
|
1338
1455
|
if (JSON.stringify(n.encodings[t]) !== JSON.stringify(e.encodings[t]))
|
|
1339
1456
|
return !0;
|
|
1340
1457
|
return n.rtcp?.cname !== e.rtcp?.cname || n.rtcp?.reducedSize !== e.rtcp?.reducedSize || n.degradationPreference !== e.degradationPreference;
|
|
1341
|
-
},
|
|
1458
|
+
}, $t = async (n, e) => {
|
|
1342
1459
|
const t = n.getParameters(), s = JSON.parse(
|
|
1343
1460
|
JSON.stringify(t)
|
|
1344
1461
|
);
|
|
1345
|
-
|
|
1346
|
-
const i =
|
|
1462
|
+
Bt(t, e), Ot(t, e);
|
|
1463
|
+
const i = kt(s, t);
|
|
1347
1464
|
return i && await n.setParameters(t), { parameters: t, isChanged: i };
|
|
1348
|
-
},
|
|
1349
|
-
const { isChanged: s, parameters: i } = await
|
|
1465
|
+
}, fe = async (n, e, t) => {
|
|
1466
|
+
const { isChanged: s, parameters: i } = await $t(n, {
|
|
1350
1467
|
encodings: [
|
|
1351
1468
|
{
|
|
1352
1469
|
scaleResolutionDownBy: e.scaleResolutionDownBy,
|
|
@@ -1355,21 +1472,21 @@ const mt = (n, e) => (n.degradationPreference = e.degradationPreference, n), Nt
|
|
|
1355
1472
|
]
|
|
1356
1473
|
});
|
|
1357
1474
|
return s && t && t(i), { isChanged: s, parameters: i };
|
|
1358
|
-
},
|
|
1359
|
-
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);
|
|
1360
1477
|
if (s)
|
|
1361
|
-
return
|
|
1478
|
+
return fe(s, { maxBitrate: t });
|
|
1362
1479
|
};
|
|
1363
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 || {});
|
|
1364
|
-
const
|
|
1481
|
+
const Me = [
|
|
1365
1482
|
"presentation:start",
|
|
1366
1483
|
"presentation:started",
|
|
1367
1484
|
"presentation:end",
|
|
1368
1485
|
"presentation:ended",
|
|
1369
1486
|
"presentation:failed"
|
|
1370
|
-
],
|
|
1371
|
-
var
|
|
1372
|
-
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({
|
|
1373
1490
|
types: {
|
|
1374
1491
|
context: {},
|
|
1375
1492
|
events: {}
|
|
@@ -1381,10 +1498,10 @@ const Lt = $({
|
|
|
1381
1498
|
logStateChange: (n, e) => {
|
|
1382
1499
|
d("PresentationStateMachine state changed", e.state);
|
|
1383
1500
|
},
|
|
1384
|
-
setError:
|
|
1501
|
+
setError: M(({ event: n }) => "error" in n && n.error !== void 0 ? {
|
|
1385
1502
|
lastError: n.error instanceof Error ? n.error : new Error(JSON.stringify(n.error))
|
|
1386
1503
|
} : { lastError: void 0 }),
|
|
1387
|
-
clearError:
|
|
1504
|
+
clearError: M({ lastError: void 0 })
|
|
1388
1505
|
}
|
|
1389
1506
|
}).createMachine({
|
|
1390
1507
|
id: "presentation",
|
|
@@ -1694,9 +1811,9 @@ const Lt = $({
|
|
|
1694
1811
|
}
|
|
1695
1812
|
}
|
|
1696
1813
|
});
|
|
1697
|
-
class
|
|
1814
|
+
class xt extends V {
|
|
1698
1815
|
constructor(e) {
|
|
1699
|
-
super(
|
|
1816
|
+
super(Wt), this.subscribeCallEvents(e);
|
|
1700
1817
|
}
|
|
1701
1818
|
get isIdle() {
|
|
1702
1819
|
return this.state === "presentation:idle";
|
|
@@ -1736,38 +1853,38 @@ class Ut extends q {
|
|
|
1736
1853
|
}
|
|
1737
1854
|
subscribeCallEvents(e) {
|
|
1738
1855
|
this.addSubscription(
|
|
1739
|
-
e.on(
|
|
1856
|
+
e.on(S.START_PRESENTATION, () => {
|
|
1740
1857
|
this.send({ type: "SCREEN.STARTING" });
|
|
1741
1858
|
})
|
|
1742
1859
|
), this.addSubscription(
|
|
1743
|
-
e.on(
|
|
1860
|
+
e.on(S.STARTED_PRESENTATION, () => {
|
|
1744
1861
|
this.send({ type: "SCREEN.STARTED" });
|
|
1745
1862
|
})
|
|
1746
1863
|
), this.addSubscription(
|
|
1747
|
-
e.on(
|
|
1864
|
+
e.on(S.END_PRESENTATION, () => {
|
|
1748
1865
|
this.send({ type: "SCREEN.ENDING" });
|
|
1749
1866
|
})
|
|
1750
1867
|
), this.addSubscription(
|
|
1751
|
-
e.on(
|
|
1868
|
+
e.on(S.ENDED_PRESENTATION, () => {
|
|
1752
1869
|
this.send({ type: "SCREEN.ENDED" });
|
|
1753
1870
|
})
|
|
1754
1871
|
), this.addSubscription(
|
|
1755
|
-
e.on(
|
|
1872
|
+
e.on(S.FAILED_PRESENTATION, (t) => {
|
|
1756
1873
|
this.send({ type: "SCREEN.FAILED", error: t });
|
|
1757
1874
|
})
|
|
1758
1875
|
), this.addSubscription(
|
|
1759
|
-
e.on(
|
|
1876
|
+
e.on(S.ENDED, () => {
|
|
1760
1877
|
this.send({ type: "CALL.ENDED" });
|
|
1761
1878
|
})
|
|
1762
1879
|
), this.addSubscription(
|
|
1763
|
-
e.on(
|
|
1880
|
+
e.on(S.FAILED, (t) => {
|
|
1764
1881
|
this.send({ type: "CALL.FAILED", error: t });
|
|
1765
1882
|
})
|
|
1766
1883
|
);
|
|
1767
1884
|
}
|
|
1768
1885
|
}
|
|
1769
|
-
const
|
|
1770
|
-
class
|
|
1886
|
+
const Qt = 1, di = (n) => je(n);
|
|
1887
|
+
class Yt {
|
|
1771
1888
|
events;
|
|
1772
1889
|
presentationStateMachine;
|
|
1773
1890
|
promisePendingStartPresentation;
|
|
@@ -1780,7 +1897,7 @@ class kt {
|
|
|
1780
1897
|
callManager: e,
|
|
1781
1898
|
maxBitrate: t
|
|
1782
1899
|
}) {
|
|
1783
|
-
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();
|
|
1784
1901
|
}
|
|
1785
1902
|
get presentationActor() {
|
|
1786
1903
|
return this.presentationStateMachine.actorRef;
|
|
@@ -1878,7 +1995,7 @@ class kt {
|
|
|
1878
1995
|
stream: s,
|
|
1879
1996
|
presentationOptions: i,
|
|
1880
1997
|
options: r = {
|
|
1881
|
-
callLimit:
|
|
1998
|
+
callLimit: Qt
|
|
1882
1999
|
}
|
|
1883
2000
|
}) {
|
|
1884
2001
|
const a = async () => this.sendPresentation(
|
|
@@ -1887,7 +2004,7 @@ class kt {
|
|
|
1887
2004
|
s,
|
|
1888
2005
|
i
|
|
1889
2006
|
), o = () => !!this.streamPresentationCurrent;
|
|
1890
|
-
return this.cancelableSendPresentationWithRepeatedCalls =
|
|
2007
|
+
return this.cancelableSendPresentationWithRepeatedCalls = Te({
|
|
1891
2008
|
targetFunction: a,
|
|
1892
2009
|
isComplete: o,
|
|
1893
2010
|
isRejectAsValid: !0,
|
|
@@ -1902,20 +2019,20 @@ class kt {
|
|
|
1902
2019
|
sendEncodings: o,
|
|
1903
2020
|
onAddedTransceiver: c
|
|
1904
2021
|
}) {
|
|
1905
|
-
const
|
|
1906
|
-
if (
|
|
2022
|
+
const l = H(s, { contentHint: r });
|
|
2023
|
+
if (l === void 0)
|
|
1907
2024
|
throw new Error("No streamPresentationTarget");
|
|
1908
|
-
this.streamPresentationCurrent =
|
|
1909
|
-
const
|
|
2025
|
+
this.streamPresentationCurrent = l;
|
|
2026
|
+
const T = e().then(async () => t.startPresentation(l, i, {
|
|
1910
2027
|
degradationPreference: a,
|
|
1911
2028
|
sendEncodings: o,
|
|
1912
2029
|
onAddedTransceiver: c
|
|
1913
|
-
})).then(this.setMaxBitrate).then(() => s).catch((
|
|
2030
|
+
})).then(this.setMaxBitrate).then(() => s).catch((u) => {
|
|
1914
2031
|
this.removeStreamPresentationCurrent();
|
|
1915
|
-
const
|
|
1916
|
-
throw this.events.trigger(P.FAILED_PRESENTATION,
|
|
2032
|
+
const E = u instanceof Error ? u : new Error(String(u));
|
|
2033
|
+
throw this.events.trigger(P.FAILED_PRESENTATION, E), u;
|
|
1917
2034
|
});
|
|
1918
|
-
return this.promisePendingStartPresentation =
|
|
2035
|
+
return this.promisePendingStartPresentation = T, T.finally(() => {
|
|
1919
2036
|
this.promisePendingStartPresentation = void 0;
|
|
1920
2037
|
});
|
|
1921
2038
|
}
|
|
@@ -1924,7 +2041,7 @@ class kt {
|
|
|
1924
2041
|
if (!e || !t || s === void 0)
|
|
1925
2042
|
return;
|
|
1926
2043
|
const i = e.getSenders();
|
|
1927
|
-
await
|
|
2044
|
+
await Vt(i, t, s);
|
|
1928
2045
|
};
|
|
1929
2046
|
getRtcSessionProtected = () => {
|
|
1930
2047
|
const e = this.callManager.getEstablishedRTCSession();
|
|
@@ -1945,7 +2062,7 @@ class kt {
|
|
|
1945
2062
|
delete this.streamPresentationCurrent;
|
|
1946
2063
|
}
|
|
1947
2064
|
}
|
|
1948
|
-
class
|
|
2065
|
+
class Xt {
|
|
1949
2066
|
data;
|
|
1950
2067
|
getUa;
|
|
1951
2068
|
constructor(e) {
|
|
@@ -2032,7 +2149,7 @@ class Bt {
|
|
|
2032
2149
|
}
|
|
2033
2150
|
}
|
|
2034
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 || {});
|
|
2035
|
-
const
|
|
2152
|
+
const _e = [
|
|
2036
2153
|
"connecting",
|
|
2037
2154
|
"connected",
|
|
2038
2155
|
"disconnected",
|
|
@@ -2042,7 +2159,7 @@ const Re = [
|
|
|
2042
2159
|
"registrationFailed",
|
|
2043
2160
|
"newMessage",
|
|
2044
2161
|
"sipEvent"
|
|
2045
|
-
],
|
|
2162
|
+
], Jt = [
|
|
2046
2163
|
"disconnecting",
|
|
2047
2164
|
"connect-started",
|
|
2048
2165
|
"connect-succeeded",
|
|
@@ -2050,12 +2167,12 @@ const Re = [
|
|
|
2050
2167
|
"connect-parameters-resolve-success",
|
|
2051
2168
|
"connect-parameters-resolve-failed",
|
|
2052
2169
|
"connected-with-configuration"
|
|
2053
|
-
],
|
|
2054
|
-
function
|
|
2170
|
+
], be = [..._e, ...Jt], zt = () => new R(be);
|
|
2171
|
+
function jt(n) {
|
|
2055
2172
|
return (e) => `sip:${e}@${n}`;
|
|
2056
2173
|
}
|
|
2057
|
-
const
|
|
2058
|
-
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 {
|
|
2059
2176
|
cancelableConnectWithRepeatedCalls;
|
|
2060
2177
|
JsSIP;
|
|
2061
2178
|
events;
|
|
@@ -2081,7 +2198,7 @@ class xt {
|
|
|
2081
2198
|
}
|
|
2082
2199
|
let r = !1;
|
|
2083
2200
|
const a = this.getConnectionConfiguration();
|
|
2084
|
-
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));
|
|
2085
2202
|
const o = r;
|
|
2086
2203
|
o ? t(o) : s(new Error("nothing changed"));
|
|
2087
2204
|
});
|
|
@@ -2099,12 +2216,12 @@ class xt {
|
|
|
2099
2216
|
cancelRequests() {
|
|
2100
2217
|
this.cancelConnectWithRepeatedCalls();
|
|
2101
2218
|
}
|
|
2102
|
-
connectWithDuplicatedCalls = async (e, { callLimit: t =
|
|
2219
|
+
connectWithDuplicatedCalls = async (e, { callLimit: t = en } = {}) => {
|
|
2103
2220
|
const s = async () => this.connectInner(e), i = (r) => {
|
|
2104
|
-
const c = this.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e),
|
|
2105
|
-
return c ||
|
|
2221
|
+
const c = this.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), l = r != null && !st(r);
|
|
2222
|
+
return c || l;
|
|
2106
2223
|
};
|
|
2107
|
-
return this.stateMachine.startConnect(), this.cancelableConnectWithRepeatedCalls =
|
|
2224
|
+
return this.stateMachine.startConnect(), this.cancelableConnectWithRepeatedCalls = Te({
|
|
2108
2225
|
targetFunction: s,
|
|
2109
2226
|
isComplete: i,
|
|
2110
2227
|
callLimit: t,
|
|
@@ -2138,39 +2255,39 @@ class xt {
|
|
|
2138
2255
|
sessionTimers: a,
|
|
2139
2256
|
registerExpires: o,
|
|
2140
2257
|
connectionRecoveryMinInterval: c,
|
|
2141
|
-
connectionRecoveryMaxInterval:
|
|
2142
|
-
userAgent:
|
|
2143
|
-
displayName:
|
|
2144
|
-
register:
|
|
2258
|
+
connectionRecoveryMaxInterval: l,
|
|
2259
|
+
userAgent: T,
|
|
2260
|
+
displayName: u = "",
|
|
2261
|
+
register: E = !1,
|
|
2145
2262
|
extraHeaders: m = []
|
|
2146
2263
|
}) => {
|
|
2147
2264
|
this.stateMachine.startInitUa(), this.setConnectionConfiguration({
|
|
2148
2265
|
sipServerIp: s,
|
|
2149
2266
|
sipServerUrl: i,
|
|
2150
|
-
displayName:
|
|
2151
|
-
register:
|
|
2267
|
+
displayName: u,
|
|
2268
|
+
register: E,
|
|
2152
2269
|
user: e,
|
|
2153
2270
|
password: t
|
|
2154
2271
|
}), this.getUa() && await this.disconnect();
|
|
2155
|
-
const { ua:
|
|
2272
|
+
const { ua: A, helpers: w } = this.uaFactory.createUAWithConfiguration(
|
|
2156
2273
|
{
|
|
2157
2274
|
user: e,
|
|
2158
2275
|
password: t,
|
|
2159
2276
|
sipServerIp: s,
|
|
2160
2277
|
sipServerUrl: i,
|
|
2161
|
-
displayName:
|
|
2162
|
-
register:
|
|
2278
|
+
displayName: u,
|
|
2279
|
+
register: E,
|
|
2163
2280
|
sessionTimers: a,
|
|
2164
2281
|
registerExpires: o,
|
|
2165
2282
|
connectionRecoveryMinInterval: c,
|
|
2166
|
-
connectionRecoveryMaxInterval:
|
|
2167
|
-
userAgent:
|
|
2283
|
+
connectionRecoveryMaxInterval: l,
|
|
2284
|
+
userAgent: T,
|
|
2168
2285
|
remoteAddress: r,
|
|
2169
2286
|
extraHeaders: m
|
|
2170
2287
|
},
|
|
2171
2288
|
this.events
|
|
2172
2289
|
);
|
|
2173
|
-
return this.setUa(
|
|
2290
|
+
return this.setUa(A), this.setGetUri(w.getUri), this.setSocket(w.socket), A;
|
|
2174
2291
|
};
|
|
2175
2292
|
start = async () => new Promise((e, t) => {
|
|
2176
2293
|
const s = this.getUa();
|
|
@@ -2179,15 +2296,15 @@ class xt {
|
|
|
2179
2296
|
return;
|
|
2180
2297
|
}
|
|
2181
2298
|
let i;
|
|
2182
|
-
i = ((c,
|
|
2299
|
+
i = ((c, l) => {
|
|
2183
2300
|
if (this.getConnectionConfiguration()?.register === !0)
|
|
2184
|
-
return this.registrationManager.subscribeToStartEvents(c,
|
|
2185
|
-
const
|
|
2186
|
-
return this.events.on(
|
|
2187
|
-
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);
|
|
2188
2305
|
}), () => {
|
|
2189
|
-
this.events.off(
|
|
2190
|
-
this.events.off(m,
|
|
2306
|
+
this.events.off(u, c), E.forEach((m) => {
|
|
2307
|
+
this.events.off(m, l);
|
|
2191
2308
|
});
|
|
2192
2309
|
};
|
|
2193
2310
|
})(() => {
|
|
@@ -2209,8 +2326,8 @@ class xt {
|
|
|
2209
2326
|
});
|
|
2210
2327
|
}
|
|
2211
2328
|
}
|
|
2212
|
-
var
|
|
2213
|
-
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({
|
|
2214
2331
|
types: {
|
|
2215
2332
|
context: {},
|
|
2216
2333
|
events: {}
|
|
@@ -2222,13 +2339,13 @@ const Yt = Object.values(fe), Xt = $({
|
|
|
2222
2339
|
logStateChange: (n, e) => {
|
|
2223
2340
|
d("ConnectionStateMachine state changed", e.state);
|
|
2224
2341
|
},
|
|
2225
|
-
setError:
|
|
2342
|
+
setError: M({
|
|
2226
2343
|
error: ({ event: n }) => {
|
|
2227
2344
|
if (n.type === "CONNECTION_FAILED" && "error" in n)
|
|
2228
2345
|
return n.error;
|
|
2229
2346
|
}
|
|
2230
2347
|
}),
|
|
2231
|
-
clearError:
|
|
2348
|
+
clearError: M({
|
|
2232
2349
|
error: () => {
|
|
2233
2350
|
}
|
|
2234
2351
|
})
|
|
@@ -2590,19 +2707,11 @@ const Yt = Object.values(fe), Xt = $({
|
|
|
2590
2707
|
}
|
|
2591
2708
|
}
|
|
2592
2709
|
});
|
|
2593
|
-
class
|
|
2594
|
-
stateChangeListeners = /* @__PURE__ */ new Set();
|
|
2710
|
+
class an extends V {
|
|
2595
2711
|
events;
|
|
2596
2712
|
unsubscribeFromEvents;
|
|
2597
2713
|
constructor(e) {
|
|
2598
|
-
super(
|
|
2599
|
-
this.subscribe((t) => {
|
|
2600
|
-
const s = t.value;
|
|
2601
|
-
this.stateChangeListeners.forEach((i) => {
|
|
2602
|
-
i(s);
|
|
2603
|
-
});
|
|
2604
|
-
})
|
|
2605
|
-
), this.subscribeToEvents();
|
|
2714
|
+
super(rn), this.events = e, this.subscribeToEvents();
|
|
2606
2715
|
}
|
|
2607
2716
|
get isIdle() {
|
|
2608
2717
|
return this.hasState(
|
|
@@ -2678,18 +2787,13 @@ class Jt extends q {
|
|
|
2678
2787
|
this.toIdle();
|
|
2679
2788
|
}
|
|
2680
2789
|
destroy() {
|
|
2681
|
-
this.
|
|
2682
|
-
}
|
|
2683
|
-
onStateChange(e) {
|
|
2684
|
-
return this.stateChangeListeners.add(e), () => {
|
|
2685
|
-
this.stateChangeListeners.delete(e);
|
|
2686
|
-
};
|
|
2790
|
+
this.unsubscribeFromEvents?.(), this.stop();
|
|
2687
2791
|
}
|
|
2688
2792
|
canTransition(e) {
|
|
2689
2793
|
return this.getSnapshot().can({ type: e });
|
|
2690
2794
|
}
|
|
2691
2795
|
getValidEvents() {
|
|
2692
|
-
return
|
|
2796
|
+
return sn.filter((e) => this.canTransition(e));
|
|
2693
2797
|
}
|
|
2694
2798
|
hasState(e) {
|
|
2695
2799
|
return this.getSnapshot().matches(e);
|
|
@@ -2761,7 +2865,7 @@ class Jt extends q {
|
|
|
2761
2865
|
this.toFailed(e instanceof Error ? e : void 0);
|
|
2762
2866
|
};
|
|
2763
2867
|
}
|
|
2764
|
-
class
|
|
2868
|
+
class on {
|
|
2765
2869
|
events;
|
|
2766
2870
|
getUaProtected;
|
|
2767
2871
|
constructor(e) {
|
|
@@ -2798,7 +2902,7 @@ class zt {
|
|
|
2798
2902
|
};
|
|
2799
2903
|
}
|
|
2800
2904
|
}
|
|
2801
|
-
class
|
|
2905
|
+
class cn {
|
|
2802
2906
|
uaFactory;
|
|
2803
2907
|
getUaProtected;
|
|
2804
2908
|
constructor(e) {
|
|
@@ -2844,30 +2948,30 @@ class Kt {
|
|
|
2844
2948
|
extraHeaders: a
|
|
2845
2949
|
}) {
|
|
2846
2950
|
return new Promise((o, c) => {
|
|
2847
|
-
const { configuration:
|
|
2951
|
+
const { configuration: l } = this.uaFactory.createConfiguration({
|
|
2848
2952
|
sipServerUrl: i,
|
|
2849
2953
|
displayName: t,
|
|
2850
2954
|
userAgent: e,
|
|
2851
2955
|
sipServerIp: s
|
|
2852
|
-
}),
|
|
2956
|
+
}), T = this.uaFactory.createUA({ ...l, remoteAddress: r, extraHeaders: a }), u = () => {
|
|
2853
2957
|
const m = new Error("Telephony is not available");
|
|
2854
2958
|
c(m);
|
|
2855
2959
|
};
|
|
2856
|
-
|
|
2857
|
-
const
|
|
2858
|
-
|
|
2960
|
+
T.once(C.DISCONNECTED, u);
|
|
2961
|
+
const E = () => {
|
|
2962
|
+
T.removeAllListeners(), T.once(C.DISCONNECTED, () => {
|
|
2859
2963
|
o();
|
|
2860
|
-
}),
|
|
2964
|
+
}), T.stop();
|
|
2861
2965
|
};
|
|
2862
|
-
|
|
2966
|
+
T.once(C.CONNECTED, E), T.start();
|
|
2863
2967
|
});
|
|
2864
2968
|
}
|
|
2865
2969
|
}
|
|
2866
|
-
const
|
|
2970
|
+
const dn = (n) => {
|
|
2867
2971
|
const e = [];
|
|
2868
2972
|
return n !== void 0 && n !== "" && e.push(`X-Vinteo-Remote: ${n}`), e;
|
|
2869
2973
|
};
|
|
2870
|
-
class
|
|
2974
|
+
class F {
|
|
2871
2975
|
JsSIP;
|
|
2872
2976
|
constructor(e) {
|
|
2873
2977
|
this.JsSIP = e;
|
|
@@ -2892,10 +2996,10 @@ class w {
|
|
|
2892
2996
|
throw new Error("user is required for authorized connection");
|
|
2893
2997
|
}
|
|
2894
2998
|
static resolveAuthorizationUser(e, t) {
|
|
2895
|
-
return e && t !== void 0 && t.trim() !== "" ? t.trim() : `${
|
|
2999
|
+
return e && t !== void 0 && t.trim() !== "" ? t.trim() : `${Zt()}`;
|
|
2896
3000
|
}
|
|
2897
3001
|
static buildExtraHeaders(e, t) {
|
|
2898
|
-
const s = e !== void 0 && e !== "" ?
|
|
3002
|
+
const s = e !== void 0 && e !== "" ? dn(e) : [];
|
|
2899
3003
|
return t === void 0 ? s : [...s, ...t];
|
|
2900
3004
|
}
|
|
2901
3005
|
createConfiguration({
|
|
@@ -2908,40 +3012,40 @@ class w {
|
|
|
2908
3012
|
sessionTimers: o = !1,
|
|
2909
3013
|
registerExpires: c = 300,
|
|
2910
3014
|
// 5 minutes in sec
|
|
2911
|
-
connectionRecoveryMinInterval:
|
|
2912
|
-
connectionRecoveryMaxInterval:
|
|
2913
|
-
userAgent:
|
|
3015
|
+
connectionRecoveryMinInterval: l = 2,
|
|
3016
|
+
connectionRecoveryMaxInterval: T = 6,
|
|
3017
|
+
userAgent: u
|
|
2914
3018
|
}) {
|
|
2915
|
-
|
|
3019
|
+
F.validateParametersConnection({
|
|
2916
3020
|
register: a,
|
|
2917
3021
|
password: t,
|
|
2918
3022
|
user: e,
|
|
2919
3023
|
sipServerIp: r,
|
|
2920
3024
|
sipServerUrl: s
|
|
2921
3025
|
});
|
|
2922
|
-
const
|
|
3026
|
+
const E = F.resolveAuthorizationUser(a, e), m = jt(r), D = m(E), A = new this.JsSIP.WebSocketInterface(`wss://${s}/webrtc/wss/`);
|
|
2923
3027
|
return {
|
|
2924
3028
|
configuration: {
|
|
2925
3029
|
password: t,
|
|
2926
3030
|
register: a,
|
|
2927
|
-
uri:
|
|
2928
|
-
display_name:
|
|
2929
|
-
user_agent:
|
|
3031
|
+
uri: D,
|
|
3032
|
+
display_name: Oe(i),
|
|
3033
|
+
user_agent: u,
|
|
2930
3034
|
sdpSemantics: "unified-plan",
|
|
2931
|
-
sockets: [
|
|
3035
|
+
sockets: [A],
|
|
2932
3036
|
session_timers: o,
|
|
2933
3037
|
register_expires: c,
|
|
2934
|
-
connection_recovery_min_interval:
|
|
2935
|
-
connection_recovery_max_interval:
|
|
3038
|
+
connection_recovery_min_interval: l,
|
|
3039
|
+
connection_recovery_max_interval: T
|
|
2936
3040
|
},
|
|
2937
3041
|
helpers: {
|
|
2938
|
-
socket:
|
|
3042
|
+
socket: A,
|
|
2939
3043
|
getUri: m
|
|
2940
3044
|
}
|
|
2941
3045
|
};
|
|
2942
3046
|
}
|
|
2943
3047
|
createUA({ remoteAddress: e, extraHeaders: t, ...s }) {
|
|
2944
|
-
const i = new this.JsSIP.UA(s), r =
|
|
3048
|
+
const i = new this.JsSIP.UA(s), r = F.buildExtraHeaders(e, t);
|
|
2945
3049
|
return r.length > 0 && i.registrator().setExtraHeaders(r), i;
|
|
2946
3050
|
}
|
|
2947
3051
|
/**
|
|
@@ -2954,13 +3058,13 @@ class w {
|
|
|
2954
3058
|
extraHeaders: e.extraHeaders
|
|
2955
3059
|
});
|
|
2956
3060
|
return t.eachTriggers((a, o) => {
|
|
2957
|
-
const c =
|
|
3061
|
+
const c = _e.find((l) => l === o);
|
|
2958
3062
|
c && r.on(c, a);
|
|
2959
3063
|
}), { ua: r, helpers: i };
|
|
2960
3064
|
}
|
|
2961
3065
|
}
|
|
2962
|
-
const
|
|
2963
|
-
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 {
|
|
2964
3068
|
events;
|
|
2965
3069
|
ua;
|
|
2966
3070
|
socket;
|
|
@@ -2972,15 +3076,15 @@ class nn {
|
|
|
2972
3076
|
configurationManager;
|
|
2973
3077
|
JsSIP;
|
|
2974
3078
|
constructor({ JsSIP: e }) {
|
|
2975
|
-
this.JsSIP = e, this.events =
|
|
3079
|
+
this.JsSIP = e, this.events = zt(), this.uaFactory = new F(e), this.registrationManager = new on({
|
|
2976
3080
|
events: this.events,
|
|
2977
3081
|
getUaProtected: this.getUaProtected
|
|
2978
|
-
}), this.stateMachine = new
|
|
3082
|
+
}), this.stateMachine = new an(this.events), this.configurationManager = new Xt({
|
|
2979
3083
|
getUa: this.getUa
|
|
2980
|
-
}), this.sipOperations = new
|
|
3084
|
+
}), this.sipOperations = new cn({
|
|
2981
3085
|
uaFactory: this.uaFactory,
|
|
2982
3086
|
getUaProtected: this.getUaProtected
|
|
2983
|
-
}), this.connectionFlow = new
|
|
3087
|
+
}), this.connectionFlow = new tn({
|
|
2984
3088
|
JsSIP: this.JsSIP,
|
|
2985
3089
|
events: this.events,
|
|
2986
3090
|
uaFactory: this.uaFactory,
|
|
@@ -3030,7 +3134,7 @@ class nn {
|
|
|
3030
3134
|
return this.stateMachine.state;
|
|
3031
3135
|
}
|
|
3032
3136
|
get isRegistered() {
|
|
3033
|
-
return
|
|
3137
|
+
return F.isRegisteredUA(this.ua);
|
|
3034
3138
|
}
|
|
3035
3139
|
get isRegisterConfig() {
|
|
3036
3140
|
return this.configurationManager.isRegister();
|
|
@@ -3085,7 +3189,7 @@ class nn {
|
|
|
3085
3189
|
getUa = () => this.ua;
|
|
3086
3190
|
connectWithProcessError = async (e, t) => {
|
|
3087
3191
|
if (!(t?.hasReadyForConnection?.() ?? !0))
|
|
3088
|
-
throw
|
|
3192
|
+
throw ln();
|
|
3089
3193
|
return this.processConnect(e, t).catch(async (i) => {
|
|
3090
3194
|
const r = i;
|
|
3091
3195
|
return this.disconnect().then(() => {
|
|
@@ -3095,7 +3199,7 @@ class nn {
|
|
|
3095
3199
|
});
|
|
3096
3200
|
});
|
|
3097
3201
|
};
|
|
3098
|
-
processConnect = async (e, t) => (this.events.trigger(C.CONNECT_STARTED, {}),
|
|
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) => {
|
|
3099
3203
|
throw this.events.trigger(C.CONNECT_PARAMETERS_RESOLVE_FAILED, s), s;
|
|
3100
3204
|
}).then(async (s) => this.connectionFlow.connect(s, t)).then((s) => (this.events.trigger(C.CONNECT_SUCCEEDED, {
|
|
3101
3205
|
...s
|
|
@@ -3104,9 +3208,9 @@ class nn {
|
|
|
3104
3208
|
throw this.events.trigger(C.CONNECT_FAILED, i), i;
|
|
3105
3209
|
}));
|
|
3106
3210
|
}
|
|
3107
|
-
class
|
|
3211
|
+
class Tn {
|
|
3108
3212
|
connectionManager;
|
|
3109
|
-
stackPromises =
|
|
3213
|
+
stackPromises = Ee({
|
|
3110
3214
|
noRunIsNotActual: !0
|
|
3111
3215
|
});
|
|
3112
3216
|
constructor({ connectionManager: e }) {
|
|
@@ -3118,11 +3222,11 @@ class sn {
|
|
|
3118
3222
|
this.stackPromises.stop();
|
|
3119
3223
|
}
|
|
3120
3224
|
}
|
|
3121
|
-
const
|
|
3122
|
-
class
|
|
3123
|
-
countInner =
|
|
3124
|
-
initialCount =
|
|
3125
|
-
limitInner =
|
|
3225
|
+
const ae = 0, En = 30;
|
|
3226
|
+
class Sn {
|
|
3227
|
+
countInner = ae;
|
|
3228
|
+
initialCount = ae;
|
|
3229
|
+
limitInner = En;
|
|
3126
3230
|
isInProgress = !1;
|
|
3127
3231
|
onStatusChange;
|
|
3128
3232
|
constructor({
|
|
@@ -3155,7 +3259,7 @@ class an {
|
|
|
3155
3259
|
this.countInner = this.initialCount, this.finishAttempt();
|
|
3156
3260
|
}
|
|
3157
3261
|
}
|
|
3158
|
-
class
|
|
3262
|
+
class Cn {
|
|
3159
3263
|
connectionManager;
|
|
3160
3264
|
interval;
|
|
3161
3265
|
checkTelephonyByTimeout = void 0;
|
|
@@ -3171,7 +3275,7 @@ class on {
|
|
|
3171
3275
|
onSuccessRequest: t,
|
|
3172
3276
|
onFailRequest: s
|
|
3173
3277
|
}) {
|
|
3174
|
-
this.stop(), this.cancelableBeforeRequest = new
|
|
3278
|
+
this.stop(), this.cancelableBeforeRequest = new Y(e), this.checkTelephonyByTimeout = Ye({
|
|
3175
3279
|
isDontStopOnFail: !0,
|
|
3176
3280
|
requestInterval: this.interval,
|
|
3177
3281
|
request: async () => {
|
|
@@ -3191,8 +3295,8 @@ class on {
|
|
|
3191
3295
|
this.checkTelephonyByTimeout?.stop(), this.checkTelephonyByTimeout = void 0, this.cancelableBeforeRequest?.cancelRequest(), this.cancelableBeforeRequest = void 0;
|
|
3192
3296
|
}
|
|
3193
3297
|
}
|
|
3194
|
-
var
|
|
3195
|
-
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 = [
|
|
3196
3300
|
"before-attempt",
|
|
3197
3301
|
"success",
|
|
3198
3302
|
"failed-all-attempts",
|
|
@@ -3200,8 +3304,8 @@ const Me = [
|
|
|
3200
3304
|
"changed-attempt-status",
|
|
3201
3305
|
"stop-attempts-by-error",
|
|
3202
3306
|
"limit-reached-attempts"
|
|
3203
|
-
],
|
|
3204
|
-
class
|
|
3307
|
+
], pn = () => new R(ye);
|
|
3308
|
+
class te {
|
|
3205
3309
|
callManager;
|
|
3206
3310
|
disposers = [];
|
|
3207
3311
|
constructor({ callManager: e }) {
|
|
@@ -3226,15 +3330,15 @@ class K {
|
|
|
3226
3330
|
this.callManager.isCallActive ? e?.() : t();
|
|
3227
3331
|
}
|
|
3228
3332
|
}
|
|
3229
|
-
const
|
|
3230
|
-
class
|
|
3333
|
+
const mn = 15e3, Nn = 2;
|
|
3334
|
+
class An {
|
|
3231
3335
|
connectionManager;
|
|
3232
3336
|
pingServerByTimeoutWithFailCalls;
|
|
3233
3337
|
constructor({ connectionManager: e }) {
|
|
3234
|
-
this.connectionManager = e, this.pingServerByTimeoutWithFailCalls =
|
|
3338
|
+
this.connectionManager = e, this.pingServerByTimeoutWithFailCalls = Xe(Nn, {
|
|
3235
3339
|
whenPossibleRequest: async () => {
|
|
3236
3340
|
},
|
|
3237
|
-
requestInterval:
|
|
3341
|
+
requestInterval: mn,
|
|
3238
3342
|
request: async () => (d("ping"), this.connectionManager.ping().then(() => {
|
|
3239
3343
|
d("ping success");
|
|
3240
3344
|
}))
|
|
@@ -3247,16 +3351,16 @@ class ln {
|
|
|
3247
3351
|
this.pingServerByTimeoutWithFailCalls.stop();
|
|
3248
3352
|
}
|
|
3249
3353
|
}
|
|
3250
|
-
class
|
|
3354
|
+
class Rn {
|
|
3251
3355
|
pingServerRequester;
|
|
3252
3356
|
notActiveCallSubscriber;
|
|
3253
3357
|
constructor({
|
|
3254
3358
|
connectionManager: e,
|
|
3255
3359
|
callManager: t
|
|
3256
3360
|
}) {
|
|
3257
|
-
this.pingServerRequester = new
|
|
3361
|
+
this.pingServerRequester = new An({
|
|
3258
3362
|
connectionManager: e
|
|
3259
|
-
}), this.notActiveCallSubscriber = new
|
|
3363
|
+
}), this.notActiveCallSubscriber = new te({ callManager: t });
|
|
3260
3364
|
}
|
|
3261
3365
|
start({ onFailRequest: e }) {
|
|
3262
3366
|
d("start"), this.notActiveCallSubscriber.subscribe({
|
|
@@ -3275,7 +3379,7 @@ class gn {
|
|
|
3275
3379
|
this.notActiveCallSubscriber.unsubscribe();
|
|
3276
3380
|
}
|
|
3277
3381
|
}
|
|
3278
|
-
class
|
|
3382
|
+
class In {
|
|
3279
3383
|
connectionManager;
|
|
3280
3384
|
isRegistrationFailed = !1;
|
|
3281
3385
|
disposers = [];
|
|
@@ -3284,7 +3388,7 @@ class un {
|
|
|
3284
3388
|
connectionManager: e,
|
|
3285
3389
|
callManager: t
|
|
3286
3390
|
}) {
|
|
3287
|
-
this.connectionManager = e, this.notActiveCallSubscriber = new
|
|
3391
|
+
this.connectionManager = e, this.notActiveCallSubscriber = new te({ callManager: t });
|
|
3288
3392
|
}
|
|
3289
3393
|
subscribe(e) {
|
|
3290
3394
|
this.unsubscribe(), this.disposers.push(
|
|
@@ -3311,12 +3415,12 @@ class un {
|
|
|
3311
3415
|
this.isRegistrationFailed = !1;
|
|
3312
3416
|
}
|
|
3313
3417
|
}
|
|
3314
|
-
const
|
|
3418
|
+
const vn = 3e3, fn = 15e3, oe = {
|
|
3315
3419
|
LIMIT_REACHED: "Limit reached",
|
|
3316
3420
|
FAILED_TO_RECONNECT: "Failed to reconnect"
|
|
3317
|
-
},
|
|
3318
|
-
},
|
|
3319
|
-
class
|
|
3421
|
+
}, Mn = async () => {
|
|
3422
|
+
}, _n = (n) => !0;
|
|
3423
|
+
class bn {
|
|
3320
3424
|
events;
|
|
3321
3425
|
connectionManager;
|
|
3322
3426
|
connectionQueueManager;
|
|
@@ -3336,21 +3440,21 @@ class pn {
|
|
|
3336
3440
|
connectionManager: t,
|
|
3337
3441
|
callManager: s
|
|
3338
3442
|
}, i) {
|
|
3339
|
-
const r = i?.onBeforeRetry ??
|
|
3340
|
-
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({
|
|
3341
3445
|
connectionManager: t,
|
|
3342
|
-
interval: i?.checkTelephonyRequestInterval ??
|
|
3343
|
-
}), this.pingServerIfNotActiveCallRequester = new
|
|
3446
|
+
interval: i?.checkTelephonyRequestInterval ?? fn
|
|
3447
|
+
}), this.pingServerIfNotActiveCallRequester = new Rn({
|
|
3344
3448
|
connectionManager: t,
|
|
3345
3449
|
callManager: s
|
|
3346
|
-
}), this.registrationFailedOutOfCallSubscriber = new
|
|
3450
|
+
}), this.registrationFailedOutOfCallSubscriber = new In({
|
|
3347
3451
|
connectionManager: t,
|
|
3348
3452
|
callManager: s
|
|
3349
|
-
}), this.attemptsState = new
|
|
3453
|
+
}), this.attemptsState = new Sn({
|
|
3350
3454
|
onStatusChange: this.emitStatusChange
|
|
3351
|
-
}), this.cancelableRequestBeforeRetry = new
|
|
3352
|
-
i?.timeoutBetweenAttempts ??
|
|
3353
|
-
), this.notActiveCallSubscriber = new
|
|
3455
|
+
}), this.cancelableRequestBeforeRetry = new Y(r), this.delayBetweenAttempts = new Je(
|
|
3456
|
+
i?.timeoutBetweenAttempts ?? vn
|
|
3457
|
+
), this.notActiveCallSubscriber = new te({ callManager: s });
|
|
3354
3458
|
}
|
|
3355
3459
|
start(e) {
|
|
3356
3460
|
d("auto connector start"), this.restartConnectionAttempts(e), this.subscribeToNotActiveCall(e);
|
|
@@ -3401,7 +3505,7 @@ class pn {
|
|
|
3401
3505
|
});
|
|
3402
3506
|
}
|
|
3403
3507
|
async attemptConnection(e) {
|
|
3404
|
-
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()) {
|
|
3405
3509
|
d("attemptConnection: limit reached"), this.handleLimitReached(e);
|
|
3406
3510
|
return;
|
|
3407
3511
|
}
|
|
@@ -3415,25 +3519,25 @@ class pn {
|
|
|
3415
3519
|
}
|
|
3416
3520
|
}
|
|
3417
3521
|
handleConnectionError(e, t) {
|
|
3418
|
-
if (
|
|
3419
|
-
this.attemptsState.finishAttempt(), this.events.trigger(
|
|
3522
|
+
if (hn(e)) {
|
|
3523
|
+
this.attemptsState.finishAttempt(), this.events.trigger(v.STOP_ATTEMPTS_BY_ERROR, e);
|
|
3420
3524
|
return;
|
|
3421
3525
|
}
|
|
3422
3526
|
if (!this.canRetryOnError(e)) {
|
|
3423
|
-
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);
|
|
3424
3528
|
return;
|
|
3425
3529
|
}
|
|
3426
|
-
if (
|
|
3427
|
-
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);
|
|
3428
3532
|
return;
|
|
3429
3533
|
}
|
|
3430
3534
|
d("executeConnectionAttempt: error", e), this.scheduleReconnect(t);
|
|
3431
3535
|
}
|
|
3432
3536
|
handleLimitReached(e) {
|
|
3433
|
-
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);
|
|
3434
3538
|
}
|
|
3435
3539
|
handleSucceededAttempt(e) {
|
|
3436
|
-
d("handleSucceededAttempt"), this.subscribeToConnectTriggers(e), this.events.trigger(
|
|
3540
|
+
d("handleSucceededAttempt"), this.subscribeToConnectTriggers(e), this.events.trigger(v.SUCCESS);
|
|
3437
3541
|
}
|
|
3438
3542
|
subscribeToConnectTriggers(e) {
|
|
3439
3543
|
this.startPingRequester(e), this.registrationFailedOutOfCallSubscriber.subscribe(() => {
|
|
@@ -3487,12 +3591,12 @@ class pn {
|
|
|
3487
3591
|
}
|
|
3488
3592
|
connectIfDisconnected(e) {
|
|
3489
3593
|
const t = this.isConnectionUnavailable();
|
|
3490
|
-
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));
|
|
3491
3595
|
}
|
|
3492
3596
|
scheduleReconnect(e) {
|
|
3493
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) => {
|
|
3494
|
-
const s = t instanceof Error ? t : new Error(
|
|
3495
|
-
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);
|
|
3496
3600
|
});
|
|
3497
3601
|
}
|
|
3498
3602
|
isConnectionUnavailable() {
|
|
@@ -3500,30 +3604,30 @@ class pn {
|
|
|
3500
3604
|
return e || t || s;
|
|
3501
3605
|
}
|
|
3502
3606
|
emitStatusChange = ({ isInProgress: e }) => {
|
|
3503
|
-
this.events.trigger(
|
|
3607
|
+
this.events.trigger(v.CHANGED_ATTEMPT_STATUS, { isInProgress: e });
|
|
3504
3608
|
};
|
|
3505
3609
|
}
|
|
3506
|
-
var
|
|
3507
|
-
const
|
|
3508
|
-
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 {
|
|
3509
3613
|
events;
|
|
3510
3614
|
state = {};
|
|
3511
3615
|
constructor() {
|
|
3512
|
-
this.events =
|
|
3616
|
+
this.events = On();
|
|
3513
3617
|
}
|
|
3514
3618
|
getState() {
|
|
3515
3619
|
return { ...this.state };
|
|
3516
3620
|
}
|
|
3517
3621
|
updateState(e) {
|
|
3518
3622
|
const t = { ...this.state };
|
|
3519
|
-
this.state = { ...this.state, ...e }, this.events.trigger(
|
|
3623
|
+
this.state = { ...this.state, ...e }, this.events.trigger(j.STATE_CHANGED, {
|
|
3520
3624
|
previous: t,
|
|
3521
3625
|
current: this.state,
|
|
3522
3626
|
updates: e
|
|
3523
3627
|
});
|
|
3524
3628
|
}
|
|
3525
3629
|
reset() {
|
|
3526
|
-
this.state = {}, this.events.trigger(
|
|
3630
|
+
this.state = {}, this.events.trigger(j.STATE_RESET, {});
|
|
3527
3631
|
}
|
|
3528
3632
|
getToken() {
|
|
3529
3633
|
return this.state.token;
|
|
@@ -3559,15 +3663,142 @@ class Nn {
|
|
|
3559
3663
|
this.events.off(e, t);
|
|
3560
3664
|
}
|
|
3561
3665
|
}
|
|
3562
|
-
|
|
3563
|
-
|
|
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 = [
|
|
3564
3795
|
"ringing",
|
|
3565
3796
|
"declinedIncomingCall",
|
|
3566
3797
|
"terminatedIncomingCall",
|
|
3567
3798
|
"failedIncomingCall"
|
|
3568
|
-
],
|
|
3569
|
-
var
|
|
3570
|
-
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({
|
|
3571
3802
|
types: {
|
|
3572
3803
|
context: {},
|
|
3573
3804
|
events: {}
|
|
@@ -3579,11 +3810,11 @@ const In = $({
|
|
|
3579
3810
|
logStateChange: (n, e) => {
|
|
3580
3811
|
d("IncomingCallStateMachine state changed", e.state);
|
|
3581
3812
|
},
|
|
3582
|
-
rememberIncoming:
|
|
3813
|
+
rememberIncoming: M(({ event: n }) => {
|
|
3583
3814
|
const { data: e } = n;
|
|
3584
3815
|
return { remoteCallerData: e, lastReason: void 0 };
|
|
3585
3816
|
}),
|
|
3586
|
-
rememberReason:
|
|
3817
|
+
rememberReason: M(({ event: n, context: e }) => n.type === "INCOMING.CONSUMED" ? {
|
|
3587
3818
|
remoteCallerData: e.remoteCallerData,
|
|
3588
3819
|
lastReason: "incoming:consumed"
|
|
3589
3820
|
/* CONSUMED */
|
|
@@ -3600,7 +3831,7 @@ const In = $({
|
|
|
3600
3831
|
lastReason: "incoming:failed"
|
|
3601
3832
|
/* FAILED */
|
|
3602
3833
|
}),
|
|
3603
|
-
clearIncoming:
|
|
3834
|
+
clearIncoming: M(() => ({ remoteCallerData: void 0, lastReason: void 0 }))
|
|
3604
3835
|
}
|
|
3605
3836
|
}).createMachine({
|
|
3606
3837
|
id: "incoming",
|
|
@@ -3899,9 +4130,9 @@ const In = $({
|
|
|
3899
4130
|
}
|
|
3900
4131
|
}
|
|
3901
4132
|
});
|
|
3902
|
-
class
|
|
4133
|
+
class $n extends V {
|
|
3903
4134
|
constructor({ incomingEvents: e, connectionEvents: t }) {
|
|
3904
|
-
super(
|
|
4135
|
+
super(kn), this.subscribeIncomingEvents(e), this.subscribeConnectionEvents(t);
|
|
3905
4136
|
}
|
|
3906
4137
|
get isIdle() {
|
|
3907
4138
|
return this.state === "incoming:idle";
|
|
@@ -3986,14 +4217,14 @@ class fn extends q {
|
|
|
3986
4217
|
this.send({ type: "INCOMING.CLEAR" });
|
|
3987
4218
|
}
|
|
3988
4219
|
}
|
|
3989
|
-
const
|
|
3990
|
-
class
|
|
4220
|
+
const Gn = 486, Vn = 487;
|
|
4221
|
+
class qn {
|
|
3991
4222
|
events;
|
|
3992
4223
|
incomingStateMachine;
|
|
3993
4224
|
incomingRTCSession;
|
|
3994
4225
|
connectionManager;
|
|
3995
4226
|
constructor(e) {
|
|
3996
|
-
this.connectionManager = e, this.events =
|
|
4227
|
+
this.connectionManager = e, this.events = Fn(), this.incomingStateMachine = new $n({
|
|
3997
4228
|
incomingEvents: this.events,
|
|
3998
4229
|
connectionEvents: this.connectionManager.events
|
|
3999
4230
|
}), this.start();
|
|
@@ -4029,19 +4260,19 @@ class _n {
|
|
|
4029
4260
|
return this.incomingStateMachine.toConsumed(), this.removeIncomingSession(), e;
|
|
4030
4261
|
};
|
|
4031
4262
|
async declineToIncomingCall({
|
|
4032
|
-
statusCode: e =
|
|
4263
|
+
statusCode: e = Vn
|
|
4033
4264
|
} = {}) {
|
|
4034
4265
|
return new Promise((t, s) => {
|
|
4035
4266
|
try {
|
|
4036
4267
|
const i = this.getIncomingRTCSession(), r = this.remoteCallerData;
|
|
4037
|
-
this.removeIncomingSession(), this.events.trigger(
|
|
4268
|
+
this.removeIncomingSession(), this.events.trigger(k.DECLINED_INCOMING_CALL, r), i.terminate({ status_code: e }), t();
|
|
4038
4269
|
} catch (i) {
|
|
4039
4270
|
s(i);
|
|
4040
4271
|
}
|
|
4041
4272
|
});
|
|
4042
4273
|
}
|
|
4043
4274
|
async busyIncomingCall() {
|
|
4044
|
-
return this.declineToIncomingCall({ statusCode:
|
|
4275
|
+
return this.declineToIncomingCall({ statusCode: Gn });
|
|
4045
4276
|
}
|
|
4046
4277
|
on(e, t) {
|
|
4047
4278
|
return this.events.on(e, t);
|
|
@@ -4074,33 +4305,33 @@ class _n {
|
|
|
4074
4305
|
this.incomingRTCSession = e;
|
|
4075
4306
|
const t = this.remoteCallerData;
|
|
4076
4307
|
e.on("failed", (s) => {
|
|
4077
|
-
this.removeIncomingSession(), s.originator === "local" ? this.events.trigger(
|
|
4078
|
-
}), 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);
|
|
4079
4310
|
}
|
|
4080
4311
|
removeIncomingSession() {
|
|
4081
4312
|
delete this.incomingRTCSession;
|
|
4082
4313
|
}
|
|
4083
4314
|
}
|
|
4084
|
-
var
|
|
4085
|
-
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) => ({
|
|
4086
4317
|
connection: n.connection.getSnapshot(),
|
|
4087
4318
|
call: n.call.getSnapshot(),
|
|
4088
4319
|
incoming: n.incoming.getSnapshot(),
|
|
4089
4320
|
presentation: n.presentation.getSnapshot()
|
|
4090
4321
|
});
|
|
4091
|
-
class
|
|
4322
|
+
class xn {
|
|
4092
4323
|
events;
|
|
4093
4324
|
actors;
|
|
4094
4325
|
currentSnapshot;
|
|
4095
4326
|
subscribers = /* @__PURE__ */ new Set();
|
|
4096
4327
|
actorSubscriptions = [];
|
|
4097
4328
|
constructor(e) {
|
|
4098
|
-
this.events =
|
|
4329
|
+
this.events = Hn(), this.actors = {
|
|
4099
4330
|
connection: e.connectionManager.connectionActor,
|
|
4100
4331
|
call: e.callManager.callActor,
|
|
4101
4332
|
incoming: e.incomingCallManager.incomingActor,
|
|
4102
4333
|
presentation: e.presentationManager.presentationActor
|
|
4103
|
-
}, this.currentSnapshot =
|
|
4334
|
+
}, this.currentSnapshot = ce(this.actors), this.actorSubscriptions.push(
|
|
4104
4335
|
this.actors.connection.subscribe(this.notifySubscribers),
|
|
4105
4336
|
this.actors.call.subscribe(this.notifySubscribers),
|
|
4106
4337
|
this.actors.incoming.subscribe(this.notifySubscribers),
|
|
@@ -4111,14 +4342,14 @@ class bn {
|
|
|
4111
4342
|
return this.currentSnapshot;
|
|
4112
4343
|
}
|
|
4113
4344
|
subscribe(e, t, s) {
|
|
4114
|
-
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 = {
|
|
4115
4346
|
selector: r,
|
|
4116
4347
|
listener: a,
|
|
4117
4348
|
equals: o,
|
|
4118
4349
|
current: c
|
|
4119
4350
|
};
|
|
4120
|
-
return this.subscribers.add(
|
|
4121
|
-
this.subscribers.delete(
|
|
4351
|
+
return this.subscribers.add(l), () => {
|
|
4352
|
+
this.subscribers.delete(l);
|
|
4122
4353
|
};
|
|
4123
4354
|
}
|
|
4124
4355
|
stop() {
|
|
@@ -4134,20 +4365,20 @@ class bn {
|
|
|
4134
4365
|
}
|
|
4135
4366
|
notifySubscribers = () => {
|
|
4136
4367
|
const e = this.currentSnapshot;
|
|
4137
|
-
this.currentSnapshot =
|
|
4368
|
+
this.currentSnapshot = ce(this.actors);
|
|
4138
4369
|
for (const t of this.subscribers) {
|
|
4139
4370
|
const s = t.selector(this.currentSnapshot);
|
|
4140
4371
|
t.equals(t.current, s) || (t.current = s, t.listener(s));
|
|
4141
4372
|
}
|
|
4142
|
-
this.events.trigger(
|
|
4373
|
+
this.events.trigger(Ue.SNAPSHOT_CHANGED, {
|
|
4143
4374
|
previous: e,
|
|
4144
4375
|
current: this.currentSnapshot
|
|
4145
4376
|
});
|
|
4146
4377
|
};
|
|
4147
4378
|
}
|
|
4148
|
-
const
|
|
4379
|
+
const B = 1e3;
|
|
4149
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 || {});
|
|
4150
|
-
const
|
|
4381
|
+
const Be = ["collected"], Qn = () => new R(Be), Yn = "api/v2/rtp2webrtc/offer", Xn = async ({
|
|
4151
4382
|
serverUrl: n,
|
|
4152
4383
|
conferenceNumber: e,
|
|
4153
4384
|
quality: t,
|
|
@@ -4156,7 +4387,7 @@ const De = ["collected"], Dn = () => new A(De), yn = "api/v2/rtp2webrtc/offer",
|
|
|
4156
4387
|
token: r
|
|
4157
4388
|
}) => {
|
|
4158
4389
|
const a = new URL(
|
|
4159
|
-
`https://${n.replace(/\/$/, "")}/${
|
|
4390
|
+
`https://${n.replace(/\/$/, "")}/${Yn}/${encodeURIComponent(e)}`
|
|
4160
4391
|
);
|
|
4161
4392
|
a.searchParams.set("quality", t), a.searchParams.set("audio", String(s));
|
|
4162
4393
|
const o = {
|
|
@@ -4171,18 +4402,18 @@ const De = ["collected"], Dn = () => new A(De), yn = "api/v2/rtp2webrtc/offer",
|
|
|
4171
4402
|
});
|
|
4172
4403
|
if (!c.ok)
|
|
4173
4404
|
throw new Error(`sendOffer failed with status ${c.status}`);
|
|
4174
|
-
const
|
|
4405
|
+
const l = await c.json();
|
|
4175
4406
|
return {
|
|
4176
|
-
type:
|
|
4177
|
-
sdp:
|
|
4407
|
+
type: l.type,
|
|
4408
|
+
sdp: l.sdp,
|
|
4178
4409
|
toJSON() {
|
|
4179
|
-
return
|
|
4410
|
+
return l;
|
|
4180
4411
|
}
|
|
4181
4412
|
};
|
|
4182
|
-
},
|
|
4413
|
+
}, de = () => "performance" in window ? performance.now() : Date.now(), q = (n) => [...n.keys()].reduce((e, t) => {
|
|
4183
4414
|
const s = n.get(t);
|
|
4184
4415
|
return s === void 0 ? e : { ...e, [s.type]: s };
|
|
4185
|
-
}, {}),
|
|
4416
|
+
}, {}), Jn = (n) => {
|
|
4186
4417
|
if (!n)
|
|
4187
4418
|
return {
|
|
4188
4419
|
outboundRtp: void 0,
|
|
@@ -4190,14 +4421,14 @@ const De = ["collected"], Dn = () => new A(De), yn = "api/v2/rtp2webrtc/offer",
|
|
|
4190
4421
|
mediaSource: void 0,
|
|
4191
4422
|
remoteInboundRtp: void 0
|
|
4192
4423
|
};
|
|
4193
|
-
const e =
|
|
4424
|
+
const e = q(n);
|
|
4194
4425
|
return {
|
|
4195
4426
|
outboundRtp: e[p.OUTBOUND_RTP],
|
|
4196
4427
|
codec: e[p.CODEC],
|
|
4197
4428
|
mediaSource: e[p.MEDIA_SOURCE],
|
|
4198
4429
|
remoteInboundRtp: e[p.REMOTE_INBOUND_RTP]
|
|
4199
4430
|
};
|
|
4200
|
-
},
|
|
4431
|
+
}, he = (n) => {
|
|
4201
4432
|
if (!n)
|
|
4202
4433
|
return {
|
|
4203
4434
|
outboundRtp: void 0,
|
|
@@ -4205,14 +4436,14 @@ const De = ["collected"], Dn = () => new A(De), yn = "api/v2/rtp2webrtc/offer",
|
|
|
4205
4436
|
mediaSource: void 0,
|
|
4206
4437
|
remoteInboundRtp: void 0
|
|
4207
4438
|
};
|
|
4208
|
-
const e =
|
|
4439
|
+
const e = q(n);
|
|
4209
4440
|
return {
|
|
4210
4441
|
outboundRtp: e[p.OUTBOUND_RTP],
|
|
4211
4442
|
codec: e[p.CODEC],
|
|
4212
4443
|
mediaSource: e[p.MEDIA_SOURCE],
|
|
4213
4444
|
remoteInboundRtp: e[p.REMOTE_INBOUND_RTP]
|
|
4214
4445
|
};
|
|
4215
|
-
},
|
|
4446
|
+
}, le = ({
|
|
4216
4447
|
videoReceiversStats: n,
|
|
4217
4448
|
synchronizationSourcesVideo: e
|
|
4218
4449
|
}) => {
|
|
@@ -4222,13 +4453,13 @@ const De = ["collected"], Dn = () => new A(De), yn = "api/v2/rtp2webrtc/offer",
|
|
|
4222
4453
|
codec: void 0,
|
|
4223
4454
|
synchronizationSources: e
|
|
4224
4455
|
};
|
|
4225
|
-
const t =
|
|
4456
|
+
const t = q(n);
|
|
4226
4457
|
return {
|
|
4227
4458
|
inboundRtp: t[p.INBOUND_RTP],
|
|
4228
4459
|
codec: t[p.CODEC],
|
|
4229
4460
|
synchronizationSources: e
|
|
4230
4461
|
};
|
|
4231
|
-
},
|
|
4462
|
+
}, zn = ({
|
|
4232
4463
|
audioReceiverStats: n,
|
|
4233
4464
|
synchronizationSourcesAudio: e
|
|
4234
4465
|
}) => {
|
|
@@ -4239,14 +4470,14 @@ const De = ["collected"], Dn = () => new A(De), yn = "api/v2/rtp2webrtc/offer",
|
|
|
4239
4470
|
remoteOutboundRtp: void 0,
|
|
4240
4471
|
synchronizationSources: e
|
|
4241
4472
|
};
|
|
4242
|
-
const t =
|
|
4473
|
+
const t = q(n);
|
|
4243
4474
|
return {
|
|
4244
4475
|
inboundRtp: t[p.INBOUND_RTP],
|
|
4245
4476
|
codec: t[p.CODEC],
|
|
4246
4477
|
remoteOutboundRtp: t[p.REMOTE_OUTBOUND_RTP],
|
|
4247
4478
|
synchronizationSources: e
|
|
4248
4479
|
};
|
|
4249
|
-
},
|
|
4480
|
+
}, ke = (n) => {
|
|
4250
4481
|
if (!n)
|
|
4251
4482
|
return {
|
|
4252
4483
|
candidatePair: void 0,
|
|
@@ -4255,7 +4486,7 @@ const De = ["collected"], Dn = () => new A(De), yn = "api/v2/rtp2webrtc/offer",
|
|
|
4255
4486
|
remoteCandidate: void 0,
|
|
4256
4487
|
transport: void 0
|
|
4257
4488
|
};
|
|
4258
|
-
const e =
|
|
4489
|
+
const e = q(n);
|
|
4259
4490
|
return {
|
|
4260
4491
|
candidatePair: e[p.CANDIDATE_PAIR],
|
|
4261
4492
|
certificate: e[p.CERTIFICATE],
|
|
@@ -4263,39 +4494,39 @@ const De = ["collected"], Dn = () => new A(De), yn = "api/v2/rtp2webrtc/offer",
|
|
|
4263
4494
|
remoteCandidate: e[p.REMOTE_CANDIDATE],
|
|
4264
4495
|
transport: e[p.TRANSPORT]
|
|
4265
4496
|
};
|
|
4266
|
-
},
|
|
4497
|
+
}, jn = ({
|
|
4267
4498
|
audioSenderStats: n,
|
|
4268
4499
|
videoSenderFirstStats: e,
|
|
4269
4500
|
videoSenderSecondStats: t
|
|
4270
4501
|
}) => ({
|
|
4271
|
-
video:
|
|
4272
|
-
secondVideo:
|
|
4273
|
-
audio:
|
|
4274
|
-
additional:
|
|
4502
|
+
video: he(e),
|
|
4503
|
+
secondVideo: he(t),
|
|
4504
|
+
audio: Jn(n),
|
|
4505
|
+
additional: ke(
|
|
4275
4506
|
n ?? e ?? t
|
|
4276
4507
|
)
|
|
4277
|
-
}),
|
|
4508
|
+
}), Kn = ({
|
|
4278
4509
|
audioReceiverStats: n,
|
|
4279
4510
|
videoReceiverFirstStats: e,
|
|
4280
4511
|
videoReceiverSecondStats: t,
|
|
4281
4512
|
synchronizationSources: s
|
|
4282
4513
|
}) => ({
|
|
4283
|
-
video:
|
|
4514
|
+
video: le({
|
|
4284
4515
|
videoReceiversStats: e,
|
|
4285
4516
|
synchronizationSourcesVideo: s.video
|
|
4286
4517
|
}),
|
|
4287
|
-
secondVideo:
|
|
4518
|
+
secondVideo: le({
|
|
4288
4519
|
videoReceiversStats: t,
|
|
4289
4520
|
synchronizationSourcesVideo: s.video
|
|
4290
4521
|
}),
|
|
4291
|
-
audio:
|
|
4522
|
+
audio: zn({
|
|
4292
4523
|
audioReceiverStats: n,
|
|
4293
4524
|
synchronizationSourcesAudio: s.audio
|
|
4294
4525
|
}),
|
|
4295
|
-
additional:
|
|
4526
|
+
additional: ke(
|
|
4296
4527
|
n ?? e ?? t
|
|
4297
4528
|
)
|
|
4298
|
-
}),
|
|
4529
|
+
}), Zn = ({
|
|
4299
4530
|
audioSenderStats: n,
|
|
4300
4531
|
videoSenderFirstStats: e,
|
|
4301
4532
|
videoSenderSecondStats: t,
|
|
@@ -4304,11 +4535,11 @@ const De = ["collected"], Dn = () => new A(De), yn = "api/v2/rtp2webrtc/offer",
|
|
|
4304
4535
|
videoReceiverSecondStats: r,
|
|
4305
4536
|
synchronizationSources: a
|
|
4306
4537
|
}) => {
|
|
4307
|
-
const o =
|
|
4538
|
+
const o = jn({
|
|
4308
4539
|
audioSenderStats: n,
|
|
4309
4540
|
videoSenderFirstStats: e,
|
|
4310
4541
|
videoSenderSecondStats: t
|
|
4311
|
-
}), c =
|
|
4542
|
+
}), c = Kn({
|
|
4312
4543
|
audioReceiverStats: s,
|
|
4313
4544
|
videoReceiverFirstStats: i,
|
|
4314
4545
|
videoReceiverSecondStats: r,
|
|
@@ -4318,16 +4549,16 @@ const De = ["collected"], Dn = () => new A(De), yn = "api/v2/rtp2webrtc/offer",
|
|
|
4318
4549
|
outbound: o,
|
|
4319
4550
|
inbound: c
|
|
4320
4551
|
};
|
|
4321
|
-
},
|
|
4322
|
-
const e = "audio", t = "video", s = n.getSenders(), i = s.find((
|
|
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 = {
|
|
4323
4554
|
trackIdentifier: o?.track.id,
|
|
4324
4555
|
item: o?.getSynchronizationSources()[0]
|
|
4325
|
-
},
|
|
4556
|
+
}, T = {
|
|
4326
4557
|
trackIdentifier: c[0]?.track.id,
|
|
4327
4558
|
item: c[0]?.getSynchronizationSources()[0]
|
|
4328
|
-
},
|
|
4329
|
-
audio:
|
|
4330
|
-
video:
|
|
4559
|
+
}, u = {
|
|
4560
|
+
audio: l,
|
|
4561
|
+
video: T
|
|
4331
4562
|
};
|
|
4332
4563
|
return Promise.all([
|
|
4333
4564
|
i?.getStats() ?? Promise.resolve(void 0),
|
|
@@ -4336,41 +4567,41 @@ const De = ["collected"], Dn = () => new A(De), yn = "api/v2/rtp2webrtc/offer",
|
|
|
4336
4567
|
o?.getStats() ?? Promise.resolve(void 0),
|
|
4337
4568
|
c[0]?.getStats() ?? Promise.resolve(void 0),
|
|
4338
4569
|
c[1]?.getStats() ?? Promise.resolve(void 0)
|
|
4339
|
-
]).then((
|
|
4570
|
+
]).then((E) => {
|
|
4340
4571
|
const [
|
|
4341
4572
|
m,
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
] =
|
|
4573
|
+
D,
|
|
4574
|
+
A,
|
|
4575
|
+
w,
|
|
4576
|
+
X,
|
|
4577
|
+
xe
|
|
4578
|
+
] = E;
|
|
4348
4579
|
return {
|
|
4349
|
-
synchronizationSources:
|
|
4580
|
+
synchronizationSources: u,
|
|
4350
4581
|
audioSenderStats: m,
|
|
4351
|
-
videoSenderFirstStats:
|
|
4352
|
-
videoSenderSecondStats:
|
|
4353
|
-
audioReceiverStats:
|
|
4354
|
-
videoReceiverFirstStats:
|
|
4355
|
-
videoReceiverSecondStats:
|
|
4582
|
+
videoSenderFirstStats: D,
|
|
4583
|
+
videoSenderSecondStats: A,
|
|
4584
|
+
audioReceiverStats: w,
|
|
4585
|
+
videoReceiverFirstStats: X,
|
|
4586
|
+
videoReceiverSecondStats: xe
|
|
4356
4587
|
};
|
|
4357
4588
|
});
|
|
4358
|
-
},
|
|
4589
|
+
}, ts = (n) => {
|
|
4359
4590
|
d(String(n));
|
|
4360
4591
|
};
|
|
4361
|
-
class
|
|
4592
|
+
class ns {
|
|
4362
4593
|
events;
|
|
4363
4594
|
setTimeoutRequest;
|
|
4364
|
-
requesterAllStatistics = new
|
|
4595
|
+
requesterAllStatistics = new Y(es);
|
|
4365
4596
|
constructor() {
|
|
4366
|
-
this.events =
|
|
4597
|
+
this.events = Qn(), this.setTimeoutRequest = new ue();
|
|
4367
4598
|
}
|
|
4368
4599
|
get requested() {
|
|
4369
4600
|
return this.setTimeoutRequest.requested;
|
|
4370
4601
|
}
|
|
4371
4602
|
start(e, {
|
|
4372
|
-
interval: t =
|
|
4373
|
-
onError: s =
|
|
4603
|
+
interval: t = B,
|
|
4604
|
+
onError: s = ts
|
|
4374
4605
|
} = {}) {
|
|
4375
4606
|
this.stop(), this.setTimeoutRequest.request(() => {
|
|
4376
4607
|
this.collectStatistics(e, {
|
|
@@ -4399,12 +4630,12 @@ class qn {
|
|
|
4399
4630
|
collectStatistics = (e, {
|
|
4400
4631
|
onError: t
|
|
4401
4632
|
}) => {
|
|
4402
|
-
const s =
|
|
4403
|
-
this.
|
|
4404
|
-
this.events.trigger("collected",
|
|
4405
|
-
const a =
|
|
4406
|
-
let o =
|
|
4407
|
-
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, {
|
|
4408
4639
|
onError: t,
|
|
4409
4640
|
interval: o
|
|
4410
4641
|
});
|
|
@@ -4412,9 +4643,15 @@ class qn {
|
|
|
4412
4643
|
t && t(i);
|
|
4413
4644
|
});
|
|
4414
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
|
+
};
|
|
4415
4652
|
}
|
|
4416
|
-
const
|
|
4417
|
-
class
|
|
4653
|
+
const ss = 500;
|
|
4654
|
+
class is {
|
|
4418
4655
|
statsPeerConnection;
|
|
4419
4656
|
availableStats;
|
|
4420
4657
|
previousAvailableStats;
|
|
@@ -4424,7 +4661,7 @@ class Vn {
|
|
|
4424
4661
|
callManager: e,
|
|
4425
4662
|
apiManager: t
|
|
4426
4663
|
}) {
|
|
4427
|
-
this.callManager = e, this.apiManager = t, this.statsPeerConnection = new
|
|
4664
|
+
this.callManager = e, this.apiManager = t, this.statsPeerConnection = new ns(), this.subscribe();
|
|
4428
4665
|
}
|
|
4429
4666
|
get events() {
|
|
4430
4667
|
return this.statsPeerConnection.events;
|
|
@@ -4474,7 +4711,7 @@ class Vn {
|
|
|
4474
4711
|
return this.previousInboundRtp?.packetsReceived;
|
|
4475
4712
|
}
|
|
4476
4713
|
get isReceivingPackets() {
|
|
4477
|
-
const e = this.packetsReceived !== void 0 && this.packetsReceived >=
|
|
4714
|
+
const e = this.packetsReceived !== void 0 && this.packetsReceived >= ss, t = this.packetsReceived !== this.previousPacketsReceived;
|
|
4478
4715
|
return e && t;
|
|
4479
4716
|
}
|
|
4480
4717
|
on(e, t) {
|
|
@@ -4502,8 +4739,8 @@ class Vn {
|
|
|
4502
4739
|
handleStatsCollected = (e) => {
|
|
4503
4740
|
this.previousAvailableStats = this.availableStats, this.availableStats = e, this.maybeSendStats();
|
|
4504
4741
|
};
|
|
4505
|
-
handleStarted = (
|
|
4506
|
-
this.statsPeerConnection.start(
|
|
4742
|
+
handleStarted = () => {
|
|
4743
|
+
this.statsPeerConnection.start(this.callManager.getActivePeerConnection);
|
|
4507
4744
|
};
|
|
4508
4745
|
handleEnded = () => {
|
|
4509
4746
|
this.statsPeerConnection.stop(), this.availableStats = void 0, this.previousAvailableStats = void 0;
|
|
@@ -4514,33 +4751,33 @@ class Vn {
|
|
|
4514
4751
|
});
|
|
4515
4752
|
}
|
|
4516
4753
|
}
|
|
4517
|
-
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) => {
|
|
4518
4755
|
const e = RTCRtpSender.getCapabilities(n), t = RTCRtpReceiver.getCapabilities(n), s = e === null ? [] : e.codecs, i = t === null ? [] : t.codecs;
|
|
4519
|
-
return
|
|
4520
|
-
},
|
|
4756
|
+
return rs(s, i);
|
|
4757
|
+
}, os = (n, e) => e === void 0 || e.length === 0 ? n : n.sort((t, s) => {
|
|
4521
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;
|
|
4522
4759
|
return a - o;
|
|
4523
|
-
}),
|
|
4760
|
+
}), cs = (n, e) => e === void 0 || e.length === 0 ? n : n.filter((t) => !e.includes(t.mimeType)), ds = (n, {
|
|
4524
4761
|
preferredMimeTypesVideoCodecs: e,
|
|
4525
4762
|
excludeMimeTypesVideoCodecs: t
|
|
4526
4763
|
}) => {
|
|
4527
4764
|
try {
|
|
4528
4765
|
if (typeof n.setCodecPreferences == "function" && n.sender.track?.kind === "video" && (e !== void 0 && e.length > 0 || t !== void 0 && t.length > 0)) {
|
|
4529
|
-
const s =
|
|
4766
|
+
const s = as("video"), i = cs(s, t), r = os(i, e);
|
|
4530
4767
|
n.setCodecPreferences(r);
|
|
4531
4768
|
}
|
|
4532
4769
|
} catch (s) {
|
|
4533
4770
|
d("setCodecPreferences error", s);
|
|
4534
4771
|
}
|
|
4535
|
-
},
|
|
4536
|
-
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 {
|
|
4537
4774
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
4538
4775
|
async getCodecFromSender(e) {
|
|
4539
|
-
return await
|
|
4776
|
+
return await gs(e) ?? "";
|
|
4540
4777
|
}
|
|
4541
4778
|
}
|
|
4542
|
-
class
|
|
4543
|
-
stackPromises =
|
|
4779
|
+
class Ts {
|
|
4780
|
+
stackPromises = Ee({
|
|
4544
4781
|
noRunIsNotActual: !0
|
|
4545
4782
|
});
|
|
4546
4783
|
/**
|
|
@@ -4564,30 +4801,30 @@ class Zn {
|
|
|
4564
4801
|
});
|
|
4565
4802
|
}
|
|
4566
4803
|
}
|
|
4567
|
-
class
|
|
4804
|
+
class Es {
|
|
4568
4805
|
taskQueue;
|
|
4569
4806
|
onSetParameters;
|
|
4570
4807
|
constructor(e) {
|
|
4571
|
-
this.onSetParameters = e, this.taskQueue = new
|
|
4808
|
+
this.onSetParameters = e, this.taskQueue = new Ts();
|
|
4572
4809
|
}
|
|
4573
4810
|
async setEncodingsToSender(e, t) {
|
|
4574
|
-
return this.taskQueue.add(async () =>
|
|
4811
|
+
return this.taskQueue.add(async () => fe(e, t, this.onSetParameters));
|
|
4575
4812
|
}
|
|
4576
4813
|
stop() {
|
|
4577
4814
|
this.taskQueue.stop();
|
|
4578
4815
|
}
|
|
4579
4816
|
}
|
|
4580
|
-
const
|
|
4581
|
-
const t =
|
|
4582
|
-
return
|
|
4583
|
-
},
|
|
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 = ({
|
|
4584
4821
|
videoTrack: n,
|
|
4585
4822
|
targetSize: e
|
|
4586
4823
|
}) => {
|
|
4587
|
-
const t = n.getSettings(), s = t.width, i = t.height, r = s === void 0 ?
|
|
4588
|
-
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);
|
|
4589
4826
|
};
|
|
4590
|
-
class
|
|
4827
|
+
class vs {
|
|
4591
4828
|
ignoreForCodec;
|
|
4592
4829
|
senderFinder;
|
|
4593
4830
|
codecProvider;
|
|
@@ -4620,7 +4857,7 @@ class ds {
|
|
|
4620
4857
|
if (!i?.track)
|
|
4621
4858
|
return { ...this.resultNoChanged, sender: i };
|
|
4622
4859
|
const r = await this.codecProvider.getCodecFromSender(i);
|
|
4623
|
-
if (
|
|
4860
|
+
if ($e(r, this.ignoreForCodec))
|
|
4624
4861
|
return { ...this.resultNoChanged, sender: i };
|
|
4625
4862
|
const { mainCam: a, resolutionMainCam: o } = t ?? {};
|
|
4626
4863
|
return this.processSender(
|
|
@@ -4640,14 +4877,14 @@ class ds {
|
|
|
4640
4877
|
async processSender(e, t) {
|
|
4641
4878
|
const { mainCam: s, resolutionMainCam: i } = e;
|
|
4642
4879
|
switch (s) {
|
|
4643
|
-
case
|
|
4880
|
+
case f.PAUSE_MAIN_CAM:
|
|
4644
4881
|
return this.downgradeResolutionSender(t);
|
|
4645
|
-
case
|
|
4882
|
+
case f.RESUME_MAIN_CAM:
|
|
4646
4883
|
return this.setBitrateByTrackResolution(t);
|
|
4647
|
-
case
|
|
4884
|
+
case f.MAX_MAIN_CAM_RESOLUTION:
|
|
4648
4885
|
return i !== void 0 ? this.setResolutionSender(i, t) : this.setBitrateByTrackResolution(t);
|
|
4649
|
-
case
|
|
4650
|
-
case
|
|
4886
|
+
case f.ADMIN_STOP_MAIN_CAM:
|
|
4887
|
+
case f.ADMIN_START_MAIN_CAM:
|
|
4651
4888
|
case void 0:
|
|
4652
4889
|
return this.setBitrateByTrackResolution(t);
|
|
4653
4890
|
default:
|
|
@@ -4662,7 +4899,7 @@ class ds {
|
|
|
4662
4899
|
async downgradeResolutionSender(e) {
|
|
4663
4900
|
const { sender: t, codec: s } = e, i = {
|
|
4664
4901
|
scaleResolutionDownBy: 200,
|
|
4665
|
-
maxBitrate:
|
|
4902
|
+
maxBitrate: As(s)
|
|
4666
4903
|
};
|
|
4667
4904
|
return this.parametersSetter.setEncodingsToSender(t, i);
|
|
4668
4905
|
}
|
|
@@ -4672,7 +4909,7 @@ class ds {
|
|
|
4672
4909
|
* @returns Promise с результатом
|
|
4673
4910
|
*/
|
|
4674
4911
|
async setBitrateByTrackResolution(e) {
|
|
4675
|
-
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);
|
|
4676
4913
|
return this.parametersSetter.setEncodingsToSender(t, {
|
|
4677
4914
|
scaleResolutionDownBy: 1,
|
|
4678
4915
|
maxBitrate: o
|
|
@@ -4688,24 +4925,24 @@ class ds {
|
|
|
4688
4925
|
const [s, i] = e.split("x"), { sender: r, videoTrack: a, codec: o } = t, c = {
|
|
4689
4926
|
width: Number(s),
|
|
4690
4927
|
height: Number(i)
|
|
4691
|
-
},
|
|
4928
|
+
}, l = Is({
|
|
4692
4929
|
videoTrack: a,
|
|
4693
4930
|
targetSize: c
|
|
4694
|
-
}),
|
|
4695
|
-
scaleResolutionDownBy:
|
|
4696
|
-
maxBitrate:
|
|
4931
|
+
}), T = ge(c.width, o), u = {
|
|
4932
|
+
scaleResolutionDownBy: l,
|
|
4933
|
+
maxBitrate: T
|
|
4697
4934
|
};
|
|
4698
|
-
return this.parametersSetter.setEncodingsToSender(r,
|
|
4935
|
+
return this.parametersSetter.setEncodingsToSender(r, u);
|
|
4699
4936
|
}
|
|
4700
4937
|
}
|
|
4701
|
-
const
|
|
4702
|
-
class
|
|
4938
|
+
const fs = (n) => n.find((e) => e.track?.kind === "video");
|
|
4939
|
+
class Ms {
|
|
4703
4940
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
4704
4941
|
findVideoSender(e) {
|
|
4705
|
-
return
|
|
4942
|
+
return fs(e);
|
|
4706
4943
|
}
|
|
4707
4944
|
}
|
|
4708
|
-
class
|
|
4945
|
+
class _s {
|
|
4709
4946
|
currentSender;
|
|
4710
4947
|
originalReplaceTrack;
|
|
4711
4948
|
lastWidth;
|
|
@@ -4718,7 +4955,7 @@ class gs {
|
|
|
4718
4955
|
pollIntervalMs: e = 1e3,
|
|
4719
4956
|
maxPollIntervalMs: t
|
|
4720
4957
|
}) {
|
|
4721
|
-
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();
|
|
4722
4959
|
}
|
|
4723
4960
|
/**
|
|
4724
4961
|
* Проверяет актуальный video-sender и (при необходимости) перенастраивает наблюдение.
|
|
@@ -4769,7 +5006,7 @@ class gs {
|
|
|
4769
5006
|
this.setTimeoutRequest.cancelRequest(), this.lastWidth = void 0, this.lastHeight = void 0;
|
|
4770
5007
|
}
|
|
4771
5008
|
}
|
|
4772
|
-
class
|
|
5009
|
+
class bs {
|
|
4773
5010
|
apiManager;
|
|
4774
5011
|
currentHandler;
|
|
4775
5012
|
constructor(e) {
|
|
@@ -4789,7 +5026,7 @@ class us {
|
|
|
4789
5026
|
this.currentHandler && (this.apiManager.off("main-cam-control", this.currentHandler), this.currentHandler = void 0);
|
|
4790
5027
|
}
|
|
4791
5028
|
}
|
|
4792
|
-
class
|
|
5029
|
+
class Os {
|
|
4793
5030
|
eventHandler;
|
|
4794
5031
|
senderBalancer;
|
|
4795
5032
|
parametersSetterWithQueue;
|
|
@@ -4801,16 +5038,16 @@ class Ts {
|
|
|
4801
5038
|
onSetParameters: i,
|
|
4802
5039
|
pollIntervalMs: r
|
|
4803
5040
|
} = {}) {
|
|
4804
|
-
this.getConnection = t, this.eventHandler = new
|
|
5041
|
+
this.getConnection = t, this.eventHandler = new bs(e), this.parametersSetterWithQueue = new Es(i), this.senderBalancer = new vs(
|
|
4805
5042
|
{
|
|
4806
|
-
senderFinder: new
|
|
4807
|
-
codecProvider: new
|
|
5043
|
+
senderFinder: new Ms(),
|
|
5044
|
+
codecProvider: new us(),
|
|
4808
5045
|
parametersSetter: this.parametersSetterWithQueue
|
|
4809
5046
|
},
|
|
4810
5047
|
{
|
|
4811
5048
|
ignoreForCodec: s
|
|
4812
5049
|
}
|
|
4813
|
-
), this.trackMonitor = new
|
|
5050
|
+
), this.trackMonitor = new _s({ pollIntervalMs: r });
|
|
4814
5051
|
}
|
|
4815
5052
|
/**
|
|
4816
5053
|
* Подписывается на события управления главной камерой
|
|
@@ -4855,13 +5092,13 @@ class Ts {
|
|
|
4855
5092
|
});
|
|
4856
5093
|
};
|
|
4857
5094
|
}
|
|
4858
|
-
const
|
|
5095
|
+
const qe = [
|
|
4859
5096
|
"balancing-scheduled",
|
|
4860
5097
|
"balancing-started",
|
|
4861
5098
|
"balancing-stopped",
|
|
4862
5099
|
"parameters-updated"
|
|
4863
|
-
],
|
|
4864
|
-
class
|
|
5100
|
+
], Ds = () => new R(qe);
|
|
5101
|
+
class Ps {
|
|
4865
5102
|
isBalancingActive = !1;
|
|
4866
5103
|
events;
|
|
4867
5104
|
callManager;
|
|
@@ -4869,7 +5106,7 @@ class Es {
|
|
|
4869
5106
|
videoSendingBalancer;
|
|
4870
5107
|
startBalancingTimer;
|
|
4871
5108
|
constructor(e, t, s = {}) {
|
|
4872
|
-
this.events =
|
|
5109
|
+
this.events = Ds(), this.callManager = e, this.balancingStartDelay = s.balancingStartDelay ?? 1e4, this.videoSendingBalancer = new Os(
|
|
4873
5110
|
t,
|
|
4874
5111
|
() => e.connection,
|
|
4875
5112
|
{
|
|
@@ -4939,13 +5176,13 @@ class Es {
|
|
|
4939
5176
|
this.startBalancingTimer && (clearTimeout(this.startBalancingTimer), this.startBalancingTimer = void 0);
|
|
4940
5177
|
}
|
|
4941
5178
|
}
|
|
4942
|
-
const
|
|
4943
|
-
class
|
|
5179
|
+
const He = "no-inbound-frames", We = [He], ys = () => new R(We);
|
|
5180
|
+
class Ls {
|
|
4944
5181
|
events;
|
|
4945
5182
|
statsManager;
|
|
4946
5183
|
callManager;
|
|
4947
5184
|
constructor(e, t) {
|
|
4948
|
-
this.statsManager = e, this.callManager = t, this.events =
|
|
5185
|
+
this.statsManager = e, this.callManager = t, this.events = ys(), this.subscribe();
|
|
4949
5186
|
}
|
|
4950
5187
|
get mainVideoTrack() {
|
|
4951
5188
|
return this.callManager.getMainRemoteStream()?.getVideoTracks()[0];
|
|
@@ -4958,20 +5195,20 @@ class ps {
|
|
|
4958
5195
|
return this.events.on(e, t);
|
|
4959
5196
|
}
|
|
4960
5197
|
handleStatsCollected = () => {
|
|
4961
|
-
this.hasNoIncomingFrames() && this.events.trigger(
|
|
5198
|
+
this.hasNoIncomingFrames() && this.events.trigger(He, {});
|
|
4962
5199
|
};
|
|
4963
5200
|
hasNoIncomingFrames = () => this.statsManager.isInvalidInboundFrames && this.isMutedMainVideoTrack;
|
|
4964
5201
|
subscribe() {
|
|
4965
5202
|
this.statsManager.on("collected", this.handleStatsCollected);
|
|
4966
5203
|
}
|
|
4967
5204
|
}
|
|
4968
|
-
const
|
|
4969
|
-
class
|
|
5205
|
+
const ws = 3e3;
|
|
5206
|
+
class Us {
|
|
4970
5207
|
renegotiateRequester;
|
|
4971
5208
|
renegotiateThrottled;
|
|
4972
5209
|
callManager;
|
|
4973
|
-
constructor(e, t =
|
|
4974
|
-
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(
|
|
4975
5212
|
this.requestRenegotiate.bind(this),
|
|
4976
5213
|
t
|
|
4977
5214
|
), this.subscribe();
|
|
@@ -4999,29 +5236,30 @@ class Ns {
|
|
|
4999
5236
|
d("cancel recover main stream"), this.renegotiateThrottled.cancel(), this.renegotiateRequester.cancelRequest();
|
|
5000
5237
|
}
|
|
5001
5238
|
}
|
|
5002
|
-
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 = [
|
|
5003
5240
|
"disconnected-from-out-of-call",
|
|
5004
5241
|
"connected-with-configuration-from-out-of-call",
|
|
5005
5242
|
"stopped-presentation-by-server-command"
|
|
5006
|
-
],
|
|
5007
|
-
...
|
|
5008
|
-
...
|
|
5009
|
-
|
|
5010
|
-
...
|
|
5011
|
-
...
|
|
5012
|
-
...
|
|
5013
|
-
...
|
|
5014
|
-
...
|
|
5015
|
-
...
|
|
5016
|
-
...
|
|
5017
|
-
...
|
|
5018
|
-
...
|
|
5019
|
-
],
|
|
5020
|
-
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 {
|
|
5021
5258
|
events;
|
|
5022
5259
|
connectionManager;
|
|
5023
5260
|
connectionQueueManager;
|
|
5024
5261
|
conferenceStateManager;
|
|
5262
|
+
contentedStreamManager;
|
|
5025
5263
|
callManager;
|
|
5026
5264
|
autoConnectorManager;
|
|
5027
5265
|
apiManager;
|
|
@@ -5040,33 +5278,33 @@ class Js {
|
|
|
5040
5278
|
videoBalancerOptions: i,
|
|
5041
5279
|
autoConnectorOptions: r
|
|
5042
5280
|
} = {}) {
|
|
5043
|
-
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({
|
|
5044
5282
|
connectionManager: this.connectionManager
|
|
5045
|
-
}), this.conferenceStateManager = new
|
|
5046
|
-
connectionManager: this.connectionManager,
|
|
5047
|
-
callManager: this.callManager
|
|
5048
|
-
}), 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({
|
|
5049
5284
|
callManager: this.callManager,
|
|
5050
|
-
maxBitrate:
|
|
5051
|
-
}), this.statsManager = new
|
|
5285
|
+
maxBitrate: Fs
|
|
5286
|
+
}), this.statsManager = new is({
|
|
5052
5287
|
callManager: this.callManager,
|
|
5053
5288
|
apiManager: this.apiManager
|
|
5054
|
-
}), this.autoConnectorManager = new
|
|
5289
|
+
}), this.autoConnectorManager = new bn(
|
|
5055
5290
|
{
|
|
5056
5291
|
connectionQueueManager: this.connectionQueueManager,
|
|
5057
5292
|
connectionManager: this.connectionManager,
|
|
5058
5293
|
callManager: this.callManager
|
|
5059
5294
|
},
|
|
5060
5295
|
r
|
|
5061
|
-
), this.videoSendingBalancerManager = new
|
|
5296
|
+
), this.videoSendingBalancerManager = new Ps(
|
|
5062
5297
|
this.callManager,
|
|
5063
5298
|
this.apiManager,
|
|
5064
5299
|
i
|
|
5065
|
-
), this.mainStreamHealthMonitor = new
|
|
5300
|
+
), this.mainStreamHealthMonitor = new Ls(this.statsManager, this.callManager), this.mainStreamRecovery = new Us(this.callManager), this.sessionManager = new xn({
|
|
5066
5301
|
connectionManager: this.connectionManager,
|
|
5067
5302
|
callManager: this.callManager,
|
|
5068
5303
|
incomingCallManager: this.incomingCallManager,
|
|
5069
5304
|
presentationManager: this.presentationManager
|
|
5305
|
+
}), this.contentedStreamManager.subscribeToApiEvents(this.apiManager), this.apiManager.subscribe({
|
|
5306
|
+
connectionManager: this.connectionManager,
|
|
5307
|
+
callManager: this.callManager
|
|
5070
5308
|
}), this.subscribe();
|
|
5071
5309
|
}
|
|
5072
5310
|
get requestedConnection() {
|
|
@@ -5171,7 +5409,7 @@ class Js {
|
|
|
5171
5409
|
const { isP2P: s, callLimit: i, onAddedTransceiver: r, ...a } = t;
|
|
5172
5410
|
return this.presentationManager.startPresentation(
|
|
5173
5411
|
async () => {
|
|
5174
|
-
s === !0 ?
|
|
5412
|
+
await (s === !0 ? this.apiManager.sendAvailableContentedStream() : this.apiManager.askPermissionToStartPresentation());
|
|
5175
5413
|
},
|
|
5176
5414
|
e,
|
|
5177
5415
|
{
|
|
@@ -5184,14 +5422,14 @@ class Js {
|
|
|
5184
5422
|
async stopPresentation(e = {}) {
|
|
5185
5423
|
const { isP2P: t } = e;
|
|
5186
5424
|
return this.presentationManager.stopPresentation(async () => {
|
|
5187
|
-
await (t === !0 ? this.apiManager.
|
|
5425
|
+
await (t === !0 ? this.apiManager.sendNotAvailableContentedStream() : this.apiManager.sendStoppedPresentation());
|
|
5188
5426
|
});
|
|
5189
5427
|
}
|
|
5190
5428
|
async updatePresentation(e, t = {}) {
|
|
5191
5429
|
const { isP2P: s, onAddedTransceiver: i, ...r } = t;
|
|
5192
5430
|
return this.presentationManager.updatePresentation(
|
|
5193
5431
|
async () => {
|
|
5194
|
-
s === !0 ?
|
|
5432
|
+
await (s === !0 ? this.apiManager.sendAvailableContentedStream() : this.apiManager.askPermissionToStartPresentation());
|
|
5195
5433
|
},
|
|
5196
5434
|
e,
|
|
5197
5435
|
{
|
|
@@ -5224,21 +5462,6 @@ class Js {
|
|
|
5224
5462
|
async sendRefusalToTurnOnCam(...e) {
|
|
5225
5463
|
return this.apiManager.sendRefusalToTurnOnCam(...e);
|
|
5226
5464
|
}
|
|
5227
|
-
async sendMustStopPresentationP2P(...e) {
|
|
5228
|
-
return this.apiManager.sendMustStopPresentationP2P(...e);
|
|
5229
|
-
}
|
|
5230
|
-
async sendStoppedPresentationP2P(...e) {
|
|
5231
|
-
return this.apiManager.sendStoppedPresentationP2P(...e);
|
|
5232
|
-
}
|
|
5233
|
-
async sendStoppedPresentation(...e) {
|
|
5234
|
-
return this.apiManager.sendStoppedPresentation(...e);
|
|
5235
|
-
}
|
|
5236
|
-
async askPermissionToStartPresentationP2P(...e) {
|
|
5237
|
-
return this.apiManager.askPermissionToStartPresentationP2P(...e);
|
|
5238
|
-
}
|
|
5239
|
-
async askPermissionToStartPresentation(...e) {
|
|
5240
|
-
return this.apiManager.askPermissionToStartPresentation(...e);
|
|
5241
|
-
}
|
|
5242
5465
|
async askPermissionToEnableCam(...e) {
|
|
5243
5466
|
return this.apiManager.askPermissionToEnableCam(...e);
|
|
5244
5467
|
}
|
|
@@ -5263,16 +5486,16 @@ class Js {
|
|
|
5263
5486
|
this.callManager.setCallRoleSpectatorSynthetic(), this.mayBeStopPresentationAndNotify();
|
|
5264
5487
|
}), this.apiManager.on("participant:move-request-to-spectators-with-audio-id", ({ audioId: e }) => {
|
|
5265
5488
|
this.callManager.setCallRoleSpectator({ audioId: e, sendOffer: this.sendOffer }), this.mayBeStopPresentationAndNotify();
|
|
5266
|
-
}), this.apiManager.on("
|
|
5489
|
+
}), this.apiManager.on("presentation:must-stop", () => {
|
|
5267
5490
|
this.mayBeStopPresentationAndNotify();
|
|
5268
|
-
}), this.apiManager.on("
|
|
5491
|
+
}), this.apiManager.on("enter-room", ({ room: e, participantName: t }) => {
|
|
5269
5492
|
this.conferenceStateManager.updateState({ room: e, participantName: t });
|
|
5270
5493
|
}), this.apiManager.on(
|
|
5271
5494
|
"conference:participant-token-issued",
|
|
5272
5495
|
({ jwt: e, conference: t, participant: s }) => {
|
|
5273
5496
|
this.conferenceStateManager.updateState({ token: e, conference: t, participant: s });
|
|
5274
5497
|
}
|
|
5275
|
-
), this.apiManager.on("channels", (e) => {
|
|
5498
|
+
), this.apiManager.on("channels:all", (e) => {
|
|
5276
5499
|
this.conferenceStateManager.updateState({ channels: e });
|
|
5277
5500
|
});
|
|
5278
5501
|
}
|
|
@@ -5281,7 +5504,7 @@ class Js {
|
|
|
5281
5504
|
if (i === void 0)
|
|
5282
5505
|
throw new Error("No sipServerUrl for sendOffer");
|
|
5283
5506
|
const r = this.conferenceStateManager.getToken();
|
|
5284
|
-
return
|
|
5507
|
+
return Xn({
|
|
5285
5508
|
serverUrl: i,
|
|
5286
5509
|
offer: t,
|
|
5287
5510
|
token: r,
|
|
@@ -5291,7 +5514,7 @@ class Js {
|
|
|
5291
5514
|
});
|
|
5292
5515
|
};
|
|
5293
5516
|
setCodecPreferences(e) {
|
|
5294
|
-
|
|
5517
|
+
ds(e, {
|
|
5295
5518
|
preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
|
|
5296
5519
|
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
5297
5520
|
});
|
|
@@ -5316,24 +5539,24 @@ class Js {
|
|
|
5316
5539
|
};
|
|
5317
5540
|
}
|
|
5318
5541
|
export {
|
|
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,
|
|
5332
5555
|
p as k,
|
|
5333
5556
|
d as l,
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5557
|
+
ns as m,
|
|
5558
|
+
gs as n,
|
|
5559
|
+
Ht as o,
|
|
5560
|
+
H as p,
|
|
5561
|
+
Xn as s
|
|
5339
5562
|
};
|