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