sip-connector 6.22.0 → 6.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SipConnector-4TW1xlov.cjs +1 -0
- package/dist/{SipConnector-_AhwhWtL.js → SipConnector-Hg44qtgr.js} +2 -2
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +289 -326
- package/dist/index.cjs +1 -1
- package/dist/index.js +150 -150
- package/package.json +27 -25
- package/dist/SipConnector-XqVe938n.cjs +0 -1
package/dist/doMock.js
CHANGED
|
@@ -1,71 +1,34 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { j as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { EventEmitter as
|
|
8
|
-
import { IncomingRequest as
|
|
9
|
-
import
|
|
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
|
|
13
|
-
constructor(
|
|
13
|
+
class f extends D {
|
|
14
|
+
constructor(e) {
|
|
14
15
|
super();
|
|
15
|
-
|
|
16
|
-
this.headers = new Headers(
|
|
16
|
+
r(this, "headers");
|
|
17
|
+
this.headers = new Headers(e);
|
|
17
18
|
}
|
|
18
|
-
getHeader(
|
|
19
|
-
return this.headers.get(
|
|
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
|
-
|
|
60
|
-
class q {
|
|
23
|
+
class b {
|
|
61
24
|
// @ts-expect-error
|
|
62
|
-
constructor({ originator:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
this.originator =
|
|
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(
|
|
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(
|
|
83
|
+
answer(t) {
|
|
121
84
|
throw new Error("Method not implemented.");
|
|
122
85
|
}
|
|
123
|
-
terminate(
|
|
86
|
+
terminate(t) {
|
|
124
87
|
throw new Error("Method not implemented.");
|
|
125
88
|
}
|
|
126
|
-
async sendInfo(
|
|
89
|
+
async sendInfo(t, e, n) {
|
|
127
90
|
throw new Error("Method not implemented.");
|
|
128
91
|
}
|
|
129
|
-
hold(
|
|
92
|
+
hold(t, e) {
|
|
130
93
|
throw new Error("Method not implemented.");
|
|
131
94
|
}
|
|
132
|
-
unhold(
|
|
95
|
+
unhold(t, e) {
|
|
133
96
|
throw new Error("Method not implemented.");
|
|
134
97
|
}
|
|
135
|
-
async renegotiate(
|
|
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(
|
|
104
|
+
mute(t) {
|
|
142
105
|
throw new Error("Method not implemented.");
|
|
143
106
|
}
|
|
144
|
-
unmute(
|
|
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(
|
|
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(
|
|
119
|
+
async replaceMediaStream(t, e) {
|
|
157
120
|
throw new Error("Method not implemented.");
|
|
158
121
|
}
|
|
159
|
-
addListener(
|
|
122
|
+
addListener(t, e) {
|
|
160
123
|
throw new Error("Method not implemented.");
|
|
161
124
|
}
|
|
162
|
-
once(
|
|
125
|
+
once(t, e) {
|
|
163
126
|
throw new Error("Method not implemented.");
|
|
164
127
|
}
|
|
165
|
-
removeListener(
|
|
128
|
+
removeListener(t, e) {
|
|
166
129
|
throw new Error("Method not implemented.");
|
|
167
130
|
}
|
|
168
|
-
off(
|
|
131
|
+
off(t, e) {
|
|
169
132
|
throw new Error("Method not implemented.");
|
|
170
133
|
}
|
|
171
|
-
removeAllListeners(
|
|
134
|
+
removeAllListeners(t) {
|
|
172
135
|
throw new Error("Method not implemented.");
|
|
173
136
|
}
|
|
174
|
-
setMaxListeners(
|
|
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(
|
|
143
|
+
listeners(t) {
|
|
181
144
|
throw new Error("Method not implemented.");
|
|
182
145
|
}
|
|
183
|
-
rawListeners(
|
|
146
|
+
rawListeners(t) {
|
|
184
147
|
throw new Error("Method not implemented.");
|
|
185
148
|
}
|
|
186
|
-
emit(
|
|
149
|
+
emit(t, ...e) {
|
|
187
150
|
throw new Error("Method not implemented.");
|
|
188
151
|
}
|
|
189
|
-
listenerCount(
|
|
152
|
+
listenerCount(t) {
|
|
190
153
|
throw new Error("Method not implemented.");
|
|
191
154
|
}
|
|
192
|
-
prependListener(
|
|
155
|
+
prependListener(t, e) {
|
|
193
156
|
throw new Error("Method not implemented.");
|
|
194
157
|
}
|
|
195
|
-
prependOnceListener(
|
|
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(
|
|
209
|
-
Object.entries(
|
|
171
|
+
initEvents(t = []) {
|
|
172
|
+
Object.entries(t).forEach(([e, n]) => this.on(e, n));
|
|
210
173
|
}
|
|
211
174
|
// @ts-expect-error
|
|
212
|
-
on(
|
|
213
|
-
return this._events.on(
|
|
175
|
+
on(t, e) {
|
|
176
|
+
return this._events.on(t, e), this;
|
|
214
177
|
}
|
|
215
|
-
trigger(
|
|
216
|
-
this._events.trigger(
|
|
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(
|
|
229
|
-
return
|
|
191
|
+
async startPresentation(t) {
|
|
192
|
+
return t;
|
|
230
193
|
}
|
|
231
|
-
async updatePresentation(
|
|
232
|
-
return
|
|
194
|
+
async updatePresentation(t) {
|
|
195
|
+
return t;
|
|
233
196
|
}
|
|
234
|
-
async stopPresentation(
|
|
235
|
-
return
|
|
197
|
+
async stopPresentation(t) {
|
|
198
|
+
return t;
|
|
236
199
|
}
|
|
237
200
|
isEstablished() {
|
|
238
201
|
return !0;
|
|
239
202
|
}
|
|
240
203
|
}
|
|
241
|
-
class
|
|
242
|
-
constructor(
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
const
|
|
273
|
-
return this._senders.push(
|
|
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 =
|
|
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(
|
|
243
|
+
async addIceCandidate(t) {
|
|
281
244
|
throw new Error("Method not implemented.");
|
|
282
245
|
}
|
|
283
|
-
addTransceiver(
|
|
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(
|
|
255
|
+
async createAnswer(t, e) {
|
|
293
256
|
throw new Error("Method not implemented.");
|
|
294
257
|
}
|
|
295
|
-
createDataChannel(
|
|
258
|
+
createDataChannel(t, e) {
|
|
296
259
|
throw new Error("Method not implemented.");
|
|
297
260
|
}
|
|
298
|
-
async createOffer(
|
|
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(
|
|
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(
|
|
276
|
+
removeTrack(t) {
|
|
314
277
|
throw new Error("Method not implemented.");
|
|
315
278
|
}
|
|
316
|
-
setConfiguration(
|
|
279
|
+
setConfiguration(t) {
|
|
317
280
|
throw new Error("Method not implemented.");
|
|
318
281
|
}
|
|
319
|
-
async setLocalDescription(
|
|
282
|
+
async setLocalDescription(t) {
|
|
320
283
|
throw new Error("Method not implemented.");
|
|
321
284
|
}
|
|
322
|
-
async setRemoteDescription(
|
|
285
|
+
async setRemoteDescription(t) {
|
|
323
286
|
throw new Error("Method not implemented.");
|
|
324
287
|
}
|
|
325
|
-
addEventListener(
|
|
288
|
+
addEventListener(t, e, n) {
|
|
326
289
|
throw new Error("Method not implemented.");
|
|
327
290
|
}
|
|
328
|
-
removeEventListener(
|
|
291
|
+
removeEventListener(t, e, n) {
|
|
329
292
|
throw new Error("Method not implemented.");
|
|
330
293
|
}
|
|
331
|
-
dispatchEvent(
|
|
294
|
+
dispatchEvent(t) {
|
|
332
295
|
throw new Error("Method not implemented.");
|
|
333
296
|
}
|
|
334
297
|
}
|
|
335
|
-
function
|
|
336
|
-
const
|
|
337
|
-
if (!
|
|
298
|
+
function V(o) {
|
|
299
|
+
const t = o.match(/[\d.]+/g);
|
|
300
|
+
if (!t)
|
|
338
301
|
throw new Error("wrong sip url");
|
|
339
|
-
return
|
|
302
|
+
return t[0];
|
|
340
303
|
}
|
|
341
|
-
const
|
|
342
|
-
class
|
|
304
|
+
const m = 400, U = "777", x = (o) => o.getVideoTracks().length > 0;
|
|
305
|
+
class M extends b {
|
|
343
306
|
constructor({
|
|
344
|
-
url:
|
|
345
|
-
mediaStream:
|
|
346
|
-
eventHandlers:
|
|
347
|
-
originator:
|
|
307
|
+
url: e = "",
|
|
308
|
+
mediaStream: n,
|
|
309
|
+
eventHandlers: i,
|
|
310
|
+
originator: d
|
|
348
311
|
}) {
|
|
349
|
-
super({ originator:
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
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
|
-
|
|
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(
|
|
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
|
-
},
|
|
334
|
+
}, m);
|
|
372
335
|
}));
|
|
373
|
-
this.url =
|
|
374
|
-
}
|
|
375
|
-
initPeerconnection(
|
|
376
|
-
return
|
|
377
|
-
}
|
|
378
|
-
createPeerconnection(
|
|
379
|
-
const
|
|
380
|
-
|
|
381
|
-
const
|
|
382
|
-
if (
|
|
383
|
-
const
|
|
384
|
-
|
|
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
|
|
349
|
+
this._connection = new P(void 0, i), this._addStream(e), setTimeout(() => {
|
|
387
350
|
this.trigger("peerconnection", { peerconnection: this.connection });
|
|
388
|
-
},
|
|
351
|
+
}, m);
|
|
389
352
|
}
|
|
390
|
-
connect(
|
|
391
|
-
const
|
|
353
|
+
connect(e) {
|
|
354
|
+
const n = V(e);
|
|
392
355
|
setTimeout(() => {
|
|
393
|
-
this.url.includes(
|
|
356
|
+
this.url.includes(U) ? this.trigger("failed", {
|
|
394
357
|
originator: "remote",
|
|
395
358
|
message: "IncomingResponse",
|
|
396
|
-
cause:
|
|
359
|
+
cause: y
|
|
397
360
|
}) : (this.trigger("connecting"), setTimeout(() => {
|
|
398
|
-
this.trigger("enterRoom",
|
|
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
|
-
},
|
|
367
|
+
}, m);
|
|
405
368
|
}
|
|
406
|
-
terminate({ status_code:
|
|
407
|
-
return this.status_code =
|
|
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:
|
|
410
|
-
return this.status_code =
|
|
372
|
+
terminateRemote({ status_code: e } = {}) {
|
|
373
|
+
return this.status_code = e, this.trigger("ended", { status_code: e, originator: "remote" }), this;
|
|
411
374
|
}
|
|
412
|
-
_addStream(
|
|
413
|
-
|
|
375
|
+
_addStream(e, n = "getTracks") {
|
|
376
|
+
e[n]().forEach((i) => this.connection.addTrack(i));
|
|
414
377
|
}
|
|
415
|
-
_forEachSenders(
|
|
416
|
-
const
|
|
417
|
-
for (const
|
|
418
|
-
|
|
419
|
-
return
|
|
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(
|
|
423
|
-
this._forEachSenders(({ track:
|
|
424
|
-
|
|
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(
|
|
430
|
-
this._forEachSenders(({ track:
|
|
431
|
-
|
|
392
|
+
_toggleMuteVideo(e) {
|
|
393
|
+
this._forEachSenders(({ track: n }) => {
|
|
394
|
+
n && n.kind === "video" && (n.enabled = !e);
|
|
432
395
|
});
|
|
433
396
|
}
|
|
434
|
-
mute(
|
|
435
|
-
|
|
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(
|
|
438
|
-
|
|
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(
|
|
444
|
-
return
|
|
406
|
+
async replaceMediaStream(e) {
|
|
407
|
+
return e;
|
|
445
408
|
}
|
|
446
|
-
_onmute({ audio:
|
|
409
|
+
_onmute({ audio: e, video: n }) {
|
|
447
410
|
this.trigger("muted", {
|
|
448
|
-
audio:
|
|
449
|
-
video:
|
|
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(
|
|
458
|
-
this.trigger("newInfo",
|
|
420
|
+
newInfo(e) {
|
|
421
|
+
this.trigger("newInfo", e);
|
|
459
422
|
}
|
|
460
423
|
/* eslint-enable no-param-reassign */
|
|
461
424
|
}
|
|
462
|
-
class
|
|
425
|
+
class F {
|
|
463
426
|
constructor() {
|
|
464
|
-
|
|
427
|
+
r(this, "extraHeaders");
|
|
465
428
|
}
|
|
466
|
-
setExtraHeaders(
|
|
467
|
-
this.extraHeaders =
|
|
429
|
+
setExtraHeaders(t) {
|
|
430
|
+
this.extraHeaders = t;
|
|
468
431
|
}
|
|
469
432
|
setExtraContactParams() {
|
|
470
433
|
}
|
|
471
434
|
}
|
|
472
|
-
const
|
|
473
|
-
class
|
|
474
|
-
constructor(
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
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
|
-
|
|
485
|
-
const { mediaStream:
|
|
486
|
-
return this.session = new
|
|
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
|
|
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
|
-
},
|
|
469
|
+
}, a) : this.trigger("disconnected", { error: new Error("stoped") });
|
|
507
470
|
}
|
|
508
471
|
// @ts-expect-error
|
|
509
|
-
on(
|
|
510
|
-
return this._events.on(
|
|
472
|
+
on(t, e) {
|
|
473
|
+
return this._events.on(t, e), this;
|
|
511
474
|
}
|
|
512
|
-
trigger(
|
|
513
|
-
this._events.trigger(
|
|
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(
|
|
532
|
-
return this.configuration[
|
|
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:
|
|
542
|
-
|
|
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
|
-
},
|
|
507
|
+
}, a)) : !this._isRegistered && e && (t === s || t === w) ? (this._isRegistered = !0, this._startedTimeout = setTimeout(() => {
|
|
545
508
|
this.trigger("registered");
|
|
546
|
-
},
|
|
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
|
-
},
|
|
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(
|
|
578
|
-
this.trigger("sipEvent",
|
|
540
|
+
newSipEvent(t) {
|
|
541
|
+
this.trigger("sipEvent", t);
|
|
579
542
|
}
|
|
580
543
|
}
|
|
581
|
-
class
|
|
582
|
-
constructor(
|
|
583
|
-
|
|
584
|
-
this.url =
|
|
544
|
+
class q {
|
|
545
|
+
constructor(t) {
|
|
546
|
+
r(this, "url");
|
|
547
|
+
this.url = t;
|
|
585
548
|
}
|
|
586
549
|
}
|
|
587
|
-
class
|
|
588
|
-
constructor(
|
|
550
|
+
class $ extends N {
|
|
551
|
+
constructor(e, n) {
|
|
589
552
|
super();
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
this.contentType =
|
|
553
|
+
r(this, "contentType");
|
|
554
|
+
r(this, "body");
|
|
555
|
+
this.contentType = e, this.body = n;
|
|
593
556
|
}
|
|
594
557
|
}
|
|
595
|
-
const
|
|
596
|
-
const
|
|
597
|
-
originator:
|
|
598
|
-
request:
|
|
599
|
-
info: new
|
|
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
|
-
|
|
602
|
-
},
|
|
603
|
-
const
|
|
604
|
-
|
|
605
|
-
},
|
|
606
|
-
incomingNumber:
|
|
607
|
-
displayName:
|
|
608
|
-
host:
|
|
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
|
|
611
|
-
|
|
612
|
-
},
|
|
613
|
-
|
|
614
|
-
},
|
|
615
|
-
triggerNewInfo:
|
|
616
|
-
triggerNewSipEvent:
|
|
617
|
-
triggerIncomingSession:
|
|
618
|
-
triggerFailIncomingSession:
|
|
619
|
-
WebSocketInterface:
|
|
620
|
-
UA:
|
|
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
|
-
},
|
|
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:
|
|
627
|
-
sipWebSocketServerURL:
|
|
628
|
-
},
|
|
629
|
-
...
|
|
630
|
-
},
|
|
631
|
-
...
|
|
632
|
-
user:
|
|
633
|
-
password:
|
|
589
|
+
sipServerUrl: g,
|
|
590
|
+
sipWebSocketServerURL: v
|
|
591
|
+
}, ae = {
|
|
592
|
+
..._
|
|
593
|
+
}, G = {
|
|
594
|
+
..._,
|
|
595
|
+
user: l,
|
|
596
|
+
password: s,
|
|
634
597
|
register: !0
|
|
635
|
-
},
|
|
636
|
-
...
|
|
637
|
-
displayName:
|
|
638
|
-
},
|
|
639
|
-
...
|
|
640
|
-
displayName:
|
|
598
|
+
}, ce = {
|
|
599
|
+
...G,
|
|
600
|
+
displayName: c
|
|
601
|
+
}, he = {
|
|
602
|
+
..._,
|
|
603
|
+
displayName: c,
|
|
641
604
|
register: !1
|
|
642
|
-
},
|
|
605
|
+
}, h = {
|
|
643
606
|
session_timers: !1,
|
|
644
|
-
sockets: [
|
|
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
|
-
},
|
|
651
|
-
...
|
|
652
|
-
password:
|
|
653
|
-
uri: `sip:${
|
|
613
|
+
}, me = {
|
|
614
|
+
...h,
|
|
615
|
+
password: s,
|
|
616
|
+
uri: `sip:${l}@${g}`,
|
|
654
617
|
display_name: "",
|
|
655
618
|
register: !0
|
|
656
|
-
},
|
|
657
|
-
...
|
|
658
|
-
password:
|
|
659
|
-
uri: `sip:${
|
|
660
|
-
display_name:
|
|
619
|
+
}, ue = {
|
|
620
|
+
...h,
|
|
621
|
+
password: s,
|
|
622
|
+
uri: `sip:${l}@${g}`,
|
|
623
|
+
display_name: c,
|
|
661
624
|
register: !0
|
|
662
|
-
},
|
|
663
|
-
...
|
|
664
|
-
display_name:
|
|
625
|
+
}, le = {
|
|
626
|
+
...h,
|
|
627
|
+
display_name: c,
|
|
665
628
|
register: !1
|
|
666
|
-
},
|
|
667
|
-
...
|
|
629
|
+
}, ge = {
|
|
630
|
+
...h,
|
|
668
631
|
display_name: "",
|
|
669
632
|
register: !1
|
|
670
|
-
},
|
|
671
|
-
JsSIP:
|
|
633
|
+
}, X = "10.10.10.10", _e = [`X-Vinteo-Remote: ${X}`], pe = () => new A({
|
|
634
|
+
JsSIP: T
|
|
672
635
|
});
|
|
673
636
|
export {
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
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
|
};
|