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