sip-connector 6.22.0 → 6.22.1

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