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