sip-connector 19.2.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-BRWV-qDT.js → @SipConnector-Cr5Qu1ds.js} +92 -90
- package/dist/{@SipConnector-4vrb2RbW.cjs → @SipConnector-Cx-er9n6.cjs} +1 -1
- package/dist/AutoConnectorManager/eventNames.d.ts +12 -8
- package/dist/SipConnector/eventNames.d.ts +1 -1
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
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 _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",
|
|
@@ -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);
|
|
@@ -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",
|
|
@@ -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;
|
|
@@ -1613,7 +1613,7 @@ class St {
|
|
|
1613
1613
|
unsubscribeFromEvents;
|
|
1614
1614
|
actorSubscription;
|
|
1615
1615
|
constructor(e) {
|
|
1616
|
-
this.events = e, this.actor =
|
|
1616
|
+
this.events = e, this.actor = ye(Tt), this.actorSubscription = this.actor.subscribe((t) => {
|
|
1617
1617
|
const s = t.value;
|
|
1618
1618
|
this.stateChangeListeners.forEach((i) => {
|
|
1619
1619
|
i(s);
|
|
@@ -1874,7 +1874,7 @@ const At = (n) => {
|
|
|
1874
1874
|
const e = [];
|
|
1875
1875
|
return n !== void 0 && n !== "" && e.push(`X-Vinteo-Remote: ${n}`), e;
|
|
1876
1876
|
};
|
|
1877
|
-
class
|
|
1877
|
+
class y {
|
|
1878
1878
|
JsSIP;
|
|
1879
1879
|
constructor(e) {
|
|
1880
1880
|
this.JsSIP = e;
|
|
@@ -1919,19 +1919,19 @@ class D {
|
|
|
1919
1919
|
connectionRecoveryMaxInterval: T = 6,
|
|
1920
1920
|
userAgent: S
|
|
1921
1921
|
}) {
|
|
1922
|
-
|
|
1922
|
+
y.validateParametersConnection({
|
|
1923
1923
|
register: a,
|
|
1924
1924
|
password: t,
|
|
1925
1925
|
user: e,
|
|
1926
1926
|
sipServerUrl: r,
|
|
1927
1927
|
sipWebSocketServerURL: s
|
|
1928
1928
|
});
|
|
1929
|
-
const g =
|
|
1929
|
+
const g = y.resolveAuthorizationUser(a, e), C = qe(r), _ = 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: _,
|
|
1935
1935
|
display_name: re(i),
|
|
1936
1936
|
user_agent: S,
|
|
1937
1937
|
sdpSemantics: "unified-plan",
|
|
@@ -1948,7 +1948,7 @@ class D {
|
|
|
1948
1948
|
};
|
|
1949
1949
|
}
|
|
1950
1950
|
createUA({ remoteAddress: e, extraHeaders: t, ...s }) {
|
|
1951
|
-
const i = new this.JsSIP.UA(s), r =
|
|
1951
|
+
const i = new this.JsSIP.UA(s), r = y.buildExtraHeaders(e, t);
|
|
1952
1952
|
return r.length > 0 && i.registrator().setExtraHeaders(r), i;
|
|
1953
1953
|
}
|
|
1954
1954
|
/**
|
|
@@ -1979,7 +1979,7 @@ class pt {
|
|
|
1979
1979
|
configurationManager;
|
|
1980
1980
|
JsSIP;
|
|
1981
1981
|
constructor({ JsSIP: e }) {
|
|
1982
|
-
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({
|
|
1983
1983
|
events: this.events,
|
|
1984
1984
|
getUaProtected: this.getUaProtected
|
|
1985
1985
|
}), this.stateMachine = new St(this.events), this.configurationManager = new ht({
|
|
@@ -2034,7 +2034,7 @@ class pt {
|
|
|
2034
2034
|
return this.stateMachine.state;
|
|
2035
2035
|
}
|
|
2036
2036
|
get isRegistered() {
|
|
2037
|
-
return
|
|
2037
|
+
return y.isRegisteredUA(this.ua);
|
|
2038
2038
|
}
|
|
2039
2039
|
get isRegisterConfig() {
|
|
2040
2040
|
return this.configurationManager.isRegister();
|
|
@@ -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 _t {
|
|
2110
2110
|
connectionManager;
|
|
2111
2111
|
stackPromises = te({
|
|
2112
2112
|
noRunIsNotActual: !0
|
|
@@ -2120,19 +2120,21 @@ class mt {
|
|
|
2120
2120
|
this.stackPromises.stop();
|
|
2121
2121
|
}
|
|
2122
2122
|
}
|
|
2123
|
-
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 || {});
|
|
2124
2124
|
const Se = [
|
|
2125
2125
|
"before-attempt",
|
|
2126
|
-
"
|
|
2127
|
-
"failed-
|
|
2128
|
-
"cancelled-
|
|
2129
|
-
"changed-attempt-status"
|
|
2130
|
-
|
|
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;
|
|
2131
2133
|
class Mt {
|
|
2132
2134
|
events;
|
|
2133
2135
|
countInner = z;
|
|
2134
2136
|
initialCount = z;
|
|
2135
|
-
limitInner =
|
|
2137
|
+
limitInner = mt;
|
|
2136
2138
|
isInProgress = !1;
|
|
2137
2139
|
constructor({ events: e }) {
|
|
2138
2140
|
this.events = e;
|
|
@@ -2162,7 +2164,7 @@ class Mt {
|
|
|
2162
2164
|
this.countInner = this.initialCount, this.finishAttempt();
|
|
2163
2165
|
}
|
|
2164
2166
|
emitStatusChange() {
|
|
2165
|
-
this.events.trigger(
|
|
2167
|
+
this.events.trigger(M.CHANGED_ATTEMPT_STATUS, { isInProgress: this.isInProgress });
|
|
2166
2168
|
}
|
|
2167
2169
|
}
|
|
2168
2170
|
class vt {
|
|
@@ -2181,7 +2183,7 @@ class vt {
|
|
|
2181
2183
|
onSuccessRequest: t,
|
|
2182
2184
|
onFailRequest: s
|
|
2183
2185
|
}) {
|
|
2184
|
-
this.stop(), this.cancelableBeforeRequest = new G(e), this.checkTelephonyByTimeout =
|
|
2186
|
+
this.stop(), this.cancelableBeforeRequest = new G(e), this.checkTelephonyByTimeout = me({
|
|
2185
2187
|
isDontStopOnFail: !0,
|
|
2186
2188
|
requestInterval: this.interval,
|
|
2187
2189
|
request: async () => {
|
|
@@ -2222,7 +2224,7 @@ class Ot {
|
|
|
2222
2224
|
this.pingServerByTimeoutWithFailCalls.stop();
|
|
2223
2225
|
}
|
|
2224
2226
|
}
|
|
2225
|
-
class
|
|
2227
|
+
class yt {
|
|
2226
2228
|
callManager;
|
|
2227
2229
|
pingServerRequester;
|
|
2228
2230
|
disposeCallStatusChange;
|
|
@@ -2249,7 +2251,7 @@ class Dt {
|
|
|
2249
2251
|
this.callManager.isCallActive ? this.pingServerRequester.stop() : this.pingServerRequester.start({ onFailRequest: e });
|
|
2250
2252
|
}
|
|
2251
2253
|
}
|
|
2252
|
-
class
|
|
2254
|
+
class Dt {
|
|
2253
2255
|
connectionManager;
|
|
2254
2256
|
callManager;
|
|
2255
2257
|
isRegistrationFailed = !1;
|
|
@@ -2306,10 +2308,10 @@ class Bt {
|
|
|
2306
2308
|
this.connectionQueueManager = e, this.connectionManager = t, this.onBeforeRetry = r, this.canRetryOnError = a, this.events = new U(Se), this.checkTelephonyRequester = new vt({
|
|
2307
2309
|
connectionManager: t,
|
|
2308
2310
|
interval: i?.checkTelephonyRequestInterval ?? wt
|
|
2309
|
-
}), this.pingServerIfNotActiveCallRequester = new
|
|
2311
|
+
}), this.pingServerIfNotActiveCallRequester = new yt({
|
|
2310
2312
|
connectionManager: t,
|
|
2311
2313
|
callManager: s
|
|
2312
|
-
}), this.registrationFailedOutOfCallSubscriber = new
|
|
2314
|
+
}), this.registrationFailedOutOfCallSubscriber = new Dt({
|
|
2313
2315
|
connectionManager: t,
|
|
2314
2316
|
callManager: s
|
|
2315
2317
|
}), this.attemptsState = new Mt({
|
|
@@ -2361,7 +2363,7 @@ class Bt {
|
|
|
2361
2363
|
});
|
|
2362
2364
|
}
|
|
2363
2365
|
async connect(e) {
|
|
2364
|
-
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()) {
|
|
2365
2367
|
d("connect: isLimitReached!"), this.handleLimitReached(e);
|
|
2366
2368
|
return;
|
|
2367
2369
|
}
|
|
@@ -2376,21 +2378,21 @@ class Bt {
|
|
|
2376
2378
|
return;
|
|
2377
2379
|
}
|
|
2378
2380
|
if (!this.canRetryOnError(t)) {
|
|
2379
|
-
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);
|
|
2380
2382
|
return;
|
|
2381
2383
|
}
|
|
2382
|
-
if (
|
|
2383
|
-
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);
|
|
2384
2386
|
return;
|
|
2385
2387
|
}
|
|
2386
2388
|
d("processConnect: error", t), this.reconnect(e);
|
|
2387
2389
|
}
|
|
2388
2390
|
}
|
|
2389
2391
|
handleLimitReached(e) {
|
|
2390
|
-
this.attemptsState.finishAttempt(), this.events.trigger(
|
|
2392
|
+
this.attemptsState.finishAttempt(), this.events.trigger(M.LIMIT_REACHED_ATTEMPTS, new Error("Limit reached")), this.runCheckTelephony(e);
|
|
2391
2393
|
}
|
|
2392
2394
|
handleSucceededAttempt(e) {
|
|
2393
|
-
d("handleSucceededAttempt"), this.subscribeToConnectTriggers(e), this.events.trigger(
|
|
2395
|
+
d("handleSucceededAttempt"), this.subscribeToConnectTriggers(e), this.events.trigger(M.SUCCESS);
|
|
2394
2396
|
}
|
|
2395
2397
|
subscribeToConnectTriggers(e) {
|
|
2396
2398
|
this.pingServerIfNotActiveCallRequester.start({
|
|
@@ -2403,12 +2405,12 @@ class Bt {
|
|
|
2403
2405
|
}
|
|
2404
2406
|
connectIfDisconnected(e) {
|
|
2405
2407
|
const t = this.hasFailedOrDisconnectedConnection();
|
|
2406
|
-
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));
|
|
2407
2409
|
}
|
|
2408
2410
|
reconnect(e) {
|
|
2409
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) => {
|
|
2410
2412
|
const s = t instanceof Error ? t : new Error("Failed to reconnect");
|
|
2411
|
-
|
|
2413
|
+
_e(t) || fe(t) ? this.events.trigger(M.CANCELLED_ATTEMPTS, s) : this.events.trigger(M.FAILED_ALL_ATTEMPTS, s), d("reconnect: error", t);
|
|
2412
2414
|
});
|
|
2413
2415
|
}
|
|
2414
2416
|
hasFailedOrDisconnectedConnection() {
|
|
@@ -2676,19 +2678,19 @@ const Ee = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2676
2678
|
]).then((g) => {
|
|
2677
2679
|
const [
|
|
2678
2680
|
C,
|
|
2679
|
-
|
|
2681
|
+
_,
|
|
2680
2682
|
I,
|
|
2681
2683
|
R,
|
|
2682
|
-
|
|
2684
|
+
D,
|
|
2683
2685
|
$
|
|
2684
2686
|
] = g;
|
|
2685
2687
|
return {
|
|
2686
2688
|
synchronizationSources: S,
|
|
2687
2689
|
audioSenderStats: C,
|
|
2688
|
-
videoSenderFirstStats:
|
|
2690
|
+
videoSenderFirstStats: _,
|
|
2689
2691
|
videoSenderSecondStats: I,
|
|
2690
2692
|
audioReceiverStats: R,
|
|
2691
|
-
videoReceiverFirstStats:
|
|
2693
|
+
videoReceiverFirstStats: D,
|
|
2692
2694
|
videoReceiverSecondStats: $
|
|
2693
2695
|
};
|
|
2694
2696
|
});
|
|
@@ -2973,7 +2975,7 @@ class on {
|
|
|
2973
2975
|
this.taskQueue.stop();
|
|
2974
2976
|
}
|
|
2975
2977
|
}
|
|
2976
|
-
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) => {
|
|
2977
2979
|
const t = dn(n);
|
|
2978
2980
|
return Y(t, e);
|
|
2979
2981
|
}, V = 1, Sn = ({
|
|
@@ -3036,14 +3038,14 @@ class Cn {
|
|
|
3036
3038
|
async processSender(e, t) {
|
|
3037
3039
|
const { mainCam: s, resolutionMainCam: i } = e;
|
|
3038
3040
|
switch (s) {
|
|
3039
|
-
case
|
|
3041
|
+
case f.PAUSE_MAIN_CAM:
|
|
3040
3042
|
return this.downgradeResolutionSender(t);
|
|
3041
|
-
case
|
|
3043
|
+
case f.RESUME_MAIN_CAM:
|
|
3042
3044
|
return this.setBitrateByTrackResolution(t);
|
|
3043
|
-
case
|
|
3045
|
+
case f.MAX_MAIN_CAM_RESOLUTION:
|
|
3044
3046
|
return i !== void 0 ? this.setResolutionSender(i, t) : this.setBitrateByTrackResolution(t);
|
|
3045
|
-
case
|
|
3046
|
-
case
|
|
3047
|
+
case f.ADMIN_STOP_MAIN_CAM:
|
|
3048
|
+
case f.ADMIN_START_MAIN_CAM:
|
|
3047
3049
|
case void 0:
|
|
3048
3050
|
return this.setBitrateByTrackResolution(t);
|
|
3049
3051
|
default:
|
|
@@ -3335,15 +3337,15 @@ class pn {
|
|
|
3335
3337
|
this.startBalancingTimer && (clearTimeout(this.startBalancingTimer), this.startBalancingTimer = void 0);
|
|
3336
3338
|
}
|
|
3337
3339
|
}
|
|
3338
|
-
const
|
|
3339
|
-
...
|
|
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,
|
|
3340
3342
|
...Mn,
|
|
3341
3343
|
...vn,
|
|
3342
3344
|
...fn,
|
|
3343
3345
|
...Pn,
|
|
3344
3346
|
...On,
|
|
3345
|
-
...
|
|
3346
|
-
...
|
|
3347
|
+
...yn,
|
|
3348
|
+
...Dn
|
|
3347
3349
|
];
|
|
3348
3350
|
class Gn {
|
|
3349
3351
|
events;
|
|
@@ -3365,14 +3367,14 @@ class Gn {
|
|
|
3365
3367
|
videoBalancerOptions: i,
|
|
3366
3368
|
autoConnectorOptions: r
|
|
3367
3369
|
} = {}) {
|
|
3368
|
-
this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events = new k(bn), this.connectionManager = new pt({ JsSIP: e }), this.connectionQueueManager = new
|
|
3370
|
+
this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events = new k(bn), this.connectionManager = new pt({ JsSIP: e }), this.connectionQueueManager = new _t({
|
|
3369
3371
|
connectionManager: this.connectionManager
|
|
3370
3372
|
}), this.callManager = new ze(), this.apiManager = new Fe({
|
|
3371
3373
|
connectionManager: this.connectionManager,
|
|
3372
3374
|
callManager: this.callManager
|
|
3373
3375
|
}), this.incomingCallManager = new $t(this.connectionManager), this.presentationManager = new dt({
|
|
3374
3376
|
callManager: this.callManager,
|
|
3375
|
-
maxBitrate:
|
|
3377
|
+
maxBitrate: _n
|
|
3376
3378
|
}), this.statsManager = new zt({
|
|
3377
3379
|
callManager: this.callManager,
|
|
3378
3380
|
apiManager: this.apiManager
|