sip-connector 14.1.2-6 → 15.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-CZo7A8_q.cjs +1 -0
- package/dist/@SipConnector-DbvV1Leg.js +2247 -0
- package/dist/ApiManager/@ApiManager.d.ts +59 -0
- package/dist/ApiManager/constants.d.ts +71 -0
- package/dist/ApiManager/eventNames.d.ts +33 -0
- package/dist/ApiManager/index.d.ts +3 -0
- package/dist/ApiManager/types.d.ts +99 -0
- package/dist/CallManager/@CallManager.d.ts +26 -0
- package/dist/CallManager/AbstractCallStrategy.d.ts +47 -0
- package/dist/CallManager/MCUCallStrategy.d.ts +30 -0
- package/dist/CallManager/RemoteStreamsManager.d.ts +8 -0
- package/dist/CallManager/causes.d.ts +13 -0
- package/dist/CallManager/eventNames.d.ts +45 -0
- package/dist/CallManager/hasCanceledCallError.d.ts +2 -0
- package/dist/CallManager/index.d.ts +7 -0
- package/dist/CallManager/types.d.ts +59 -0
- package/dist/ConnectionManager/@ConnectionManager.d.ts +48 -0
- package/dist/ConnectionManager/ConfigurationManager.d.ts +60 -0
- package/dist/ConnectionManager/ConnectionFlow.d.ts +84 -0
- package/dist/ConnectionManager/ConnectionStateMachine.d.ts +61 -0
- package/dist/ConnectionManager/RegistrationManager.d.ts +17 -0
- package/dist/ConnectionManager/SipOperations.d.ts +32 -0
- package/dist/ConnectionManager/UAFactory.d.ts +50 -0
- package/dist/ConnectionManager/eventNames.d.ts +16 -0
- package/dist/ConnectionManager/index.d.ts +3 -0
- package/dist/IncomingCallManager/@IncomingCallManager.d.ts +37 -0
- package/dist/IncomingCallManager/eventNames.d.ts +13 -0
- package/dist/IncomingCallManager/index.d.ts +2 -0
- package/dist/PresentationManager/@PresentationManager.d.ts +47 -0
- package/dist/PresentationManager/constants.d.ts +1 -0
- package/dist/PresentationManager/eventNames.d.ts +11 -0
- package/dist/PresentationManager/index.d.ts +2 -0
- package/dist/PresentationManager/types.d.ts +2 -0
- package/dist/SipConnector/@SipConnector.d.ts +96 -0
- package/dist/SipConnector/eventNames.d.ts +4 -0
- package/dist/SipConnector/index.d.ts +2 -0
- package/dist/{src/SipConnectorFacade → SipConnectorFacade}/SipConnectorFacade.d.ts +7 -16
- package/dist/{src/__fixtures__ → __fixtures__}/BaseSession.mock.d.ts +9 -9
- package/dist/{src/__fixtures__ → __fixtures__}/RTCPeerConnectionMock.d.ts +6 -0
- package/dist/{src/__fixtures__ → __fixtures__}/RTCSessionMock.d.ts +13 -8
- package/dist/{src/__fixtures__ → __fixtures__}/UA.mock.d.ts +13 -15
- package/dist/{src → __fixtures__}/eventNames.d.ts +1 -1
- package/dist/{src/__fixtures__ → __fixtures__}/index.d.ts +4 -4
- package/dist/{src/__fixtures__ → __fixtures__}/jssip.mock.d.ts +3 -3
- package/dist/doMock.cjs +1 -1
- package/dist/{src/doMock.d.ts → doMock.d.ts} +2 -1
- package/dist/doMock.js +442 -341
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +14 -0
- package/dist/index.js +721 -674
- package/dist/{src/setParametersToSender → setParametersToSender}/resolveHasNeedToUpdateItemEncoding.d.ts +1 -1
- package/dist/{src/tools → tools}/__fixtures__/connectToServer.d.ts +2 -2
- package/dist/{src/tools → tools}/__fixtures__/processRequest.d.ts +1 -1
- package/dist/{src/tools → tools}/error/getLinkError.d.ts +1 -1
- package/dist/{src/tools → tools}/error/getTypeFromError.d.ts +1 -1
- package/dist/{src/tools → tools}/error/getValuesFromError.d.ts +1 -1
- package/dist/{src/tools → tools}/index.d.ts +1 -1
- package/dist/{src/tools → tools}/prepareMediaStream.d.ts +1 -1
- package/dist/{src/tools → tools}/setVideoTrackContentHints.d.ts +1 -1
- package/dist/{src/tools → tools}/syncMediaState/index.d.ts +1 -1
- package/dist/{src/tools → tools}/syncMediaState/resolveOnStartMainCam.d.ts +1 -1
- package/dist/{src/tools → tools}/syncMediaState/resolveOnStartMic.d.ts +1 -1
- package/dist/{src/tools → tools}/syncMediaState/resolveOnStopMainCam.d.ts +1 -1
- package/dist/{src/tools → tools}/syncMediaState/resolveOnStopMic.d.ts +1 -1
- package/dist/types.d.ts +23 -0
- package/dist/{src/videoSendingBalancer → videoSendingBalancer}/balance.d.ts +1 -1
- package/dist/{src/videoSendingBalancer → videoSendingBalancer}/getMaxBitrateByWidth.d.ts +1 -0
- package/dist/{src/videoSendingBalancer → videoSendingBalancer}/getMaxBitrateByWidthAndCodec.d.ts +1 -0
- package/dist/{src/videoSendingBalancer → videoSendingBalancer}/index.d.ts +1 -1
- package/dist/{src/videoSendingBalancer → videoSendingBalancer}/processSender.d.ts +1 -1
- package/package.json +35 -42
- package/dist/SipConnector-D9frFCEK.js +0 -1352
- package/dist/SipConnector-J07EhbbA.cjs +0 -1
- package/dist/src/SipConnector.d.ts +0 -235
- package/dist/src/causes.d.ts +0 -23
- package/dist/src/headers.d.ts +0 -37
- package/dist/src/index.d.ts +0 -11
- package/dist/src/types.d.ts +0 -69
- /package/dist/{src → ConnectionManager}/getExtraHeadersRemoteAddress.d.ts +0 -0
- /package/dist/{src/SipConnectorFacade → SipConnectorFacade}/index.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/RTCRtpSenderMock.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__}/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__}/constants.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__}/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/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}/setParametersToSender.d.ts +0 -0
- /package/dist/{src/tools → tools}/__fixtures__/call.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}/__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/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}/resolveUpdateTransceiver.d.ts +0 -0
- /package/dist/{src/tools/sendDTMFAccumulated.d.ts → tools/sendDtmfFAccumulated.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}/hasAv1Codec.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/hasIncludesString.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,35 +1,114 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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-D9frFCEK.js";
|
|
5
|
-
import V from "@krivega/jssip/lib/NameAddrHeader";
|
|
1
|
+
import { O as D, S as L } from "./@SipConnector-DbvV1Leg.js";
|
|
2
|
+
import y from "@krivega/jssip/lib/NameAddrHeader";
|
|
6
3
|
import F from "@krivega/jssip/lib/URI";
|
|
7
|
-
import { EventEmitter as
|
|
8
|
-
import { IncomingRequest as
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
class
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return this.headers.get(t) ?? "";
|
|
4
|
+
import { EventEmitter as b } from "node:events";
|
|
5
|
+
import { IncomingRequest as V } from "@krivega/jssip/lib/SIPMessage";
|
|
6
|
+
import { NameAddrHeader as k, URI as E, C as N } from "@krivega/jssip";
|
|
7
|
+
import { createAudioMediaStreamTrackMock as W, createVideoMediaStreamTrackMock as U } from "webrtc-mock";
|
|
8
|
+
import { Events as _ } from "events-constructor";
|
|
9
|
+
class T extends V {
|
|
10
|
+
headers;
|
|
11
|
+
constructor(e) {
|
|
12
|
+
super(), this.headers = new Headers(e);
|
|
13
|
+
}
|
|
14
|
+
getHeader(e) {
|
|
15
|
+
return this.headers.get(e) ?? "";
|
|
20
16
|
}
|
|
21
17
|
}
|
|
22
|
-
|
|
18
|
+
const G = "incomingCall", H = "declinedIncomingCall", x = "failedIncomingCall", q = "terminatedIncomingCall", A = "connecting", Y = "connected", j = "disconnected", z = "newRTCSession", B = "registered", $ = "unregistered", J = "registrationFailed", K = "newMessage", Q = "sipEvent", X = "availableSecondRemoteStream", Z = "notAvailableSecondRemoteStream", ee = "mustStopPresentation", te = "shareState", re = "enterRoom", ne = "useLicense", oe = "peerconnection:confirmed", se = "peerconnection:ontrack", ie = "channels", ae = "channels:notify", ce = "ended:fromserver", de = "main-cam-control", Ee = "admin-stop-main-cam", he = "admin-start-main-cam", me = "admin-stop-mic", le = "admin-start-mic", ue = "admin-force-sync-media-state", pe = "participant:added-to-list-moderators", ge = "participant:removed-from-list-moderators", _e = "participant:move-request-to-stream", Te = "participant:move-request-to-spectators", Ie = "participant:move-request-to-participants", we = "participation:accepting-word-request", Se = "participation:cancelling-word-request", Ne = "webcast:started", fe = "webcast:stopped", Ce = "account:changed", Re = "account:deleted", Me = "conference:participant-token-issued", Ae = "ended", Oe = "sending", Pe = "reinvite", ve = "replaces", De = "refer", Le = "progress", ye = "accepted", Fe = "confirmed", be = "peerconnection", Ve = "failed", ke = "muted", We = "unmuted", Ue = "newDTMF", Ge = "newInfo", He = "hold", xe = "unhold", qe = "update", Ye = "sdp", je = "icecandidate", ze = "getusermediafailed", Be = "peerconnection:createofferfailed", $e = "peerconnection:createanswerfailed", Je = "peerconnection:setlocaldescriptionfailed", Ke = "peerconnection:setremotedescriptionfailed", Qe = "presentation:start", Xe = "presentation:started", Ze = "presentation:end", et = "presentation:ended", tt = "presentation:failed", rt = [
|
|
19
|
+
G,
|
|
20
|
+
H,
|
|
21
|
+
q,
|
|
22
|
+
x,
|
|
23
|
+
we,
|
|
24
|
+
Se,
|
|
25
|
+
_e,
|
|
26
|
+
ae,
|
|
27
|
+
Me,
|
|
28
|
+
Ce,
|
|
29
|
+
Re,
|
|
30
|
+
Ne,
|
|
31
|
+
fe,
|
|
32
|
+
pe,
|
|
33
|
+
ge
|
|
34
|
+
], O = [
|
|
35
|
+
A,
|
|
36
|
+
Y,
|
|
37
|
+
j,
|
|
38
|
+
z,
|
|
39
|
+
B,
|
|
40
|
+
$,
|
|
41
|
+
J,
|
|
42
|
+
K,
|
|
43
|
+
Q
|
|
44
|
+
], nt = [
|
|
45
|
+
X,
|
|
46
|
+
Z,
|
|
47
|
+
ee,
|
|
48
|
+
te,
|
|
49
|
+
re,
|
|
50
|
+
ne,
|
|
51
|
+
oe,
|
|
52
|
+
se,
|
|
53
|
+
ie,
|
|
54
|
+
ce,
|
|
55
|
+
de,
|
|
56
|
+
he,
|
|
57
|
+
Ee,
|
|
58
|
+
me,
|
|
59
|
+
le,
|
|
60
|
+
ue,
|
|
61
|
+
Te,
|
|
62
|
+
Ie
|
|
63
|
+
], p = [
|
|
64
|
+
Ae,
|
|
65
|
+
A,
|
|
66
|
+
Oe,
|
|
67
|
+
Pe,
|
|
68
|
+
ve,
|
|
69
|
+
De,
|
|
70
|
+
Le,
|
|
71
|
+
ye,
|
|
72
|
+
Fe,
|
|
73
|
+
be,
|
|
74
|
+
Ve,
|
|
75
|
+
ke,
|
|
76
|
+
We,
|
|
77
|
+
Ue,
|
|
78
|
+
Ge,
|
|
79
|
+
He,
|
|
80
|
+
xe,
|
|
81
|
+
qe,
|
|
82
|
+
Ye,
|
|
83
|
+
je,
|
|
84
|
+
ze,
|
|
85
|
+
Be,
|
|
86
|
+
$e,
|
|
87
|
+
Je,
|
|
88
|
+
Ke,
|
|
89
|
+
Qe,
|
|
90
|
+
Xe,
|
|
91
|
+
Ze,
|
|
92
|
+
et,
|
|
93
|
+
tt
|
|
94
|
+
];
|
|
95
|
+
[...O, ...rt];
|
|
96
|
+
[
|
|
97
|
+
...p,
|
|
98
|
+
...nt
|
|
99
|
+
];
|
|
100
|
+
class ot {
|
|
101
|
+
originator;
|
|
102
|
+
connection;
|
|
103
|
+
events;
|
|
104
|
+
remote_identity;
|
|
105
|
+
mutedOptions = { audio: !1, video: !1 };
|
|
23
106
|
constructor({
|
|
24
107
|
originator: e = "local",
|
|
25
|
-
eventHandlers: t
|
|
108
|
+
eventHandlers: t,
|
|
109
|
+
remoteIdentity: r
|
|
26
110
|
}) {
|
|
27
|
-
|
|
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);
|
|
111
|
+
this.originator = e, this.events = new _(p), this.initEvents(t), this.remote_identity = r;
|
|
33
112
|
}
|
|
34
113
|
get contact() {
|
|
35
114
|
throw new Error("Method not implemented.");
|
|
@@ -81,7 +160,7 @@ class Y {
|
|
|
81
160
|
terminate(e) {
|
|
82
161
|
throw new Error("Method not implemented.");
|
|
83
162
|
}
|
|
84
|
-
async sendInfo(e, t,
|
|
163
|
+
async sendInfo(e, t, r) {
|
|
85
164
|
throw new Error("Method not implemented.");
|
|
86
165
|
}
|
|
87
166
|
hold(e, t) {
|
|
@@ -124,10 +203,10 @@ class Y {
|
|
|
124
203
|
throw new Error("Method not implemented.");
|
|
125
204
|
}
|
|
126
205
|
off(e, t) {
|
|
127
|
-
|
|
206
|
+
return this.events.off(e, t), this;
|
|
128
207
|
}
|
|
129
208
|
removeAllListeners(e) {
|
|
130
|
-
|
|
209
|
+
return console.warn("Method not implemented. Event:", e), this;
|
|
131
210
|
}
|
|
132
211
|
setMaxListeners(e) {
|
|
133
212
|
throw new Error("Method not implemented.");
|
|
@@ -157,12 +236,14 @@ class Y {
|
|
|
157
236
|
throw new Error("Method not implemented.");
|
|
158
237
|
}
|
|
159
238
|
initEvents(e) {
|
|
160
|
-
Object.entries(e).forEach(([t,
|
|
239
|
+
e && Object.entries(e).forEach(([t, r]) => {
|
|
240
|
+
this.on(t, r);
|
|
241
|
+
});
|
|
161
242
|
}
|
|
162
243
|
// @ts-expect-error
|
|
163
244
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
164
245
|
on(e, t) {
|
|
165
|
-
return this.events.on(e, t), this;
|
|
246
|
+
return p.includes(e) && this.events.on(e, t), this;
|
|
166
247
|
}
|
|
167
248
|
trigger(e, t) {
|
|
168
249
|
this.events.trigger(e, t);
|
|
@@ -178,32 +259,29 @@ class Y {
|
|
|
178
259
|
this.trigger("newDTMF", { originator: this.originator });
|
|
179
260
|
}
|
|
180
261
|
async startPresentation(e) {
|
|
181
|
-
return e;
|
|
182
|
-
}
|
|
183
|
-
async updatePresentation(e) {
|
|
184
|
-
return e;
|
|
262
|
+
return this.trigger("presentation:start", e), this.trigger("presentation:started", e), e;
|
|
185
263
|
}
|
|
186
264
|
async stopPresentation(e) {
|
|
187
|
-
return e;
|
|
265
|
+
return this.trigger("presentation:end", e), this.trigger("presentation:ended", e), e;
|
|
188
266
|
}
|
|
189
267
|
isEstablished() {
|
|
190
268
|
return !0;
|
|
191
269
|
}
|
|
192
270
|
}
|
|
193
|
-
class
|
|
271
|
+
class st {
|
|
272
|
+
dtmf = null;
|
|
273
|
+
track = null;
|
|
274
|
+
transport = null;
|
|
275
|
+
transform = null;
|
|
276
|
+
parameters = {
|
|
277
|
+
encodings: [{}],
|
|
278
|
+
transactionId: "0",
|
|
279
|
+
codecs: [],
|
|
280
|
+
headerExtensions: [],
|
|
281
|
+
rtcp: {}
|
|
282
|
+
};
|
|
283
|
+
parametersGets;
|
|
194
284
|
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");
|
|
207
285
|
this.track = e ?? null;
|
|
208
286
|
}
|
|
209
287
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -233,43 +311,39 @@ class q {
|
|
|
233
311
|
throw new Error("Method not implemented.");
|
|
234
312
|
}
|
|
235
313
|
}
|
|
236
|
-
|
|
314
|
+
const it = ["track"];
|
|
315
|
+
class at {
|
|
316
|
+
senders = [];
|
|
317
|
+
receivers = [];
|
|
318
|
+
canTrickleIceCandidates;
|
|
319
|
+
connectionState;
|
|
320
|
+
currentLocalDescription;
|
|
321
|
+
currentRemoteDescription;
|
|
322
|
+
iceConnectionState;
|
|
323
|
+
iceGatheringState;
|
|
324
|
+
idpErrorInfo;
|
|
325
|
+
idpLoginUrl;
|
|
326
|
+
localDescription;
|
|
327
|
+
onconnectionstatechange;
|
|
328
|
+
ondatachannel;
|
|
329
|
+
onicecandidate;
|
|
330
|
+
// eslint-disable-next-line unicorn/no-null
|
|
331
|
+
onicecandidateerror = null;
|
|
332
|
+
oniceconnectionstatechange;
|
|
333
|
+
onicegatheringstatechange;
|
|
334
|
+
onnegotiationneeded;
|
|
335
|
+
onsignalingstatechange;
|
|
336
|
+
ontrack;
|
|
337
|
+
peerIdentity = void 0;
|
|
338
|
+
pendingLocalDescription;
|
|
339
|
+
pendingRemoteDescription;
|
|
340
|
+
remoteDescription;
|
|
341
|
+
// eslint-disable-next-line unicorn/no-null
|
|
342
|
+
sctp = null;
|
|
343
|
+
signalingState;
|
|
344
|
+
events;
|
|
237
345
|
constructor(e, t) {
|
|
238
|
-
|
|
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 }));
|
|
346
|
+
this.events = new _(it), this.receivers = t.map((r) => ({ track: r }));
|
|
273
347
|
}
|
|
274
348
|
getRemoteStreams() {
|
|
275
349
|
throw new Error("Method not implemented.");
|
|
@@ -292,7 +366,7 @@ class G {
|
|
|
292
366
|
createDataChannel(e, t) {
|
|
293
367
|
throw new Error("Method not implemented.");
|
|
294
368
|
}
|
|
295
|
-
async createOffer(e, t,
|
|
369
|
+
async createOffer(e, t, r) {
|
|
296
370
|
throw new Error("Method not implemented.");
|
|
297
371
|
}
|
|
298
372
|
getConfiguration() {
|
|
@@ -319,147 +393,176 @@ class G {
|
|
|
319
393
|
async setRemoteDescription(e) {
|
|
320
394
|
throw new Error("Method not implemented.");
|
|
321
395
|
}
|
|
322
|
-
addEventListener(e, t,
|
|
323
|
-
|
|
396
|
+
addEventListener(e, t, r) {
|
|
397
|
+
this.events.on(e, t);
|
|
324
398
|
}
|
|
325
|
-
removeEventListener(e, t,
|
|
326
|
-
|
|
399
|
+
removeEventListener(e, t, r) {
|
|
400
|
+
this.events.off(e, t);
|
|
327
401
|
}
|
|
328
402
|
dispatchEvent(e) {
|
|
329
403
|
throw new Error("Method not implemented.");
|
|
330
404
|
}
|
|
405
|
+
getReceivers = () => this.receivers;
|
|
406
|
+
getSenders = () => this.senders;
|
|
407
|
+
addTrack = (e) => {
|
|
408
|
+
const t = new st({ track: e });
|
|
409
|
+
return this.senders.push(t), this.events.trigger("track", { track: e }), t;
|
|
410
|
+
};
|
|
331
411
|
}
|
|
332
|
-
function
|
|
333
|
-
const e =
|
|
412
|
+
function ct(n) {
|
|
413
|
+
const e = n.match(/(purgatory)|[\d.]+/g);
|
|
334
414
|
if (!e)
|
|
335
415
|
throw new Error("wrong sip url");
|
|
336
416
|
return e[0];
|
|
337
417
|
}
|
|
338
|
-
const
|
|
418
|
+
const f = 400, dt = "777", Et = (n) => n.getVideoTracks().length > 0;
|
|
419
|
+
class i extends ot {
|
|
420
|
+
static presentationError;
|
|
421
|
+
static startPresentationError;
|
|
422
|
+
static countStartPresentationError = Number.POSITIVE_INFINITY;
|
|
423
|
+
static countStartsPresentation = 0;
|
|
424
|
+
url;
|
|
425
|
+
status_code;
|
|
426
|
+
/**
|
|
427
|
+
* answer
|
|
428
|
+
*
|
|
429
|
+
* @param {Object} arg1 - The argument 1
|
|
430
|
+
* @param {Object} arg1.mediaStream - The media stream
|
|
431
|
+
* @param {Array} arg1.eventHandlers - The event handlers
|
|
432
|
+
|
|
433
|
+
* @returns {undefined}
|
|
434
|
+
*/
|
|
435
|
+
answer = jest.fn(({ mediaStream: e }) => {
|
|
436
|
+
if (this.originator !== "remote")
|
|
437
|
+
throw new Error("answer available only for remote sessions");
|
|
438
|
+
this.initPeerconnection(e), setTimeout(() => {
|
|
439
|
+
this.trigger("connecting"), setTimeout(() => {
|
|
440
|
+
this.trigger("accepted");
|
|
441
|
+
}, 100), setTimeout(() => {
|
|
442
|
+
this.trigger("confirmed");
|
|
443
|
+
}, 200);
|
|
444
|
+
}, f);
|
|
445
|
+
});
|
|
446
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
447
|
+
replaceMediaStream = jest.fn(async (e) => {
|
|
448
|
+
});
|
|
449
|
+
isEndedInner = !1;
|
|
339
450
|
constructor({
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
451
|
+
eventHandlers: e,
|
|
452
|
+
originator: t,
|
|
453
|
+
remoteIdentity: r = new k(
|
|
454
|
+
new E("sip", "caller1", "test1.com", 5060),
|
|
455
|
+
"Test Caller 1"
|
|
456
|
+
)
|
|
344
457
|
}) {
|
|
345
|
-
super({ originator:
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
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;
|
|
458
|
+
super({ originator: t, eventHandlers: e, remoteIdentity: r });
|
|
459
|
+
}
|
|
460
|
+
static setPresentationError(e) {
|
|
461
|
+
this.presentationError = e;
|
|
462
|
+
}
|
|
463
|
+
static resetPresentationError() {
|
|
464
|
+
this.presentationError = void 0;
|
|
465
|
+
}
|
|
466
|
+
static setStartPresentationError(e, { count: t = Number.POSITIVE_INFINITY } = {}) {
|
|
467
|
+
this.startPresentationError = e, this.countStartPresentationError = t;
|
|
373
468
|
}
|
|
374
469
|
static resetStartPresentationError() {
|
|
375
470
|
this.startPresentationError = void 0, this.countStartPresentationError = Number.POSITIVE_INFINITY, this.countStartsPresentation = 0;
|
|
376
471
|
}
|
|
377
|
-
async
|
|
378
|
-
if (
|
|
379
|
-
throw
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
472
|
+
startPresentation = async (e) => {
|
|
473
|
+
if (i.countStartsPresentation += 1, i.presentationError)
|
|
474
|
+
throw this.trigger("presentation:start", e), this.trigger("presentation:failed", e), i.presentationError;
|
|
475
|
+
if (i.startPresentationError && i.countStartsPresentation < i.countStartPresentationError)
|
|
476
|
+
throw this.trigger("presentation:start", e), this.trigger("presentation:failed", e), i.startPresentationError;
|
|
477
|
+
return super.startPresentation(e);
|
|
478
|
+
};
|
|
479
|
+
stopPresentation = async (e) => {
|
|
480
|
+
if (i.presentationError)
|
|
481
|
+
throw this.trigger("presentation:end", e), this.trigger("presentation:failed", e), i.presentationError;
|
|
482
|
+
return super.stopPresentation(e);
|
|
483
|
+
};
|
|
484
|
+
initPeerconnection(e) {
|
|
485
|
+
return e ? (this.createPeerconnection(e), !0) : !1;
|
|
486
|
+
}
|
|
487
|
+
createPeerconnection(e) {
|
|
488
|
+
const t = W();
|
|
489
|
+
t.id = "mainaudio1";
|
|
490
|
+
const r = [t];
|
|
491
|
+
if (Et(e)) {
|
|
492
|
+
const a = U();
|
|
493
|
+
a.id = "mainvideo1", r.push(a);
|
|
392
494
|
}
|
|
393
|
-
this.connection = new
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
setTimeout(() => {
|
|
400
|
-
this.url.includes($) ? this.trigger("failed", {
|
|
495
|
+
this.connection = new at(void 0, r), this.addStream(e), this.trigger("peerconnection", { peerconnection: this.connection });
|
|
496
|
+
}
|
|
497
|
+
connect(e, { mediaStream: t } = {}) {
|
|
498
|
+
const r = ct(e);
|
|
499
|
+
return this.initPeerconnection(t), setTimeout(() => {
|
|
500
|
+
e.includes(dt) ? this.trigger("failed", {
|
|
401
501
|
originator: "remote",
|
|
402
502
|
message: "IncomingResponse",
|
|
403
|
-
cause:
|
|
503
|
+
cause: "Rejected"
|
|
404
504
|
}) : (this.trigger("connecting"), setTimeout(() => {
|
|
405
|
-
this.
|
|
505
|
+
this.newInfo({
|
|
506
|
+
originator: D.REMOTE,
|
|
507
|
+
// @ts-expect-error
|
|
508
|
+
request: {
|
|
509
|
+
getHeader: (s) => s === "content-type" ? "application/vinteo.webrtc.roomname" : s === "x-webrtc-enter-room" ? r : s === "x-webrtc-participant-name" ? "Test Caller 1" : ""
|
|
510
|
+
}
|
|
511
|
+
});
|
|
406
512
|
}, 100), setTimeout(() => {
|
|
407
513
|
this.trigger("accepted");
|
|
408
514
|
}, 200), setTimeout(() => {
|
|
409
515
|
this.trigger("confirmed");
|
|
410
516
|
}, 300));
|
|
411
|
-
},
|
|
517
|
+
}, f), this.connection;
|
|
412
518
|
}
|
|
413
|
-
terminate({ status_code:
|
|
414
|
-
return this.status_code =
|
|
519
|
+
terminate({ status_code: e, cause: t } = {}) {
|
|
520
|
+
return this.status_code = e, this.trigger("ended", { status_code: e, cause: t, originator: "local" }), this.isEndedInner = !1, this;
|
|
415
521
|
}
|
|
416
522
|
async terminateAsync({
|
|
417
|
-
status_code:
|
|
418
|
-
cause:
|
|
523
|
+
status_code: e,
|
|
524
|
+
cause: t
|
|
419
525
|
} = {}) {
|
|
420
|
-
this.terminate({ status_code:
|
|
526
|
+
this.terminate({ status_code: e, cause: t });
|
|
421
527
|
}
|
|
422
|
-
terminateRemote({ status_code:
|
|
423
|
-
return this.status_code =
|
|
528
|
+
terminateRemote({ status_code: e } = {}) {
|
|
529
|
+
return this.status_code = e, this.trigger("ended", { status_code: e, originator: "remote" }), this;
|
|
424
530
|
}
|
|
425
|
-
addStream(
|
|
426
|
-
t
|
|
531
|
+
addStream(e, t = "getTracks") {
|
|
532
|
+
e[t]().forEach((r) => this.connection.addTrack(r));
|
|
427
533
|
}
|
|
428
|
-
forEachSenders(
|
|
429
|
-
const
|
|
430
|
-
for (const
|
|
431
|
-
|
|
432
|
-
return
|
|
534
|
+
forEachSenders(e) {
|
|
535
|
+
const t = this.connection.getSenders();
|
|
536
|
+
for (const r of t)
|
|
537
|
+
e(r);
|
|
538
|
+
return t;
|
|
433
539
|
}
|
|
434
540
|
/* eslint-disable no-param-reassign */
|
|
435
|
-
toggleMuteAudio(
|
|
436
|
-
this.forEachSenders(({ track:
|
|
437
|
-
|
|
541
|
+
toggleMuteAudio(e) {
|
|
542
|
+
this.forEachSenders(({ track: t }) => {
|
|
543
|
+
t && t.kind === "audio" && (t.enabled = !e);
|
|
438
544
|
});
|
|
439
545
|
}
|
|
440
546
|
/* eslint-enable no-param-reassign */
|
|
441
547
|
/* eslint-disable no-param-reassign */
|
|
442
|
-
toggleMuteVideo(
|
|
443
|
-
this.forEachSenders(({ track:
|
|
444
|
-
|
|
548
|
+
toggleMuteVideo(e) {
|
|
549
|
+
this.forEachSenders(({ track: t }) => {
|
|
550
|
+
t && t.kind === "video" && (t.enabled = !e);
|
|
445
551
|
});
|
|
446
552
|
}
|
|
447
|
-
mute(
|
|
448
|
-
|
|
553
|
+
mute(e) {
|
|
554
|
+
e.audio && (this.mutedOptions.audio = !0, this.toggleMuteAudio(this.mutedOptions.audio)), e.video && (this.mutedOptions.video = !0, this.toggleMuteVideo(this.mutedOptions.video)), this.onmute(e);
|
|
449
555
|
}
|
|
450
|
-
unmute(
|
|
451
|
-
|
|
556
|
+
unmute(e) {
|
|
557
|
+
e.audio && (this.mutedOptions.audio = !1), e.video && (this.mutedOptions.video = !1), this.trigger("unmuted", e);
|
|
452
558
|
}
|
|
453
559
|
isMuted() {
|
|
454
560
|
return this.mutedOptions;
|
|
455
561
|
}
|
|
456
|
-
|
|
457
|
-
async replaceMediaStream(t) {
|
|
458
|
-
}
|
|
459
|
-
onmute({ audio: t, video: n }) {
|
|
562
|
+
onmute({ audio: e, video: t }) {
|
|
460
563
|
this.trigger("muted", {
|
|
461
|
-
audio:
|
|
462
|
-
video:
|
|
564
|
+
audio: e,
|
|
565
|
+
video: t
|
|
463
566
|
});
|
|
464
567
|
}
|
|
465
568
|
// eslint-disable-next-line @typescript-eslint/no-empty-function, class-methods-use-this
|
|
@@ -468,17 +571,13 @@ const g = 400, $ = "777", j = (o) => o.getVideoTracks().length > 0, a = class a
|
|
|
468
571
|
isEnded() {
|
|
469
572
|
return this.isEndedInner;
|
|
470
573
|
}
|
|
471
|
-
newInfo(
|
|
472
|
-
this.trigger("newInfo",
|
|
574
|
+
newInfo(e) {
|
|
575
|
+
this.trigger("newInfo", e);
|
|
473
576
|
}
|
|
474
577
|
/* eslint-enable no-param-reassign */
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
class B {
|
|
479
|
-
constructor() {
|
|
480
|
-
r(this, "extraHeaders", []);
|
|
481
|
-
}
|
|
578
|
+
}
|
|
579
|
+
class ht {
|
|
580
|
+
extraHeaders = [];
|
|
482
581
|
setExtraHeaders(e) {
|
|
483
582
|
this.extraHeaders = e;
|
|
484
583
|
}
|
|
@@ -486,86 +585,91 @@ class B {
|
|
|
486
585
|
setExtraContactParams() {
|
|
487
586
|
}
|
|
488
587
|
}
|
|
489
|
-
const
|
|
588
|
+
const c = "PASSWORD_CORRECT", C = "PASSWORD_CORRECT_2", mt = "NAME_INCORRECT", d = 400, u = {
|
|
490
589
|
url: "wss://sipServerUrl/webrtc/wss/",
|
|
491
590
|
sip_uri: "sip:sipServerUrl;transport=ws",
|
|
492
591
|
via_transport: "WSS"
|
|
493
|
-
},
|
|
592
|
+
}, R = {
|
|
494
593
|
status_code: 200,
|
|
495
594
|
reason_phrase: "OK"
|
|
496
|
-
},
|
|
595
|
+
}, M = {
|
|
497
596
|
status_code: 401,
|
|
498
597
|
reason_phrase: "Unauthorized"
|
|
499
|
-
}
|
|
598
|
+
};
|
|
599
|
+
class o {
|
|
600
|
+
static isAvailableTelephony = !0;
|
|
601
|
+
static startError;
|
|
602
|
+
static countStartError = Number.POSITIVE_INFINITY;
|
|
603
|
+
static countStarts = 0;
|
|
604
|
+
events;
|
|
605
|
+
registratorInner;
|
|
606
|
+
// @ts-expect-error – Jest создаёт функцию-замок.
|
|
607
|
+
call = jest.fn(
|
|
608
|
+
(e, t) => {
|
|
609
|
+
const { mediaStream: r, eventHandlers: s } = t;
|
|
610
|
+
return this.session = new i({ eventHandlers: s, originator: "local" }), this.session.connect(e, { mediaStream: r }), this.session;
|
|
611
|
+
}
|
|
612
|
+
);
|
|
613
|
+
sendOptions = jest.fn(
|
|
614
|
+
(e, t, r) => {
|
|
615
|
+
console.log("sendOptions", e, t, r);
|
|
616
|
+
}
|
|
617
|
+
);
|
|
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: u });
|
|
634
|
+
}, d) : this.trigger("disconnected", { error: !0, socket: u });
|
|
635
|
+
});
|
|
636
|
+
removeAllListeners = jest.fn(() => (this.events.removeEventHandlers(), this));
|
|
637
|
+
once = jest.fn((e, t) => (this.events.once(e, t), this));
|
|
638
|
+
startedTimeout;
|
|
639
|
+
stopedTimeout;
|
|
640
|
+
session;
|
|
641
|
+
isRegisteredInner;
|
|
642
|
+
isConnectedInner;
|
|
643
|
+
configuration;
|
|
500
644
|
constructor(e) {
|
|
501
|
-
|
|
502
|
-
r(
|
|
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 = {
|
|
645
|
+
this.events = new _(O);
|
|
646
|
+
const [t, r] = e.uri.split(":"), [s, a] = r.split("@"), l = {
|
|
518
647
|
...e,
|
|
519
|
-
uri: new
|
|
648
|
+
uri: new E(t, s, a)
|
|
520
649
|
};
|
|
521
|
-
this.configuration =
|
|
650
|
+
this.configuration = l, this.registratorInner = new ht();
|
|
522
651
|
}
|
|
523
652
|
static setStartError(e, { count: t = Number.POSITIVE_INFINITY } = {}) {
|
|
524
|
-
|
|
653
|
+
o.startError = e, o.countStartError = t;
|
|
525
654
|
}
|
|
526
655
|
static resetStartError() {
|
|
527
|
-
|
|
656
|
+
o.startError = void 0, o.countStartError = Number.POSITIVE_INFINITY, o.countStarts = 0;
|
|
528
657
|
}
|
|
529
658
|
static setAvailableTelephony() {
|
|
530
|
-
|
|
659
|
+
o.isAvailableTelephony = !0;
|
|
531
660
|
}
|
|
532
661
|
static setNotAvailableTelephony() {
|
|
533
|
-
|
|
662
|
+
o.isAvailableTelephony = !1;
|
|
534
663
|
}
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
*
|
|
538
|
-
* @returns {undefined}
|
|
539
|
-
*/
|
|
540
|
-
start() {
|
|
541
|
-
if (s.countStarts += 1, s.startError && s.countStarts < s.countStartError) {
|
|
542
|
-
this.trigger("disconnected", s.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: w });
|
|
555
|
-
}, m) : this.trigger("disconnected", { error: !0, socket: w });
|
|
664
|
+
static reset() {
|
|
665
|
+
o.resetStartError(), o.setAvailableTelephony();
|
|
556
666
|
}
|
|
557
667
|
on(e, t) {
|
|
558
668
|
return this.events.on(e, t), this;
|
|
559
669
|
}
|
|
560
|
-
once(e, t) {
|
|
561
|
-
return this.events.once(e, t), this;
|
|
562
|
-
}
|
|
563
670
|
off(e, t) {
|
|
564
671
|
return this.events.off(e, t), this;
|
|
565
672
|
}
|
|
566
|
-
removeAllListeners() {
|
|
567
|
-
return this.events.removeEventHandlers(), this;
|
|
568
|
-
}
|
|
569
673
|
trigger(e, t) {
|
|
570
674
|
this.events.trigger(e, t);
|
|
571
675
|
}
|
|
@@ -575,8 +679,7 @@ const h = "PASSWORD_CORRECT", R = "PASSWORD_CORRECT_2", K = "NAME_INCORRECT", m
|
|
|
575
679
|
* @returns {undefined}
|
|
576
680
|
*/
|
|
577
681
|
terminateSessions() {
|
|
578
|
-
|
|
579
|
-
(e = this.session) == null || e.terminate();
|
|
682
|
+
this.session?.terminate();
|
|
580
683
|
}
|
|
581
684
|
set(e, t) {
|
|
582
685
|
return this.configuration[e] = t, !0;
|
|
@@ -588,14 +691,14 @@ const h = "PASSWORD_CORRECT", R = "PASSWORD_CORRECT_2", K = "NAME_INCORRECT", m
|
|
|
588
691
|
*/
|
|
589
692
|
register() {
|
|
590
693
|
this.startedTimeout && clearTimeout(this.startedTimeout);
|
|
591
|
-
const { password: e, register: t, uri:
|
|
592
|
-
t === !0 &&
|
|
593
|
-
this.trigger("registrationFailed", { response:
|
|
594
|
-
},
|
|
595
|
-
this.trigger("registered", { response:
|
|
596
|
-
},
|
|
597
|
-
this.trigger("registrationFailed", { response:
|
|
598
|
-
},
|
|
694
|
+
const { password: e, register: t, uri: r } = this.configuration;
|
|
695
|
+
t === !0 && r.user.includes(mt) ? (this.isRegisteredInner = !1, this.isConnectedInner = !1, this.startedTimeout = setTimeout(() => {
|
|
696
|
+
this.trigger("registrationFailed", { response: M, cause: N.causes.REJECTED });
|
|
697
|
+
}, d)) : !this.isRegistered() && t === !0 && (e === c || e === C) ? (this.isRegisteredInner = !0, this.startedTimeout = setTimeout(() => {
|
|
698
|
+
this.trigger("registered", { response: R });
|
|
699
|
+
}, d)) : t === !0 && e !== c && e !== C && (this.isRegisteredInner = !1, this.isConnectedInner = !1, this.startedTimeout = setTimeout(() => {
|
|
700
|
+
this.trigger("registrationFailed", { response: M, cause: N.causes.REJECTED });
|
|
701
|
+
}, d)), o.isAvailableTelephony ? (this.trigger("connected", { socket: u }), this.isConnectedInner = !0) : this.stop();
|
|
599
702
|
}
|
|
600
703
|
/**
|
|
601
704
|
* unregister
|
|
@@ -603,7 +706,7 @@ const h = "PASSWORD_CORRECT", R = "PASSWORD_CORRECT_2", K = "NAME_INCORRECT", m
|
|
|
603
706
|
* @returns {undefined}
|
|
604
707
|
*/
|
|
605
708
|
unregister() {
|
|
606
|
-
this.isRegisteredInner = !1, this.isConnectedInner = !1, this.trigger("unregistered", { response:
|
|
709
|
+
this.isRegisteredInner = !1, this.isConnectedInner = !1, this.trigger("unregistered", { response: R });
|
|
607
710
|
}
|
|
608
711
|
isRegistered() {
|
|
609
712
|
return this.isRegisteredInner === !0;
|
|
@@ -625,125 +728,123 @@ const h = "PASSWORD_CORRECT", R = "PASSWORD_CORRECT_2", K = "NAME_INCORRECT", m
|
|
|
625
728
|
registrator() {
|
|
626
729
|
return this.registratorInner;
|
|
627
730
|
}
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
class X {
|
|
731
|
+
}
|
|
732
|
+
class lt {
|
|
733
|
+
url;
|
|
632
734
|
constructor(e) {
|
|
633
|
-
r(this, "url");
|
|
634
735
|
this.url = e;
|
|
635
736
|
}
|
|
636
737
|
}
|
|
637
|
-
class
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
this.contentType = t, this.body = n;
|
|
738
|
+
class ut extends b {
|
|
739
|
+
contentType;
|
|
740
|
+
body;
|
|
741
|
+
constructor(e, t) {
|
|
742
|
+
super(), this.contentType = e, this.body = t;
|
|
643
743
|
}
|
|
644
744
|
}
|
|
645
|
-
const
|
|
646
|
-
const t = new
|
|
647
|
-
originator:
|
|
745
|
+
const g = "remote", pt = (n, e) => {
|
|
746
|
+
const t = new T(e), r = {
|
|
747
|
+
originator: g,
|
|
648
748
|
request: t,
|
|
649
|
-
info: new
|
|
749
|
+
info: new ut("", "")
|
|
650
750
|
};
|
|
651
|
-
|
|
652
|
-
},
|
|
653
|
-
const
|
|
654
|
-
|
|
655
|
-
},
|
|
751
|
+
n.newInfo(r);
|
|
752
|
+
}, gt = (n, e) => {
|
|
753
|
+
const r = { event: "sipEvent", request: new T(e) };
|
|
754
|
+
n.newSipEvent(r);
|
|
755
|
+
}, _t = (n, {
|
|
656
756
|
incomingNumber: e = "1234",
|
|
657
757
|
displayName: t,
|
|
658
|
-
host:
|
|
758
|
+
host: r
|
|
659
759
|
}) => {
|
|
660
|
-
const
|
|
661
|
-
|
|
662
|
-
const
|
|
663
|
-
|
|
664
|
-
originator:
|
|
665
|
-
session:
|
|
666
|
-
request:
|
|
760
|
+
const s = new i({ originator: g, eventHandlers: {} }), a = new F("sip", e, r);
|
|
761
|
+
s.remote_identity = new y(a, t);
|
|
762
|
+
const l = new T([]);
|
|
763
|
+
n.trigger("newRTCSession", {
|
|
764
|
+
originator: g,
|
|
765
|
+
session: s,
|
|
766
|
+
request: l
|
|
667
767
|
});
|
|
668
|
-
},
|
|
669
|
-
e ?
|
|
768
|
+
}, Tt = (n, e) => {
|
|
769
|
+
e ? n.trigger("failed", e) : n.trigger("failed", n);
|
|
670
770
|
}, P = {
|
|
671
|
-
triggerNewInfo:
|
|
672
|
-
triggerNewSipEvent:
|
|
673
|
-
triggerIncomingSession:
|
|
674
|
-
triggerFailIncomingSession:
|
|
675
|
-
WebSocketInterface:
|
|
676
|
-
UA:
|
|
771
|
+
triggerNewInfo: pt,
|
|
772
|
+
triggerNewSipEvent: gt,
|
|
773
|
+
triggerIncomingSession: _t,
|
|
774
|
+
triggerFailIncomingSession: Tt,
|
|
775
|
+
WebSocketInterface: lt,
|
|
776
|
+
UA: o,
|
|
677
777
|
C: {
|
|
678
778
|
INVITE: "INVITE"
|
|
679
779
|
}
|
|
680
|
-
}, I = "user",
|
|
780
|
+
}, I = "user", h = "displayName", w = "SIP_SERVER_URL", v = "SIP_WEB_SOCKET_SERVER_URL", It = new P.WebSocketInterface(v), S = {
|
|
681
781
|
userAgent: "Chrome",
|
|
682
|
-
sipServerUrl:
|
|
683
|
-
sipWebSocketServerURL:
|
|
684
|
-
},
|
|
685
|
-
...
|
|
686
|
-
},
|
|
687
|
-
...
|
|
782
|
+
sipServerUrl: w,
|
|
783
|
+
sipWebSocketServerURL: v
|
|
784
|
+
}, vt = {
|
|
785
|
+
...S
|
|
786
|
+
}, wt = {
|
|
787
|
+
...S,
|
|
688
788
|
user: I,
|
|
689
|
-
password:
|
|
789
|
+
password: c,
|
|
690
790
|
register: !0
|
|
691
|
-
},
|
|
692
|
-
...
|
|
693
|
-
displayName:
|
|
694
|
-
},
|
|
695
|
-
...
|
|
696
|
-
displayName:
|
|
791
|
+
}, Dt = {
|
|
792
|
+
...wt,
|
|
793
|
+
displayName: h
|
|
794
|
+
}, Lt = {
|
|
795
|
+
...S,
|
|
796
|
+
displayName: h,
|
|
697
797
|
register: !1
|
|
698
|
-
},
|
|
798
|
+
}, m = {
|
|
699
799
|
session_timers: !1,
|
|
700
|
-
sockets: [
|
|
800
|
+
sockets: [It],
|
|
701
801
|
user_agent: "Chrome",
|
|
702
|
-
|
|
802
|
+
sdpSemantics: "unified-plan",
|
|
703
803
|
register_expires: 300,
|
|
704
804
|
connection_recovery_max_interval: 6,
|
|
705
805
|
connection_recovery_min_interval: 2
|
|
706
|
-
},
|
|
707
|
-
...
|
|
708
|
-
password:
|
|
709
|
-
uri: new
|
|
806
|
+
}, yt = {
|
|
807
|
+
...m,
|
|
808
|
+
password: c,
|
|
809
|
+
uri: new E("sip", I, w),
|
|
710
810
|
display_name: "",
|
|
711
811
|
register: !0
|
|
712
|
-
},
|
|
713
|
-
...
|
|
714
|
-
password:
|
|
715
|
-
uri: new
|
|
716
|
-
display_name:
|
|
812
|
+
}, Ft = {
|
|
813
|
+
...m,
|
|
814
|
+
password: c,
|
|
815
|
+
uri: new E("sip", I, w),
|
|
816
|
+
display_name: h,
|
|
717
817
|
register: !0
|
|
718
|
-
},
|
|
719
|
-
...
|
|
720
|
-
display_name:
|
|
818
|
+
}, bt = {
|
|
819
|
+
...m,
|
|
820
|
+
display_name: h,
|
|
721
821
|
register: !1
|
|
722
|
-
},
|
|
723
|
-
...
|
|
822
|
+
}, Vt = {
|
|
823
|
+
...m,
|
|
724
824
|
display_name: "",
|
|
725
825
|
register: !1
|
|
726
|
-
},
|
|
826
|
+
}, St = "10.10.10.10", kt = [`X-Vinteo-Remote: ${St}`], Wt = () => new L({
|
|
727
827
|
JsSIP: P
|
|
728
828
|
});
|
|
729
829
|
export {
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
830
|
+
dt as FAILED_CONFERENCE_NUMBER,
|
|
831
|
+
P as JsSIP,
|
|
832
|
+
mt as NAME_INCORRECT,
|
|
833
|
+
c as PASSWORD_CORRECT,
|
|
834
|
+
C as PASSWORD_CORRECT_2,
|
|
835
|
+
w as SIP_SERVER_URL,
|
|
836
|
+
v as SIP_WEB_SOCKET_SERVER_URL,
|
|
837
|
+
wt as dataForConnectionWithAuthorization,
|
|
838
|
+
Dt as dataForConnectionWithAuthorizationWithDisplayName,
|
|
839
|
+
Lt as dataForConnectionWithoutAuthorization,
|
|
840
|
+
vt as dataForConnectionWithoutAuthorizationWithoutDisplayName,
|
|
841
|
+
h as displayName,
|
|
842
|
+
Wt as doMockSipConnector,
|
|
843
|
+
kt as extraHeadersRemoteAddress,
|
|
844
|
+
St as remoteAddress,
|
|
845
|
+
yt as uaConfigurationWithAuthorization,
|
|
846
|
+
Ft as uaConfigurationWithAuthorizationWithDisplayName,
|
|
847
|
+
bt as uaConfigurationWithoutAuthorization,
|
|
848
|
+
Vt as uaConfigurationWithoutAuthorizationWithoutDisplayName,
|
|
748
849
|
I as user
|
|
749
850
|
};
|