sip-connector 7.0.2 → 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/{SipConnector-BbhXaowv.js → SipConnector-CxSB1Bmp.js} +2 -1
- package/dist/{SipConnector-jXZTwQ41.cjs → SipConnector-DxGNVRHG.cjs} +1 -1
- package/dist/SipConnector.d.ts +2 -2
- package/dist/__fixtures__/BaseSession.mock.d.ts +2 -2
- package/dist/__fixtures__/RTCPeerConnectionMock.d.ts +1 -1
- package/dist/__fixtures__/Session.mock.d.ts +1 -1
- package/dist/__fixtures__/UA.mock.d.ts +4 -4
- package/dist/__fixtures__/jssip.mock.d.ts +2 -2
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +298 -335
- package/dist/index.cjs +1 -1
- package/dist/index.js +345 -464
- package/dist/tools/connectToServer.d.ts +1 -1
- package/dist/tools/resolveOnUseLicense.d.ts +1 -1
- package/dist/videoSendingBalancer/balance.d.ts +1 -1
- package/dist/videoSendingBalancer/index.d.ts +1 -1
- package/dist/videoSendingBalancer/processSender.d.ts +1 -1
- package/package.json +17 -14
package/dist/doMock.js
CHANGED
|
@@ -1,70 +1,33 @@
|
|
|
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
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
15
|
-
this.headers = new Headers(
|
|
15
|
+
r(this, "headers");
|
|
16
|
+
this.headers = new Headers(e);
|
|
16
17
|
}
|
|
17
|
-
getHeader(
|
|
18
|
-
return this.headers.get(
|
|
18
|
+
getHeader(e) {
|
|
19
|
+
return this.headers.get(e) || "";
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
|
-
|
|
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:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
this.originator =
|
|
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(
|
|
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(
|
|
82
|
+
answer(t) {
|
|
120
83
|
throw new Error("Method not implemented.");
|
|
121
84
|
}
|
|
122
|
-
terminate(
|
|
85
|
+
terminate(t) {
|
|
123
86
|
throw new Error("Method not implemented.");
|
|
124
87
|
}
|
|
125
|
-
async sendInfo(
|
|
88
|
+
async sendInfo(t, e, n) {
|
|
126
89
|
throw new Error("Method not implemented.");
|
|
127
90
|
}
|
|
128
|
-
hold(
|
|
91
|
+
hold(t, e) {
|
|
129
92
|
throw new Error("Method not implemented.");
|
|
130
93
|
}
|
|
131
|
-
unhold(
|
|
94
|
+
unhold(t, e) {
|
|
132
95
|
throw new Error("Method not implemented.");
|
|
133
96
|
}
|
|
134
|
-
async renegotiate(
|
|
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(
|
|
103
|
+
mute(t) {
|
|
141
104
|
throw new Error("Method not implemented.");
|
|
142
105
|
}
|
|
143
|
-
unmute(
|
|
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(
|
|
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(
|
|
118
|
+
async replaceMediaStream(t, e) {
|
|
156
119
|
throw new Error("Method not implemented.");
|
|
157
120
|
}
|
|
158
|
-
addListener(
|
|
121
|
+
addListener(t, e) {
|
|
159
122
|
throw new Error("Method not implemented.");
|
|
160
123
|
}
|
|
161
|
-
once(
|
|
124
|
+
once(t, e) {
|
|
162
125
|
throw new Error("Method not implemented.");
|
|
163
126
|
}
|
|
164
|
-
removeListener(
|
|
127
|
+
removeListener(t, e) {
|
|
165
128
|
throw new Error("Method not implemented.");
|
|
166
129
|
}
|
|
167
|
-
off(
|
|
130
|
+
off(t, e) {
|
|
168
131
|
throw new Error("Method not implemented.");
|
|
169
132
|
}
|
|
170
|
-
removeAllListeners(
|
|
133
|
+
removeAllListeners(t) {
|
|
171
134
|
throw new Error("Method not implemented.");
|
|
172
135
|
}
|
|
173
|
-
setMaxListeners(
|
|
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(
|
|
142
|
+
listeners(t) {
|
|
180
143
|
throw new Error("Method not implemented.");
|
|
181
144
|
}
|
|
182
|
-
rawListeners(
|
|
145
|
+
rawListeners(t) {
|
|
183
146
|
throw new Error("Method not implemented.");
|
|
184
147
|
}
|
|
185
|
-
emit(
|
|
148
|
+
emit(t, ...e) {
|
|
186
149
|
throw new Error("Method not implemented.");
|
|
187
150
|
}
|
|
188
|
-
listenerCount(
|
|
151
|
+
listenerCount(t) {
|
|
189
152
|
throw new Error("Method not implemented.");
|
|
190
153
|
}
|
|
191
|
-
prependListener(
|
|
154
|
+
prependListener(t, e) {
|
|
192
155
|
throw new Error("Method not implemented.");
|
|
193
156
|
}
|
|
194
|
-
prependOnceListener(
|
|
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(
|
|
208
|
-
Object.entries(
|
|
170
|
+
initEvents(t = []) {
|
|
171
|
+
Object.entries(t).forEach(([e, n]) => this.on(e, n));
|
|
209
172
|
}
|
|
210
173
|
// @ts-expect-error
|
|
211
|
-
on(
|
|
212
|
-
return this._events.on(
|
|
174
|
+
on(t, e) {
|
|
175
|
+
return this._events.on(t, e), this;
|
|
213
176
|
}
|
|
214
|
-
trigger(
|
|
215
|
-
this._events.trigger(
|
|
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(
|
|
228
|
-
return
|
|
190
|
+
async startPresentation(t) {
|
|
191
|
+
return t;
|
|
229
192
|
}
|
|
230
|
-
async updatePresentation(
|
|
231
|
-
return
|
|
193
|
+
async updatePresentation(t) {
|
|
194
|
+
return t;
|
|
232
195
|
}
|
|
233
|
-
async stopPresentation(
|
|
234
|
-
return
|
|
196
|
+
async stopPresentation(t) {
|
|
197
|
+
return t;
|
|
235
198
|
}
|
|
236
199
|
isEstablished() {
|
|
237
200
|
return !0;
|
|
238
201
|
}
|
|
239
202
|
}
|
|
240
|
-
class
|
|
241
|
-
constructor(
|
|
242
|
-
|
|
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
|
-
const
|
|
272
|
-
return this._senders.push(
|
|
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 =
|
|
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(
|
|
242
|
+
async addIceCandidate(t) {
|
|
280
243
|
throw new Error("Method not implemented.");
|
|
281
244
|
}
|
|
282
|
-
addTransceiver(
|
|
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(
|
|
254
|
+
async createAnswer(t, e) {
|
|
292
255
|
throw new Error("Method not implemented.");
|
|
293
256
|
}
|
|
294
|
-
createDataChannel(
|
|
257
|
+
createDataChannel(t, e) {
|
|
295
258
|
throw new Error("Method not implemented.");
|
|
296
259
|
}
|
|
297
|
-
async createOffer(
|
|
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(
|
|
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(
|
|
275
|
+
removeTrack(t) {
|
|
313
276
|
throw new Error("Method not implemented.");
|
|
314
277
|
}
|
|
315
|
-
setConfiguration(
|
|
278
|
+
setConfiguration(t) {
|
|
316
279
|
throw new Error("Method not implemented.");
|
|
317
280
|
}
|
|
318
|
-
async setLocalDescription(
|
|
281
|
+
async setLocalDescription(t) {
|
|
319
282
|
throw new Error("Method not implemented.");
|
|
320
283
|
}
|
|
321
|
-
async setRemoteDescription(
|
|
284
|
+
async setRemoteDescription(t) {
|
|
322
285
|
throw new Error("Method not implemented.");
|
|
323
286
|
}
|
|
324
|
-
addEventListener(
|
|
287
|
+
addEventListener(t, e, n) {
|
|
325
288
|
throw new Error("Method not implemented.");
|
|
326
289
|
}
|
|
327
|
-
removeEventListener(
|
|
290
|
+
removeEventListener(t, e, n) {
|
|
328
291
|
throw new Error("Method not implemented.");
|
|
329
292
|
}
|
|
330
|
-
dispatchEvent(
|
|
293
|
+
dispatchEvent(t) {
|
|
331
294
|
throw new Error("Method not implemented.");
|
|
332
295
|
}
|
|
333
296
|
}
|
|
334
|
-
function
|
|
335
|
-
const
|
|
336
|
-
if (!
|
|
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
|
|
301
|
+
return t[0];
|
|
339
302
|
}
|
|
340
|
-
const
|
|
341
|
-
class
|
|
303
|
+
const u = 400, H = "777", z = (o) => o.getVideoTracks().length > 0;
|
|
304
|
+
class R extends U {
|
|
342
305
|
constructor({
|
|
343
|
-
url:
|
|
344
|
-
mediaStream:
|
|
345
|
-
eventHandlers:
|
|
346
|
-
originator:
|
|
306
|
+
url: e = "",
|
|
307
|
+
mediaStream: n,
|
|
308
|
+
eventHandlers: i,
|
|
309
|
+
originator: s
|
|
347
310
|
}) {
|
|
348
|
-
super({ originator:
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
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
|
-
|
|
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(
|
|
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
|
-
},
|
|
333
|
+
}, u);
|
|
371
334
|
}));
|
|
372
|
-
this.url =
|
|
373
|
-
}
|
|
374
|
-
initPeerconnection(
|
|
375
|
-
return
|
|
376
|
-
}
|
|
377
|
-
createPeerconnection(
|
|
378
|
-
const
|
|
379
|
-
|
|
380
|
-
const
|
|
381
|
-
if (
|
|
382
|
-
const
|
|
383
|
-
|
|
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
|
|
348
|
+
this._connection = new x(void 0, i), this._addStream(e), setTimeout(() => {
|
|
386
349
|
this.trigger("peerconnection", { peerconnection: this.connection });
|
|
387
|
-
},
|
|
350
|
+
}, u);
|
|
388
351
|
}
|
|
389
|
-
connect(
|
|
390
|
-
const
|
|
352
|
+
connect(e) {
|
|
353
|
+
const n = F(e);
|
|
391
354
|
setTimeout(() => {
|
|
392
|
-
this.url.includes(
|
|
355
|
+
this.url.includes(H) ? this.trigger("failed", {
|
|
393
356
|
originator: "remote",
|
|
394
357
|
message: "IncomingResponse",
|
|
395
|
-
cause:
|
|
358
|
+
cause: O
|
|
396
359
|
}) : (this.trigger("connecting"), setTimeout(() => {
|
|
397
|
-
this.trigger("enterRoom", { room:
|
|
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
|
-
},
|
|
366
|
+
}, u);
|
|
404
367
|
}
|
|
405
|
-
terminate({ status_code:
|
|
406
|
-
return this.status_code =
|
|
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:
|
|
409
|
-
return this.status_code =
|
|
371
|
+
terminateRemote({ status_code: e } = {}) {
|
|
372
|
+
return this.status_code = e, this.trigger("ended", { status_code: e, originator: "remote" }), this;
|
|
410
373
|
}
|
|
411
|
-
_addStream(
|
|
412
|
-
|
|
374
|
+
_addStream(e, n = "getTracks") {
|
|
375
|
+
e[n]().forEach((i) => this.connection.addTrack(i));
|
|
413
376
|
}
|
|
414
|
-
_forEachSenders(
|
|
415
|
-
const
|
|
416
|
-
for (const
|
|
417
|
-
|
|
418
|
-
return
|
|
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(
|
|
422
|
-
this._forEachSenders(({ track:
|
|
423
|
-
|
|
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(
|
|
429
|
-
this._forEachSenders(({ track:
|
|
430
|
-
|
|
391
|
+
_toggleMuteVideo(e) {
|
|
392
|
+
this._forEachSenders(({ track: n }) => {
|
|
393
|
+
n && n.kind === "video" && (n.enabled = !e);
|
|
431
394
|
});
|
|
432
395
|
}
|
|
433
|
-
mute(
|
|
434
|
-
|
|
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(
|
|
437
|
-
|
|
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(
|
|
443
|
-
return
|
|
405
|
+
async replaceMediaStream(e) {
|
|
406
|
+
return e;
|
|
444
407
|
}
|
|
445
|
-
_onmute({ audio:
|
|
408
|
+
_onmute({ audio: e, video: n }) {
|
|
446
409
|
this.trigger("muted", {
|
|
447
|
-
audio:
|
|
448
|
-
video:
|
|
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(
|
|
457
|
-
this.trigger("newInfo",
|
|
419
|
+
newInfo(e) {
|
|
420
|
+
this.trigger("newInfo", e);
|
|
458
421
|
}
|
|
459
422
|
/* eslint-enable no-param-reassign */
|
|
460
423
|
}
|
|
461
|
-
class
|
|
424
|
+
class q {
|
|
462
425
|
constructor() {
|
|
463
|
-
|
|
426
|
+
r(this, "extraHeaders");
|
|
464
427
|
}
|
|
465
|
-
setExtraHeaders(
|
|
466
|
-
this.extraHeaders =
|
|
428
|
+
setExtraHeaders(t) {
|
|
429
|
+
this.extraHeaders = t;
|
|
467
430
|
}
|
|
468
431
|
setExtraContactParams() {
|
|
469
432
|
}
|
|
470
433
|
}
|
|
471
|
-
const
|
|
472
|
-
constructor(
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
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
|
-
|
|
483
|
-
const { mediaStream:
|
|
484
|
-
return this.session = new
|
|
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
|
|
487
|
-
const [
|
|
488
|
-
...
|
|
489
|
-
uri: new
|
|
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 =
|
|
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(
|
|
519
|
-
return this._events.on(
|
|
481
|
+
on(t, e) {
|
|
482
|
+
return this._events.on(t, e), this;
|
|
520
483
|
}
|
|
521
484
|
// @ts-expect-error
|
|
522
|
-
once(
|
|
523
|
-
return this._events.once(
|
|
485
|
+
once(t, e) {
|
|
486
|
+
return this._events.once(t, e), this;
|
|
524
487
|
}
|
|
525
488
|
// @ts-expect-error
|
|
526
|
-
off(
|
|
527
|
-
return this._events.off(
|
|
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(
|
|
533
|
-
this._events.trigger(
|
|
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(
|
|
552
|
-
return this.configuration[
|
|
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:
|
|
562
|
-
|
|
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 &&
|
|
527
|
+
}, c)) : !this._isRegistered && e && (t === a || t === M) ? (this._isRegistered = !0, this._startedTimeout = setTimeout(() => {
|
|
565
528
|
this.trigger("registered");
|
|
566
|
-
}, c)) :
|
|
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)),
|
|
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(
|
|
598
|
-
this.trigger("sipEvent",
|
|
560
|
+
newSipEvent(t) {
|
|
561
|
+
this.trigger("sipEvent", t);
|
|
599
562
|
}
|
|
600
563
|
};
|
|
601
|
-
|
|
602
|
-
let
|
|
603
|
-
class
|
|
604
|
-
constructor(
|
|
605
|
-
|
|
606
|
-
this.url =
|
|
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
|
|
610
|
-
constructor(
|
|
572
|
+
class K extends L {
|
|
573
|
+
constructor(e, n) {
|
|
611
574
|
super();
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
this.contentType =
|
|
575
|
+
r(this, "contentType");
|
|
576
|
+
r(this, "body");
|
|
577
|
+
this.contentType = e, this.body = n;
|
|
615
578
|
}
|
|
616
579
|
}
|
|
617
|
-
const
|
|
618
|
-
const
|
|
619
|
-
originator:
|
|
620
|
-
request:
|
|
621
|
-
info: new
|
|
580
|
+
const _ = "remote", $ = (o, t) => {
|
|
581
|
+
const e = new T(t), n = {
|
|
582
|
+
originator: _,
|
|
583
|
+
request: e,
|
|
584
|
+
info: new K("", "")
|
|
622
585
|
};
|
|
623
|
-
|
|
624
|
-
},
|
|
625
|
-
const
|
|
626
|
-
|
|
627
|
-
},
|
|
628
|
-
incomingNumber:
|
|
629
|
-
displayName:
|
|
630
|
-
host:
|
|
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
|
|
633
|
-
|
|
634
|
-
},
|
|
635
|
-
|
|
636
|
-
},
|
|
637
|
-
triggerNewInfo:
|
|
638
|
-
triggerNewSipEvent:
|
|
639
|
-
triggerIncomingSession:
|
|
640
|
-
triggerFailIncomingSession:
|
|
641
|
-
WebSocketInterface:
|
|
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
|
-
},
|
|
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:
|
|
649
|
-
sipWebSocketServerURL:
|
|
650
|
-
},
|
|
651
|
-
...
|
|
652
|
-
},
|
|
653
|
-
...
|
|
654
|
-
user:
|
|
655
|
-
password:
|
|
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
|
-
},
|
|
658
|
-
...
|
|
659
|
-
displayName:
|
|
660
|
-
},
|
|
661
|
-
...
|
|
662
|
-
displayName:
|
|
620
|
+
}, he = {
|
|
621
|
+
...Q,
|
|
622
|
+
displayName: m
|
|
623
|
+
}, me = {
|
|
624
|
+
...f,
|
|
625
|
+
displayName: m,
|
|
663
626
|
register: !1
|
|
664
|
-
},
|
|
627
|
+
}, l = {
|
|
665
628
|
session_timers: !1,
|
|
666
|
-
sockets: [
|
|
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
|
-
},
|
|
673
|
-
...
|
|
674
|
-
password:
|
|
675
|
-
uri: new
|
|
635
|
+
}, le = {
|
|
636
|
+
...l,
|
|
637
|
+
password: a,
|
|
638
|
+
uri: new p("sip", w, E),
|
|
676
639
|
display_name: "",
|
|
677
640
|
register: !0
|
|
678
|
-
},
|
|
679
|
-
...
|
|
680
|
-
password:
|
|
681
|
-
uri: new
|
|
682
|
-
display_name:
|
|
641
|
+
}, ue = {
|
|
642
|
+
...l,
|
|
643
|
+
password: a,
|
|
644
|
+
uri: new p("sip", w, E),
|
|
645
|
+
display_name: m,
|
|
683
646
|
register: !0
|
|
684
|
-
},
|
|
685
|
-
...
|
|
686
|
-
display_name:
|
|
647
|
+
}, ge = {
|
|
648
|
+
...l,
|
|
649
|
+
display_name: m,
|
|
687
650
|
register: !1
|
|
688
|
-
},
|
|
689
|
-
...
|
|
651
|
+
}, _e = {
|
|
652
|
+
...l,
|
|
690
653
|
display_name: "",
|
|
691
654
|
register: !1
|
|
692
|
-
},
|
|
693
|
-
JsSIP:
|
|
655
|
+
}, Z = "10.10.10.10", pe = [`X-Vinteo-Remote: ${Z}`], we = () => new N({
|
|
656
|
+
JsSIP: S
|
|
694
657
|
});
|
|
695
658
|
export {
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
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
|
};
|