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.
Files changed (97) hide show
  1. package/dist/SipConnector-CZwqeStw.cjs +1 -0
  2. package/dist/SipConnector-DfaRIKWv.js +1345 -0
  3. package/dist/SipConnector.d.ts +315 -0
  4. package/dist/{src/SipConnectorFacade → SipConnectorFacade}/SipConnectorFacade.d.ts +1 -1
  5. package/dist/doMock.cjs +1 -1
  6. package/dist/doMock.js +302 -298
  7. package/dist/index.cjs +1 -1
  8. package/dist/index.js +533 -522
  9. package/dist/utils/utils.d.ts +4 -0
  10. package/package.json +6 -5
  11. package/dist/SipConnector-DRjfFGAZ.js +0 -1339
  12. package/dist/SipConnector-EXAO9Z-2.cjs +0 -1
  13. package/dist/src/SipConnector.d.ts +0 -235
  14. /package/dist/{src/SipConnectorFacade → SipConnectorFacade}/index.d.ts +0 -0
  15. /package/dist/{src/__fixtures__ → __fixtures__}/BaseSession.mock.d.ts +0 -0
  16. /package/dist/{src/__fixtures__ → __fixtures__}/RTCPeerConnectionMock.d.ts +0 -0
  17. /package/dist/{src/__fixtures__ → __fixtures__}/RTCRtpSenderMock.d.ts +0 -0
  18. /package/dist/{src/__fixtures__ → __fixtures__}/RTCSessionMock.d.ts +0 -0
  19. /package/dist/{src/__fixtures__ → __fixtures__}/Registrator.mock.d.ts +0 -0
  20. /package/dist/{src/__fixtures__ → __fixtures__}/Request.mock.d.ts +0 -0
  21. /package/dist/{src/__fixtures__ → __fixtures__}/UA.mock.d.ts +0 -0
  22. /package/dist/{src/__fixtures__ → __fixtures__}/WebSocketInterface.mock.d.ts +0 -0
  23. /package/dist/{src/__fixtures__ → __fixtures__}/accountNotify.d.ts +0 -0
  24. /package/dist/{src/__fixtures__ → __fixtures__}/channels.d.ts +0 -0
  25. /package/dist/{src/__fixtures__ → __fixtures__}/channelsNotify.d.ts +0 -0
  26. /package/dist/{src/__fixtures__ → __fixtures__}/conferenceParticipantTokenIssuedNotify.d.ts +0 -0
  27. /package/dist/{src/__fixtures__ → __fixtures__}/delayPromise.d.ts +0 -0
  28. /package/dist/{src/__fixtures__ → __fixtures__}/enterRoom.d.ts +0 -0
  29. /package/dist/{src/__fixtures__ → __fixtures__}/index.d.ts +0 -0
  30. /package/dist/{src/__fixtures__ → __fixtures__}/jssip.mock.d.ts +0 -0
  31. /package/dist/{src/__fixtures__ → __fixtures__}/mediaState.d.ts +0 -0
  32. /package/dist/{src/__fixtures__ → __fixtures__}/participantMoveRequests.d.ts +0 -0
  33. /package/dist/{src/__fixtures__ → __fixtures__}/participantNotify.d.ts +0 -0
  34. /package/dist/{src/__fixtures__ → __fixtures__}/remoteCallerData.d.ts +0 -0
  35. /package/dist/{src/__fixtures__ → __fixtures__}/utils.d.ts +0 -0
  36. /package/dist/{src/__fixtures__ → __fixtures__}/webcastNotify.d.ts +0 -0
  37. /package/dist/{src/causes.d.ts → causes.d.ts} +0 -0
  38. /package/dist/{src/constants.d.ts → constants.d.ts} +0 -0
  39. /package/dist/{src/doMock.d.ts → doMock.d.ts} +0 -0
  40. /package/dist/{src/eventNames.d.ts → eventNames.d.ts} +0 -0
  41. /package/dist/{src/getExtraHeadersRemoteAddress.d.ts → getExtraHeadersRemoteAddress.d.ts} +0 -0
  42. /package/dist/{src/headers.d.ts → headers.d.ts} +0 -0
  43. /package/dist/{src/index.d.ts → index.d.ts} +0 -0
  44. /package/dist/{src/logger.d.ts → logger.d.ts} +0 -0
  45. /package/dist/{src/setParametersToSender → setParametersToSender}/configureDegradationPreference.d.ts +0 -0
  46. /package/dist/{src/setParametersToSender → setParametersToSender}/configureEmptyEncodings.d.ts +0 -0
  47. /package/dist/{src/setParametersToSender → setParametersToSender}/configureEncodings.d.ts +0 -0
  48. /package/dist/{src/setParametersToSender → setParametersToSender}/configureMaxBitrate.d.ts +0 -0
  49. /package/dist/{src/setParametersToSender → setParametersToSender}/configureScaleResolutionDownBy.d.ts +0 -0
  50. /package/dist/{src/setParametersToSender → setParametersToSender}/hasChangedRTCRtpSendParameters.d.ts +0 -0
  51. /package/dist/{src/setParametersToSender → setParametersToSender}/index.d.ts +0 -0
  52. /package/dist/{src/setParametersToSender → setParametersToSender}/resolveHasNeedToUpdateItemEncoding.d.ts +0 -0
  53. /package/dist/{src/setParametersToSender → setParametersToSender}/setParametersToSender.d.ts +0 -0
  54. /package/dist/{src/tools → tools}/__fixtures__/call.d.ts +0 -0
  55. /package/dist/{src/tools → tools}/__fixtures__/connectToServer.d.ts +0 -0
  56. /package/dist/{src/tools → tools}/__fixtures__/hasValidUri.d.ts +0 -0
  57. /package/dist/{src/tools → tools}/__fixtures__/permissions.d.ts +0 -0
  58. /package/dist/{src/tools → tools}/__fixtures__/processRequest.d.ts +0 -0
  59. /package/dist/{src/tools → tools}/__tests-utils__/parseObject.d.ts +0 -0
  60. /package/dist/{src/tools → tools}/__tests-utils__/resolveParseArray.d.ts +0 -0
  61. /package/dist/{src/tools → tools}/error/getLinkError.d.ts +0 -0
  62. /package/dist/{src/tools → tools}/error/getTypeFromError.d.ts +0 -0
  63. /package/dist/{src/tools → tools}/error/getValuesFromError.d.ts +0 -0
  64. /package/dist/{src/tools → tools}/error/index.d.ts +0 -0
  65. /package/dist/{src/tools → tools}/error/stringifyMessage.d.ts +0 -0
  66. /package/dist/{src/tools → tools}/generateSimulcastEncodings.d.ts +0 -0
  67. /package/dist/{src/tools → tools}/getExtraHeaders.d.ts +0 -0
  68. /package/dist/{src/tools → tools}/getUserAgent.d.ts +0 -0
  69. /package/dist/{src/tools → tools}/hasPurgatory.d.ts +0 -0
  70. /package/dist/{src/tools → tools}/index.d.ts +0 -0
  71. /package/dist/{src/tools → tools}/prepareMediaStream.d.ts +0 -0
  72. /package/dist/{src/tools → tools}/resolveUpdateTransceiver.d.ts +0 -0
  73. /package/dist/{src/tools → tools}/sendDTMFAccumulated.d.ts +0 -0
  74. /package/dist/{src/tools → tools}/setVideoTrackContentHints.d.ts +0 -0
  75. /package/dist/{src/tools → tools}/syncMediaState/index.d.ts +0 -0
  76. /package/dist/{src/tools → tools}/syncMediaState/resolveOnStartMainCam.d.ts +0 -0
  77. /package/dist/{src/tools → tools}/syncMediaState/resolveOnStartMic.d.ts +0 -0
  78. /package/dist/{src/tools → tools}/syncMediaState/resolveOnStopMainCam.d.ts +0 -0
  79. /package/dist/{src/tools → tools}/syncMediaState/resolveOnStopMic.d.ts +0 -0
  80. /package/dist/{src/types.d.ts → types.d.ts} +0 -0
  81. /package/dist/{src/utils → utils}/errors.d.ts +0 -0
  82. /package/dist/{src/utils → utils}/findSenderByStream.d.ts +0 -0
  83. /package/dist/{src/utils → utils}/findVideoSender.d.ts +0 -0
  84. /package/dist/{src/utils → utils}/findVideoTrack.d.ts +0 -0
  85. /package/dist/{src/utils → utils}/getCodecFromSender.d.ts +0 -0
  86. /package/dist/{src/utils → utils}/replaceForbiddenSymbolsWithUnderscore.d.ts +0 -0
  87. /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/balance.d.ts +0 -0
  88. /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/getMaxBitrateByWidth.d.ts +0 -0
  89. /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/getMaxBitrateByWidthAndCodec.d.ts +0 -0
  90. /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/hasAv1Codec.d.ts +0 -0
  91. /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/hasIncludesString.d.ts +0 -0
  92. /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/index.d.ts +0 -0
  93. /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/processSender.d.ts +0 -0
  94. /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/scaleBitrate.d.ts +0 -0
  95. /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/scaleBitrateByCodec.d.ts +0 -0
  96. /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/scaleResolutionAndBitrate.d.ts +0 -0
  97. /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/setEncodingsToSender.d.ts +0 -0
