sip-connector 19.0.1 → 19.2.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-4vrb2RbW.cjs +1 -0
- package/dist/{@SipConnector-DC8z6npa.js → @SipConnector-BRWV-qDT.js} +228 -229
- package/dist/AutoConnectorManager/@AutoConnectorManager.d.ts +2 -1
- package/dist/AutoConnectorManager/index.d.ts +0 -1
- package/dist/AutoConnectorManager/types.d.ts +1 -0
- 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/UAFactory.d.ts +1 -1
- package/dist/ConnectionManager/eventNames.d.ts +27 -4
- package/dist/ConnectionManager/utils/errors.d.ts +4 -2
- 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 +102 -99
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +53 -55
- package/package.json +14 -14
- package/dist/@SipConnector-eNxG0NqG.cjs +0 -1
- package/dist/AutoConnectorManager/utils/errors.d.ts +0 -2
- package/dist/AutoConnectorManager/utils/index.d.ts +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
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
|
|
5
|
-
import { hasCanceledError as
|
|
6
|
-
import { setup as
|
|
7
|
-
import { createStackPromises as te, isPromiseIsNotActualError as
|
|
3
|
+
import { CancelableRequest as G, isCanceledError as me } from "@krivega/cancelable-promise";
|
|
4
|
+
import { resolveRequesterByTimeout as _e, requesterByTimeoutsWithFailCalls as Me, DelayRequester as ve, hasCanceledError as fe, SetTimeoutRequest as Z } from "@krivega/timeout-requester";
|
|
5
|
+
import { hasCanceledError as Pe, repeatedCallsAsync as ee } from "repeated-calls";
|
|
6
|
+
import { setup as Oe, createActor as De } from "xstate";
|
|
7
|
+
import { createStackPromises as te, isPromiseIsNotActualError as ye } from "stack-promises";
|
|
8
8
|
import "ua-parser-js";
|
|
9
9
|
import "sequent-promises";
|
|
10
|
-
const Q = "sip-connector", d = x(Q),
|
|
10
|
+
const Q = "sip-connector", d = x(Q), Wn = () => {
|
|
11
11
|
x.enable(Q);
|
|
12
|
-
},
|
|
12
|
+
}, Hn = () => {
|
|
13
13
|
x.enable(`-${Q}`);
|
|
14
|
-
},
|
|
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 || {}), f = /* @__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))(f || {}), _ = /* @__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 || {}),
|
|
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 || {}), f = /* @__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))(f || {}), _ = /* @__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",
|
|
@@ -44,7 +44,7 @@ const ne = [
|
|
|
44
44
|
"restart"
|
|
45
45
|
];
|
|
46
46
|
var p = /* @__PURE__ */ ((n) => (n.CHANNELS = "channels", n.WEBCAST_STARTED = "WebcastStarted", n.WEBCAST_STOPPED = "WebcastStopped", n.ACCOUNT_CHANGED = "accountChanged", n.ACCOUNT_DELETED = "accountDeleted", n.ADDED_TO_LIST_MODERATORS = "addedToListModerators", n.REMOVED_FROM_LIST_MODERATORS = "removedFromListModerators", n.ACCEPTING_WORD_REQUEST = "ParticipationRequestAccepted", n.CANCELLING_WORD_REQUEST = "ParticipationRequestRejected", n.MOVE_REQUEST_TO_STREAM = "ParticipantMovedToWebcast", n.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "ConferenceParticipantTokenIssued", n))(p || {});
|
|
47
|
-
class
|
|
47
|
+
class Fe {
|
|
48
48
|
events;
|
|
49
49
|
connectionManager;
|
|
50
50
|
callManager;
|
|
@@ -52,7 +52,7 @@ class ke {
|
|
|
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);
|
|
@@ -150,7 +150,7 @@ class ke {
|
|
|
150
150
|
...e,
|
|
151
151
|
extraHeaders: s
|
|
152
152
|
}).catch((i) => {
|
|
153
|
-
if (
|
|
153
|
+
if (Le(i))
|
|
154
154
|
throw i;
|
|
155
155
|
});
|
|
156
156
|
}
|
|
@@ -460,7 +460,7 @@ class ke {
|
|
|
460
460
|
this.events.trigger(u.RESTART, r);
|
|
461
461
|
};
|
|
462
462
|
}
|
|
463
|
-
var N = /* @__PURE__ */ ((n) => (n.PEER_CONNECTION = "peerconnection", n.CONNECTING = "connecting", n.SENDING = "sending", n.PROGRESS = "progress", n.ACCEPTED = "accepted", n.CONFIRMED = "confirmed", n.ENDED = "ended", n.FAILED = "failed", n.NEW_DTMF = "newDTMF", n.NEW_INFO = "newInfo", n.HOLD = "hold", n.UNHOLD = "unhold", n.MUTED = "muted", n.UNMUTED = "unmuted", n.REINVITE = "reinvite", n.UPDATE = "update", n.REFER = "refer", n.REPLACES = "replaces", n.SDP = "sdp", n.ICE_CANDIDATE = "icecandidate", n.GET_USER_MEDIA_FAILED = "getusermediafailed", n.PEER_CONNECTION_CREATE_OFFER_FAILED = "peerconnection:createofferfailed", n.PEER_CONNECTION_CREATE_ANSWER_FAILED = "peerconnection:createanswerfailed", n.PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED = "peerconnection:setlocaldescriptionfailed", n.PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED = "peerconnection:setremotedescriptionfailed", 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.PEER_CONNECTION_CONFIRMED = "peerconnection:confirmed", n.PEER_CONNECTION_ONTRACK = "peerconnection:ontrack", n.ENDED_FROM_SERVER = "ended:fromserver", n.CALL_STATUS_CHANGED = "call-status-changed", n))(N || {}),
|
|
463
|
+
var N = /* @__PURE__ */ ((n) => (n.PEER_CONNECTION = "peerconnection", n.CONNECTING = "connecting", n.SENDING = "sending", n.PROGRESS = "progress", n.ACCEPTED = "accepted", n.CONFIRMED = "confirmed", n.ENDED = "ended", n.FAILED = "failed", n.NEW_DTMF = "newDTMF", n.NEW_INFO = "newInfo", n.HOLD = "hold", n.UNHOLD = "unhold", n.MUTED = "muted", n.UNMUTED = "unmuted", n.REINVITE = "reinvite", n.UPDATE = "update", n.REFER = "refer", n.REPLACES = "replaces", n.SDP = "sdp", n.ICE_CANDIDATE = "icecandidate", n.GET_USER_MEDIA_FAILED = "getusermediafailed", n.PEER_CONNECTION_CREATE_OFFER_FAILED = "peerconnection:createofferfailed", n.PEER_CONNECTION_CREATE_ANSWER_FAILED = "peerconnection:createanswerfailed", n.PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED = "peerconnection:setlocaldescriptionfailed", n.PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED = "peerconnection:setremotedescriptionfailed", 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.PEER_CONNECTION_CONFIRMED = "peerconnection:confirmed", n.PEER_CONNECTION_ONTRACK = "peerconnection:ontrack", n.ENDED_FROM_SERVER = "ended:fromserver", n.CALL_STATUS_CHANGED = "call-status-changed", n))(N || {}), ke = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))(ke || {});
|
|
464
464
|
const se = [
|
|
465
465
|
"peerconnection",
|
|
466
466
|
"connecting",
|
|
@@ -488,15 +488,15 @@ const se = [
|
|
|
488
488
|
"peerconnection:createanswerfailed",
|
|
489
489
|
"peerconnection:setlocaldescriptionfailed",
|
|
490
490
|
"peerconnection:setremotedescriptionfailed"
|
|
491
|
-
],
|
|
491
|
+
], $e = [
|
|
492
492
|
"peerconnection:confirmed",
|
|
493
493
|
"peerconnection:ontrack",
|
|
494
494
|
"ended:fromserver",
|
|
495
495
|
"call-status-changed"
|
|
496
496
|
], ie = [
|
|
497
497
|
...se,
|
|
498
|
-
|
|
499
|
-
],
|
|
498
|
+
...$e
|
|
499
|
+
], Ve = (n, e) => {
|
|
500
500
|
n.getVideoTracks().forEach((s) => {
|
|
501
501
|
"contentHint" in s && s.contentHint !== e && (s.contentHint = e);
|
|
502
502
|
});
|
|
@@ -508,16 +508,16 @@ const se = [
|
|
|
508
508
|
if (!n || e === "recvonly" && t === "recvonly")
|
|
509
509
|
return;
|
|
510
510
|
const i = t === "recvonly" ? [] : n.getAudioTracks(), r = e === "recvonly" ? [] : n.getVideoTracks(), a = [...i, ...r], o = new MediaStream(a);
|
|
511
|
-
return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" &&
|
|
511
|
+
return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" && Ve(o, s), o;
|
|
512
512
|
};
|
|
513
|
-
function
|
|
513
|
+
function qe(n) {
|
|
514
514
|
return (e) => `sip:${e}@${n}`;
|
|
515
515
|
}
|
|
516
|
-
const
|
|
516
|
+
const We = (n, e) => () => Math.floor(Math.random() * (e - n)) + n, re = (n) => n.trim().replaceAll(" ", "_"), He = We(1e5, 99999999), xe = (n) => n.some((t) => {
|
|
517
517
|
const { kind: s } = t;
|
|
518
518
|
return s === "video";
|
|
519
519
|
});
|
|
520
|
-
class
|
|
520
|
+
class Ge {
|
|
521
521
|
isPendingCall = !1;
|
|
522
522
|
isPendingAnswer = !1;
|
|
523
523
|
rtcSession;
|
|
@@ -529,7 +529,7 @@ class Qe {
|
|
|
529
529
|
}
|
|
530
530
|
}
|
|
531
531
|
var ae = /* @__PURE__ */ ((n) => (n.BYE = "Terminated", n.WEBRTC_ERROR = "WebRTC Error", n.CANCELED = "Canceled", n.REQUEST_TIMEOUT = "Request Timeout", n.REJECTED = "Rejected", n.REDIRECTED = "Redirected", n.UNAVAILABLE = "Unavailable", n.NOT_FOUND = "Not Found", n.ADDRESS_INCOMPLETE = "Address Incomplete", n.INCOMPATIBLE_SDP = "Incompatible SDP", n.BAD_MEDIA_DESCRIPTION = "Bad Media Description", n))(ae || {});
|
|
532
|
-
class
|
|
532
|
+
class Qe {
|
|
533
533
|
remoteStreams = {};
|
|
534
534
|
reset() {
|
|
535
535
|
this.remoteStreams = {};
|
|
@@ -558,8 +558,8 @@ class Ye {
|
|
|
558
558
|
return e.map((t) => this.generateAudioStream(t));
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
|
-
class
|
|
562
|
-
remoteStreamsManager = new
|
|
561
|
+
class Ye extends Ge {
|
|
562
|
+
remoteStreamsManager = new Qe();
|
|
563
563
|
disposers = /* @__PURE__ */ new Set();
|
|
564
564
|
constructor(e) {
|
|
565
565
|
super(e), e.on(N.FAILED, this.handleEnded), e.on(N.ENDED, this.handleEnded);
|
|
@@ -684,7 +684,7 @@ class ze extends Qe {
|
|
|
684
684
|
if (!this.connection)
|
|
685
685
|
return;
|
|
686
686
|
const t = this.connection.getReceivers().map(({ track: s }) => s);
|
|
687
|
-
return
|
|
687
|
+
return xe(t) ? this.remoteStreamsManager.generateStreams(t) : this.remoteStreamsManager.generateAudioStreams(t);
|
|
688
688
|
}
|
|
689
689
|
async replaceMediaStream(e, t) {
|
|
690
690
|
if (!this.rtcSession)
|
|
@@ -753,11 +753,11 @@ class ze extends Qe {
|
|
|
753
753
|
delete this.rtcSession, this.remoteStreamsManager.reset(), this.unsubscribeFromSessionEvents(), this.callConfiguration.number = void 0, this.callConfiguration.answer = !1;
|
|
754
754
|
};
|
|
755
755
|
}
|
|
756
|
-
class
|
|
756
|
+
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;
|
|
@@ -813,39 +813,39 @@ class Xe {
|
|
|
813
813
|
return t !== e && this.events.trigger(N.CALL_STATUS_CHANGED, { isCallActive: t }), t;
|
|
814
814
|
}
|
|
815
815
|
}
|
|
816
|
-
const
|
|
816
|
+
const Xe = (n, e) => (n.degradationPreference = e.degradationPreference, n), Je = (n, e) => {
|
|
817
817
|
n.encodings ??= [];
|
|
818
818
|
for (let t = n.encodings.length; t < e; t += 1)
|
|
819
819
|
n.encodings.push({});
|
|
820
820
|
return n;
|
|
821
|
-
}, oe = (n) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== n,
|
|
822
|
-
if (
|
|
821
|
+
}, oe = (n) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== n, Ke = oe(), je = (n, e) => {
|
|
822
|
+
if (Ke(n, e))
|
|
823
823
|
return n;
|
|
824
|
-
},
|
|
825
|
-
const t = n.maxBitrate, s =
|
|
824
|
+
}, Ze = (n, e) => {
|
|
825
|
+
const t = n.maxBitrate, s = je(e, t);
|
|
826
826
|
return s !== void 0 && (n.maxBitrate = s), n;
|
|
827
|
-
}, ce = 1,
|
|
827
|
+
}, ce = 1, et = oe(
|
|
828
828
|
ce
|
|
829
|
-
),
|
|
829
|
+
), tt = (n, e) => {
|
|
830
830
|
const t = n === void 0 ? void 0 : Math.max(n, ce);
|
|
831
|
-
if (t !== void 0 &&
|
|
831
|
+
if (t !== void 0 && et(
|
|
832
832
|
t,
|
|
833
833
|
e
|
|
834
834
|
))
|
|
835
835
|
return t;
|
|
836
|
-
},
|
|
837
|
-
const t = n.scaleResolutionDownBy, s =
|
|
836
|
+
}, nt = (n, e) => {
|
|
837
|
+
const t = n.scaleResolutionDownBy, s = tt(
|
|
838
838
|
e,
|
|
839
839
|
t
|
|
840
840
|
);
|
|
841
841
|
return s !== void 0 && (n.scaleResolutionDownBy = s), n;
|
|
842
|
-
},
|
|
842
|
+
}, st = (n, e) => {
|
|
843
843
|
const t = e.encodings?.length ?? 0;
|
|
844
|
-
return
|
|
844
|
+
return Je(n, t), n.encodings.forEach((s, i) => {
|
|
845
845
|
const r = (e?.encodings ?? [])[i], a = r?.maxBitrate, o = r?.scaleResolutionDownBy;
|
|
846
|
-
|
|
846
|
+
Ze(s, a), nt(s, o);
|
|
847
847
|
}), n;
|
|
848
|
-
},
|
|
848
|
+
}, it = (n, e) => {
|
|
849
849
|
if (n.codecs?.length !== e.codecs?.length)
|
|
850
850
|
return !0;
|
|
851
851
|
for (let t = 0; t < (n.codecs?.length ?? 0); t++)
|
|
@@ -862,15 +862,15 @@ const Je = (n, e) => (n.degradationPreference = e.degradationPreference, n), Ke
|
|
|
862
862
|
if (JSON.stringify(n.encodings[t]) !== JSON.stringify(e.encodings[t]))
|
|
863
863
|
return !0;
|
|
864
864
|
return n.rtcp?.cname !== e.rtcp?.cname || n.rtcp?.reducedSize !== e.rtcp?.reducedSize || n.degradationPreference !== e.degradationPreference;
|
|
865
|
-
},
|
|
865
|
+
}, rt = async (n, e) => {
|
|
866
866
|
const t = n.getParameters(), s = JSON.parse(
|
|
867
867
|
JSON.stringify(t)
|
|
868
868
|
);
|
|
869
|
-
|
|
870
|
-
const i =
|
|
869
|
+
st(t, e), Xe(t, e);
|
|
870
|
+
const i = it(s, t);
|
|
871
871
|
return i && await n.setParameters(t), { parameters: t, isChanged: i };
|
|
872
872
|
}, de = async (n, e, t) => {
|
|
873
|
-
const { isChanged: s, parameters: i } = await
|
|
873
|
+
const { isChanged: s, parameters: i } = await rt(n, {
|
|
874
874
|
encodings: [
|
|
875
875
|
{
|
|
876
876
|
scaleResolutionDownBy: e.scaleResolutionDownBy,
|
|
@@ -879,8 +879,8 @@ const Je = (n, e) => (n.degradationPreference = e.degradationPreference, n), Ke
|
|
|
879
879
|
]
|
|
880
880
|
});
|
|
881
881
|
return s && t && t(i), { isChanged: s, parameters: i };
|
|
882
|
-
},
|
|
883
|
-
const s =
|
|
882
|
+
}, at = (n, e) => n.find((t) => t.track !== null && e.getTracks().includes(t.track)), ot = async (n, e, t) => {
|
|
883
|
+
const s = at(n, e);
|
|
884
884
|
if (s)
|
|
885
885
|
return de(s, { maxBitrate: t });
|
|
886
886
|
};
|
|
@@ -891,8 +891,8 @@ const he = [
|
|
|
891
891
|
"presentation:end",
|
|
892
892
|
"presentation:ended",
|
|
893
893
|
"presentation:failed"
|
|
894
|
-
],
|
|
895
|
-
class
|
|
894
|
+
], ct = 1, xn = (n) => Pe(n);
|
|
895
|
+
class dt {
|
|
896
896
|
events;
|
|
897
897
|
promisePendingStartPresentation;
|
|
898
898
|
promisePendingStopPresentation;
|
|
@@ -904,7 +904,7 @@ class ht {
|
|
|
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;
|
|
@@ -999,7 +999,7 @@ class ht {
|
|
|
999
999
|
stream: s,
|
|
1000
1000
|
presentationOptions: i,
|
|
1001
1001
|
options: r = {
|
|
1002
|
-
callLimit:
|
|
1002
|
+
callLimit: ct
|
|
1003
1003
|
}
|
|
1004
1004
|
}) {
|
|
1005
1005
|
const a = async () => this.sendPresentation(
|
|
@@ -1043,7 +1043,7 @@ class ht {
|
|
|
1043
1043
|
if (!e || !t || s === void 0)
|
|
1044
1044
|
return;
|
|
1045
1045
|
const i = e.getSenders();
|
|
1046
|
-
await
|
|
1046
|
+
await ot(i, t, s);
|
|
1047
1047
|
};
|
|
1048
1048
|
getRtcSessionProtected = () => {
|
|
1049
1049
|
const e = this.callManager.getEstablishedRTCSession();
|
|
@@ -1064,7 +1064,7 @@ class ht {
|
|
|
1064
1064
|
delete this.streamPresentationCurrent;
|
|
1065
1065
|
}
|
|
1066
1066
|
}
|
|
1067
|
-
class
|
|
1067
|
+
class ht {
|
|
1068
1068
|
data = {};
|
|
1069
1069
|
getUa;
|
|
1070
1070
|
constructor(e) {
|
|
@@ -1137,7 +1137,7 @@ class lt {
|
|
|
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",
|
|
@@ -1148,13 +1148,14 @@ const le = [
|
|
|
1148
1148
|
"registrationFailed",
|
|
1149
1149
|
"newMessage",
|
|
1150
1150
|
"sipEvent"
|
|
1151
|
-
],
|
|
1151
|
+
], lt = [
|
|
1152
1152
|
"disconnecting",
|
|
1153
1153
|
"connect-started",
|
|
1154
1154
|
"connect-succeeded",
|
|
1155
|
-
"connect-failed"
|
|
1156
|
-
|
|
1157
|
-
|
|
1155
|
+
"connect-failed",
|
|
1156
|
+
"connect-parameters-resolve-failed"
|
|
1157
|
+
], ge = [...le, ...lt], gt = 3;
|
|
1158
|
+
class ut {
|
|
1158
1159
|
cancelableConnectWithRepeatedCalls;
|
|
1159
1160
|
JsSIP;
|
|
1160
1161
|
events;
|
|
@@ -1185,22 +1186,22 @@ class Tt {
|
|
|
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
|
};
|
|
1198
1199
|
cancelRequests() {
|
|
1199
1200
|
this.cancelConnectWithRepeatedCalls();
|
|
1200
1201
|
}
|
|
1201
|
-
connectWithDuplicatedCalls = async (e, { callLimit: t =
|
|
1202
|
+
connectWithDuplicatedCalls = async (e, { callLimit: t = gt } = {}) => {
|
|
1202
1203
|
const s = async () => this.connectInner(e), i = (r) => {
|
|
1203
|
-
const c = this.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), h = r != null && !
|
|
1204
|
+
const c = this.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), h = r != null && !Ue(r);
|
|
1204
1205
|
return c || h;
|
|
1205
1206
|
};
|
|
1206
1207
|
return this.stateMachine.startConnect(), this.cancelableConnectWithRepeatedCalls = ee({
|
|
@@ -1272,7 +1273,7 @@ class Tt {
|
|
|
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
|
}), () => {
|
|
@@ -1291,7 +1292,7 @@ class Tt {
|
|
|
1291
1292
|
}
|
|
1292
1293
|
}
|
|
1293
1294
|
var ue = /* @__PURE__ */ ((n) => (n.START_CONNECT = "START_CONNECT", n.START_INIT_UA = "START_INIT_UA", n.UA_CONNECTED = "UA_CONNECTED", n.UA_REGISTERED = "UA_REGISTERED", n.UA_UNREGISTERED = "UA_UNREGISTERED", n.UA_DISCONNECTED = "UA_DISCONNECTED", n.CONNECTION_FAILED = "CONNECTION_FAILED", n.RESET = "RESET", n))(ue || {});
|
|
1294
|
-
const
|
|
1295
|
+
const Tt = Oe({
|
|
1295
1296
|
types: {
|
|
1296
1297
|
context: {},
|
|
1297
1298
|
events: {}
|
|
@@ -1605,14 +1606,14 @@ const St = De({
|
|
|
1605
1606
|
}
|
|
1606
1607
|
}
|
|
1607
1608
|
});
|
|
1608
|
-
class
|
|
1609
|
+
class St {
|
|
1609
1610
|
actor;
|
|
1610
1611
|
stateChangeListeners = /* @__PURE__ */ new Set();
|
|
1611
1612
|
events;
|
|
1612
1613
|
unsubscribeFromEvents;
|
|
1613
1614
|
actorSubscription;
|
|
1614
1615
|
constructor(e) {
|
|
1615
|
-
this.events = e, this.actor =
|
|
1616
|
+
this.events = e, this.actor = De(Tt), this.actorSubscription = this.actor.subscribe((t) => {
|
|
1616
1617
|
const s = t.value;
|
|
1617
1618
|
this.stateChangeListeners.forEach((i) => {
|
|
1618
1619
|
i(s);
|
|
@@ -1767,7 +1768,7 @@ class Ct {
|
|
|
1767
1768
|
};
|
|
1768
1769
|
}
|
|
1769
1770
|
}
|
|
1770
|
-
class
|
|
1771
|
+
class Ct {
|
|
1771
1772
|
events;
|
|
1772
1773
|
getUaProtected;
|
|
1773
1774
|
constructor(e) {
|
|
@@ -1776,13 +1777,13 @@ class Et {
|
|
|
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 Et {
|
|
|
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
|
}), () => {
|
|
@@ -1804,7 +1805,7 @@ class Et {
|
|
|
1804
1805
|
};
|
|
1805
1806
|
}
|
|
1806
1807
|
}
|
|
1807
|
-
class
|
|
1808
|
+
class Et {
|
|
1808
1809
|
uaFactory;
|
|
1809
1810
|
getUaProtected;
|
|
1810
1811
|
constructor(e) {
|
|
@@ -1859,17 +1860,17 @@ class At {
|
|
|
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
|
}
|
|
1872
|
-
const
|
|
1873
|
+
const At = (n) => {
|
|
1873
1874
|
const e = [];
|
|
1874
1875
|
return n !== void 0 && n !== "" && e.push(`X-Vinteo-Remote: ${n}`), e;
|
|
1875
1876
|
};
|
|
@@ -1881,7 +1882,7 @@ class D {
|
|
|
1881
1882
|
static isRegisteredUA(e) {
|
|
1882
1883
|
return !!e && e.isRegistered();
|
|
1883
1884
|
}
|
|
1884
|
-
static
|
|
1885
|
+
static validateParametersConnection({
|
|
1885
1886
|
register: e,
|
|
1886
1887
|
password: t,
|
|
1887
1888
|
user: s,
|
|
@@ -1898,10 +1899,10 @@ class D {
|
|
|
1898
1899
|
throw new Error("user is required for authorized connection");
|
|
1899
1900
|
}
|
|
1900
1901
|
static resolveAuthorizationUser(e, t) {
|
|
1901
|
-
return e && t !== void 0 && t.trim() !== "" ? t.trim() : `${
|
|
1902
|
+
return e && t !== void 0 && t.trim() !== "" ? t.trim() : `${He()}`;
|
|
1902
1903
|
}
|
|
1903
1904
|
static buildExtraHeaders(e, t) {
|
|
1904
|
-
const s = e !== void 0 && e !== "" ?
|
|
1905
|
+
const s = e !== void 0 && e !== "" ? At(e) : [];
|
|
1905
1906
|
return t === void 0 ? s : [...s, ...t];
|
|
1906
1907
|
}
|
|
1907
1908
|
createConfiguration({
|
|
@@ -1918,14 +1919,14 @@ class D {
|
|
|
1918
1919
|
connectionRecoveryMaxInterval: T = 6,
|
|
1919
1920
|
userAgent: S
|
|
1920
1921
|
}) {
|
|
1921
|
-
D.
|
|
1922
|
+
D.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 = D.resolveAuthorizationUser(a, e), C =
|
|
1929
|
+
const g = D.resolveAuthorizationUser(a, e), C = qe(r), m = C(g), I = new this.JsSIP.WebSocketInterface(s);
|
|
1929
1930
|
return {
|
|
1930
1931
|
configuration: {
|
|
1931
1932
|
password: t,
|
|
@@ -1965,8 +1966,8 @@ class D {
|
|
|
1965
1966
|
}), { ua: r, helpers: i };
|
|
1966
1967
|
}
|
|
1967
1968
|
}
|
|
1968
|
-
const Te = "Not ready for connection",
|
|
1969
|
-
class
|
|
1969
|
+
const Te = "Not ready for connection", Nt = (n) => n instanceof Error && n.message === Te, Rt = () => new Error(Te), It = async (n) => typeof n == "function" ? n() : n;
|
|
1970
|
+
class pt {
|
|
1970
1971
|
events;
|
|
1971
1972
|
ua;
|
|
1972
1973
|
socket;
|
|
@@ -1978,15 +1979,15 @@ class mt {
|
|
|
1978
1979
|
configurationManager;
|
|
1979
1980
|
JsSIP;
|
|
1980
1981
|
constructor({ JsSIP: e }) {
|
|
1981
|
-
this.JsSIP = e, this.events = new U(ge), this.uaFactory = new D(e), this.registrationManager = new
|
|
1982
|
+
this.JsSIP = e, this.events = new U(ge), this.uaFactory = new D(e), this.registrationManager = new Ct({
|
|
1982
1983
|
events: this.events,
|
|
1983
1984
|
getUaProtected: this.getUaProtected
|
|
1984
|
-
}), this.stateMachine = new
|
|
1985
|
+
}), this.stateMachine = new St(this.events), this.configurationManager = new ht({
|
|
1985
1986
|
getUa: this.getUa
|
|
1986
|
-
}), this.sipOperations = new
|
|
1987
|
+
}), this.sipOperations = new Et({
|
|
1987
1988
|
uaFactory: this.uaFactory,
|
|
1988
1989
|
getUaProtected: this.getUaProtected
|
|
1989
|
-
}), this.connectionFlow = new
|
|
1990
|
+
}), this.connectionFlow = new ut({
|
|
1990
1991
|
JsSIP: this.JsSIP,
|
|
1991
1992
|
events: this.events,
|
|
1992
1993
|
uaFactory: this.uaFactory,
|
|
@@ -2056,22 +2057,18 @@ class mt {
|
|
|
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
|
}
|
|
@@ -2092,7 +2089,7 @@ class mt {
|
|
|
2092
2089
|
getUa = () => this.ua;
|
|
2093
2090
|
connectWithProcessError = async (e, t) => {
|
|
2094
2091
|
if (!(t?.hasReadyForConnection?.() ?? !0))
|
|
2095
|
-
throw
|
|
2092
|
+
throw Rt();
|
|
2096
2093
|
return this.processConnect(e, t).catch(async (i) => {
|
|
2097
2094
|
const r = i;
|
|
2098
2095
|
return this.disconnect().then(() => {
|
|
@@ -2102,12 +2099,14 @@ class mt {
|
|
|
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 mt {
|
|
2111
2110
|
connectionManager;
|
|
2112
2111
|
stackPromises = te({
|
|
2113
2112
|
noRunIsNotActual: !0
|
|
@@ -2128,12 +2127,12 @@ const Se = [
|
|
|
2128
2127
|
"failed-attempt",
|
|
2129
2128
|
"cancelled-attempt",
|
|
2130
2129
|
"changed-attempt-status"
|
|
2131
|
-
], z = 0,
|
|
2132
|
-
class
|
|
2130
|
+
], z = 0, _t = 30;
|
|
2131
|
+
class Mt {
|
|
2133
2132
|
events;
|
|
2134
2133
|
countInner = z;
|
|
2135
2134
|
initialCount = z;
|
|
2136
|
-
limitInner =
|
|
2135
|
+
limitInner = _t;
|
|
2137
2136
|
isInProgress = !1;
|
|
2138
2137
|
constructor({ events: e }) {
|
|
2139
2138
|
this.events = e;
|
|
@@ -2166,7 +2165,7 @@ class vt {
|
|
|
2166
2165
|
this.events.trigger(O.CHANGED_ATTEMPT_STATUS, { isInProgress: this.isInProgress });
|
|
2167
2166
|
}
|
|
2168
2167
|
}
|
|
2169
|
-
class
|
|
2168
|
+
class vt {
|
|
2170
2169
|
connectionManager;
|
|
2171
2170
|
interval;
|
|
2172
2171
|
checkTelephonyByTimeout = void 0;
|
|
@@ -2182,7 +2181,7 @@ class ft {
|
|
|
2182
2181
|
onSuccessRequest: t,
|
|
2183
2182
|
onFailRequest: s
|
|
2184
2183
|
}) {
|
|
2185
|
-
this.stop(), this.cancelableBeforeRequest = new G(e), this.checkTelephonyByTimeout =
|
|
2184
|
+
this.stop(), this.cancelableBeforeRequest = new G(e), this.checkTelephonyByTimeout = _e({
|
|
2186
2185
|
isDontStopOnFail: !0,
|
|
2187
2186
|
requestInterval: this.interval,
|
|
2188
2187
|
request: async () => {
|
|
@@ -2202,15 +2201,15 @@ class ft {
|
|
|
2202
2201
|
this.checkTelephonyByTimeout?.stop(), this.checkTelephonyByTimeout = void 0, this.cancelableBeforeRequest?.cancelRequest(), this.cancelableBeforeRequest = void 0;
|
|
2203
2202
|
}
|
|
2204
2203
|
}
|
|
2205
|
-
const
|
|
2206
|
-
class
|
|
2204
|
+
const ft = 15e3, Pt = 2;
|
|
2205
|
+
class Ot {
|
|
2207
2206
|
connectionManager;
|
|
2208
2207
|
pingServerByTimeoutWithFailCalls;
|
|
2209
2208
|
constructor({ connectionManager: e }) {
|
|
2210
|
-
this.connectionManager = e, this.pingServerByTimeoutWithFailCalls =
|
|
2209
|
+
this.connectionManager = e, this.pingServerByTimeoutWithFailCalls = Me(Pt, {
|
|
2211
2210
|
whenPossibleRequest: async () => {
|
|
2212
2211
|
},
|
|
2213
|
-
requestInterval:
|
|
2212
|
+
requestInterval: ft,
|
|
2214
2213
|
request: async () => (d("ping"), this.connectionManager.ping().then(() => {
|
|
2215
2214
|
d("ping success");
|
|
2216
2215
|
}))
|
|
@@ -2223,7 +2222,7 @@ class Dt {
|
|
|
2223
2222
|
this.pingServerByTimeoutWithFailCalls.stop();
|
|
2224
2223
|
}
|
|
2225
2224
|
}
|
|
2226
|
-
class
|
|
2225
|
+
class Dt {
|
|
2227
2226
|
callManager;
|
|
2228
2227
|
pingServerRequester;
|
|
2229
2228
|
disposeCallStatusChange;
|
|
@@ -2231,7 +2230,7 @@ class yt {
|
|
|
2231
2230
|
connectionManager: e,
|
|
2232
2231
|
callManager: t
|
|
2233
2232
|
}) {
|
|
2234
|
-
this.callManager = t, this.pingServerRequester = new
|
|
2233
|
+
this.callManager = t, this.pingServerRequester = new Ot({
|
|
2235
2234
|
connectionManager: e
|
|
2236
2235
|
});
|
|
2237
2236
|
}
|
|
@@ -2250,7 +2249,7 @@ class yt {
|
|
|
2250
2249
|
this.callManager.isCallActive ? this.pingServerRequester.stop() : this.pingServerRequester.start({ onFailRequest: e });
|
|
2251
2250
|
}
|
|
2252
2251
|
}
|
|
2253
|
-
class
|
|
2252
|
+
class yt {
|
|
2254
2253
|
connectionManager;
|
|
2255
2254
|
callManager;
|
|
2256
2255
|
isRegistrationFailed = !1;
|
|
@@ -2284,9 +2283,9 @@ class bt {
|
|
|
2284
2283
|
this.isRegistrationFailed = !1;
|
|
2285
2284
|
}
|
|
2286
2285
|
}
|
|
2287
|
-
const
|
|
2288
|
-
};
|
|
2289
|
-
class
|
|
2286
|
+
const bt = 3e3, wt = 15e3, Ut = async () => {
|
|
2287
|
+
}, Lt = (n) => !0;
|
|
2288
|
+
class Bt {
|
|
2290
2289
|
events;
|
|
2291
2290
|
connectionManager;
|
|
2292
2291
|
connectionQueueManager;
|
|
@@ -2297,25 +2296,26 @@ class Ft {
|
|
|
2297
2296
|
delayBetweenAttempts;
|
|
2298
2297
|
cancelableRequestBeforeRetry;
|
|
2299
2298
|
onBeforeRetry;
|
|
2299
|
+
canRetryOnError;
|
|
2300
2300
|
constructor({
|
|
2301
2301
|
connectionQueueManager: e,
|
|
2302
2302
|
connectionManager: t,
|
|
2303
2303
|
callManager: s
|
|
2304
2304
|
}, i) {
|
|
2305
|
-
const r = i?.onBeforeRetry ??
|
|
2306
|
-
this.connectionQueueManager = e, this.connectionManager = t, this.onBeforeRetry = r, this.events = new
|
|
2305
|
+
const r = i?.onBeforeRetry ?? Ut, a = i?.canRetryOnError ?? Lt;
|
|
2306
|
+
this.connectionQueueManager = e, this.connectionManager = t, this.onBeforeRetry = r, this.canRetryOnError = a, this.events = new U(Se), this.checkTelephonyRequester = new vt({
|
|
2307
2307
|
connectionManager: t,
|
|
2308
|
-
interval: i?.checkTelephonyRequestInterval ??
|
|
2309
|
-
}), this.pingServerIfNotActiveCallRequester = new
|
|
2308
|
+
interval: i?.checkTelephonyRequestInterval ?? wt
|
|
2309
|
+
}), this.pingServerIfNotActiveCallRequester = new Dt({
|
|
2310
2310
|
connectionManager: t,
|
|
2311
2311
|
callManager: s
|
|
2312
|
-
}), this.registrationFailedOutOfCallSubscriber = new
|
|
2312
|
+
}), this.registrationFailedOutOfCallSubscriber = new yt({
|
|
2313
2313
|
connectionManager: t,
|
|
2314
2314
|
callManager: s
|
|
2315
|
-
}), this.attemptsState = new
|
|
2315
|
+
}), this.attemptsState = new Mt({
|
|
2316
2316
|
events: this.events
|
|
2317
|
-
}), this.cancelableRequestBeforeRetry = new G(r), this.delayBetweenAttempts = new
|
|
2318
|
-
i?.timeoutBetweenAttempts ??
|
|
2317
|
+
}), this.cancelableRequestBeforeRetry = new G(r), this.delayBetweenAttempts = new ve(
|
|
2318
|
+
i?.timeoutBetweenAttempts ?? bt
|
|
2319
2319
|
);
|
|
2320
2320
|
}
|
|
2321
2321
|
start(e) {
|
|
@@ -2371,15 +2371,15 @@ class Ft {
|
|
|
2371
2371
|
try {
|
|
2372
2372
|
await this.connectionQueueManager.connect(e.getParameters, e.options), d("processConnect success"), this.handleSucceededAttempt(e);
|
|
2373
2373
|
} catch (t) {
|
|
2374
|
-
if (
|
|
2374
|
+
if (Nt(t)) {
|
|
2375
2375
|
this.handleSucceededAttempt(e);
|
|
2376
2376
|
return;
|
|
2377
2377
|
}
|
|
2378
|
-
if (
|
|
2379
|
-
d("processConnect:
|
|
2378
|
+
if (!this.canRetryOnError(t)) {
|
|
2379
|
+
d("processConnect: error does not allow retry", t);
|
|
2380
2380
|
return;
|
|
2381
2381
|
}
|
|
2382
|
-
if (
|
|
2382
|
+
if (ye(t)) {
|
|
2383
2383
|
d("processConnect: not actual error", t), this.events.trigger(O.CANCELLED_ATTEMPT, t);
|
|
2384
2384
|
return;
|
|
2385
2385
|
}
|
|
@@ -2408,7 +2408,7 @@ class Ft {
|
|
|
2408
2408
|
reconnect(e) {
|
|
2409
2409
|
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
2410
|
const s = t instanceof Error ? t : new Error("Failed to reconnect");
|
|
2411
|
-
|
|
2411
|
+
me(t) || fe(t) ? this.events.trigger(O.CANCELLED_ATTEMPT, s) : this.events.trigger(O.FAILED_ATTEMPT, s), d("reconnect: error", t);
|
|
2412
2412
|
});
|
|
2413
2413
|
}
|
|
2414
2414
|
hasFailedOrDisconnectedConnection() {
|
|
@@ -2417,18 +2417,18 @@ class Ft {
|
|
|
2417
2417
|
}
|
|
2418
2418
|
}
|
|
2419
2419
|
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 || {});
|
|
2420
|
-
const
|
|
2420
|
+
const Ce = [
|
|
2421
2421
|
"incomingCall",
|
|
2422
2422
|
"declinedIncomingCall",
|
|
2423
2423
|
"terminatedIncomingCall",
|
|
2424
2424
|
"failedIncomingCall"
|
|
2425
|
-
],
|
|
2426
|
-
class
|
|
2425
|
+
], Ft = 486, kt = 487;
|
|
2426
|
+
class $t {
|
|
2427
2427
|
events;
|
|
2428
2428
|
incomingRTCSession;
|
|
2429
2429
|
connectionManager;
|
|
2430
2430
|
constructor(e) {
|
|
2431
|
-
this.connectionManager = e, this.events = new
|
|
2431
|
+
this.connectionManager = e, this.events = new k(Ce), this.start();
|
|
2432
2432
|
}
|
|
2433
2433
|
get remoteCallerData() {
|
|
2434
2434
|
return {
|
|
@@ -2458,7 +2458,7 @@ class Vt {
|
|
|
2458
2458
|
return this.removeIncomingSession(), e;
|
|
2459
2459
|
};
|
|
2460
2460
|
async declineToIncomingCall({
|
|
2461
|
-
statusCode: e =
|
|
2461
|
+
statusCode: e = kt
|
|
2462
2462
|
} = {}) {
|
|
2463
2463
|
return new Promise((t, s) => {
|
|
2464
2464
|
try {
|
|
@@ -2470,7 +2470,7 @@ class Vt {
|
|
|
2470
2470
|
});
|
|
2471
2471
|
}
|
|
2472
2472
|
async busyIncomingCall() {
|
|
2473
|
-
return this.declineToIncomingCall({ statusCode:
|
|
2473
|
+
return this.declineToIncomingCall({ statusCode: Ft });
|
|
2474
2474
|
}
|
|
2475
2475
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
2476
2476
|
on(e, t) {
|
|
@@ -2515,11 +2515,11 @@ class Vt {
|
|
|
2515
2515
|
}
|
|
2516
2516
|
}
|
|
2517
2517
|
const b = 1e3;
|
|
2518
|
-
var
|
|
2519
|
-
const
|
|
2518
|
+
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 || {});
|
|
2519
|
+
const Ee = ["collected"], X = () => "performance" in window ? performance.now() : Date.now(), L = (n) => [...n.keys()].reduce((e, t) => {
|
|
2520
2520
|
const s = n.get(t);
|
|
2521
2521
|
return s === void 0 ? e : { ...e, [s.type]: s };
|
|
2522
|
-
}, {}),
|
|
2522
|
+
}, {}), Vt = (n) => {
|
|
2523
2523
|
if (!n)
|
|
2524
2524
|
return {
|
|
2525
2525
|
outboundRtp: void 0,
|
|
@@ -2529,10 +2529,10 @@ const Ae = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2529
2529
|
};
|
|
2530
2530
|
const e = L(n);
|
|
2531
2531
|
return {
|
|
2532
|
-
outboundRtp: e[
|
|
2533
|
-
codec: e[
|
|
2534
|
-
mediaSource: e[
|
|
2535
|
-
remoteInboundRtp: e[
|
|
2532
|
+
outboundRtp: e[A.OUTBOUND_RTP],
|
|
2533
|
+
codec: e[A.CODEC],
|
|
2534
|
+
mediaSource: e[A.MEDIA_SOURCE],
|
|
2535
|
+
remoteInboundRtp: e[A.REMOTE_INBOUND_RTP]
|
|
2536
2536
|
};
|
|
2537
2537
|
}, J = (n) => {
|
|
2538
2538
|
if (!n)
|
|
@@ -2544,10 +2544,10 @@ const Ae = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2544
2544
|
};
|
|
2545
2545
|
const e = L(n);
|
|
2546
2546
|
return {
|
|
2547
|
-
outboundRtp: e[
|
|
2548
|
-
codec: e[
|
|
2549
|
-
mediaSource: e[
|
|
2550
|
-
remoteInboundRtp: e[
|
|
2547
|
+
outboundRtp: e[A.OUTBOUND_RTP],
|
|
2548
|
+
codec: e[A.CODEC],
|
|
2549
|
+
mediaSource: e[A.MEDIA_SOURCE],
|
|
2550
|
+
remoteInboundRtp: e[A.REMOTE_INBOUND_RTP]
|
|
2551
2551
|
};
|
|
2552
2552
|
}, K = ({
|
|
2553
2553
|
videoReceiversStats: n,
|
|
@@ -2561,11 +2561,11 @@ const Ae = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2561
2561
|
};
|
|
2562
2562
|
const t = L(n);
|
|
2563
2563
|
return {
|
|
2564
|
-
inboundRtp: t[
|
|
2565
|
-
codec: t[
|
|
2564
|
+
inboundRtp: t[A.INBOUND_RTP],
|
|
2565
|
+
codec: t[A.CODEC],
|
|
2566
2566
|
synchronizationSources: e
|
|
2567
2567
|
};
|
|
2568
|
-
},
|
|
2568
|
+
}, qt = ({
|
|
2569
2569
|
audioReceiverStats: n,
|
|
2570
2570
|
synchronizationSourcesAudio: e
|
|
2571
2571
|
}) => {
|
|
@@ -2578,12 +2578,12 @@ const Ae = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2578
2578
|
};
|
|
2579
2579
|
const t = L(n);
|
|
2580
2580
|
return {
|
|
2581
|
-
inboundRtp: t[
|
|
2582
|
-
codec: t[
|
|
2583
|
-
remoteOutboundRtp: t[
|
|
2581
|
+
inboundRtp: t[A.INBOUND_RTP],
|
|
2582
|
+
codec: t[A.CODEC],
|
|
2583
|
+
remoteOutboundRtp: t[A.REMOTE_OUTBOUND_RTP],
|
|
2584
2584
|
synchronizationSources: e
|
|
2585
2585
|
};
|
|
2586
|
-
},
|
|
2586
|
+
}, Ae = (n) => {
|
|
2587
2587
|
if (!n)
|
|
2588
2588
|
return {
|
|
2589
2589
|
candidatePair: void 0,
|
|
@@ -2594,24 +2594,24 @@ const Ae = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2594
2594
|
};
|
|
2595
2595
|
const e = L(n);
|
|
2596
2596
|
return {
|
|
2597
|
-
candidatePair: e[
|
|
2598
|
-
certificate: e[
|
|
2599
|
-
localCandidate: e[
|
|
2600
|
-
remoteCandidate: e[
|
|
2601
|
-
transport: e[
|
|
2597
|
+
candidatePair: e[A.CANDIDATE_PAIR],
|
|
2598
|
+
certificate: e[A.CERTIFICATE],
|
|
2599
|
+
localCandidate: e[A.LOCAL_CANDIDATE],
|
|
2600
|
+
remoteCandidate: e[A.REMOTE_CANDIDATE],
|
|
2601
|
+
transport: e[A.TRANSPORT]
|
|
2602
2602
|
};
|
|
2603
|
-
},
|
|
2603
|
+
}, Wt = ({
|
|
2604
2604
|
audioSenderStats: n,
|
|
2605
2605
|
videoSenderFirstStats: e,
|
|
2606
2606
|
videoSenderSecondStats: t
|
|
2607
2607
|
}) => ({
|
|
2608
2608
|
video: J(e),
|
|
2609
2609
|
secondVideo: J(t),
|
|
2610
|
-
audio:
|
|
2611
|
-
additional:
|
|
2610
|
+
audio: Vt(n),
|
|
2611
|
+
additional: Ae(
|
|
2612
2612
|
n ?? e ?? t
|
|
2613
2613
|
)
|
|
2614
|
-
}),
|
|
2614
|
+
}), Ht = ({
|
|
2615
2615
|
audioReceiverStats: n,
|
|
2616
2616
|
videoReceiverFirstStats: e,
|
|
2617
2617
|
videoReceiverSecondStats: t,
|
|
@@ -2625,14 +2625,14 @@ const Ae = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2625
2625
|
videoReceiversStats: t,
|
|
2626
2626
|
synchronizationSourcesVideo: s.video
|
|
2627
2627
|
}),
|
|
2628
|
-
audio:
|
|
2628
|
+
audio: qt({
|
|
2629
2629
|
audioReceiverStats: n,
|
|
2630
2630
|
synchronizationSourcesAudio: s.audio
|
|
2631
2631
|
}),
|
|
2632
|
-
additional:
|
|
2632
|
+
additional: Ae(
|
|
2633
2633
|
n ?? e ?? t
|
|
2634
2634
|
)
|
|
2635
|
-
}),
|
|
2635
|
+
}), xt = ({
|
|
2636
2636
|
audioSenderStats: n,
|
|
2637
2637
|
videoSenderFirstStats: e,
|
|
2638
2638
|
videoSenderSecondStats: t,
|
|
@@ -2641,11 +2641,11 @@ const Ae = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2641
2641
|
videoReceiverSecondStats: r,
|
|
2642
2642
|
synchronizationSources: a
|
|
2643
2643
|
}) => {
|
|
2644
|
-
const o =
|
|
2644
|
+
const o = Wt({
|
|
2645
2645
|
audioSenderStats: n,
|
|
2646
2646
|
videoSenderFirstStats: e,
|
|
2647
2647
|
videoSenderSecondStats: t
|
|
2648
|
-
}), c =
|
|
2648
|
+
}), c = Ht({
|
|
2649
2649
|
audioReceiverStats: s,
|
|
2650
2650
|
videoReceiverFirstStats: i,
|
|
2651
2651
|
videoReceiverSecondStats: r,
|
|
@@ -2655,7 +2655,7 @@ const Ae = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2655
2655
|
outbound: o,
|
|
2656
2656
|
inbound: c
|
|
2657
2657
|
};
|
|
2658
|
-
},
|
|
2658
|
+
}, Gt = async (n) => {
|
|
2659
2659
|
const e = "audio", t = "video", s = n.getSenders(), i = s.find((g) => g.track?.kind === e), r = s.filter((g) => g.track?.kind === t), a = n.getReceivers(), o = a.find((g) => g.track.kind === e), c = a.filter((g) => g.track.kind === t), h = {
|
|
2660
2660
|
trackIdentifier: o?.track.id,
|
|
2661
2661
|
item: o?.getSynchronizationSources()[0]
|
|
@@ -2692,22 +2692,22 @@ const Ae = ["collected"], X = () => "performance" in window ? performance.now()
|
|
|
2692
2692
|
videoReceiverSecondStats: $
|
|
2693
2693
|
};
|
|
2694
2694
|
});
|
|
2695
|
-
},
|
|
2695
|
+
}, Qt = (n) => {
|
|
2696
2696
|
d(String(n));
|
|
2697
2697
|
};
|
|
2698
|
-
class
|
|
2698
|
+
class Yt {
|
|
2699
2699
|
events;
|
|
2700
2700
|
setTimeoutRequest;
|
|
2701
|
-
requesterAllStatistics = new G(
|
|
2701
|
+
requesterAllStatistics = new G(Gt);
|
|
2702
2702
|
constructor() {
|
|
2703
|
-
this.events = new
|
|
2703
|
+
this.events = new U(Ee), this.setTimeoutRequest = new Z();
|
|
2704
2704
|
}
|
|
2705
2705
|
get requested() {
|
|
2706
2706
|
return this.setTimeoutRequest.requested;
|
|
2707
2707
|
}
|
|
2708
2708
|
start(e, {
|
|
2709
2709
|
interval: t = b,
|
|
2710
|
-
onError: s =
|
|
2710
|
+
onError: s = Qt
|
|
2711
2711
|
} = {}) {
|
|
2712
2712
|
this.stop(), this.setTimeoutRequest.request(() => {
|
|
2713
2713
|
this.collectStatistics(e, {
|
|
@@ -2738,7 +2738,7 @@ class zt {
|
|
|
2738
2738
|
}) => {
|
|
2739
2739
|
const s = X();
|
|
2740
2740
|
this.requesterAllStatistics.request(e).then((i) => {
|
|
2741
|
-
this.events.trigger("collected",
|
|
2741
|
+
this.events.trigger("collected", xt(i));
|
|
2742
2742
|
const a = X() - s;
|
|
2743
2743
|
let o = b;
|
|
2744
2744
|
a > 48 ? o = b * 4 : a > 32 ? o = b * 3 : a > 16 && (o = b * 2), this.start(e, {
|
|
@@ -2750,7 +2750,7 @@ class zt {
|
|
|
2750
2750
|
});
|
|
2751
2751
|
};
|
|
2752
2752
|
}
|
|
2753
|
-
class
|
|
2753
|
+
class zt {
|
|
2754
2754
|
availableIncomingBitrate;
|
|
2755
2755
|
statsPeerConnection;
|
|
2756
2756
|
callManager;
|
|
@@ -2760,7 +2760,7 @@ class Xt {
|
|
|
2760
2760
|
callManager: e,
|
|
2761
2761
|
apiManager: t
|
|
2762
2762
|
}) {
|
|
2763
|
-
this.callManager = e, this.apiManager = t, this.statsPeerConnection = new
|
|
2763
|
+
this.callManager = e, this.apiManager = t, this.statsPeerConnection = new Yt(), this.subscribe();
|
|
2764
2764
|
}
|
|
2765
2765
|
get events() {
|
|
2766
2766
|
return this.statsPeerConnection.events;
|
|
@@ -2802,26 +2802,26 @@ class Xt {
|
|
|
2802
2802
|
});
|
|
2803
2803
|
}
|
|
2804
2804
|
}
|
|
2805
|
-
const
|
|
2805
|
+
const Xt = (n, e) => n.filter((s) => e.some((i) => i.clockRate === s.clockRate && i.mimeType === s.mimeType && i.channels === s.channels && i.sdpFmtpLine === s.sdpFmtpLine)), Jt = (n) => {
|
|
2806
2806
|
const e = RTCRtpSender.getCapabilities(n), t = RTCRtpReceiver.getCapabilities(n), s = e === null ? [] : e.codecs, i = t === null ? [] : t.codecs;
|
|
2807
|
-
return
|
|
2808
|
-
},
|
|
2807
|
+
return Xt(s, i);
|
|
2808
|
+
}, Kt = (n, e) => e === void 0 || e.length === 0 ? n : n.sort((t, s) => {
|
|
2809
2809
|
const i = e.indexOf(t.mimeType), r = e.indexOf(s.mimeType), a = i === -1 ? Number.MAX_VALUE : i, o = r === -1 ? Number.MAX_VALUE : r;
|
|
2810
2810
|
return a - o;
|
|
2811
|
-
}),
|
|
2811
|
+
}), jt = (n, e) => e === void 0 || e.length === 0 ? n : n.filter((t) => !e.includes(t.mimeType)), Zt = (n, {
|
|
2812
2812
|
preferredMimeTypesVideoCodecs: e,
|
|
2813
2813
|
excludeMimeTypesVideoCodecs: t
|
|
2814
2814
|
}) => {
|
|
2815
2815
|
try {
|
|
2816
2816
|
if (typeof n.setCodecPreferences == "function" && n.sender.track?.kind === "video" && (e !== void 0 && e.length > 0 || t !== void 0 && t.length > 0)) {
|
|
2817
|
-
const s =
|
|
2817
|
+
const s = Jt("video"), i = jt(s, t), r = Kt(i, e);
|
|
2818
2818
|
n.setCodecPreferences(r);
|
|
2819
2819
|
}
|
|
2820
2820
|
} catch (s) {
|
|
2821
2821
|
d("setCodecPreferences error", s);
|
|
2822
2822
|
}
|
|
2823
2823
|
};
|
|
2824
|
-
class
|
|
2824
|
+
class en {
|
|
2825
2825
|
/**
|
|
2826
2826
|
* Хранилище основных transceiver'ов
|
|
2827
2827
|
*/
|
|
@@ -2928,14 +2928,14 @@ class tn {
|
|
|
2928
2928
|
this.clear();
|
|
2929
2929
|
};
|
|
2930
2930
|
}
|
|
2931
|
-
const
|
|
2932
|
-
class
|
|
2931
|
+
const tn = (n) => [...n.keys()].map((e) => n.get(e)), nn = (n, e) => tn(n).find((t) => t?.type === e), sn = async (n) => n.getStats().then((e) => nn(e, "codec")?.mimeType);
|
|
2932
|
+
class rn {
|
|
2933
2933
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
2934
2934
|
async getCodecFromSender(e) {
|
|
2935
|
-
return await
|
|
2935
|
+
return await sn(e) ?? "";
|
|
2936
2936
|
}
|
|
2937
2937
|
}
|
|
2938
|
-
class
|
|
2938
|
+
class an {
|
|
2939
2939
|
stackPromises = te({
|
|
2940
2940
|
noRunIsNotActual: !0
|
|
2941
2941
|
});
|
|
@@ -2960,11 +2960,11 @@ class on {
|
|
|
2960
2960
|
});
|
|
2961
2961
|
}
|
|
2962
2962
|
}
|
|
2963
|
-
class
|
|
2963
|
+
class on {
|
|
2964
2964
|
taskQueue;
|
|
2965
2965
|
onSetParameters;
|
|
2966
2966
|
constructor(e) {
|
|
2967
|
-
this.onSetParameters = e, this.taskQueue = new
|
|
2967
|
+
this.onSetParameters = e, this.taskQueue = new an();
|
|
2968
2968
|
}
|
|
2969
2969
|
async setEncodingsToSender(e, t) {
|
|
2970
2970
|
return this.taskQueue.add(async () => de(e, t, this.onSetParameters));
|
|
@@ -2973,17 +2973,17 @@ class cn {
|
|
|
2973
2973
|
this.taskQueue.stop();
|
|
2974
2974
|
}
|
|
2975
2975
|
}
|
|
2976
|
-
const
|
|
2977
|
-
const t =
|
|
2976
|
+
const Ne = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), cn = 1e6, M = (n) => n * cn, Re = M(0.06), Ie = M(4), dn = (n) => n <= 64 ? Re : n <= 128 ? M(0.12) : n <= 256 ? M(0.25) : n <= 384 ? M(0.32) : n <= 426 ? M(0.38) : n <= 640 ? M(0.5) : n <= 848 ? M(0.7) : n <= 1280 ? M(1) : n <= 1920 ? M(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
|
+
const t = dn(n);
|
|
2978
2978
|
return Y(t, e);
|
|
2979
|
-
}, V = 1,
|
|
2979
|
+
}, V = 1, Sn = ({
|
|
2980
2980
|
videoTrack: n,
|
|
2981
2981
|
targetSize: e
|
|
2982
2982
|
}) => {
|
|
2983
2983
|
const t = n.getSettings(), s = t.width, i = t.height, r = s === void 0 ? V : s / e.width, a = i === void 0 ? V : i / e.height;
|
|
2984
2984
|
return Math.max(r, a, V);
|
|
2985
2985
|
};
|
|
2986
|
-
class
|
|
2986
|
+
class Cn {
|
|
2987
2987
|
ignoreForCodec;
|
|
2988
2988
|
senderFinder;
|
|
2989
2989
|
codecProvider;
|
|
@@ -3016,7 +3016,7 @@ class En {
|
|
|
3016
3016
|
if (!i?.track)
|
|
3017
3017
|
return { ...this.resultNoChanged, sender: i };
|
|
3018
3018
|
const r = await this.codecProvider.getCodecFromSender(i);
|
|
3019
|
-
if (
|
|
3019
|
+
if (Ne(r, this.ignoreForCodec))
|
|
3020
3020
|
return { ...this.resultNoChanged, sender: i };
|
|
3021
3021
|
const { mainCam: a, resolutionMainCam: o } = t ?? {};
|
|
3022
3022
|
return this.processSender(
|
|
@@ -3058,7 +3058,7 @@ class En {
|
|
|
3058
3058
|
async downgradeResolutionSender(e) {
|
|
3059
3059
|
const { sender: t, codec: s } = e, i = {
|
|
3060
3060
|
scaleResolutionDownBy: 200,
|
|
3061
|
-
maxBitrate:
|
|
3061
|
+
maxBitrate: un(s)
|
|
3062
3062
|
};
|
|
3063
3063
|
return this.parametersSetter.setEncodingsToSender(t, i);
|
|
3064
3064
|
}
|
|
@@ -3068,7 +3068,7 @@ class En {
|
|
|
3068
3068
|
* @returns Promise с результатом
|
|
3069
3069
|
*/
|
|
3070
3070
|
async setBitrateByTrackResolution(e) {
|
|
3071
|
-
const { sender: t, videoTrack: s, codec: i } = e, a = s.getSettings().width, o = a === void 0 ?
|
|
3071
|
+
const { sender: t, videoTrack: s, codec: i } = e, a = s.getSettings().width, o = a === void 0 ? Tn(i) : j(a, i);
|
|
3072
3072
|
return this.parametersSetter.setEncodingsToSender(t, {
|
|
3073
3073
|
scaleResolutionDownBy: 1,
|
|
3074
3074
|
maxBitrate: o
|
|
@@ -3084,7 +3084,7 @@ class En {
|
|
|
3084
3084
|
const [s, i] = e.split("x"), { sender: r, videoTrack: a, codec: o } = t, c = {
|
|
3085
3085
|
width: Number(s),
|
|
3086
3086
|
height: Number(i)
|
|
3087
|
-
}, h =
|
|
3087
|
+
}, h = Sn({
|
|
3088
3088
|
videoTrack: a,
|
|
3089
3089
|
targetSize: c
|
|
3090
3090
|
}), T = j(c.width, o), S = {
|
|
@@ -3094,14 +3094,14 @@ class En {
|
|
|
3094
3094
|
return this.parametersSetter.setEncodingsToSender(r, S);
|
|
3095
3095
|
}
|
|
3096
3096
|
}
|
|
3097
|
-
const
|
|
3098
|
-
class
|
|
3097
|
+
const En = (n) => n.find((e) => e.track?.kind === "video");
|
|
3098
|
+
class An {
|
|
3099
3099
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
3100
3100
|
findVideoSender(e) {
|
|
3101
|
-
return
|
|
3101
|
+
return En(e);
|
|
3102
3102
|
}
|
|
3103
3103
|
}
|
|
3104
|
-
class
|
|
3104
|
+
class Nn {
|
|
3105
3105
|
currentSender;
|
|
3106
3106
|
originalReplaceTrack;
|
|
3107
3107
|
lastWidth;
|
|
@@ -3165,7 +3165,7 @@ class Rn {
|
|
|
3165
3165
|
this.setTimeoutRequest.cancelRequest(), this.lastWidth = void 0, this.lastHeight = void 0;
|
|
3166
3166
|
}
|
|
3167
3167
|
}
|
|
3168
|
-
class
|
|
3168
|
+
class Rn {
|
|
3169
3169
|
apiManager;
|
|
3170
3170
|
currentHandler;
|
|
3171
3171
|
constructor(e) {
|
|
@@ -3185,7 +3185,7 @@ class In {
|
|
|
3185
3185
|
this.currentHandler && (this.apiManager.off("main-cam-control", this.currentHandler), this.currentHandler = void 0);
|
|
3186
3186
|
}
|
|
3187
3187
|
}
|
|
3188
|
-
class
|
|
3188
|
+
class In {
|
|
3189
3189
|
eventHandler;
|
|
3190
3190
|
senderBalancer;
|
|
3191
3191
|
parametersSetterWithQueue;
|
|
@@ -3197,16 +3197,16 @@ class pn {
|
|
|
3197
3197
|
onSetParameters: i,
|
|
3198
3198
|
pollIntervalMs: r
|
|
3199
3199
|
} = {}) {
|
|
3200
|
-
this.getConnection = t, this.eventHandler = new
|
|
3200
|
+
this.getConnection = t, this.eventHandler = new Rn(e), this.parametersSetterWithQueue = new on(i), this.senderBalancer = new Cn(
|
|
3201
3201
|
{
|
|
3202
|
-
senderFinder: new
|
|
3203
|
-
codecProvider: new
|
|
3202
|
+
senderFinder: new An(),
|
|
3203
|
+
codecProvider: new rn(),
|
|
3204
3204
|
parametersSetter: this.parametersSetterWithQueue
|
|
3205
3205
|
},
|
|
3206
3206
|
{
|
|
3207
3207
|
ignoreForCodec: s
|
|
3208
3208
|
}
|
|
3209
|
-
), this.trackMonitor = new
|
|
3209
|
+
), this.trackMonitor = new Nn({ pollIntervalMs: r });
|
|
3210
3210
|
}
|
|
3211
3211
|
/**
|
|
3212
3212
|
* Подписывается на события управления главной камерой
|
|
@@ -3251,13 +3251,13 @@ class pn {
|
|
|
3251
3251
|
});
|
|
3252
3252
|
};
|
|
3253
3253
|
}
|
|
3254
|
-
const
|
|
3254
|
+
const pe = [
|
|
3255
3255
|
"balancing-scheduled",
|
|
3256
3256
|
"balancing-started",
|
|
3257
3257
|
"balancing-stopped",
|
|
3258
3258
|
"parameters-updated"
|
|
3259
3259
|
];
|
|
3260
|
-
class
|
|
3260
|
+
class pn {
|
|
3261
3261
|
isBalancingActive = !1;
|
|
3262
3262
|
events;
|
|
3263
3263
|
callManager;
|
|
@@ -3265,7 +3265,7 @@ class mn {
|
|
|
3265
3265
|
videoSendingBalancer;
|
|
3266
3266
|
startBalancingTimer;
|
|
3267
3267
|
constructor(e, t, s = {}) {
|
|
3268
|
-
this.events = new
|
|
3268
|
+
this.events = new U(pe), this.callManager = e, this.balancingStartDelay = s.balancingStartDelay ?? 1e4, this.videoSendingBalancer = new In(
|
|
3269
3269
|
t,
|
|
3270
3270
|
() => e.connection,
|
|
3271
3271
|
{
|
|
@@ -3335,17 +3335,17 @@ class mn {
|
|
|
3335
3335
|
this.startBalancingTimer && (clearTimeout(this.startBalancingTimer), this.startBalancingTimer = void 0);
|
|
3336
3336
|
}
|
|
3337
3337
|
}
|
|
3338
|
-
const
|
|
3338
|
+
const mn = 1e6, _n = 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}`), Dn = Ee.map((n) => `stats:${n}`), yn = pe.map((n) => `video-balancer:${n}`), bn = [
|
|
3339
|
+
..._n,
|
|
3339
3340
|
...Mn,
|
|
3340
3341
|
...vn,
|
|
3341
3342
|
...fn,
|
|
3342
3343
|
...Pn,
|
|
3343
3344
|
...On,
|
|
3344
3345
|
...Dn,
|
|
3345
|
-
...yn
|
|
3346
|
-
...bn
|
|
3346
|
+
...yn
|
|
3347
3347
|
];
|
|
3348
|
-
class
|
|
3348
|
+
class Gn {
|
|
3349
3349
|
events;
|
|
3350
3350
|
connectionManager;
|
|
3351
3351
|
connectionQueueManager;
|
|
@@ -3365,28 +3365,28 @@ class Yn {
|
|
|
3365
3365
|
videoBalancerOptions: i,
|
|
3366
3366
|
autoConnectorOptions: r
|
|
3367
3367
|
} = {}) {
|
|
3368
|
-
this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events = new
|
|
3368
|
+
this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events = new k(bn), this.connectionManager = new pt({ JsSIP: e }), this.connectionQueueManager = new mt({
|
|
3369
3369
|
connectionManager: this.connectionManager
|
|
3370
|
-
}), this.callManager = new
|
|
3370
|
+
}), this.callManager = new ze(), this.apiManager = new Fe({
|
|
3371
3371
|
connectionManager: this.connectionManager,
|
|
3372
3372
|
callManager: this.callManager
|
|
3373
|
-
}), this.incomingCallManager = new
|
|
3373
|
+
}), this.incomingCallManager = new $t(this.connectionManager), this.presentationManager = new dt({
|
|
3374
3374
|
callManager: this.callManager,
|
|
3375
|
-
maxBitrate:
|
|
3376
|
-
}), this.statsManager = new
|
|
3375
|
+
maxBitrate: mn
|
|
3376
|
+
}), this.statsManager = new zt({
|
|
3377
3377
|
callManager: this.callManager,
|
|
3378
3378
|
apiManager: this.apiManager
|
|
3379
|
-
}), this.autoConnectorManager = new
|
|
3379
|
+
}), this.autoConnectorManager = new Bt(
|
|
3380
3380
|
{
|
|
3381
3381
|
connectionQueueManager: this.connectionQueueManager,
|
|
3382
3382
|
connectionManager: this.connectionManager,
|
|
3383
3383
|
callManager: this.callManager
|
|
3384
3384
|
},
|
|
3385
3385
|
r
|
|
3386
|
-
), this.transceiverManager = new
|
|
3386
|
+
), this.transceiverManager = new en({
|
|
3387
3387
|
callManager: this.callManager,
|
|
3388
3388
|
apiManager: this.apiManager
|
|
3389
|
-
}), this.videoSendingBalancerManager = new
|
|
3389
|
+
}), this.videoSendingBalancerManager = new pn(
|
|
3390
3390
|
this.callManager,
|
|
3391
3391
|
this.apiManager,
|
|
3392
3392
|
i
|
|
@@ -3571,7 +3571,7 @@ class Yn {
|
|
|
3571
3571
|
return this.apiManager.askPermissionToEnableCam(...e);
|
|
3572
3572
|
}
|
|
3573
3573
|
setCodecPreferences(e) {
|
|
3574
|
-
|
|
3574
|
+
Zt(e, {
|
|
3575
3575
|
preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
|
|
3576
3576
|
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
3577
3577
|
});
|
|
@@ -3592,20 +3592,19 @@ class Yn {
|
|
|
3592
3592
|
}
|
|
3593
3593
|
export {
|
|
3594
3594
|
ae as E,
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
Qn as j,
|
|
3595
|
+
ke as O,
|
|
3596
|
+
Gn as S,
|
|
3597
|
+
rt as a,
|
|
3598
|
+
Be as b,
|
|
3599
|
+
xn as c,
|
|
3600
|
+
Hn as d,
|
|
3601
|
+
Wn as e,
|
|
3602
|
+
A as f,
|
|
3603
|
+
Yt as g,
|
|
3604
|
+
Nt as h,
|
|
3605
|
+
sn as i,
|
|
3607
3606
|
d as l,
|
|
3608
3607
|
F as p,
|
|
3609
|
-
|
|
3608
|
+
It as r,
|
|
3610
3609
|
de as s
|
|
3611
3610
|
};
|