sip-connector 14.1.0-alpha.9 → 14.1.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-DRjfFGAZ.js +1339 -0
- package/dist/SipConnector-EXAO9Z-2.cjs +1 -0
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +162 -267
- package/dist/index.cjs +1 -1
- package/dist/index.js +526 -577
- package/dist/src/SipConnector.d.ts +235 -0
- package/dist/{SipConnectorFacade → src/SipConnectorFacade}/SipConnectorFacade.d.ts +16 -7
- package/dist/{__fixtures__ → src/__fixtures__}/BaseSession.mock.d.ts +5 -5
- package/dist/{__fixtures__ → src/__fixtures__}/RTCSessionMock.d.ts +4 -9
- package/dist/{__fixtures__ → src/__fixtures__}/UA.mock.d.ts +14 -12
- package/dist/{__fixtures__ → src/__fixtures__}/index.d.ts +4 -4
- package/dist/{__fixtures__ → src/__fixtures__}/jssip.mock.d.ts +3 -3
- package/dist/src/causes.d.ts +23 -0
- package/dist/{doMock.d.ts → src/doMock.d.ts} +1 -2
- package/dist/{__fixtures__ → src}/eventNames.d.ts +1 -1
- package/dist/src/headers.d.ts +37 -0
- package/dist/src/index.d.ts +11 -0
- package/dist/{tools → src/tools}/__fixtures__/connectToServer.d.ts +2 -2
- package/dist/{tools → src/tools}/__fixtures__/processRequest.d.ts +1 -1
- package/dist/{tools → src/tools}/error/getLinkError.d.ts +1 -1
- package/dist/{tools → src/tools}/error/getTypeFromError.d.ts +1 -1
- package/dist/{tools → src/tools}/error/getValuesFromError.d.ts +1 -1
- package/dist/{tools → src/tools}/index.d.ts +1 -1
- package/dist/{tools → src/tools}/prepareMediaStream.d.ts +1 -1
- package/dist/{tools → src/tools}/setVideoTrackContentHints.d.ts +1 -1
- package/dist/{tools → src/tools}/syncMediaState/index.d.ts +1 -1
- package/dist/{tools → src/tools}/syncMediaState/resolveOnStartMainCam.d.ts +1 -1
- package/dist/{tools → src/tools}/syncMediaState/resolveOnStartMic.d.ts +1 -1
- package/dist/{tools → src/tools}/syncMediaState/resolveOnStopMainCam.d.ts +1 -1
- package/dist/{tools → src/tools}/syncMediaState/resolveOnStopMic.d.ts +1 -1
- package/dist/src/types.d.ts +69 -0
- package/dist/{videoSendingBalancer → src/videoSendingBalancer}/balance.d.ts +1 -1
- package/dist/{videoSendingBalancer → src/videoSendingBalancer}/index.d.ts +1 -1
- package/dist/{videoSendingBalancer → src/videoSendingBalancer}/processSender.d.ts +1 -1
- package/dist/src/videoSendingBalancer/scaleBitrate.d.ts +2 -0
- package/package.json +32 -26
- package/dist/@SipConnector-BOHJ000Z.cjs +0 -1
- package/dist/@SipConnector-BxitfweK.js +0 -2267
- package/dist/ApiManager/@ApiManager.d.ts +0 -58
- package/dist/ApiManager/constants.d.ts +0 -71
- package/dist/ApiManager/eventNames.d.ts +0 -33
- package/dist/ApiManager/index.d.ts +0 -3
- package/dist/ApiManager/types.d.ts +0 -99
- package/dist/CallManager/@CallManager.d.ts +0 -26
- package/dist/CallManager/AbstractCallStrategy.d.ts +0 -47
- package/dist/CallManager/MCUCallStrategy.d.ts +0 -30
- package/dist/CallManager/RemoteStreamsManager.d.ts +0 -8
- package/dist/CallManager/causes.d.ts +0 -13
- package/dist/CallManager/eventNames.d.ts +0 -45
- package/dist/CallManager/hasCanceledCallError.d.ts +0 -2
- package/dist/CallManager/index.d.ts +0 -7
- package/dist/CallManager/types.d.ts +0 -59
- package/dist/ConnectionManager/@ConnectionManager.d.ts +0 -48
- package/dist/ConnectionManager/ConfigurationManager.d.ts +0 -60
- package/dist/ConnectionManager/ConnectionFlow.d.ts +0 -84
- package/dist/ConnectionManager/ConnectionStateMachine.d.ts +0 -61
- package/dist/ConnectionManager/RegistrationManager.d.ts +0 -17
- package/dist/ConnectionManager/SipOperations.d.ts +0 -32
- package/dist/ConnectionManager/UAFactory.d.ts +0 -50
- package/dist/ConnectionManager/eventNames.d.ts +0 -16
- package/dist/ConnectionManager/index.d.ts +0 -3
- package/dist/IncomingCallManager/@IncomingCallManager.d.ts +0 -37
- package/dist/IncomingCallManager/eventNames.d.ts +0 -13
- package/dist/IncomingCallManager/index.d.ts +0 -2
- package/dist/PresentationManager/@PresentationManager.d.ts +0 -47
- package/dist/PresentationManager/constants.d.ts +0 -1
- package/dist/PresentationManager/eventNames.d.ts +0 -11
- package/dist/PresentationManager/index.d.ts +0 -2
- package/dist/PresentationManager/types.d.ts +0 -2
- package/dist/SipConnector/@SipConnector.d.ts +0 -96
- package/dist/SipConnector/eventNames.d.ts +0 -4
- package/dist/SipConnector/index.d.ts +0 -2
- package/dist/index.d.ts +0 -14
- package/dist/types.d.ts +0 -23
- package/dist/videoSendingBalancer/scaleBitrate.d.ts +0 -2
- /package/dist/{SipConnectorFacade → src/SipConnectorFacade}/index.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/RTCPeerConnectionMock.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/RTCRtpSenderMock.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/Registrator.mock.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/Request.mock.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/WebSocketInterface.mock.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/accountNotify.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/channels.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/channelsNotify.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/conferenceParticipantTokenIssuedNotify.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/delayPromise.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/enterRoom.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/mediaState.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/participantMoveRequests.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/participantNotify.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/remoteCallerData.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/utils.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/webcastNotify.d.ts +0 -0
- /package/dist/{__fixtures__ → src}/constants.d.ts +0 -0
- /package/dist/{ConnectionManager → src}/getExtraHeadersRemoteAddress.d.ts +0 -0
- /package/dist/{logger.d.ts → src/logger.d.ts} +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/configureDegradationPreference.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/configureEmptyEncodings.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/configureEncodings.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/configureMaxBitrate.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/configureScaleResolutionDownBy.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/hasChangedRTCRtpSendParameters.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/index.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/resolveHasNeedToUpdateItemEncoding.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/setParametersToSender.d.ts +0 -0
- /package/dist/{tools → src/tools}/__fixtures__/call.d.ts +0 -0
- /package/dist/{tools → src/tools}/__fixtures__/hasValidUri.d.ts +0 -0
- /package/dist/{tools → src/tools}/__fixtures__/permissions.d.ts +0 -0
- /package/dist/{tools → src/tools}/__tests-utils__/parseObject.d.ts +0 -0
- /package/dist/{tools → src/tools}/__tests-utils__/resolveParseArray.d.ts +0 -0
- /package/dist/{tools → src/tools}/error/index.d.ts +0 -0
- /package/dist/{tools → src/tools}/error/stringifyMessage.d.ts +0 -0
- /package/dist/{tools → src/tools}/generateSimulcastEncodings.d.ts +0 -0
- /package/dist/{tools → src/tools}/getExtraHeaders.d.ts +0 -0
- /package/dist/{tools → src/tools}/getUserAgent.d.ts +0 -0
- /package/dist/{tools → src/tools}/hasPurgatory.d.ts +0 -0
- /package/dist/{tools → src/tools}/resolveUpdateTransceiver.d.ts +0 -0
- /package/dist/{tools/sendDtmfFAccumulated.d.ts → src/tools/sendDTMFAccumulated.d.ts} +0 -0
- /package/dist/{utils → src/utils}/errors.d.ts +0 -0
- /package/dist/{utils → src/utils}/findSenderByStream.d.ts +0 -0
- /package/dist/{utils → src/utils}/findVideoSender.d.ts +0 -0
- /package/dist/{utils → src/utils}/findVideoTrack.d.ts +0 -0
- /package/dist/{utils → src/utils}/getCodecFromSender.d.ts +0 -0
- /package/dist/{utils → src/utils}/replaceForbiddenSymbolsWithUnderscore.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/getMaxBitrateByWidth.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/getMaxBitrateByWidthAndCodec.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/hasAv1Codec.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/hasIncludesString.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/scaleBitrateByCodec.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/scaleResolutionAndBitrate.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/setEncodingsToSender.d.ts +0 -0
package/dist/doMock.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { EventEmitter as
|
|
5
|
-
import { IncomingRequest as
|
|
6
|
-
import {
|
|
7
|
-
import { createAudioMediaStreamTrackMock as k, createVideoMediaStreamTrackMock as W } from "webrtc-mock";
|
|
1
|
+
import { o as N, R as P, U as O, S as k } from "./SipConnector-DRjfFGAZ.js";
|
|
2
|
+
import A from "@krivega/jssip/lib/NameAddrHeader";
|
|
3
|
+
import b from "@krivega/jssip/lib/URI";
|
|
4
|
+
import { EventEmitter as D } from "node:events";
|
|
5
|
+
import { IncomingRequest as L } from "@krivega/jssip/lib/SIPMessage";
|
|
6
|
+
import { createAudioMediaStreamTrackMock as W, createVideoMediaStreamTrackMock as V } from "webrtc-mock";
|
|
8
7
|
import R from "events-constructor";
|
|
9
|
-
|
|
8
|
+
import { URI as w, C as I } from "@krivega/jssip";
|
|
9
|
+
class E extends L {
|
|
10
10
|
headers;
|
|
11
11
|
constructor(e) {
|
|
12
12
|
super(), this.headers = new Headers(e);
|
|
@@ -15,89 +15,7 @@ class _ extends b {
|
|
|
15
15
|
return this.headers.get(e) ?? "";
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
U,
|
|
20
|
-
G,
|
|
21
|
-
x,
|
|
22
|
-
H,
|
|
23
|
-
Ie,
|
|
24
|
-
we,
|
|
25
|
-
ge,
|
|
26
|
-
ie,
|
|
27
|
-
Re,
|
|
28
|
-
fe,
|
|
29
|
-
Ce,
|
|
30
|
-
Se,
|
|
31
|
-
Ne,
|
|
32
|
-
ue,
|
|
33
|
-
pe
|
|
34
|
-
], A = [
|
|
35
|
-
M,
|
|
36
|
-
q,
|
|
37
|
-
Y,
|
|
38
|
-
j,
|
|
39
|
-
z,
|
|
40
|
-
B,
|
|
41
|
-
J,
|
|
42
|
-
K,
|
|
43
|
-
$
|
|
44
|
-
], rt = [
|
|
45
|
-
Q,
|
|
46
|
-
X,
|
|
47
|
-
Z,
|
|
48
|
-
ee,
|
|
49
|
-
te,
|
|
50
|
-
re,
|
|
51
|
-
ne,
|
|
52
|
-
oe,
|
|
53
|
-
se,
|
|
54
|
-
ae,
|
|
55
|
-
ce,
|
|
56
|
-
Ee,
|
|
57
|
-
de,
|
|
58
|
-
he,
|
|
59
|
-
me,
|
|
60
|
-
le,
|
|
61
|
-
_e,
|
|
62
|
-
Te
|
|
63
|
-
], nt = [
|
|
64
|
-
Me,
|
|
65
|
-
M,
|
|
66
|
-
Ae,
|
|
67
|
-
Oe,
|
|
68
|
-
Pe,
|
|
69
|
-
ve,
|
|
70
|
-
De,
|
|
71
|
-
ye,
|
|
72
|
-
Le,
|
|
73
|
-
Fe,
|
|
74
|
-
be,
|
|
75
|
-
Ve,
|
|
76
|
-
ke,
|
|
77
|
-
We,
|
|
78
|
-
Ue,
|
|
79
|
-
Ge,
|
|
80
|
-
He,
|
|
81
|
-
xe,
|
|
82
|
-
qe,
|
|
83
|
-
Ye,
|
|
84
|
-
je,
|
|
85
|
-
ze,
|
|
86
|
-
Be,
|
|
87
|
-
Je,
|
|
88
|
-
Ke,
|
|
89
|
-
$e,
|
|
90
|
-
Qe,
|
|
91
|
-
Xe,
|
|
92
|
-
Ze,
|
|
93
|
-
et
|
|
94
|
-
];
|
|
95
|
-
[...A, ...tt];
|
|
96
|
-
const ot = [
|
|
97
|
-
...nt,
|
|
98
|
-
...rt
|
|
99
|
-
];
|
|
100
|
-
class st {
|
|
18
|
+
class F {
|
|
101
19
|
originator;
|
|
102
20
|
connection;
|
|
103
21
|
events;
|
|
@@ -105,10 +23,9 @@ class st {
|
|
|
105
23
|
mutedOptions = { audio: !1, video: !1 };
|
|
106
24
|
constructor({
|
|
107
25
|
originator: e = "local",
|
|
108
|
-
eventHandlers: t
|
|
109
|
-
remoteIdentity: r
|
|
26
|
+
eventHandlers: t
|
|
110
27
|
}) {
|
|
111
|
-
this.originator = e, this.events = new R(
|
|
28
|
+
this.originator = e, this.events = new R(N), this.initEvents(t);
|
|
112
29
|
}
|
|
113
30
|
get contact() {
|
|
114
31
|
throw new Error("Method not implemented.");
|
|
@@ -203,10 +120,10 @@ class st {
|
|
|
203
120
|
throw new Error("Method not implemented.");
|
|
204
121
|
}
|
|
205
122
|
off(e, t) {
|
|
206
|
-
|
|
123
|
+
throw new Error("Method not implemented.");
|
|
207
124
|
}
|
|
208
125
|
removeAllListeners(e) {
|
|
209
|
-
|
|
126
|
+
throw new Error("Method not implemented.");
|
|
210
127
|
}
|
|
211
128
|
setMaxListeners(e) {
|
|
212
129
|
throw new Error("Method not implemented.");
|
|
@@ -236,7 +153,7 @@ class st {
|
|
|
236
153
|
throw new Error("Method not implemented.");
|
|
237
154
|
}
|
|
238
155
|
initEvents(e) {
|
|
239
|
-
|
|
156
|
+
Object.entries(e).forEach(([t, r]) => this.on(t, r));
|
|
240
157
|
}
|
|
241
158
|
// @ts-expect-error
|
|
242
159
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
@@ -257,16 +174,19 @@ class st {
|
|
|
257
174
|
this.trigger("newDTMF", { originator: this.originator });
|
|
258
175
|
}
|
|
259
176
|
async startPresentation(e) {
|
|
260
|
-
return
|
|
177
|
+
return e;
|
|
178
|
+
}
|
|
179
|
+
async updatePresentation(e) {
|
|
180
|
+
return e;
|
|
261
181
|
}
|
|
262
182
|
async stopPresentation(e) {
|
|
263
|
-
return
|
|
183
|
+
return e;
|
|
264
184
|
}
|
|
265
185
|
isEstablished() {
|
|
266
186
|
return !0;
|
|
267
187
|
}
|
|
268
188
|
}
|
|
269
|
-
class
|
|
189
|
+
class x {
|
|
270
190
|
dtmf = null;
|
|
271
191
|
track = null;
|
|
272
192
|
transport = null;
|
|
@@ -309,7 +229,7 @@ class it {
|
|
|
309
229
|
throw new Error("Method not implemented.");
|
|
310
230
|
}
|
|
311
231
|
}
|
|
312
|
-
class
|
|
232
|
+
class U {
|
|
313
233
|
senders = [];
|
|
314
234
|
receivers = [];
|
|
315
235
|
canTrickleIceCandidates;
|
|
@@ -390,10 +310,10 @@ class at {
|
|
|
390
310
|
throw new Error("Method not implemented.");
|
|
391
311
|
}
|
|
392
312
|
addEventListener(e, t, r) {
|
|
393
|
-
|
|
313
|
+
throw new Error("Method not implemented.");
|
|
394
314
|
}
|
|
395
315
|
removeEventListener(e, t, r) {
|
|
396
|
-
|
|
316
|
+
throw new Error("Method not implemented.");
|
|
397
317
|
}
|
|
398
318
|
dispatchEvent(e) {
|
|
399
319
|
throw new Error("Method not implemented.");
|
|
@@ -401,19 +321,18 @@ class at {
|
|
|
401
321
|
getReceivers = () => this.receivers;
|
|
402
322
|
getSenders = () => this.senders;
|
|
403
323
|
addTrack = (e) => {
|
|
404
|
-
const t = new
|
|
324
|
+
const t = new x({ track: e });
|
|
405
325
|
return this.senders.push(t), t;
|
|
406
326
|
};
|
|
407
327
|
}
|
|
408
|
-
function
|
|
328
|
+
function H(n) {
|
|
409
329
|
const e = n.match(/(purgatory)|[\d.]+/g);
|
|
410
330
|
if (!e)
|
|
411
331
|
throw new Error("wrong sip url");
|
|
412
332
|
return e[0];
|
|
413
333
|
}
|
|
414
|
-
const
|
|
415
|
-
class s extends
|
|
416
|
-
static presentationError;
|
|
334
|
+
const l = 400, z = "777", Y = (n) => n.getVideoTracks().length > 0;
|
|
335
|
+
class s extends F {
|
|
417
336
|
static startPresentationError;
|
|
418
337
|
static countStartPresentationError = Number.POSITIVE_INFINITY;
|
|
419
338
|
static countStartsPresentation = 0;
|
|
@@ -437,29 +356,16 @@ class s extends st {
|
|
|
437
356
|
}, 100), setTimeout(() => {
|
|
438
357
|
this.trigger("confirmed");
|
|
439
358
|
}, 200);
|
|
440
|
-
},
|
|
441
|
-
});
|
|
442
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
443
|
-
replaceMediaStream = jest.fn(async (e) => {
|
|
359
|
+
}, l);
|
|
444
360
|
});
|
|
445
361
|
isEndedInner = !1;
|
|
446
362
|
constructor({
|
|
447
363
|
url: e = "",
|
|
448
364
|
mediaStream: t,
|
|
449
365
|
eventHandlers: r,
|
|
450
|
-
originator:
|
|
451
|
-
remoteIdentity: a = new V(
|
|
452
|
-
new E("sip", "caller1", "test1.com", 5060),
|
|
453
|
-
"Test Caller 1"
|
|
454
|
-
)
|
|
366
|
+
originator: o
|
|
455
367
|
}) {
|
|
456
|
-
super({ originator:
|
|
457
|
-
}
|
|
458
|
-
static setPresentationError(e) {
|
|
459
|
-
this.presentationError = e;
|
|
460
|
-
}
|
|
461
|
-
static resetPresentationError() {
|
|
462
|
-
this.presentationError = void 0;
|
|
368
|
+
super({ originator: o, eventHandlers: r }), this.url = e, this.initPeerconnection(t);
|
|
463
369
|
}
|
|
464
370
|
static setStartPresentationError(e, { count: t = Number.POSITIVE_INFINITY } = {}) {
|
|
465
371
|
this.startPresentationError = e, this.countStartPresentationError = t;
|
|
@@ -467,54 +373,41 @@ class s extends st {
|
|
|
467
373
|
static resetStartPresentationError() {
|
|
468
374
|
this.startPresentationError = void 0, this.countStartPresentationError = Number.POSITIVE_INFINITY, this.countStartsPresentation = 0;
|
|
469
375
|
}
|
|
470
|
-
|
|
471
|
-
if (s.countStartsPresentation += 1, s.
|
|
472
|
-
throw
|
|
473
|
-
if (s.startPresentationError && s.countStartsPresentation < s.countStartPresentationError)
|
|
474
|
-
throw this.trigger("presentation:start", e), this.trigger("presentation:failed", e), s.startPresentationError;
|
|
376
|
+
async startPresentation(e) {
|
|
377
|
+
if (s.countStartsPresentation += 1, s.startPresentationError && s.countStartsPresentation < s.countStartPresentationError)
|
|
378
|
+
throw s.startPresentationError;
|
|
475
379
|
return super.startPresentation(e);
|
|
476
|
-
}
|
|
477
|
-
stopPresentation = async (e) => {
|
|
478
|
-
if (s.presentationError)
|
|
479
|
-
throw this.trigger("presentation:end", e), this.trigger("presentation:failed", e), s.presentationError;
|
|
480
|
-
return super.stopPresentation(e);
|
|
481
|
-
};
|
|
380
|
+
}
|
|
482
381
|
initPeerconnection(e) {
|
|
483
382
|
return e ? (this.createPeerconnection(e), !0) : !1;
|
|
484
383
|
}
|
|
485
384
|
createPeerconnection(e) {
|
|
486
|
-
const t =
|
|
385
|
+
const t = W();
|
|
487
386
|
t.id = "mainaudio1";
|
|
488
387
|
const r = [t];
|
|
489
|
-
if (
|
|
490
|
-
const a =
|
|
388
|
+
if (Y(e)) {
|
|
389
|
+
const a = V();
|
|
491
390
|
a.id = "mainvideo1", r.push(a);
|
|
492
391
|
}
|
|
493
|
-
this.connection = new
|
|
392
|
+
this.connection = new U(void 0, r), this.addStream(e), setTimeout(() => {
|
|
494
393
|
this.trigger("peerconnection", { peerconnection: this.connection });
|
|
495
|
-
},
|
|
394
|
+
}, l);
|
|
496
395
|
}
|
|
497
396
|
connect(e) {
|
|
498
|
-
const t =
|
|
397
|
+
const t = H(e);
|
|
499
398
|
setTimeout(() => {
|
|
500
|
-
this.url.includes(
|
|
399
|
+
this.url.includes(z) ? this.trigger("failed", {
|
|
501
400
|
originator: "remote",
|
|
502
401
|
message: "IncomingResponse",
|
|
503
|
-
cause:
|
|
402
|
+
cause: P
|
|
504
403
|
}) : (this.trigger("connecting"), setTimeout(() => {
|
|
505
|
-
this.
|
|
506
|
-
originator: v.REMOTE,
|
|
507
|
-
// @ts-expect-error
|
|
508
|
-
request: {
|
|
509
|
-
getHeader: (r) => r === "content-type" ? "application/vinteo.webrtc.roomname" : r === "x-webrtc-enter-room" ? t : r === "x-webrtc-participant-name" ? "Test Caller 1" : ""
|
|
510
|
-
}
|
|
511
|
-
});
|
|
404
|
+
this.trigger("enterRoom", { room: t });
|
|
512
405
|
}, 100), setTimeout(() => {
|
|
513
406
|
this.trigger("accepted");
|
|
514
407
|
}, 200), setTimeout(() => {
|
|
515
408
|
this.trigger("confirmed");
|
|
516
409
|
}, 300));
|
|
517
|
-
},
|
|
410
|
+
}, l);
|
|
518
411
|
}
|
|
519
412
|
terminate({ status_code: e, cause: t } = {}) {
|
|
520
413
|
return this.status_code = e, this.trigger("ended", { status_code: e, cause: t, originator: "local" }), this.isEndedInner = !1, this;
|
|
@@ -559,6 +452,9 @@ class s extends st {
|
|
|
559
452
|
isMuted() {
|
|
560
453
|
return this.mutedOptions;
|
|
561
454
|
}
|
|
455
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function, class-methods-use-this
|
|
456
|
+
async replaceMediaStream(e) {
|
|
457
|
+
}
|
|
562
458
|
onmute({ audio: e, video: t }) {
|
|
563
459
|
this.trigger("muted", {
|
|
564
460
|
audio: e,
|
|
@@ -576,7 +472,7 @@ class s extends st {
|
|
|
576
472
|
}
|
|
577
473
|
/* eslint-enable no-param-reassign */
|
|
578
474
|
}
|
|
579
|
-
class
|
|
475
|
+
class q {
|
|
580
476
|
extraHeaders = [];
|
|
581
477
|
setExtraHeaders(e) {
|
|
582
478
|
this.extraHeaders = e;
|
|
@@ -585,56 +481,31 @@ class ht {
|
|
|
585
481
|
setExtraContactParams() {
|
|
586
482
|
}
|
|
587
483
|
}
|
|
588
|
-
const
|
|
484
|
+
const d = "PASSWORD_CORRECT", M = "PASSWORD_CORRECT_2", G = "NAME_INCORRECT", c = 400, p = {
|
|
589
485
|
url: "wss://sipServerUrl/webrtc/wss/",
|
|
590
486
|
sip_uri: "sip:sipServerUrl;transport=ws",
|
|
591
487
|
via_transport: "WSS"
|
|
592
|
-
},
|
|
488
|
+
}, v = {
|
|
593
489
|
status_code: 200,
|
|
594
490
|
reason_phrase: "OK"
|
|
595
|
-
},
|
|
491
|
+
}, T = {
|
|
596
492
|
status_code: 401,
|
|
597
493
|
reason_phrase: "Unauthorized"
|
|
598
494
|
};
|
|
599
|
-
class
|
|
495
|
+
class i {
|
|
600
496
|
static isAvailableTelephony = !0;
|
|
601
497
|
static startError;
|
|
602
498
|
static countStartError = Number.POSITIVE_INFINITY;
|
|
603
499
|
static countStarts = 0;
|
|
604
500
|
events;
|
|
605
501
|
registratorInner;
|
|
606
|
-
// @ts-expect-error
|
|
502
|
+
// @ts-expect-error
|
|
607
503
|
call = jest.fn(
|
|
608
504
|
(e, t) => {
|
|
609
|
-
const { mediaStream: r, eventHandlers:
|
|
610
|
-
return this.session = new s({ url: e, mediaStream: r, eventHandlers:
|
|
611
|
-
}
|
|
612
|
-
);
|
|
613
|
-
sendOptions = jest.fn(
|
|
614
|
-
(e, t, r) => {
|
|
615
|
-
console.log("sendOptions", e, t, r);
|
|
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;
|
|
616
507
|
}
|
|
617
508
|
);
|
|
618
|
-
/**
|
|
619
|
-
* start – имитирует запуск UA.
|
|
620
|
-
*/
|
|
621
|
-
start = jest.fn(() => {
|
|
622
|
-
if (o.countStarts += 1, o.startError && o.countStarts < o.countStartError) {
|
|
623
|
-
this.trigger("disconnected", o.startError);
|
|
624
|
-
return;
|
|
625
|
-
}
|
|
626
|
-
this.register();
|
|
627
|
-
});
|
|
628
|
-
/**
|
|
629
|
-
* stop – имитирует остановку UA.
|
|
630
|
-
*/
|
|
631
|
-
stop = jest.fn(() => {
|
|
632
|
-
this.startedTimeout && clearTimeout(this.startedTimeout), this.stopedTimeout && clearTimeout(this.stopedTimeout), this.unregister(), this.isStarted() ? this.stopedTimeout = setTimeout(() => {
|
|
633
|
-
this.trigger("disconnected", { error: !0, socket: p });
|
|
634
|
-
}, d) : this.trigger("disconnected", { error: !0, socket: p });
|
|
635
|
-
});
|
|
636
|
-
removeAllListeners = jest.fn(() => (this.events.removeEventHandlers(), this));
|
|
637
|
-
once = jest.fn((e, t) => (this.events.once(e, t), this));
|
|
638
509
|
startedTimeout;
|
|
639
510
|
stopedTimeout;
|
|
640
511
|
session;
|
|
@@ -642,34 +513,59 @@ class o {
|
|
|
642
513
|
isConnectedInner;
|
|
643
514
|
configuration;
|
|
644
515
|
constructor(e) {
|
|
645
|
-
this.events = new R(
|
|
646
|
-
const [t, r] = e.uri.split(":"), [
|
|
516
|
+
this.events = new R(O);
|
|
517
|
+
const [t, r] = e.uri.split(":"), [o, a] = r.split("@"), u = {
|
|
647
518
|
...e,
|
|
648
|
-
uri: new
|
|
519
|
+
uri: new w(t, o, a)
|
|
649
520
|
};
|
|
650
|
-
this.configuration =
|
|
521
|
+
this.configuration = u, this.registratorInner = new q();
|
|
651
522
|
}
|
|
652
523
|
static setStartError(e, { count: t = Number.POSITIVE_INFINITY } = {}) {
|
|
653
|
-
|
|
524
|
+
this.startError = e, this.countStartError = t;
|
|
654
525
|
}
|
|
655
526
|
static resetStartError() {
|
|
656
|
-
|
|
527
|
+
this.startError = void 0, this.countStartError = Number.POSITIVE_INFINITY, this.countStarts = 0;
|
|
657
528
|
}
|
|
658
529
|
static setAvailableTelephony() {
|
|
659
|
-
|
|
530
|
+
this.isAvailableTelephony = !0;
|
|
660
531
|
}
|
|
661
532
|
static setNotAvailableTelephony() {
|
|
662
|
-
|
|
533
|
+
this.isAvailableTelephony = !1;
|
|
663
534
|
}
|
|
664
|
-
|
|
665
|
-
|
|
535
|
+
/**
|
|
536
|
+
* start
|
|
537
|
+
*
|
|
538
|
+
* @returns {undefined}
|
|
539
|
+
*/
|
|
540
|
+
start() {
|
|
541
|
+
if (i.countStarts += 1, i.startError && i.countStarts < i.countStartError) {
|
|
542
|
+
this.trigger("disconnected", i.startError);
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
this.register();
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* stop
|
|
549
|
+
*
|
|
550
|
+
* @returns {undefined}
|
|
551
|
+
*/
|
|
552
|
+
stop() {
|
|
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: p });
|
|
555
|
+
}, c) : this.trigger("disconnected", { error: !0, socket: p });
|
|
666
556
|
}
|
|
667
557
|
on(e, t) {
|
|
668
558
|
return this.events.on(e, t), this;
|
|
669
559
|
}
|
|
560
|
+
once(e, t) {
|
|
561
|
+
return this.events.once(e, t), this;
|
|
562
|
+
}
|
|
670
563
|
off(e, t) {
|
|
671
564
|
return this.events.off(e, t), this;
|
|
672
565
|
}
|
|
566
|
+
removeAllListeners() {
|
|
567
|
+
return this.events.removeEventHandlers(), this;
|
|
568
|
+
}
|
|
673
569
|
trigger(e, t) {
|
|
674
570
|
this.events.trigger(e, t);
|
|
675
571
|
}
|
|
@@ -692,13 +588,13 @@ class o {
|
|
|
692
588
|
register() {
|
|
693
589
|
this.startedTimeout && clearTimeout(this.startedTimeout);
|
|
694
590
|
const { password: e, register: t, uri: r } = this.configuration;
|
|
695
|
-
t === !0 && r.user.includes(
|
|
696
|
-
this.trigger("registrationFailed", { response:
|
|
697
|
-
},
|
|
698
|
-
this.trigger("registered", { response:
|
|
699
|
-
},
|
|
700
|
-
this.trigger("registrationFailed", { response:
|
|
701
|
-
},
|
|
591
|
+
t === !0 && r.user.includes(G) ? (this.isRegisteredInner = !1, this.isConnectedInner = !1, this.startedTimeout = setTimeout(() => {
|
|
592
|
+
this.trigger("registrationFailed", { response: T, cause: I.causes.REJECTED });
|
|
593
|
+
}, c)) : !this.isRegistered() && t === !0 && (e === d || e === M) ? (this.isRegisteredInner = !0, this.startedTimeout = setTimeout(() => {
|
|
594
|
+
this.trigger("registered", { response: v });
|
|
595
|
+
}, c)) : t === !0 && e !== d && e !== M && (this.isRegisteredInner = !1, this.isConnectedInner = !1, this.startedTimeout = setTimeout(() => {
|
|
596
|
+
this.trigger("registrationFailed", { response: T, cause: I.causes.REJECTED });
|
|
597
|
+
}, c)), i.isAvailableTelephony ? (this.trigger("connected", { socket: p }), this.isConnectedInner = !0) : this.stop();
|
|
702
598
|
}
|
|
703
599
|
/**
|
|
704
600
|
* unregister
|
|
@@ -706,7 +602,7 @@ class o {
|
|
|
706
602
|
* @returns {undefined}
|
|
707
603
|
*/
|
|
708
604
|
unregister() {
|
|
709
|
-
this.isRegisteredInner = !1, this.isConnectedInner = !1, this.trigger("unregistered", { response:
|
|
605
|
+
this.isRegisteredInner = !1, this.isConnectedInner = !1, this.trigger("unregistered", { response: v });
|
|
710
606
|
}
|
|
711
607
|
isRegistered() {
|
|
712
608
|
return this.isRegisteredInner === !0;
|
|
@@ -729,122 +625,121 @@ class o {
|
|
|
729
625
|
return this.registratorInner;
|
|
730
626
|
}
|
|
731
627
|
}
|
|
732
|
-
class
|
|
628
|
+
class J {
|
|
733
629
|
url;
|
|
734
630
|
constructor(e) {
|
|
735
631
|
this.url = e;
|
|
736
632
|
}
|
|
737
633
|
}
|
|
738
|
-
class
|
|
634
|
+
class $ extends D {
|
|
739
635
|
contentType;
|
|
740
636
|
body;
|
|
741
637
|
constructor(e, t) {
|
|
742
638
|
super(), this.contentType = e, this.body = t;
|
|
743
639
|
}
|
|
744
640
|
}
|
|
745
|
-
const g = "remote",
|
|
746
|
-
const t = new
|
|
641
|
+
const g = "remote", j = (n, e) => {
|
|
642
|
+
const t = new E(e), r = {
|
|
747
643
|
originator: g,
|
|
748
644
|
request: t,
|
|
749
|
-
info: new
|
|
645
|
+
info: new $("", "")
|
|
750
646
|
};
|
|
751
647
|
n.newInfo(r);
|
|
752
|
-
},
|
|
753
|
-
const r = { event: "sipEvent", request: new
|
|
648
|
+
}, B = (n, e) => {
|
|
649
|
+
const r = { event: "sipEvent", request: new E(e) };
|
|
754
650
|
n.newSipEvent(r);
|
|
755
|
-
},
|
|
651
|
+
}, K = (n, {
|
|
756
652
|
incomingNumber: e = "1234",
|
|
757
653
|
displayName: t,
|
|
758
654
|
host: r
|
|
759
655
|
}) => {
|
|
760
|
-
const
|
|
761
|
-
|
|
762
|
-
const
|
|
656
|
+
const o = new s({ originator: g, eventHandlers: {} }), a = new b("sip", e, r);
|
|
657
|
+
o.remote_identity = new A(a, t);
|
|
658
|
+
const u = new E([]);
|
|
763
659
|
n.trigger("newRTCSession", {
|
|
764
660
|
originator: g,
|
|
765
|
-
session:
|
|
766
|
-
request:
|
|
661
|
+
session: o,
|
|
662
|
+
request: u
|
|
767
663
|
});
|
|
768
|
-
},
|
|
664
|
+
}, X = (n, e) => {
|
|
769
665
|
e ? n.trigger("failed", e) : n.trigger("failed", n);
|
|
770
|
-
},
|
|
771
|
-
triggerNewInfo:
|
|
772
|
-
triggerNewSipEvent:
|
|
773
|
-
triggerIncomingSession:
|
|
774
|
-
triggerFailIncomingSession:
|
|
775
|
-
WebSocketInterface:
|
|
776
|
-
UA:
|
|
666
|
+
}, C = {
|
|
667
|
+
triggerNewInfo: j,
|
|
668
|
+
triggerNewSipEvent: B,
|
|
669
|
+
triggerIncomingSession: K,
|
|
670
|
+
triggerFailIncomingSession: X,
|
|
671
|
+
WebSocketInterface: J,
|
|
672
|
+
UA: i,
|
|
777
673
|
C: {
|
|
778
674
|
INVITE: "INVITE"
|
|
779
675
|
}
|
|
780
|
-
},
|
|
676
|
+
}, f = "user", h = "displayName", _ = "SIP_SERVER_URL", y = "SIP_WEB_SOCKET_SERVER_URL", Q = new C.WebSocketInterface(y), S = {
|
|
781
677
|
userAgent: "Chrome",
|
|
782
|
-
sipServerUrl:
|
|
783
|
-
sipWebSocketServerURL:
|
|
784
|
-
},
|
|
785
|
-
...
|
|
786
|
-
},
|
|
787
|
-
...
|
|
788
|
-
user:
|
|
789
|
-
password:
|
|
678
|
+
sipServerUrl: _,
|
|
679
|
+
sipWebSocketServerURL: y
|
|
680
|
+
}, ce = {
|
|
681
|
+
...S
|
|
682
|
+
}, Z = {
|
|
683
|
+
...S,
|
|
684
|
+
user: f,
|
|
685
|
+
password: d,
|
|
790
686
|
register: !0
|
|
791
|
-
},
|
|
792
|
-
...
|
|
687
|
+
}, he = {
|
|
688
|
+
...Z,
|
|
793
689
|
displayName: h
|
|
794
|
-
},
|
|
795
|
-
...
|
|
690
|
+
}, me = {
|
|
691
|
+
...S,
|
|
796
692
|
displayName: h,
|
|
797
693
|
register: !1
|
|
798
694
|
}, m = {
|
|
799
695
|
session_timers: !1,
|
|
800
|
-
sockets: [
|
|
696
|
+
sockets: [Q],
|
|
801
697
|
user_agent: "Chrome",
|
|
802
|
-
|
|
698
|
+
sdp_semantics: "unified-plan",
|
|
803
699
|
register_expires: 300,
|
|
804
700
|
connection_recovery_max_interval: 6,
|
|
805
701
|
connection_recovery_min_interval: 2
|
|
806
|
-
},
|
|
702
|
+
}, ue = {
|
|
807
703
|
...m,
|
|
808
|
-
password:
|
|
809
|
-
uri: new
|
|
704
|
+
password: d,
|
|
705
|
+
uri: new w("sip", f, _),
|
|
810
706
|
display_name: "",
|
|
811
707
|
register: !0
|
|
812
|
-
},
|
|
708
|
+
}, le = {
|
|
813
709
|
...m,
|
|
814
|
-
password:
|
|
815
|
-
uri: new
|
|
710
|
+
password: d,
|
|
711
|
+
uri: new w("sip", f, _),
|
|
816
712
|
display_name: h,
|
|
817
713
|
register: !0
|
|
818
|
-
},
|
|
714
|
+
}, pe = {
|
|
819
715
|
...m,
|
|
820
716
|
display_name: h,
|
|
821
717
|
register: !1
|
|
822
|
-
},
|
|
718
|
+
}, ge = {
|
|
823
719
|
...m,
|
|
824
720
|
display_name: "",
|
|
825
721
|
register: !1
|
|
826
|
-
},
|
|
827
|
-
JsSIP:
|
|
722
|
+
}, ee = "10.10.10.10", we = [`X-Vinteo-Remote: ${ee}`], Ee = () => new k({
|
|
723
|
+
JsSIP: C
|
|
828
724
|
});
|
|
829
725
|
export {
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
vt as dataForConnectionWithoutAuthorizationWithoutDisplayName,
|
|
726
|
+
z as FAILED_CONFERENCE_NUMBER,
|
|
727
|
+
G as NAME_INCORRECT,
|
|
728
|
+
d as PASSWORD_CORRECT,
|
|
729
|
+
M as PASSWORD_CORRECT_2,
|
|
730
|
+
_ as SIP_SERVER_URL,
|
|
731
|
+
y as SIP_WEB_SOCKET_SERVER_URL,
|
|
732
|
+
Z as dataForConnectionWithAuthorization,
|
|
733
|
+
he as dataForConnectionWithAuthorizationWithDisplayName,
|
|
734
|
+
me as dataForConnectionWithoutAuthorization,
|
|
735
|
+
ce as dataForConnectionWithoutAuthorizationWithoutDisplayName,
|
|
841
736
|
h as displayName,
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
737
|
+
Ee as doMockSipConnector,
|
|
738
|
+
we as extraHeadersRemoteAddress,
|
|
739
|
+
ee as remoteAddress,
|
|
740
|
+
ue as uaConfigurationWithAuthorization,
|
|
741
|
+
le as uaConfigurationWithAuthorizationWithDisplayName,
|
|
742
|
+
pe as uaConfigurationWithoutAuthorization,
|
|
743
|
+
ge as uaConfigurationWithoutAuthorizationWithoutDisplayName,
|
|
744
|
+
f as user
|
|
850
745
|
};
|