sip-connector 14.1.2-6 → 15.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-CZo7A8_q.cjs +1 -0
- package/dist/@SipConnector-DbvV1Leg.js +2247 -0
- package/dist/ApiManager/@ApiManager.d.ts +59 -0
- package/dist/ApiManager/constants.d.ts +71 -0
- package/dist/ApiManager/eventNames.d.ts +33 -0
- package/dist/ApiManager/index.d.ts +3 -0
- package/dist/ApiManager/types.d.ts +99 -0
- package/dist/CallManager/@CallManager.d.ts +26 -0
- package/dist/CallManager/AbstractCallStrategy.d.ts +47 -0
- package/dist/CallManager/MCUCallStrategy.d.ts +30 -0
- package/dist/CallManager/RemoteStreamsManager.d.ts +8 -0
- package/dist/CallManager/causes.d.ts +13 -0
- package/dist/CallManager/eventNames.d.ts +45 -0
- package/dist/CallManager/hasCanceledCallError.d.ts +2 -0
- package/dist/CallManager/index.d.ts +7 -0
- package/dist/CallManager/types.d.ts +59 -0
- package/dist/ConnectionManager/@ConnectionManager.d.ts +48 -0
- package/dist/ConnectionManager/ConfigurationManager.d.ts +60 -0
- package/dist/ConnectionManager/ConnectionFlow.d.ts +84 -0
- package/dist/ConnectionManager/ConnectionStateMachine.d.ts +61 -0
- package/dist/ConnectionManager/RegistrationManager.d.ts +17 -0
- package/dist/ConnectionManager/SipOperations.d.ts +32 -0
- package/dist/ConnectionManager/UAFactory.d.ts +50 -0
- package/dist/ConnectionManager/eventNames.d.ts +16 -0
- package/dist/ConnectionManager/index.d.ts +3 -0
- package/dist/IncomingCallManager/@IncomingCallManager.d.ts +37 -0
- package/dist/IncomingCallManager/eventNames.d.ts +13 -0
- package/dist/IncomingCallManager/index.d.ts +2 -0
- package/dist/PresentationManager/@PresentationManager.d.ts +47 -0
- package/dist/PresentationManager/constants.d.ts +1 -0
- package/dist/PresentationManager/eventNames.d.ts +11 -0
- package/dist/PresentationManager/index.d.ts +2 -0
- package/dist/PresentationManager/types.d.ts +2 -0
- package/dist/SipConnector/@SipConnector.d.ts +96 -0
- package/dist/SipConnector/eventNames.d.ts +4 -0
- package/dist/SipConnector/index.d.ts +2 -0
- package/dist/{src/SipConnectorFacade → SipConnectorFacade}/SipConnectorFacade.d.ts +7 -16
- package/dist/{src/__fixtures__ → __fixtures__}/BaseSession.mock.d.ts +9 -9
- package/dist/{src/__fixtures__ → __fixtures__}/RTCPeerConnectionMock.d.ts +6 -0
- package/dist/{src/__fixtures__ → __fixtures__}/RTCSessionMock.d.ts +13 -8
- package/dist/{src/__fixtures__ → __fixtures__}/UA.mock.d.ts +13 -15
- package/dist/{src → __fixtures__}/eventNames.d.ts +1 -1
- package/dist/{src/__fixtures__ → __fixtures__}/index.d.ts +4 -4
- package/dist/{src/__fixtures__ → __fixtures__}/jssip.mock.d.ts +3 -3
- package/dist/doMock.cjs +1 -1
- package/dist/{src/doMock.d.ts → doMock.d.ts} +2 -1
- package/dist/doMock.js +442 -341
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +14 -0
- package/dist/index.js +721 -674
- package/dist/{src/setParametersToSender → setParametersToSender}/resolveHasNeedToUpdateItemEncoding.d.ts +1 -1
- package/dist/{src/tools → tools}/__fixtures__/connectToServer.d.ts +2 -2
- package/dist/{src/tools → tools}/__fixtures__/processRequest.d.ts +1 -1
- package/dist/{src/tools → tools}/error/getLinkError.d.ts +1 -1
- package/dist/{src/tools → tools}/error/getTypeFromError.d.ts +1 -1
- package/dist/{src/tools → tools}/error/getValuesFromError.d.ts +1 -1
- package/dist/{src/tools → tools}/index.d.ts +1 -1
- package/dist/{src/tools → tools}/prepareMediaStream.d.ts +1 -1
- package/dist/{src/tools → tools}/setVideoTrackContentHints.d.ts +1 -1
- package/dist/{src/tools → tools}/syncMediaState/index.d.ts +1 -1
- package/dist/{src/tools → tools}/syncMediaState/resolveOnStartMainCam.d.ts +1 -1
- package/dist/{src/tools → tools}/syncMediaState/resolveOnStartMic.d.ts +1 -1
- package/dist/{src/tools → tools}/syncMediaState/resolveOnStopMainCam.d.ts +1 -1
- package/dist/{src/tools → tools}/syncMediaState/resolveOnStopMic.d.ts +1 -1
- package/dist/types.d.ts +23 -0
- package/dist/{src/videoSendingBalancer → videoSendingBalancer}/balance.d.ts +1 -1
- package/dist/{src/videoSendingBalancer → videoSendingBalancer}/getMaxBitrateByWidth.d.ts +1 -0
- package/dist/{src/videoSendingBalancer → videoSendingBalancer}/getMaxBitrateByWidthAndCodec.d.ts +1 -0
- package/dist/{src/videoSendingBalancer → videoSendingBalancer}/index.d.ts +1 -1
- package/dist/{src/videoSendingBalancer → videoSendingBalancer}/processSender.d.ts +1 -1
- package/package.json +35 -42
- package/dist/SipConnector-D9frFCEK.js +0 -1352
- package/dist/SipConnector-J07EhbbA.cjs +0 -1
- package/dist/src/SipConnector.d.ts +0 -235
- package/dist/src/causes.d.ts +0 -23
- package/dist/src/headers.d.ts +0 -37
- package/dist/src/index.d.ts +0 -11
- package/dist/src/types.d.ts +0 -69
- /package/dist/{src → ConnectionManager}/getExtraHeadersRemoteAddress.d.ts +0 -0
- /package/dist/{src/SipConnectorFacade → SipConnectorFacade}/index.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/RTCRtpSenderMock.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/Registrator.mock.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/Request.mock.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/WebSocketInterface.mock.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/accountNotify.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/channels.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/channelsNotify.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/conferenceParticipantTokenIssuedNotify.d.ts +0 -0
- /package/dist/{src → __fixtures__}/constants.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/delayPromise.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/enterRoom.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/mediaState.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/participantMoveRequests.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/participantNotify.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/remoteCallerData.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/utils.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/webcastNotify.d.ts +0 -0
- /package/dist/{src/logger.d.ts → logger.d.ts} +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/configureDegradationPreference.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/configureEmptyEncodings.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/configureEncodings.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/configureMaxBitrate.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/configureScaleResolutionDownBy.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/hasChangedRTCRtpSendParameters.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/index.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/setParametersToSender.d.ts +0 -0
- /package/dist/{src/tools → tools}/__fixtures__/call.d.ts +0 -0
- /package/dist/{src/tools → tools}/__fixtures__/hasValidUri.d.ts +0 -0
- /package/dist/{src/tools → tools}/__fixtures__/permissions.d.ts +0 -0
- /package/dist/{src/tools → tools}/__tests-utils__/parseObject.d.ts +0 -0
- /package/dist/{src/tools → tools}/__tests-utils__/resolveParseArray.d.ts +0 -0
- /package/dist/{src/tools → tools}/error/index.d.ts +0 -0
- /package/dist/{src/tools → tools}/error/stringifyMessage.d.ts +0 -0
- /package/dist/{src/tools → tools}/generateSimulcastEncodings.d.ts +0 -0
- /package/dist/{src/tools → tools}/getExtraHeaders.d.ts +0 -0
- /package/dist/{src/tools → tools}/getUserAgent.d.ts +0 -0
- /package/dist/{src/tools → tools}/hasPurgatory.d.ts +0 -0
- /package/dist/{src/tools → tools}/resolveUpdateTransceiver.d.ts +0 -0
- /package/dist/{src/tools/sendDTMFAccumulated.d.ts → tools/sendDtmfFAccumulated.d.ts} +0 -0
- /package/dist/{src/utils → utils}/errors.d.ts +0 -0
- /package/dist/{src/utils → utils}/findSenderByStream.d.ts +0 -0
- /package/dist/{src/utils → utils}/findVideoSender.d.ts +0 -0
- /package/dist/{src/utils → utils}/findVideoTrack.d.ts +0 -0
- /package/dist/{src/utils → utils}/getCodecFromSender.d.ts +0 -0
- /package/dist/{src/utils → utils}/replaceForbiddenSymbolsWithUnderscore.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/hasAv1Codec.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/hasIncludesString.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/scaleBitrate.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/scaleBitrateByCodec.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/scaleResolutionAndBitrate.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/setEncodingsToSender.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -1,238 +1,725 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import "events-constructor";
|
|
2
|
+
import { E as y, O as ae, l as i, a as w } from "./@SipConnector-DbvV1Leg.js";
|
|
3
|
+
import { b as Bn, S as wn, d as Dn, e as Pn, h as xn } from "./@SipConnector-DbvV1Leg.js";
|
|
4
|
+
import { isCanceledError as Y } from "@krivega/cancelable-promise";
|
|
5
|
+
import { hasCanceledError as ue } from "repeated-calls";
|
|
6
|
+
import { debounce as de } from "ts-debounce";
|
|
7
|
+
import x from "debug";
|
|
8
|
+
import { default as Fn } from "debug";
|
|
9
|
+
import { sequentPromises as le } from "sequent-promises";
|
|
10
|
+
import { createStackPromises as fe } from "stack-promises";
|
|
11
|
+
const he = (e) => e instanceof Object && ("originator" in e || "cause" in e), Mn = (e) => {
|
|
12
|
+
if (Y(e))
|
|
13
|
+
return !0;
|
|
14
|
+
if (!he(e))
|
|
15
|
+
return !1;
|
|
16
|
+
const { originator: n, cause: t } = e;
|
|
17
|
+
return typeof t == "string" ? t === y.REQUEST_TIMEOUT || t === y.REJECTED || n === ae.LOCAL && (t === y.CANCELED || t === y.BYE) : !1;
|
|
18
|
+
}, ge = (e, n) => (e.degradationPreference = n.degradationPreference, e), Ce = (e, n) => {
|
|
19
|
+
e.encodings ??= [];
|
|
20
|
+
for (let t = e.encodings.length; t < n; t += 1)
|
|
21
|
+
e.encodings.push({});
|
|
22
|
+
return e;
|
|
23
|
+
}, q = (e) => (n, t) => t !== void 0 && n !== t || t === void 0 && n !== e, Se = q(), me = (e, n) => {
|
|
24
|
+
if (Se(e, n))
|
|
25
|
+
return e;
|
|
26
|
+
}, Re = (e, n) => {
|
|
27
|
+
const t = e.maxBitrate, o = me(n, t);
|
|
28
|
+
return o !== void 0 && (e.maxBitrate = o), e;
|
|
29
|
+
}, z = 1, pe = q(
|
|
30
|
+
z
|
|
31
|
+
), ye = (e, n) => {
|
|
32
|
+
const t = e === void 0 ? void 0 : Math.max(e, z);
|
|
33
|
+
if (t !== void 0 && pe(
|
|
34
|
+
t,
|
|
35
|
+
n
|
|
36
|
+
))
|
|
37
|
+
return t;
|
|
38
|
+
}, Ee = (e, n) => {
|
|
39
|
+
const t = e.scaleResolutionDownBy, o = ye(
|
|
40
|
+
n,
|
|
41
|
+
t
|
|
42
|
+
);
|
|
43
|
+
return o !== void 0 && (e.scaleResolutionDownBy = o), e;
|
|
44
|
+
}, Te = (e, n) => {
|
|
45
|
+
const t = n.encodings?.length ?? 0;
|
|
46
|
+
return Ce(e, t), e.encodings.forEach((o, s) => {
|
|
47
|
+
const r = (n?.encodings ?? [])[s], c = r?.maxBitrate, a = r?.scaleResolutionDownBy;
|
|
48
|
+
Re(o, c), Ee(o, a);
|
|
49
|
+
}), e;
|
|
50
|
+
}, ve = (e, n) => {
|
|
51
|
+
if (e.codecs?.length !== n.codecs?.length)
|
|
52
|
+
return !0;
|
|
53
|
+
for (let t = 0; t < (e.codecs?.length ?? 0); t++)
|
|
54
|
+
if (JSON.stringify(e.codecs[t]) !== JSON.stringify(n.codecs[t]))
|
|
55
|
+
return !0;
|
|
56
|
+
if (e.headerExtensions?.length !== n.headerExtensions?.length)
|
|
57
|
+
return !0;
|
|
58
|
+
for (let t = 0; t < (e.headerExtensions?.length ?? 0); t++)
|
|
59
|
+
if (JSON.stringify(e.headerExtensions[t]) !== JSON.stringify(n.headerExtensions[t]))
|
|
60
|
+
return !0;
|
|
61
|
+
if (e.encodings?.length !== n.encodings?.length)
|
|
62
|
+
return !0;
|
|
63
|
+
for (let t = 0; t < (e.encodings.length ?? 0); t++)
|
|
64
|
+
if (JSON.stringify(e.encodings[t]) !== JSON.stringify(n.encodings[t]))
|
|
65
|
+
return !0;
|
|
66
|
+
return e.rtcp?.cname !== n.rtcp?.cname || e.rtcp?.reducedSize !== n.rtcp?.reducedSize || e.degradationPreference !== n.degradationPreference;
|
|
67
|
+
}, Q = async (e, n) => {
|
|
68
|
+
const t = e.getParameters(), o = JSON.parse(
|
|
69
|
+
JSON.stringify(t)
|
|
70
|
+
);
|
|
71
|
+
Te(t, n), ge(t, n);
|
|
72
|
+
const s = ve(o, t);
|
|
73
|
+
return s && await e.setParameters(t), { parameters: t, isChanged: s };
|
|
74
|
+
}, Me = (e) => e.getVideoTracks()[0], be = 1e6, m = (e) => e * be, Z = m(0.06), ee = m(4), _e = (e) => e <= 64 ? Z : e <= 128 ? m(0.12) : e <= 256 ? m(0.25) : e <= 384 ? m(0.32) : e <= 426 ? m(0.38) : e <= 640 ? m(0.5) : e <= 848 ? m(0.7) : e <= 1280 ? m(1) : e <= 1920 ? m(2) : ee, ne = (e, n) => e !== void 0 && n !== void 0 && e.toLowerCase().includes(n.toLowerCase()), Ae = "av1", Oe = (e) => ne(e, Ae), Ne = 0.6, W = (e, n) => Oe(n) ? e * Ne : e, Be = (e) => W(Z, e), we = (e) => W(ee, e), te = (e, n) => {
|
|
75
|
+
const t = _e(e);
|
|
76
|
+
return W(t, n);
|
|
77
|
+
}, J = 1, oe = ({
|
|
78
|
+
videoTrack: e,
|
|
79
|
+
targetSize: n,
|
|
80
|
+
codec: t
|
|
81
|
+
}) => {
|
|
82
|
+
const o = e.getSettings(), s = o.width, r = o.height, c = s === void 0 ? J : s / n.width, a = r === void 0 ? J : r / n.height, u = Math.max(c, a, J), l = te(n.width, t);
|
|
83
|
+
return { scaleResolutionDownBy: u, maxBitrate: l };
|
|
84
|
+
}, D = ({
|
|
85
|
+
mediaStream: e,
|
|
86
|
+
simulcastEncodings: n,
|
|
87
|
+
sendEncodings: t
|
|
88
|
+
}) => {
|
|
89
|
+
if (n && n.length > 0) {
|
|
90
|
+
const o = t ?? [], s = Me(e);
|
|
91
|
+
if (s === void 0)
|
|
92
|
+
throw new Error("No video track");
|
|
93
|
+
return n.forEach((r, c) => {
|
|
94
|
+
const a = o[c] ?? {};
|
|
95
|
+
a.active = !0, r.rid !== void 0 && (a.rid = r.rid), r.scalabilityMode !== void 0 && (a.scalabilityMode = r.scalabilityMode);
|
|
96
|
+
const { maxBitrate: u, scaleResolutionDownBy: l } = oe({
|
|
97
|
+
videoTrack: s,
|
|
98
|
+
targetSize: {
|
|
99
|
+
width: r.width,
|
|
100
|
+
height: r.height
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
a.maxBitrate = u, a.scaleResolutionDownBy = l, o[c] = a;
|
|
104
|
+
}), o;
|
|
105
|
+
}
|
|
106
|
+
return t;
|
|
107
|
+
}, se = "purgatory", I = (e) => e === se, De = (e, n) => e.filter((o) => n.some((s) => s.clockRate === o.clockRate && s.mimeType === o.mimeType && s.channels === o.channels && s.sdpFmtpLine === o.sdpFmtpLine)), Pe = (e) => {
|
|
108
|
+
const n = RTCRtpSender.getCapabilities(e), t = RTCRtpReceiver.getCapabilities(e), o = n === null ? [] : n.codecs, s = t === null ? [] : t.codecs;
|
|
109
|
+
return De(o, s);
|
|
110
|
+
}, xe = (e, n) => n === void 0 || n.length === 0 ? e : e.sort((t, o) => {
|
|
111
|
+
const s = n.indexOf(t.mimeType), r = n.indexOf(o.mimeType), c = s === -1 ? Number.MAX_VALUE : s, a = r === -1 ? Number.MAX_VALUE : r;
|
|
112
|
+
return c - a;
|
|
113
|
+
}), Ie = (e, n) => n === void 0 || n.length === 0 ? e : e.filter((t) => !n.includes(t.mimeType)), Fe = (e, {
|
|
114
|
+
preferredMimeTypesVideoCodecs: n,
|
|
115
|
+
excludeMimeTypesVideoCodecs: t
|
|
116
|
+
}) => {
|
|
117
|
+
if (typeof e.setCodecPreferences == "function" && e.sender.track?.kind === "video" && (n !== void 0 && n.length > 0 || t !== void 0 && t.length > 0)) {
|
|
118
|
+
const o = Pe("video"), s = Ie(o, t), r = xe(s, n);
|
|
119
|
+
e.setCodecPreferences(r);
|
|
120
|
+
}
|
|
121
|
+
}, P = (e, {
|
|
122
|
+
preferredMimeTypesVideoCodecs: n,
|
|
123
|
+
excludeMimeTypesVideoCodecs: t
|
|
124
|
+
}) => async (o) => {
|
|
125
|
+
try {
|
|
126
|
+
Fe(o, {
|
|
127
|
+
preferredMimeTypesVideoCodecs: n,
|
|
128
|
+
excludeMimeTypesVideoCodecs: t
|
|
129
|
+
}), Object.values(e).filter((r) => r != null).length > 0 && (i("updateTransceiver setParametersToSender", e), await Q(o.sender, e));
|
|
130
|
+
} catch (s) {
|
|
131
|
+
i("updateTransceiver error", s);
|
|
132
|
+
}
|
|
133
|
+
}, X = (e) => {
|
|
134
|
+
if (!Y(e) && !ue(e))
|
|
135
|
+
throw e;
|
|
136
|
+
return { isSuccessful: !1 };
|
|
137
|
+
}, Ue = ({ kind: e, readyState: n }) => e === "video" && n === "live", ke = /* @__PURE__ */ new Set([
|
|
138
|
+
"on",
|
|
139
|
+
"once",
|
|
140
|
+
"onceRace",
|
|
141
|
+
"wait",
|
|
142
|
+
"off",
|
|
143
|
+
"sendDTMF",
|
|
144
|
+
"hangUp",
|
|
145
|
+
"declineToIncomingCall",
|
|
146
|
+
"sendChannels",
|
|
147
|
+
"checkTelephony",
|
|
148
|
+
"waitChannels",
|
|
149
|
+
"ping",
|
|
150
|
+
"connection",
|
|
151
|
+
"isConfigured",
|
|
152
|
+
"isRegistered"
|
|
153
|
+
]);
|
|
154
|
+
class bn {
|
|
155
|
+
// @ts-expect-error: proxy method
|
|
156
|
+
on;
|
|
157
|
+
// @ts-expect-error: proxy method
|
|
158
|
+
once;
|
|
159
|
+
// @ts-expect-error: proxy method
|
|
160
|
+
onceRace;
|
|
161
|
+
// @ts-expect-error: proxy method
|
|
162
|
+
wait;
|
|
163
|
+
// @ts-expect-error: proxy method
|
|
164
|
+
off;
|
|
165
|
+
// @ts-expect-error: proxy method
|
|
166
|
+
sendDTMF;
|
|
167
|
+
// @ts-expect-error: proxy method
|
|
168
|
+
hangUp;
|
|
169
|
+
// @ts-expect-error: proxy method
|
|
170
|
+
declineToIncomingCall;
|
|
171
|
+
// @ts-expect-error: proxy method
|
|
172
|
+
sendChannels;
|
|
173
|
+
// @ts-expect-error: proxy method
|
|
174
|
+
checkTelephony;
|
|
175
|
+
// @ts-expect-error: proxy method
|
|
176
|
+
waitChannels;
|
|
177
|
+
// @ts-expect-error: proxy method
|
|
178
|
+
ping;
|
|
179
|
+
// proxy method
|
|
180
|
+
connection;
|
|
181
|
+
// @ts-expect-error: proxy method
|
|
182
|
+
isConfigured;
|
|
183
|
+
// @ts-expect-error: proxy method
|
|
184
|
+
isRegistered;
|
|
185
|
+
sipConnector;
|
|
186
|
+
preferredMimeTypesVideoCodecs;
|
|
187
|
+
excludeMimeTypesVideoCodecs;
|
|
188
|
+
constructor(n, {
|
|
189
|
+
preferredMimeTypesVideoCodecs: t,
|
|
190
|
+
excludeMimeTypesVideoCodecs: o
|
|
191
|
+
} = {}) {
|
|
192
|
+
return this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = o, this.sipConnector = n, new Proxy(this, {
|
|
193
|
+
get: (s, r, c) => {
|
|
194
|
+
if (typeof r == "string" && ke.has(r) && r in this.sipConnector) {
|
|
195
|
+
const u = Reflect.get(this.sipConnector, r, this.sipConnector);
|
|
196
|
+
return typeof u == "function" ? u.bind(this.sipConnector) : u;
|
|
197
|
+
}
|
|
198
|
+
const a = Reflect.get(s, r, c);
|
|
199
|
+
return typeof a == "function" ? a.bind(s) : a;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
connectToServer = async (n) => {
|
|
204
|
+
const {
|
|
205
|
+
userAgent: t,
|
|
206
|
+
sipWebSocketServerURL: o,
|
|
207
|
+
sipServerUrl: s,
|
|
208
|
+
remoteAddress: r,
|
|
209
|
+
displayName: c,
|
|
210
|
+
name: a,
|
|
211
|
+
password: u,
|
|
212
|
+
isRegisteredUser: l,
|
|
213
|
+
isDisconnectOnFail: h
|
|
214
|
+
} = n;
|
|
215
|
+
return i("connectToServer", n), this.sipConnector.connect({
|
|
216
|
+
userAgent: t,
|
|
217
|
+
sipWebSocketServerURL: o,
|
|
218
|
+
sipServerUrl: s,
|
|
219
|
+
remoteAddress: r,
|
|
220
|
+
displayName: c,
|
|
221
|
+
password: u,
|
|
222
|
+
user: a,
|
|
223
|
+
register: l
|
|
224
|
+
}).then((f) => (i("connectToServer then"), { ua: f, isSuccessful: !0 })).catch(async (f) => (i("connectToServer catch: error", f), h === !0 ? this.sipConnector.disconnect().then(() => X(f)).catch(() => X(f)) : X(f)));
|
|
225
|
+
};
|
|
226
|
+
callToServer = async (n) => {
|
|
227
|
+
const {
|
|
228
|
+
conference: t,
|
|
229
|
+
mediaStream: o,
|
|
230
|
+
extraHeaders: s,
|
|
231
|
+
iceServers: r,
|
|
232
|
+
contentHint: c,
|
|
233
|
+
simulcastEncodings: a,
|
|
234
|
+
degradationPreference: u,
|
|
235
|
+
sendEncodings: l,
|
|
236
|
+
offerToReceiveAudio: h,
|
|
237
|
+
offerToReceiveVideo: f,
|
|
238
|
+
directionVideo: F,
|
|
239
|
+
directionAudio: U,
|
|
240
|
+
setRemoteStreams: g,
|
|
241
|
+
onBeforeProgressCall: R,
|
|
242
|
+
onSuccessProgressCall: C,
|
|
243
|
+
onEnterPurgatory: S,
|
|
244
|
+
onEnterConference: p,
|
|
245
|
+
onFailProgressCall: E,
|
|
246
|
+
onFinishProgressCall: T,
|
|
247
|
+
onEndedCall: v
|
|
248
|
+
} = n, _ = this.resolveHandleReadyRemoteStreamsDebounced({
|
|
249
|
+
onReadyRemoteStreams: g
|
|
250
|
+
}), A = this.resolveHandleReadyRemoteStreams({
|
|
251
|
+
onReadyRemoteStreams: () => {
|
|
252
|
+
_().catch(x);
|
|
253
|
+
}
|
|
254
|
+
}), O = P(
|
|
255
|
+
{
|
|
256
|
+
degradationPreference: u
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
|
|
260
|
+
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
261
|
+
}
|
|
262
|
+
);
|
|
263
|
+
i("callToServer", n);
|
|
264
|
+
const N = async () => (i("startCall"), this.sipConnector.call({
|
|
265
|
+
mediaStream: o,
|
|
266
|
+
extraHeaders: s,
|
|
267
|
+
iceServers: r,
|
|
268
|
+
contentHint: c,
|
|
269
|
+
offerToReceiveAudio: h,
|
|
270
|
+
offerToReceiveVideo: f,
|
|
271
|
+
directionVideo: F,
|
|
272
|
+
directionAudio: U,
|
|
273
|
+
sendEncodings: D({
|
|
274
|
+
mediaStream: o,
|
|
275
|
+
simulcastEncodings: a,
|
|
276
|
+
sendEncodings: l
|
|
277
|
+
}),
|
|
278
|
+
number: t,
|
|
279
|
+
onAddedTransceiver: O,
|
|
280
|
+
ontrack: A
|
|
281
|
+
}));
|
|
282
|
+
let M = !1, b;
|
|
283
|
+
const B = (i("subscribeEnterConference: onEnterConference", p), S ?? p ? this.sipConnector.on("api:enterRoom", ({ room: d }) => {
|
|
284
|
+
i("enterRoom", { _room: d, isSuccessProgressCall: M }), b = d, I(b) ? S && S() : p && p({ isSuccessProgressCall: M });
|
|
285
|
+
}) : () => {
|
|
286
|
+
}), L = (d) => (i("onSuccess"), M = !0, _().catch(x), C && C({ isPurgatory: I(b) }), this.sipConnector.onceRace(["call:ended", "call:failed"], () => {
|
|
287
|
+
B(), v && v();
|
|
288
|
+
}), d), H = (d) => {
|
|
289
|
+
throw i("onFail"), E && E(), B(), d;
|
|
290
|
+
}, $ = () => {
|
|
291
|
+
i("onFinish"), T && T();
|
|
292
|
+
};
|
|
293
|
+
return i("onBeforeProgressCall"), R && R(t), N().then(L).catch((d) => H(d)).finally($);
|
|
294
|
+
};
|
|
295
|
+
disconnectFromServer = async () => this.sipConnector.disconnect().then(() => (i("disconnectFromServer: then"), { isSuccessful: !0 })).catch((n) => (i("disconnectFromServer: catch", n), { isSuccessful: !1 }));
|
|
296
|
+
answerToIncomingCall = async (n) => {
|
|
297
|
+
const {
|
|
298
|
+
mediaStream: t,
|
|
299
|
+
extraHeaders: o,
|
|
300
|
+
iceServers: s,
|
|
301
|
+
contentHint: r,
|
|
302
|
+
simulcastEncodings: c,
|
|
303
|
+
degradationPreference: a,
|
|
304
|
+
sendEncodings: u,
|
|
305
|
+
offerToReceiveAudio: l,
|
|
306
|
+
offerToReceiveVideo: h,
|
|
307
|
+
directionVideo: f,
|
|
308
|
+
directionAudio: F,
|
|
309
|
+
setRemoteStreams: U,
|
|
310
|
+
onBeforeProgressCall: g,
|
|
311
|
+
onSuccessProgressCall: R,
|
|
312
|
+
onEnterPurgatory: C,
|
|
313
|
+
onEnterConference: S,
|
|
314
|
+
onFailProgressCall: p,
|
|
315
|
+
onFinishProgressCall: E,
|
|
316
|
+
onEndedCall: T
|
|
317
|
+
} = n, v = this.resolveHandleReadyRemoteStreamsDebounced({
|
|
318
|
+
onReadyRemoteStreams: U
|
|
319
|
+
}), _ = this.resolveHandleReadyRemoteStreams({
|
|
320
|
+
onReadyRemoteStreams: () => {
|
|
321
|
+
v().catch(x);
|
|
322
|
+
}
|
|
323
|
+
}), A = P(
|
|
324
|
+
{
|
|
325
|
+
degradationPreference: a
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
|
|
329
|
+
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
330
|
+
}
|
|
331
|
+
);
|
|
332
|
+
i("answerToIncomingCall", n);
|
|
333
|
+
const O = async () => this.sipConnector.answerToIncomingCall({
|
|
334
|
+
mediaStream: t,
|
|
335
|
+
extraHeaders: o,
|
|
336
|
+
iceServers: s,
|
|
337
|
+
contentHint: r,
|
|
338
|
+
offerToReceiveAudio: l,
|
|
339
|
+
offerToReceiveVideo: h,
|
|
340
|
+
directionVideo: f,
|
|
341
|
+
directionAudio: F,
|
|
342
|
+
sendEncodings: D({
|
|
343
|
+
mediaStream: t,
|
|
344
|
+
simulcastEncodings: c,
|
|
345
|
+
sendEncodings: u
|
|
346
|
+
}),
|
|
347
|
+
onAddedTransceiver: A,
|
|
348
|
+
ontrack: _
|
|
349
|
+
}), N = () => {
|
|
350
|
+
const { remoteCallerData: d } = this.sipConnector;
|
|
351
|
+
return d.incomingNumber;
|
|
352
|
+
};
|
|
353
|
+
let M = !1, b;
|
|
354
|
+
const B = (i("subscribeEnterConference: onEnterConference", S), C ?? S ? this.sipConnector.on("api:enterRoom", (d) => {
|
|
355
|
+
i("enterRoom", { _room: d, isSuccessProgressCall: M }), b = d, I(b) ? C && C() : S && S({ isSuccessProgressCall: M });
|
|
356
|
+
}) : () => {
|
|
357
|
+
}), L = (d) => (i("onSuccess"), M = !0, v().catch(x), R && R({ isPurgatory: I(b) }), this.sipConnector.onceRace(["call:ended", "call:failed"], () => {
|
|
358
|
+
B(), T && T();
|
|
359
|
+
}), d), H = (d) => {
|
|
360
|
+
throw i("onFail"), p && p(), B(), d;
|
|
361
|
+
}, $ = () => {
|
|
362
|
+
i("onFinish"), E && E();
|
|
363
|
+
};
|
|
364
|
+
if (i("onBeforeProgressCall"), g) {
|
|
365
|
+
const d = N();
|
|
366
|
+
g(d);
|
|
367
|
+
}
|
|
368
|
+
return O().then(L).catch((d) => H(d)).finally($);
|
|
369
|
+
};
|
|
370
|
+
updatePresentation = async ({
|
|
371
|
+
mediaStream: n,
|
|
372
|
+
isP2P: t,
|
|
373
|
+
maxBitrate: o,
|
|
374
|
+
contentHint: s,
|
|
375
|
+
simulcastEncodings: r,
|
|
376
|
+
degradationPreference: c,
|
|
377
|
+
sendEncodings: a,
|
|
378
|
+
preferredMimeTypesVideoCodecs: u,
|
|
379
|
+
excludeMimeTypesVideoCodecs: l
|
|
380
|
+
}) => {
|
|
381
|
+
const h = P(
|
|
382
|
+
{
|
|
383
|
+
degradationPreference: c
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
preferredMimeTypesVideoCodecs: u,
|
|
387
|
+
excludeMimeTypesVideoCodecs: l
|
|
388
|
+
}
|
|
389
|
+
);
|
|
390
|
+
return i("updatePresentation"), this.sipConnector.updatePresentation(n, {
|
|
391
|
+
isP2P: t,
|
|
392
|
+
maxBitrate: o,
|
|
393
|
+
contentHint: s,
|
|
394
|
+
sendEncodings: D({
|
|
395
|
+
mediaStream: n,
|
|
396
|
+
simulcastEncodings: r,
|
|
397
|
+
sendEncodings: a
|
|
398
|
+
}),
|
|
399
|
+
onAddedTransceiver: h
|
|
400
|
+
});
|
|
401
|
+
};
|
|
402
|
+
startPresentation = async ({
|
|
403
|
+
mediaStream: n,
|
|
404
|
+
isP2P: t,
|
|
405
|
+
maxBitrate: o,
|
|
406
|
+
contentHint: s,
|
|
407
|
+
simulcastEncodings: r,
|
|
408
|
+
degradationPreference: c,
|
|
409
|
+
sendEncodings: a,
|
|
410
|
+
preferredMimeTypesVideoCodecs: u,
|
|
411
|
+
excludeMimeTypesVideoCodecs: l,
|
|
412
|
+
callLimit: h
|
|
413
|
+
}) => {
|
|
414
|
+
const f = P(
|
|
415
|
+
{
|
|
416
|
+
degradationPreference: c
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
preferredMimeTypesVideoCodecs: u,
|
|
420
|
+
excludeMimeTypesVideoCodecs: l
|
|
421
|
+
}
|
|
422
|
+
);
|
|
423
|
+
return i("startPresentation"), this.sipConnector.startPresentation(n, {
|
|
424
|
+
isP2P: t,
|
|
425
|
+
maxBitrate: o,
|
|
426
|
+
contentHint: s,
|
|
427
|
+
callLimit: h,
|
|
428
|
+
sendEncodings: D({
|
|
429
|
+
mediaStream: n,
|
|
430
|
+
simulcastEncodings: r,
|
|
431
|
+
sendEncodings: a
|
|
432
|
+
}),
|
|
433
|
+
onAddedTransceiver: f
|
|
434
|
+
});
|
|
435
|
+
};
|
|
436
|
+
stopShareSipConnector = async ({ isP2P: n = !1 } = {}) => (i("stopShareSipConnector"), this.sipConnector.stopPresentation({
|
|
437
|
+
isP2P: n
|
|
438
|
+
}).catch((t) => {
|
|
439
|
+
i(t);
|
|
440
|
+
}));
|
|
441
|
+
sendRefusalToTurnOnMic = async () => {
|
|
442
|
+
i("sendRefusalToTurnOnMic"), await this.sipConnector.sendRefusalToTurnOnMic().catch((n) => {
|
|
443
|
+
i("sendRefusalToTurnOnMic: error", n);
|
|
444
|
+
});
|
|
445
|
+
};
|
|
446
|
+
sendRefusalToTurnOnCam = async () => {
|
|
447
|
+
i("sendRefusalToTurnOnCam"), await this.sipConnector.sendRefusalToTurnOnCam().catch((n) => {
|
|
448
|
+
i("sendRefusalToTurnOnCam: error", n);
|
|
449
|
+
});
|
|
450
|
+
};
|
|
451
|
+
sendMediaState = async ({
|
|
452
|
+
isEnabledCam: n,
|
|
453
|
+
isEnabledMic: t
|
|
454
|
+
}) => {
|
|
455
|
+
i("sendMediaState"), await this.sipConnector.sendMediaState({ cam: n, mic: t });
|
|
456
|
+
};
|
|
457
|
+
replaceMediaStream = async (n, {
|
|
458
|
+
deleteExisting: t,
|
|
459
|
+
addMissing: o,
|
|
460
|
+
forceRenegotiation: s,
|
|
461
|
+
contentHint: r,
|
|
462
|
+
simulcastEncodings: c,
|
|
463
|
+
degradationPreference: a,
|
|
464
|
+
sendEncodings: u
|
|
465
|
+
} = {}) => {
|
|
466
|
+
const l = P(
|
|
467
|
+
{
|
|
468
|
+
degradationPreference: a
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
|
|
472
|
+
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
473
|
+
}
|
|
474
|
+
);
|
|
475
|
+
return i("replaceMediaStream"), this.sipConnector.replaceMediaStream(n, {
|
|
476
|
+
deleteExisting: t,
|
|
477
|
+
addMissing: o,
|
|
478
|
+
forceRenegotiation: s,
|
|
479
|
+
contentHint: r,
|
|
480
|
+
sendEncodings: D({
|
|
481
|
+
mediaStream: n,
|
|
482
|
+
simulcastEncodings: c,
|
|
483
|
+
sendEncodings: u
|
|
484
|
+
}),
|
|
485
|
+
onAddedTransceiver: l
|
|
486
|
+
});
|
|
487
|
+
};
|
|
488
|
+
askPermissionToEnableCam = async () => {
|
|
489
|
+
i("askPermissionToEnableCam"), await this.sipConnector.askPermissionToEnableCam();
|
|
490
|
+
};
|
|
491
|
+
resolveHandleReadyRemoteStreamsDebounced = ({
|
|
492
|
+
onReadyRemoteStreams: n
|
|
493
|
+
}) => de(() => {
|
|
494
|
+
const t = this.sipConnector.getRemoteStreams();
|
|
495
|
+
i("remoteStreams", t), t && n(t);
|
|
496
|
+
}, 200);
|
|
497
|
+
// eslint-disable-next-line class-methods-use-this
|
|
498
|
+
resolveHandleReadyRemoteStreams = ({
|
|
499
|
+
onReadyRemoteStreams: n
|
|
500
|
+
}) => ({ track: t }) => {
|
|
501
|
+
Ue(t) && n();
|
|
502
|
+
};
|
|
503
|
+
getRemoteStreams = () => (i("getRemoteStreams"), this.sipConnector.getRemoteStreams());
|
|
504
|
+
onUseLicense = (n) => (i("onUseLicense"), this.sipConnector.on("api:useLicense", n));
|
|
505
|
+
onMustStopPresentation = (n) => (i("onMustStopPresentation"), this.sipConnector.on("api:mustStopPresentation", n));
|
|
506
|
+
onMoveToSpectators = (n) => (i("onMoveToSpectators"), this.sipConnector.on("api:participant:move-request-to-spectators", n));
|
|
507
|
+
onMoveToParticipants = (n) => (i("onMoveToParticipants"), this.sipConnector.on("api:participant:move-request-to-participants", n));
|
|
508
|
+
}
|
|
509
|
+
const V = (e) => {
|
|
510
|
+
const { url: n, cause: t } = e;
|
|
511
|
+
let o = n;
|
|
512
|
+
return (t === y.BAD_MEDIA_DESCRIPTION || t === y.NOT_FOUND) && (o = `${e.message.to.uri.user}@${e.message.to.uri.host}`), o;
|
|
17
513
|
};
|
|
18
|
-
var
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
switch (e) {
|
|
514
|
+
var re = /* @__PURE__ */ ((e) => (e.CONNECT_SERVER_FAILED = "CONNECT_SERVER_FAILED", e.WRONG_USER_OR_PASSWORD = "WRONG_USER_OR_PASSWORD", e.BAD_MEDIA_ERROR = "BAD_MEDIA_ERROR", e.NOT_FOUND_ERROR = "NOT_FOUND_ERROR", e.WS_CONNECTION_FAILED = "WS_CONNECTION_FAILED", e.CONNECT_SERVER_FAILED_BY_LINK = "CONNECT_SERVER_FAILED_BY_LINK", e))(re || {});
|
|
515
|
+
const Ve = new Error("Unknown error"), Le = (e = Ve) => {
|
|
516
|
+
const { cause: n, socket: t } = e;
|
|
517
|
+
let o = "CONNECT_SERVER_FAILED";
|
|
518
|
+
switch (n) {
|
|
24
519
|
case "Forbidden": {
|
|
25
|
-
|
|
520
|
+
o = "WRONG_USER_OR_PASSWORD";
|
|
26
521
|
break;
|
|
27
522
|
}
|
|
28
|
-
case
|
|
29
|
-
|
|
523
|
+
case y.BAD_MEDIA_DESCRIPTION: {
|
|
524
|
+
o = "BAD_MEDIA_ERROR";
|
|
30
525
|
break;
|
|
31
526
|
}
|
|
32
|
-
case
|
|
33
|
-
|
|
527
|
+
case y.NOT_FOUND: {
|
|
528
|
+
o = "NOT_FOUND_ERROR";
|
|
34
529
|
break;
|
|
35
530
|
}
|
|
36
531
|
default:
|
|
37
|
-
t !== void 0 &&
|
|
532
|
+
t !== void 0 && t._ws?.readyState === 3 ? o = "WS_CONNECTION_FAILED" : V(e) !== void 0 && V(e) !== "" && (o = "CONNECT_SERVER_FAILED_BY_LINK");
|
|
38
533
|
}
|
|
39
|
-
return
|
|
40
|
-
},
|
|
41
|
-
let
|
|
534
|
+
return o;
|
|
535
|
+
}, He = (e) => {
|
|
536
|
+
let n = "";
|
|
42
537
|
try {
|
|
43
|
-
|
|
538
|
+
n = JSON.stringify(e);
|
|
44
539
|
} catch (t) {
|
|
45
|
-
|
|
540
|
+
i("failed to stringify message", t);
|
|
46
541
|
}
|
|
47
|
-
return
|
|
48
|
-
},
|
|
49
|
-
const { code:
|
|
50
|
-
return typeof
|
|
51
|
-
},
|
|
542
|
+
return n;
|
|
543
|
+
}, $e = new Error("Unknown error"), Je = (e = $e) => {
|
|
544
|
+
const { code: n, cause: t, message: o } = e, s = V(e), r = { code: "", cause: "", message: "" };
|
|
545
|
+
return typeof o == "object" && o !== null ? r.message = He(o) : o && (r.message = String(o)), s !== void 0 && s !== "" && (r.link = s), n !== void 0 && n !== "" && (r.code = n), t !== void 0 && t !== "" && (r.cause = t), r;
|
|
546
|
+
}, Xe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
52
547
|
__proto__: null,
|
|
53
|
-
EErrorTypes:
|
|
54
|
-
getLinkError:
|
|
55
|
-
getTypeFromError:
|
|
56
|
-
getValuesFromError:
|
|
57
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
58
|
-
sessionId:
|
|
59
|
-
remoteAddress:
|
|
548
|
+
EErrorTypes: re,
|
|
549
|
+
getLinkError: V,
|
|
550
|
+
getTypeFromError: Le,
|
|
551
|
+
getValuesFromError: Je
|
|
552
|
+
}, Symbol.toStringTag, { value: "Module" })), We = ({
|
|
553
|
+
sessionId: e,
|
|
554
|
+
remoteAddress: n,
|
|
60
555
|
isMutedAudio: t,
|
|
61
|
-
isMutedVideo:
|
|
62
|
-
isRegistered:
|
|
556
|
+
isMutedVideo: o,
|
|
557
|
+
isRegistered: s,
|
|
63
558
|
isPresentationCall: r
|
|
64
559
|
}) => {
|
|
65
|
-
const
|
|
66
|
-
return
|
|
67
|
-
},
|
|
68
|
-
let
|
|
69
|
-
return
|
|
70
|
-
},
|
|
71
|
-
appName:
|
|
72
|
-
appVersion:
|
|
560
|
+
const c = [], a = t ? "0" : "1", u = o ? "0" : "1";
|
|
561
|
+
return c.push(`X-Vinteo-Mic-State: ${a}`, `X-Vinteo-MainCam-State: ${u}`), (s === !1 || s === void 0) && c.push("X-Vinteo-Purgatory-Call: yes"), e !== void 0 && e !== "" && c.push(`X-Vinteo-Session: ${e}`), r === !0 && c.push("X-Vinteo-Presentation-Call: yes"), n !== void 0 && n !== "" && c.push(`X-Vinteo-Remote: ${n}`), c;
|
|
562
|
+
}, je = "[@*!|]", Ge = "_", Ke = (e) => {
|
|
563
|
+
let n = e;
|
|
564
|
+
return n = n.replaceAll(new RegExp(je, "g"), Ge), n;
|
|
565
|
+
}, Ye = ({
|
|
566
|
+
appName: e,
|
|
567
|
+
appVersion: n,
|
|
73
568
|
browserName: t,
|
|
74
|
-
browserVersion:
|
|
569
|
+
browserVersion: o
|
|
75
570
|
}) => {
|
|
76
|
-
const r = `${
|
|
77
|
-
return `ChromeNew - ${t ? `${t} ${
|
|
78
|
-
},
|
|
79
|
-
isUnifiedSdpSemantic:
|
|
80
|
-
appVersion:
|
|
571
|
+
const r = `${Ke(e)} ${n}`;
|
|
572
|
+
return `ChromeNew - ${t === void 0 ? r : `${t} ${o}, ${r}`}`;
|
|
573
|
+
}, qe = ({
|
|
574
|
+
isUnifiedSdpSemantic: e,
|
|
575
|
+
appVersion: n,
|
|
81
576
|
browserName: t,
|
|
82
|
-
browserVersion:
|
|
83
|
-
appName:
|
|
84
|
-
}) =>
|
|
85
|
-
accumulatedKeys:
|
|
86
|
-
sendKey:
|
|
577
|
+
browserVersion: o,
|
|
578
|
+
appName: s
|
|
579
|
+
}) => e ? Ye({ appVersion: n, browserName: t, browserVersion: o, appName: s }) : "Chrome", ze = (e) => (n) => [...n].map((o) => async () => e(o)), Qe = async ({
|
|
580
|
+
accumulatedKeys: e,
|
|
581
|
+
sendKey: n,
|
|
87
582
|
canRunTask: t
|
|
88
583
|
}) => {
|
|
89
|
-
const
|
|
90
|
-
return
|
|
91
|
-
},
|
|
92
|
-
const
|
|
93
|
-
if (
|
|
94
|
-
|
|
584
|
+
const s = ze(n)(e);
|
|
585
|
+
return le(s, t);
|
|
586
|
+
}, Ze = (e) => (t) => (i("onStartMainCam"), e.on("api:admin-start-main-cam", t)), en = (e) => (t) => (i("onStartMic"), e.on("api:admin-start-mic", t)), nn = (e) => (t) => (i("onStopMainCam"), e.on("api:admin-stop-main-cam", t)), tn = (e) => (t) => (i("onStopMic"), e.on("api:admin-stop-mic", t)), on = ({ sipConnector: e }) => {
|
|
587
|
+
const n = (g, R) => ({ isSyncForced: C }) => {
|
|
588
|
+
if (C === !0) {
|
|
589
|
+
g();
|
|
95
590
|
return;
|
|
96
591
|
}
|
|
97
|
-
|
|
98
|
-
}, t =
|
|
99
|
-
let
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
onStartMicForced: y,
|
|
110
|
-
onStartMicNotForced: T,
|
|
111
|
-
onStopMicForced: E,
|
|
112
|
-
onStopMicNotForced: M
|
|
592
|
+
R();
|
|
593
|
+
}, t = Ze(e), o = nn(e), s = en(e), r = tn(e);
|
|
594
|
+
let c, a, u, l;
|
|
595
|
+
const h = ({
|
|
596
|
+
onStartMainCamForced: g,
|
|
597
|
+
onStartMainCamNotForced: R,
|
|
598
|
+
onStopMainCamForced: C,
|
|
599
|
+
onStopMainCamNotForced: S,
|
|
600
|
+
onStartMicForced: p,
|
|
601
|
+
onStartMicNotForced: E,
|
|
602
|
+
onStopMicForced: T,
|
|
603
|
+
onStopMicNotForced: v
|
|
113
604
|
}) => {
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
605
|
+
const _ = n(
|
|
606
|
+
g,
|
|
607
|
+
R
|
|
117
608
|
);
|
|
118
|
-
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
609
|
+
c = t(_);
|
|
610
|
+
const A = n(
|
|
611
|
+
C,
|
|
612
|
+
S
|
|
122
613
|
);
|
|
123
|
-
|
|
124
|
-
const O =
|
|
125
|
-
|
|
126
|
-
const N =
|
|
127
|
-
|
|
128
|
-
},
|
|
129
|
-
|
|
614
|
+
a = o(A);
|
|
615
|
+
const O = n(p, E);
|
|
616
|
+
u = s(O);
|
|
617
|
+
const N = n(T, v);
|
|
618
|
+
l = r(N);
|
|
619
|
+
}, f = () => {
|
|
620
|
+
c?.(), a?.(), u?.(), l?.();
|
|
130
621
|
};
|
|
131
622
|
return {
|
|
132
|
-
start: (
|
|
133
|
-
|
|
623
|
+
start: (g) => {
|
|
624
|
+
h(g);
|
|
134
625
|
},
|
|
135
626
|
stop: () => {
|
|
136
|
-
|
|
627
|
+
f();
|
|
137
628
|
}
|
|
138
629
|
};
|
|
139
|
-
},
|
|
630
|
+
}, _n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
140
631
|
__proto__: null,
|
|
141
|
-
PURGATORY_CONFERENCE_NUMBER:
|
|
142
|
-
createSyncMediaState:
|
|
143
|
-
error:
|
|
144
|
-
getExtraHeaders:
|
|
145
|
-
getUserAgent:
|
|
146
|
-
hasPurgatory:
|
|
147
|
-
sendDtmfAccumulated:
|
|
148
|
-
}, Symbol.toStringTag, { value: "Module" }))
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
c("videoSendingBalancer: error", n);
|
|
166
|
-
}), Ke = async (n) => (te.add(n), Ge()), j = async ({
|
|
167
|
-
sender: n,
|
|
168
|
-
scaleResolutionDownBy: e,
|
|
632
|
+
PURGATORY_CONFERENCE_NUMBER: se,
|
|
633
|
+
createSyncMediaState: on,
|
|
634
|
+
error: Xe,
|
|
635
|
+
getExtraHeaders: We,
|
|
636
|
+
getUserAgent: qe,
|
|
637
|
+
hasPurgatory: I,
|
|
638
|
+
sendDtmfAccumulated: Qe
|
|
639
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
640
|
+
var sn = /* @__PURE__ */ ((e) => (e.VP8 = "video/VP8", e.VP9 = "video/VP9", e.H264 = "video/H264", e.AV1 = "video/AV1", e.rtx = "video/rtx", e.red = "video/red", e.flexfec03 = "video/flexfec-03", e))(sn || {});
|
|
641
|
+
const rn = (e) => [...e.keys()].map((n) => e.get(n)), cn = (e, n) => rn(e).find((t) => t?.type === n), an = async (e) => e.getStats().then((n) => cn(n, "codec")?.mimeType), un = (e) => e.find((n) => n.track?.kind === "video"), dn = async (e, n, t) => {
|
|
642
|
+
const { isChanged: o, parameters: s } = await Q(e, {
|
|
643
|
+
encodings: [
|
|
644
|
+
{
|
|
645
|
+
scaleResolutionDownBy: n.scaleResolutionDownBy,
|
|
646
|
+
maxBitrate: n.maxBitrate
|
|
647
|
+
}
|
|
648
|
+
]
|
|
649
|
+
});
|
|
650
|
+
return o && t && t(s), { isChanged: o, parameters: s };
|
|
651
|
+
}, ie = fe(), ln = async () => ie().catch((e) => {
|
|
652
|
+
i("videoSendingBalancer: error", e);
|
|
653
|
+
}), fn = async (e) => (ie.add(e), ln()), j = async ({
|
|
654
|
+
sender: e,
|
|
655
|
+
scaleResolutionDownBy: n,
|
|
169
656
|
maxBitrate: t,
|
|
170
|
-
onSetParameters:
|
|
171
|
-
}) =>
|
|
172
|
-
const
|
|
657
|
+
onSetParameters: o
|
|
658
|
+
}) => fn(async () => dn(e, { scaleResolutionDownBy: n, maxBitrate: t }, o)), hn = async ({ sender: e, codec: n }, t) => {
|
|
659
|
+
const s = Be(n);
|
|
173
660
|
return j({
|
|
174
|
-
sender:
|
|
175
|
-
maxBitrate:
|
|
661
|
+
sender: e,
|
|
662
|
+
maxBitrate: s,
|
|
176
663
|
onSetParameters: t,
|
|
177
664
|
scaleResolutionDownBy: 200
|
|
178
665
|
});
|
|
179
|
-
},
|
|
180
|
-
sender:
|
|
181
|
-
videoTrack:
|
|
666
|
+
}, k = async ({
|
|
667
|
+
sender: e,
|
|
668
|
+
videoTrack: n,
|
|
182
669
|
codec: t
|
|
183
|
-
},
|
|
184
|
-
const
|
|
670
|
+
}, o) => {
|
|
671
|
+
const c = n.getSettings().width, a = c === void 0 ? we(t) : te(c, t);
|
|
185
672
|
return j({
|
|
186
|
-
sender:
|
|
187
|
-
maxBitrate:
|
|
188
|
-
onSetParameters:
|
|
673
|
+
sender: e,
|
|
674
|
+
maxBitrate: a,
|
|
675
|
+
onSetParameters: o,
|
|
189
676
|
scaleResolutionDownBy: 1
|
|
190
677
|
});
|
|
191
|
-
},
|
|
192
|
-
sender:
|
|
193
|
-
videoTrack:
|
|
678
|
+
}, gn = async ({
|
|
679
|
+
sender: e,
|
|
680
|
+
videoTrack: n,
|
|
194
681
|
resolution: t,
|
|
195
|
-
codec:
|
|
196
|
-
},
|
|
197
|
-
const [r,
|
|
198
|
-
videoTrack:
|
|
199
|
-
codec:
|
|
682
|
+
codec: o
|
|
683
|
+
}, s) => {
|
|
684
|
+
const [r, c] = t.split("x"), { maxBitrate: a, scaleResolutionDownBy: u } = oe({
|
|
685
|
+
videoTrack: n,
|
|
686
|
+
codec: o,
|
|
200
687
|
targetSize: {
|
|
201
688
|
width: Number(r),
|
|
202
|
-
height: Number(
|
|
689
|
+
height: Number(c)
|
|
203
690
|
}
|
|
204
691
|
});
|
|
205
692
|
return j({
|
|
206
|
-
sender:
|
|
207
|
-
maxBitrate:
|
|
208
|
-
onSetParameters:
|
|
209
|
-
scaleResolutionDownBy:
|
|
693
|
+
sender: e,
|
|
694
|
+
maxBitrate: a,
|
|
695
|
+
onSetParameters: s,
|
|
696
|
+
scaleResolutionDownBy: u
|
|
210
697
|
});
|
|
211
|
-
},
|
|
212
|
-
mainCam:
|
|
213
|
-
resolutionMainCam:
|
|
698
|
+
}, Cn = async ({
|
|
699
|
+
mainCam: e,
|
|
700
|
+
resolutionMainCam: n,
|
|
214
701
|
sender: t,
|
|
215
|
-
videoTrack:
|
|
216
|
-
codec:
|
|
702
|
+
videoTrack: o,
|
|
703
|
+
codec: s
|
|
217
704
|
}, r) => {
|
|
218
|
-
switch (
|
|
219
|
-
case
|
|
220
|
-
return
|
|
221
|
-
case
|
|
222
|
-
return
|
|
223
|
-
case
|
|
224
|
-
return
|
|
225
|
-
{ sender: t, videoTrack:
|
|
705
|
+
switch (e) {
|
|
706
|
+
case w.PAUSE_MAIN_CAM:
|
|
707
|
+
return hn({ sender: t, codec: s }, r);
|
|
708
|
+
case w.RESUME_MAIN_CAM:
|
|
709
|
+
return k({ sender: t, videoTrack: o, codec: s }, r);
|
|
710
|
+
case w.MAX_MAIN_CAM_RESOLUTION:
|
|
711
|
+
return n !== void 0 ? gn(
|
|
712
|
+
{ sender: t, videoTrack: o, codec: s, resolution: n },
|
|
226
713
|
r
|
|
227
|
-
) :
|
|
228
|
-
case
|
|
229
|
-
case
|
|
714
|
+
) : k({ sender: t, videoTrack: o, codec: s }, r);
|
|
715
|
+
case w.ADMIN_STOP_MAIN_CAM:
|
|
716
|
+
case w.ADMIN_START_MAIN_CAM:
|
|
230
717
|
case void 0:
|
|
231
|
-
return
|
|
718
|
+
return k({ sender: t, videoTrack: o, codec: s }, r);
|
|
232
719
|
default:
|
|
233
|
-
return
|
|
720
|
+
return k({ sender: t, videoTrack: o, codec: s }, r);
|
|
234
721
|
}
|
|
235
|
-
},
|
|
722
|
+
}, G = {
|
|
236
723
|
isChanged: !1,
|
|
237
724
|
parameters: {
|
|
238
725
|
encodings: [{}],
|
|
@@ -241,525 +728,85 @@ const me = new Error("Unknown error"), he = (n = me) => {
|
|
|
241
728
|
headerExtensions: [],
|
|
242
729
|
rtcp: {}
|
|
243
730
|
}
|
|
244
|
-
},
|
|
245
|
-
mainCam:
|
|
246
|
-
resolutionMainCam:
|
|
731
|
+
}, K = async ({
|
|
732
|
+
mainCam: e,
|
|
733
|
+
resolutionMainCam: n,
|
|
247
734
|
connection: t,
|
|
248
|
-
onSetParameters:
|
|
249
|
-
ignoreForCodec:
|
|
735
|
+
onSetParameters: o,
|
|
736
|
+
ignoreForCodec: s
|
|
250
737
|
}) => {
|
|
251
|
-
const r = t.getSenders(),
|
|
252
|
-
if (!
|
|
253
|
-
return
|
|
254
|
-
const
|
|
255
|
-
return
|
|
738
|
+
const r = t.getSenders(), c = un(r);
|
|
739
|
+
if (!c?.track)
|
|
740
|
+
return G;
|
|
741
|
+
const a = await an(c);
|
|
742
|
+
return ne(a, s) ? G : Cn(
|
|
256
743
|
{
|
|
257
|
-
mainCam:
|
|
258
|
-
resolutionMainCam:
|
|
259
|
-
sender:
|
|
260
|
-
codec:
|
|
261
|
-
videoTrack:
|
|
744
|
+
mainCam: e,
|
|
745
|
+
resolutionMainCam: n,
|
|
746
|
+
sender: c,
|
|
747
|
+
codec: a,
|
|
748
|
+
videoTrack: c.track
|
|
262
749
|
},
|
|
263
|
-
|
|
750
|
+
o
|
|
264
751
|
);
|
|
265
|
-
},
|
|
266
|
-
ignoreForCodec:
|
|
752
|
+
}, An = (e, {
|
|
753
|
+
ignoreForCodec: n,
|
|
267
754
|
onSetParameters: t
|
|
268
755
|
} = {}) => {
|
|
269
|
-
const
|
|
270
|
-
const { connection:
|
|
271
|
-
if (!
|
|
756
|
+
const o = async () => {
|
|
757
|
+
const { connection: u } = e;
|
|
758
|
+
if (!u)
|
|
272
759
|
throw new Error("connection is not exist");
|
|
273
|
-
return
|
|
274
|
-
connection:
|
|
760
|
+
return K({
|
|
761
|
+
connection: u,
|
|
275
762
|
onSetParameters: t,
|
|
276
|
-
ignoreForCodec:
|
|
763
|
+
ignoreForCodec: n
|
|
277
764
|
});
|
|
278
765
|
};
|
|
279
|
-
let
|
|
280
|
-
const r = (
|
|
281
|
-
|
|
282
|
-
const { mainCam:
|
|
283
|
-
if (!
|
|
766
|
+
let s = o;
|
|
767
|
+
const r = (u) => {
|
|
768
|
+
s = async () => {
|
|
769
|
+
const { mainCam: l, resolutionMainCam: h } = u, { connection: f } = e;
|
|
770
|
+
if (!f)
|
|
284
771
|
throw new Error("connection is not exist");
|
|
285
|
-
return
|
|
286
|
-
mainCam:
|
|
287
|
-
resolutionMainCam:
|
|
288
|
-
connection:
|
|
772
|
+
return K({
|
|
773
|
+
mainCam: l,
|
|
774
|
+
resolutionMainCam: h,
|
|
775
|
+
connection: f,
|
|
289
776
|
onSetParameters: t,
|
|
290
|
-
ignoreForCodec:
|
|
777
|
+
ignoreForCodec: n
|
|
291
778
|
});
|
|
292
|
-
},
|
|
779
|
+
}, s().catch(x);
|
|
293
780
|
};
|
|
294
781
|
return {
|
|
295
782
|
subscribe: () => {
|
|
296
|
-
|
|
783
|
+
e.on("api:main-cam-control", r);
|
|
297
784
|
},
|
|
298
785
|
unsubscribe: () => {
|
|
299
|
-
|
|
786
|
+
e.off("api:main-cam-control", r);
|
|
300
787
|
},
|
|
301
|
-
balanceByTrack:
|
|
788
|
+
balanceByTrack: o,
|
|
302
789
|
resetMainCamControl() {
|
|
303
|
-
|
|
790
|
+
s = o;
|
|
304
791
|
},
|
|
305
792
|
async reBalance() {
|
|
306
|
-
return
|
|
793
|
+
return s();
|
|
307
794
|
}
|
|
308
795
|
};
|
|
309
|
-
}
|
|
310
|
-
mediaStream: n,
|
|
311
|
-
simulcastEncodings: e,
|
|
312
|
-
sendEncodings: t
|
|
313
|
-
}) => {
|
|
314
|
-
if (e && e.length > 0) {
|
|
315
|
-
const s = t ?? [], o = Qe(n);
|
|
316
|
-
if (o === void 0)
|
|
317
|
-
throw new Error("No video track");
|
|
318
|
-
return e.forEach((r, i) => {
|
|
319
|
-
const u = s[i] ?? {};
|
|
320
|
-
u.active = !0, r.rid !== void 0 && (u.rid = r.rid), r.scalabilityMode !== void 0 && (u.scalabilityMode = r.scalabilityMode);
|
|
321
|
-
const { maxBitrate: d, scaleResolutionDownBy: C } = ne({
|
|
322
|
-
videoTrack: o,
|
|
323
|
-
targetSize: {
|
|
324
|
-
width: r.width,
|
|
325
|
-
height: r.height
|
|
326
|
-
}
|
|
327
|
-
});
|
|
328
|
-
u.maxBitrate = d, u.scaleResolutionDownBy = C, s[i] = u;
|
|
329
|
-
}), s;
|
|
330
|
-
}
|
|
331
|
-
return t;
|
|
332
|
-
}, Je = (n, e) => n.filter((s) => e.some((o) => o.clockRate === s.clockRate && o.mimeType === s.mimeType && o.channels === s.channels && o.sdpFmtpLine === s.sdpFmtpLine)), Ze = (n) => {
|
|
333
|
-
const e = RTCRtpSender.getCapabilities(n), t = RTCRtpReceiver.getCapabilities(n), s = e === null ? [] : e.codecs, o = t === null ? [] : t.codecs;
|
|
334
|
-
return Je(s, o);
|
|
335
|
-
}, en = (n, e) => e === void 0 || e.length === 0 ? n : n.sort((t, s) => {
|
|
336
|
-
const o = e.indexOf(t.mimeType), r = e.indexOf(s.mimeType), i = o === -1 ? Number.MAX_VALUE : o, u = r === -1 ? Number.MAX_VALUE : r;
|
|
337
|
-
return i - u;
|
|
338
|
-
}), nn = (n, e) => e === void 0 || e.length === 0 ? n : n.filter((t) => !e.includes(t.mimeType)), I = (n, {
|
|
339
|
-
preferredMimeTypesVideoCodecs: e,
|
|
340
|
-
excludeMimeTypesVideoCodecs: t
|
|
341
|
-
}) => async (s) => {
|
|
342
|
-
var o;
|
|
343
|
-
try {
|
|
344
|
-
if (typeof s.setCodecPreferences == "function" && ((o = s.sender.track) == null ? void 0 : o.kind) === "video" && (e !== void 0 && e.length > 0 || t !== void 0 && t.length > 0)) {
|
|
345
|
-
const r = Ze("video"), i = nn(r, t), u = en(i, e);
|
|
346
|
-
s.setCodecPreferences(u);
|
|
347
|
-
}
|
|
348
|
-
Object.keys(n).length > 0 && await ce(s.sender, n);
|
|
349
|
-
} catch (r) {
|
|
350
|
-
c("updateTransceiver error", r);
|
|
351
|
-
}
|
|
352
|
-
}, X = (n) => {
|
|
353
|
-
if (!Ce(n) && !Se(n))
|
|
354
|
-
throw n;
|
|
355
|
-
return { isSuccessful: !1 };
|
|
356
|
-
}, tn = ({ kind: n, readyState: e }) => n === "video" && e === "live", sn = /* @__PURE__ */ new Set([
|
|
357
|
-
"on",
|
|
358
|
-
"once",
|
|
359
|
-
"onceRace",
|
|
360
|
-
"wait",
|
|
361
|
-
"off",
|
|
362
|
-
"onSession",
|
|
363
|
-
"onceSession",
|
|
364
|
-
"onceRaceSession",
|
|
365
|
-
"waitSession",
|
|
366
|
-
"offSession",
|
|
367
|
-
"sendDTMF",
|
|
368
|
-
"hangUp",
|
|
369
|
-
"declineToIncomingCall",
|
|
370
|
-
"sendChannels",
|
|
371
|
-
"checkTelephony",
|
|
372
|
-
"waitChannels",
|
|
373
|
-
"ping",
|
|
374
|
-
"connection",
|
|
375
|
-
"isConfigured",
|
|
376
|
-
"isRegistered"
|
|
377
|
-
]);
|
|
378
|
-
class mn {
|
|
379
|
-
constructor(e, {
|
|
380
|
-
preferredMimeTypesVideoCodecs: t,
|
|
381
|
-
excludeMimeTypesVideoCodecs: s
|
|
382
|
-
} = {}) {
|
|
383
|
-
// @ts-expect-error: proxy method
|
|
384
|
-
a(this, "on");
|
|
385
|
-
// @ts-expect-error: proxy method
|
|
386
|
-
a(this, "once");
|
|
387
|
-
// @ts-expect-error: proxy method
|
|
388
|
-
a(this, "onceRace");
|
|
389
|
-
// @ts-expect-error: proxy method
|
|
390
|
-
a(this, "wait");
|
|
391
|
-
// @ts-expect-error: proxy method
|
|
392
|
-
a(this, "off");
|
|
393
|
-
// @ts-expect-error: proxy method
|
|
394
|
-
a(this, "onSession");
|
|
395
|
-
// @ts-expect-error: proxy method
|
|
396
|
-
a(this, "onceSession");
|
|
397
|
-
// @ts-expect-error: proxy method
|
|
398
|
-
a(this, "onceRaceSession");
|
|
399
|
-
// @ts-expect-error: proxy method
|
|
400
|
-
a(this, "waitSession");
|
|
401
|
-
// @ts-expect-error: proxy method
|
|
402
|
-
a(this, "offSession");
|
|
403
|
-
// @ts-expect-error: proxy method
|
|
404
|
-
a(this, "sendDTMF");
|
|
405
|
-
// @ts-expect-error: proxy method
|
|
406
|
-
a(this, "hangUp");
|
|
407
|
-
// @ts-expect-error: proxy method
|
|
408
|
-
a(this, "declineToIncomingCall");
|
|
409
|
-
// @ts-expect-error: proxy method
|
|
410
|
-
a(this, "sendChannels");
|
|
411
|
-
// @ts-expect-error: proxy method
|
|
412
|
-
a(this, "checkTelephony");
|
|
413
|
-
// @ts-expect-error: proxy method
|
|
414
|
-
a(this, "waitChannels");
|
|
415
|
-
// @ts-expect-error: proxy method
|
|
416
|
-
a(this, "ping");
|
|
417
|
-
// proxy method
|
|
418
|
-
a(this, "connection");
|
|
419
|
-
// @ts-expect-error: proxy method
|
|
420
|
-
a(this, "isConfigured");
|
|
421
|
-
// @ts-expect-error: proxy method
|
|
422
|
-
a(this, "isRegistered");
|
|
423
|
-
a(this, "sipConnector");
|
|
424
|
-
a(this, "preferredMimeTypesVideoCodecs");
|
|
425
|
-
a(this, "excludeMimeTypesVideoCodecs");
|
|
426
|
-
a(this, "connectToServer", async (e) => {
|
|
427
|
-
const {
|
|
428
|
-
userAgent: t,
|
|
429
|
-
sipWebSocketServerURL: s,
|
|
430
|
-
sipServerUrl: o,
|
|
431
|
-
remoteAddress: r,
|
|
432
|
-
displayName: i,
|
|
433
|
-
name: u,
|
|
434
|
-
password: d,
|
|
435
|
-
isRegisteredUser: C,
|
|
436
|
-
isDisconnectOnFail: f
|
|
437
|
-
} = e;
|
|
438
|
-
return c("connectToServer", e), this.sipConnector.connect({
|
|
439
|
-
userAgent: t,
|
|
440
|
-
sipWebSocketServerURL: s,
|
|
441
|
-
sipServerUrl: o,
|
|
442
|
-
remoteAddress: r,
|
|
443
|
-
displayName: i,
|
|
444
|
-
password: d,
|
|
445
|
-
user: u,
|
|
446
|
-
register: C
|
|
447
|
-
}).then((S) => (c("connectToServer then"), { ua: S, isSuccessful: !0 })).catch(async (S) => (c("connectToServer catch: error", S), f === !0 ? this.sipConnector.disconnect().then(() => X(S)).catch(() => X(S)) : X(S)));
|
|
448
|
-
});
|
|
449
|
-
a(this, "callToServer", async (e) => {
|
|
450
|
-
const {
|
|
451
|
-
conference: t,
|
|
452
|
-
mediaStream: s,
|
|
453
|
-
extraHeaders: o,
|
|
454
|
-
iceServers: r,
|
|
455
|
-
contentHint: i,
|
|
456
|
-
simulcastEncodings: u,
|
|
457
|
-
degradationPreference: d,
|
|
458
|
-
sendEncodings: C,
|
|
459
|
-
offerToReceiveAudio: f,
|
|
460
|
-
offerToReceiveVideo: S,
|
|
461
|
-
directionVideo: F,
|
|
462
|
-
directionAudio: V,
|
|
463
|
-
setRemoteStreams: m,
|
|
464
|
-
onBeforeProgressCall: g,
|
|
465
|
-
onSuccessProgressCall: h,
|
|
466
|
-
onEnterPurgatory: p,
|
|
467
|
-
onEnterConference: y,
|
|
468
|
-
onFailProgressCall: T,
|
|
469
|
-
onFinishProgressCall: E,
|
|
470
|
-
onEndedCall: M
|
|
471
|
-
} = e, A = this.resolveHandleReadyRemoteStreamsDebounced({
|
|
472
|
-
onReadyRemoteStreams: m
|
|
473
|
-
}), v = this.resolveHandleReadyRemoteStreams({
|
|
474
|
-
onReadyRemoteStreams: () => {
|
|
475
|
-
A().catch(D);
|
|
476
|
-
}
|
|
477
|
-
}), O = I(
|
|
478
|
-
{
|
|
479
|
-
degradationPreference: d
|
|
480
|
-
},
|
|
481
|
-
{
|
|
482
|
-
preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
|
|
483
|
-
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
484
|
-
}
|
|
485
|
-
);
|
|
486
|
-
c("callToServer", e);
|
|
487
|
-
const N = async () => (c("startCall"), this.sipConnector.call({
|
|
488
|
-
mediaStream: s,
|
|
489
|
-
extraHeaders: o,
|
|
490
|
-
iceServers: r,
|
|
491
|
-
contentHint: i,
|
|
492
|
-
offerToReceiveAudio: f,
|
|
493
|
-
offerToReceiveVideo: S,
|
|
494
|
-
directionVideo: F,
|
|
495
|
-
directionAudio: V,
|
|
496
|
-
sendEncodings: P({
|
|
497
|
-
mediaStream: s,
|
|
498
|
-
simulcastEncodings: u,
|
|
499
|
-
sendEncodings: C
|
|
500
|
-
}),
|
|
501
|
-
number: t,
|
|
502
|
-
onAddedTransceiver: O,
|
|
503
|
-
ontrack: v
|
|
504
|
-
}));
|
|
505
|
-
let b = !1, _;
|
|
506
|
-
const w = (c("subscribeEnterConference: onEnterConference", y), p ?? y ? this.sipConnector.onSession("enterRoom", ({ room: l }) => {
|
|
507
|
-
c("enterRoom", { _room: l, isSuccessProgressCall: b }), _ = l, k(_) ? p && p() : y && y({ isSuccessProgressCall: b });
|
|
508
|
-
}) : () => {
|
|
509
|
-
}), L = (l) => (c("onSuccess"), b = !0, A().catch(D), h && h({ isPurgatory: k(_) }), this.sipConnector.onceRaceSession(["ended", "failed"], () => {
|
|
510
|
-
w(), M && M();
|
|
511
|
-
}), l), $ = (l) => {
|
|
512
|
-
throw c("onFail"), T && T(), w(), l;
|
|
513
|
-
}, H = () => {
|
|
514
|
-
c("onFinish"), E && E();
|
|
515
|
-
};
|
|
516
|
-
return c("onBeforeProgressCall"), g && g(t), N().then(L).catch((l) => $(l)).finally(H);
|
|
517
|
-
});
|
|
518
|
-
a(this, "disconnectFromServer", async () => this.sipConnector.disconnect().then(() => (c("disconnectFromServer: then"), { isSuccessful: !0 })).catch((e) => (c("disconnectFromServer: catch", e), { isSuccessful: !1 })));
|
|
519
|
-
a(this, "answerIncomingCall", async (e) => {
|
|
520
|
-
const {
|
|
521
|
-
mediaStream: t,
|
|
522
|
-
extraHeaders: s,
|
|
523
|
-
iceServers: o,
|
|
524
|
-
contentHint: r,
|
|
525
|
-
simulcastEncodings: i,
|
|
526
|
-
degradationPreference: u,
|
|
527
|
-
sendEncodings: d,
|
|
528
|
-
offerToReceiveAudio: C,
|
|
529
|
-
offerToReceiveVideo: f,
|
|
530
|
-
directionVideo: S,
|
|
531
|
-
directionAudio: F,
|
|
532
|
-
setRemoteStreams: V,
|
|
533
|
-
onBeforeProgressCall: m,
|
|
534
|
-
onSuccessProgressCall: g,
|
|
535
|
-
onEnterPurgatory: h,
|
|
536
|
-
onEnterConference: p,
|
|
537
|
-
onFailProgressCall: y,
|
|
538
|
-
onFinishProgressCall: T,
|
|
539
|
-
onEndedCall: E
|
|
540
|
-
} = e, M = this.resolveHandleReadyRemoteStreamsDebounced({
|
|
541
|
-
onReadyRemoteStreams: V
|
|
542
|
-
}), A = this.resolveHandleReadyRemoteStreams({
|
|
543
|
-
onReadyRemoteStreams: () => {
|
|
544
|
-
M().catch(D);
|
|
545
|
-
}
|
|
546
|
-
}), v = I(
|
|
547
|
-
{
|
|
548
|
-
degradationPreference: u
|
|
549
|
-
},
|
|
550
|
-
{
|
|
551
|
-
preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
|
|
552
|
-
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
553
|
-
}
|
|
554
|
-
);
|
|
555
|
-
c("answerIncomingCall", e);
|
|
556
|
-
const O = async () => this.sipConnector.answerToIncomingCall({
|
|
557
|
-
mediaStream: t,
|
|
558
|
-
extraHeaders: s,
|
|
559
|
-
iceServers: o,
|
|
560
|
-
contentHint: r,
|
|
561
|
-
offerToReceiveAudio: C,
|
|
562
|
-
offerToReceiveVideo: f,
|
|
563
|
-
directionVideo: S,
|
|
564
|
-
directionAudio: F,
|
|
565
|
-
sendEncodings: P({
|
|
566
|
-
mediaStream: t,
|
|
567
|
-
simulcastEncodings: i,
|
|
568
|
-
sendEncodings: d
|
|
569
|
-
}),
|
|
570
|
-
onAddedTransceiver: v,
|
|
571
|
-
ontrack: A
|
|
572
|
-
}), N = () => {
|
|
573
|
-
const { remoteCallerData: l } = this.sipConnector;
|
|
574
|
-
return l.incomingNumber;
|
|
575
|
-
};
|
|
576
|
-
let b = !1, _;
|
|
577
|
-
const w = (c("subscribeEnterConference: onEnterConference", p), h ?? p ? this.sipConnector.onSession("enterRoom", (l) => {
|
|
578
|
-
c("enterRoom", { _room: l, isSuccessProgressCall: b }), _ = l, k(_) ? h && h() : p && p({ isSuccessProgressCall: b });
|
|
579
|
-
}) : () => {
|
|
580
|
-
}), L = (l) => (c("onSuccess"), b = !0, M().catch(D), g && g({ isPurgatory: k(_) }), this.sipConnector.onceRaceSession(["ended", "failed"], () => {
|
|
581
|
-
w(), E && E();
|
|
582
|
-
}), l), $ = (l) => {
|
|
583
|
-
throw c("onFail"), y && y(), w(), l;
|
|
584
|
-
}, H = () => {
|
|
585
|
-
c("onFinish"), T && T();
|
|
586
|
-
};
|
|
587
|
-
if (c("onBeforeProgressCall"), m) {
|
|
588
|
-
const l = N();
|
|
589
|
-
m(l);
|
|
590
|
-
}
|
|
591
|
-
return O().then(L).catch((l) => $(l)).finally(H);
|
|
592
|
-
});
|
|
593
|
-
a(this, "updatePresentation", async ({
|
|
594
|
-
mediaStream: e,
|
|
595
|
-
isP2P: t,
|
|
596
|
-
maxBitrate: s,
|
|
597
|
-
contentHint: o,
|
|
598
|
-
simulcastEncodings: r,
|
|
599
|
-
degradationPreference: i,
|
|
600
|
-
sendEncodings: u,
|
|
601
|
-
preferredMimeTypesVideoCodecs: d,
|
|
602
|
-
excludeMimeTypesVideoCodecs: C
|
|
603
|
-
}) => {
|
|
604
|
-
const f = I(
|
|
605
|
-
{
|
|
606
|
-
degradationPreference: i
|
|
607
|
-
},
|
|
608
|
-
{
|
|
609
|
-
preferredMimeTypesVideoCodecs: d,
|
|
610
|
-
excludeMimeTypesVideoCodecs: C
|
|
611
|
-
}
|
|
612
|
-
);
|
|
613
|
-
return c("updatePresentation"), this.sipConnector.updatePresentation(e, {
|
|
614
|
-
isP2P: t,
|
|
615
|
-
maxBitrate: s,
|
|
616
|
-
contentHint: o,
|
|
617
|
-
sendEncodings: P({
|
|
618
|
-
mediaStream: e,
|
|
619
|
-
simulcastEncodings: r,
|
|
620
|
-
sendEncodings: u
|
|
621
|
-
}),
|
|
622
|
-
onAddedTransceiver: f
|
|
623
|
-
});
|
|
624
|
-
});
|
|
625
|
-
a(this, "startPresentation", async ({
|
|
626
|
-
mediaStream: e,
|
|
627
|
-
isP2P: t,
|
|
628
|
-
maxBitrate: s,
|
|
629
|
-
contentHint: o,
|
|
630
|
-
simulcastEncodings: r,
|
|
631
|
-
degradationPreference: i,
|
|
632
|
-
sendEncodings: u,
|
|
633
|
-
preferredMimeTypesVideoCodecs: d,
|
|
634
|
-
excludeMimeTypesVideoCodecs: C
|
|
635
|
-
}, f) => {
|
|
636
|
-
const S = I(
|
|
637
|
-
{
|
|
638
|
-
degradationPreference: i
|
|
639
|
-
},
|
|
640
|
-
{
|
|
641
|
-
preferredMimeTypesVideoCodecs: d,
|
|
642
|
-
excludeMimeTypesVideoCodecs: C
|
|
643
|
-
}
|
|
644
|
-
);
|
|
645
|
-
return c("startPresentation"), this.sipConnector.startPresentation(
|
|
646
|
-
e,
|
|
647
|
-
{
|
|
648
|
-
isP2P: t,
|
|
649
|
-
maxBitrate: s,
|
|
650
|
-
contentHint: o,
|
|
651
|
-
sendEncodings: P({
|
|
652
|
-
mediaStream: e,
|
|
653
|
-
simulcastEncodings: r,
|
|
654
|
-
sendEncodings: u
|
|
655
|
-
}),
|
|
656
|
-
onAddedTransceiver: S
|
|
657
|
-
},
|
|
658
|
-
f
|
|
659
|
-
);
|
|
660
|
-
});
|
|
661
|
-
a(this, "stopShareSipConnector", async ({ isP2P: e = !1 } = {}) => (c("stopShareSipConnector"), this.sipConnector.stopPresentation({
|
|
662
|
-
isP2P: e
|
|
663
|
-
}).catch((t) => {
|
|
664
|
-
c(t);
|
|
665
|
-
})));
|
|
666
|
-
a(this, "sendRefusalToTurnOnMic", async () => {
|
|
667
|
-
this.sipConnector.isCallActive && (c("sendRefusalToTurnOnMic"), await this.sipConnector.sendRefusalToTurnOnMic().catch((e) => {
|
|
668
|
-
c("sendRefusalToTurnOnMic: error", e);
|
|
669
|
-
}));
|
|
670
|
-
});
|
|
671
|
-
a(this, "sendRefusalToTurnOnCam", async () => {
|
|
672
|
-
this.sipConnector.isCallActive && (c("sendRefusalToTurnOnCam"), await this.sipConnector.sendRefusalToTurnOnCam().catch((e) => {
|
|
673
|
-
c("sendRefusalToTurnOnCam: error", e);
|
|
674
|
-
}));
|
|
675
|
-
});
|
|
676
|
-
a(this, "sendMediaState", async ({
|
|
677
|
-
isEnabledCam: e,
|
|
678
|
-
isEnabledMic: t
|
|
679
|
-
}) => {
|
|
680
|
-
this.sipConnector.isCallActive && (c("sendMediaState"), await this.sipConnector.sendMediaState({ cam: e, mic: t }));
|
|
681
|
-
});
|
|
682
|
-
a(this, "replaceMediaStream", async (e, {
|
|
683
|
-
deleteExisting: t,
|
|
684
|
-
addMissing: s,
|
|
685
|
-
forceRenegotiation: o,
|
|
686
|
-
contentHint: r,
|
|
687
|
-
simulcastEncodings: i,
|
|
688
|
-
degradationPreference: u,
|
|
689
|
-
sendEncodings: d
|
|
690
|
-
} = {}) => {
|
|
691
|
-
const C = I(
|
|
692
|
-
{
|
|
693
|
-
degradationPreference: u
|
|
694
|
-
},
|
|
695
|
-
{
|
|
696
|
-
preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
|
|
697
|
-
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
698
|
-
}
|
|
699
|
-
);
|
|
700
|
-
return c("replaceMediaStream"), this.sipConnector.replaceMediaStream(e, {
|
|
701
|
-
deleteExisting: t,
|
|
702
|
-
addMissing: s,
|
|
703
|
-
forceRenegotiation: o,
|
|
704
|
-
contentHint: r,
|
|
705
|
-
sendEncodings: P({
|
|
706
|
-
mediaStream: e,
|
|
707
|
-
simulcastEncodings: i,
|
|
708
|
-
sendEncodings: d
|
|
709
|
-
}),
|
|
710
|
-
onAddedTransceiver: C
|
|
711
|
-
});
|
|
712
|
-
});
|
|
713
|
-
a(this, "askPermissionToEnableCam", async () => {
|
|
714
|
-
this.sipConnector.isCallActive && (c("askPermissionToEnableCam"), await this.sipConnector.askPermissionToEnableCam());
|
|
715
|
-
});
|
|
716
|
-
a(this, "resolveHandleReadyRemoteStreamsDebounced", ({
|
|
717
|
-
onReadyRemoteStreams: e
|
|
718
|
-
}) => fe(() => {
|
|
719
|
-
const t = this.sipConnector.getRemoteStreams();
|
|
720
|
-
c("remoteStreams", t), t && e(t);
|
|
721
|
-
}, 200));
|
|
722
|
-
// eslint-disable-next-line class-methods-use-this
|
|
723
|
-
a(this, "resolveHandleReadyRemoteStreams", ({
|
|
724
|
-
onReadyRemoteStreams: e
|
|
725
|
-
}) => ({ track: t }) => {
|
|
726
|
-
tn(t) && e();
|
|
727
|
-
});
|
|
728
|
-
a(this, "getRemoteStreams", () => (c("getRemoteStreams"), this.sipConnector.getRemoteStreams()));
|
|
729
|
-
a(this, "onUseLicense", (e) => (c("onUseLicense"), this.sipConnector.onSession("useLicense", e)));
|
|
730
|
-
a(this, "onMustStopPresentation", (e) => (c("onMustStopPresentation"), this.sipConnector.onSession("mustStopPresentation", e)));
|
|
731
|
-
a(this, "onMoveToSpectators", (e) => (c("onMoveToSpectators"), this.sipConnector.onSession(ae, e)));
|
|
732
|
-
a(this, "onMoveToParticipants", (e) => (c("onMoveToParticipants"), this.sipConnector.onSession(ue, e)));
|
|
733
|
-
return this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.sipConnector = e, new Proxy(this, {
|
|
734
|
-
get: (o, r, i) => {
|
|
735
|
-
if (typeof r == "string" && sn.has(r) && r in this.sipConnector) {
|
|
736
|
-
const d = Reflect.get(this.sipConnector, r, this.sipConnector);
|
|
737
|
-
return typeof d == "function" ? d.bind(this.sipConnector) : d;
|
|
738
|
-
}
|
|
739
|
-
const u = Reflect.get(o, r, i);
|
|
740
|
-
return typeof u == "function" ? u.bind(o) : u;
|
|
741
|
-
}
|
|
742
|
-
});
|
|
743
|
-
}
|
|
744
|
-
}
|
|
796
|
+
};
|
|
745
797
|
export {
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
An as
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
On as hasCanceledCallError,
|
|
761
|
-
Nn as hasCanceledStartPresentationError,
|
|
762
|
-
fn as resolveVideoSendingBalancer,
|
|
763
|
-
ce as setParametersToSender,
|
|
764
|
-
Sn as tools
|
|
798
|
+
y as ECallCause,
|
|
799
|
+
sn as EMimeTypesVideoCodecs,
|
|
800
|
+
Bn as EUseLicense,
|
|
801
|
+
wn as SipConnector,
|
|
802
|
+
bn as SipConnectorFacade,
|
|
803
|
+
Fn as debug,
|
|
804
|
+
Dn as disableDebug,
|
|
805
|
+
Pn as enableDebug,
|
|
806
|
+
an as getCodecFromSender,
|
|
807
|
+
Mn as hasCanceledCallError,
|
|
808
|
+
xn as hasCanceledStartPresentationError,
|
|
809
|
+
An as resolveVideoSendingBalancer,
|
|
810
|
+
Q as setParametersToSender,
|
|
811
|
+
_n as tools
|
|
765
812
|
};
|