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