sip-connector 14.1.0 → 14.1.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/SipConnector-DRjfFGAZ.js +1339 -0
- package/dist/SipConnector-EXAO9Z-2.cjs +1 -0
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +399 -402
- package/dist/index.cjs +1 -1
- package/dist/index.js +499 -500
- package/dist/src/SipConnector.d.ts +235 -0
- package/dist/{SipConnectorFacade → src/SipConnectorFacade}/SipConnectorFacade.d.ts +7 -7
- package/dist/{__fixtures__ → src/__fixtures__}/BaseSession.mock.d.ts +22 -34
- package/dist/{__fixtures__ → src/__fixtures__}/RTCPeerConnectionMock.d.ts +15 -15
- package/dist/{__fixtures__ → src/__fixtures__}/RTCRtpSenderMock.d.ts +2 -2
- package/dist/{__fixtures__ → src/__fixtures__}/RTCSessionMock.d.ts +34 -38
- package/dist/{__fixtures__ → src/__fixtures__}/UA.mock.d.ts +25 -44
- package/dist/{__fixtures__ → src/__fixtures__}/channelsNotify.d.ts +2 -2
- package/dist/{__fixtures__ → src/__fixtures__}/jssip.mock.d.ts +1 -1
- package/dist/{__fixtures__ → src/__fixtures__}/participantNotify.d.ts +2 -2
- package/dist/{tools → src/tools}/index.d.ts +2 -2
- package/dist/{tools → src/tools}/sendDTMFAccumulated.d.ts +2 -2
- package/dist/{types.d.ts → src/types.d.ts} +2 -1
- package/dist/src/videoSendingBalancer/scaleBitrate.d.ts +2 -0
- package/package.json +30 -30
- package/dist/SipConnector-BPIL3yLc.js +0 -1343
- package/dist/SipConnector-BUbfMgHs.cjs +0 -1
- package/dist/SipConnector.d.ts +0 -315
- package/dist/utils.d.ts +0 -4
- package/dist/videoSendingBalancer/scaleBitrate.d.ts +0 -2
- /package/dist/{SipConnectorFacade → src/SipConnectorFacade}/index.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/Registrator.mock.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/Request.mock.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/WebSocketInterface.mock.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/accountNotify.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/channels.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/conferenceParticipantTokenIssuedNotify.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/delayPromise.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/enterRoom.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/index.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/mediaState.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/participantMoveRequests.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/remoteCallerData.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/utils.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/webcastNotify.d.ts +0 -0
- /package/dist/{causes.d.ts → src/causes.d.ts} +0 -0
- /package/dist/{constants.d.ts → src/constants.d.ts} +0 -0
- /package/dist/{doMock.d.ts → src/doMock.d.ts} +0 -0
- /package/dist/{eventNames.d.ts → src/eventNames.d.ts} +0 -0
- /package/dist/{getExtraHeadersRemoteAddress.d.ts → src/getExtraHeadersRemoteAddress.d.ts} +0 -0
- /package/dist/{headers.d.ts → src/headers.d.ts} +0 -0
- /package/dist/{index.d.ts → src/index.d.ts} +0 -0
- /package/dist/{logger.d.ts → src/logger.d.ts} +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/configureDegradationPreference.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/configureEmptyEncodings.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/configureEncodings.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/configureMaxBitrate.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/configureScaleResolutionDownBy.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/hasChangedRTCRtpSendParameters.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/index.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/resolveHasNeedToUpdateItemEncoding.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/setParametersToSender.d.ts +0 -0
- /package/dist/{tools → src/tools}/__fixtures__/call.d.ts +0 -0
- /package/dist/{tools → src/tools}/__fixtures__/connectToServer.d.ts +0 -0
- /package/dist/{tools → src/tools}/__fixtures__/hasValidUri.d.ts +0 -0
- /package/dist/{tools → src/tools}/__fixtures__/permissions.d.ts +0 -0
- /package/dist/{tools → src/tools}/__fixtures__/processRequest.d.ts +0 -0
- /package/dist/{tools → src/tools}/__tests-utils__/parseObject.d.ts +0 -0
- /package/dist/{tools → src/tools}/__tests-utils__/resolveParseArray.d.ts +0 -0
- /package/dist/{tools → src/tools}/error/getLinkError.d.ts +0 -0
- /package/dist/{tools → src/tools}/error/getTypeFromError.d.ts +0 -0
- /package/dist/{tools → src/tools}/error/getValuesFromError.d.ts +0 -0
- /package/dist/{tools → src/tools}/error/index.d.ts +0 -0
- /package/dist/{tools → src/tools}/error/stringifyMessage.d.ts +0 -0
- /package/dist/{tools → src/tools}/generateSimulcastEncodings.d.ts +0 -0
- /package/dist/{tools → src/tools}/getExtraHeaders.d.ts +0 -0
- /package/dist/{tools → src/tools}/getUserAgent.d.ts +0 -0
- /package/dist/{tools → src/tools}/hasPurgatory.d.ts +0 -0
- /package/dist/{tools → src/tools}/prepareMediaStream.d.ts +0 -0
- /package/dist/{tools → src/tools}/resolveUpdateTransceiver.d.ts +0 -0
- /package/dist/{tools → src/tools}/setVideoTrackContentHints.d.ts +0 -0
- /package/dist/{tools → src/tools}/syncMediaState/index.d.ts +0 -0
- /package/dist/{tools → src/tools}/syncMediaState/resolveOnStartMainCam.d.ts +0 -0
- /package/dist/{tools → src/tools}/syncMediaState/resolveOnStartMic.d.ts +0 -0
- /package/dist/{tools → src/tools}/syncMediaState/resolveOnStopMainCam.d.ts +0 -0
- /package/dist/{tools → src/tools}/syncMediaState/resolveOnStopMic.d.ts +0 -0
- /package/dist/{utils → src/utils}/errors.d.ts +0 -0
- /package/dist/{utils → src/utils}/findSenderByStream.d.ts +0 -0
- /package/dist/{utils → src/utils}/findVideoSender.d.ts +0 -0
- /package/dist/{utils → src/utils}/findVideoTrack.d.ts +0 -0
- /package/dist/{utils → src/utils}/getCodecFromSender.d.ts +0 -0
- /package/dist/{utils → src/utils}/replaceForbiddenSymbolsWithUnderscore.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/balance.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/getMaxBitrateByWidth.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/getMaxBitrateByWidthAndCodec.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/hasAv1Codec.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/hasIncludesString.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/index.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/processSender.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/scaleBitrateByCodec.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/scaleResolutionAndBitrate.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/setEncodingsToSender.d.ts +0 -0
package/dist/doMock.js
CHANGED
|
@@ -1,73 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import { URI as E } from "@krivega/jssip";
|
|
12
|
-
class I extends W {
|
|
1
|
+
import { o as N, R as P, U as O, S as k } from "./SipConnector-DRjfFGAZ.js";
|
|
2
|
+
import A from "@krivega/jssip/lib/NameAddrHeader";
|
|
3
|
+
import b from "@krivega/jssip/lib/URI";
|
|
4
|
+
import { EventEmitter as D } from "node:events";
|
|
5
|
+
import { IncomingRequest as L } from "@krivega/jssip/lib/SIPMessage";
|
|
6
|
+
import { createAudioMediaStreamTrackMock as W, createVideoMediaStreamTrackMock as V } from "webrtc-mock";
|
|
7
|
+
import R from "events-constructor";
|
|
8
|
+
import { URI as w, C as I } from "@krivega/jssip";
|
|
9
|
+
class E extends L {
|
|
10
|
+
headers;
|
|
13
11
|
constructor(e) {
|
|
14
|
-
super();
|
|
15
|
-
r(this, "headers");
|
|
16
|
-
this.headers = new Headers(e);
|
|
12
|
+
super(), this.headers = new Headers(e);
|
|
17
13
|
}
|
|
18
14
|
getHeader(e) {
|
|
19
|
-
return this.headers.get(e)
|
|
15
|
+
return this.headers.get(e) ?? "";
|
|
20
16
|
}
|
|
21
17
|
}
|
|
22
|
-
class
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
class F {
|
|
19
|
+
originator;
|
|
20
|
+
connection;
|
|
21
|
+
events;
|
|
22
|
+
remote_identity;
|
|
23
|
+
mutedOptions = { audio: !1, video: !1 };
|
|
24
|
+
constructor({
|
|
25
|
+
originator: e = "local",
|
|
26
|
+
eventHandlers: t
|
|
27
|
+
}) {
|
|
28
|
+
this.originator = e, this.events = new R(N), this.initEvents(t);
|
|
31
29
|
}
|
|
32
|
-
|
|
33
|
-
get C() {
|
|
30
|
+
get contact() {
|
|
34
31
|
throw new Error("Method not implemented.");
|
|
35
32
|
}
|
|
36
|
-
|
|
37
|
-
get causes() {
|
|
33
|
+
get direction() {
|
|
38
34
|
throw new Error("Method not implemented.");
|
|
39
35
|
}
|
|
40
|
-
get
|
|
36
|
+
get local_identity() {
|
|
41
37
|
throw new Error("Method not implemented.");
|
|
42
38
|
}
|
|
43
|
-
|
|
39
|
+
get start_time() {
|
|
44
40
|
throw new Error("Method not implemented.");
|
|
45
41
|
}
|
|
46
|
-
get
|
|
42
|
+
get end_time() {
|
|
47
43
|
throw new Error("Method not implemented.");
|
|
48
44
|
}
|
|
49
|
-
get
|
|
50
|
-
return this._connection;
|
|
51
|
-
}
|
|
52
|
-
get contact() {
|
|
45
|
+
get status() {
|
|
53
46
|
throw new Error("Method not implemented.");
|
|
54
47
|
}
|
|
55
|
-
|
|
48
|
+
// @ts-expect-error
|
|
49
|
+
get C() {
|
|
56
50
|
throw new Error("Method not implemented.");
|
|
57
51
|
}
|
|
58
|
-
|
|
52
|
+
// @ts-expect-error
|
|
53
|
+
get causes() {
|
|
59
54
|
throw new Error("Method not implemented.");
|
|
60
55
|
}
|
|
61
|
-
get
|
|
62
|
-
return this._remote_identity;
|
|
63
|
-
}
|
|
64
|
-
get start_time() {
|
|
56
|
+
get id() {
|
|
65
57
|
throw new Error("Method not implemented.");
|
|
66
58
|
}
|
|
67
|
-
get
|
|
59
|
+
get data() {
|
|
68
60
|
throw new Error("Method not implemented.");
|
|
69
61
|
}
|
|
70
|
-
|
|
62
|
+
set data(e) {
|
|
71
63
|
throw new Error("Method not implemented.");
|
|
72
64
|
}
|
|
73
65
|
isInProgress() {
|
|
@@ -79,104 +71,97 @@ class x {
|
|
|
79
71
|
isReadyToReOffer() {
|
|
80
72
|
throw new Error("Method not implemented.");
|
|
81
73
|
}
|
|
82
|
-
answer(
|
|
74
|
+
answer(e) {
|
|
83
75
|
throw new Error("Method not implemented.");
|
|
84
76
|
}
|
|
85
|
-
terminate(
|
|
77
|
+
terminate(e) {
|
|
86
78
|
throw new Error("Method not implemented.");
|
|
87
79
|
}
|
|
88
|
-
async sendInfo(
|
|
80
|
+
async sendInfo(e, t, r) {
|
|
89
81
|
throw new Error("Method not implemented.");
|
|
90
82
|
}
|
|
91
|
-
hold(
|
|
83
|
+
hold(e, t) {
|
|
92
84
|
throw new Error("Method not implemented.");
|
|
93
85
|
}
|
|
94
|
-
unhold(
|
|
86
|
+
unhold(e, t) {
|
|
95
87
|
throw new Error("Method not implemented.");
|
|
96
88
|
}
|
|
97
|
-
async renegotiate(
|
|
89
|
+
async renegotiate(e, t) {
|
|
98
90
|
throw new Error("Method not implemented.");
|
|
99
91
|
}
|
|
100
92
|
isOnHold() {
|
|
101
93
|
throw new Error("Method not implemented.");
|
|
102
94
|
}
|
|
103
|
-
mute(
|
|
95
|
+
mute(e) {
|
|
104
96
|
throw new Error("Method not implemented.");
|
|
105
97
|
}
|
|
106
|
-
unmute(
|
|
98
|
+
unmute(e) {
|
|
107
99
|
throw new Error("Method not implemented.");
|
|
108
100
|
}
|
|
109
101
|
isMuted() {
|
|
110
102
|
throw new Error("Method not implemented.");
|
|
111
103
|
}
|
|
112
|
-
refer(
|
|
104
|
+
refer(e, t) {
|
|
113
105
|
throw new Error("Method not implemented.");
|
|
114
106
|
}
|
|
115
107
|
resetLocalMedia() {
|
|
116
108
|
throw new Error("Method not implemented.");
|
|
117
109
|
}
|
|
118
|
-
async replaceMediaStream(
|
|
110
|
+
async replaceMediaStream(e, t) {
|
|
119
111
|
throw new Error("Method not implemented.");
|
|
120
112
|
}
|
|
121
|
-
addListener(
|
|
113
|
+
addListener(e, t) {
|
|
122
114
|
throw new Error("Method not implemented.");
|
|
123
115
|
}
|
|
124
|
-
once(
|
|
116
|
+
once(e, t) {
|
|
125
117
|
throw new Error("Method not implemented.");
|
|
126
118
|
}
|
|
127
|
-
removeListener(
|
|
119
|
+
removeListener(e, t) {
|
|
128
120
|
throw new Error("Method not implemented.");
|
|
129
121
|
}
|
|
130
|
-
off(
|
|
122
|
+
off(e, t) {
|
|
131
123
|
throw new Error("Method not implemented.");
|
|
132
124
|
}
|
|
133
|
-
removeAllListeners(
|
|
125
|
+
removeAllListeners(e) {
|
|
134
126
|
throw new Error("Method not implemented.");
|
|
135
127
|
}
|
|
136
|
-
setMaxListeners(
|
|
128
|
+
setMaxListeners(e) {
|
|
137
129
|
throw new Error("Method not implemented.");
|
|
138
130
|
}
|
|
139
131
|
getMaxListeners() {
|
|
140
132
|
throw new Error("Method not implemented.");
|
|
141
133
|
}
|
|
142
|
-
listeners(
|
|
134
|
+
listeners(e) {
|
|
143
135
|
throw new Error("Method not implemented.");
|
|
144
136
|
}
|
|
145
|
-
rawListeners(
|
|
137
|
+
rawListeners(e) {
|
|
146
138
|
throw new Error("Method not implemented.");
|
|
147
139
|
}
|
|
148
|
-
emit(
|
|
140
|
+
emit(e, ...t) {
|
|
149
141
|
throw new Error("Method not implemented.");
|
|
150
142
|
}
|
|
151
|
-
listenerCount(
|
|
143
|
+
listenerCount(e) {
|
|
152
144
|
throw new Error("Method not implemented.");
|
|
153
145
|
}
|
|
154
|
-
prependListener(
|
|
146
|
+
prependListener(e, t) {
|
|
155
147
|
throw new Error("Method not implemented.");
|
|
156
148
|
}
|
|
157
|
-
prependOnceListener(
|
|
149
|
+
prependOnceListener(e, t) {
|
|
158
150
|
throw new Error("Method not implemented.");
|
|
159
151
|
}
|
|
160
152
|
eventNames() {
|
|
161
153
|
throw new Error("Method not implemented.");
|
|
162
154
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
*
|
|
166
|
-
* @param {Array} [eventHandlers=[] - ] The event handlers
|
|
167
|
-
*
|
|
168
|
-
* @returns {undefined}
|
|
169
|
-
*/
|
|
170
|
-
initEvents(t = []) {
|
|
171
|
-
Object.entries(t).forEach(([e, n]) => this.on(e, n));
|
|
155
|
+
initEvents(e) {
|
|
156
|
+
Object.entries(e).forEach(([t, r]) => this.on(t, r));
|
|
172
157
|
}
|
|
173
158
|
// @ts-expect-error
|
|
174
159
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
175
|
-
on(
|
|
176
|
-
return this.
|
|
160
|
+
on(e, t) {
|
|
161
|
+
return this.events.on(e, t), this;
|
|
177
162
|
}
|
|
178
|
-
trigger(
|
|
179
|
-
this.
|
|
163
|
+
trigger(e, t) {
|
|
164
|
+
this.events.trigger(e, t);
|
|
180
165
|
}
|
|
181
166
|
/**
|
|
182
167
|
* sendDTMF
|
|
@@ -188,103 +173,101 @@ class x {
|
|
|
188
173
|
sendDTMF() {
|
|
189
174
|
this.trigger("newDTMF", { originator: this.originator });
|
|
190
175
|
}
|
|
191
|
-
async startPresentation(
|
|
192
|
-
return
|
|
176
|
+
async startPresentation(e) {
|
|
177
|
+
return e;
|
|
193
178
|
}
|
|
194
|
-
async updatePresentation(
|
|
195
|
-
return
|
|
179
|
+
async updatePresentation(e) {
|
|
180
|
+
return e;
|
|
196
181
|
}
|
|
197
|
-
async stopPresentation(
|
|
198
|
-
return
|
|
182
|
+
async stopPresentation(e) {
|
|
183
|
+
return e;
|
|
199
184
|
}
|
|
200
185
|
isEstablished() {
|
|
201
186
|
return !0;
|
|
202
187
|
}
|
|
203
188
|
}
|
|
204
|
-
class
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
this.track =
|
|
189
|
+
class x {
|
|
190
|
+
dtmf = null;
|
|
191
|
+
track = null;
|
|
192
|
+
transport = null;
|
|
193
|
+
transform = null;
|
|
194
|
+
parameters = {
|
|
195
|
+
encodings: [{}],
|
|
196
|
+
transactionId: "0",
|
|
197
|
+
codecs: [],
|
|
198
|
+
headerExtensions: [],
|
|
199
|
+
rtcp: {}
|
|
200
|
+
};
|
|
201
|
+
parametersGets;
|
|
202
|
+
constructor({ track: e } = {}) {
|
|
203
|
+
this.track = e ?? null;
|
|
219
204
|
}
|
|
205
|
+
// eslint-disable-next-line class-methods-use-this
|
|
220
206
|
async getStats() {
|
|
221
207
|
throw new Error("Method not implemented.");
|
|
222
208
|
}
|
|
223
|
-
async replaceTrack(
|
|
224
|
-
this.track =
|
|
209
|
+
async replaceTrack(e) {
|
|
210
|
+
this.track = e ?? null;
|
|
225
211
|
}
|
|
226
|
-
async setParameters(
|
|
227
|
-
if (
|
|
212
|
+
async setParameters(e) {
|
|
213
|
+
if (e !== this.parametersGets)
|
|
228
214
|
throw new Error(
|
|
229
215
|
"Failed to execute 'setParameters' on 'RTCRtpSender': Read-only field modified in setParameters()."
|
|
230
216
|
);
|
|
231
|
-
const { transactionId:
|
|
232
|
-
this.
|
|
233
|
-
...this.
|
|
234
|
-
...
|
|
235
|
-
transactionId: `${Number(
|
|
217
|
+
const { transactionId: t } = this.parameters;
|
|
218
|
+
this.parameters = {
|
|
219
|
+
...this.parameters,
|
|
220
|
+
...e,
|
|
221
|
+
transactionId: `${Number(t) + 1}`
|
|
236
222
|
};
|
|
237
223
|
}
|
|
238
224
|
getParameters() {
|
|
239
|
-
return this.
|
|
225
|
+
return this.parametersGets = { ...this.parameters }, this.parametersGets;
|
|
240
226
|
}
|
|
227
|
+
// eslint-disable-next-line class-methods-use-this
|
|
241
228
|
setStreams() {
|
|
242
229
|
throw new Error("Method not implemented.");
|
|
243
230
|
}
|
|
244
231
|
}
|
|
245
|
-
class
|
|
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
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
const e = new U({ track: t });
|
|
277
|
-
return this._senders.push(e), e;
|
|
278
|
-
});
|
|
279
|
-
this._receivers = e.map((n) => ({ track: n }));
|
|
232
|
+
class U {
|
|
233
|
+
senders = [];
|
|
234
|
+
receivers = [];
|
|
235
|
+
canTrickleIceCandidates;
|
|
236
|
+
connectionState;
|
|
237
|
+
currentLocalDescription;
|
|
238
|
+
currentRemoteDescription;
|
|
239
|
+
iceConnectionState;
|
|
240
|
+
iceGatheringState;
|
|
241
|
+
idpErrorInfo;
|
|
242
|
+
idpLoginUrl;
|
|
243
|
+
localDescription;
|
|
244
|
+
onconnectionstatechange;
|
|
245
|
+
ondatachannel;
|
|
246
|
+
onicecandidate;
|
|
247
|
+
// eslint-disable-next-line unicorn/no-null
|
|
248
|
+
onicecandidateerror = null;
|
|
249
|
+
oniceconnectionstatechange;
|
|
250
|
+
onicegatheringstatechange;
|
|
251
|
+
onnegotiationneeded;
|
|
252
|
+
onsignalingstatechange;
|
|
253
|
+
ontrack;
|
|
254
|
+
peerIdentity = void 0;
|
|
255
|
+
pendingLocalDescription;
|
|
256
|
+
pendingRemoteDescription;
|
|
257
|
+
remoteDescription;
|
|
258
|
+
// eslint-disable-next-line unicorn/no-null
|
|
259
|
+
sctp = null;
|
|
260
|
+
signalingState;
|
|
261
|
+
constructor(e, t) {
|
|
262
|
+
this.receivers = t.map((r) => ({ track: r }));
|
|
280
263
|
}
|
|
281
264
|
getRemoteStreams() {
|
|
282
265
|
throw new Error("Method not implemented.");
|
|
283
266
|
}
|
|
284
|
-
async addIceCandidate(
|
|
267
|
+
async addIceCandidate(e) {
|
|
285
268
|
throw new Error("Method not implemented.");
|
|
286
269
|
}
|
|
287
|
-
addTransceiver(
|
|
270
|
+
addTransceiver(e, t) {
|
|
288
271
|
throw new Error("Method not implemented.");
|
|
289
272
|
}
|
|
290
273
|
close() {
|
|
@@ -293,13 +276,13 @@ class H {
|
|
|
293
276
|
restartIce() {
|
|
294
277
|
throw new Error("Method not implemented.");
|
|
295
278
|
}
|
|
296
|
-
async createAnswer(
|
|
279
|
+
async createAnswer(e, t) {
|
|
297
280
|
throw new Error("Method not implemented.");
|
|
298
281
|
}
|
|
299
|
-
createDataChannel(
|
|
282
|
+
createDataChannel(e, t) {
|
|
300
283
|
throw new Error("Method not implemented.");
|
|
301
284
|
}
|
|
302
|
-
async createOffer(
|
|
285
|
+
async createOffer(e, t, r) {
|
|
303
286
|
throw new Error("Method not implemented.");
|
|
304
287
|
}
|
|
305
288
|
getConfiguration() {
|
|
@@ -308,210 +291,237 @@ class H {
|
|
|
308
291
|
async getIdentityAssertion() {
|
|
309
292
|
throw new Error("Method not implemented.");
|
|
310
293
|
}
|
|
311
|
-
async getStats(
|
|
294
|
+
async getStats(e) {
|
|
312
295
|
throw new Error("Method not implemented.");
|
|
313
296
|
}
|
|
314
297
|
getTransceivers() {
|
|
315
298
|
throw new Error("Method not implemented.");
|
|
316
299
|
}
|
|
317
|
-
removeTrack(
|
|
300
|
+
removeTrack(e) {
|
|
318
301
|
throw new Error("Method not implemented.");
|
|
319
302
|
}
|
|
320
|
-
setConfiguration(
|
|
303
|
+
setConfiguration(e) {
|
|
321
304
|
throw new Error("Method not implemented.");
|
|
322
305
|
}
|
|
323
|
-
async setLocalDescription(
|
|
306
|
+
async setLocalDescription(e) {
|
|
324
307
|
throw new Error("Method not implemented.");
|
|
325
308
|
}
|
|
326
|
-
async setRemoteDescription(
|
|
309
|
+
async setRemoteDescription(e) {
|
|
327
310
|
throw new Error("Method not implemented.");
|
|
328
311
|
}
|
|
329
|
-
addEventListener(
|
|
312
|
+
addEventListener(e, t, r) {
|
|
330
313
|
throw new Error("Method not implemented.");
|
|
331
314
|
}
|
|
332
|
-
removeEventListener(
|
|
315
|
+
removeEventListener(e, t, r) {
|
|
333
316
|
throw new Error("Method not implemented.");
|
|
334
317
|
}
|
|
335
|
-
dispatchEvent(
|
|
318
|
+
dispatchEvent(e) {
|
|
336
319
|
throw new Error("Method not implemented.");
|
|
337
320
|
}
|
|
321
|
+
getReceivers = () => this.receivers;
|
|
322
|
+
getSenders = () => this.senders;
|
|
323
|
+
addTrack = (e) => {
|
|
324
|
+
const t = new x({ track: e });
|
|
325
|
+
return this.senders.push(t), t;
|
|
326
|
+
};
|
|
338
327
|
}
|
|
339
|
-
function
|
|
340
|
-
const
|
|
341
|
-
if (!
|
|
328
|
+
function H(n) {
|
|
329
|
+
const e = n.match(/(purgatory)|[\d.]+/g);
|
|
330
|
+
if (!e)
|
|
342
331
|
throw new Error("wrong sip url");
|
|
343
|
-
return
|
|
332
|
+
return e[0];
|
|
344
333
|
}
|
|
345
|
-
const
|
|
334
|
+
const l = 400, z = "777", Y = (n) => n.getVideoTracks().length > 0;
|
|
335
|
+
class s extends F {
|
|
336
|
+
static startPresentationError;
|
|
337
|
+
static countStartPresentationError = Number.POSITIVE_INFINITY;
|
|
338
|
+
static countStartsPresentation = 0;
|
|
339
|
+
url;
|
|
340
|
+
status_code;
|
|
341
|
+
/**
|
|
342
|
+
* answer
|
|
343
|
+
*
|
|
344
|
+
* @param {Object} arg1 - The argument 1
|
|
345
|
+
* @param {Object} arg1.mediaStream - The media stream
|
|
346
|
+
* @param {Array} arg1.eventHandlers - The event handlers
|
|
347
|
+
|
|
348
|
+
* @returns {undefined}
|
|
349
|
+
*/
|
|
350
|
+
answer = jest.fn(({ mediaStream: e }) => {
|
|
351
|
+
if (this.originator !== "remote")
|
|
352
|
+
throw new Error("answer available only for remote sessions");
|
|
353
|
+
this.initPeerconnection(e), setTimeout(() => {
|
|
354
|
+
this.trigger("connecting"), setTimeout(() => {
|
|
355
|
+
this.trigger("accepted");
|
|
356
|
+
}, 100), setTimeout(() => {
|
|
357
|
+
this.trigger("confirmed");
|
|
358
|
+
}, 200);
|
|
359
|
+
}, l);
|
|
360
|
+
});
|
|
361
|
+
isEndedInner = !1;
|
|
346
362
|
constructor({
|
|
347
363
|
url: e = "",
|
|
348
|
-
mediaStream:
|
|
349
|
-
eventHandlers:
|
|
350
|
-
originator:
|
|
364
|
+
mediaStream: t,
|
|
365
|
+
eventHandlers: r,
|
|
366
|
+
originator: o
|
|
351
367
|
}) {
|
|
352
|
-
super({ originator:
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* answer
|
|
358
|
-
*
|
|
359
|
-
* @param {Object} arg1 - The argument 1
|
|
360
|
-
* @param {Object} arg1.mediaStream - The media stream
|
|
361
|
-
* @param {Array} arg1.eventHandlers - The event handlers
|
|
362
|
-
|
|
363
|
-
* @returns {undefined}
|
|
364
|
-
*/
|
|
365
|
-
r(this, "answer", jest.fn(({ mediaStream: e }) => {
|
|
366
|
-
if (this.originator !== "remote")
|
|
367
|
-
throw new Error("answer available only for remote sessions");
|
|
368
|
-
this.initPeerconnection(e), setTimeout(() => {
|
|
369
|
-
this.trigger("connecting"), setTimeout(() => {
|
|
370
|
-
this.trigger("accepted");
|
|
371
|
-
}, 100), setTimeout(() => {
|
|
372
|
-
this.trigger("confirmed");
|
|
373
|
-
}, 200);
|
|
374
|
-
}, p);
|
|
375
|
-
}));
|
|
376
|
-
this.url = e, this.initPeerconnection(n);
|
|
377
|
-
}
|
|
378
|
-
static setStartPresentationError(e, { count: n = Number.POSITIVE_INFINITY } = {}) {
|
|
379
|
-
this.startPresentationError = e, this.countStartPresentationError = n;
|
|
368
|
+
super({ originator: o, eventHandlers: r }), this.url = e, this.initPeerconnection(t);
|
|
369
|
+
}
|
|
370
|
+
static setStartPresentationError(e, { count: t = Number.POSITIVE_INFINITY } = {}) {
|
|
371
|
+
this.startPresentationError = e, this.countStartPresentationError = t;
|
|
380
372
|
}
|
|
381
373
|
static resetStartPresentationError() {
|
|
382
374
|
this.startPresentationError = void 0, this.countStartPresentationError = Number.POSITIVE_INFINITY, this.countStartsPresentation = 0;
|
|
383
375
|
}
|
|
384
376
|
async startPresentation(e) {
|
|
385
|
-
if (
|
|
386
|
-
throw
|
|
377
|
+
if (s.countStartsPresentation += 1, s.startPresentationError && s.countStartsPresentation < s.countStartPresentationError)
|
|
378
|
+
throw s.startPresentationError;
|
|
387
379
|
return super.startPresentation(e);
|
|
388
380
|
}
|
|
389
381
|
initPeerconnection(e) {
|
|
390
382
|
return e ? (this.createPeerconnection(e), !0) : !1;
|
|
391
383
|
}
|
|
392
384
|
createPeerconnection(e) {
|
|
393
|
-
const
|
|
394
|
-
|
|
395
|
-
const
|
|
396
|
-
if (
|
|
397
|
-
const
|
|
398
|
-
|
|
385
|
+
const t = W();
|
|
386
|
+
t.id = "mainaudio1";
|
|
387
|
+
const r = [t];
|
|
388
|
+
if (Y(e)) {
|
|
389
|
+
const a = V();
|
|
390
|
+
a.id = "mainvideo1", r.push(a);
|
|
399
391
|
}
|
|
400
|
-
this.
|
|
392
|
+
this.connection = new U(void 0, r), this.addStream(e), setTimeout(() => {
|
|
401
393
|
this.trigger("peerconnection", { peerconnection: this.connection });
|
|
402
|
-
},
|
|
394
|
+
}, l);
|
|
403
395
|
}
|
|
404
396
|
connect(e) {
|
|
405
|
-
const
|
|
397
|
+
const t = H(e);
|
|
406
398
|
setTimeout(() => {
|
|
407
|
-
this.url.includes(
|
|
399
|
+
this.url.includes(z) ? this.trigger("failed", {
|
|
408
400
|
originator: "remote",
|
|
409
401
|
message: "IncomingResponse",
|
|
410
|
-
cause:
|
|
402
|
+
cause: P
|
|
411
403
|
}) : (this.trigger("connecting"), setTimeout(() => {
|
|
412
|
-
this.trigger("enterRoom", { room:
|
|
404
|
+
this.trigger("enterRoom", { room: t });
|
|
413
405
|
}, 100), setTimeout(() => {
|
|
414
406
|
this.trigger("accepted");
|
|
415
407
|
}, 200), setTimeout(() => {
|
|
416
408
|
this.trigger("confirmed");
|
|
417
409
|
}, 300));
|
|
418
|
-
},
|
|
410
|
+
}, l);
|
|
419
411
|
}
|
|
420
|
-
terminate({ status_code: e } = {}) {
|
|
421
|
-
return this.status_code = e, this.trigger("ended", { status_code: e }), this.
|
|
412
|
+
terminate({ status_code: e, cause: t } = {}) {
|
|
413
|
+
return this.status_code = e, this.trigger("ended", { status_code: e, cause: t, originator: "local" }), this.isEndedInner = !1, this;
|
|
422
414
|
}
|
|
423
|
-
async terminateAsync({
|
|
424
|
-
|
|
415
|
+
async terminateAsync({
|
|
416
|
+
status_code: e,
|
|
417
|
+
cause: t
|
|
418
|
+
} = {}) {
|
|
419
|
+
this.terminate({ status_code: e, cause: t });
|
|
425
420
|
}
|
|
426
421
|
terminateRemote({ status_code: e } = {}) {
|
|
427
422
|
return this.status_code = e, this.trigger("ended", { status_code: e, originator: "remote" }), this;
|
|
428
423
|
}
|
|
429
|
-
|
|
430
|
-
e[
|
|
424
|
+
addStream(e, t = "getTracks") {
|
|
425
|
+
e[t]().forEach((r) => this.connection.addTrack(r));
|
|
431
426
|
}
|
|
432
|
-
|
|
433
|
-
const
|
|
434
|
-
for (const
|
|
435
|
-
e(
|
|
436
|
-
return
|
|
427
|
+
forEachSenders(e) {
|
|
428
|
+
const t = this.connection.getSenders();
|
|
429
|
+
for (const r of t)
|
|
430
|
+
e(r);
|
|
431
|
+
return t;
|
|
437
432
|
}
|
|
438
433
|
/* eslint-disable no-param-reassign */
|
|
439
|
-
|
|
440
|
-
this.
|
|
441
|
-
|
|
434
|
+
toggleMuteAudio(e) {
|
|
435
|
+
this.forEachSenders(({ track: t }) => {
|
|
436
|
+
t && t.kind === "audio" && (t.enabled = !e);
|
|
442
437
|
});
|
|
443
438
|
}
|
|
444
439
|
/* eslint-enable no-param-reassign */
|
|
445
440
|
/* eslint-disable no-param-reassign */
|
|
446
|
-
|
|
447
|
-
this.
|
|
448
|
-
|
|
441
|
+
toggleMuteVideo(e) {
|
|
442
|
+
this.forEachSenders(({ track: t }) => {
|
|
443
|
+
t && t.kind === "video" && (t.enabled = !e);
|
|
449
444
|
});
|
|
450
445
|
}
|
|
451
446
|
mute(e) {
|
|
452
|
-
e.audio && (this.
|
|
447
|
+
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);
|
|
453
448
|
}
|
|
454
449
|
unmute(e) {
|
|
455
|
-
e.audio && (this.
|
|
450
|
+
e.audio && (this.mutedOptions.audio = !1), e.video && (this.mutedOptions.video = !1), this.trigger("unmuted", e);
|
|
456
451
|
}
|
|
457
452
|
isMuted() {
|
|
458
|
-
return this.
|
|
453
|
+
return this.mutedOptions;
|
|
459
454
|
}
|
|
455
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function, class-methods-use-this
|
|
460
456
|
async replaceMediaStream(e) {
|
|
461
|
-
return e;
|
|
462
457
|
}
|
|
463
|
-
|
|
458
|
+
onmute({ audio: e, video: t }) {
|
|
464
459
|
this.trigger("muted", {
|
|
465
460
|
audio: e,
|
|
466
|
-
video:
|
|
461
|
+
video: t
|
|
467
462
|
});
|
|
468
463
|
}
|
|
464
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function, class-methods-use-this
|
|
469
465
|
async sendInfo() {
|
|
470
466
|
}
|
|
471
467
|
isEnded() {
|
|
472
|
-
return this.
|
|
468
|
+
return this.isEndedInner;
|
|
473
469
|
}
|
|
474
470
|
newInfo(e) {
|
|
475
471
|
this.trigger("newInfo", e);
|
|
476
472
|
}
|
|
477
473
|
/* eslint-enable no-param-reassign */
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
r(this, "extraHeaders", []);
|
|
484
|
-
}
|
|
485
|
-
setExtraHeaders(t) {
|
|
486
|
-
this.extraHeaders = t;
|
|
474
|
+
}
|
|
475
|
+
class q {
|
|
476
|
+
extraHeaders = [];
|
|
477
|
+
setExtraHeaders(e) {
|
|
478
|
+
this.extraHeaders = e;
|
|
487
479
|
}
|
|
480
|
+
// eslint-disable-next-line class-methods-use-this
|
|
488
481
|
setExtraContactParams() {
|
|
489
482
|
}
|
|
490
483
|
}
|
|
491
|
-
const
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
484
|
+
const d = "PASSWORD_CORRECT", M = "PASSWORD_CORRECT_2", G = "NAME_INCORRECT", c = 400, p = {
|
|
485
|
+
url: "wss://sipServerUrl/webrtc/wss/",
|
|
486
|
+
sip_uri: "sip:sipServerUrl;transport=ws",
|
|
487
|
+
via_transport: "WSS"
|
|
488
|
+
}, v = {
|
|
489
|
+
status_code: 200,
|
|
490
|
+
reason_phrase: "OK"
|
|
491
|
+
}, T = {
|
|
492
|
+
status_code: 401,
|
|
493
|
+
reason_phrase: "Unauthorized"
|
|
494
|
+
};
|
|
495
|
+
class i {
|
|
496
|
+
static isAvailableTelephony = !0;
|
|
497
|
+
static startError;
|
|
498
|
+
static countStartError = Number.POSITIVE_INFINITY;
|
|
499
|
+
static countStarts = 0;
|
|
500
|
+
events;
|
|
501
|
+
registratorInner;
|
|
502
|
+
// @ts-expect-error
|
|
503
|
+
call = jest.fn(
|
|
504
|
+
(e, t) => {
|
|
505
|
+
const { mediaStream: r, eventHandlers: o } = t;
|
|
506
|
+
return this.session = new s({ url: e, mediaStream: r, eventHandlers: o, originator: "local" }), this.session.connect(e), this.session;
|
|
507
|
+
}
|
|
508
|
+
);
|
|
509
|
+
startedTimeout;
|
|
510
|
+
stopedTimeout;
|
|
511
|
+
session;
|
|
512
|
+
isRegisteredInner;
|
|
513
|
+
isConnectedInner;
|
|
514
|
+
configuration;
|
|
515
|
+
constructor(e) {
|
|
516
|
+
this.events = new R(O);
|
|
517
|
+
const [t, r] = e.uri.split(":"), [o, a] = r.split("@"), u = {
|
|
518
|
+
...e,
|
|
519
|
+
uri: new w(t, o, a)
|
|
510
520
|
};
|
|
511
|
-
this.configuration =
|
|
521
|
+
this.configuration = u, this.registratorInner = new q();
|
|
512
522
|
}
|
|
513
|
-
static setStartError(
|
|
514
|
-
this.startError =
|
|
523
|
+
static setStartError(e, { count: t = Number.POSITIVE_INFINITY } = {}) {
|
|
524
|
+
this.startError = e, this.countStartError = t;
|
|
515
525
|
}
|
|
516
526
|
static resetStartError() {
|
|
517
527
|
this.startError = void 0, this.countStartError = Number.POSITIVE_INFINITY, this.countStarts = 0;
|
|
@@ -522,17 +532,14 @@ const c = "PASSWORD_CORRECT", T = "PASSWORD_CORRECT_2", j = "NAME_INCORRECT", m
|
|
|
522
532
|
static setNotAvailableTelephony() {
|
|
523
533
|
this.isAvailableTelephony = !1;
|
|
524
534
|
}
|
|
525
|
-
isConnected() {
|
|
526
|
-
return !!this._isConnected;
|
|
527
|
-
}
|
|
528
535
|
/**
|
|
529
536
|
* start
|
|
530
537
|
*
|
|
531
538
|
* @returns {undefined}
|
|
532
539
|
*/
|
|
533
540
|
start() {
|
|
534
|
-
if (
|
|
535
|
-
this.trigger("disconnected",
|
|
541
|
+
if (i.countStarts += 1, i.startError && i.countStarts < i.countStartError) {
|
|
542
|
+
this.trigger("disconnected", i.startError);
|
|
536
543
|
return;
|
|
537
544
|
}
|
|
538
545
|
this.register();
|
|
@@ -543,27 +550,24 @@ const c = "PASSWORD_CORRECT", T = "PASSWORD_CORRECT_2", j = "NAME_INCORRECT", m
|
|
|
543
550
|
* @returns {undefined}
|
|
544
551
|
*/
|
|
545
552
|
stop() {
|
|
546
|
-
this.
|
|
547
|
-
this.trigger("disconnected", { error:
|
|
548
|
-
},
|
|
553
|
+
this.startedTimeout && clearTimeout(this.startedTimeout), this.stopedTimeout && clearTimeout(this.stopedTimeout), this.unregister(), this.isStarted() ? this.stopedTimeout = setTimeout(() => {
|
|
554
|
+
this.trigger("disconnected", { error: !0, socket: p });
|
|
555
|
+
}, c) : this.trigger("disconnected", { error: !0, socket: p });
|
|
549
556
|
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
return this._events.on(t, e), this;
|
|
557
|
+
on(e, t) {
|
|
558
|
+
return this.events.on(e, t), this;
|
|
553
559
|
}
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
return this._events.once(t, e), this;
|
|
560
|
+
once(e, t) {
|
|
561
|
+
return this.events.once(e, t), this;
|
|
557
562
|
}
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
return this._events.off(t, e), this;
|
|
563
|
+
off(e, t) {
|
|
564
|
+
return this.events.off(e, t), this;
|
|
561
565
|
}
|
|
562
566
|
removeAllListeners() {
|
|
563
|
-
return this.
|
|
567
|
+
return this.events.removeEventHandlers(), this;
|
|
564
568
|
}
|
|
565
|
-
trigger(
|
|
566
|
-
this.
|
|
569
|
+
trigger(e, t) {
|
|
570
|
+
this.events.trigger(e, t);
|
|
567
571
|
}
|
|
568
572
|
/**
|
|
569
573
|
* terminateSessions
|
|
@@ -571,18 +575,10 @@ const c = "PASSWORD_CORRECT", T = "PASSWORD_CORRECT_2", j = "NAME_INCORRECT", m
|
|
|
571
575
|
* @returns {undefined}
|
|
572
576
|
*/
|
|
573
577
|
terminateSessions() {
|
|
574
|
-
this.session
|
|
578
|
+
this.session?.terminate();
|
|
575
579
|
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
*
|
|
579
|
-
* @param {string} key - key
|
|
580
|
-
* @param {string} value - value
|
|
581
|
-
*
|
|
582
|
-
* @returns {boolean} true
|
|
583
|
-
*/
|
|
584
|
-
set(t, e) {
|
|
585
|
-
return this.configuration[t] = e, !0;
|
|
580
|
+
set(e, t) {
|
|
581
|
+
return this.configuration[e] = t, !0;
|
|
586
582
|
}
|
|
587
583
|
/**
|
|
588
584
|
* register
|
|
@@ -590,15 +586,15 @@ const c = "PASSWORD_CORRECT", T = "PASSWORD_CORRECT_2", j = "NAME_INCORRECT", m
|
|
|
590
586
|
* @returns {undefined}
|
|
591
587
|
*/
|
|
592
588
|
register() {
|
|
593
|
-
this.
|
|
594
|
-
const { password:
|
|
595
|
-
|
|
596
|
-
this.trigger("registrationFailed", { response:
|
|
597
|
-
},
|
|
598
|
-
this.trigger("registered");
|
|
599
|
-
},
|
|
600
|
-
this.trigger("registrationFailed", { response:
|
|
601
|
-
},
|
|
589
|
+
this.startedTimeout && clearTimeout(this.startedTimeout);
|
|
590
|
+
const { password: e, register: t, uri: r } = this.configuration;
|
|
591
|
+
t === !0 && r.user.includes(G) ? (this.isRegisteredInner = !1, this.isConnectedInner = !1, this.startedTimeout = setTimeout(() => {
|
|
592
|
+
this.trigger("registrationFailed", { response: T, cause: I.causes.REJECTED });
|
|
593
|
+
}, c)) : !this.isRegistered() && t === !0 && (e === d || e === M) ? (this.isRegisteredInner = !0, this.startedTimeout = setTimeout(() => {
|
|
594
|
+
this.trigger("registered", { response: v });
|
|
595
|
+
}, c)) : t === !0 && e !== d && e !== M && (this.isRegisteredInner = !1, this.isConnectedInner = !1, this.startedTimeout = setTimeout(() => {
|
|
596
|
+
this.trigger("registrationFailed", { response: T, cause: I.causes.REJECTED });
|
|
597
|
+
}, c)), i.isAvailableTelephony ? (this.trigger("connected", { socket: p }), this.isConnectedInner = !0) : this.stop();
|
|
602
598
|
}
|
|
603
599
|
/**
|
|
604
600
|
* unregister
|
|
@@ -606,15 +602,13 @@ const c = "PASSWORD_CORRECT", T = "PASSWORD_CORRECT_2", j = "NAME_INCORRECT", m
|
|
|
606
602
|
* @returns {undefined}
|
|
607
603
|
*/
|
|
608
604
|
unregister() {
|
|
609
|
-
this.
|
|
605
|
+
this.isRegisteredInner = !1, this.isConnectedInner = !1, this.trigger("unregistered", { response: v });
|
|
610
606
|
}
|
|
611
|
-
/**
|
|
612
|
-
* isRegistered
|
|
613
|
-
*
|
|
614
|
-
* @returns {boolean} isRegistered
|
|
615
|
-
*/
|
|
616
607
|
isRegistered() {
|
|
617
|
-
return
|
|
608
|
+
return this.isRegisteredInner === !0;
|
|
609
|
+
}
|
|
610
|
+
isConnected() {
|
|
611
|
+
return this.isConnectedInner === !0;
|
|
618
612
|
}
|
|
619
613
|
/**
|
|
620
614
|
* isStarted
|
|
@@ -622,127 +616,130 @@ const c = "PASSWORD_CORRECT", T = "PASSWORD_CORRECT_2", j = "NAME_INCORRECT", m
|
|
|
622
616
|
* @returns {boolean} isStarted
|
|
623
617
|
*/
|
|
624
618
|
isStarted() {
|
|
625
|
-
return this.configuration
|
|
619
|
+
return this.configuration.register === !0 && this.isRegisteredInner === !0 || this.configuration.register !== !0 && this.isConnectedInner === !0;
|
|
626
620
|
}
|
|
627
|
-
|
|
628
|
-
|
|
621
|
+
newSipEvent(e) {
|
|
622
|
+
this.trigger("sipEvent", e);
|
|
629
623
|
}
|
|
630
|
-
|
|
631
|
-
this.
|
|
624
|
+
registrator() {
|
|
625
|
+
return this.registratorInner;
|
|
632
626
|
}
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
r(this, "url");
|
|
639
|
-
this.url = t;
|
|
627
|
+
}
|
|
628
|
+
class J {
|
|
629
|
+
url;
|
|
630
|
+
constructor(e) {
|
|
631
|
+
this.url = e;
|
|
640
632
|
}
|
|
641
633
|
}
|
|
642
|
-
class $ extends
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
this.contentType = e, this.body = n;
|
|
634
|
+
class $ extends D {
|
|
635
|
+
contentType;
|
|
636
|
+
body;
|
|
637
|
+
constructor(e, t) {
|
|
638
|
+
super(), this.contentType = e, this.body = t;
|
|
648
639
|
}
|
|
649
640
|
}
|
|
650
|
-
const
|
|
651
|
-
const
|
|
652
|
-
originator:
|
|
653
|
-
request:
|
|
641
|
+
const g = "remote", j = (n, e) => {
|
|
642
|
+
const t = new E(e), r = {
|
|
643
|
+
originator: g,
|
|
644
|
+
request: t,
|
|
654
645
|
info: new $("", "")
|
|
655
646
|
};
|
|
656
|
-
|
|
657
|
-
},
|
|
658
|
-
const
|
|
659
|
-
|
|
660
|
-
},
|
|
661
|
-
incomingNumber:
|
|
662
|
-
displayName:
|
|
663
|
-
host:
|
|
647
|
+
n.newInfo(r);
|
|
648
|
+
}, B = (n, e) => {
|
|
649
|
+
const r = { event: "sipEvent", request: new E(e) };
|
|
650
|
+
n.newSipEvent(r);
|
|
651
|
+
}, K = (n, {
|
|
652
|
+
incomingNumber: e = "1234",
|
|
653
|
+
displayName: t,
|
|
654
|
+
host: r
|
|
664
655
|
}) => {
|
|
665
|
-
const
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
656
|
+
const o = new s({ originator: g, eventHandlers: {} }), a = new b("sip", e, r);
|
|
657
|
+
o.remote_identity = new A(a, t);
|
|
658
|
+
const u = new E([]);
|
|
659
|
+
n.trigger("newRTCSession", {
|
|
660
|
+
originator: g,
|
|
661
|
+
session: o,
|
|
662
|
+
request: u
|
|
663
|
+
});
|
|
664
|
+
}, X = (n, e) => {
|
|
665
|
+
e ? n.trigger("failed", e) : n.trigger("failed", n);
|
|
666
|
+
}, C = {
|
|
667
|
+
triggerNewInfo: j,
|
|
668
|
+
triggerNewSipEvent: B,
|
|
669
|
+
triggerIncomingSession: K,
|
|
670
|
+
triggerFailIncomingSession: X,
|
|
671
|
+
WebSocketInterface: J,
|
|
672
|
+
UA: i,
|
|
676
673
|
C: {
|
|
677
674
|
INVITE: "INVITE"
|
|
678
675
|
}
|
|
679
|
-
}, f = "user",
|
|
676
|
+
}, f = "user", h = "displayName", _ = "SIP_SERVER_URL", y = "SIP_WEB_SOCKET_SERVER_URL", Q = new C.WebSocketInterface(y), S = {
|
|
680
677
|
userAgent: "Chrome",
|
|
681
|
-
sipServerUrl:
|
|
682
|
-
sipWebSocketServerURL:
|
|
683
|
-
},
|
|
684
|
-
...
|
|
685
|
-
},
|
|
686
|
-
...
|
|
678
|
+
sipServerUrl: _,
|
|
679
|
+
sipWebSocketServerURL: y
|
|
680
|
+
}, ce = {
|
|
681
|
+
...S
|
|
682
|
+
}, Z = {
|
|
683
|
+
...S,
|
|
687
684
|
user: f,
|
|
688
|
-
password:
|
|
685
|
+
password: d,
|
|
689
686
|
register: !0
|
|
690
|
-
},
|
|
691
|
-
...
|
|
692
|
-
displayName:
|
|
693
|
-
},
|
|
694
|
-
...
|
|
695
|
-
displayName:
|
|
687
|
+
}, he = {
|
|
688
|
+
...Z,
|
|
689
|
+
displayName: h
|
|
690
|
+
}, me = {
|
|
691
|
+
...S,
|
|
692
|
+
displayName: h,
|
|
696
693
|
register: !1
|
|
697
|
-
},
|
|
694
|
+
}, m = {
|
|
698
695
|
session_timers: !1,
|
|
699
|
-
sockets: [
|
|
696
|
+
sockets: [Q],
|
|
700
697
|
user_agent: "Chrome",
|
|
701
698
|
sdp_semantics: "unified-plan",
|
|
702
699
|
register_expires: 300,
|
|
703
700
|
connection_recovery_max_interval: 6,
|
|
704
701
|
connection_recovery_min_interval: 2
|
|
705
|
-
},
|
|
706
|
-
...
|
|
707
|
-
password:
|
|
708
|
-
uri: new
|
|
702
|
+
}, ue = {
|
|
703
|
+
...m,
|
|
704
|
+
password: d,
|
|
705
|
+
uri: new w("sip", f, _),
|
|
709
706
|
display_name: "",
|
|
710
707
|
register: !0
|
|
711
|
-
},
|
|
712
|
-
...
|
|
713
|
-
password:
|
|
714
|
-
uri: new
|
|
715
|
-
display_name:
|
|
708
|
+
}, le = {
|
|
709
|
+
...m,
|
|
710
|
+
password: d,
|
|
711
|
+
uri: new w("sip", f, _),
|
|
712
|
+
display_name: h,
|
|
716
713
|
register: !0
|
|
717
|
-
},
|
|
718
|
-
...
|
|
719
|
-
display_name:
|
|
714
|
+
}, pe = {
|
|
715
|
+
...m,
|
|
716
|
+
display_name: h,
|
|
720
717
|
register: !1
|
|
721
|
-
},
|
|
722
|
-
...
|
|
718
|
+
}, ge = {
|
|
719
|
+
...m,
|
|
723
720
|
display_name: "",
|
|
724
721
|
register: !1
|
|
725
|
-
},
|
|
726
|
-
JsSIP:
|
|
722
|
+
}, ee = "10.10.10.10", we = [`X-Vinteo-Remote: ${ee}`], Ee = () => new k({
|
|
723
|
+
JsSIP: C
|
|
727
724
|
});
|
|
728
725
|
export {
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
726
|
+
z as FAILED_CONFERENCE_NUMBER,
|
|
727
|
+
G as NAME_INCORRECT,
|
|
728
|
+
d as PASSWORD_CORRECT,
|
|
729
|
+
M as PASSWORD_CORRECT_2,
|
|
730
|
+
_ as SIP_SERVER_URL,
|
|
731
|
+
y as SIP_WEB_SOCKET_SERVER_URL,
|
|
732
|
+
Z as dataForConnectionWithAuthorization,
|
|
733
|
+
he as dataForConnectionWithAuthorizationWithDisplayName,
|
|
734
|
+
me as dataForConnectionWithoutAuthorization,
|
|
735
|
+
ce as dataForConnectionWithoutAuthorizationWithoutDisplayName,
|
|
736
|
+
h as displayName,
|
|
737
|
+
Ee as doMockSipConnector,
|
|
738
|
+
we as extraHeadersRemoteAddress,
|
|
739
|
+
ee as remoteAddress,
|
|
740
|
+
ue as uaConfigurationWithAuthorization,
|
|
741
|
+
le as uaConfigurationWithAuthorizationWithDisplayName,
|
|
742
|
+
pe as uaConfigurationWithoutAuthorization,
|
|
743
|
+
ge as uaConfigurationWithoutAuthorizationWithoutDisplayName,
|
|
747
744
|
f as user
|
|
748
745
|
};
|