sip-connector 14.1.1 → 14.1.2-1
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-CZwqeStw.cjs +1 -0
- package/dist/SipConnector-DfaRIKWv.js +1345 -0
- package/dist/SipConnector.d.ts +315 -0
- package/dist/{src/SipConnectorFacade → SipConnectorFacade}/SipConnectorFacade.d.ts +1 -1
- 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/dist/utils/utils.d.ts +4 -0
- package/package.json +6 -5
- package/dist/SipConnector-DRjfFGAZ.js +0 -1339
- package/dist/SipConnector-EXAO9Z-2.cjs +0 -1
- package/dist/src/SipConnector.d.ts +0 -235
- /package/dist/{src/SipConnectorFacade → SipConnectorFacade}/index.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/BaseSession.mock.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/RTCPeerConnectionMock.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/RTCRtpSenderMock.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/RTCSessionMock.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/Registrator.mock.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/Request.mock.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/UA.mock.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/WebSocketInterface.mock.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/accountNotify.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/channels.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/channelsNotify.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/conferenceParticipantTokenIssuedNotify.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/delayPromise.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/enterRoom.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/index.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/jssip.mock.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/mediaState.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/participantMoveRequests.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/participantNotify.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/remoteCallerData.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/utils.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/webcastNotify.d.ts +0 -0
- /package/dist/{src/causes.d.ts → causes.d.ts} +0 -0
- /package/dist/{src/constants.d.ts → constants.d.ts} +0 -0
- /package/dist/{src/doMock.d.ts → doMock.d.ts} +0 -0
- /package/dist/{src/eventNames.d.ts → eventNames.d.ts} +0 -0
- /package/dist/{src/getExtraHeadersRemoteAddress.d.ts → getExtraHeadersRemoteAddress.d.ts} +0 -0
- /package/dist/{src/headers.d.ts → headers.d.ts} +0 -0
- /package/dist/{src/index.d.ts → index.d.ts} +0 -0
- /package/dist/{src/logger.d.ts → logger.d.ts} +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/configureDegradationPreference.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/configureEmptyEncodings.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/configureEncodings.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/configureMaxBitrate.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/configureScaleResolutionDownBy.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/hasChangedRTCRtpSendParameters.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/index.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/resolveHasNeedToUpdateItemEncoding.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/setParametersToSender.d.ts +0 -0
- /package/dist/{src/tools → tools}/__fixtures__/call.d.ts +0 -0
- /package/dist/{src/tools → tools}/__fixtures__/connectToServer.d.ts +0 -0
- /package/dist/{src/tools → tools}/__fixtures__/hasValidUri.d.ts +0 -0
- /package/dist/{src/tools → tools}/__fixtures__/permissions.d.ts +0 -0
- /package/dist/{src/tools → tools}/__fixtures__/processRequest.d.ts +0 -0
- /package/dist/{src/tools → tools}/__tests-utils__/parseObject.d.ts +0 -0
- /package/dist/{src/tools → tools}/__tests-utils__/resolveParseArray.d.ts +0 -0
- /package/dist/{src/tools → tools}/error/getLinkError.d.ts +0 -0
- /package/dist/{src/tools → tools}/error/getTypeFromError.d.ts +0 -0
- /package/dist/{src/tools → tools}/error/getValuesFromError.d.ts +0 -0
- /package/dist/{src/tools → tools}/error/index.d.ts +0 -0
- /package/dist/{src/tools → tools}/error/stringifyMessage.d.ts +0 -0
- /package/dist/{src/tools → tools}/generateSimulcastEncodings.d.ts +0 -0
- /package/dist/{src/tools → tools}/getExtraHeaders.d.ts +0 -0
- /package/dist/{src/tools → tools}/getUserAgent.d.ts +0 -0
- /package/dist/{src/tools → tools}/hasPurgatory.d.ts +0 -0
- /package/dist/{src/tools → tools}/index.d.ts +0 -0
- /package/dist/{src/tools → tools}/prepareMediaStream.d.ts +0 -0
- /package/dist/{src/tools → tools}/resolveUpdateTransceiver.d.ts +0 -0
- /package/dist/{src/tools → tools}/sendDTMFAccumulated.d.ts +0 -0
- /package/dist/{src/tools → tools}/setVideoTrackContentHints.d.ts +0 -0
- /package/dist/{src/tools → tools}/syncMediaState/index.d.ts +0 -0
- /package/dist/{src/tools → tools}/syncMediaState/resolveOnStartMainCam.d.ts +0 -0
- /package/dist/{src/tools → tools}/syncMediaState/resolveOnStartMic.d.ts +0 -0
- /package/dist/{src/tools → tools}/syncMediaState/resolveOnStopMainCam.d.ts +0 -0
- /package/dist/{src/tools → tools}/syncMediaState/resolveOnStopMic.d.ts +0 -0
- /package/dist/{src/types.d.ts → types.d.ts} +0 -0
- /package/dist/{src/utils → utils}/errors.d.ts +0 -0
- /package/dist/{src/utils → utils}/findSenderByStream.d.ts +0 -0
- /package/dist/{src/utils → utils}/findVideoSender.d.ts +0 -0
- /package/dist/{src/utils → utils}/findVideoTrack.d.ts +0 -0
- /package/dist/{src/utils → utils}/getCodecFromSender.d.ts +0 -0
- /package/dist/{src/utils → utils}/replaceForbiddenSymbolsWithUnderscore.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/balance.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/getMaxBitrateByWidth.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/getMaxBitrateByWidthAndCodec.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/hasAv1Codec.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/hasIncludesString.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/index.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/processSender.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/scaleBitrate.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/scaleBitrateByCodec.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/scaleResolutionAndBitrate.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/setEncodingsToSender.d.ts +0 -0
package/dist/doMock.js
CHANGED
|
@@ -1,31 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
var k = Object.defineProperty;
|
|
2
|
+
var A = (o, e, t) => e in o ? k(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var r = (o, e, t) => A(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { o as b, R as D, U as L, S as W } from "./SipConnector-DfaRIKWv.js";
|
|
5
|
+
import V from "@krivega/jssip/lib/NameAddrHeader";
|
|
6
|
+
import F from "@krivega/jssip/lib/URI";
|
|
7
|
+
import { EventEmitter as x } from "node:events";
|
|
8
|
+
import { IncomingRequest as U } from "@krivega/jssip/lib/SIPMessage";
|
|
9
|
+
import { createAudioMediaStreamTrackMock as H, createVideoMediaStreamTrackMock as z } from "webrtc-mock";
|
|
10
|
+
import N from "events-constructor";
|
|
11
|
+
import { URI as _, C as T } from "@krivega/jssip";
|
|
12
|
+
class S extends U {
|
|
13
|
+
constructor(t) {
|
|
14
|
+
super();
|
|
15
|
+
r(this, "headers");
|
|
16
|
+
this.headers = new Headers(t);
|
|
17
|
+
}
|
|
18
|
+
getHeader(t) {
|
|
19
|
+
return this.headers.get(t) ?? "";
|
|
16
20
|
}
|
|
17
21
|
}
|
|
18
|
-
class
|
|
19
|
-
originator;
|
|
20
|
-
connection;
|
|
21
|
-
events;
|
|
22
|
-
remote_identity;
|
|
23
|
-
mutedOptions = { audio: !1, video: !1 };
|
|
22
|
+
class Y {
|
|
24
23
|
constructor({
|
|
25
24
|
originator: e = "local",
|
|
26
25
|
eventHandlers: t
|
|
27
26
|
}) {
|
|
28
|
-
this
|
|
27
|
+
r(this, "originator");
|
|
28
|
+
r(this, "connection");
|
|
29
|
+
r(this, "events");
|
|
30
|
+
r(this, "remote_identity");
|
|
31
|
+
r(this, "mutedOptions", { audio: !1, video: !1 });
|
|
32
|
+
this.originator = e, this.events = new N(b), this.initEvents(t);
|
|
29
33
|
}
|
|
30
34
|
get contact() {
|
|
31
35
|
throw new Error("Method not implemented.");
|
|
@@ -77,7 +81,7 @@ class F {
|
|
|
77
81
|
terminate(e) {
|
|
78
82
|
throw new Error("Method not implemented.");
|
|
79
83
|
}
|
|
80
|
-
async sendInfo(e, t,
|
|
84
|
+
async sendInfo(e, t, n) {
|
|
81
85
|
throw new Error("Method not implemented.");
|
|
82
86
|
}
|
|
83
87
|
hold(e, t) {
|
|
@@ -153,7 +157,7 @@ class F {
|
|
|
153
157
|
throw new Error("Method not implemented.");
|
|
154
158
|
}
|
|
155
159
|
initEvents(e) {
|
|
156
|
-
Object.entries(e).forEach(([t,
|
|
160
|
+
Object.entries(e).forEach(([t, n]) => this.on(t, n));
|
|
157
161
|
}
|
|
158
162
|
// @ts-expect-error
|
|
159
163
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
@@ -186,20 +190,20 @@ class F {
|
|
|
186
190
|
return !0;
|
|
187
191
|
}
|
|
188
192
|
}
|
|
189
|
-
class
|
|
190
|
-
dtmf = null;
|
|
191
|
-
track = null;
|
|
192
|
-
transport = null;
|
|
193
|
-
transform = null;
|
|
194
|
-
parameters = {
|
|
195
|
-
encodings: [{}],
|
|
196
|
-
transactionId: "0",
|
|
197
|
-
codecs: [],
|
|
198
|
-
headerExtensions: [],
|
|
199
|
-
rtcp: {}
|
|
200
|
-
};
|
|
201
|
-
parametersGets;
|
|
193
|
+
class q {
|
|
202
194
|
constructor({ track: e } = {}) {
|
|
195
|
+
r(this, "dtmf", null);
|
|
196
|
+
r(this, "track", null);
|
|
197
|
+
r(this, "transport", null);
|
|
198
|
+
r(this, "transform", null);
|
|
199
|
+
r(this, "parameters", {
|
|
200
|
+
encodings: [{}],
|
|
201
|
+
transactionId: "0",
|
|
202
|
+
codecs: [],
|
|
203
|
+
headerExtensions: [],
|
|
204
|
+
rtcp: {}
|
|
205
|
+
});
|
|
206
|
+
r(this, "parametersGets");
|
|
203
207
|
this.track = e ?? null;
|
|
204
208
|
}
|
|
205
209
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -229,37 +233,43 @@ class x {
|
|
|
229
233
|
throw new Error("Method not implemented.");
|
|
230
234
|
}
|
|
231
235
|
}
|
|
232
|
-
class
|
|
233
|
-
senders = [];
|
|
234
|
-
receivers = [];
|
|
235
|
-
canTrickleIceCandidates;
|
|
236
|
-
connectionState;
|
|
237
|
-
currentLocalDescription;
|
|
238
|
-
currentRemoteDescription;
|
|
239
|
-
iceConnectionState;
|
|
240
|
-
iceGatheringState;
|
|
241
|
-
idpErrorInfo;
|
|
242
|
-
idpLoginUrl;
|
|
243
|
-
localDescription;
|
|
244
|
-
onconnectionstatechange;
|
|
245
|
-
ondatachannel;
|
|
246
|
-
onicecandidate;
|
|
247
|
-
// eslint-disable-next-line unicorn/no-null
|
|
248
|
-
onicecandidateerror = null;
|
|
249
|
-
oniceconnectionstatechange;
|
|
250
|
-
onicegatheringstatechange;
|
|
251
|
-
onnegotiationneeded;
|
|
252
|
-
onsignalingstatechange;
|
|
253
|
-
ontrack;
|
|
254
|
-
peerIdentity = void 0;
|
|
255
|
-
pendingLocalDescription;
|
|
256
|
-
pendingRemoteDescription;
|
|
257
|
-
remoteDescription;
|
|
258
|
-
// eslint-disable-next-line unicorn/no-null
|
|
259
|
-
sctp = null;
|
|
260
|
-
signalingState;
|
|
236
|
+
class G {
|
|
261
237
|
constructor(e, t) {
|
|
262
|
-
|
|
238
|
+
r(this, "senders", []);
|
|
239
|
+
r(this, "receivers", []);
|
|
240
|
+
r(this, "canTrickleIceCandidates");
|
|
241
|
+
r(this, "connectionState");
|
|
242
|
+
r(this, "currentLocalDescription");
|
|
243
|
+
r(this, "currentRemoteDescription");
|
|
244
|
+
r(this, "iceConnectionState");
|
|
245
|
+
r(this, "iceGatheringState");
|
|
246
|
+
r(this, "idpErrorInfo");
|
|
247
|
+
r(this, "idpLoginUrl");
|
|
248
|
+
r(this, "localDescription");
|
|
249
|
+
r(this, "onconnectionstatechange");
|
|
250
|
+
r(this, "ondatachannel");
|
|
251
|
+
r(this, "onicecandidate");
|
|
252
|
+
// eslint-disable-next-line unicorn/no-null
|
|
253
|
+
r(this, "onicecandidateerror", null);
|
|
254
|
+
r(this, "oniceconnectionstatechange");
|
|
255
|
+
r(this, "onicegatheringstatechange");
|
|
256
|
+
r(this, "onnegotiationneeded");
|
|
257
|
+
r(this, "onsignalingstatechange");
|
|
258
|
+
r(this, "ontrack");
|
|
259
|
+
r(this, "peerIdentity");
|
|
260
|
+
r(this, "pendingLocalDescription");
|
|
261
|
+
r(this, "pendingRemoteDescription");
|
|
262
|
+
r(this, "remoteDescription");
|
|
263
|
+
// eslint-disable-next-line unicorn/no-null
|
|
264
|
+
r(this, "sctp", null);
|
|
265
|
+
r(this, "signalingState");
|
|
266
|
+
r(this, "getReceivers", () => this.receivers);
|
|
267
|
+
r(this, "getSenders", () => this.senders);
|
|
268
|
+
r(this, "addTrack", (e) => {
|
|
269
|
+
const t = new q({ track: e });
|
|
270
|
+
return this.senders.push(t), t;
|
|
271
|
+
});
|
|
272
|
+
this.receivers = t.map((n) => ({ track: n }));
|
|
263
273
|
}
|
|
264
274
|
getRemoteStreams() {
|
|
265
275
|
throw new Error("Method not implemented.");
|
|
@@ -282,7 +292,7 @@ class U {
|
|
|
282
292
|
createDataChannel(e, t) {
|
|
283
293
|
throw new Error("Method not implemented.");
|
|
284
294
|
}
|
|
285
|
-
async createOffer(e, t,
|
|
295
|
+
async createOffer(e, t, n) {
|
|
286
296
|
throw new Error("Method not implemented.");
|
|
287
297
|
}
|
|
288
298
|
getConfiguration() {
|
|
@@ -309,156 +319,147 @@ class U {
|
|
|
309
319
|
async setRemoteDescription(e) {
|
|
310
320
|
throw new Error("Method not implemented.");
|
|
311
321
|
}
|
|
312
|
-
addEventListener(e, t,
|
|
322
|
+
addEventListener(e, t, n) {
|
|
313
323
|
throw new Error("Method not implemented.");
|
|
314
324
|
}
|
|
315
|
-
removeEventListener(e, t,
|
|
325
|
+
removeEventListener(e, t, n) {
|
|
316
326
|
throw new Error("Method not implemented.");
|
|
317
327
|
}
|
|
318
328
|
dispatchEvent(e) {
|
|
319
329
|
throw new Error("Method not implemented.");
|
|
320
330
|
}
|
|
321
|
-
getReceivers = () => this.receivers;
|
|
322
|
-
getSenders = () => this.senders;
|
|
323
|
-
addTrack = (e) => {
|
|
324
|
-
const t = new x({ track: e });
|
|
325
|
-
return this.senders.push(t), t;
|
|
326
|
-
};
|
|
327
331
|
}
|
|
328
|
-
function
|
|
329
|
-
const e =
|
|
332
|
+
function J(o) {
|
|
333
|
+
const e = o.match(/(purgatory)|[\d.]+/g);
|
|
330
334
|
if (!e)
|
|
331
335
|
throw new Error("wrong sip url");
|
|
332
336
|
return e[0];
|
|
333
337
|
}
|
|
334
|
-
const
|
|
335
|
-
class s extends F {
|
|
336
|
-
static startPresentationError;
|
|
337
|
-
static countStartPresentationError = Number.POSITIVE_INFINITY;
|
|
338
|
-
static countStartsPresentation = 0;
|
|
339
|
-
url;
|
|
340
|
-
status_code;
|
|
341
|
-
/**
|
|
342
|
-
* answer
|
|
343
|
-
*
|
|
344
|
-
* @param {Object} arg1 - The argument 1
|
|
345
|
-
* @param {Object} arg1.mediaStream - The media stream
|
|
346
|
-
* @param {Array} arg1.eventHandlers - The event handlers
|
|
347
|
-
|
|
348
|
-
* @returns {undefined}
|
|
349
|
-
*/
|
|
350
|
-
answer = jest.fn(({ mediaStream: e }) => {
|
|
351
|
-
if (this.originator !== "remote")
|
|
352
|
-
throw new Error("answer available only for remote sessions");
|
|
353
|
-
this.initPeerconnection(e), setTimeout(() => {
|
|
354
|
-
this.trigger("connecting"), setTimeout(() => {
|
|
355
|
-
this.trigger("accepted");
|
|
356
|
-
}, 100), setTimeout(() => {
|
|
357
|
-
this.trigger("confirmed");
|
|
358
|
-
}, 200);
|
|
359
|
-
}, l);
|
|
360
|
-
});
|
|
361
|
-
isEndedInner = !1;
|
|
338
|
+
const g = 400, $ = "777", j = (o) => o.getVideoTracks().length > 0, a = class a extends Y {
|
|
362
339
|
constructor({
|
|
363
|
-
url:
|
|
364
|
-
mediaStream:
|
|
365
|
-
eventHandlers:
|
|
366
|
-
originator:
|
|
340
|
+
url: t = "",
|
|
341
|
+
mediaStream: n,
|
|
342
|
+
eventHandlers: i,
|
|
343
|
+
originator: d
|
|
367
344
|
}) {
|
|
368
|
-
super({ originator:
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
345
|
+
super({ originator: d, eventHandlers: i });
|
|
346
|
+
r(this, "url");
|
|
347
|
+
r(this, "status_code");
|
|
348
|
+
/**
|
|
349
|
+
* answer
|
|
350
|
+
*
|
|
351
|
+
* @param {Object} arg1 - The argument 1
|
|
352
|
+
* @param {Object} arg1.mediaStream - The media stream
|
|
353
|
+
* @param {Array} arg1.eventHandlers - The event handlers
|
|
354
|
+
|
|
355
|
+
* @returns {undefined}
|
|
356
|
+
*/
|
|
357
|
+
r(this, "answer", jest.fn(({ mediaStream: t }) => {
|
|
358
|
+
if (this.originator !== "remote")
|
|
359
|
+
throw new Error("answer available only for remote sessions");
|
|
360
|
+
this.initPeerconnection(t), setTimeout(() => {
|
|
361
|
+
this.trigger("connecting"), setTimeout(() => {
|
|
362
|
+
this.trigger("accepted");
|
|
363
|
+
}, 100), setTimeout(() => {
|
|
364
|
+
this.trigger("confirmed");
|
|
365
|
+
}, 200);
|
|
366
|
+
}, g);
|
|
367
|
+
}));
|
|
368
|
+
r(this, "isEndedInner", !1);
|
|
369
|
+
this.url = t, this.initPeerconnection(n);
|
|
370
|
+
}
|
|
371
|
+
static setStartPresentationError(t, { count: n = Number.POSITIVE_INFINITY } = {}) {
|
|
372
|
+
this.startPresentationError = t, this.countStartPresentationError = n;
|
|
372
373
|
}
|
|
373
374
|
static resetStartPresentationError() {
|
|
374
375
|
this.startPresentationError = void 0, this.countStartPresentationError = Number.POSITIVE_INFINITY, this.countStartsPresentation = 0;
|
|
375
376
|
}
|
|
376
|
-
async startPresentation(
|
|
377
|
-
if (
|
|
378
|
-
throw
|
|
379
|
-
return super.startPresentation(
|
|
380
|
-
}
|
|
381
|
-
initPeerconnection(
|
|
382
|
-
return
|
|
383
|
-
}
|
|
384
|
-
createPeerconnection(
|
|
385
|
-
const
|
|
386
|
-
|
|
387
|
-
const
|
|
388
|
-
if (
|
|
389
|
-
const
|
|
390
|
-
|
|
377
|
+
async startPresentation(t) {
|
|
378
|
+
if (a.countStartsPresentation += 1, a.startPresentationError && a.countStartsPresentation < a.countStartPresentationError)
|
|
379
|
+
throw a.startPresentationError;
|
|
380
|
+
return super.startPresentation(t);
|
|
381
|
+
}
|
|
382
|
+
initPeerconnection(t) {
|
|
383
|
+
return t ? (this.createPeerconnection(t), !0) : !1;
|
|
384
|
+
}
|
|
385
|
+
createPeerconnection(t) {
|
|
386
|
+
const n = H();
|
|
387
|
+
n.id = "mainaudio1";
|
|
388
|
+
const i = [n];
|
|
389
|
+
if (j(t)) {
|
|
390
|
+
const c = z();
|
|
391
|
+
c.id = "mainvideo1", i.push(c);
|
|
391
392
|
}
|
|
392
|
-
this.connection = new
|
|
393
|
+
this.connection = new G(void 0, i), this.addStream(t), setTimeout(() => {
|
|
393
394
|
this.trigger("peerconnection", { peerconnection: this.connection });
|
|
394
|
-
},
|
|
395
|
+
}, g);
|
|
395
396
|
}
|
|
396
|
-
connect(
|
|
397
|
-
const
|
|
397
|
+
connect(t) {
|
|
398
|
+
const n = J(t);
|
|
398
399
|
setTimeout(() => {
|
|
399
|
-
this.url.includes(
|
|
400
|
+
this.url.includes($) ? this.trigger("failed", {
|
|
400
401
|
originator: "remote",
|
|
401
402
|
message: "IncomingResponse",
|
|
402
|
-
cause:
|
|
403
|
+
cause: D
|
|
403
404
|
}) : (this.trigger("connecting"), setTimeout(() => {
|
|
404
|
-
this.trigger("enterRoom", { room:
|
|
405
|
+
this.trigger("enterRoom", { room: n });
|
|
405
406
|
}, 100), setTimeout(() => {
|
|
406
407
|
this.trigger("accepted");
|
|
407
408
|
}, 200), setTimeout(() => {
|
|
408
409
|
this.trigger("confirmed");
|
|
409
410
|
}, 300));
|
|
410
|
-
},
|
|
411
|
+
}, g);
|
|
411
412
|
}
|
|
412
|
-
terminate({ status_code:
|
|
413
|
-
return this.status_code =
|
|
413
|
+
terminate({ status_code: t, cause: n } = {}) {
|
|
414
|
+
return this.status_code = t, this.trigger("ended", { status_code: t, cause: n, originator: "local" }), this.isEndedInner = !1, this;
|
|
414
415
|
}
|
|
415
416
|
async terminateAsync({
|
|
416
|
-
status_code:
|
|
417
|
-
cause:
|
|
417
|
+
status_code: t,
|
|
418
|
+
cause: n
|
|
418
419
|
} = {}) {
|
|
419
|
-
this.terminate({ status_code:
|
|
420
|
+
this.terminate({ status_code: t, cause: n });
|
|
420
421
|
}
|
|
421
|
-
terminateRemote({ status_code:
|
|
422
|
-
return this.status_code =
|
|
422
|
+
terminateRemote({ status_code: t } = {}) {
|
|
423
|
+
return this.status_code = t, this.trigger("ended", { status_code: t, originator: "remote" }), this;
|
|
423
424
|
}
|
|
424
|
-
addStream(
|
|
425
|
-
|
|
425
|
+
addStream(t, n = "getTracks") {
|
|
426
|
+
t[n]().forEach((i) => this.connection.addTrack(i));
|
|
426
427
|
}
|
|
427
|
-
forEachSenders(
|
|
428
|
-
const
|
|
429
|
-
for (const
|
|
430
|
-
|
|
431
|
-
return
|
|
428
|
+
forEachSenders(t) {
|
|
429
|
+
const n = this.connection.getSenders();
|
|
430
|
+
for (const i of n)
|
|
431
|
+
t(i);
|
|
432
|
+
return n;
|
|
432
433
|
}
|
|
433
434
|
/* eslint-disable no-param-reassign */
|
|
434
|
-
toggleMuteAudio(
|
|
435
|
-
this.forEachSenders(({ track:
|
|
436
|
-
|
|
435
|
+
toggleMuteAudio(t) {
|
|
436
|
+
this.forEachSenders(({ track: n }) => {
|
|
437
|
+
n && n.kind === "audio" && (n.enabled = !t);
|
|
437
438
|
});
|
|
438
439
|
}
|
|
439
440
|
/* eslint-enable no-param-reassign */
|
|
440
441
|
/* eslint-disable no-param-reassign */
|
|
441
|
-
toggleMuteVideo(
|
|
442
|
-
this.forEachSenders(({ track:
|
|
443
|
-
|
|
442
|
+
toggleMuteVideo(t) {
|
|
443
|
+
this.forEachSenders(({ track: n }) => {
|
|
444
|
+
n && n.kind === "video" && (n.enabled = !t);
|
|
444
445
|
});
|
|
445
446
|
}
|
|
446
|
-
mute(
|
|
447
|
-
|
|
447
|
+
mute(t) {
|
|
448
|
+
t.audio && (this.mutedOptions.audio = !0, this.toggleMuteAudio(this.mutedOptions.audio)), t.video && (this.mutedOptions.video = !0, this.toggleMuteVideo(this.mutedOptions.video)), this.onmute(t);
|
|
448
449
|
}
|
|
449
|
-
unmute(
|
|
450
|
-
|
|
450
|
+
unmute(t) {
|
|
451
|
+
t.audio && (this.mutedOptions.audio = !1), t.video && (this.mutedOptions.video = !1), this.trigger("unmuted", t);
|
|
451
452
|
}
|
|
452
453
|
isMuted() {
|
|
453
454
|
return this.mutedOptions;
|
|
454
455
|
}
|
|
455
456
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function, class-methods-use-this
|
|
456
|
-
async replaceMediaStream(
|
|
457
|
+
async replaceMediaStream(t) {
|
|
457
458
|
}
|
|
458
|
-
onmute({ audio:
|
|
459
|
+
onmute({ audio: t, video: n }) {
|
|
459
460
|
this.trigger("muted", {
|
|
460
|
-
audio:
|
|
461
|
-
video:
|
|
461
|
+
audio: t,
|
|
462
|
+
video: n
|
|
462
463
|
});
|
|
463
464
|
}
|
|
464
465
|
// eslint-disable-next-line @typescript-eslint/no-empty-function, class-methods-use-this
|
|
@@ -467,13 +468,17 @@ class s extends F {
|
|
|
467
468
|
isEnded() {
|
|
468
469
|
return this.isEndedInner;
|
|
469
470
|
}
|
|
470
|
-
newInfo(
|
|
471
|
-
this.trigger("newInfo",
|
|
471
|
+
newInfo(t) {
|
|
472
|
+
this.trigger("newInfo", t);
|
|
472
473
|
}
|
|
473
474
|
/* eslint-enable no-param-reassign */
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
|
|
475
|
+
};
|
|
476
|
+
r(a, "startPresentationError"), r(a, "countStartPresentationError", Number.POSITIVE_INFINITY), r(a, "countStartsPresentation", 0);
|
|
477
|
+
let u = a;
|
|
478
|
+
class B {
|
|
479
|
+
constructor() {
|
|
480
|
+
r(this, "extraHeaders", []);
|
|
481
|
+
}
|
|
477
482
|
setExtraHeaders(e) {
|
|
478
483
|
this.extraHeaders = e;
|
|
479
484
|
}
|
|
@@ -481,44 +486,39 @@ class q {
|
|
|
481
486
|
setExtraContactParams() {
|
|
482
487
|
}
|
|
483
488
|
}
|
|
484
|
-
const
|
|
489
|
+
const h = "PASSWORD_CORRECT", R = "PASSWORD_CORRECT_2", K = "NAME_INCORRECT", m = 400, w = {
|
|
485
490
|
url: "wss://sipServerUrl/webrtc/wss/",
|
|
486
491
|
sip_uri: "sip:sipServerUrl;transport=ws",
|
|
487
492
|
via_transport: "WSS"
|
|
488
|
-
},
|
|
493
|
+
}, C = {
|
|
489
494
|
status_code: 200,
|
|
490
495
|
reason_phrase: "OK"
|
|
491
|
-
},
|
|
496
|
+
}, y = {
|
|
492
497
|
status_code: 401,
|
|
493
498
|
reason_phrase: "Unauthorized"
|
|
494
|
-
}
|
|
495
|
-
class i {
|
|
496
|
-
static isAvailableTelephony = !0;
|
|
497
|
-
static startError;
|
|
498
|
-
static countStartError = Number.POSITIVE_INFINITY;
|
|
499
|
-
static countStarts = 0;
|
|
500
|
-
events;
|
|
501
|
-
registratorInner;
|
|
502
|
-
// @ts-expect-error
|
|
503
|
-
call = jest.fn(
|
|
504
|
-
(e, t) => {
|
|
505
|
-
const { mediaStream: r, eventHandlers: o } = t;
|
|
506
|
-
return this.session = new s({ url: e, mediaStream: r, eventHandlers: o, originator: "local" }), this.session.connect(e), this.session;
|
|
507
|
-
}
|
|
508
|
-
);
|
|
509
|
-
startedTimeout;
|
|
510
|
-
stopedTimeout;
|
|
511
|
-
session;
|
|
512
|
-
isRegisteredInner;
|
|
513
|
-
isConnectedInner;
|
|
514
|
-
configuration;
|
|
499
|
+
}, s = class s {
|
|
515
500
|
constructor(e) {
|
|
516
|
-
this
|
|
517
|
-
|
|
501
|
+
r(this, "events");
|
|
502
|
+
r(this, "registratorInner");
|
|
503
|
+
// @ts-expect-error
|
|
504
|
+
r(this, "call", jest.fn(
|
|
505
|
+
(e, t) => {
|
|
506
|
+
const { mediaStream: n, eventHandlers: i } = t;
|
|
507
|
+
return this.session = new u({ url: e, mediaStream: n, eventHandlers: i, originator: "local" }), this.session.connect(e), this.session;
|
|
508
|
+
}
|
|
509
|
+
));
|
|
510
|
+
r(this, "startedTimeout");
|
|
511
|
+
r(this, "stopedTimeout");
|
|
512
|
+
r(this, "session");
|
|
513
|
+
r(this, "isRegisteredInner");
|
|
514
|
+
r(this, "isConnectedInner");
|
|
515
|
+
r(this, "configuration");
|
|
516
|
+
this.events = new N(L);
|
|
517
|
+
const [t, n] = e.uri.split(":"), [i, d] = n.split("@"), c = {
|
|
518
518
|
...e,
|
|
519
|
-
uri: new
|
|
519
|
+
uri: new _(t, i, d)
|
|
520
520
|
};
|
|
521
|
-
this.configuration =
|
|
521
|
+
this.configuration = c, this.registratorInner = new B();
|
|
522
522
|
}
|
|
523
523
|
static setStartError(e, { count: t = Number.POSITIVE_INFINITY } = {}) {
|
|
524
524
|
this.startError = e, this.countStartError = t;
|
|
@@ -538,8 +538,8 @@ class i {
|
|
|
538
538
|
* @returns {undefined}
|
|
539
539
|
*/
|
|
540
540
|
start() {
|
|
541
|
-
if (
|
|
542
|
-
this.trigger("disconnected",
|
|
541
|
+
if (s.countStarts += 1, s.startError && s.countStarts < s.countStartError) {
|
|
542
|
+
this.trigger("disconnected", s.startError);
|
|
543
543
|
return;
|
|
544
544
|
}
|
|
545
545
|
this.register();
|
|
@@ -551,8 +551,8 @@ class i {
|
|
|
551
551
|
*/
|
|
552
552
|
stop() {
|
|
553
553
|
this.startedTimeout && clearTimeout(this.startedTimeout), this.stopedTimeout && clearTimeout(this.stopedTimeout), this.unregister(), this.isStarted() ? this.stopedTimeout = setTimeout(() => {
|
|
554
|
-
this.trigger("disconnected", { error: !0, socket:
|
|
555
|
-
},
|
|
554
|
+
this.trigger("disconnected", { error: !0, socket: w });
|
|
555
|
+
}, m) : this.trigger("disconnected", { error: !0, socket: w });
|
|
556
556
|
}
|
|
557
557
|
on(e, t) {
|
|
558
558
|
return this.events.on(e, t), this;
|
|
@@ -575,7 +575,8 @@ class i {
|
|
|
575
575
|
* @returns {undefined}
|
|
576
576
|
*/
|
|
577
577
|
terminateSessions() {
|
|
578
|
-
|
|
578
|
+
var e;
|
|
579
|
+
(e = this.session) == null || e.terminate();
|
|
579
580
|
}
|
|
580
581
|
set(e, t) {
|
|
581
582
|
return this.configuration[e] = t, !0;
|
|
@@ -587,14 +588,14 @@ class i {
|
|
|
587
588
|
*/
|
|
588
589
|
register() {
|
|
589
590
|
this.startedTimeout && clearTimeout(this.startedTimeout);
|
|
590
|
-
const { password: e, register: t, uri:
|
|
591
|
-
t === !0 &&
|
|
592
|
-
this.trigger("registrationFailed", { response:
|
|
593
|
-
},
|
|
594
|
-
this.trigger("registered", { response:
|
|
595
|
-
},
|
|
596
|
-
this.trigger("registrationFailed", { response:
|
|
597
|
-
},
|
|
591
|
+
const { password: e, register: t, uri: n } = this.configuration;
|
|
592
|
+
t === !0 && n.user.includes(K) ? (this.isRegisteredInner = !1, this.isConnectedInner = !1, this.startedTimeout = setTimeout(() => {
|
|
593
|
+
this.trigger("registrationFailed", { response: y, cause: T.causes.REJECTED });
|
|
594
|
+
}, m)) : !this.isRegistered() && t === !0 && (e === h || e === R) ? (this.isRegisteredInner = !0, this.startedTimeout = setTimeout(() => {
|
|
595
|
+
this.trigger("registered", { response: C });
|
|
596
|
+
}, m)) : t === !0 && e !== h && e !== R && (this.isRegisteredInner = !1, this.isConnectedInner = !1, this.startedTimeout = setTimeout(() => {
|
|
597
|
+
this.trigger("registrationFailed", { response: y, cause: T.causes.REJECTED });
|
|
598
|
+
}, m)), s.isAvailableTelephony ? (this.trigger("connected", { socket: w }), this.isConnectedInner = !0) : this.stop();
|
|
598
599
|
}
|
|
599
600
|
/**
|
|
600
601
|
* unregister
|
|
@@ -602,7 +603,7 @@ class i {
|
|
|
602
603
|
* @returns {undefined}
|
|
603
604
|
*/
|
|
604
605
|
unregister() {
|
|
605
|
-
this.isRegisteredInner = !1, this.isConnectedInner = !1, this.trigger("unregistered", { response:
|
|
606
|
+
this.isRegisteredInner = !1, this.isConnectedInner = !1, this.trigger("unregistered", { response: C });
|
|
606
607
|
}
|
|
607
608
|
isRegistered() {
|
|
608
609
|
return this.isRegisteredInner === !0;
|
|
@@ -624,122 +625,125 @@ class i {
|
|
|
624
625
|
registrator() {
|
|
625
626
|
return this.registratorInner;
|
|
626
627
|
}
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
|
|
628
|
+
};
|
|
629
|
+
r(s, "isAvailableTelephony", !0), r(s, "startError"), r(s, "countStartError", Number.POSITIVE_INFINITY), r(s, "countStarts", 0);
|
|
630
|
+
let E = s;
|
|
631
|
+
class X {
|
|
630
632
|
constructor(e) {
|
|
633
|
+
r(this, "url");
|
|
631
634
|
this.url = e;
|
|
632
635
|
}
|
|
633
636
|
}
|
|
634
|
-
class
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
637
|
+
class Q extends x {
|
|
638
|
+
constructor(t, n) {
|
|
639
|
+
super();
|
|
640
|
+
r(this, "contentType");
|
|
641
|
+
r(this, "body");
|
|
642
|
+
this.contentType = t, this.body = n;
|
|
639
643
|
}
|
|
640
644
|
}
|
|
641
|
-
const
|
|
642
|
-
const t = new
|
|
643
|
-
originator:
|
|
645
|
+
const f = "remote", Z = (o, e) => {
|
|
646
|
+
const t = new S(e), n = {
|
|
647
|
+
originator: f,
|
|
644
648
|
request: t,
|
|
645
|
-
info: new
|
|
649
|
+
info: new Q("", "")
|
|
646
650
|
};
|
|
647
|
-
|
|
648
|
-
},
|
|
649
|
-
const
|
|
650
|
-
|
|
651
|
-
},
|
|
651
|
+
o.newInfo(n);
|
|
652
|
+
}, ee = (o, e) => {
|
|
653
|
+
const n = { event: "sipEvent", request: new S(e) };
|
|
654
|
+
o.newSipEvent(n);
|
|
655
|
+
}, te = (o, {
|
|
652
656
|
incomingNumber: e = "1234",
|
|
653
657
|
displayName: t,
|
|
654
|
-
host:
|
|
658
|
+
host: n
|
|
655
659
|
}) => {
|
|
656
|
-
const
|
|
657
|
-
|
|
658
|
-
const
|
|
659
|
-
|
|
660
|
-
originator:
|
|
661
|
-
session:
|
|
662
|
-
request:
|
|
660
|
+
const i = new u({ originator: f, eventHandlers: {} }), d = new F("sip", e, n);
|
|
661
|
+
i.remote_identity = new V(d, t);
|
|
662
|
+
const c = new S([]);
|
|
663
|
+
o.trigger("newRTCSession", {
|
|
664
|
+
originator: f,
|
|
665
|
+
session: i,
|
|
666
|
+
request: c
|
|
663
667
|
});
|
|
664
|
-
},
|
|
665
|
-
e ?
|
|
666
|
-
},
|
|
667
|
-
triggerNewInfo:
|
|
668
|
-
triggerNewSipEvent:
|
|
669
|
-
triggerIncomingSession:
|
|
670
|
-
triggerFailIncomingSession:
|
|
671
|
-
WebSocketInterface:
|
|
672
|
-
UA:
|
|
668
|
+
}, re = (o, e) => {
|
|
669
|
+
e ? o.trigger("failed", e) : o.trigger("failed", o);
|
|
670
|
+
}, P = {
|
|
671
|
+
triggerNewInfo: Z,
|
|
672
|
+
triggerNewSipEvent: ee,
|
|
673
|
+
triggerIncomingSession: te,
|
|
674
|
+
triggerFailIncomingSession: re,
|
|
675
|
+
WebSocketInterface: X,
|
|
676
|
+
UA: E,
|
|
673
677
|
C: {
|
|
674
678
|
INVITE: "INVITE"
|
|
675
679
|
}
|
|
676
|
-
},
|
|
680
|
+
}, I = "user", l = "displayName", M = "SIP_SERVER_URL", O = "SIP_WEB_SOCKET_SERVER_URL", ne = new P.WebSocketInterface(O), v = {
|
|
677
681
|
userAgent: "Chrome",
|
|
678
|
-
sipServerUrl:
|
|
679
|
-
sipWebSocketServerURL:
|
|
680
|
-
},
|
|
681
|
-
...
|
|
682
|
-
},
|
|
683
|
-
...
|
|
684
|
-
user:
|
|
685
|
-
password:
|
|
682
|
+
sipServerUrl: M,
|
|
683
|
+
sipWebSocketServerURL: O
|
|
684
|
+
}, ge = {
|
|
685
|
+
...v
|
|
686
|
+
}, oe = {
|
|
687
|
+
...v,
|
|
688
|
+
user: I,
|
|
689
|
+
password: h,
|
|
686
690
|
register: !0
|
|
687
|
-
},
|
|
688
|
-
...
|
|
689
|
-
displayName:
|
|
690
|
-
},
|
|
691
|
-
...
|
|
692
|
-
displayName:
|
|
691
|
+
}, we = {
|
|
692
|
+
...oe,
|
|
693
|
+
displayName: l
|
|
694
|
+
}, Ee = {
|
|
695
|
+
...v,
|
|
696
|
+
displayName: l,
|
|
693
697
|
register: !1
|
|
694
|
-
},
|
|
698
|
+
}, p = {
|
|
695
699
|
session_timers: !1,
|
|
696
|
-
sockets: [
|
|
700
|
+
sockets: [ne],
|
|
697
701
|
user_agent: "Chrome",
|
|
698
702
|
sdp_semantics: "unified-plan",
|
|
699
703
|
register_expires: 300,
|
|
700
704
|
connection_recovery_max_interval: 6,
|
|
701
705
|
connection_recovery_min_interval: 2
|
|
702
|
-
},
|
|
703
|
-
...
|
|
704
|
-
password:
|
|
705
|
-
uri: new
|
|
706
|
+
}, fe = {
|
|
707
|
+
...p,
|
|
708
|
+
password: h,
|
|
709
|
+
uri: new _("sip", I, M),
|
|
706
710
|
display_name: "",
|
|
707
711
|
register: !0
|
|
708
|
-
},
|
|
709
|
-
...
|
|
710
|
-
password:
|
|
711
|
-
uri: new
|
|
712
|
-
display_name:
|
|
712
|
+
}, _e = {
|
|
713
|
+
...p,
|
|
714
|
+
password: h,
|
|
715
|
+
uri: new _("sip", I, M),
|
|
716
|
+
display_name: l,
|
|
713
717
|
register: !0
|
|
714
|
-
},
|
|
715
|
-
...
|
|
716
|
-
display_name:
|
|
718
|
+
}, Se = {
|
|
719
|
+
...p,
|
|
720
|
+
display_name: l,
|
|
717
721
|
register: !1
|
|
718
|
-
},
|
|
719
|
-
...
|
|
722
|
+
}, Ie = {
|
|
723
|
+
...p,
|
|
720
724
|
display_name: "",
|
|
721
725
|
register: !1
|
|
722
|
-
},
|
|
723
|
-
JsSIP:
|
|
726
|
+
}, ie = "10.10.10.10", Me = [`X-Vinteo-Remote: ${ie}`], ve = () => new W({
|
|
727
|
+
JsSIP: P
|
|
724
728
|
});
|
|
725
729
|
export {
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
730
|
+
$ as FAILED_CONFERENCE_NUMBER,
|
|
731
|
+
K as NAME_INCORRECT,
|
|
732
|
+
h as PASSWORD_CORRECT,
|
|
733
|
+
R as PASSWORD_CORRECT_2,
|
|
734
|
+
M as SIP_SERVER_URL,
|
|
735
|
+
O as SIP_WEB_SOCKET_SERVER_URL,
|
|
736
|
+
oe as dataForConnectionWithAuthorization,
|
|
737
|
+
we as dataForConnectionWithAuthorizationWithDisplayName,
|
|
738
|
+
Ee as dataForConnectionWithoutAuthorization,
|
|
739
|
+
ge as dataForConnectionWithoutAuthorizationWithoutDisplayName,
|
|
740
|
+
l as displayName,
|
|
741
|
+
ve as doMockSipConnector,
|
|
742
|
+
Me as extraHeadersRemoteAddress,
|
|
743
|
+
ie as remoteAddress,
|
|
744
|
+
fe as uaConfigurationWithAuthorization,
|
|
745
|
+
_e as uaConfigurationWithAuthorizationWithDisplayName,
|
|
746
|
+
Se as uaConfigurationWithoutAuthorization,
|
|
747
|
+
Ie as uaConfigurationWithoutAuthorizationWithoutDisplayName,
|
|
748
|
+
I as user
|
|
745
749
|
};
|