sip-connector 7.0.3 → 7.0.4

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/doMock.js CHANGED
@@ -1,70 +1,33 @@
1
- var A = Object.defineProperty;
2
- var O = (i, e, t) => e in i ? A(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
- var n = (i, e, t) => (O(i, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { j as k, R as N, U as L, S as D } from "./SipConnector-CxSB1Bmp.js";
5
- import W from "@krivega/jssip/lib/NameAddrHeader";
6
- import P from "@krivega/jssip/lib/URI";
7
- import { EventEmitter as x } from "node:events";
8
- import { IncomingRequest as V } from "@krivega/jssip/lib/SIPMessage";
9
- import E from "events-constructor";
10
- import { URI as f } from "@krivega/jssip";
11
- class R extends V {
12
- constructor(t) {
1
+ var y = Object.defineProperty;
2
+ var I = (o, t, e) => t in o ? y(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
+ var r = (o, t, e) => (I(o, typeof t != "symbol" ? t + "" : t, e), e);
4
+ import { j as A, R as O, U as k, S as N } from "./SipConnector-CxSB1Bmp.js";
5
+ import b from "@krivega/jssip/lib/NameAddrHeader";
6
+ import D from "@krivega/jssip/lib/URI";
7
+ import { EventEmitter as L } from "node:events";
8
+ import { IncomingRequest as W } from "@krivega/jssip/lib/SIPMessage";
9
+ import { createAudioMediaStreamTrackMock as P, createVideoMediaStreamTrackMock as V } from "webrtc-mock";
10
+ import v from "events-constructor";
11
+ import { URI as p } from "@krivega/jssip";
12
+ class T extends W {
13
+ constructor(e) {
13
14
  super();
14
- n(this, "headers");
15
- this.headers = new Headers(t);
15
+ r(this, "headers");
16
+ this.headers = new Headers(e);
16
17
  }
17
- getHeader(t) {
18
- return this.headers.get(t) || "";
18
+ getHeader(e) {
19
+ return this.headers.get(e) || "";
19
20
  }
20
21
  }
21
- var F = Object.defineProperty, U = (i, e, t) => e in i ? F(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, s = (i, e, t) => (U(i, typeof e != "symbol" ? e + "" : e, t), t);
22
- const m = "ended", H = "mute", j = "isolationchange", z = "overconstrained", q = "unmute", $ = [m, H, q, j, z];
23
- class S {
24
- constructor(e, { id: t = "identifier", constraints: r = {} } = {}) {
25
- s(this, "events"), s(this, "id"), s(this, "kind"), s(this, "constraints"), s(this, "enabled"), s(this, "contentHint", ""), s(this, "readyState", "live"), s(this, "isolated", !1), s(this, "label", ""), s(this, "muted", !1), s(this, "onended", null), s(this, "onisolationchange", null), s(this, "onmute", null), s(this, "onunmute", null), s(this, "getConstraints", () => this.constraints), s(this, "stop", () => {
26
- const o = { ...new Event(m) };
27
- this.events.trigger(m, o), this.readyState = m, this.onended && this.onended(o);
28
- }), s(this, "addEventListener", (o, a) => {
29
- this.events.on(o, a);
30
- }), s(this, "removeEventListener", (o, a) => {
31
- this.events.off(o, a);
32
- }), this.id = `${t}-${e}-track`, this.kind = e, this.enabled = !0, this.constraints = { ...r }, this.events = new E($);
33
- }
34
- clone() {
35
- return { ...this };
36
- }
37
- getCapabilities() {
38
- return {
39
- width: { min: 352, max: 4096 },
40
- height: { min: 288, max: 2160 }
41
- };
42
- }
43
- getSettings() {
44
- let e = 0, t = 0;
45
- return typeof this.constraints.width == "object" && this.constraints.width.ideal !== void 0 ? e = this.constraints.width.ideal : typeof this.constraints.width == "object" && this.constraints.width.exact !== void 0 ? e = this.constraints.width.exact : typeof this.constraints.width == "number" && this.constraints.width && (e = this.constraints.width), typeof this.constraints.height == "object" && this.constraints.height.ideal !== void 0 ? t = this.constraints.height.ideal : typeof this.constraints.height == "object" && this.constraints.height.exact !== void 0 ? t = this.constraints.height.exact : typeof this.constraints.height == "number" && this.constraints.height && (t = this.constraints.height), {
46
- width: e,
47
- height: t
48
- };
49
- }
50
- async applyConstraints(e) {
51
- this.constraints = { ...e };
52
- }
53
- dispatchEvent(e) {
54
- const t = e.type;
55
- return this.events.trigger(t, e), !0;
56
- }
57
- }
58
- const B = (i) => new S("audio", i), K = (i) => new S("video", i);
59
- class Y {
22
+ class U {
60
23
  // @ts-expect-error
61
- constructor({ originator: e = "local", eventHandlers: t }) {
62
- n(this, "originator");
63
- n(this, "_connection");
64
- n(this, "_events");
65
- n(this, "_remote_identity");
66
- n(this, "_mutedOptions", { audio: !1, video: !1 });
67
- this.originator = e, this._events = new E(k), this.initEvents(t);
24
+ constructor({ originator: t = "local", eventHandlers: e }) {
25
+ r(this, "originator");
26
+ r(this, "_connection");
27
+ r(this, "_events");
28
+ r(this, "_remote_identity");
29
+ r(this, "_mutedOptions", { audio: !1, video: !1 });
30
+ this.originator = t, this._events = new v(A), this.initEvents(e);
68
31
  }
69
32
  // @ts-expect-error
70
33
  get C() {
@@ -77,7 +40,7 @@ class Y {
77
40
  get id() {
78
41
  throw new Error("Method not implemented.");
79
42
  }
80
- set data(e) {
43
+ set data(t) {
81
44
  throw new Error("Method not implemented.");
82
45
  }
83
46
  get data() {
@@ -116,82 +79,82 @@ class Y {
116
79
  isReadyToReOffer() {
117
80
  throw new Error("Method not implemented.");
118
81
  }
119
- answer(e) {
82
+ answer(t) {
120
83
  throw new Error("Method not implemented.");
121
84
  }
122
- terminate(e) {
85
+ terminate(t) {
123
86
  throw new Error("Method not implemented.");
124
87
  }
125
- async sendInfo(e, t, r) {
88
+ async sendInfo(t, e, n) {
126
89
  throw new Error("Method not implemented.");
127
90
  }
128
- hold(e, t) {
91
+ hold(t, e) {
129
92
  throw new Error("Method not implemented.");
130
93
  }
131
- unhold(e, t) {
94
+ unhold(t, e) {
132
95
  throw new Error("Method not implemented.");
133
96
  }
134
- async renegotiate(e, t) {
97
+ async renegotiate(t, e) {
135
98
  throw new Error("Method not implemented.");
136
99
  }
137
100
  isOnHold() {
138
101
  throw new Error("Method not implemented.");
139
102
  }
140
- mute(e) {
103
+ mute(t) {
141
104
  throw new Error("Method not implemented.");
142
105
  }
143
- unmute(e) {
106
+ unmute(t) {
144
107
  throw new Error("Method not implemented.");
145
108
  }
146
109
  isMuted() {
147
110
  throw new Error("Method not implemented.");
148
111
  }
149
- refer(e, t) {
112
+ refer(t, e) {
150
113
  throw new Error("Method not implemented.");
151
114
  }
152
115
  resetLocalMedia() {
153
116
  throw new Error("Method not implemented.");
154
117
  }
155
- async replaceMediaStream(e, t) {
118
+ async replaceMediaStream(t, e) {
156
119
  throw new Error("Method not implemented.");
157
120
  }
158
- addListener(e, t) {
121
+ addListener(t, e) {
159
122
  throw new Error("Method not implemented.");
160
123
  }
161
- once(e, t) {
124
+ once(t, e) {
162
125
  throw new Error("Method not implemented.");
163
126
  }
164
- removeListener(e, t) {
127
+ removeListener(t, e) {
165
128
  throw new Error("Method not implemented.");
166
129
  }
167
- off(e, t) {
130
+ off(t, e) {
168
131
  throw new Error("Method not implemented.");
169
132
  }
170
- removeAllListeners(e) {
133
+ removeAllListeners(t) {
171
134
  throw new Error("Method not implemented.");
172
135
  }
173
- setMaxListeners(e) {
136
+ setMaxListeners(t) {
174
137
  throw new Error("Method not implemented.");
175
138
  }
176
139
  getMaxListeners() {
177
140
  throw new Error("Method not implemented.");
178
141
  }
179
- listeners(e) {
142
+ listeners(t) {
180
143
  throw new Error("Method not implemented.");
181
144
  }
182
- rawListeners(e) {
145
+ rawListeners(t) {
183
146
  throw new Error("Method not implemented.");
184
147
  }
185
- emit(e, ...t) {
148
+ emit(t, ...e) {
186
149
  throw new Error("Method not implemented.");
187
150
  }
188
- listenerCount(e) {
151
+ listenerCount(t) {
189
152
  throw new Error("Method not implemented.");
190
153
  }
191
- prependListener(e, t) {
154
+ prependListener(t, e) {
192
155
  throw new Error("Method not implemented.");
193
156
  }
194
- prependOnceListener(e, t) {
157
+ prependOnceListener(t, e) {
195
158
  throw new Error("Method not implemented.");
196
159
  }
197
160
  eventNames() {
@@ -204,15 +167,15 @@ class Y {
204
167
  *
205
168
  * @returns {undefined}
206
169
  */
207
- initEvents(e = []) {
208
- Object.entries(e).forEach(([t, r]) => this.on(t, r));
170
+ initEvents(t = []) {
171
+ Object.entries(t).forEach(([e, n]) => this.on(e, n));
209
172
  }
210
173
  // @ts-expect-error
211
- on(e, t) {
212
- return this._events.on(e, t), this;
174
+ on(t, e) {
175
+ return this._events.on(t, e), this;
213
176
  }
214
- trigger(e, t) {
215
- this._events.trigger(e, t);
177
+ trigger(t, e) {
178
+ this._events.trigger(t, e);
216
179
  }
217
180
  /**
218
181
  * sendDTMF
@@ -224,62 +187,62 @@ class Y {
224
187
  sendDTMF() {
225
188
  this.trigger("newDTMF", { originator: this.originator });
226
189
  }
227
- async startPresentation(e) {
228
- return e;
190
+ async startPresentation(t) {
191
+ return t;
229
192
  }
230
- async updatePresentation(e) {
231
- return e;
193
+ async updatePresentation(t) {
194
+ return t;
232
195
  }
233
- async stopPresentation(e) {
234
- return e;
196
+ async stopPresentation(t) {
197
+ return t;
235
198
  }
236
199
  isEstablished() {
237
200
  return !0;
238
201
  }
239
202
  }
240
- class J {
241
- constructor(e, t) {
242
- n(this, "_senders", []);
243
- n(this, "_receivers", []);
244
- n(this, "canTrickleIceCandidates");
245
- n(this, "connectionState");
246
- n(this, "currentLocalDescription");
247
- n(this, "currentRemoteDescription");
248
- n(this, "iceConnectionState");
249
- n(this, "iceGatheringState");
250
- n(this, "idpErrorInfo");
251
- n(this, "idpLoginUrl");
252
- n(this, "localDescription");
253
- n(this, "onconnectionstatechange");
254
- n(this, "ondatachannel");
255
- n(this, "onicecandidate");
256
- n(this, "onicecandidateerror", null);
257
- n(this, "oniceconnectionstatechange");
258
- n(this, "onicegatheringstatechange");
259
- n(this, "onnegotiationneeded");
260
- n(this, "onsignalingstatechange");
261
- n(this, "ontrack");
262
- n(this, "peerIdentity");
263
- n(this, "pendingLocalDescription");
264
- n(this, "pendingRemoteDescription");
265
- n(this, "remoteDescription");
266
- n(this, "sctp", null);
267
- n(this, "signalingState");
268
- n(this, "getReceivers", () => this._receivers);
269
- n(this, "getSenders", () => this._senders);
270
- n(this, "addTrack", (e) => {
271
- const t = { track: e };
272
- return this._senders.push(t), t;
203
+ class x {
204
+ constructor(t, e) {
205
+ r(this, "_senders", []);
206
+ r(this, "_receivers", []);
207
+ r(this, "canTrickleIceCandidates");
208
+ r(this, "connectionState");
209
+ r(this, "currentLocalDescription");
210
+ r(this, "currentRemoteDescription");
211
+ r(this, "iceConnectionState");
212
+ r(this, "iceGatheringState");
213
+ r(this, "idpErrorInfo");
214
+ r(this, "idpLoginUrl");
215
+ r(this, "localDescription");
216
+ r(this, "onconnectionstatechange");
217
+ r(this, "ondatachannel");
218
+ r(this, "onicecandidate");
219
+ r(this, "onicecandidateerror", null);
220
+ r(this, "oniceconnectionstatechange");
221
+ r(this, "onicegatheringstatechange");
222
+ r(this, "onnegotiationneeded");
223
+ r(this, "onsignalingstatechange");
224
+ r(this, "ontrack");
225
+ r(this, "peerIdentity");
226
+ r(this, "pendingLocalDescription");
227
+ r(this, "pendingRemoteDescription");
228
+ r(this, "remoteDescription");
229
+ r(this, "sctp", null);
230
+ r(this, "signalingState");
231
+ r(this, "getReceivers", () => this._receivers);
232
+ r(this, "getSenders", () => this._senders);
233
+ r(this, "addTrack", (t) => {
234
+ const e = { track: t };
235
+ return this._senders.push(e), e;
273
236
  });
274
- this._receivers = t.map((r) => ({ track: r }));
237
+ this._receivers = e.map((n) => ({ track: n }));
275
238
  }
276
239
  getRemoteStreams() {
277
240
  throw new Error("Method not implemented.");
278
241
  }
279
- async addIceCandidate(e) {
242
+ async addIceCandidate(t) {
280
243
  throw new Error("Method not implemented.");
281
244
  }
282
- addTransceiver(e, t) {
245
+ addTransceiver(t, e) {
283
246
  throw new Error("Method not implemented.");
284
247
  }
285
248
  close() {
@@ -288,13 +251,13 @@ class J {
288
251
  restartIce() {
289
252
  throw new Error("Method not implemented.");
290
253
  }
291
- async createAnswer(e, t) {
254
+ async createAnswer(t, e) {
292
255
  throw new Error("Method not implemented.");
293
256
  }
294
- createDataChannel(e, t) {
257
+ createDataChannel(t, e) {
295
258
  throw new Error("Method not implemented.");
296
259
  }
297
- async createOffer(e, t, r) {
260
+ async createOffer(t, e, n) {
298
261
  throw new Error("Method not implemented.");
299
262
  }
300
263
  getConfiguration() {
@@ -303,52 +266,52 @@ class J {
303
266
  async getIdentityAssertion() {
304
267
  throw new Error("Method not implemented.");
305
268
  }
306
- async getStats(e) {
269
+ async getStats(t) {
307
270
  throw new Error("Method not implemented.");
308
271
  }
309
272
  getTransceivers() {
310
273
  throw new Error("Method not implemented.");
311
274
  }
312
- removeTrack(e) {
275
+ removeTrack(t) {
313
276
  throw new Error("Method not implemented.");
314
277
  }
315
- setConfiguration(e) {
278
+ setConfiguration(t) {
316
279
  throw new Error("Method not implemented.");
317
280
  }
318
- async setLocalDescription(e) {
281
+ async setLocalDescription(t) {
319
282
  throw new Error("Method not implemented.");
320
283
  }
321
- async setRemoteDescription(e) {
284
+ async setRemoteDescription(t) {
322
285
  throw new Error("Method not implemented.");
323
286
  }
324
- addEventListener(e, t, r) {
287
+ addEventListener(t, e, n) {
325
288
  throw new Error("Method not implemented.");
326
289
  }
327
- removeEventListener(e, t, r) {
290
+ removeEventListener(t, e, n) {
328
291
  throw new Error("Method not implemented.");
329
292
  }
330
- dispatchEvent(e) {
293
+ dispatchEvent(t) {
331
294
  throw new Error("Method not implemented.");
332
295
  }
333
296
  }
334
- function G(i) {
335
- const e = i.match(/(purgatory)|[\d.]+/g);
336
- if (!e)
297
+ function F(o) {
298
+ const t = o.match(/(purgatory)|[\d.]+/g);
299
+ if (!t)
337
300
  throw new Error("wrong sip url");
338
- return e[0];
301
+ return t[0];
339
302
  }
340
- const p = 400, X = "777", Q = (i) => i.getVideoTracks().length > 0;
341
- class C extends Y {
303
+ const u = 400, H = "777", z = (o) => o.getVideoTracks().length > 0;
304
+ class R extends U {
342
305
  constructor({
343
- url: t = "",
344
- mediaStream: r,
345
- eventHandlers: o,
346
- originator: a
306
+ url: e = "",
307
+ mediaStream: n,
308
+ eventHandlers: i,
309
+ originator: s
347
310
  }) {
348
- super({ originator: a, eventHandlers: o });
349
- n(this, "url");
350
- n(this, "status_code");
351
- n(this, "_isEnded", !1);
311
+ super({ originator: s, eventHandlers: i });
312
+ r(this, "url");
313
+ r(this, "status_code");
314
+ r(this, "_isEnded", !1);
352
315
  /**
353
316
  * answer
354
317
  *
@@ -358,94 +321,94 @@ class C extends Y {
358
321
 
359
322
  * @returns {undefined}
360
323
  */
361
- n(this, "answer", jest.fn(({ mediaStream: t }) => {
324
+ r(this, "answer", jest.fn(({ mediaStream: e }) => {
362
325
  if (this.originator !== "remote")
363
326
  throw new Error("answer available only for remote sessions");
364
- this.initPeerconnection(t), setTimeout(() => {
327
+ this.initPeerconnection(e), setTimeout(() => {
365
328
  this.trigger("connecting"), setTimeout(() => {
366
329
  this.trigger("accepted");
367
330
  }, 100), setTimeout(() => {
368
331
  this.trigger("confirmed");
369
332
  }, 200);
370
- }, p);
333
+ }, u);
371
334
  }));
372
- this.url = t, this.initPeerconnection(r);
373
- }
374
- initPeerconnection(t) {
375
- return t ? (this.createPeerconnection(t), !0) : !1;
376
- }
377
- createPeerconnection(t) {
378
- const r = B();
379
- r.id = "mainaudio1";
380
- const o = [r];
381
- if (Q(t)) {
382
- const h = K();
383
- h.id = "mainvideo1", o.push(h);
335
+ this.url = e, this.initPeerconnection(n);
336
+ }
337
+ initPeerconnection(e) {
338
+ return e ? (this.createPeerconnection(e), !0) : !1;
339
+ }
340
+ createPeerconnection(e) {
341
+ const n = P();
342
+ n.id = "mainaudio1";
343
+ const i = [n];
344
+ if (z(e)) {
345
+ const d = V();
346
+ d.id = "mainvideo1", i.push(d);
384
347
  }
385
- this._connection = new J(void 0, o), this._addStream(t), setTimeout(() => {
348
+ this._connection = new x(void 0, i), this._addStream(e), setTimeout(() => {
386
349
  this.trigger("peerconnection", { peerconnection: this.connection });
387
- }, p);
350
+ }, u);
388
351
  }
389
- connect(t) {
390
- const r = G(t);
352
+ connect(e) {
353
+ const n = F(e);
391
354
  setTimeout(() => {
392
- this.url.includes(X) ? this.trigger("failed", {
355
+ this.url.includes(H) ? this.trigger("failed", {
393
356
  originator: "remote",
394
357
  message: "IncomingResponse",
395
- cause: N
358
+ cause: O
396
359
  }) : (this.trigger("connecting"), setTimeout(() => {
397
- this.trigger("enterRoom", { room: r });
360
+ this.trigger("enterRoom", { room: n });
398
361
  }, 100), setTimeout(() => {
399
362
  this.trigger("accepted");
400
363
  }, 200), setTimeout(() => {
401
364
  this.trigger("confirmed");
402
365
  }, 300));
403
- }, p);
366
+ }, u);
404
367
  }
405
- terminate({ status_code: t } = {}) {
406
- return this.status_code = t, this.trigger("ended", { status_code: t }), this._isEnded = !1, this;
368
+ terminate({ status_code: e } = {}) {
369
+ return this.status_code = e, this.trigger("ended", { status_code: e }), this._isEnded = !1, this;
407
370
  }
408
- terminateRemote({ status_code: t } = {}) {
409
- return this.status_code = t, this.trigger("ended", { status_code: t, originator: "remote" }), this;
371
+ terminateRemote({ status_code: e } = {}) {
372
+ return this.status_code = e, this.trigger("ended", { status_code: e, originator: "remote" }), this;
410
373
  }
411
- _addStream(t, r = "getTracks") {
412
- t[r]().forEach((o) => this.connection.addTrack(o));
374
+ _addStream(e, n = "getTracks") {
375
+ e[n]().forEach((i) => this.connection.addTrack(i));
413
376
  }
414
- _forEachSenders(t) {
415
- const r = this.connection.getSenders();
416
- for (const o of r)
417
- t(o);
418
- return r;
377
+ _forEachSenders(e) {
378
+ const n = this.connection.getSenders();
379
+ for (const i of n)
380
+ e(i);
381
+ return n;
419
382
  }
420
383
  /* eslint-disable no-param-reassign */
421
- _toggleMuteAudio(t) {
422
- this._forEachSenders(({ track: r }) => {
423
- r && r.kind === "audio" && (r.enabled = !t);
384
+ _toggleMuteAudio(e) {
385
+ this._forEachSenders(({ track: n }) => {
386
+ n && n.kind === "audio" && (n.enabled = !e);
424
387
  });
425
388
  }
426
389
  /* eslint-enable no-param-reassign */
427
390
  /* eslint-disable no-param-reassign */
428
- _toggleMuteVideo(t) {
429
- this._forEachSenders(({ track: r }) => {
430
- r && r.kind === "video" && (r.enabled = !t);
391
+ _toggleMuteVideo(e) {
392
+ this._forEachSenders(({ track: n }) => {
393
+ n && n.kind === "video" && (n.enabled = !e);
431
394
  });
432
395
  }
433
- mute(t) {
434
- 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);
396
+ mute(e) {
397
+ 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);
435
398
  }
436
- unmute(t) {
437
- t.audio && (this._mutedOptions.audio = !1), t.video && (this._mutedOptions.video = !1), this.trigger("unmuted", t);
399
+ unmute(e) {
400
+ e.audio && (this._mutedOptions.audio = !1), e.video && (this._mutedOptions.video = !1), this.trigger("unmuted", e);
438
401
  }
439
402
  isMuted() {
440
403
  return this._mutedOptions;
441
404
  }
442
- async replaceMediaStream(t) {
443
- return t;
405
+ async replaceMediaStream(e) {
406
+ return e;
444
407
  }
445
- _onmute({ audio: t, video: r }) {
408
+ _onmute({ audio: e, video: n }) {
446
409
  this.trigger("muted", {
447
- audio: t,
448
- video: r
410
+ audio: e,
411
+ video: n
449
412
  });
450
413
  }
451
414
  async sendInfo() {
@@ -453,42 +416,42 @@ class C extends Y {
453
416
  isEnded() {
454
417
  return this._isEnded;
455
418
  }
456
- newInfo(t) {
457
- this.trigger("newInfo", t);
419
+ newInfo(e) {
420
+ this.trigger("newInfo", e);
458
421
  }
459
422
  /* eslint-enable no-param-reassign */
460
423
  }
461
- class Z {
424
+ class q {
462
425
  constructor() {
463
- n(this, "extraHeaders");
426
+ r(this, "extraHeaders");
464
427
  }
465
- setExtraHeaders(e) {
466
- this.extraHeaders = e;
428
+ setExtraHeaders(t) {
429
+ this.extraHeaders = t;
467
430
  }
468
431
  setExtraContactParams() {
469
432
  }
470
433
  }
471
- const d = "PASSWORD_CORRECT", y = "PASSWORD_CORRECT_2", ee = "NAME_INCORRECT", c = 400, l = class l {
472
- constructor(e) {
473
- n(this, "_events");
474
- n(this, "_startedTimeout");
475
- n(this, "_stopedTimeout");
476
- n(this, "session");
477
- n(this, "_isRegistered");
478
- n(this, "_isConnected");
479
- n(this, "configuration");
480
- n(this, "_registrator");
434
+ const a = "PASSWORD_CORRECT", M = "PASSWORD_CORRECT_2", j = "NAME_INCORRECT", c = 400, h = class h {
435
+ constructor(t) {
436
+ r(this, "_events");
437
+ r(this, "_startedTimeout");
438
+ r(this, "_stopedTimeout");
439
+ r(this, "session");
440
+ r(this, "_isRegistered");
441
+ r(this, "_isConnected");
442
+ r(this, "configuration");
443
+ r(this, "_registrator");
481
444
  // @ts-expect-error
482
- n(this, "call", jest.fn((e, t) => {
483
- const { mediaStream: r, eventHandlers: o } = t;
484
- return this.session = new C({ url: e, mediaStream: r, eventHandlers: o, originator: "local" }), this.session.connect(e), this.session;
445
+ r(this, "call", jest.fn((t, e) => {
446
+ const { mediaStream: n, eventHandlers: i } = e;
447
+ return this.session = new R({ url: t, mediaStream: n, eventHandlers: i, originator: "local" }), this.session.connect(t), this.session;
485
448
  }));
486
- this._events = new E(L);
487
- const [t, r] = e.uri.split(":"), [o, a] = r.split("@"), h = {
488
- ...e,
489
- uri: new f(t, o, a)
449
+ this._events = new v(k);
450
+ const [e, n] = t.uri.split(":"), [i, s] = n.split("@"), d = {
451
+ ...t,
452
+ uri: new p(e, i, s)
490
453
  };
491
- this.configuration = h, this._registrator = new Z();
454
+ this.configuration = d, this._registrator = new q();
492
455
  }
493
456
  static setAvailableTelephony() {
494
457
  this.isAvailableTelephony = !0;
@@ -515,22 +478,22 @@ const d = "PASSWORD_CORRECT", y = "PASSWORD_CORRECT_2", ee = "NAME_INCORRECT", c
515
478
  }, c) : this.trigger("disconnected", { error: new Error("stoped") });
516
479
  }
517
480
  // @ts-expect-error
518
- on(e, t) {
519
- return this._events.on(e, t), this;
481
+ on(t, e) {
482
+ return this._events.on(t, e), this;
520
483
  }
521
484
  // @ts-expect-error
522
- once(e, t) {
523
- return this._events.once(e, t), this;
485
+ once(t, e) {
486
+ return this._events.once(t, e), this;
524
487
  }
525
488
  // @ts-expect-error
526
- off(e, t) {
527
- return this._events.off(e, t), this;
489
+ off(t, e) {
490
+ return this._events.off(t, e), this;
528
491
  }
529
492
  removeAllListeners() {
530
493
  return this._events.removeEventHandlers(), this;
531
494
  }
532
- trigger(e, t) {
533
- this._events.trigger(e, t);
495
+ trigger(t, e) {
496
+ this._events.trigger(t, e);
534
497
  }
535
498
  /**
536
499
  * terminateSessions
@@ -548,8 +511,8 @@ const d = "PASSWORD_CORRECT", y = "PASSWORD_CORRECT_2", ee = "NAME_INCORRECT", c
548
511
  *
549
512
  * @returns {boolean} true
550
513
  */
551
- set(e, t) {
552
- return this.configuration[e] = t, !0;
514
+ set(t, e) {
515
+ return this.configuration[t] = e, !0;
553
516
  }
554
517
  /**
555
518
  * register
@@ -558,14 +521,14 @@ const d = "PASSWORD_CORRECT", y = "PASSWORD_CORRECT_2", ee = "NAME_INCORRECT", c
558
521
  */
559
522
  register() {
560
523
  this._startedTimeout && clearTimeout(this._startedTimeout);
561
- const { password: e, register: t, uri: r } = this.configuration;
562
- t && r.user.includes(ee) ? (this._isRegistered = !1, this._isConnected = !1, this._startedTimeout = setTimeout(() => {
524
+ const { password: t, register: e, uri: n } = this.configuration;
525
+ e && n.user.includes(j) ? (this._isRegistered = !1, this._isConnected = !1, this._startedTimeout = setTimeout(() => {
563
526
  this.trigger("registrationFailed", { response: null, cause: "Request Timeout" });
564
- }, c)) : !this._isRegistered && t && (e === d || e === y) ? (this._isRegistered = !0, this._startedTimeout = setTimeout(() => {
527
+ }, c)) : !this._isRegistered && e && (t === a || t === M) ? (this._isRegistered = !0, this._startedTimeout = setTimeout(() => {
565
528
  this.trigger("registered");
566
- }, c)) : t && e !== d && e !== y && (this._isRegistered = !1, this._isConnected = !1, this._startedTimeout = setTimeout(() => {
529
+ }, c)) : e && t !== a && t !== M && (this._isRegistered = !1, this._isConnected = !1, this._startedTimeout = setTimeout(() => {
567
530
  this.trigger("registrationFailed", { response: null, cause: "Wrong credentials" });
568
- }, c)), l.isAvailableTelephony ? (this.trigger("connected"), this._isConnected = !0) : this.stop();
531
+ }, c)), h.isAvailableTelephony ? (this.trigger("connected"), this._isConnected = !0) : this.stop();
569
532
  }
570
533
  /**
571
534
  * unregister
@@ -594,122 +557,122 @@ const d = "PASSWORD_CORRECT", y = "PASSWORD_CORRECT_2", ee = "NAME_INCORRECT", c
594
557
  registrator() {
595
558
  return this._registrator;
596
559
  }
597
- newSipEvent(e) {
598
- this.trigger("sipEvent", e);
560
+ newSipEvent(t) {
561
+ this.trigger("sipEvent", t);
599
562
  }
600
563
  };
601
- n(l, "isAvailableTelephony", !0);
602
- let _ = l;
603
- class te {
604
- constructor(e) {
605
- n(this, "url");
606
- this.url = e;
564
+ r(h, "isAvailableTelephony", !0);
565
+ let g = h;
566
+ class B {
567
+ constructor(t) {
568
+ r(this, "url");
569
+ this.url = t;
607
570
  }
608
571
  }
609
- class ne extends x {
610
- constructor(t, r) {
572
+ class K extends L {
573
+ constructor(e, n) {
611
574
  super();
612
- n(this, "contentType");
613
- n(this, "body");
614
- this.contentType = t, this.body = r;
575
+ r(this, "contentType");
576
+ r(this, "body");
577
+ this.contentType = e, this.body = n;
615
578
  }
616
579
  }
617
- const w = "remote", re = (i, e) => {
618
- const t = new R(e), r = {
619
- originator: w,
620
- request: t,
621
- info: new ne("", "")
580
+ const _ = "remote", $ = (o, t) => {
581
+ const e = new T(t), n = {
582
+ originator: _,
583
+ request: e,
584
+ info: new K("", "")
622
585
  };
623
- i.newInfo(r);
624
- }, ie = (i, e) => {
625
- const r = { request: new R(e) };
626
- i.newSipEvent(r);
627
- }, oe = (i, {
628
- incomingNumber: e = "1234",
629
- displayName: t,
630
- host: r
586
+ o.newInfo(n);
587
+ }, J = (o, t) => {
588
+ const n = { request: new T(t) };
589
+ o.newSipEvent(n);
590
+ }, Y = (o, {
591
+ incomingNumber: t = "1234",
592
+ displayName: e,
593
+ host: n
631
594
  }) => {
632
- const o = new C({ originator: w }), a = new P("sip", e, r);
633
- o._remote_identity = new W(a, t), i.trigger("newRTCSession", { originator: w, session: o });
634
- }, se = (i, e) => {
635
- e ? i.trigger("failed", e) : i.trigger("failed", i);
636
- }, b = {
637
- triggerNewInfo: re,
638
- triggerNewSipEvent: ie,
639
- triggerIncomingSession: oe,
640
- triggerFailIncomingSession: se,
641
- WebSocketInterface: te,
642
- UA: _,
595
+ const i = new R({ originator: _ }), s = new D("sip", t, n);
596
+ i._remote_identity = new b(s, e), o.trigger("newRTCSession", { originator: _, session: i });
597
+ }, G = (o, t) => {
598
+ t ? o.trigger("failed", t) : o.trigger("failed", o);
599
+ }, S = {
600
+ triggerNewInfo: $,
601
+ triggerNewSipEvent: J,
602
+ triggerIncomingSession: Y,
603
+ triggerFailIncomingSession: G,
604
+ WebSocketInterface: B,
605
+ UA: g,
643
606
  C: {
644
607
  INVITE: "INVITE"
645
608
  }
646
- }, v = "user", u = "displayName", M = "SIP_SERVER_URL", I = "SIP_WEB_SOCKET_SERVER_URL", ae = new b.WebSocketInterface(I), T = {
609
+ }, w = "user", m = "displayName", E = "SIP_SERVER_URL", C = "SIP_WEB_SOCKET_SERVER_URL", X = new S.WebSocketInterface(C), f = {
647
610
  userAgent: "Chrome",
648
- sipServerUrl: M,
649
- sipWebSocketServerURL: I
650
- }, Ee = {
651
- ...T
652
- }, de = {
653
- ...T,
654
- user: v,
655
- password: d,
611
+ sipServerUrl: E,
612
+ sipWebSocketServerURL: C
613
+ }, ce = {
614
+ ...f
615
+ }, Q = {
616
+ ...f,
617
+ user: w,
618
+ password: a,
656
619
  register: !0
657
- }, fe = {
658
- ...de,
659
- displayName: u
660
- }, ve = {
661
- ...T,
662
- displayName: u,
620
+ }, he = {
621
+ ...Q,
622
+ displayName: m
623
+ }, me = {
624
+ ...f,
625
+ displayName: m,
663
626
  register: !1
664
- }, g = {
627
+ }, l = {
665
628
  session_timers: !1,
666
- sockets: [ae],
629
+ sockets: [X],
667
630
  user_agent: "Chrome",
668
631
  sdp_semantics: "plan-b",
669
632
  register_expires: 300,
670
633
  connection_recovery_max_interval: 6,
671
634
  connection_recovery_min_interval: 2
672
- }, Me = {
673
- ...g,
674
- password: d,
675
- uri: new f("sip", v, M),
635
+ }, le = {
636
+ ...l,
637
+ password: a,
638
+ uri: new p("sip", w, E),
676
639
  display_name: "",
677
640
  register: !0
678
- }, Te = {
679
- ...g,
680
- password: d,
681
- uri: new f("sip", v, M),
682
- display_name: u,
641
+ }, ue = {
642
+ ...l,
643
+ password: a,
644
+ uri: new p("sip", w, E),
645
+ display_name: m,
683
646
  register: !0
684
- }, ye = {
685
- ...g,
686
- display_name: u,
647
+ }, ge = {
648
+ ...l,
649
+ display_name: m,
687
650
  register: !1
688
- }, Re = {
689
- ...g,
651
+ }, _e = {
652
+ ...l,
690
653
  display_name: "",
691
654
  register: !1
692
- }, he = "10.10.10.10", Se = [`X-Vinteo-Remote: ${he}`], Ce = () => new D({
693
- JsSIP: b
655
+ }, Z = "10.10.10.10", pe = [`X-Vinteo-Remote: ${Z}`], we = () => new N({
656
+ JsSIP: S
694
657
  });
695
658
  export {
696
- X as FAILED_CONFERENCE_NUMBER,
697
- ee as NAME_INCORRECT,
698
- d as PASSWORD_CORRECT,
699
- y as PASSWORD_CORRECT_2,
700
- M as SIP_SERVER_URL,
701
- I as SIP_WEB_SOCKET_SERVER_URL,
702
- de as dataForConnectionWithAuthorization,
703
- fe as dataForConnectionWithAuthorizationWithDisplayName,
704
- ve as dataForConnectionWithoutAuthorization,
705
- Ee as dataForConnectionWithoutAuthorizationWithoutDisplayName,
706
- Ce as default,
707
- u as displayName,
708
- Se as extraHeadersRemoteAddress,
709
- he as remoteAddress,
710
- Me as uaConfigurationWithAuthorization,
711
- Te as uaConfigurationWithAuthorizationWithDisplayName,
712
- ye as uaConfigurationWithoutAuthorization,
713
- Re as uaConfigurationWithoutAuthorizationWithoutDisplayName,
714
- v as user
659
+ H as FAILED_CONFERENCE_NUMBER,
660
+ j as NAME_INCORRECT,
661
+ a as PASSWORD_CORRECT,
662
+ M as PASSWORD_CORRECT_2,
663
+ E as SIP_SERVER_URL,
664
+ C as SIP_WEB_SOCKET_SERVER_URL,
665
+ Q as dataForConnectionWithAuthorization,
666
+ he as dataForConnectionWithAuthorizationWithDisplayName,
667
+ me as dataForConnectionWithoutAuthorization,
668
+ ce as dataForConnectionWithoutAuthorizationWithoutDisplayName,
669
+ we as default,
670
+ m as displayName,
671
+ pe as extraHeadersRemoteAddress,
672
+ Z as remoteAddress,
673
+ le as uaConfigurationWithAuthorization,
674
+ ue as uaConfigurationWithAuthorizationWithDisplayName,
675
+ ge as uaConfigurationWithoutAuthorization,
676
+ _e as uaConfigurationWithoutAuthorizationWithoutDisplayName,
677
+ w as user
715
678
  };