sip-connector 12.2.0 → 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{SipConnector-BxDInUHC.js → SipConnector-B4xLnl6L.js} +284 -278
- package/dist/SipConnector-CE4F15z6.cjs +1 -0
- package/dist/SipConnector.d.ts +9 -17
- package/dist/SipConnectorFacade/SipConnectorFacade.d.ts +8 -0
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +254 -238
- package/dist/tools/prepareMediaStream.d.ts +3 -3
- package/package.json +4 -4
- package/dist/SipConnector-Ds1fhzNg.cjs +0 -1
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var l = (n, e, t) =>
|
|
4
|
-
import { B as
|
|
5
|
-
import { i as
|
|
6
|
-
import { sequentPromises as
|
|
7
|
-
import { createStackPromises as
|
|
8
|
-
import { isCanceledError as
|
|
9
|
-
import { hasCanceledError as
|
|
10
|
-
import { debounce as
|
|
11
|
-
import { default as
|
|
12
|
-
const
|
|
1
|
+
var se = Object.defineProperty;
|
|
2
|
+
var re = (n, e, t) => e in n ? se(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var l = (n, e, t) => re(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { B as G, N as K, l as a, E as L, s as oe, a as ie, P as ce, b as ae, S as tn } from "./SipConnector-B4xLnl6L.js";
|
|
5
|
+
import { i as Cn, j as fn, m as hn, k as Rn, c as gn, d as pn, f as yn, g as En, e as Tn, h as bn } from "./SipConnector-B4xLnl6L.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 me } from "ts-debounce";
|
|
11
|
+
import { default as An } from "debug";
|
|
12
|
+
const H = (n) => {
|
|
13
13
|
const { url: e, cause: t } = n;
|
|
14
14
|
let s = e;
|
|
15
|
-
return (t ===
|
|
15
|
+
return (t === G || t === K) && (s = `${n.message.to.uri.user}@${n.message.to.uri.host}`), s;
|
|
16
16
|
};
|
|
17
|
-
var
|
|
18
|
-
const
|
|
17
|
+
var q = /* @__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))(q || {});
|
|
18
|
+
const Ce = (n = new Error()) => {
|
|
19
19
|
var r;
|
|
20
20
|
const { cause: e, socket: t } = n;
|
|
21
21
|
let s = "CONNECT_SERVER_FAILED";
|
|
@@ -24,19 +24,19 @@ const le = (n = new Error()) => {
|
|
|
24
24
|
s = "WRONG_USER_OR_PASSWORD";
|
|
25
25
|
break;
|
|
26
26
|
}
|
|
27
|
-
case
|
|
27
|
+
case G: {
|
|
28
28
|
s = "BAD_MEDIA_ERROR";
|
|
29
29
|
break;
|
|
30
30
|
}
|
|
31
|
-
case
|
|
31
|
+
case K: {
|
|
32
32
|
s = "NOT_FOUND_ERROR";
|
|
33
33
|
break;
|
|
34
34
|
}
|
|
35
35
|
default:
|
|
36
|
-
t && ((r = t == null ? void 0 : t._ws) == null ? void 0 : r.readyState) === 3 ? s = "WS_CONNECTION_FAILED" :
|
|
36
|
+
t && ((r = t == null ? void 0 : t._ws) == null ? void 0 : r.readyState) === 3 ? s = "WS_CONNECTION_FAILED" : H(n) && (s = "CONNECT_SERVER_FAILED_BY_LINK");
|
|
37
37
|
}
|
|
38
38
|
return s;
|
|
39
|
-
},
|
|
39
|
+
}, fe = (n) => {
|
|
40
40
|
let e = "";
|
|
41
41
|
try {
|
|
42
42
|
e = JSON.stringify(n);
|
|
@@ -44,16 +44,16 @@ const le = (n = new Error()) => {
|
|
|
44
44
|
a("failed to stringify message", t);
|
|
45
45
|
}
|
|
46
46
|
return e;
|
|
47
|
-
},
|
|
48
|
-
const { code: e, cause: t, message: s } = n, r =
|
|
49
|
-
return typeof s == "object" && s !== null ? o.message =
|
|
50
|
-
},
|
|
47
|
+
}, he = (n = new Error()) => {
|
|
48
|
+
const { code: e, cause: t, message: s } = n, r = H(n), o = { code: "", cause: "", message: "" };
|
|
49
|
+
return typeof s == "object" && s !== null ? o.message = fe(s) : s && (o.message = String(s)), r && (o.link = r), e && (o.code = e), t && (o.cause = t), o;
|
|
50
|
+
}, Re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
51
51
|
__proto__: null,
|
|
52
|
-
EErrorTypes:
|
|
53
|
-
getLinkError:
|
|
54
|
-
getTypeFromError:
|
|
55
|
-
getValuesFromError:
|
|
56
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
52
|
+
EErrorTypes: q,
|
|
53
|
+
getLinkError: H,
|
|
54
|
+
getTypeFromError: Ce,
|
|
55
|
+
getValuesFromError: he
|
|
56
|
+
}, Symbol.toStringTag, { value: "Module" })), ge = ({
|
|
57
57
|
sessionId: n,
|
|
58
58
|
remoteAddress: e,
|
|
59
59
|
isMutedAudio: t,
|
|
@@ -61,71 +61,71 @@ const le = (n = new Error()) => {
|
|
|
61
61
|
isRegistered: r,
|
|
62
62
|
isPresentationCall: o
|
|
63
63
|
}) => {
|
|
64
|
-
const
|
|
65
|
-
return
|
|
66
|
-
},
|
|
64
|
+
const i = [], c = t ? "0" : "1", u = s ? "0" : "1";
|
|
65
|
+
return i.push(`X-Vinteo-Mic-State: ${c}`, `X-Vinteo-MainCam-State: ${u}`), r || i.push("X-Vinteo-Purgatory-Call: yes"), n && i.push(`X-Vinteo-Session: ${n}`), o && i.push("X-Vinteo-Presentation-Call: yes"), e && i.push(`X-Vinteo-Remote: ${e}`), i;
|
|
66
|
+
}, pe = "[@*!|]", ye = "_", Ee = (n) => {
|
|
67
67
|
let e = n;
|
|
68
|
-
return e = e.replaceAll(new RegExp(
|
|
69
|
-
},
|
|
68
|
+
return e = e.replaceAll(new RegExp(pe, "g"), ye), e;
|
|
69
|
+
}, Te = ({
|
|
70
70
|
appName: n,
|
|
71
71
|
appVersion: e,
|
|
72
72
|
browserName: t,
|
|
73
73
|
browserVersion: s
|
|
74
74
|
}) => {
|
|
75
|
-
const o = `${
|
|
75
|
+
const o = `${Ee(n)} ${e}`;
|
|
76
76
|
return `ChromeNew - ${t ? `${t} ${s}, ${o}` : o}`;
|
|
77
|
-
},
|
|
77
|
+
}, be = ({
|
|
78
78
|
isUnifiedSdpSemantic: n,
|
|
79
79
|
appVersion: e,
|
|
80
80
|
browserName: t,
|
|
81
81
|
browserVersion: s,
|
|
82
82
|
appName: r
|
|
83
|
-
}) => n ?
|
|
83
|
+
}) => n ? Te({ appVersion: e, browserName: t, browserVersion: s, appName: r }) : "Chrome", Y = "purgatory", D = (n) => n === Y, Me = (n) => (e) => [...e].map((s) => async () => n(s)), Ae = async ({
|
|
84
84
|
accumulatedKeys: n,
|
|
85
85
|
sendKey: e,
|
|
86
86
|
canRunTask: t
|
|
87
87
|
}) => {
|
|
88
|
-
const r =
|
|
89
|
-
return
|
|
90
|
-
},
|
|
91
|
-
const e = (f,
|
|
92
|
-
if (
|
|
88
|
+
const r = Me(e)(n);
|
|
89
|
+
return ue(r, t);
|
|
90
|
+
}, _e = (n) => (t) => (a("onStartMainCam"), n.onSession("admin-start-main-cam", t)), ve = (n) => (t) => (a("onStartMic"), n.onSession("admin-start-mic", t)), Oe = (n) => (t) => (a("onStopMainCam"), n.onSession("admin-stop-main-cam", t)), Ne = (n) => (t) => (a("onStopMic"), n.onSession("admin-stop-mic", t)), Be = ({ sipConnector: n }) => {
|
|
91
|
+
const e = (f, p) => ({ isSyncForced: h = !1 }) => {
|
|
92
|
+
if (h) {
|
|
93
93
|
f();
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
}, t =
|
|
98
|
-
let
|
|
99
|
-
},
|
|
96
|
+
p();
|
|
97
|
+
}, t = _e(n), s = Oe(n), r = ve(n), o = Ne(n);
|
|
98
|
+
let i = () => {
|
|
99
|
+
}, c = () => {
|
|
100
100
|
}, u = () => {
|
|
101
101
|
}, S = () => {
|
|
102
102
|
};
|
|
103
103
|
const C = ({
|
|
104
104
|
onStartMainCamForced: f,
|
|
105
|
-
onStartMainCamNotForced:
|
|
106
|
-
onStopMainCamForced:
|
|
107
|
-
onStopMainCamNotForced:
|
|
108
|
-
onStartMicForced:
|
|
109
|
-
onStartMicNotForced:
|
|
110
|
-
onStopMicForced:
|
|
111
|
-
onStopMicNotForced:
|
|
105
|
+
onStartMainCamNotForced: p,
|
|
106
|
+
onStopMainCamForced: h,
|
|
107
|
+
onStopMainCamNotForced: R,
|
|
108
|
+
onStartMicForced: y,
|
|
109
|
+
onStartMicNotForced: E,
|
|
110
|
+
onStopMicForced: T,
|
|
111
|
+
onStopMicNotForced: b
|
|
112
112
|
}) => {
|
|
113
|
-
const
|
|
113
|
+
const _ = e(
|
|
114
114
|
f,
|
|
115
|
-
|
|
115
|
+
p
|
|
116
116
|
);
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
i = t(_);
|
|
118
|
+
const v = e(
|
|
119
|
+
h,
|
|
120
|
+
R
|
|
121
121
|
);
|
|
122
|
-
|
|
123
|
-
const
|
|
124
|
-
u = r(
|
|
125
|
-
const
|
|
126
|
-
S = o(
|
|
122
|
+
c = s(v);
|
|
123
|
+
const O = e(y, E);
|
|
124
|
+
u = r(O);
|
|
125
|
+
const N = e(T, b);
|
|
126
|
+
S = o(N);
|
|
127
127
|
}, m = () => {
|
|
128
|
-
|
|
128
|
+
i(), c(), u(), S();
|
|
129
129
|
};
|
|
130
130
|
return {
|
|
131
131
|
start: (f) => {
|
|
@@ -135,79 +135,79 @@ const le = (n = new Error()) => {
|
|
|
135
135
|
m();
|
|
136
136
|
}
|
|
137
137
|
};
|
|
138
|
-
},
|
|
138
|
+
}, un = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
139
139
|
__proto__: null,
|
|
140
|
-
PURGATORY_CONFERENCE_NUMBER:
|
|
141
|
-
createSyncMediaState:
|
|
142
|
-
error:
|
|
143
|
-
getExtraHeaders:
|
|
144
|
-
getUserAgent:
|
|
145
|
-
hasPurgatory:
|
|
146
|
-
sendDTMFAccumulated:
|
|
147
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
148
|
-
const t =
|
|
140
|
+
PURGATORY_CONFERENCE_NUMBER: Y,
|
|
141
|
+
createSyncMediaState: Be,
|
|
142
|
+
error: Re,
|
|
143
|
+
getExtraHeaders: ge,
|
|
144
|
+
getUserAgent: be,
|
|
145
|
+
hasPurgatory: D,
|
|
146
|
+
sendDTMFAccumulated: Ae
|
|
147
|
+
}, Symbol.toStringTag, { value: "Module" })), Pe = (n) => [...n.keys()].map((e) => n.get(e)), we = (n, e) => Pe(n).find((t) => t.type === e), De = async (n) => n.getStats().then((e) => {
|
|
148
|
+
const t = we(e, "codec");
|
|
149
149
|
return t == null ? void 0 : t.mimeType;
|
|
150
|
-
}),
|
|
150
|
+
}), Ie = (n) => n.find((e) => {
|
|
151
151
|
var t;
|
|
152
152
|
return ((t = e == null ? void 0 : e.track) == null ? void 0 : t.kind) === "video";
|
|
153
|
-
}),
|
|
154
|
-
const t =
|
|
155
|
-
return
|
|
156
|
-
},
|
|
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", Le = (n) => z(n, Ve), xe = 0.6, J = (n, e) => Le(e) ? n * xe : n, $e = (n) => J(Q, n), Z = (n, e) => {
|
|
154
|
+
const t = Ue(n);
|
|
155
|
+
return J(t, e);
|
|
156
|
+
}, He = 1, ee = ({
|
|
157
157
|
videoTrack: n,
|
|
158
158
|
targetSize: e,
|
|
159
159
|
codec: t
|
|
160
160
|
}) => {
|
|
161
|
-
const s = n.getSettings(), r = s.width, o = s.height,
|
|
161
|
+
const s = n.getSettings(), r = s.width, o = s.height, i = r / e.width, c = o / e.height, u = Math.max(i, c, He), S = Z(e.width, t);
|
|
162
162
|
return { scaleResolutionDownBy: u, maxBitrate: S };
|
|
163
|
-
},
|
|
163
|
+
}, ne = le(), Xe = async () => ne().catch((n) => {
|
|
164
164
|
a("videoSendingBalancer: error", n);
|
|
165
|
-
}),
|
|
165
|
+
}), je = async (n) => (ne.add(n), Xe()), X = async ({
|
|
166
166
|
sender: n,
|
|
167
167
|
scaleResolutionDownBy: e,
|
|
168
168
|
maxBitrate: t,
|
|
169
169
|
onSetParameters: s
|
|
170
|
-
}) =>
|
|
171
|
-
const r =
|
|
172
|
-
return
|
|
170
|
+
}) => je(async () => oe(n, { scaleResolutionDownBy: e, maxBitrate: t }, s)), We = async ({ sender: n, codec: e }, t) => {
|
|
171
|
+
const r = $e(e);
|
|
172
|
+
return X({
|
|
173
173
|
sender: n,
|
|
174
174
|
maxBitrate: r,
|
|
175
175
|
onSetParameters: t,
|
|
176
176
|
scaleResolutionDownBy: 200
|
|
177
177
|
});
|
|
178
|
-
},
|
|
178
|
+
}, x = async ({
|
|
179
179
|
sender: n,
|
|
180
180
|
videoTrack: e,
|
|
181
181
|
codec: t
|
|
182
182
|
}, s) => {
|
|
183
|
-
const
|
|
184
|
-
return
|
|
183
|
+
const i = e.getSettings().width, c = Z(i, t);
|
|
184
|
+
return X({
|
|
185
185
|
sender: n,
|
|
186
|
-
maxBitrate:
|
|
186
|
+
maxBitrate: c,
|
|
187
187
|
onSetParameters: s,
|
|
188
188
|
scaleResolutionDownBy: 1
|
|
189
189
|
});
|
|
190
|
-
},
|
|
190
|
+
}, Ge = async ({
|
|
191
191
|
sender: n,
|
|
192
192
|
videoTrack: e,
|
|
193
193
|
resolution: t,
|
|
194
194
|
codec: s
|
|
195
195
|
}, r) => {
|
|
196
|
-
const [o,
|
|
196
|
+
const [o, i] = t.split("x"), { maxBitrate: c, scaleResolutionDownBy: u } = ee({
|
|
197
197
|
videoTrack: e,
|
|
198
198
|
codec: s,
|
|
199
199
|
targetSize: {
|
|
200
200
|
width: Number(o),
|
|
201
|
-
height: Number(
|
|
201
|
+
height: Number(i)
|
|
202
202
|
}
|
|
203
203
|
});
|
|
204
|
-
return
|
|
204
|
+
return X({
|
|
205
205
|
sender: n,
|
|
206
|
-
maxBitrate:
|
|
206
|
+
maxBitrate: c,
|
|
207
207
|
onSetParameters: r,
|
|
208
208
|
scaleResolutionDownBy: u
|
|
209
209
|
});
|
|
210
|
-
},
|
|
210
|
+
}, Ke = async ({
|
|
211
211
|
mainCam: n,
|
|
212
212
|
resolutionMainCam: e,
|
|
213
213
|
sender: t,
|
|
@@ -215,19 +215,19 @@ const le = (n = new Error()) => {
|
|
|
215
215
|
codec: r
|
|
216
216
|
}, o) => {
|
|
217
217
|
switch (n) {
|
|
218
|
-
case
|
|
219
|
-
return
|
|
220
|
-
case
|
|
221
|
-
return
|
|
222
|
-
case
|
|
223
|
-
return e !== void 0 ?
|
|
218
|
+
case L.PAUSE_MAIN_CAM:
|
|
219
|
+
return We({ sender: t, codec: r }, o);
|
|
220
|
+
case L.RESUME_MAIN_CAM:
|
|
221
|
+
return x({ sender: t, videoTrack: s, codec: r }, o);
|
|
222
|
+
case L.MAX_MAIN_CAM_RESOLUTION:
|
|
223
|
+
return e !== void 0 ? Ge(
|
|
224
224
|
{ sender: t, videoTrack: s, codec: r, resolution: e },
|
|
225
225
|
o
|
|
226
|
-
) :
|
|
226
|
+
) : x({ sender: t, videoTrack: s, codec: r }, o);
|
|
227
227
|
default:
|
|
228
|
-
return
|
|
228
|
+
return x({ sender: t, videoTrack: s, codec: r }, o);
|
|
229
229
|
}
|
|
230
|
-
},
|
|
230
|
+
}, j = {
|
|
231
231
|
isChanged: !1,
|
|
232
232
|
parameters: {
|
|
233
233
|
encodings: [{}],
|
|
@@ -236,28 +236,28 @@ const le = (n = new Error()) => {
|
|
|
236
236
|
headerExtensions: [],
|
|
237
237
|
rtcp: {}
|
|
238
238
|
}
|
|
239
|
-
},
|
|
239
|
+
}, W = async ({
|
|
240
240
|
mainCam: n,
|
|
241
241
|
resolutionMainCam: e,
|
|
242
242
|
connection: t,
|
|
243
243
|
onSetParameters: s,
|
|
244
244
|
ignoreForCodec: r
|
|
245
245
|
}) => {
|
|
246
|
-
const o = t.getSenders(),
|
|
247
|
-
if (!(
|
|
248
|
-
return
|
|
249
|
-
const
|
|
250
|
-
return
|
|
246
|
+
const o = t.getSenders(), i = Ie(o);
|
|
247
|
+
if (!(i != null && i.track))
|
|
248
|
+
return j;
|
|
249
|
+
const c = await De(i);
|
|
250
|
+
return z(c, r) ? j : Ke(
|
|
251
251
|
{
|
|
252
252
|
mainCam: n,
|
|
253
253
|
resolutionMainCam: e,
|
|
254
|
-
sender:
|
|
255
|
-
codec:
|
|
256
|
-
videoTrack:
|
|
254
|
+
sender: i,
|
|
255
|
+
codec: c,
|
|
256
|
+
videoTrack: i.track
|
|
257
257
|
},
|
|
258
258
|
s
|
|
259
259
|
);
|
|
260
|
-
},
|
|
260
|
+
}, ln = (n, {
|
|
261
261
|
ignoreForCodec: e,
|
|
262
262
|
onSetParameters: t
|
|
263
263
|
} = {}) => {
|
|
@@ -265,7 +265,7 @@ const le = (n = new Error()) => {
|
|
|
265
265
|
const { connection: u } = n;
|
|
266
266
|
if (!u)
|
|
267
267
|
throw new Error("connection is not exist");
|
|
268
|
-
return
|
|
268
|
+
return W({
|
|
269
269
|
connection: u,
|
|
270
270
|
onSetParameters: t,
|
|
271
271
|
ignoreForCodec: e
|
|
@@ -276,7 +276,7 @@ const le = (n = new Error()) => {
|
|
|
276
276
|
const { mainCam: S, resolutionMainCam: C } = u, { connection: m } = n;
|
|
277
277
|
if (!m)
|
|
278
278
|
throw new Error("connection is not exist");
|
|
279
|
-
return
|
|
279
|
+
return W({
|
|
280
280
|
mainCam: S,
|
|
281
281
|
resolutionMainCam: C,
|
|
282
282
|
connection: m,
|
|
@@ -299,49 +299,49 @@ const le = (n = new Error()) => {
|
|
|
299
299
|
return r();
|
|
300
300
|
}
|
|
301
301
|
};
|
|
302
|
-
},
|
|
302
|
+
}, qe = (n) => n.getVideoTracks()[0], P = ({
|
|
303
303
|
mediaStream: n,
|
|
304
304
|
simulcastEncodings: e,
|
|
305
305
|
sendEncodings: t
|
|
306
306
|
}) => {
|
|
307
307
|
if (e && e.length > 0) {
|
|
308
|
-
const s = t ?? [], r =
|
|
309
|
-
return e.forEach((o,
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
const { maxBitrate: u, scaleResolutionDownBy: S } =
|
|
308
|
+
const s = t ?? [], r = qe(n);
|
|
309
|
+
return e.forEach((o, i) => {
|
|
310
|
+
const c = s[i] ?? {};
|
|
311
|
+
c.active = !0, o.rid !== void 0 && (c.rid = o.rid), o.scalabilityMode !== void 0 && (c.scalabilityMode = o.scalabilityMode);
|
|
312
|
+
const { maxBitrate: u, scaleResolutionDownBy: S } = ee({
|
|
313
313
|
videoTrack: r,
|
|
314
314
|
targetSize: {
|
|
315
315
|
width: o.width,
|
|
316
316
|
height: o.height
|
|
317
317
|
}
|
|
318
318
|
});
|
|
319
|
-
|
|
319
|
+
c.maxBitrate = u, c.scaleResolutionDownBy = S, s[i] = c;
|
|
320
320
|
}), s;
|
|
321
321
|
}
|
|
322
322
|
return t;
|
|
323
|
-
},
|
|
323
|
+
}, Ye = (n, e) => [...n, ...e].filter((r, o, i) => o === i.findIndex((c) => c.clockRate === r.clockRate && c.mimeType === r.mimeType && c.channels === r.channels && c.sdpFmtpLine === r.sdpFmtpLine)), ze = (n) => {
|
|
324
324
|
const e = RTCRtpSender.getCapabilities(n), t = RTCRtpReceiver.getCapabilities(n), s = e === null ? [] : e.codecs, r = t === null ? [] : t.codecs;
|
|
325
|
-
return
|
|
326
|
-
},
|
|
327
|
-
const r = e.indexOf(t.mimeType), o = e.indexOf(s.mimeType),
|
|
328
|
-
return
|
|
329
|
-
}),
|
|
325
|
+
return Ye(s, r);
|
|
326
|
+
}, Qe = (n, e) => e === void 0 || e.length === 0 ? n : n.sort((t, s) => {
|
|
327
|
+
const r = e.indexOf(t.mimeType), o = e.indexOf(s.mimeType), i = r === -1 ? Number.MAX_VALUE : r, c = o === -1 ? Number.MAX_VALUE : o;
|
|
328
|
+
return i - c;
|
|
329
|
+
}), Je = (n, e) => e === void 0 || e.length === 0 ? n : n.filter((t) => !e.includes(t.mimeType)), w = (n, {
|
|
330
330
|
preferredMimeTypesVideoCodecs: e,
|
|
331
331
|
excludeMimeTypesVideoCodecs: t
|
|
332
332
|
}) => async (s) => {
|
|
333
333
|
var r;
|
|
334
334
|
if (typeof s.setCodecPreferences == "function" && ((r = s.sender.track) == null ? void 0 : r.kind) === "video" && (e !== void 0 && (e == null ? void 0 : e.length) > 0 || t !== void 0 && (t == null ? void 0 : t.length) > 0)) {
|
|
335
|
-
const o =
|
|
336
|
-
s.setCodecPreferences(
|
|
335
|
+
const o = ze("video"), i = Je(o, t), c = Qe(i, e);
|
|
336
|
+
s.setCodecPreferences(c);
|
|
337
337
|
}
|
|
338
|
-
Object.keys(n).length > 0 && await
|
|
339
|
-
},
|
|
340
|
-
if (!
|
|
338
|
+
Object.keys(n).length > 0 && await ie(s.sender, n);
|
|
339
|
+
}, $ = (n) => {
|
|
340
|
+
if (!de(n) && !Se(n))
|
|
341
341
|
throw n;
|
|
342
342
|
return { isSuccessful: !1 };
|
|
343
|
-
},
|
|
344
|
-
class
|
|
343
|
+
}, Ze = ({ kind: n, readyState: e }) => n === "video" && e === "live";
|
|
344
|
+
class dn {
|
|
345
345
|
constructor(e, {
|
|
346
346
|
preferredMimeTypesVideoCodecs: t,
|
|
347
347
|
excludeMimeTypesVideoCodecs: s
|
|
@@ -355,8 +355,8 @@ class cn {
|
|
|
355
355
|
sipWebSocketServerURL: s,
|
|
356
356
|
sipServerUrl: r,
|
|
357
357
|
remoteAddress: o,
|
|
358
|
-
displayName:
|
|
359
|
-
name:
|
|
358
|
+
displayName: i,
|
|
359
|
+
name: c,
|
|
360
360
|
password: u,
|
|
361
361
|
isRegisteredUser: S,
|
|
362
362
|
isDisconnectOnFail: C
|
|
@@ -366,11 +366,11 @@ class cn {
|
|
|
366
366
|
sipWebSocketServerURL: s,
|
|
367
367
|
sipServerUrl: r,
|
|
368
368
|
remoteAddress: o,
|
|
369
|
-
displayName:
|
|
369
|
+
displayName: i,
|
|
370
370
|
password: u,
|
|
371
|
-
user:
|
|
371
|
+
user: c,
|
|
372
372
|
register: S
|
|
373
|
-
}).then((m) => (a("connectToServer then"), { ua: m, isSuccessful: !0 })).catch(async (m) => (a("connectToServer catch: error", m), C === !0 ? this.sipConnector.disconnect().then(() =>
|
|
373
|
+
}).then((m) => (a("connectToServer then"), { ua: m, isSuccessful: !0 })).catch(async (m) => (a("connectToServer catch: error", m), C === !0 ? this.sipConnector.disconnect().then(() => $(m)).catch(() => $(m)) : $(m)));
|
|
374
374
|
});
|
|
375
375
|
l(this, "callToServer", async (e) => {
|
|
376
376
|
const {
|
|
@@ -378,23 +378,27 @@ class cn {
|
|
|
378
378
|
mediaStream: s,
|
|
379
379
|
extraHeaders: r,
|
|
380
380
|
iceServers: o,
|
|
381
|
-
contentHint:
|
|
382
|
-
simulcastEncodings:
|
|
381
|
+
contentHint: i,
|
|
382
|
+
simulcastEncodings: c,
|
|
383
383
|
degradationPreference: u,
|
|
384
384
|
sendEncodings: S,
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
385
|
+
offerToReceiveAudio: C,
|
|
386
|
+
offerToReceiveVideo: m,
|
|
387
|
+
directionVideo: I,
|
|
388
|
+
directionAudio: F,
|
|
389
|
+
setRemoteStreams: f,
|
|
390
|
+
onBeforeProgressCall: p,
|
|
391
|
+
onSuccessProgressCall: h,
|
|
388
392
|
onEnterPurgatory: R,
|
|
389
|
-
onEnterConference:
|
|
390
|
-
onFailProgressCall:
|
|
391
|
-
onFinishProgressCall:
|
|
393
|
+
onEnterConference: y,
|
|
394
|
+
onFailProgressCall: E,
|
|
395
|
+
onFinishProgressCall: T,
|
|
392
396
|
onEndedCall: b
|
|
393
397
|
} = e, _ = this.resolveHandleReadyRemoteStreamsDebounced({
|
|
394
|
-
onReadyRemoteStreams:
|
|
395
|
-
}),
|
|
398
|
+
onReadyRemoteStreams: f
|
|
399
|
+
}), v = this.resolveHandleReadyRemoteStreams({
|
|
396
400
|
onReadyRemoteStreams: _
|
|
397
|
-
}),
|
|
401
|
+
}), O = w(
|
|
398
402
|
{
|
|
399
403
|
degradationPreference: u
|
|
400
404
|
},
|
|
@@ -404,32 +408,36 @@ class cn {
|
|
|
404
408
|
}
|
|
405
409
|
);
|
|
406
410
|
a("callToServer", e);
|
|
407
|
-
const
|
|
411
|
+
const N = async () => (a("startCall"), this.sipConnector.call({
|
|
408
412
|
mediaStream: s,
|
|
409
413
|
extraHeaders: r,
|
|
410
414
|
iceServers: o,
|
|
411
|
-
contentHint:
|
|
412
|
-
|
|
415
|
+
contentHint: i,
|
|
416
|
+
offerToReceiveAudio: C,
|
|
417
|
+
offerToReceiveVideo: m,
|
|
418
|
+
directionVideo: I,
|
|
419
|
+
directionAudio: F,
|
|
420
|
+
sendEncodings: P({
|
|
413
421
|
mediaStream: s,
|
|
414
|
-
simulcastEncodings:
|
|
422
|
+
simulcastEncodings: c,
|
|
415
423
|
sendEncodings: S
|
|
416
424
|
}),
|
|
417
425
|
number: t,
|
|
418
|
-
onAddedTransceiver:
|
|
419
|
-
ontrack:
|
|
426
|
+
onAddedTransceiver: O,
|
|
427
|
+
ontrack: v
|
|
420
428
|
}));
|
|
421
|
-
let
|
|
422
|
-
const
|
|
423
|
-
a("enterRoom", { _room: d, isSuccessProgressCall:
|
|
429
|
+
let M = !1, A;
|
|
430
|
+
const B = (a("subscribeEnterConference: onEnterConference", y), R ?? y ? this.sipConnector.onSession("enterRoom", ({ room: d }) => {
|
|
431
|
+
a("enterRoom", { _room: d, isSuccessProgressCall: M }), A = d, D(A) ? R && R() : y && y({ isSuccessProgressCall: M });
|
|
424
432
|
}) : () => {
|
|
425
|
-
}),
|
|
426
|
-
|
|
427
|
-
}), d),
|
|
428
|
-
throw a("onFail"),
|
|
429
|
-
},
|
|
430
|
-
a("onFinish"),
|
|
433
|
+
}), k = (d) => (a("onSuccess"), M = !0, _(), h && h({ isPurgatory: D(A) }), this.sipConnector.onceRaceSession(["ended", "failed"], () => {
|
|
434
|
+
B(), b && b();
|
|
435
|
+
}), d), U = (d) => {
|
|
436
|
+
throw a("onFail"), E && E(), B(), d;
|
|
437
|
+
}, V = () => {
|
|
438
|
+
a("onFinish"), T && T();
|
|
431
439
|
};
|
|
432
|
-
return a("onBeforeProgressCall"),
|
|
440
|
+
return a("onBeforeProgressCall"), p && p(t), N().then(k).catch((d) => U(d)).finally(V);
|
|
433
441
|
});
|
|
434
442
|
l(this, "disconnectFromServer", async () => this.sipConnector.disconnect().then(() => (a("disconnectFromServer: then"), { isSuccessful: !0 })).catch((e) => (a("disconnectFromServer: catch", e), { isSuccessful: !1 })));
|
|
435
443
|
l(this, "answerIncomingCall", async (e) => {
|
|
@@ -438,24 +446,28 @@ class cn {
|
|
|
438
446
|
extraHeaders: s,
|
|
439
447
|
iceServers: r,
|
|
440
448
|
contentHint: o,
|
|
441
|
-
simulcastEncodings:
|
|
442
|
-
degradationPreference:
|
|
449
|
+
simulcastEncodings: i,
|
|
450
|
+
degradationPreference: c,
|
|
443
451
|
sendEncodings: u,
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
452
|
+
offerToReceiveAudio: S,
|
|
453
|
+
offerToReceiveVideo: C,
|
|
454
|
+
directionVideo: m,
|
|
455
|
+
directionAudio: I,
|
|
456
|
+
setRemoteStreams: F,
|
|
457
|
+
onBeforeProgressCall: f,
|
|
458
|
+
onSuccessProgressCall: p,
|
|
459
|
+
onEnterPurgatory: h,
|
|
448
460
|
onEnterConference: R,
|
|
449
|
-
onFailProgressCall:
|
|
450
|
-
onFinishProgressCall:
|
|
451
|
-
onEndedCall:
|
|
461
|
+
onFailProgressCall: y,
|
|
462
|
+
onFinishProgressCall: E,
|
|
463
|
+
onEndedCall: T
|
|
452
464
|
} = e, b = this.resolveHandleReadyRemoteStreamsDebounced({
|
|
453
|
-
onReadyRemoteStreams:
|
|
465
|
+
onReadyRemoteStreams: F
|
|
454
466
|
}), _ = this.resolveHandleReadyRemoteStreams({
|
|
455
467
|
onReadyRemoteStreams: b
|
|
456
|
-
}),
|
|
468
|
+
}), v = w(
|
|
457
469
|
{
|
|
458
|
-
degradationPreference:
|
|
470
|
+
degradationPreference: c
|
|
459
471
|
},
|
|
460
472
|
{
|
|
461
473
|
preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
|
|
@@ -463,38 +475,42 @@ class cn {
|
|
|
463
475
|
}
|
|
464
476
|
);
|
|
465
477
|
a("answerIncomingCall", e);
|
|
466
|
-
const
|
|
478
|
+
const O = async () => this.sipConnector.answerToIncomingCall({
|
|
467
479
|
mediaStream: t,
|
|
468
480
|
extraHeaders: s,
|
|
469
481
|
iceServers: r,
|
|
470
482
|
contentHint: o,
|
|
471
|
-
|
|
483
|
+
offerToReceiveAudio: S,
|
|
484
|
+
offerToReceiveVideo: C,
|
|
485
|
+
directionVideo: m,
|
|
486
|
+
directionAudio: I,
|
|
487
|
+
sendEncodings: P({
|
|
472
488
|
mediaStream: t,
|
|
473
|
-
simulcastEncodings:
|
|
489
|
+
simulcastEncodings: i,
|
|
474
490
|
sendEncodings: u
|
|
475
491
|
}),
|
|
476
|
-
onAddedTransceiver:
|
|
492
|
+
onAddedTransceiver: v,
|
|
477
493
|
ontrack: _
|
|
478
|
-
}),
|
|
494
|
+
}), N = () => {
|
|
479
495
|
const { remoteCallerData: d } = this.sipConnector;
|
|
480
496
|
return d.incomingNumber;
|
|
481
497
|
};
|
|
482
|
-
let
|
|
483
|
-
const
|
|
484
|
-
a("enterRoom", { _room: d, isSuccessProgressCall:
|
|
498
|
+
let M = !1, A;
|
|
499
|
+
const B = (a("subscribeEnterConference: onEnterConference", R), h ?? R ? this.sipConnector.onSession("enterRoom", (d) => {
|
|
500
|
+
a("enterRoom", { _room: d, isSuccessProgressCall: M }), A = d, D(A) ? h && h() : R && R({ isSuccessProgressCall: M });
|
|
485
501
|
}) : () => {
|
|
486
|
-
}),
|
|
487
|
-
|
|
488
|
-
}), d),
|
|
489
|
-
throw a("onFail"),
|
|
490
|
-
},
|
|
491
|
-
a("onFinish"),
|
|
502
|
+
}), k = (d) => (a("onSuccess"), M = !0, b(), p && p({ isPurgatory: D(A) }), this.sipConnector.onceRaceSession(["ended", "failed"], () => {
|
|
503
|
+
B(), T && T();
|
|
504
|
+
}), d), U = (d) => {
|
|
505
|
+
throw a("onFail"), y && y(), B(), d;
|
|
506
|
+
}, V = () => {
|
|
507
|
+
a("onFinish"), E && E();
|
|
492
508
|
};
|
|
493
|
-
if (a("onBeforeProgressCall"),
|
|
494
|
-
const d =
|
|
495
|
-
|
|
509
|
+
if (a("onBeforeProgressCall"), f) {
|
|
510
|
+
const d = N();
|
|
511
|
+
f(d);
|
|
496
512
|
}
|
|
497
|
-
return
|
|
513
|
+
return O().then(k).catch((d) => U(d)).finally(V);
|
|
498
514
|
});
|
|
499
515
|
l(this, "updatePresentation", async ({
|
|
500
516
|
mediaStream: e,
|
|
@@ -502,14 +518,14 @@ class cn {
|
|
|
502
518
|
maxBitrate: s,
|
|
503
519
|
contentHint: r,
|
|
504
520
|
simulcastEncodings: o,
|
|
505
|
-
degradationPreference:
|
|
506
|
-
sendEncodings:
|
|
521
|
+
degradationPreference: i,
|
|
522
|
+
sendEncodings: c,
|
|
507
523
|
preferredMimeTypesVideoCodecs: u,
|
|
508
524
|
excludeMimeTypesVideoCodecs: S
|
|
509
525
|
}) => {
|
|
510
|
-
const C =
|
|
526
|
+
const C = w(
|
|
511
527
|
{
|
|
512
|
-
degradationPreference:
|
|
528
|
+
degradationPreference: i
|
|
513
529
|
},
|
|
514
530
|
{
|
|
515
531
|
preferredMimeTypesVideoCodecs: u,
|
|
@@ -520,10 +536,10 @@ class cn {
|
|
|
520
536
|
isP2P: t,
|
|
521
537
|
maxBitrate: s,
|
|
522
538
|
contentHint: r,
|
|
523
|
-
sendEncodings:
|
|
539
|
+
sendEncodings: P({
|
|
524
540
|
mediaStream: e,
|
|
525
541
|
simulcastEncodings: o,
|
|
526
|
-
sendEncodings:
|
|
542
|
+
sendEncodings: c
|
|
527
543
|
}),
|
|
528
544
|
onAddedTransceiver: C
|
|
529
545
|
});
|
|
@@ -534,14 +550,14 @@ class cn {
|
|
|
534
550
|
maxBitrate: s,
|
|
535
551
|
contentHint: r,
|
|
536
552
|
simulcastEncodings: o,
|
|
537
|
-
degradationPreference:
|
|
538
|
-
sendEncodings:
|
|
553
|
+
degradationPreference: i,
|
|
554
|
+
sendEncodings: c,
|
|
539
555
|
preferredMimeTypesVideoCodecs: u,
|
|
540
556
|
excludeMimeTypesVideoCodecs: S
|
|
541
557
|
}, C) => {
|
|
542
|
-
const m =
|
|
558
|
+
const m = w(
|
|
543
559
|
{
|
|
544
|
-
degradationPreference:
|
|
560
|
+
degradationPreference: i
|
|
545
561
|
},
|
|
546
562
|
{
|
|
547
563
|
preferredMimeTypesVideoCodecs: u,
|
|
@@ -554,10 +570,10 @@ class cn {
|
|
|
554
570
|
isP2P: t,
|
|
555
571
|
maxBitrate: s,
|
|
556
572
|
contentHint: r,
|
|
557
|
-
sendEncodings:
|
|
573
|
+
sendEncodings: P({
|
|
558
574
|
mediaStream: e,
|
|
559
575
|
simulcastEncodings: o,
|
|
560
|
-
sendEncodings:
|
|
576
|
+
sendEncodings: c
|
|
561
577
|
}),
|
|
562
578
|
onAddedTransceiver: m
|
|
563
579
|
},
|
|
@@ -593,13 +609,13 @@ class cn {
|
|
|
593
609
|
addMissing: s,
|
|
594
610
|
forceRenegotiation: r,
|
|
595
611
|
contentHint: o,
|
|
596
|
-
simulcastEncodings:
|
|
597
|
-
degradationPreference:
|
|
612
|
+
simulcastEncodings: i,
|
|
613
|
+
degradationPreference: c,
|
|
598
614
|
sendEncodings: u
|
|
599
615
|
} = {}) => {
|
|
600
|
-
const S =
|
|
616
|
+
const S = w(
|
|
601
617
|
{
|
|
602
|
-
degradationPreference:
|
|
618
|
+
degradationPreference: c
|
|
603
619
|
},
|
|
604
620
|
{
|
|
605
621
|
preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
|
|
@@ -611,9 +627,9 @@ class cn {
|
|
|
611
627
|
addMissing: s,
|
|
612
628
|
forceRenegotiation: r,
|
|
613
629
|
contentHint: o,
|
|
614
|
-
sendEncodings:
|
|
630
|
+
sendEncodings: P({
|
|
615
631
|
mediaStream: e,
|
|
616
|
-
simulcastEncodings:
|
|
632
|
+
simulcastEncodings: i,
|
|
617
633
|
sendEncodings: u
|
|
618
634
|
}),
|
|
619
635
|
onAddedTransceiver: S
|
|
@@ -625,40 +641,40 @@ class cn {
|
|
|
625
641
|
});
|
|
626
642
|
l(this, "resolveHandleReadyRemoteStreamsDebounced", ({
|
|
627
643
|
onReadyRemoteStreams: e
|
|
628
|
-
}) =>
|
|
644
|
+
}) => me(() => {
|
|
629
645
|
const t = this.sipConnector.getRemoteStreams();
|
|
630
646
|
a("remoteStreams", t), t && e(t);
|
|
631
647
|
}, 200));
|
|
632
648
|
l(this, "resolveHandleReadyRemoteStreams", ({
|
|
633
649
|
onReadyRemoteStreams: e
|
|
634
650
|
}) => ({ track: t }) => {
|
|
635
|
-
|
|
651
|
+
Ze(t) && e();
|
|
636
652
|
});
|
|
637
653
|
l(this, "getRemoteStreams", () => (a("getRemoteStreams"), this.sipConnector.getRemoteStreams()));
|
|
638
654
|
l(this, "onUseLicense", (e) => (a("onUseLicense"), this.sipConnector.onSession("useLicense", e)));
|
|
639
655
|
l(this, "onMustStopPresentation", (e) => (a("onMustStopPresentation"), this.sipConnector.onSession("mustStopPresentation", e)));
|
|
640
|
-
l(this, "onMoveToSpectators", (e) => (a("onMoveToSpectators"), this.sipConnector.onSession(
|
|
641
|
-
l(this, "onMoveToParticipants", (e) => (a("onMoveToParticipants"), this.sipConnector.onSession(
|
|
656
|
+
l(this, "onMoveToSpectators", (e) => (a("onMoveToSpectators"), this.sipConnector.onSession(ce, e)));
|
|
657
|
+
l(this, "onMoveToParticipants", (e) => (a("onMoveToParticipants"), this.sipConnector.onSession(ae, e)));
|
|
642
658
|
this.sipConnector = e, this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s;
|
|
643
659
|
}
|
|
644
660
|
}
|
|
645
661
|
export {
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
662
|
+
L as EEventsMainCAM,
|
|
663
|
+
Cn as EEventsMic,
|
|
664
|
+
fn as EEventsSyncMediaState,
|
|
665
|
+
hn as EMimeTypesVideoCodecs,
|
|
666
|
+
Rn as EUseLicense,
|
|
667
|
+
dn as SipConnectorFacade,
|
|
668
|
+
gn as causes,
|
|
669
|
+
pn as constants,
|
|
670
|
+
An as debug,
|
|
671
|
+
tn as default,
|
|
672
|
+
yn as disableDebug,
|
|
673
|
+
En as enableDebug,
|
|
674
|
+
Tn as eventNames,
|
|
675
|
+
De as getCodecFromSender,
|
|
676
|
+
bn as hasCanceledCallError,
|
|
677
|
+
ln as resolveVideoSendingBalancer,
|
|
678
|
+
ie as setParametersToSender,
|
|
679
|
+
un as tools
|
|
664
680
|
};
|