sip-connector 19.2.1 → 19.3.0
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-Cr5Qu1ds.js → @SipConnector-BBoS4GNN.js} +70 -69
- package/dist/{@SipConnector-Cx-er9n6.cjs → @SipConnector-Bfb_x_4D.cjs} +1 -1
- package/dist/AutoConnectorManager/@AutoConnectorManager.d.ts +1 -0
- package/dist/AutoConnectorManager/AttemptsState.d.ts +5 -5
- package/dist/AutoConnectorManager/types.d.ts +2 -3
- package/dist/ConnectionManager/@ConnectionManager.d.ts +2 -2
- package/dist/ConnectionManager/ConnectionFlow.d.ts +4 -4
- package/dist/ConnectionManager/index.d.ts +2 -1
- package/dist/SipConnectorFacade/@SipConnectorFacade.d.ts +2 -11
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +233 -259
- package/dist/tools/__fixtures__/connectToServer.d.ts +14 -14
- package/dist/tools/__fixtures__/permissions.d.ts +3 -3
- package/dist/tools/__fixtures__/processRequest.d.ts +2 -2
- package/package.json +4 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
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 me } from "@krivega/cancelable-promise";
|
|
4
|
+
import { resolveRequesterByTimeout as _e, requesterByTimeoutsWithFailCalls as Me, DelayRequester as fe, hasCanceledError as ve, SetTimeoutRequest as Z } from "@krivega/timeout-requester";
|
|
5
5
|
import { hasCanceledError as Pe, repeatedCallsAsync as ee } from "repeated-calls";
|
|
6
6
|
import { setup as Oe, createActor as ye } from "xstate";
|
|
7
7
|
import { createStackPromises as te, isPromiseIsNotActualError as De } from "stack-promises";
|
|
@@ -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 || {}), 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 || {}),
|
|
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 || {}), _ = /* @__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))(_ || {}), v = /* @__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))(v || {}), 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",
|
|
@@ -81,7 +81,7 @@ class Fe {
|
|
|
81
81
|
i,
|
|
82
82
|
r
|
|
83
83
|
];
|
|
84
|
-
return s.sendInfo(
|
|
84
|
+
return s.sendInfo(_.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(_.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(_.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(_.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(_.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(_.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(_.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(_.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(_.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(_.MAIN_CAM, void 0, {
|
|
149
149
|
noTerminateWhenError: !0,
|
|
150
150
|
...e,
|
|
151
151
|
extraHeaders: s
|
|
@@ -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 === v.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 === v.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 === v.RESUME_MAIN_CAM || t === v.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,7 +588,7 @@ class Ye extends Ge {
|
|
|
588
588
|
offerToReceiveAudio: S = !0,
|
|
589
589
|
offerToReceiveVideo: g = !0,
|
|
590
590
|
degradationPreference: C,
|
|
591
|
-
sendEncodings:
|
|
591
|
+
sendEncodings: m,
|
|
592
592
|
onAddedTransceiver: I
|
|
593
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(($) => {
|
|
@@ -614,7 +614,7 @@ class Ye extends Ge {
|
|
|
614
614
|
directionVideo: c,
|
|
615
615
|
directionAudio: h,
|
|
616
616
|
degradationPreference: C,
|
|
617
|
-
sendEncodings:
|
|
617
|
+
sendEncodings: m,
|
|
618
618
|
onAddedTransceiver: I
|
|
619
619
|
});
|
|
620
620
|
}).finally(() => {
|
|
@@ -643,10 +643,10 @@ 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((m, 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(
|
|
649
|
+
this.rtcSession = R, this.subscribeToSessionEvents(R), this.callConfiguration.answer = !0, this.callConfiguration.number = R.remote_identity.uri.user, this.handleCall({ ontrack: s }).then(m).catch((D) => {
|
|
650
650
|
I(D);
|
|
651
651
|
}), R.answer({
|
|
652
652
|
pcConfig: {
|
|
@@ -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 = (m) => {
|
|
725
|
+
this.events.trigger(N.PEER_CONNECTION_ONTRACK, m), e && e(m);
|
|
726
726
|
};
|
|
727
727
|
g.addEventListener("track", C), this.disposers.add(() => {
|
|
728
728
|
g.removeEventListener("track", C);
|
|
@@ -1926,12 +1926,12 @@ class y {
|
|
|
1926
1926
|
sipServerUrl: r,
|
|
1927
1927
|
sipWebSocketServerURL: s
|
|
1928
1928
|
});
|
|
1929
|
-
const g = y.resolveAuthorizationUser(a, e), C = qe(r),
|
|
1929
|
+
const g = y.resolveAuthorizationUser(a, e), C = qe(r), m = C(g), I = new this.JsSIP.WebSocketInterface(s);
|
|
1930
1930
|
return {
|
|
1931
1931
|
configuration: {
|
|
1932
1932
|
password: t,
|
|
1933
1933
|
register: a,
|
|
1934
|
-
uri:
|
|
1934
|
+
uri: m,
|
|
1935
1935
|
display_name: re(i),
|
|
1936
1936
|
user_agent: S,
|
|
1937
1937
|
sdpSemantics: "unified-plan",
|
|
@@ -2106,7 +2106,7 @@ class pt {
|
|
|
2106
2106
|
throw this.events.trigger(E.CONNECT_FAILED, i), i;
|
|
2107
2107
|
}));
|
|
2108
2108
|
}
|
|
2109
|
-
class
|
|
2109
|
+
class mt {
|
|
2110
2110
|
connectionManager;
|
|
2111
2111
|
stackPromises = te({
|
|
2112
2112
|
noRunIsNotActual: !0
|
|
@@ -2120,24 +2120,17 @@ class _t {
|
|
|
2120
2120
|
this.stackPromises.stop();
|
|
2121
2121
|
}
|
|
2122
2122
|
}
|
|
2123
|
-
|
|
2124
|
-
const Se = [
|
|
2125
|
-
"before-attempt",
|
|
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;
|
|
2123
|
+
const z = 0, _t = 30;
|
|
2133
2124
|
class Mt {
|
|
2134
|
-
events;
|
|
2135
2125
|
countInner = z;
|
|
2136
2126
|
initialCount = z;
|
|
2137
|
-
limitInner =
|
|
2127
|
+
limitInner = _t;
|
|
2138
2128
|
isInProgress = !1;
|
|
2139
|
-
|
|
2140
|
-
|
|
2129
|
+
onStatusChange;
|
|
2130
|
+
constructor({
|
|
2131
|
+
onStatusChange: e
|
|
2132
|
+
}) {
|
|
2133
|
+
this.onStatusChange = e;
|
|
2141
2134
|
}
|
|
2142
2135
|
get count() {
|
|
2143
2136
|
return this.countInner;
|
|
@@ -2152,10 +2145,10 @@ class Mt {
|
|
|
2152
2145
|
return this.countInner >= this.limitInner;
|
|
2153
2146
|
}
|
|
2154
2147
|
startAttempt() {
|
|
2155
|
-
this.isInProgress || (this.isInProgress = !0, this.
|
|
2148
|
+
this.isInProgress || (this.isInProgress = !0, this.onStatusChange({ isInProgress: this.isInProgress }));
|
|
2156
2149
|
}
|
|
2157
2150
|
finishAttempt() {
|
|
2158
|
-
this.isInProgress && (this.isInProgress = !1, this.
|
|
2151
|
+
this.isInProgress && (this.isInProgress = !1, this.onStatusChange({ isInProgress: this.isInProgress }));
|
|
2159
2152
|
}
|
|
2160
2153
|
increment() {
|
|
2161
2154
|
this.count < this.limit && (this.countInner += 1);
|
|
@@ -2163,11 +2156,8 @@ class Mt {
|
|
|
2163
2156
|
reset() {
|
|
2164
2157
|
this.countInner = this.initialCount, this.finishAttempt();
|
|
2165
2158
|
}
|
|
2166
|
-
emitStatusChange() {
|
|
2167
|
-
this.events.trigger(M.CHANGED_ATTEMPT_STATUS, { isInProgress: this.isInProgress });
|
|
2168
|
-
}
|
|
2169
2159
|
}
|
|
2170
|
-
class
|
|
2160
|
+
class ft {
|
|
2171
2161
|
connectionManager;
|
|
2172
2162
|
interval;
|
|
2173
2163
|
checkTelephonyByTimeout = void 0;
|
|
@@ -2183,7 +2173,7 @@ class vt {
|
|
|
2183
2173
|
onSuccessRequest: t,
|
|
2184
2174
|
onFailRequest: s
|
|
2185
2175
|
}) {
|
|
2186
|
-
this.stop(), this.cancelableBeforeRequest = new G(e), this.checkTelephonyByTimeout =
|
|
2176
|
+
this.stop(), this.cancelableBeforeRequest = new G(e), this.checkTelephonyByTimeout = _e({
|
|
2187
2177
|
isDontStopOnFail: !0,
|
|
2188
2178
|
requestInterval: this.interval,
|
|
2189
2179
|
request: async () => {
|
|
@@ -2203,7 +2193,16 @@ class vt {
|
|
|
2203
2193
|
this.checkTelephonyByTimeout?.stop(), this.checkTelephonyByTimeout = void 0, this.cancelableBeforeRequest?.cancelRequest(), this.cancelableBeforeRequest = void 0;
|
|
2204
2194
|
}
|
|
2205
2195
|
}
|
|
2206
|
-
|
|
2196
|
+
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 || {});
|
|
2197
|
+
const Se = [
|
|
2198
|
+
"before-attempt",
|
|
2199
|
+
"success",
|
|
2200
|
+
"failed-all-attempts",
|
|
2201
|
+
"cancelled-attempts",
|
|
2202
|
+
"changed-attempt-status",
|
|
2203
|
+
"stop-attempts-by-error",
|
|
2204
|
+
"limit-reached-attempts"
|
|
2205
|
+
], vt = 15e3, Pt = 2;
|
|
2207
2206
|
class Ot {
|
|
2208
2207
|
connectionManager;
|
|
2209
2208
|
pingServerByTimeoutWithFailCalls;
|
|
@@ -2211,7 +2210,7 @@ class Ot {
|
|
|
2211
2210
|
this.connectionManager = e, this.pingServerByTimeoutWithFailCalls = Me(Pt, {
|
|
2212
2211
|
whenPossibleRequest: async () => {
|
|
2213
2212
|
},
|
|
2214
|
-
requestInterval:
|
|
2213
|
+
requestInterval: vt,
|
|
2215
2214
|
request: async () => (d("ping"), this.connectionManager.ping().then(() => {
|
|
2216
2215
|
d("ping success");
|
|
2217
2216
|
}))
|
|
@@ -2305,7 +2304,7 @@ class Bt {
|
|
|
2305
2304
|
callManager: s
|
|
2306
2305
|
}, i) {
|
|
2307
2306
|
const r = i?.onBeforeRetry ?? Ut, a = i?.canRetryOnError ?? Lt;
|
|
2308
|
-
this.connectionQueueManager = e, this.connectionManager = t, this.onBeforeRetry = r, this.canRetryOnError = a, this.events = new U(Se), this.checkTelephonyRequester = new
|
|
2307
|
+
this.connectionQueueManager = e, this.connectionManager = t, this.onBeforeRetry = r, this.canRetryOnError = a, this.events = new U(Se), this.checkTelephonyRequester = new ft({
|
|
2309
2308
|
connectionManager: t,
|
|
2310
2309
|
interval: i?.checkTelephonyRequestInterval ?? wt
|
|
2311
2310
|
}), this.pingServerIfNotActiveCallRequester = new yt({
|
|
@@ -2315,8 +2314,8 @@ class Bt {
|
|
|
2315
2314
|
connectionManager: t,
|
|
2316
2315
|
callManager: s
|
|
2317
2316
|
}), this.attemptsState = new Mt({
|
|
2318
|
-
|
|
2319
|
-
}), this.cancelableRequestBeforeRetry = new G(r), this.delayBetweenAttempts = new
|
|
2317
|
+
onStatusChange: this.emitStatusChange
|
|
2318
|
+
}), this.cancelableRequestBeforeRetry = new G(r), this.delayBetweenAttempts = new fe(
|
|
2320
2319
|
i?.timeoutBetweenAttempts ?? bt
|
|
2321
2320
|
);
|
|
2322
2321
|
}
|
|
@@ -2374,15 +2373,15 @@ class Bt {
|
|
|
2374
2373
|
await this.connectionQueueManager.connect(e.getParameters, e.options), d("processConnect success"), this.handleSucceededAttempt(e);
|
|
2375
2374
|
} catch (t) {
|
|
2376
2375
|
if (Nt(t)) {
|
|
2377
|
-
this.handleSucceededAttempt(e);
|
|
2376
|
+
this.attemptsState.finishAttempt(), this.handleSucceededAttempt(e);
|
|
2378
2377
|
return;
|
|
2379
2378
|
}
|
|
2380
2379
|
if (!this.canRetryOnError(t)) {
|
|
2381
|
-
d("processConnect: error does not allow retry", t), this.events.trigger(M.STOP_ATTEMPTS_BY_ERROR, t);
|
|
2380
|
+
d("processConnect: error does not allow retry", t), this.attemptsState.finishAttempt(), this.events.trigger(M.STOP_ATTEMPTS_BY_ERROR, t);
|
|
2382
2381
|
return;
|
|
2383
2382
|
}
|
|
2384
2383
|
if (De(t)) {
|
|
2385
|
-
d("processConnect: not actual error", t), this.events.trigger(M.CANCELLED_ATTEMPTS, t);
|
|
2384
|
+
d("processConnect: not actual error", t), this.attemptsState.finishAttempt(), this.events.trigger(M.CANCELLED_ATTEMPTS, t);
|
|
2386
2385
|
return;
|
|
2387
2386
|
}
|
|
2388
2387
|
d("processConnect: error", t), this.reconnect(e);
|
|
@@ -2410,13 +2409,16 @@ class Bt {
|
|
|
2410
2409
|
reconnect(e) {
|
|
2411
2410
|
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) => {
|
|
2412
2411
|
const s = t instanceof Error ? t : new Error("Failed to reconnect");
|
|
2413
|
-
|
|
2412
|
+
this.attemptsState.finishAttempt(), me(t) || ve(t) ? this.events.trigger(M.CANCELLED_ATTEMPTS, s) : this.events.trigger(M.FAILED_ALL_ATTEMPTS, s), d("reconnect: error", t);
|
|
2414
2413
|
});
|
|
2415
2414
|
}
|
|
2416
2415
|
hasFailedOrDisconnectedConnection() {
|
|
2417
2416
|
const { isFailed: e, isDisconnected: t, isIdle: s } = this.connectionManager;
|
|
2418
2417
|
return e || t || s;
|
|
2419
2418
|
}
|
|
2419
|
+
emitStatusChange = ({ isInProgress: e }) => {
|
|
2420
|
+
this.events.trigger(M.CHANGED_ATTEMPT_STATUS, { isInProgress: e });
|
|
2421
|
+
};
|
|
2420
2422
|
}
|
|
2421
2423
|
var w = /* @__PURE__ */ ((n) => (n.INCOMING_CALL = "incomingCall", n.DECLINED_INCOMING_CALL = "declinedIncomingCall", n.TERMINATED_INCOMING_CALL = "terminatedIncomingCall", n.FAILED_INCOMING_CALL = "failedIncomingCall", n))(w || {});
|
|
2422
2424
|
const Ce = [
|
|
@@ -2678,7 +2680,7 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2678
2680
|
]).then((g) => {
|
|
2679
2681
|
const [
|
|
2680
2682
|
C,
|
|
2681
|
-
|
|
2683
|
+
m,
|
|
2682
2684
|
I,
|
|
2683
2685
|
R,
|
|
2684
2686
|
D,
|
|
@@ -2687,7 +2689,7 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2687
2689
|
return {
|
|
2688
2690
|
synchronizationSources: S,
|
|
2689
2691
|
audioSenderStats: C,
|
|
2690
|
-
videoSenderFirstStats:
|
|
2692
|
+
videoSenderFirstStats: m,
|
|
2691
2693
|
videoSenderSecondStats: I,
|
|
2692
2694
|
audioReceiverStats: R,
|
|
2693
2695
|
videoReceiverFirstStats: D,
|
|
@@ -2975,7 +2977,7 @@ class on {
|
|
|
2975
2977
|
this.taskQueue.stop();
|
|
2976
2978
|
}
|
|
2977
2979
|
}
|
|
2978
|
-
const Ne = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), cn = 1e6,
|
|
2980
|
+
const Ne = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), cn = 1e6, f = (n) => n * cn, Re = f(0.06), Ie = f(4), dn = (n) => n <= 64 ? Re : n <= 128 ? f(0.12) : n <= 256 ? f(0.25) : n <= 384 ? f(0.32) : n <= 426 ? f(0.38) : n <= 640 ? f(0.5) : n <= 848 ? f(0.7) : n <= 1280 ? f(1) : n <= 1920 ? f(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) => {
|
|
2979
2981
|
const t = dn(n);
|
|
2980
2982
|
return Y(t, e);
|
|
2981
2983
|
}, V = 1, Sn = ({
|
|
@@ -3038,14 +3040,14 @@ class Cn {
|
|
|
3038
3040
|
async processSender(e, t) {
|
|
3039
3041
|
const { mainCam: s, resolutionMainCam: i } = e;
|
|
3040
3042
|
switch (s) {
|
|
3041
|
-
case
|
|
3043
|
+
case v.PAUSE_MAIN_CAM:
|
|
3042
3044
|
return this.downgradeResolutionSender(t);
|
|
3043
|
-
case
|
|
3045
|
+
case v.RESUME_MAIN_CAM:
|
|
3044
3046
|
return this.setBitrateByTrackResolution(t);
|
|
3045
|
-
case
|
|
3047
|
+
case v.MAX_MAIN_CAM_RESOLUTION:
|
|
3046
3048
|
return i !== void 0 ? this.setResolutionSender(i, t) : this.setBitrateByTrackResolution(t);
|
|
3047
|
-
case
|
|
3048
|
-
case
|
|
3049
|
+
case v.ADMIN_STOP_MAIN_CAM:
|
|
3050
|
+
case v.ADMIN_START_MAIN_CAM:
|
|
3049
3051
|
case void 0:
|
|
3050
3052
|
return this.setBitrateByTrackResolution(t);
|
|
3051
3053
|
default:
|
|
@@ -3337,11 +3339,11 @@ class pn {
|
|
|
3337
3339
|
this.startBalancingTimer && (clearTimeout(this.startBalancingTimer), this.startBalancingTimer = void 0);
|
|
3338
3340
|
}
|
|
3339
3341
|
}
|
|
3340
|
-
const
|
|
3341
|
-
...
|
|
3342
|
+
const mn = 1e6, _n = Se.map((n) => `auto-connect:${n}`), Mn = ge.map((n) => `connection:${n}`), fn = ie.map((n) => `call:${n}`), vn = 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 = [
|
|
3343
|
+
..._n,
|
|
3342
3344
|
...Mn,
|
|
3343
|
-
...vn,
|
|
3344
3345
|
...fn,
|
|
3346
|
+
...vn,
|
|
3345
3347
|
...Pn,
|
|
3346
3348
|
...On,
|
|
3347
3349
|
...yn,
|
|
@@ -3367,14 +3369,14 @@ class Gn {
|
|
|
3367
3369
|
videoBalancerOptions: i,
|
|
3368
3370
|
autoConnectorOptions: r
|
|
3369
3371
|
} = {}) {
|
|
3370
|
-
this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events = new k(bn), this.connectionManager = new pt({ JsSIP: e }), this.connectionQueueManager = new
|
|
3372
|
+
this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events = new k(bn), this.connectionManager = new pt({ JsSIP: e }), this.connectionQueueManager = new mt({
|
|
3371
3373
|
connectionManager: this.connectionManager
|
|
3372
3374
|
}), this.callManager = new ze(), this.apiManager = new Fe({
|
|
3373
3375
|
connectionManager: this.connectionManager,
|
|
3374
3376
|
callManager: this.callManager
|
|
3375
3377
|
}), this.incomingCallManager = new $t(this.connectionManager), this.presentationManager = new dt({
|
|
3376
3378
|
callManager: this.callManager,
|
|
3377
|
-
maxBitrate:
|
|
3379
|
+
maxBitrate: mn
|
|
3378
3380
|
}), this.statsManager = new zt({
|
|
3379
3381
|
callManager: this.callManager,
|
|
3380
3382
|
apiManager: this.apiManager
|
|
@@ -3607,6 +3609,5 @@ export {
|
|
|
3607
3609
|
sn as i,
|
|
3608
3610
|
d as l,
|
|
3609
3611
|
F as p,
|
|
3610
|
-
It as r,
|
|
3611
3612
|
de as s
|
|
3612
3613
|
};
|