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