sip-connector 19.1.0 → 19.2.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-BOCUgqab.js → @SipConnector-Cr5Qu1ds.js} +137 -136
- package/dist/@SipConnector-Cx-er9n6.cjs +1 -0
- package/dist/AutoConnectorManager/eventNames.d.ts +12 -8
- package/dist/ConnectionManager/@ConnectionManager.d.ts +7 -8
- package/dist/ConnectionManager/ConnectionFlow.d.ts +2 -3
- package/dist/ConnectionManager/ConnectionStateMachine.d.ts +2 -3
- package/dist/ConnectionManager/RegistrationManager.d.ts +4 -5
- package/dist/ConnectionManager/eventNames.d.ts +27 -4
- package/dist/SipConnector/eventNames.d.ts +1 -1
- package/dist/__fixtures__/RTCSessionMock.d.ts +4 -1
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +100 -97
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/@SipConnector-CQnPH_xV.cjs +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Events as
|
|
1
|
+
import { Events as k, TypedEvents as U } from "events-constructor";
|
|
2
2
|
import x from "debug";
|
|
3
|
-
import { CancelableRequest as G, isCanceledError as
|
|
4
|
-
import { resolveRequesterByTimeout as
|
|
3
|
+
import { CancelableRequest as G, isCanceledError as _e } from "@krivega/cancelable-promise";
|
|
4
|
+
import { resolveRequesterByTimeout as me, requesterByTimeoutsWithFailCalls as Me, DelayRequester as ve, hasCanceledError as fe, SetTimeoutRequest as Z } from "@krivega/timeout-requester";
|
|
5
5
|
import { hasCanceledError as Pe, repeatedCallsAsync as ee } from "repeated-calls";
|
|
6
|
-
import { setup as Oe, createActor as
|
|
7
|
-
import { createStackPromises as te, isPromiseIsNotActualError as
|
|
6
|
+
import { setup as Oe, createActor as ye } from "xstate";
|
|
7
|
+
import { createStackPromises as te, isPromiseIsNotActualError as De } from "stack-promises";
|
|
8
8
|
import "ua-parser-js";
|
|
9
9
|
import "sequent-promises";
|
|
10
10
|
const Q = "sip-connector", d = x(Q), Wn = () => {
|
|
@@ -12,7 +12,7 @@ const Q = "sip-connector", d = x(Q), Wn = () => {
|
|
|
12
12
|
}, Hn = () => {
|
|
13
13
|
x.enable(`-${Q}`);
|
|
14
14
|
}, be = "Error decline with 603", we = 1006, Ue = (n) => typeof n == "object" && n !== null && "code" in n && n.code === we, Le = (n) => n.message === be;
|
|
15
|
-
var l = /* @__PURE__ */ ((n) => (n.CONTENT_TYPE = "content-type", n.CONTENT_ENTER_ROOM = "x-webrtc-enter-room", n.CONTENT_USE_LICENSE = "X-WEBRTC-USE-LICENSE", n.PARTICIPANT_NAME = "X-WEBRTC-PARTICIPANT-NAME", n.INPUT_CHANNELS = "X-WEBRTC-INPUT-CHANNELS", n.OUTPUT_CHANNELS = "X-WEBRTC-OUTPUT-CHANNELS", n.MAIN_CAM = "X-WEBRTC-MAINCAM", n.MIC = "X-WEBRTC-MIC", n.MEDIA_SYNC = "X-WEBRTC-SYNC", n.MAIN_CAM_RESOLUTION = "X-WEBRTC-MAINCAM-RESOLUTION", n.MEDIA_STATE = "X-WEBRTC-MEDIA-STATE", n.MEDIA_TYPE = "X-Vinteo-Media-Type", n.MAIN_CAM_STATE = "X-Vinteo-MainCam-State", n.MIC_STATE = "X-Vinteo-Mic-State", n.CONTENT_PARTICIPANT_STATE = "X-WEBRTC-PARTSTATE", n.NOTIFY = "X-VINTEO-NOTIFY", n.CONTENT_ENABLE_MEDIA_DEVICE = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", n.CONTENT_SHARE_STATE = "x-webrtc-share-state", n.MUST_STOP_PRESENTATION_P2P = "x-webrtc-share-state: YOUMUSTSTOPSENDCONTENT", n.START_PRESENTATION_P2P = "x-webrtc-share-state: YOUCANRECEIVECONTENT", n.STOP_PRESENTATION_P2P = "x-webrtc-share-state: CONTENTEND", n.STOP_PRESENTATION = "x-webrtc-share-state: STOPPRESENTATION", n.START_PRESENTATION = "x-webrtc-share-state: LETMESTARTPRESENTATION", n.ENABLE_MAIN_CAM = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE: LETMESTARTMAINCAM", n.AVAILABLE_INCOMING_BITRATE = "X-WEBRTC-AVAILABLE-INCOMING-BITRATE", n.AUDIO_TRACK_COUNT = "X-WEBRTC-AUDIO-TRACK-COUNT", n.VIDEO_TRACK_COUNT = "X-WEBRTC-VIDEO-TRACK-COUNT", n.TRACKS_DIRECTION = "X-WEBRTC-TRACKS-DIRECTION", n))(l || {}), B = /* @__PURE__ */ ((n) => (n.AVAILABLE_SECOND_REMOTE_STREAM = "YOUCANRECEIVECONTENT", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "CONTENTEND", n.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", n))(B || {}), q = /* @__PURE__ */ ((n) => (n.SPECTATOR = "SPECTATOR", n.PARTICIPANT = "PARTICIPANT", n))(q || {}),
|
|
15
|
+
var l = /* @__PURE__ */ ((n) => (n.CONTENT_TYPE = "content-type", n.CONTENT_ENTER_ROOM = "x-webrtc-enter-room", n.CONTENT_USE_LICENSE = "X-WEBRTC-USE-LICENSE", n.PARTICIPANT_NAME = "X-WEBRTC-PARTICIPANT-NAME", n.INPUT_CHANNELS = "X-WEBRTC-INPUT-CHANNELS", n.OUTPUT_CHANNELS = "X-WEBRTC-OUTPUT-CHANNELS", n.MAIN_CAM = "X-WEBRTC-MAINCAM", n.MIC = "X-WEBRTC-MIC", n.MEDIA_SYNC = "X-WEBRTC-SYNC", n.MAIN_CAM_RESOLUTION = "X-WEBRTC-MAINCAM-RESOLUTION", n.MEDIA_STATE = "X-WEBRTC-MEDIA-STATE", n.MEDIA_TYPE = "X-Vinteo-Media-Type", n.MAIN_CAM_STATE = "X-Vinteo-MainCam-State", n.MIC_STATE = "X-Vinteo-Mic-State", n.CONTENT_PARTICIPANT_STATE = "X-WEBRTC-PARTSTATE", n.NOTIFY = "X-VINTEO-NOTIFY", n.CONTENT_ENABLE_MEDIA_DEVICE = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", n.CONTENT_SHARE_STATE = "x-webrtc-share-state", n.MUST_STOP_PRESENTATION_P2P = "x-webrtc-share-state: YOUMUSTSTOPSENDCONTENT", n.START_PRESENTATION_P2P = "x-webrtc-share-state: YOUCANRECEIVECONTENT", n.STOP_PRESENTATION_P2P = "x-webrtc-share-state: CONTENTEND", n.STOP_PRESENTATION = "x-webrtc-share-state: STOPPRESENTATION", n.START_PRESENTATION = "x-webrtc-share-state: LETMESTARTPRESENTATION", n.ENABLE_MAIN_CAM = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE: LETMESTARTMAINCAM", n.AVAILABLE_INCOMING_BITRATE = "X-WEBRTC-AVAILABLE-INCOMING-BITRATE", n.AUDIO_TRACK_COUNT = "X-WEBRTC-AUDIO-TRACK-COUNT", n.VIDEO_TRACK_COUNT = "X-WEBRTC-VIDEO-TRACK-COUNT", n.TRACKS_DIRECTION = "X-WEBRTC-TRACKS-DIRECTION", n))(l || {}), B = /* @__PURE__ */ ((n) => (n.AVAILABLE_SECOND_REMOTE_STREAM = "YOUCANRECEIVECONTENT", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "CONTENTEND", n.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", n))(B || {}), q = /* @__PURE__ */ ((n) => (n.SPECTATOR = "SPECTATOR", n.PARTICIPANT = "PARTICIPANT", n))(q || {}), P = /* @__PURE__ */ ((n) => (n.ENTER_ROOM = "application/vinteo.webrtc.roomname", n.MIC = "application/vinteo.webrtc.mic", n.USE_LICENSE = "application/vinteo.webrtc.uselic", n.PARTICIPANT_STATE = "application/vinteo.webrtc.partstate", n.NOTIFY = "application/vinteo.webrtc.notify", n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n.RESTART = "application/vinteo.webrtc.restart", n))(P || {}), m = /* @__PURE__ */ ((n) => (n.CHANNELS = "application/vinteo.webrtc.channels", n.MEDIA_STATE = "application/vinteo.webrtc.mediastate", n.REFUSAL = "application/vinteo.webrtc.refusal", n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n.STATS = "application/vinteo.webrtc.stats", n))(m || {}), f = /* @__PURE__ */ ((n) => (n.PAUSE_MAIN_CAM = "PAUSEMAINCAM", n.RESUME_MAIN_CAM = "RESUMEMAINCAM", n.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", n.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", n.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", n))(f || {}), W = /* @__PURE__ */ ((n) => (n.ADMIN_STOP_MIC = "ADMINSTOPMIC", n.ADMIN_START_MIC = "ADMINSTARTMIC", n))(W || {}), H = /* @__PURE__ */ ((n) => (n.ADMIN_SYNC_FORCED = "1", n.ADMIN_SYNC_NOT_FORCED = "0", n))(H || {}), Be = /* @__PURE__ */ ((n) => (n.AUDIO = "AUDIO", n.VIDEO = "VIDEO", n.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", n))(Be || {}), u = /* @__PURE__ */ ((n) => (n.CHANNELS_NOTIFY = "channels:notify", n.PARTICIPANT_ADDED_TO_LIST_MODERATORS = "participant:added-to-list-moderators", n.PARTICIPANT_REMOVED_FROM_LIST_MODERATORS = "participant:removed-from-list-moderators", n.PARTICIPANT_MOVE_REQUEST_TO_STREAM = "participant:move-request-to-stream", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS = "participant:move-request-to-spectators", n.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS = "participant:move-request-to-participants", n.PARTICIPATION_ACCEPTING_WORD_REQUEST = "participation:accepting-word-request", n.PARTICIPATION_CANCELLING_WORD_REQUEST = "participation:cancelling-word-request", n.WEBCAST_STARTED = "webcast:started", n.WEBCAST_STOPPED = "webcast:stopped", n.ACCOUNT_CHANGED = "account:changed", n.ACCOUNT_DELETED = "account:deleted", n.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "conference:participant-token-issued", n.CHANNELS = "channels", n.ENTER_ROOM = "enterRoom", n.SHARE_STATE = "shareState", n.MAIN_CAM_CONTROL = "main-cam-control", n.USE_LICENSE = "useLicense", n.ADMIN_START_MAIN_CAM = "admin-start-main-cam", n.ADMIN_STOP_MAIN_CAM = "admin-stop-main-cam", n.ADMIN_START_MIC = "admin-start-mic", n.ADMIN_STOP_MIC = "admin-stop-mic", n.ADMIN_FORCE_SYNC_MEDIA_STATE = "admin-force-sync-media-state", n.AVAILABLE_SECOND_REMOTE_STREAM = "availableSecondRemoteStream", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "notAvailableSecondRemoteStream", n.MUST_STOP_PRESENTATION = "mustStopPresentation", n.NEW_DTMF = "newDTMF", n.RESTART = "restart", n))(u || {});
|
|
16
16
|
const ne = [
|
|
17
17
|
"participation:accepting-word-request",
|
|
18
18
|
"participation:cancelling-word-request",
|
|
@@ -52,7 +52,7 @@ class Fe {
|
|
|
52
52
|
connectionManager: e,
|
|
53
53
|
callManager: t
|
|
54
54
|
}) {
|
|
55
|
-
this.connectionManager = e, this.callManager = t, this.events = new
|
|
55
|
+
this.connectionManager = e, this.callManager = t, this.events = new k(ne), this.subscribe();
|
|
56
56
|
}
|
|
57
57
|
async waitChannels() {
|
|
58
58
|
return this.wait(u.CHANNELS);
|
|
@@ -81,7 +81,7 @@ class Fe {
|
|
|
81
81
|
i,
|
|
82
82
|
r
|
|
83
83
|
];
|
|
84
|
-
return s.sendInfo(
|
|
84
|
+
return s.sendInfo(m.CHANNELS, void 0, { extraHeaders: a });
|
|
85
85
|
}
|
|
86
86
|
async sendMediaState({ cam: e, mic: t }, s = {}) {
|
|
87
87
|
const i = this.getEstablishedRTCSessionProtected(), r = `${l.MEDIA_STATE}: currentstate`, a = `${l.MAIN_CAM_STATE}: ${Number(e)}`, o = `${l.MIC_STATE}: ${Number(t)}`, c = [
|
|
@@ -89,7 +89,7 @@ class Fe {
|
|
|
89
89
|
a,
|
|
90
90
|
o
|
|
91
91
|
];
|
|
92
|
-
return i.sendInfo(
|
|
92
|
+
return i.sendInfo(m.MEDIA_STATE, void 0, {
|
|
93
93
|
noTerminateWhenError: !0,
|
|
94
94
|
...s,
|
|
95
95
|
extraHeaders: c
|
|
@@ -99,14 +99,14 @@ class Fe {
|
|
|
99
99
|
availableIncomingBitrate: e
|
|
100
100
|
}) {
|
|
101
101
|
const t = this.getEstablishedRTCSessionProtected(), i = [`${l.AVAILABLE_INCOMING_BITRATE}: ${e}`];
|
|
102
|
-
return t.sendInfo(
|
|
102
|
+
return t.sendInfo(m.STATS, void 0, {
|
|
103
103
|
noTerminateWhenError: !0,
|
|
104
104
|
extraHeaders: i
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
async sendRefusalToTurnOn(e, t = {}) {
|
|
108
108
|
const s = this.getEstablishedRTCSessionProtected(), a = e === "mic" ? 0 : 1, c = [`${l.MEDIA_TYPE}: ${a}`];
|
|
109
|
-
return s.sendInfo(
|
|
109
|
+
return s.sendInfo(m.REFUSAL, void 0, {
|
|
110
110
|
noTerminateWhenError: !0,
|
|
111
111
|
...t,
|
|
112
112
|
extraHeaders: c
|
|
@@ -119,33 +119,33 @@ class Fe {
|
|
|
119
119
|
return this.sendRefusalToTurnOn("cam", { noTerminateWhenError: !0, ...e });
|
|
120
120
|
}
|
|
121
121
|
async sendMustStopPresentationP2P() {
|
|
122
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
122
|
+
await this.getEstablishedRTCSessionProtected().sendInfo(m.SHARE_STATE, void 0, {
|
|
123
123
|
extraHeaders: [l.MUST_STOP_PRESENTATION_P2P]
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
126
|
async sendStoppedPresentationP2P() {
|
|
127
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
127
|
+
await this.getEstablishedRTCSessionProtected().sendInfo(m.SHARE_STATE, void 0, {
|
|
128
128
|
extraHeaders: [l.STOP_PRESENTATION_P2P]
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
131
|
async sendStoppedPresentation() {
|
|
132
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
132
|
+
await this.getEstablishedRTCSessionProtected().sendInfo(m.SHARE_STATE, void 0, {
|
|
133
133
|
extraHeaders: [l.STOP_PRESENTATION]
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
136
|
async askPermissionToStartPresentationP2P() {
|
|
137
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
137
|
+
await this.getEstablishedRTCSessionProtected().sendInfo(m.SHARE_STATE, void 0, {
|
|
138
138
|
extraHeaders: [l.START_PRESENTATION_P2P]
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
141
|
async askPermissionToStartPresentation() {
|
|
142
|
-
await this.getEstablishedRTCSessionProtected().sendInfo(
|
|
142
|
+
await this.getEstablishedRTCSessionProtected().sendInfo(m.SHARE_STATE, void 0, {
|
|
143
143
|
extraHeaders: [l.START_PRESENTATION]
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
146
|
async askPermissionToEnableCam(e = {}) {
|
|
147
147
|
const t = this.getEstablishedRTCSessionProtected(), s = [l.ENABLE_MAIN_CAM];
|
|
148
|
-
return t.sendInfo(
|
|
148
|
+
return t.sendInfo(m.MAIN_CAM, void 0, {
|
|
149
149
|
noTerminateWhenError: !0,
|
|
150
150
|
...e,
|
|
151
151
|
extraHeaders: s
|
|
@@ -264,35 +264,35 @@ class Fe {
|
|
|
264
264
|
const { request: s } = e, i = s, r = i.getHeader(l.CONTENT_TYPE);
|
|
265
265
|
if (r !== void 0)
|
|
266
266
|
switch (r) {
|
|
267
|
-
case
|
|
267
|
+
case P.ENTER_ROOM: {
|
|
268
268
|
this.triggerEnterRoom(i), this.maybeTriggerChannels(i);
|
|
269
269
|
break;
|
|
270
270
|
}
|
|
271
|
-
case
|
|
271
|
+
case P.NOTIFY: {
|
|
272
272
|
this.maybeHandleNotify(i);
|
|
273
273
|
break;
|
|
274
274
|
}
|
|
275
|
-
case
|
|
275
|
+
case P.SHARE_STATE: {
|
|
276
276
|
this.triggerShareState(i);
|
|
277
277
|
break;
|
|
278
278
|
}
|
|
279
|
-
case
|
|
279
|
+
case P.MAIN_CAM: {
|
|
280
280
|
this.triggerMainCamControl(i);
|
|
281
281
|
break;
|
|
282
282
|
}
|
|
283
|
-
case
|
|
283
|
+
case P.MIC: {
|
|
284
284
|
this.triggerMicControl(i);
|
|
285
285
|
break;
|
|
286
286
|
}
|
|
287
|
-
case
|
|
287
|
+
case P.USE_LICENSE: {
|
|
288
288
|
this.triggerUseLicense(i);
|
|
289
289
|
break;
|
|
290
290
|
}
|
|
291
|
-
case
|
|
291
|
+
case P.PARTICIPANT_STATE: {
|
|
292
292
|
this.maybeTriggerParticipantMoveRequest(i);
|
|
293
293
|
break;
|
|
294
294
|
}
|
|
295
|
-
case
|
|
295
|
+
case P.RESTART: {
|
|
296
296
|
this.triggerRestart(i);
|
|
297
297
|
break;
|
|
298
298
|
}
|
|
@@ -426,15 +426,15 @@ class Fe {
|
|
|
426
426
|
};
|
|
427
427
|
triggerMainCamControl = (e) => {
|
|
428
428
|
const t = e.getHeader(l.MAIN_CAM), s = e.getHeader(l.MEDIA_SYNC), i = s === H.ADMIN_SYNC_FORCED;
|
|
429
|
-
if (t ===
|
|
429
|
+
if (t === f.ADMIN_START_MAIN_CAM) {
|
|
430
430
|
this.events.trigger(u.ADMIN_START_MAIN_CAM, { isSyncForced: i });
|
|
431
431
|
return;
|
|
432
432
|
}
|
|
433
|
-
if (t ===
|
|
433
|
+
if (t === f.ADMIN_STOP_MAIN_CAM) {
|
|
434
434
|
this.events.trigger(u.ADMIN_STOP_MAIN_CAM, { isSyncForced: i });
|
|
435
435
|
return;
|
|
436
436
|
}
|
|
437
|
-
(t ===
|
|
437
|
+
(t === f.RESUME_MAIN_CAM || t === f.PAUSE_MAIN_CAM) && s !== void 0 && this.events.trigger(u.ADMIN_FORCE_SYNC_MEDIA_STATE, { isSyncForced: i });
|
|
438
438
|
const r = e.getHeader(l.MAIN_CAM_RESOLUTION);
|
|
439
439
|
this.events.trigger(u.MAIN_CAM_CONTROL, {
|
|
440
440
|
mainCam: t,
|
|
@@ -588,11 +588,11 @@ class Ye extends Ge {
|
|
|
588
588
|
offerToReceiveAudio: S = !0,
|
|
589
589
|
offerToReceiveVideo: g = !0,
|
|
590
590
|
degradationPreference: C,
|
|
591
|
-
sendEncodings:
|
|
591
|
+
sendEncodings: _,
|
|
592
592
|
onAddedTransceiver: I
|
|
593
|
-
}) => (this.isPendingCall = !0, new Promise((R,
|
|
593
|
+
}) => (this.isPendingCall = !0, new Promise((R, D) => {
|
|
594
594
|
this.callConfiguration.number = s, this.callConfiguration.answer = !1, this.handleCall({ ontrack: a }).then(R).catch(($) => {
|
|
595
|
-
|
|
595
|
+
D($);
|
|
596
596
|
}), this.rtcSession = e.call(t(s), {
|
|
597
597
|
mediaStream: F(i, {
|
|
598
598
|
directionVideo: c,
|
|
@@ -614,7 +614,7 @@ class Ye extends Ge {
|
|
|
614
614
|
directionVideo: c,
|
|
615
615
|
directionAudio: h,
|
|
616
616
|
degradationPreference: C,
|
|
617
|
-
sendEncodings:
|
|
617
|
+
sendEncodings: _,
|
|
618
618
|
onAddedTransceiver: I
|
|
619
619
|
});
|
|
620
620
|
}).finally(() => {
|
|
@@ -643,11 +643,11 @@ class Ye extends Ge {
|
|
|
643
643
|
degradationPreference: S,
|
|
644
644
|
sendEncodings: g,
|
|
645
645
|
onAddedTransceiver: C
|
|
646
|
-
}) => (this.isPendingAnswer = !0, new Promise((
|
|
646
|
+
}) => (this.isPendingAnswer = !0, new Promise((_, I) => {
|
|
647
647
|
try {
|
|
648
648
|
const R = e();
|
|
649
|
-
this.rtcSession = R, this.subscribeToSessionEvents(R), this.callConfiguration.answer = !0, this.callConfiguration.number = R.remote_identity.uri.user, this.handleCall({ ontrack: s }).then(
|
|
650
|
-
I(
|
|
649
|
+
this.rtcSession = R, this.subscribeToSessionEvents(R), this.callConfiguration.answer = !0, this.callConfiguration.number = R.remote_identity.uri.user, this.handleCall({ ontrack: s }).then(_).catch((D) => {
|
|
650
|
+
I(D);
|
|
651
651
|
}), R.answer({
|
|
652
652
|
pcConfig: {
|
|
653
653
|
iceServers: r
|
|
@@ -721,8 +721,8 @@ class Ye extends Ge {
|
|
|
721
721
|
let h;
|
|
722
722
|
const T = ({ peerconnection: g }) => {
|
|
723
723
|
h = g;
|
|
724
|
-
const C = (
|
|
725
|
-
this.events.trigger(N.PEER_CONNECTION_ONTRACK,
|
|
724
|
+
const C = (_) => {
|
|
725
|
+
this.events.trigger(N.PEER_CONNECTION_ONTRACK, _), e && e(_);
|
|
726
726
|
};
|
|
727
727
|
g.addEventListener("track", C), this.disposers.add(() => {
|
|
728
728
|
g.removeEventListener("track", C);
|
|
@@ -757,7 +757,7 @@ class ze {
|
|
|
757
757
|
events;
|
|
758
758
|
strategy;
|
|
759
759
|
constructor(e) {
|
|
760
|
-
this.events = new
|
|
760
|
+
this.events = new U(ie), this.strategy = e ?? new Ye(this.events), this.subscribeCallStatusChange();
|
|
761
761
|
}
|
|
762
762
|
get requested() {
|
|
763
763
|
return this.strategy.requested;
|
|
@@ -884,7 +884,7 @@ const Xe = (n, e) => (n.degradationPreference = e.degradationPreference, n), Je
|
|
|
884
884
|
if (s)
|
|
885
885
|
return de(s, { maxBitrate: t });
|
|
886
886
|
};
|
|
887
|
-
var
|
|
887
|
+
var O = /* @__PURE__ */ ((n) => (n.START_PRESENTATION = "presentation:start", n.STARTED_PRESENTATION = "presentation:started", n.END_PRESENTATION = "presentation:end", n.ENDED_PRESENTATION = "presentation:ended", n.FAILED_PRESENTATION = "presentation:failed", n))(O || {});
|
|
888
888
|
const he = [
|
|
889
889
|
"presentation:start",
|
|
890
890
|
"presentation:started",
|
|
@@ -904,7 +904,7 @@ class dt {
|
|
|
904
904
|
callManager: e,
|
|
905
905
|
maxBitrate: t
|
|
906
906
|
}) {
|
|
907
|
-
this.callManager = e, this.maxBitrate = t, this.events = new
|
|
907
|
+
this.callManager = e, this.maxBitrate = t, this.events = new k(he), this.subscribe();
|
|
908
908
|
}
|
|
909
909
|
get isPendingPresentation() {
|
|
910
910
|
return !!this.promisePendingStartPresentation || !!this.promisePendingStopPresentation;
|
|
@@ -939,8 +939,8 @@ class dt {
|
|
|
939
939
|
});
|
|
940
940
|
const i = this.callManager.getEstablishedRTCSession();
|
|
941
941
|
return i && t ? s = e().then(async () => i.stopPresentation(t)).catch((r) => {
|
|
942
|
-
throw this.events.trigger(
|
|
943
|
-
}) : t && this.events.trigger(
|
|
942
|
+
throw this.events.trigger(O.FAILED_PRESENTATION, r), r;
|
|
943
|
+
}) : t && this.events.trigger(O.ENDED_PRESENTATION, t), this.promisePendingStopPresentation = s, s.finally(() => {
|
|
944
944
|
this.resetPresentation();
|
|
945
945
|
});
|
|
946
946
|
}
|
|
@@ -983,15 +983,15 @@ class dt {
|
|
|
983
983
|
}
|
|
984
984
|
subscribe() {
|
|
985
985
|
this.callManager.on("presentation:start", (e) => {
|
|
986
|
-
this.events.trigger(
|
|
986
|
+
this.events.trigger(O.START_PRESENTATION, e);
|
|
987
987
|
}), this.callManager.on("presentation:started", (e) => {
|
|
988
|
-
this.events.trigger(
|
|
988
|
+
this.events.trigger(O.STARTED_PRESENTATION, e);
|
|
989
989
|
}), this.callManager.on("presentation:end", (e) => {
|
|
990
|
-
this.events.trigger(
|
|
990
|
+
this.events.trigger(O.END_PRESENTATION, e);
|
|
991
991
|
}), this.callManager.on("presentation:ended", (e) => {
|
|
992
|
-
this.events.trigger(
|
|
992
|
+
this.events.trigger(O.ENDED_PRESENTATION, e);
|
|
993
993
|
}), this.callManager.on("presentation:failed", (e) => {
|
|
994
|
-
this.events.trigger(
|
|
994
|
+
this.events.trigger(O.FAILED_PRESENTATION, e);
|
|
995
995
|
}), this.callManager.on("failed", this.handleEnded), this.callManager.on("ended", this.handleEnded);
|
|
996
996
|
}
|
|
997
997
|
async sendPresentationWithDuplicatedCalls(e, {
|
|
@@ -1032,7 +1032,7 @@ class dt {
|
|
|
1032
1032
|
sendEncodings: o,
|
|
1033
1033
|
onAddedTransceiver: c
|
|
1034
1034
|
})).then(this.setMaxBitrate).then(() => s).catch((S) => {
|
|
1035
|
-
throw this.removeStreamPresentationCurrent(), this.events.trigger(
|
|
1035
|
+
throw this.removeStreamPresentationCurrent(), this.events.trigger(O.FAILED_PRESENTATION, S), S;
|
|
1036
1036
|
});
|
|
1037
1037
|
return this.promisePendingStartPresentation = T, T.finally(() => {
|
|
1038
1038
|
this.promisePendingStartPresentation = void 0;
|
|
@@ -1137,7 +1137,7 @@ class ht {
|
|
|
1137
1137
|
return this.data.register === !0;
|
|
1138
1138
|
}
|
|
1139
1139
|
}
|
|
1140
|
-
var
|
|
1140
|
+
var E = /* @__PURE__ */ ((n) => (n.CONNECTING = "connecting", n.CONNECTED = "connected", n.DISCONNECTED = "disconnected", n.DISCONNECTING = "disconnecting", n.NEW_RTC_SESSION = "newRTCSession", n.REGISTERED = "registered", n.UNREGISTERED = "unregistered", n.REGISTRATION_FAILED = "registrationFailed", n.NEW_MESSAGE = "newMessage", n.SIP_EVENT = "sipEvent", n.CONNECT_STARTED = "connect-started", n.CONNECT_SUCCEEDED = "connect-succeeded", n.CONNECT_FAILED = "connect-failed", n.CONNECT_PARAMETERS_RESOLVE_FAILED = "connect-parameters-resolve-failed", n))(E || {});
|
|
1141
1141
|
const le = [
|
|
1142
1142
|
"connecting",
|
|
1143
1143
|
"connected",
|
|
@@ -1152,7 +1152,8 @@ const le = [
|
|
|
1152
1152
|
"disconnecting",
|
|
1153
1153
|
"connect-started",
|
|
1154
1154
|
"connect-succeeded",
|
|
1155
|
-
"connect-failed"
|
|
1155
|
+
"connect-failed",
|
|
1156
|
+
"connect-parameters-resolve-failed"
|
|
1156
1157
|
], ge = [...le, ...lt], gt = 3;
|
|
1157
1158
|
class ut {
|
|
1158
1159
|
cancelableConnectWithRepeatedCalls;
|
|
@@ -1185,13 +1186,13 @@ class ut {
|
|
|
1185
1186
|
o ? t(o) : s(new Error("nothing changed"));
|
|
1186
1187
|
});
|
|
1187
1188
|
disconnect = async () => {
|
|
1188
|
-
this.events.trigger(
|
|
1189
|
+
this.events.trigger(E.DISCONNECTING, {});
|
|
1189
1190
|
const e = new Promise((s) => {
|
|
1190
|
-
this.events.once(
|
|
1191
|
+
this.events.once(E.DISCONNECTED, () => {
|
|
1191
1192
|
s();
|
|
1192
1193
|
});
|
|
1193
1194
|
}), t = this.getUa();
|
|
1194
|
-
return t ? t.stop() : this.events.trigger(
|
|
1195
|
+
return t ? t.stop() : this.events.trigger(E.DISCONNECTED, { socket: {}, error: !1 }), e.finally(() => {
|
|
1195
1196
|
this.setUa(void 0), this.stateMachine.reset();
|
|
1196
1197
|
});
|
|
1197
1198
|
};
|
|
@@ -1272,7 +1273,7 @@ class ut {
|
|
|
1272
1273
|
i = ((c, h) => {
|
|
1273
1274
|
if (this.getConnectionConfiguration().register === !0)
|
|
1274
1275
|
return this.registrationManager.subscribeToStartEvents(c, h);
|
|
1275
|
-
const S =
|
|
1276
|
+
const S = E.CONNECTED, g = [E.DISCONNECTED];
|
|
1276
1277
|
return this.events.on(S, c), g.forEach((C) => {
|
|
1277
1278
|
this.events.on(C, h);
|
|
1278
1279
|
}), () => {
|
|
@@ -1612,7 +1613,7 @@ class St {
|
|
|
1612
1613
|
unsubscribeFromEvents;
|
|
1613
1614
|
actorSubscription;
|
|
1614
1615
|
constructor(e) {
|
|
1615
|
-
this.events = e, this.actor =
|
|
1616
|
+
this.events = e, this.actor = ye(Tt), this.actorSubscription = this.actor.subscribe((t) => {
|
|
1616
1617
|
const s = t.value;
|
|
1617
1618
|
this.stateChangeListeners.forEach((i) => {
|
|
1618
1619
|
i(s);
|
|
@@ -1776,13 +1777,13 @@ class Ct {
|
|
|
1776
1777
|
async register() {
|
|
1777
1778
|
const e = this.getUaProtected();
|
|
1778
1779
|
return new Promise((t, s) => {
|
|
1779
|
-
e.on(
|
|
1780
|
+
e.on(E.REGISTERED, t), e.on(E.REGISTRATION_FAILED, s), e.register();
|
|
1780
1781
|
});
|
|
1781
1782
|
}
|
|
1782
1783
|
async unregister() {
|
|
1783
1784
|
const e = this.getUaProtected();
|
|
1784
1785
|
return new Promise((t) => {
|
|
1785
|
-
e.on(
|
|
1786
|
+
e.on(E.UNREGISTERED, t), e.unregister();
|
|
1786
1787
|
});
|
|
1787
1788
|
}
|
|
1788
1789
|
async tryRegister() {
|
|
@@ -1794,7 +1795,7 @@ class Ct {
|
|
|
1794
1795
|
return this.register();
|
|
1795
1796
|
}
|
|
1796
1797
|
subscribeToStartEvents(e, t) {
|
|
1797
|
-
const s =
|
|
1798
|
+
const s = E.REGISTERED, i = [E.REGISTRATION_FAILED, E.DISCONNECTED];
|
|
1798
1799
|
return this.events.on(s, e), i.forEach((r) => {
|
|
1799
1800
|
this.events.on(r, t);
|
|
1800
1801
|
}), () => {
|
|
@@ -1859,13 +1860,13 @@ class Et {
|
|
|
1859
1860
|
const C = new Error("Telephony is not available");
|
|
1860
1861
|
c(C);
|
|
1861
1862
|
};
|
|
1862
|
-
T.once(
|
|
1863
|
+
T.once(E.DISCONNECTED, S);
|
|
1863
1864
|
const g = () => {
|
|
1864
|
-
T.removeAllListeners(), T.once(
|
|
1865
|
+
T.removeAllListeners(), T.once(E.DISCONNECTED, () => {
|
|
1865
1866
|
o();
|
|
1866
1867
|
}), T.stop();
|
|
1867
1868
|
};
|
|
1868
|
-
T.once(
|
|
1869
|
+
T.once(E.CONNECTED, g), T.start();
|
|
1869
1870
|
});
|
|
1870
1871
|
}
|
|
1871
1872
|
}
|
|
@@ -1873,7 +1874,7 @@ const At = (n) => {
|
|
|
1873
1874
|
const e = [];
|
|
1874
1875
|
return n !== void 0 && n !== "" && e.push(`X-Vinteo-Remote: ${n}`), e;
|
|
1875
1876
|
};
|
|
1876
|
-
class
|
|
1877
|
+
class y {
|
|
1877
1878
|
JsSIP;
|
|
1878
1879
|
constructor(e) {
|
|
1879
1880
|
this.JsSIP = e;
|
|
@@ -1918,19 +1919,19 @@ class D {
|
|
|
1918
1919
|
connectionRecoveryMaxInterval: T = 6,
|
|
1919
1920
|
userAgent: S
|
|
1920
1921
|
}) {
|
|
1921
|
-
|
|
1922
|
+
y.validateParametersConnection({
|
|
1922
1923
|
register: a,
|
|
1923
1924
|
password: t,
|
|
1924
1925
|
user: e,
|
|
1925
1926
|
sipServerUrl: r,
|
|
1926
1927
|
sipWebSocketServerURL: s
|
|
1927
1928
|
});
|
|
1928
|
-
const g =
|
|
1929
|
+
const g = y.resolveAuthorizationUser(a, e), C = qe(r), _ = C(g), I = new this.JsSIP.WebSocketInterface(s);
|
|
1929
1930
|
return {
|
|
1930
1931
|
configuration: {
|
|
1931
1932
|
password: t,
|
|
1932
1933
|
register: a,
|
|
1933
|
-
uri:
|
|
1934
|
+
uri: _,
|
|
1934
1935
|
display_name: re(i),
|
|
1935
1936
|
user_agent: S,
|
|
1936
1937
|
sdpSemantics: "unified-plan",
|
|
@@ -1947,7 +1948,7 @@ class D {
|
|
|
1947
1948
|
};
|
|
1948
1949
|
}
|
|
1949
1950
|
createUA({ remoteAddress: e, extraHeaders: t, ...s }) {
|
|
1950
|
-
const i = new this.JsSIP.UA(s), r =
|
|
1951
|
+
const i = new this.JsSIP.UA(s), r = y.buildExtraHeaders(e, t);
|
|
1951
1952
|
return r.length > 0 && i.registrator().setExtraHeaders(r), i;
|
|
1952
1953
|
}
|
|
1953
1954
|
/**
|
|
@@ -1978,7 +1979,7 @@ class pt {
|
|
|
1978
1979
|
configurationManager;
|
|
1979
1980
|
JsSIP;
|
|
1980
1981
|
constructor({ JsSIP: e }) {
|
|
1981
|
-
this.JsSIP = e, this.events = new U(ge), this.uaFactory = new
|
|
1982
|
+
this.JsSIP = e, this.events = new U(ge), this.uaFactory = new y(e), this.registrationManager = new Ct({
|
|
1982
1983
|
events: this.events,
|
|
1983
1984
|
getUaProtected: this.getUaProtected
|
|
1984
1985
|
}), this.stateMachine = new St(this.events), this.configurationManager = new ht({
|
|
@@ -2033,7 +2034,7 @@ class pt {
|
|
|
2033
2034
|
return this.stateMachine.state;
|
|
2034
2035
|
}
|
|
2035
2036
|
get isRegistered() {
|
|
2036
|
-
return
|
|
2037
|
+
return y.isRegisteredUA(this.ua);
|
|
2037
2038
|
}
|
|
2038
2039
|
get isRegisterConfig() {
|
|
2039
2040
|
return this.configurationManager.isRegister();
|
|
@@ -2056,22 +2057,18 @@ class pt {
|
|
|
2056
2057
|
sendOptions = async (e, t, s) => this.sipOperations.sendOptions(e, t, s);
|
|
2057
2058
|
ping = async (e, t) => this.sipOperations.ping(e, t);
|
|
2058
2059
|
checkTelephony = async (e) => this.sipOperations.checkTelephony(e);
|
|
2059
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
2060
2060
|
on(e, t) {
|
|
2061
2061
|
return this.events.on(e, t);
|
|
2062
2062
|
}
|
|
2063
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
2064
2063
|
once(e, t) {
|
|
2065
2064
|
return this.events.once(e, t);
|
|
2066
2065
|
}
|
|
2067
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
2068
2066
|
onceRace(e, t) {
|
|
2069
2067
|
return this.events.onceRace(e, t);
|
|
2070
2068
|
}
|
|
2071
2069
|
async wait(e) {
|
|
2072
2070
|
return this.events.wait(e);
|
|
2073
2071
|
}
|
|
2074
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
2075
2072
|
off(e, t) {
|
|
2076
2073
|
this.events.off(e, t);
|
|
2077
2074
|
}
|
|
@@ -2102,12 +2099,14 @@ class pt {
|
|
|
2102
2099
|
});
|
|
2103
2100
|
});
|
|
2104
2101
|
};
|
|
2105
|
-
processConnect = async (e, t) => (this.events.trigger(
|
|
2102
|
+
processConnect = async (e, t) => (this.events.trigger(E.CONNECT_STARTED, {}), It(e).catch((s) => {
|
|
2103
|
+
throw this.events.trigger(E.CONNECT_PARAMETERS_RESOLVE_FAILED, s), s;
|
|
2104
|
+
}).then(async (s) => this.connectionFlow.connect(s, t)).then((s) => (this.events.trigger(E.CONNECT_SUCCEEDED, { ua: s }), s)).catch((s) => {
|
|
2106
2105
|
const i = s ?? new Error("Failed to connect to server");
|
|
2107
|
-
throw this.events.trigger(
|
|
2106
|
+
throw this.events.trigger(E.CONNECT_FAILED, i), i;
|
|
2108
2107
|
}));
|
|
2109
2108
|
}
|
|
2110
|
-
class
|
|
2109
|
+
class _t {
|
|
2111
2110
|
connectionManager;
|
|
2112
2111
|
stackPromises = te({
|
|
2113
2112
|
noRunIsNotActual: !0
|
|
@@ -2121,19 +2120,21 @@ class mt {
|
|
|
2121
2120
|
this.stackPromises.stop();
|
|
2122
2121
|
}
|
|
2123
2122
|
}
|
|
2124
|
-
var
|
|
2123
|
+
var M = /* @__PURE__ */ ((n) => (n.BEFORE_ATTEMPT = "before-attempt", n.SUCCESS = "success", n.FAILED_ALL_ATTEMPTS = "failed-all-attempts", n.CANCELLED_ATTEMPTS = "cancelled-attempts", n.CHANGED_ATTEMPT_STATUS = "changed-attempt-status", n.STOP_ATTEMPTS_BY_ERROR = "stop-attempts-by-error", n.LIMIT_REACHED_ATTEMPTS = "limit-reached-attempts", n))(M || {});
|
|
2125
2124
|
const Se = [
|
|
2126
2125
|
"before-attempt",
|
|
2127
|
-
"
|
|
2128
|
-
"failed-
|
|
2129
|
-
"cancelled-
|
|
2130
|
-
"changed-attempt-status"
|
|
2131
|
-
|
|
2126
|
+
"success",
|
|
2127
|
+
"failed-all-attempts",
|
|
2128
|
+
"cancelled-attempts",
|
|
2129
|
+
"changed-attempt-status",
|
|
2130
|
+
"stop-attempts-by-error",
|
|
2131
|
+
"limit-reached-attempts"
|
|
2132
|
+
], z = 0, mt = 30;
|
|
2132
2133
|
class Mt {
|
|
2133
2134
|
events;
|
|
2134
2135
|
countInner = z;
|
|
2135
2136
|
initialCount = z;
|
|
2136
|
-
limitInner =
|
|
2137
|
+
limitInner = mt;
|
|
2137
2138
|
isInProgress = !1;
|
|
2138
2139
|
constructor({ events: e }) {
|
|
2139
2140
|
this.events = e;
|
|
@@ -2163,7 +2164,7 @@ class Mt {
|
|
|
2163
2164
|
this.countInner = this.initialCount, this.finishAttempt();
|
|
2164
2165
|
}
|
|
2165
2166
|
emitStatusChange() {
|
|
2166
|
-
this.events.trigger(
|
|
2167
|
+
this.events.trigger(M.CHANGED_ATTEMPT_STATUS, { isInProgress: this.isInProgress });
|
|
2167
2168
|
}
|
|
2168
2169
|
}
|
|
2169
2170
|
class vt {
|
|
@@ -2182,7 +2183,7 @@ class vt {
|
|
|
2182
2183
|
onSuccessRequest: t,
|
|
2183
2184
|
onFailRequest: s
|
|
2184
2185
|
}) {
|
|
2185
|
-
this.stop(), this.cancelableBeforeRequest = new G(e), this.checkTelephonyByTimeout =
|
|
2186
|
+
this.stop(), this.cancelableBeforeRequest = new G(e), this.checkTelephonyByTimeout = me({
|
|
2186
2187
|
isDontStopOnFail: !0,
|
|
2187
2188
|
requestInterval: this.interval,
|
|
2188
2189
|
request: async () => {
|
|
@@ -2223,7 +2224,7 @@ class Ot {
|
|
|
2223
2224
|
this.pingServerByTimeoutWithFailCalls.stop();
|
|
2224
2225
|
}
|
|
2225
2226
|
}
|
|
2226
|
-
class
|
|
2227
|
+
class yt {
|
|
2227
2228
|
callManager;
|
|
2228
2229
|
pingServerRequester;
|
|
2229
2230
|
disposeCallStatusChange;
|
|
@@ -2250,7 +2251,7 @@ class Dt {
|
|
|
2250
2251
|
this.callManager.isCallActive ? this.pingServerRequester.stop() : this.pingServerRequester.start({ onFailRequest: e });
|
|
2251
2252
|
}
|
|
2252
2253
|
}
|
|
2253
|
-
class
|
|
2254
|
+
class Dt {
|
|
2254
2255
|
connectionManager;
|
|
2255
2256
|
callManager;
|
|
2256
2257
|
isRegistrationFailed = !1;
|
|
@@ -2304,13 +2305,13 @@ class Bt {
|
|
|
2304
2305
|
callManager: s
|
|
2305
2306
|
}, i) {
|
|
2306
2307
|
const r = i?.onBeforeRetry ?? Ut, a = i?.canRetryOnError ?? Lt;
|
|
2307
|
-
this.connectionQueueManager = e, this.connectionManager = t, this.onBeforeRetry = r, this.canRetryOnError = a, this.events = new
|
|
2308
|
+
this.connectionQueueManager = e, this.connectionManager = t, this.onBeforeRetry = r, this.canRetryOnError = a, this.events = new U(Se), this.checkTelephonyRequester = new vt({
|
|
2308
2309
|
connectionManager: t,
|
|
2309
2310
|
interval: i?.checkTelephonyRequestInterval ?? wt
|
|
2310
|
-
}), this.pingServerIfNotActiveCallRequester = new
|
|
2311
|
+
}), this.pingServerIfNotActiveCallRequester = new yt({
|
|
2311
2312
|
connectionManager: t,
|
|
2312
2313
|
callManager: s
|
|
2313
|
-
}), this.registrationFailedOutOfCallSubscriber = new
|
|
2314
|
+
}), this.registrationFailedOutOfCallSubscriber = new Dt({
|
|
2314
2315
|
connectionManager: t,
|
|
2315
2316
|
callManager: s
|
|
2316
2317
|
}), this.attemptsState = new Mt({
|
|
@@ -2362,7 +2363,7 @@ class Bt {
|
|
|
2362
2363
|
});
|
|
2363
2364
|
}
|
|
2364
2365
|
async connect(e) {
|
|
2365
|
-
if (d("connect: attempts.count", this.attemptsState.count), this.events.trigger(
|
|
2366
|
+
if (d("connect: attempts.count", this.attemptsState.count), this.events.trigger(M.BEFORE_ATTEMPT, {}), this.stopConnectTriggers(), this.attemptsState.hasLimitReached()) {
|
|
2366
2367
|
d("connect: isLimitReached!"), this.handleLimitReached(e);
|
|
2367
2368
|
return;
|
|
2368
2369
|
}
|
|
@@ -2377,21 +2378,21 @@ class Bt {
|
|
|
2377
2378
|
return;
|
|
2378
2379
|
}
|
|
2379
2380
|
if (!this.canRetryOnError(t)) {
|
|
2380
|
-
d("processConnect: error does not allow retry", t);
|
|
2381
|
+
d("processConnect: error does not allow retry", t), this.events.trigger(M.STOP_ATTEMPTS_BY_ERROR, t);
|
|
2381
2382
|
return;
|
|
2382
2383
|
}
|
|
2383
|
-
if (
|
|
2384
|
-
d("processConnect: not actual error", t), this.events.trigger(
|
|
2384
|
+
if (De(t)) {
|
|
2385
|
+
d("processConnect: not actual error", t), this.events.trigger(M.CANCELLED_ATTEMPTS, t);
|
|
2385
2386
|
return;
|
|
2386
2387
|
}
|
|
2387
2388
|
d("processConnect: error", t), this.reconnect(e);
|
|
2388
2389
|
}
|
|
2389
2390
|
}
|
|
2390
2391
|
handleLimitReached(e) {
|
|
2391
|
-
this.attemptsState.finishAttempt(), this.events.trigger(
|
|
2392
|
+
this.attemptsState.finishAttempt(), this.events.trigger(M.LIMIT_REACHED_ATTEMPTS, new Error("Limit reached")), this.runCheckTelephony(e);
|
|
2392
2393
|
}
|
|
2393
2394
|
handleSucceededAttempt(e) {
|
|
2394
|
-
d("handleSucceededAttempt"), this.subscribeToConnectTriggers(e), this.events.trigger(
|
|
2395
|
+
d("handleSucceededAttempt"), this.subscribeToConnectTriggers(e), this.events.trigger(M.SUCCESS);
|
|
2395
2396
|
}
|
|
2396
2397
|
subscribeToConnectTriggers(e) {
|
|
2397
2398
|
this.pingServerIfNotActiveCallRequester.start({
|
|
@@ -2404,12 +2405,12 @@ class Bt {
|
|
|
2404
2405
|
}
|
|
2405
2406
|
connectIfDisconnected(e) {
|
|
2406
2407
|
const t = this.hasFailedOrDisconnectedConnection();
|
|
2407
|
-
d("connectIfDisconnected: isFailedOrDisconnected", t), t ? this.start(e) : (this.stopConnectTriggers(), this.events.trigger(
|
|
2408
|
+
d("connectIfDisconnected: isFailedOrDisconnected", t), t ? this.start(e) : (this.stopConnectTriggers(), this.events.trigger(M.SUCCESS));
|
|
2408
2409
|
}
|
|
2409
2410
|
reconnect(e) {
|
|
2410
2411
|
d("reconnect"), this.delayBetweenAttempts.request().then(async () => (d("reconnect: delayBetweenAttempts success"), this.cancelableRequestBeforeRetry.request())).then(async () => (d("reconnect: onBeforeRetry success"), this.connect(e))).catch((t) => {
|
|
2411
2412
|
const s = t instanceof Error ? t : new Error("Failed to reconnect");
|
|
2412
|
-
|
|
2413
|
+
_e(t) || fe(t) ? this.events.trigger(M.CANCELLED_ATTEMPTS, s) : this.events.trigger(M.FAILED_ALL_ATTEMPTS, s), d("reconnect: error", t);
|
|
2413
2414
|
});
|
|
2414
2415
|
}
|
|
2415
2416
|
hasFailedOrDisconnectedConnection() {
|
|
@@ -2429,7 +2430,7 @@ class $t {
|
|
|
2429
2430
|
incomingRTCSession;
|
|
2430
2431
|
connectionManager;
|
|
2431
2432
|
constructor(e) {
|
|
2432
|
-
this.connectionManager = e, this.events = new
|
|
2433
|
+
this.connectionManager = e, this.events = new k(Ce), this.start();
|
|
2433
2434
|
}
|
|
2434
2435
|
get remoteCallerData() {
|
|
2435
2436
|
return {
|
|
@@ -2516,7 +2517,7 @@ class $t {
|
|
|
2516
2517
|
}
|
|
2517
2518
|
}
|
|
2518
2519
|
const b = 1e3;
|
|
2519
|
-
var
|
|
2520
|
+
var A = /* @__PURE__ */ ((n) => (n.INBOUND_RTP = "inbound-rtp", n.REMOTE_OUTBOUND_RTP = "remote-outbound-rtp", n.MEDIA_SOURCE = "media-source", n.OUTBOUND_RTP = "outbound-rtp", n.REMOTE_INBOUND_RTP = "remote-inbound-rtp", n.CODEC = "codec", n.CANDIDATE_PAIR = "candidate-pair", n.CERTIFICATE = "certificate", n.TRANSPORT = "transport", n.LOCAL_CANDIDATE = "local-candidate", n.REMOTE_CANDIDATE = "remote-candidate", n))(A || {});
|
|
2520
2521
|
const Ee = ["collected"], X = () => "performance" in window ? performance.now() : Date.now(), L = (n) => [...n.keys()].reduce((e, t) => {
|
|
2521
2522
|
const s = n.get(t);
|
|
2522
2523
|
return s === void 0 ? e : { ...e, [s.type]: s };
|
|
@@ -2530,10 +2531,10 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2530
2531
|
};
|
|
2531
2532
|
const e = L(n);
|
|
2532
2533
|
return {
|
|
2533
|
-
outboundRtp: e[
|
|
2534
|
-
codec: e[
|
|
2535
|
-
mediaSource: e[
|
|
2536
|
-
remoteInboundRtp: e[
|
|
2534
|
+
outboundRtp: e[A.OUTBOUND_RTP],
|
|
2535
|
+
codec: e[A.CODEC],
|
|
2536
|
+
mediaSource: e[A.MEDIA_SOURCE],
|
|
2537
|
+
remoteInboundRtp: e[A.REMOTE_INBOUND_RTP]
|
|
2537
2538
|
};
|
|
2538
2539
|
}, J = (n) => {
|
|
2539
2540
|
if (!n)
|
|
@@ -2545,10 +2546,10 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2545
2546
|
};
|
|
2546
2547
|
const e = L(n);
|
|
2547
2548
|
return {
|
|
2548
|
-
outboundRtp: e[
|
|
2549
|
-
codec: e[
|
|
2550
|
-
mediaSource: e[
|
|
2551
|
-
remoteInboundRtp: e[
|
|
2549
|
+
outboundRtp: e[A.OUTBOUND_RTP],
|
|
2550
|
+
codec: e[A.CODEC],
|
|
2551
|
+
mediaSource: e[A.MEDIA_SOURCE],
|
|
2552
|
+
remoteInboundRtp: e[A.REMOTE_INBOUND_RTP]
|
|
2552
2553
|
};
|
|
2553
2554
|
}, K = ({
|
|
2554
2555
|
videoReceiversStats: n,
|
|
@@ -2562,8 +2563,8 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2562
2563
|
};
|
|
2563
2564
|
const t = L(n);
|
|
2564
2565
|
return {
|
|
2565
|
-
inboundRtp: t[
|
|
2566
|
-
codec: t[
|
|
2566
|
+
inboundRtp: t[A.INBOUND_RTP],
|
|
2567
|
+
codec: t[A.CODEC],
|
|
2567
2568
|
synchronizationSources: e
|
|
2568
2569
|
};
|
|
2569
2570
|
}, qt = ({
|
|
@@ -2579,9 +2580,9 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2579
2580
|
};
|
|
2580
2581
|
const t = L(n);
|
|
2581
2582
|
return {
|
|
2582
|
-
inboundRtp: t[
|
|
2583
|
-
codec: t[
|
|
2584
|
-
remoteOutboundRtp: t[
|
|
2583
|
+
inboundRtp: t[A.INBOUND_RTP],
|
|
2584
|
+
codec: t[A.CODEC],
|
|
2585
|
+
remoteOutboundRtp: t[A.REMOTE_OUTBOUND_RTP],
|
|
2585
2586
|
synchronizationSources: e
|
|
2586
2587
|
};
|
|
2587
2588
|
}, Ae = (n) => {
|
|
@@ -2595,11 +2596,11 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2595
2596
|
};
|
|
2596
2597
|
const e = L(n);
|
|
2597
2598
|
return {
|
|
2598
|
-
candidatePair: e[
|
|
2599
|
-
certificate: e[
|
|
2600
|
-
localCandidate: e[
|
|
2601
|
-
remoteCandidate: e[
|
|
2602
|
-
transport: e[
|
|
2599
|
+
candidatePair: e[A.CANDIDATE_PAIR],
|
|
2600
|
+
certificate: e[A.CERTIFICATE],
|
|
2601
|
+
localCandidate: e[A.LOCAL_CANDIDATE],
|
|
2602
|
+
remoteCandidate: e[A.REMOTE_CANDIDATE],
|
|
2603
|
+
transport: e[A.TRANSPORT]
|
|
2603
2604
|
};
|
|
2604
2605
|
}, Wt = ({
|
|
2605
2606
|
audioSenderStats: n,
|
|
@@ -2677,19 +2678,19 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2677
2678
|
]).then((g) => {
|
|
2678
2679
|
const [
|
|
2679
2680
|
C,
|
|
2680
|
-
|
|
2681
|
+
_,
|
|
2681
2682
|
I,
|
|
2682
2683
|
R,
|
|
2683
|
-
|
|
2684
|
+
D,
|
|
2684
2685
|
$
|
|
2685
2686
|
] = g;
|
|
2686
2687
|
return {
|
|
2687
2688
|
synchronizationSources: S,
|
|
2688
2689
|
audioSenderStats: C,
|
|
2689
|
-
videoSenderFirstStats:
|
|
2690
|
+
videoSenderFirstStats: _,
|
|
2690
2691
|
videoSenderSecondStats: I,
|
|
2691
2692
|
audioReceiverStats: R,
|
|
2692
|
-
videoReceiverFirstStats:
|
|
2693
|
+
videoReceiverFirstStats: D,
|
|
2693
2694
|
videoReceiverSecondStats: $
|
|
2694
2695
|
};
|
|
2695
2696
|
});
|
|
@@ -2701,7 +2702,7 @@ class Yt {
|
|
|
2701
2702
|
setTimeoutRequest;
|
|
2702
2703
|
requesterAllStatistics = new G(Gt);
|
|
2703
2704
|
constructor() {
|
|
2704
|
-
this.events = new
|
|
2705
|
+
this.events = new U(Ee), this.setTimeoutRequest = new Z();
|
|
2705
2706
|
}
|
|
2706
2707
|
get requested() {
|
|
2707
2708
|
return this.setTimeoutRequest.requested;
|
|
@@ -2974,7 +2975,7 @@ class on {
|
|
|
2974
2975
|
this.taskQueue.stop();
|
|
2975
2976
|
}
|
|
2976
2977
|
}
|
|
2977
|
-
const Ne = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), cn = 1e6,
|
|
2978
|
+
const Ne = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), cn = 1e6, v = (n) => n * cn, Re = v(0.06), Ie = v(4), dn = (n) => n <= 64 ? Re : n <= 128 ? v(0.12) : n <= 256 ? v(0.25) : n <= 384 ? v(0.32) : n <= 426 ? v(0.38) : n <= 640 ? v(0.5) : n <= 848 ? v(0.7) : n <= 1280 ? v(1) : n <= 1920 ? v(2) : Ie, hn = "av1", ln = (n) => Ne(n, hn), gn = 0.6, Y = (n, e) => ln(e) ? n * gn : n, un = (n) => Y(Re, n), Tn = (n) => Y(Ie, n), j = (n, e) => {
|
|
2978
2979
|
const t = dn(n);
|
|
2979
2980
|
return Y(t, e);
|
|
2980
2981
|
}, V = 1, Sn = ({
|
|
@@ -3037,14 +3038,14 @@ class Cn {
|
|
|
3037
3038
|
async processSender(e, t) {
|
|
3038
3039
|
const { mainCam: s, resolutionMainCam: i } = e;
|
|
3039
3040
|
switch (s) {
|
|
3040
|
-
case
|
|
3041
|
+
case f.PAUSE_MAIN_CAM:
|
|
3041
3042
|
return this.downgradeResolutionSender(t);
|
|
3042
|
-
case
|
|
3043
|
+
case f.RESUME_MAIN_CAM:
|
|
3043
3044
|
return this.setBitrateByTrackResolution(t);
|
|
3044
|
-
case
|
|
3045
|
+
case f.MAX_MAIN_CAM_RESOLUTION:
|
|
3045
3046
|
return i !== void 0 ? this.setResolutionSender(i, t) : this.setBitrateByTrackResolution(t);
|
|
3046
|
-
case
|
|
3047
|
-
case
|
|
3047
|
+
case f.ADMIN_STOP_MAIN_CAM:
|
|
3048
|
+
case f.ADMIN_START_MAIN_CAM:
|
|
3048
3049
|
case void 0:
|
|
3049
3050
|
return this.setBitrateByTrackResolution(t);
|
|
3050
3051
|
default:
|
|
@@ -3266,7 +3267,7 @@ class pn {
|
|
|
3266
3267
|
videoSendingBalancer;
|
|
3267
3268
|
startBalancingTimer;
|
|
3268
3269
|
constructor(e, t, s = {}) {
|
|
3269
|
-
this.events = new
|
|
3270
|
+
this.events = new U(pe), this.callManager = e, this.balancingStartDelay = s.balancingStartDelay ?? 1e4, this.videoSendingBalancer = new In(
|
|
3270
3271
|
t,
|
|
3271
3272
|
() => e.connection,
|
|
3272
3273
|
{
|
|
@@ -3336,15 +3337,15 @@ class pn {
|
|
|
3336
3337
|
this.startBalancingTimer && (clearTimeout(this.startBalancingTimer), this.startBalancingTimer = void 0);
|
|
3337
3338
|
}
|
|
3338
3339
|
}
|
|
3339
|
-
const
|
|
3340
|
-
...
|
|
3340
|
+
const _n = 1e6, mn = Se.map((n) => `auto-connect:${n}`), Mn = ge.map((n) => `connection:${n}`), vn = ie.map((n) => `call:${n}`), fn = ne.map((n) => `api:${n}`), Pn = Ce.map((n) => `incoming-call:${n}`), On = he.map((n) => `presentation:${n}`), yn = Ee.map((n) => `stats:${n}`), Dn = pe.map((n) => `video-balancer:${n}`), bn = [
|
|
3341
|
+
...mn,
|
|
3341
3342
|
...Mn,
|
|
3342
3343
|
...vn,
|
|
3343
3344
|
...fn,
|
|
3344
3345
|
...Pn,
|
|
3345
3346
|
...On,
|
|
3346
|
-
...
|
|
3347
|
-
...
|
|
3347
|
+
...yn,
|
|
3348
|
+
...Dn
|
|
3348
3349
|
];
|
|
3349
3350
|
class Gn {
|
|
3350
3351
|
events;
|
|
@@ -3366,14 +3367,14 @@ class Gn {
|
|
|
3366
3367
|
videoBalancerOptions: i,
|
|
3367
3368
|
autoConnectorOptions: r
|
|
3368
3369
|
} = {}) {
|
|
3369
|
-
this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events = new
|
|
3370
|
+
this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events = new k(bn), this.connectionManager = new pt({ JsSIP: e }), this.connectionQueueManager = new _t({
|
|
3370
3371
|
connectionManager: this.connectionManager
|
|
3371
3372
|
}), this.callManager = new ze(), this.apiManager = new Fe({
|
|
3372
3373
|
connectionManager: this.connectionManager,
|
|
3373
3374
|
callManager: this.callManager
|
|
3374
3375
|
}), this.incomingCallManager = new $t(this.connectionManager), this.presentationManager = new dt({
|
|
3375
3376
|
callManager: this.callManager,
|
|
3376
|
-
maxBitrate:
|
|
3377
|
+
maxBitrate: _n
|
|
3377
3378
|
}), this.statsManager = new zt({
|
|
3378
3379
|
callManager: this.callManager,
|
|
3379
3380
|
apiManager: this.apiManager
|
|
@@ -3600,7 +3601,7 @@ export {
|
|
|
3600
3601
|
xn as c,
|
|
3601
3602
|
Hn as d,
|
|
3602
3603
|
Wn as e,
|
|
3603
|
-
|
|
3604
|
+
A as f,
|
|
3604
3605
|
Yt as g,
|
|
3605
3606
|
Nt as h,
|
|
3606
3607
|
sn as i,
|