package/dist/doMock.js CHANGED
@@ -1,31 +1,35 @@
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";
7
- import R from "events-constructor";
8
- import { URI as w, C as I } from "@krivega/jssip";
9
- class E extends L {
10
- headers;
11
- constructor(e) {
12
- super(), this.headers = new Headers(e);
13
- }
14
- getHeader(e) {
15
- return this.headers.get(e) ?? "";
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 F {
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.originator = e, this.events = new R(N), this.initEvents(t);
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, r) {
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, r]) => this.on(t, r));
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 x {
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 U {
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
- this.receivers = t.map((r) => ({ track: r }));
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, r) {
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, r) {
322
+ addEventListener(e, t, n) {
313
323
  throw new Error("Method not implemented.");
314
324
  }
315
- removeEventListener(e, t, r) {
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 H(n) {
329
- const e = n.match(/(purgatory)|[\d.]+/g);
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 l = 400, z = "777", Y = (n) => n.getVideoTracks().length > 0;
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: e = "",
364
- mediaStream: t,
365
- eventHandlers: r,
366
- originator: o
340
+ url: t = "",
341
+ mediaStream: n,
342
+ eventHandlers: i,
343
+ originator: d
367
344
  }) {
368
- super({ originator: o, eventHandlers: r }), this.url = e, this.initPeerconnection(t);
369
- }
370
- static setStartPresentationError(e, { count: t = Number.POSITIVE_INFINITY } = {}) {
371
- this.startPresentationError = e, this.countStartPresentationError = t;
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(e) {
377
- if (s.countStartsPresentation += 1, s.startPresentationError && s.countStartsPresentation < s.countStartPresentationError)
378
- throw s.startPresentationError;
379
- return super.startPresentation(e);
380
- }
381
- initPeerconnection(e) {
382
- return e ? (this.createPeerconnection(e), !0) : !1;
383
- }
384
- createPeerconnection(e) {
385
- const t = W();
386
- t.id = "mainaudio1";
387
- const r = [t];
388
- if (Y(e)) {
389
- const a = V();
390
- a.id = "mainvideo1", r.push(a);
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 U(void 0, r), this.addStream(e), setTimeout(() => {
393
+ this.connection = new G(void 0, i), this.addStream(t), setTimeout(() => {
393
394
  this.trigger("peerconnection", { peerconnection: this.connection });
394
- }, l);
395
+ }, g);
395
396
  }
396
- connect(e) {
397
- const t = H(e);
397
+ connect(t) {
398
+ const n = J(t);
398
399
  setTimeout(() => {
399
- this.url.includes(z) ? this.trigger("failed", {
400
+ this.url.includes($) ? this.trigger("failed", {
400
401
  originator: "remote",
401
402
  message: "IncomingResponse",
402
- cause: P
403
+ cause: D
403
404
  }) : (this.trigger("connecting"), setTimeout(() => {
404
- this.trigger("enterRoom", { room: t });
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
- }, l);
411
+ }, g);
411
412
  }
412
- terminate({ status_code: e, cause: t } = {}) {
413
- return this.status_code = e, this.trigger("ended", { status_code: e, cause: t, originator: "local" }), this.isEndedInner = !1, this;
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: e,
417
- cause: t
417
+ status_code: t,
418
+ cause: n
418
419
  } = {}) {
419
- this.terminate({ status_code: e, cause: t });
420
+ this.terminate({ status_code: t, cause: n });
420
421
  }
421
- terminateRemote({ status_code: e } = {}) {
422
- return this.status_code = e, this.trigger("ended", { status_code: e, originator: "remote" }), this;
422
+ terminateRemote({ status_code: t } = {}) {
423
+ return this.status_code = t, this.trigger("ended", { status_code: t, originator: "remote" }), this;
423
424
  }
424
- addStream(e, t = "getTracks") {
425
- e[t]().forEach((r) => this.connection.addTrack(r));
425
+ addStream(t, n = "getTracks") {
426
+ t[n]().forEach((i) => this.connection.addTrack(i));
426
427
  }
427
- forEachSenders(e) {
428
- const t = this.connection.getSenders();
429
- for (const r of t)
430
- e(r);
431
- return t;
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(e) {
435
- this.forEachSenders(({ track: t }) => {
436
- t && t.kind === "audio" && (t.enabled = !e);
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(e) {
442
- this.forEachSenders(({ track: t }) => {
443
- t && t.kind === "video" && (t.enabled = !e);
442
+ toggleMuteVideo(t) {
443
+ this.forEachSenders(({ track: n }) => {
444
+ n && n.kind === "video" && (n.enabled = !t);
444
445
  });
445
446
  }
446
- mute(e) {
447
- 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);
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(e) {
450
- e.audio && (this.mutedOptions.audio = !1), e.video && (this.mutedOptions.video = !1), this.trigger("unmuted", e);
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(e) {
457
+ async replaceMediaStream(t) {
457
458
  }
458
- onmute({ audio: e, video: t }) {
459
+ onmute({ audio: t, video: n }) {
459
460
  this.trigger("muted", {
460
- audio: e,
461
- video: t
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(e) {
471
- this.trigger("newInfo", e);
471
+ newInfo(t) {
472
+ this.trigger("newInfo", t);
472
473
  }
473
474
  /* eslint-enable no-param-reassign */
474
- }
475
- class q {
476
- extraHeaders = [];
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 d = "PASSWORD_CORRECT", M = "PASSWORD_CORRECT_2", G = "NAME_INCORRECT", c = 400, p = {
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
- }, v = {
493
+ }, C = {
489
494
  status_code: 200,
490
495
  reason_phrase: "OK"
491
- }, T = {
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.events = new R(O);
517
- const [t, r] = e.uri.split(":"), [o, a] = r.split("@"), u = {
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 w(t, o, a)
519
+ uri: new _(t, i, d)
520
520
  };
521
- this.configuration = u, this.registratorInner = new q();
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 (i.countStarts += 1, i.startError && i.countStarts < i.countStartError) {
542
- this.trigger("disconnected", i.startError);
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: p });
555
- }, c) : this.trigger("disconnected", { error: !0, socket: p });
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
- this.session?.terminate();
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: r } = this.configuration;
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();
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: v });
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
- class J {
629
- url;
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 $ extends D {
635
- contentType;
636
- body;
637
- constructor(e, t) {
638
- super(), this.contentType = e, this.body = t;
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 g = "remote", j = (n, e) => {
642
- const t = new E(e), r = {
643
- originator: g,
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
- n.newInfo(r);
648
- }, B = (n, e) => {
649
- const r = { event: "sipEvent", request: new E(e) };
650
- n.newSipEvent(r);
651
- }, K = (n, {
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: r
658
+ host: n
655
659
  }) => {
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([]);
659
- n.trigger("newRTCSession", {
660
- originator: g,
661
- session: o,
662
- request: u
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
- }, X = (n, e) => {
665
- e ? n.trigger("failed", e) : n.trigger("failed", n);
666
- }, C = {
667
- triggerNewInfo: j,
668
- triggerNewSipEvent: B,
669
- triggerIncomingSession: K,
670
- triggerFailIncomingSession: X,
671
- WebSocketInterface: J,
672
- UA: i,
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
- }, f = "user", h = "displayName", _ = "SIP_SERVER_URL", y = "SIP_WEB_SOCKET_SERVER_URL", Q = new C.WebSocketInterface(y), S = {
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: y
680
- }, ce = {
681
- ...S
682
- }, Z = {
683
- ...S,
684
- user: f,
685
- password: d,
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
- }, he = {
688
- ...Z,
689
- displayName: h
690
- }, me = {
691
- ...S,
692
- displayName: h,
691
+ }, we = {
692
+ ...oe,
693
+ displayName: l
694
+ }, Ee = {
695
+ ...v,
696
+ displayName: l,
693
697
  register: !1
694
- }, m = {
698
+ }, p = {
695
699
  session_timers: !1,
696
- sockets: [Q],
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
- }, ue = {
703
- ...m,
704
- password: d,
705
- uri: new w("sip", f, _),
706
+ }, fe = {
707
+ ...p,
708
+ password: h,
709
+ uri: new _("sip", I, M),
706
710
  display_name: "",
707
711
  register: !0
708
- }, le = {
709
- ...m,
710
- password: d,
711
- uri: new w("sip", f, _),
712
- display_name: h,
712
+ }, _e = {
713
+ ...p,
714
+ password: h,
715
+ uri: new _("sip", I, M),
716
+ display_name: l,
713
717
  register: !0
714
- }, pe = {
715
- ...m,
716
- display_name: h,
718
+ }, Se = {
719
+ ...p,
720
+ display_name: l,
717
721
  register: !1
718
- }, ge = {
719
- ...m,
722
+ }, Ie = {
723
+ ...p,
720
724
  display_name: "",
721
725
  register: !1
722
- }, ee = "10.10.10.10", we = [`X-Vinteo-Remote: ${ee}`], Ee = () => new k({
723
- JsSIP: C
726
+ }, ie = "10.10.10.10", Me = [`X-Vinteo-Remote: ${ie}`], ve = () => new W({
727
+ JsSIP: P
724
728
  });
725
729
  export {
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,
736
- h as displayName,
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
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
  };