sip-connector 20.0.0 → 20.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{@SipConnector-D4DfiZRM.js → @SipConnector-VCSf3-Uy.js} +350 -299
- package/dist/@SipConnector-W10AstYR.cjs +1 -0
- package/dist/AutoConnectorManager/@AutoConnectorManager.d.ts +3 -0
- package/dist/AutoConnectorManager/NotActiveCallSubscriber.d.ts +15 -0
- package/dist/AutoConnectorManager/PingServerIfNotActiveCallRequester.d.ts +1 -3
- package/dist/AutoConnectorManager/RegistrationFailedOutOfCallSubscriber.d.ts +1 -1
- package/dist/SipConnector/@SipConnector.d.ts +1 -0
- package/dist/SipConnector/eventNames.d.ts +4 -2
- 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
- package/dist/@SipConnector-CZiURTVf.cjs +0 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { TypedEvents as O } from "events-constructor";
|
|
2
|
-
import
|
|
3
|
-
import { CancelableRequest as x, isCanceledError as
|
|
4
|
-
import { resolveRequesterByTimeout as
|
|
5
|
-
import { hasCanceledError as
|
|
6
|
-
import { setup as
|
|
7
|
-
import { createStackPromises as
|
|
2
|
+
import G from "debug";
|
|
3
|
+
import { CancelableRequest as x, isCanceledError as Oe } from "@krivega/cancelable-promise";
|
|
4
|
+
import { resolveRequesterByTimeout as be, requesterByTimeoutsWithFailCalls as ye, DelayRequester as De, hasCanceledError as we, SetTimeoutRequest as se } from "@krivega/timeout-requester";
|
|
5
|
+
import { hasCanceledError as Ue, repeatedCallsAsync as ie } from "repeated-calls";
|
|
6
|
+
import { setup as Le, createActor as Be } from "xstate";
|
|
7
|
+
import { createStackPromises as re, isPromiseIsNotActualError as Fe } from "stack-promises";
|
|
8
8
|
import "ua-parser-js";
|
|
9
9
|
import "sequent-promises";
|
|
10
|
-
const Q = "sip-connector", h =
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
}, ke = "Error decline with 603",
|
|
15
|
-
var u = /* @__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.AUDIO_ID = "X-WEBRTC-AUDIOID", n))(u || {}), B = /* @__PURE__ */ ((n) => (n.AVAILABLE_SECOND_REMOTE_STREAM = "YOUCANRECEIVECONTENT", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "CONTENTEND", n.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", n))(B || {}),
|
|
16
|
-
const
|
|
10
|
+
const Q = "sip-connector", h = G(Q), jn = () => {
|
|
11
|
+
G.enable(Q);
|
|
12
|
+
}, Zn = () => {
|
|
13
|
+
G.enable(`-${Q}`);
|
|
14
|
+
}, ke = "Error decline with 603", $e = 1006, qe = (n) => typeof n == "object" && n !== null && "code" in n && n.code === $e, He = (n) => n.message === ke;
|
|
15
|
+
var u = /* @__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.AUDIO_ID = "X-WEBRTC-AUDIOID", n))(u || {}), B = /* @__PURE__ */ ((n) => (n.AVAILABLE_SECOND_REMOTE_STREAM = "YOUCANRECEIVECONTENT", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "CONTENTEND", n.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", n))(B || {}), H = /* @__PURE__ */ ((n) => (n.SPECTATOR = "SPECTATOR", n.PARTICIPANT = "PARTICIPANT", n))(H || {}), b = /* @__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))(b || {}), 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 || {}), V = /* @__PURE__ */ ((n) => (n.ADMIN_SYNC_FORCED = "1", n.ADMIN_SYNC_NOT_FORCED = "0", n))(V || {}), We = /* @__PURE__ */ ((n) => (n.AUDIO = "AUDIO", n.VIDEO = "VIDEO", n.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", n))(We || {}), l = /* @__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_SPECTATORS_SYNTHETIC = "participant:move-request-to-spectators-synthetic", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_WITH_AUDIO_ID = "participant:move-request-to-spectators-with-audio-id", 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))(l || {});
|
|
16
|
+
const ae = [
|
|
17
17
|
"participation:accepting-word-request",
|
|
18
18
|
"participation:cancelling-word-request",
|
|
19
19
|
"participant:move-request-to-stream",
|
|
@@ -45,7 +45,7 @@ const re = [
|
|
|
45
45
|
"newDTMF"
|
|
46
46
|
];
|
|
47
47
|
var N = /* @__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))(N || {});
|
|
48
|
-
class
|
|
48
|
+
class Ve {
|
|
49
49
|
events;
|
|
50
50
|
connectionManager;
|
|
51
51
|
callManager;
|
|
@@ -53,7 +53,7 @@ class He {
|
|
|
53
53
|
connectionManager: e,
|
|
54
54
|
callManager: t
|
|
55
55
|
}) {
|
|
56
|
-
this.connectionManager = e, this.callManager = t, this.events = new O(
|
|
56
|
+
this.connectionManager = e, this.callManager = t, this.events = new O(ae), this.subscribe();
|
|
57
57
|
}
|
|
58
58
|
async waitChannels() {
|
|
59
59
|
return this.wait(l.CHANNELS);
|
|
@@ -151,7 +151,7 @@ class He {
|
|
|
151
151
|
...e,
|
|
152
152
|
extraHeaders: s
|
|
153
153
|
}).catch((i) => {
|
|
154
|
-
if (
|
|
154
|
+
if (He(i))
|
|
155
155
|
throw i;
|
|
156
156
|
});
|
|
157
157
|
}
|
|
@@ -261,31 +261,31 @@ class He {
|
|
|
261
261
|
const { request: s } = e, i = s, r = i.getHeader(u.CONTENT_TYPE);
|
|
262
262
|
if (r !== void 0)
|
|
263
263
|
switch (r) {
|
|
264
|
-
case
|
|
264
|
+
case b.ENTER_ROOM: {
|
|
265
265
|
this.triggerEnterRoom(i), this.maybeTriggerChannels(i);
|
|
266
266
|
break;
|
|
267
267
|
}
|
|
268
|
-
case
|
|
268
|
+
case b.NOTIFY: {
|
|
269
269
|
this.maybeHandleNotify(i);
|
|
270
270
|
break;
|
|
271
271
|
}
|
|
272
|
-
case
|
|
272
|
+
case b.SHARE_STATE: {
|
|
273
273
|
this.triggerShareState(i);
|
|
274
274
|
break;
|
|
275
275
|
}
|
|
276
|
-
case
|
|
276
|
+
case b.MAIN_CAM: {
|
|
277
277
|
this.triggerMainCamControl(i);
|
|
278
278
|
break;
|
|
279
279
|
}
|
|
280
|
-
case
|
|
280
|
+
case b.MIC: {
|
|
281
281
|
this.triggerMicControl(i);
|
|
282
282
|
break;
|
|
283
283
|
}
|
|
284
|
-
case
|
|
284
|
+
case b.USE_LICENSE: {
|
|
285
285
|
this.triggerUseLicense(i);
|
|
286
286
|
break;
|
|
287
287
|
}
|
|
288
|
-
case
|
|
288
|
+
case b.PARTICIPANT_STATE: {
|
|
289
289
|
this.maybeTriggerParticipantMoveRequest(i);
|
|
290
290
|
break;
|
|
291
291
|
}
|
|
@@ -415,24 +415,24 @@ class He {
|
|
|
415
415
|
};
|
|
416
416
|
maybeTriggerParticipantMoveRequest = (e) => {
|
|
417
417
|
const t = e.getHeader(u.CONTENT_PARTICIPANT_STATE), s = e.getHeader(u.AUDIO_ID);
|
|
418
|
-
t ===
|
|
418
|
+
t === H.SPECTATOR && (s ? (this.events.trigger(l.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_WITH_AUDIO_ID, {
|
|
419
419
|
audioId: s
|
|
420
420
|
}), this.events.trigger(l.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS, {
|
|
421
421
|
isSynthetic: !1,
|
|
422
422
|
audioId: s
|
|
423
|
-
})) : (this.events.trigger(l.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_SYNTHETIC, {}), this.events.trigger(l.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS, { isSynthetic: !0 }))), t ===
|
|
423
|
+
})) : (this.events.trigger(l.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_SYNTHETIC, {}), this.events.trigger(l.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS, { isSynthetic: !0 }))), t === H.PARTICIPANT && this.events.trigger(l.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS, {});
|
|
424
424
|
};
|
|
425
425
|
triggerMainCamControl = (e) => {
|
|
426
|
-
const t = e.getHeader(u.MAIN_CAM), s = e.getHeader(u.MEDIA_SYNC), i = s ===
|
|
427
|
-
if (t ===
|
|
426
|
+
const t = e.getHeader(u.MAIN_CAM), s = e.getHeader(u.MEDIA_SYNC), i = s === V.ADMIN_SYNC_FORCED;
|
|
427
|
+
if (t === f.ADMIN_START_MAIN_CAM) {
|
|
428
428
|
this.events.trigger(l.ADMIN_START_MAIN_CAM, { isSyncForced: i });
|
|
429
429
|
return;
|
|
430
430
|
}
|
|
431
|
-
if (t ===
|
|
431
|
+
if (t === f.ADMIN_STOP_MAIN_CAM) {
|
|
432
432
|
this.events.trigger(l.ADMIN_STOP_MAIN_CAM, { isSyncForced: i });
|
|
433
433
|
return;
|
|
434
434
|
}
|
|
435
|
-
(t ===
|
|
435
|
+
(t === f.RESUME_MAIN_CAM || t === f.PAUSE_MAIN_CAM) && s !== void 0 && this.events.trigger(l.ADMIN_FORCE_SYNC_MEDIA_STATE, { isSyncForced: i });
|
|
436
436
|
const r = e.getHeader(u.MAIN_CAM_RESOLUTION);
|
|
437
437
|
this.events.trigger(l.MAIN_CAM_CONTROL, {
|
|
438
438
|
mainCam: t,
|
|
@@ -440,8 +440,8 @@ class He {
|
|
|
440
440
|
});
|
|
441
441
|
};
|
|
442
442
|
triggerMicControl = (e) => {
|
|
443
|
-
const t = e.getHeader(u.MIC), i = e.getHeader(u.MEDIA_SYNC) ===
|
|
444
|
-
t ===
|
|
443
|
+
const t = e.getHeader(u.MIC), i = e.getHeader(u.MEDIA_SYNC) === V.ADMIN_SYNC_FORCED;
|
|
444
|
+
t === W.ADMIN_START_MIC ? this.events.trigger(l.ADMIN_START_MIC, { isSyncForced: i }) : t === W.ADMIN_STOP_MIC && this.events.trigger(l.ADMIN_STOP_MIC, { isSyncForced: i });
|
|
445
445
|
};
|
|
446
446
|
triggerUseLicense = (e) => {
|
|
447
447
|
const t = e.getHeader(u.CONTENT_USE_LICENSE);
|
|
@@ -449,7 +449,7 @@ class He {
|
|
|
449
449
|
};
|
|
450
450
|
}
|
|
451
451
|
var R = /* @__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.REMOTE_STREAMS_CHANGED = "remote-streams-changed", n))(R || {}), Ge = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))(Ge || {});
|
|
452
|
-
const
|
|
452
|
+
const oe = [
|
|
453
453
|
"peerconnection",
|
|
454
454
|
"connecting",
|
|
455
455
|
"sending",
|
|
@@ -476,20 +476,20 @@ const ae = [
|
|
|
476
476
|
"peerconnection:createanswerfailed",
|
|
477
477
|
"peerconnection:setlocaldescriptionfailed",
|
|
478
478
|
"peerconnection:setremotedescriptionfailed"
|
|
479
|
-
],
|
|
479
|
+
], xe = [
|
|
480
480
|
"peerconnection:confirmed",
|
|
481
481
|
"peerconnection:ontrack",
|
|
482
482
|
"ended:fromserver",
|
|
483
483
|
"call-status-changed",
|
|
484
484
|
"remote-streams-changed"
|
|
485
|
-
],
|
|
486
|
-
...
|
|
487
|
-
...
|
|
488
|
-
],
|
|
485
|
+
], ce = [
|
|
486
|
+
...oe,
|
|
487
|
+
...xe
|
|
488
|
+
], Qe = (n, e) => {
|
|
489
489
|
n.getVideoTracks().forEach((s) => {
|
|
490
490
|
"contentHint" in s && s.contentHint !== e && (s.contentHint = e);
|
|
491
491
|
});
|
|
492
|
-
},
|
|
492
|
+
}, F = (n, {
|
|
493
493
|
directionVideo: e,
|
|
494
494
|
directionAudio: t,
|
|
495
495
|
contentHint: s
|
|
@@ -497,10 +497,10 @@ const ae = [
|
|
|
497
497
|
if (!n || e === "recvonly" && t === "recvonly")
|
|
498
498
|
return;
|
|
499
499
|
const i = t === "recvonly" ? [] : n.getAudioTracks(), r = e === "recvonly" ? [] : n.getVideoTracks(), a = [...i, ...r], o = new MediaStream(a);
|
|
500
|
-
return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" &&
|
|
500
|
+
return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" && Qe(o, s), o;
|
|
501
501
|
};
|
|
502
|
-
var
|
|
503
|
-
class
|
|
502
|
+
var he = /* @__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))(he || {});
|
|
503
|
+
class Ye {
|
|
504
504
|
events;
|
|
505
505
|
rtcSession;
|
|
506
506
|
disposers = /* @__PURE__ */ new Set();
|
|
@@ -528,11 +528,11 @@ class Qe {
|
|
|
528
528
|
degradationPreference: T,
|
|
529
529
|
sendEncodings: p,
|
|
530
530
|
onAddedTransceiver: v
|
|
531
|
-
}) => new Promise((A,
|
|
532
|
-
this.handleCall().then(A).catch((
|
|
533
|
-
|
|
531
|
+
}) => new Promise((A, y) => {
|
|
532
|
+
this.handleCall().then(A).catch((k) => {
|
|
533
|
+
y(k);
|
|
534
534
|
}), this.rtcSession = e.call(t(s), {
|
|
535
|
-
mediaStream:
|
|
535
|
+
mediaStream: F(i, {
|
|
536
536
|
directionVideo: o,
|
|
537
537
|
directionAudio: c,
|
|
538
538
|
contentHint: d
|
|
@@ -560,7 +560,7 @@ class Qe {
|
|
|
560
560
|
const { rtcSession: e } = this;
|
|
561
561
|
if (e && !e.isEnded())
|
|
562
562
|
return e.terminateAsync({
|
|
563
|
-
cause:
|
|
563
|
+
cause: he.CANCELED
|
|
564
564
|
}).finally(() => {
|
|
565
565
|
this.reset();
|
|
566
566
|
});
|
|
@@ -590,7 +590,7 @@ class Qe {
|
|
|
590
590
|
offerToReceiveAudio: o,
|
|
591
591
|
offerToReceiveVideo: c
|
|
592
592
|
},
|
|
593
|
-
mediaStream:
|
|
593
|
+
mediaStream: F(t, {
|
|
594
594
|
directionVideo: r,
|
|
595
595
|
directionAudio: a,
|
|
596
596
|
contentHint: d
|
|
@@ -609,7 +609,7 @@ class Qe {
|
|
|
609
609
|
async replaceMediaStream(e, t) {
|
|
610
610
|
if (!this.rtcSession)
|
|
611
611
|
throw new Error("No rtcSession established");
|
|
612
|
-
const { contentHint: s } = t ?? {}, i =
|
|
612
|
+
const { contentHint: s } = t ?? {}, i = F(e, { contentHint: s });
|
|
613
613
|
if (i === void 0)
|
|
614
614
|
throw new Error("No preparedMediaStream");
|
|
615
615
|
return this.rtcSession.replaceMediaStream(i, t);
|
|
@@ -647,7 +647,7 @@ class Qe {
|
|
|
647
647
|
});
|
|
648
648
|
subscribeToSessionEvents(e) {
|
|
649
649
|
this.events.eachTriggers((t, s) => {
|
|
650
|
-
const i =
|
|
650
|
+
const i = oe.find((r) => r === s);
|
|
651
651
|
i && (e.on(i, t), this.disposers.add(() => {
|
|
652
652
|
e.off(i, t);
|
|
653
653
|
}));
|
|
@@ -666,7 +666,7 @@ class Qe {
|
|
|
666
666
|
delete this.rtcSession, this.unsubscribeFromSessionEvents(), this.onReset();
|
|
667
667
|
};
|
|
668
668
|
}
|
|
669
|
-
class
|
|
669
|
+
class ze {
|
|
670
670
|
config;
|
|
671
671
|
tools;
|
|
672
672
|
connection;
|
|
@@ -715,18 +715,18 @@ class Ye {
|
|
|
715
715
|
return this.connection.addTransceiver(e, t);
|
|
716
716
|
}
|
|
717
717
|
}
|
|
718
|
-
const
|
|
719
|
-
const t =
|
|
718
|
+
const de = (n) => n.getSettings(), Xe = (n, e) => {
|
|
719
|
+
const t = de(n);
|
|
720
720
|
let s = e;
|
|
721
721
|
s ??= n.label;
|
|
722
722
|
let i = t?.msid;
|
|
723
723
|
return i ??= s, i ??= n.id, i;
|
|
724
|
-
},
|
|
725
|
-
const t =
|
|
724
|
+
}, Je = (n, e) => {
|
|
725
|
+
const t = de(n);
|
|
726
726
|
let s = e;
|
|
727
727
|
return s ??= t?.msid, s ??= n.label, (s && s.length > 0 ? s : void 0) ?? n.id;
|
|
728
728
|
};
|
|
729
|
-
class
|
|
729
|
+
class X {
|
|
730
730
|
participantGroups = /* @__PURE__ */ new Map();
|
|
731
731
|
trackToGroup = /* @__PURE__ */ new Map();
|
|
732
732
|
trackDisposers = /* @__PURE__ */ new Map();
|
|
@@ -739,7 +739,7 @@ class z {
|
|
|
739
739
|
onRemoved: t,
|
|
740
740
|
streamHint: s
|
|
741
741
|
} = {}) {
|
|
742
|
-
const i =
|
|
742
|
+
const i = Je(e, s), r = Xe(e, s);
|
|
743
743
|
if (this.trackToGroup.has(e.id))
|
|
744
744
|
return { isAdded: !1 };
|
|
745
745
|
const a = this.getParticipantGroups(i);
|
|
@@ -801,13 +801,13 @@ class z {
|
|
|
801
801
|
}
|
|
802
802
|
const $ = {
|
|
803
803
|
type: "participant"
|
|
804
|
-
},
|
|
804
|
+
}, Ke = {
|
|
805
805
|
type: "spectator_synthetic"
|
|
806
|
-
},
|
|
806
|
+
}, je = (n) => ({
|
|
807
807
|
type: "spectator",
|
|
808
808
|
recvParams: n
|
|
809
809
|
});
|
|
810
|
-
class
|
|
810
|
+
class M {
|
|
811
811
|
role = $;
|
|
812
812
|
mainManager;
|
|
813
813
|
recvManager;
|
|
@@ -834,10 +834,10 @@ class f {
|
|
|
834
834
|
this.changeRole($);
|
|
835
835
|
}
|
|
836
836
|
setCallRoleSpectatorSynthetic() {
|
|
837
|
-
this.changeRole(
|
|
837
|
+
this.changeRole(Ke);
|
|
838
838
|
}
|
|
839
839
|
setCallRoleSpectator(e) {
|
|
840
|
-
this.changeRole(
|
|
840
|
+
this.changeRole(je(e));
|
|
841
841
|
}
|
|
842
842
|
changeRole(e) {
|
|
843
843
|
const t = this.role;
|
|
@@ -845,7 +845,7 @@ class f {
|
|
|
845
845
|
this.setRole(e);
|
|
846
846
|
return;
|
|
847
847
|
}
|
|
848
|
-
|
|
848
|
+
M.hasSpectator(e) && M.hasSpectator(t) && t.recvParams.audioId !== e.recvParams.audioId && this.setRole(e);
|
|
849
849
|
}
|
|
850
850
|
reset() {
|
|
851
851
|
this.role = $, this.recvManager.reset();
|
|
@@ -854,29 +854,29 @@ class f {
|
|
|
854
854
|
return this.hasSpectator() ? this.recvManager : this.mainManager;
|
|
855
855
|
}
|
|
856
856
|
hasParticipant() {
|
|
857
|
-
return
|
|
857
|
+
return M.hasParticipant(this.role);
|
|
858
858
|
}
|
|
859
859
|
hasSpectatorSynthetic() {
|
|
860
|
-
return
|
|
860
|
+
return M.hasSpectatorSynthetic(this.role);
|
|
861
861
|
}
|
|
862
862
|
hasSpectator() {
|
|
863
|
-
return
|
|
863
|
+
return M.hasSpectator(this.role);
|
|
864
864
|
}
|
|
865
865
|
setRole(e) {
|
|
866
866
|
const t = this.role;
|
|
867
867
|
this.role = e, this.onRoleChanged?.({ previous: t, next: e });
|
|
868
868
|
}
|
|
869
869
|
}
|
|
870
|
-
const
|
|
871
|
-
class
|
|
870
|
+
const J = (n) => n.streams[0]?.id;
|
|
871
|
+
class Ze {
|
|
872
872
|
events;
|
|
873
873
|
isPendingCall = !1;
|
|
874
874
|
isPendingAnswer = !1;
|
|
875
875
|
rtcSession;
|
|
876
876
|
callConfiguration = {};
|
|
877
|
-
mainRemoteStreamsManager = new
|
|
878
|
-
recvRemoteStreamsManager = new
|
|
879
|
-
roleManager = new
|
|
877
|
+
mainRemoteStreamsManager = new X();
|
|
878
|
+
recvRemoteStreamsManager = new X();
|
|
879
|
+
roleManager = new M(
|
|
880
880
|
{ mainManager: this.mainRemoteStreamsManager, recvManager: this.recvRemoteStreamsManager },
|
|
881
881
|
(e) => {
|
|
882
882
|
this.onRoleChanged(e);
|
|
@@ -886,7 +886,7 @@ class je {
|
|
|
886
886
|
recvSession;
|
|
887
887
|
disposeRecvSessionTrackListener;
|
|
888
888
|
constructor() {
|
|
889
|
-
this.events = new O(
|
|
889
|
+
this.events = new O(ce), this.mcuSession = new Ye(this.events, { onReset: this.reset }), this.subscribeCallStatusChange(), this.subscribeMcuRemoteTrackEvents();
|
|
890
890
|
}
|
|
891
891
|
get requested() {
|
|
892
892
|
return this.isPendingCall || this.isPendingAnswer;
|
|
@@ -966,7 +966,7 @@ class je {
|
|
|
966
966
|
}
|
|
967
967
|
subscribeMcuRemoteTrackEvents() {
|
|
968
968
|
this.on(R.PEER_CONNECTION_ONTRACK, (e) => {
|
|
969
|
-
this.addRemoteTrack(this.mainRemoteStreamsManager, e.track,
|
|
969
|
+
this.addRemoteTrack(this.mainRemoteStreamsManager, e.track, J(e));
|
|
970
970
|
});
|
|
971
971
|
}
|
|
972
972
|
addRemoteTrack(e, t, s) {
|
|
@@ -1001,7 +1001,7 @@ class je {
|
|
|
1001
1001
|
}
|
|
1002
1002
|
attachRecvSessionTracks(e) {
|
|
1003
1003
|
const { peerConnection: t } = e, s = (i) => {
|
|
1004
|
-
this.addRemoteTrack(this.recvRemoteStreamsManager, i.track,
|
|
1004
|
+
this.addRemoteTrack(this.recvRemoteStreamsManager, i.track, J(i));
|
|
1005
1005
|
};
|
|
1006
1006
|
t.addEventListener("track", s), this.disposeRecvSessionTrackListener = () => {
|
|
1007
1007
|
t.removeEventListener("track", s);
|
|
@@ -1015,7 +1015,7 @@ class je {
|
|
|
1015
1015
|
const i = {
|
|
1016
1016
|
quality: "high",
|
|
1017
1017
|
audioChannel: e
|
|
1018
|
-
}, r = new
|
|
1018
|
+
}, r = new ze(i, { sendOffer: t });
|
|
1019
1019
|
this.recvSession = r, this.recvRemoteStreamsManager.reset(), this.attachRecvSessionTracks(r), r.call(s).catch(() => {
|
|
1020
1020
|
this.stopRecvSession();
|
|
1021
1021
|
});
|
|
@@ -1027,45 +1027,45 @@ class je {
|
|
|
1027
1027
|
previous: e,
|
|
1028
1028
|
next: t
|
|
1029
1029
|
}) => {
|
|
1030
|
-
if (
|
|
1030
|
+
if (M.hasSpectator(e) && !M.hasSpectator(t) && this.stopRecvSession(), M.hasSpectator(t)) {
|
|
1031
1031
|
const s = t.recvParams;
|
|
1032
1032
|
this.startRecvSession(s.audioId, s.sendOffer);
|
|
1033
1033
|
}
|
|
1034
1034
|
};
|
|
1035
1035
|
}
|
|
1036
|
-
const
|
|
1036
|
+
const et = (n, e) => (n.degradationPreference = e.degradationPreference, n), tt = (n, e) => {
|
|
1037
1037
|
n.encodings ??= [];
|
|
1038
1038
|
for (let t = n.encodings.length; t < e; t += 1)
|
|
1039
1039
|
n.encodings.push({});
|
|
1040
1040
|
return n;
|
|
1041
|
-
},
|
|
1042
|
-
if (
|
|
1041
|
+
}, le = (n) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== n, nt = le(), st = (n, e) => {
|
|
1042
|
+
if (nt(n, e))
|
|
1043
1043
|
return n;
|
|
1044
|
-
},
|
|
1045
|
-
const t = n.maxBitrate, s =
|
|
1044
|
+
}, it = (n, e) => {
|
|
1045
|
+
const t = n.maxBitrate, s = st(e, t);
|
|
1046
1046
|
return s !== void 0 && (n.maxBitrate = s), n;
|
|
1047
|
-
},
|
|
1048
|
-
|
|
1049
|
-
),
|
|
1050
|
-
const t = n === void 0 ? void 0 : Math.max(n,
|
|
1051
|
-
if (t !== void 0 &&
|
|
1047
|
+
}, ue = 1, rt = le(
|
|
1048
|
+
ue
|
|
1049
|
+
), at = (n, e) => {
|
|
1050
|
+
const t = n === void 0 ? void 0 : Math.max(n, ue);
|
|
1051
|
+
if (t !== void 0 && rt(
|
|
1052
1052
|
t,
|
|
1053
1053
|
e
|
|
1054
1054
|
))
|
|
1055
1055
|
return t;
|
|
1056
|
-
},
|
|
1057
|
-
const t = n.scaleResolutionDownBy, s =
|
|
1056
|
+
}, ot = (n, e) => {
|
|
1057
|
+
const t = n.scaleResolutionDownBy, s = at(
|
|
1058
1058
|
e,
|
|
1059
1059
|
t
|
|
1060
1060
|
);
|
|
1061
1061
|
return s !== void 0 && (n.scaleResolutionDownBy = s), n;
|
|
1062
|
-
},
|
|
1062
|
+
}, ct = (n, e) => {
|
|
1063
1063
|
const t = e.encodings?.length ?? 0;
|
|
1064
|
-
return
|
|
1064
|
+
return tt(n, t), n.encodings.forEach((s, i) => {
|
|
1065
1065
|
const r = (e?.encodings ?? [])[i], a = r?.maxBitrate, o = r?.scaleResolutionDownBy;
|
|
1066
|
-
|
|
1066
|
+
it(s, a), ot(s, o);
|
|
1067
1067
|
}), n;
|
|
1068
|
-
},
|
|
1068
|
+
}, ht = (n, e) => {
|
|
1069
1069
|
if (n.codecs?.length !== e.codecs?.length)
|
|
1070
1070
|
return !0;
|
|
1071
1071
|
for (let t = 0; t < (n.codecs?.length ?? 0); t++)
|
|
@@ -1082,15 +1082,15 @@ const Ze = (n, e) => (n.degradationPreference = e.degradationPreference, n), et
|
|
|
1082
1082
|
if (JSON.stringify(n.encodings[t]) !== JSON.stringify(e.encodings[t]))
|
|
1083
1083
|
return !0;
|
|
1084
1084
|
return n.rtcp?.cname !== e.rtcp?.cname || n.rtcp?.reducedSize !== e.rtcp?.reducedSize || n.degradationPreference !== e.degradationPreference;
|
|
1085
|
-
},
|
|
1085
|
+
}, dt = async (n, e) => {
|
|
1086
1086
|
const t = n.getParameters(), s = JSON.parse(
|
|
1087
1087
|
JSON.stringify(t)
|
|
1088
1088
|
);
|
|
1089
|
-
|
|
1090
|
-
const i =
|
|
1089
|
+
ct(t, e), et(t, e);
|
|
1090
|
+
const i = ht(s, t);
|
|
1091
1091
|
return i && await n.setParameters(t), { parameters: t, isChanged: i };
|
|
1092
|
-
},
|
|
1093
|
-
const { isChanged: s, parameters: i } = await
|
|
1092
|
+
}, ge = async (n, e, t) => {
|
|
1093
|
+
const { isChanged: s, parameters: i } = await dt(n, {
|
|
1094
1094
|
encodings: [
|
|
1095
1095
|
{
|
|
1096
1096
|
scaleResolutionDownBy: e.scaleResolutionDownBy,
|
|
@@ -1099,20 +1099,20 @@ const Ze = (n, e) => (n.degradationPreference = e.degradationPreference, n), et
|
|
|
1099
1099
|
]
|
|
1100
1100
|
});
|
|
1101
1101
|
return s && t && t(i), { isChanged: s, parameters: i };
|
|
1102
|
-
},
|
|
1103
|
-
const s =
|
|
1102
|
+
}, lt = (n, e) => n.find((t) => t.track !== null && e.getTracks().includes(t.track)), ut = async (n, e, t) => {
|
|
1103
|
+
const s = lt(n, e);
|
|
1104
1104
|
if (s)
|
|
1105
|
-
return
|
|
1105
|
+
return ge(s, { maxBitrate: t });
|
|
1106
1106
|
};
|
|
1107
1107
|
var P = /* @__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))(P || {});
|
|
1108
|
-
const
|
|
1108
|
+
const Te = [
|
|
1109
1109
|
"presentation:start",
|
|
1110
1110
|
"presentation:started",
|
|
1111
1111
|
"presentation:end",
|
|
1112
1112
|
"presentation:ended",
|
|
1113
1113
|
"presentation:failed"
|
|
1114
|
-
],
|
|
1115
|
-
class
|
|
1114
|
+
], gt = 1, es = (n) => Ue(n);
|
|
1115
|
+
class Tt {
|
|
1116
1116
|
events;
|
|
1117
1117
|
promisePendingStartPresentation;
|
|
1118
1118
|
promisePendingStopPresentation;
|
|
@@ -1124,7 +1124,7 @@ class gt {
|
|
|
1124
1124
|
callManager: e,
|
|
1125
1125
|
maxBitrate: t
|
|
1126
1126
|
}) {
|
|
1127
|
-
this.callManager = e, this.maxBitrate = t, this.events = new O(
|
|
1127
|
+
this.callManager = e, this.maxBitrate = t, this.events = new O(Te), this.subscribe();
|
|
1128
1128
|
}
|
|
1129
1129
|
get isPendingPresentation() {
|
|
1130
1130
|
return !!this.promisePendingStartPresentation || !!this.promisePendingStopPresentation;
|
|
@@ -1216,7 +1216,7 @@ class gt {
|
|
|
1216
1216
|
stream: s,
|
|
1217
1217
|
presentationOptions: i,
|
|
1218
1218
|
options: r = {
|
|
1219
|
-
callLimit:
|
|
1219
|
+
callLimit: gt
|
|
1220
1220
|
}
|
|
1221
1221
|
}) {
|
|
1222
1222
|
const a = async () => this.sendPresentation(
|
|
@@ -1225,7 +1225,7 @@ class gt {
|
|
|
1225
1225
|
s,
|
|
1226
1226
|
i
|
|
1227
1227
|
), o = () => !!this.streamPresentationCurrent;
|
|
1228
|
-
return this.cancelableSendPresentationWithRepeatedCalls =
|
|
1228
|
+
return this.cancelableSendPresentationWithRepeatedCalls = ie({
|
|
1229
1229
|
targetFunction: a,
|
|
1230
1230
|
isComplete: o,
|
|
1231
1231
|
isRejectAsValid: !0,
|
|
@@ -1240,7 +1240,7 @@ class gt {
|
|
|
1240
1240
|
sendEncodings: o,
|
|
1241
1241
|
onAddedTransceiver: c
|
|
1242
1242
|
}) {
|
|
1243
|
-
const d =
|
|
1243
|
+
const d = F(s, { contentHint: r });
|
|
1244
1244
|
if (d === void 0)
|
|
1245
1245
|
throw new Error("No streamPresentationTarget");
|
|
1246
1246
|
this.streamPresentationCurrent = d;
|
|
@@ -1262,7 +1262,7 @@ class gt {
|
|
|
1262
1262
|
if (!e || !t || s === void 0)
|
|
1263
1263
|
return;
|
|
1264
1264
|
const i = e.getSenders();
|
|
1265
|
-
await
|
|
1265
|
+
await ut(i, t, s);
|
|
1266
1266
|
};
|
|
1267
1267
|
getRtcSessionProtected = () => {
|
|
1268
1268
|
const e = this.callManager.getEstablishedRTCSession();
|
|
@@ -1283,7 +1283,7 @@ class gt {
|
|
|
1283
1283
|
delete this.streamPresentationCurrent;
|
|
1284
1284
|
}
|
|
1285
1285
|
}
|
|
1286
|
-
class
|
|
1286
|
+
class St {
|
|
1287
1287
|
data;
|
|
1288
1288
|
getUa;
|
|
1289
1289
|
constructor(e) {
|
|
@@ -1370,7 +1370,7 @@ class Tt {
|
|
|
1370
1370
|
}
|
|
1371
1371
|
}
|
|
1372
1372
|
var C = /* @__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_SUCCESS = "connect-parameters-resolve-success", n.CONNECT_PARAMETERS_RESOLVE_FAILED = "connect-parameters-resolve-failed", n.CONNECTED_WITH_CONFIGURATION = "connected-with-configuration", n))(C || {});
|
|
1373
|
-
const
|
|
1373
|
+
const Se = [
|
|
1374
1374
|
"connecting",
|
|
1375
1375
|
"connected",
|
|
1376
1376
|
"disconnected",
|
|
@@ -1380,7 +1380,7 @@ const Te = [
|
|
|
1380
1380
|
"registrationFailed",
|
|
1381
1381
|
"newMessage",
|
|
1382
1382
|
"sipEvent"
|
|
1383
|
-
],
|
|
1383
|
+
], Ct = [
|
|
1384
1384
|
"disconnecting",
|
|
1385
1385
|
"connect-started",
|
|
1386
1386
|
"connect-succeeded",
|
|
@@ -1388,12 +1388,12 @@ const Te = [
|
|
|
1388
1388
|
"connect-parameters-resolve-success",
|
|
1389
1389
|
"connect-parameters-resolve-failed",
|
|
1390
1390
|
"connected-with-configuration"
|
|
1391
|
-
],
|
|
1392
|
-
function
|
|
1391
|
+
], Ce = [...Se, ...Ct];
|
|
1392
|
+
function Et(n) {
|
|
1393
1393
|
return (e) => `sip:${e}@${n}`;
|
|
1394
1394
|
}
|
|
1395
|
-
const
|
|
1396
|
-
class
|
|
1395
|
+
const pt = (n, e) => () => Math.floor(Math.random() * (e - n)) + n, Ee = (n) => n.trim().replaceAll(" ", "_"), Rt = pt(1e5, 99999999), At = 3;
|
|
1396
|
+
class Nt {
|
|
1397
1397
|
cancelableConnectWithRepeatedCalls;
|
|
1398
1398
|
JsSIP;
|
|
1399
1399
|
events;
|
|
@@ -1419,7 +1419,7 @@ class At {
|
|
|
1419
1419
|
}
|
|
1420
1420
|
let r = !1;
|
|
1421
1421
|
const a = this.getConnectionConfiguration();
|
|
1422
|
-
e !== void 0 && e !== a?.displayName && (r = i.set("display_name",
|
|
1422
|
+
e !== void 0 && e !== a?.displayName && (r = i.set("display_name", Ee(e)), this.updateConnectionConfiguration("displayName", e));
|
|
1423
1423
|
const o = r;
|
|
1424
1424
|
o ? t(o) : s(new Error("nothing changed"));
|
|
1425
1425
|
});
|
|
@@ -1437,12 +1437,12 @@ class At {
|
|
|
1437
1437
|
cancelRequests() {
|
|
1438
1438
|
this.cancelConnectWithRepeatedCalls();
|
|
1439
1439
|
}
|
|
1440
|
-
connectWithDuplicatedCalls = async (e, { callLimit: t =
|
|
1440
|
+
connectWithDuplicatedCalls = async (e, { callLimit: t = At } = {}) => {
|
|
1441
1441
|
const s = async () => this.connectInner(e), i = (r) => {
|
|
1442
|
-
const c = this.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), d = r != null &&
|
|
1442
|
+
const c = this.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), d = r != null && !qe(r);
|
|
1443
1443
|
return c || d;
|
|
1444
1444
|
};
|
|
1445
|
-
return this.stateMachine.startConnect(), this.cancelableConnectWithRepeatedCalls =
|
|
1445
|
+
return this.stateMachine.startConnect(), this.cancelableConnectWithRepeatedCalls = ie({
|
|
1446
1446
|
targetFunction: s,
|
|
1447
1447
|
isComplete: i,
|
|
1448
1448
|
callLimit: t,
|
|
@@ -1490,7 +1490,7 @@ class At {
|
|
|
1490
1490
|
user: e,
|
|
1491
1491
|
password: t
|
|
1492
1492
|
}), this.getUa() && await this.disconnect();
|
|
1493
|
-
const { ua: A, helpers:
|
|
1493
|
+
const { ua: A, helpers: y } = this.uaFactory.createUAWithConfiguration(
|
|
1494
1494
|
{
|
|
1495
1495
|
user: e,
|
|
1496
1496
|
password: t,
|
|
@@ -1508,7 +1508,7 @@ class At {
|
|
|
1508
1508
|
},
|
|
1509
1509
|
this.events
|
|
1510
1510
|
);
|
|
1511
|
-
return this.setUa(A), this.setGetUri(
|
|
1511
|
+
return this.setUa(A), this.setGetUri(y.getUri), this.setSocket(y.socket), A;
|
|
1512
1512
|
};
|
|
1513
1513
|
start = async () => new Promise((e, t) => {
|
|
1514
1514
|
const s = this.getUa();
|
|
@@ -1547,8 +1547,8 @@ class At {
|
|
|
1547
1547
|
});
|
|
1548
1548
|
}
|
|
1549
1549
|
}
|
|
1550
|
-
var
|
|
1551
|
-
const
|
|
1550
|
+
var pe = /* @__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))(pe || {});
|
|
1551
|
+
const mt = Le({
|
|
1552
1552
|
types: {
|
|
1553
1553
|
context: {},
|
|
1554
1554
|
events: {}
|
|
@@ -1862,14 +1862,14 @@ const Nt = Ue({
|
|
|
1862
1862
|
}
|
|
1863
1863
|
}
|
|
1864
1864
|
});
|
|
1865
|
-
class
|
|
1865
|
+
class It {
|
|
1866
1866
|
actor;
|
|
1867
1867
|
stateChangeListeners = /* @__PURE__ */ new Set();
|
|
1868
1868
|
events;
|
|
1869
1869
|
unsubscribeFromEvents;
|
|
1870
1870
|
actorSubscription;
|
|
1871
1871
|
constructor(e) {
|
|
1872
|
-
this.events = e, this.actor =
|
|
1872
|
+
this.events = e, this.actor = Be(mt), this.actorSubscription = this.actor.subscribe((t) => {
|
|
1873
1873
|
const s = t.value;
|
|
1874
1874
|
this.stateChangeListeners.forEach((i) => {
|
|
1875
1875
|
i(s);
|
|
@@ -1955,7 +1955,7 @@ class mt {
|
|
|
1955
1955
|
return this.actor.getSnapshot().can({ type: e });
|
|
1956
1956
|
}
|
|
1957
1957
|
getValidEvents() {
|
|
1958
|
-
return Object.values(
|
|
1958
|
+
return Object.values(pe).filter((e) => this.canTransition(e));
|
|
1959
1959
|
}
|
|
1960
1960
|
hasState(e) {
|
|
1961
1961
|
return this.actor.getSnapshot().matches(e);
|
|
@@ -2024,7 +2024,7 @@ class mt {
|
|
|
2024
2024
|
};
|
|
2025
2025
|
}
|
|
2026
2026
|
}
|
|
2027
|
-
class
|
|
2027
|
+
class _t {
|
|
2028
2028
|
events;
|
|
2029
2029
|
getUaProtected;
|
|
2030
2030
|
constructor(e) {
|
|
@@ -2061,7 +2061,7 @@ class It {
|
|
|
2061
2061
|
};
|
|
2062
2062
|
}
|
|
2063
2063
|
}
|
|
2064
|
-
class
|
|
2064
|
+
class ft {
|
|
2065
2065
|
uaFactory;
|
|
2066
2066
|
getUaProtected;
|
|
2067
2067
|
constructor(e) {
|
|
@@ -2130,7 +2130,7 @@ const Mt = (n) => {
|
|
|
2130
2130
|
const e = [];
|
|
2131
2131
|
return n !== void 0 && n !== "" && e.push(`X-Vinteo-Remote: ${n}`), e;
|
|
2132
2132
|
};
|
|
2133
|
-
class
|
|
2133
|
+
class D {
|
|
2134
2134
|
JsSIP;
|
|
2135
2135
|
constructor(e) {
|
|
2136
2136
|
this.JsSIP = e;
|
|
@@ -2155,7 +2155,7 @@ class b {
|
|
|
2155
2155
|
throw new Error("user is required for authorized connection");
|
|
2156
2156
|
}
|
|
2157
2157
|
static resolveAuthorizationUser(e, t) {
|
|
2158
|
-
return e && t !== void 0 && t.trim() !== "" ? t.trim() : `${
|
|
2158
|
+
return e && t !== void 0 && t.trim() !== "" ? t.trim() : `${Rt()}`;
|
|
2159
2159
|
}
|
|
2160
2160
|
static buildExtraHeaders(e, t) {
|
|
2161
2161
|
const s = e !== void 0 && e !== "" ? Mt(e) : [];
|
|
@@ -2175,20 +2175,20 @@ class b {
|
|
|
2175
2175
|
connectionRecoveryMaxInterval: S = 6,
|
|
2176
2176
|
userAgent: g
|
|
2177
2177
|
}) {
|
|
2178
|
-
|
|
2178
|
+
D.validateParametersConnection({
|
|
2179
2179
|
register: a,
|
|
2180
2180
|
password: t,
|
|
2181
2181
|
user: e,
|
|
2182
2182
|
sipServerIp: r,
|
|
2183
2183
|
sipServerUrl: s
|
|
2184
2184
|
});
|
|
2185
|
-
const T =
|
|
2185
|
+
const T = D.resolveAuthorizationUser(a, e), p = Et(r), v = p(T), A = new this.JsSIP.WebSocketInterface(`wss://${s}/webrtc/wss/`);
|
|
2186
2186
|
return {
|
|
2187
2187
|
configuration: {
|
|
2188
2188
|
password: t,
|
|
2189
2189
|
register: a,
|
|
2190
2190
|
uri: v,
|
|
2191
|
-
display_name:
|
|
2191
|
+
display_name: Ee(i),
|
|
2192
2192
|
user_agent: g,
|
|
2193
2193
|
sdpSemantics: "unified-plan",
|
|
2194
2194
|
sockets: [A],
|
|
@@ -2204,7 +2204,7 @@ class b {
|
|
|
2204
2204
|
};
|
|
2205
2205
|
}
|
|
2206
2206
|
createUA({ remoteAddress: e, extraHeaders: t, ...s }) {
|
|
2207
|
-
const i = new this.JsSIP.UA(s), r =
|
|
2207
|
+
const i = new this.JsSIP.UA(s), r = D.buildExtraHeaders(e, t);
|
|
2208
2208
|
return r.length > 0 && i.registrator().setExtraHeaders(r), i;
|
|
2209
2209
|
}
|
|
2210
2210
|
/**
|
|
@@ -2217,13 +2217,13 @@ class b {
|
|
|
2217
2217
|
extraHeaders: e.extraHeaders
|
|
2218
2218
|
});
|
|
2219
2219
|
return t.eachTriggers((a, o) => {
|
|
2220
|
-
const c =
|
|
2220
|
+
const c = Se.find((d) => d === o);
|
|
2221
2221
|
c && r.on(c, a);
|
|
2222
2222
|
}), { ua: r, helpers: i };
|
|
2223
2223
|
}
|
|
2224
2224
|
}
|
|
2225
|
-
const
|
|
2226
|
-
class
|
|
2225
|
+
const Re = "Not ready for connection", vt = (n) => n instanceof Error && n.message === Re, Pt = () => new Error(Re), Ot = async (n) => typeof n == "function" ? n() : n;
|
|
2226
|
+
class bt {
|
|
2227
2227
|
events;
|
|
2228
2228
|
ua;
|
|
2229
2229
|
socket;
|
|
@@ -2235,15 +2235,15 @@ class Ot {
|
|
|
2235
2235
|
configurationManager;
|
|
2236
2236
|
JsSIP;
|
|
2237
2237
|
constructor({ JsSIP: e }) {
|
|
2238
|
-
this.JsSIP = e, this.events = new O(
|
|
2238
|
+
this.JsSIP = e, this.events = new O(Ce), this.uaFactory = new D(e), this.registrationManager = new _t({
|
|
2239
2239
|
events: this.events,
|
|
2240
2240
|
getUaProtected: this.getUaProtected
|
|
2241
|
-
}), this.stateMachine = new
|
|
2241
|
+
}), this.stateMachine = new It(this.events), this.configurationManager = new St({
|
|
2242
2242
|
getUa: this.getUa
|
|
2243
|
-
}), this.sipOperations = new
|
|
2243
|
+
}), this.sipOperations = new ft({
|
|
2244
2244
|
uaFactory: this.uaFactory,
|
|
2245
2245
|
getUaProtected: this.getUaProtected
|
|
2246
|
-
}), this.connectionFlow = new
|
|
2246
|
+
}), this.connectionFlow = new Nt({
|
|
2247
2247
|
JsSIP: this.JsSIP,
|
|
2248
2248
|
events: this.events,
|
|
2249
2249
|
uaFactory: this.uaFactory,
|
|
@@ -2290,7 +2290,7 @@ class Ot {
|
|
|
2290
2290
|
return this.stateMachine.state;
|
|
2291
2291
|
}
|
|
2292
2292
|
get isRegistered() {
|
|
2293
|
-
return
|
|
2293
|
+
return D.isRegisteredUA(this.ua);
|
|
2294
2294
|
}
|
|
2295
2295
|
get isRegisterConfig() {
|
|
2296
2296
|
return this.configurationManager.isRegister();
|
|
@@ -2345,7 +2345,7 @@ class Ot {
|
|
|
2345
2345
|
getUa = () => this.ua;
|
|
2346
2346
|
connectWithProcessError = async (e, t) => {
|
|
2347
2347
|
if (!(t?.hasReadyForConnection?.() ?? !0))
|
|
2348
|
-
throw
|
|
2348
|
+
throw Pt();
|
|
2349
2349
|
return this.processConnect(e, t).catch(async (i) => {
|
|
2350
2350
|
const r = i;
|
|
2351
2351
|
return this.disconnect().then(() => {
|
|
@@ -2355,7 +2355,7 @@ class Ot {
|
|
|
2355
2355
|
});
|
|
2356
2356
|
});
|
|
2357
2357
|
};
|
|
2358
|
-
processConnect = async (e, t) => (this.events.trigger(C.CONNECT_STARTED, {}),
|
|
2358
|
+
processConnect = async (e, t) => (this.events.trigger(C.CONNECT_STARTED, {}), Ot(e).then((s) => (this.events.trigger(C.CONNECT_PARAMETERS_RESOLVE_SUCCESS, s), s)).catch((s) => {
|
|
2359
2359
|
throw this.events.trigger(C.CONNECT_PARAMETERS_RESOLVE_FAILED, s), s;
|
|
2360
2360
|
}).then(async (s) => this.connectionFlow.connect(s, t)).then((s) => (this.events.trigger(C.CONNECT_SUCCEEDED, {
|
|
2361
2361
|
...s
|
|
@@ -2366,7 +2366,7 @@ class Ot {
|
|
|
2366
2366
|
}
|
|
2367
2367
|
class yt {
|
|
2368
2368
|
connectionManager;
|
|
2369
|
-
stackPromises =
|
|
2369
|
+
stackPromises = re({
|
|
2370
2370
|
noRunIsNotActual: !0
|
|
2371
2371
|
});
|
|
2372
2372
|
constructor({ connectionManager: e }) {
|
|
@@ -2378,10 +2378,10 @@ class yt {
|
|
|
2378
2378
|
this.stackPromises.stop();
|
|
2379
2379
|
}
|
|
2380
2380
|
}
|
|
2381
|
-
const
|
|
2382
|
-
class
|
|
2383
|
-
countInner =
|
|
2384
|
-
initialCount =
|
|
2381
|
+
const K = 0, Dt = 30;
|
|
2382
|
+
class wt {
|
|
2383
|
+
countInner = K;
|
|
2384
|
+
initialCount = K;
|
|
2385
2385
|
limitInner = Dt;
|
|
2386
2386
|
isInProgress = !1;
|
|
2387
2387
|
onStatusChange;
|
|
@@ -2415,7 +2415,7 @@ class bt {
|
|
|
2415
2415
|
this.countInner = this.initialCount, this.finishAttempt();
|
|
2416
2416
|
}
|
|
2417
2417
|
}
|
|
2418
|
-
class
|
|
2418
|
+
class Ut {
|
|
2419
2419
|
connectionManager;
|
|
2420
2420
|
interval;
|
|
2421
2421
|
checkTelephonyByTimeout = void 0;
|
|
@@ -2431,7 +2431,7 @@ class wt {
|
|
|
2431
2431
|
onSuccessRequest: t,
|
|
2432
2432
|
onFailRequest: s
|
|
2433
2433
|
}) {
|
|
2434
|
-
this.stop(), this.cancelableBeforeRequest = new x(e), this.checkTelephonyByTimeout =
|
|
2434
|
+
this.stop(), this.cancelableBeforeRequest = new x(e), this.checkTelephonyByTimeout = be({
|
|
2435
2435
|
isDontStopOnFail: !0,
|
|
2436
2436
|
requestInterval: this.interval,
|
|
2437
2437
|
request: async () => {
|
|
@@ -2452,7 +2452,7 @@ class wt {
|
|
|
2452
2452
|
}
|
|
2453
2453
|
}
|
|
2454
2454
|
var I = /* @__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))(I || {});
|
|
2455
|
-
const
|
|
2455
|
+
const Ae = [
|
|
2456
2456
|
"before-attempt",
|
|
2457
2457
|
"success",
|
|
2458
2458
|
"failed-all-attempts",
|
|
@@ -2460,15 +2460,41 @@ const Re = [
|
|
|
2460
2460
|
"changed-attempt-status",
|
|
2461
2461
|
"stop-attempts-by-error",
|
|
2462
2462
|
"limit-reached-attempts"
|
|
2463
|
-
]
|
|
2464
|
-
class
|
|
2463
|
+
];
|
|
2464
|
+
class Y {
|
|
2465
|
+
callManager;
|
|
2466
|
+
disposers = [];
|
|
2467
|
+
constructor({ callManager: e }) {
|
|
2468
|
+
this.callManager = e;
|
|
2469
|
+
}
|
|
2470
|
+
subscribe(e) {
|
|
2471
|
+
this.unsubscribe(), this.disposers.push(
|
|
2472
|
+
this.callManager.on("call-status-changed", () => {
|
|
2473
|
+
this.handleCallStatusChange(e);
|
|
2474
|
+
})
|
|
2475
|
+
), this.handleCallStatusChange(e);
|
|
2476
|
+
}
|
|
2477
|
+
unsubscribe() {
|
|
2478
|
+
this.disposers.forEach((e) => {
|
|
2479
|
+
e();
|
|
2480
|
+
}), this.disposers = [];
|
|
2481
|
+
}
|
|
2482
|
+
handleCallStatusChange({
|
|
2483
|
+
onActive: e,
|
|
2484
|
+
onInactive: t
|
|
2485
|
+
}) {
|
|
2486
|
+
this.callManager.isCallActive ? e?.() : t();
|
|
2487
|
+
}
|
|
2488
|
+
}
|
|
2489
|
+
const Lt = 15e3, Bt = 2;
|
|
2490
|
+
class Ft {
|
|
2465
2491
|
connectionManager;
|
|
2466
2492
|
pingServerByTimeoutWithFailCalls;
|
|
2467
2493
|
constructor({ connectionManager: e }) {
|
|
2468
|
-
this.connectionManager = e, this.pingServerByTimeoutWithFailCalls = ye(
|
|
2494
|
+
this.connectionManager = e, this.pingServerByTimeoutWithFailCalls = ye(Bt, {
|
|
2469
2495
|
whenPossibleRequest: async () => {
|
|
2470
2496
|
},
|
|
2471
|
-
requestInterval:
|
|
2497
|
+
requestInterval: Lt,
|
|
2472
2498
|
request: async () => (h("ping"), this.connectionManager.ping().then(() => {
|
|
2473
2499
|
h("ping success");
|
|
2474
2500
|
}))
|
|
@@ -2482,53 +2508,56 @@ class Bt {
|
|
|
2482
2508
|
}
|
|
2483
2509
|
}
|
|
2484
2510
|
class kt {
|
|
2485
|
-
callManager;
|
|
2486
2511
|
pingServerRequester;
|
|
2487
|
-
|
|
2512
|
+
notActiveCallSubscriber;
|
|
2488
2513
|
constructor({
|
|
2489
2514
|
connectionManager: e,
|
|
2490
2515
|
callManager: t
|
|
2491
2516
|
}) {
|
|
2492
|
-
this.
|
|
2517
|
+
this.pingServerRequester = new Ft({
|
|
2493
2518
|
connectionManager: e
|
|
2494
|
-
});
|
|
2519
|
+
}), this.notActiveCallSubscriber = new Y({ callManager: t });
|
|
2495
2520
|
}
|
|
2496
2521
|
start({ onFailRequest: e }) {
|
|
2497
|
-
h("start"), this.
|
|
2498
|
-
|
|
2499
|
-
|
|
2522
|
+
h("start"), this.notActiveCallSubscriber.subscribe({
|
|
2523
|
+
onActive: () => {
|
|
2524
|
+
this.pingServerRequester.stop();
|
|
2525
|
+
},
|
|
2526
|
+
onInactive: () => {
|
|
2527
|
+
this.pingServerRequester.start({ onFailRequest: e });
|
|
2528
|
+
}
|
|
2529
|
+
});
|
|
2500
2530
|
}
|
|
2501
2531
|
stop() {
|
|
2502
2532
|
h("stop"), this.pingServerRequester.stop(), this.unsubscribeCallStatusChange();
|
|
2503
2533
|
}
|
|
2504
2534
|
unsubscribeCallStatusChange() {
|
|
2505
|
-
this.
|
|
2506
|
-
}
|
|
2507
|
-
handleCallStatusChange({ onFailRequest: e }) {
|
|
2508
|
-
this.callManager.isCallActive ? this.pingServerRequester.stop() : this.pingServerRequester.start({ onFailRequest: e });
|
|
2535
|
+
this.notActiveCallSubscriber.unsubscribe();
|
|
2509
2536
|
}
|
|
2510
2537
|
}
|
|
2511
|
-
class
|
|
2538
|
+
class $t {
|
|
2512
2539
|
connectionManager;
|
|
2513
|
-
callManager;
|
|
2514
2540
|
isRegistrationFailed = !1;
|
|
2515
2541
|
disposers = [];
|
|
2542
|
+
notActiveCallSubscriber;
|
|
2516
2543
|
constructor({
|
|
2517
2544
|
connectionManager: e,
|
|
2518
2545
|
callManager: t
|
|
2519
2546
|
}) {
|
|
2520
|
-
this.connectionManager = e, this.
|
|
2547
|
+
this.connectionManager = e, this.notActiveCallSubscriber = new Y({ callManager: t });
|
|
2521
2548
|
}
|
|
2522
2549
|
subscribe(e) {
|
|
2523
2550
|
this.unsubscribe(), this.disposers.push(
|
|
2524
2551
|
this.connectionManager.on("registrationFailed", () => {
|
|
2525
2552
|
this.setIsRegistrationFailed();
|
|
2526
2553
|
})
|
|
2527
|
-
), this.
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
}
|
|
2531
|
-
)
|
|
2554
|
+
), this.notActiveCallSubscriber.subscribe({
|
|
2555
|
+
onInactive: () => {
|
|
2556
|
+
this.isRegistrationFailed && e();
|
|
2557
|
+
}
|
|
2558
|
+
}), this.disposers.push(() => {
|
|
2559
|
+
this.notActiveCallSubscriber.unsubscribe();
|
|
2560
|
+
});
|
|
2532
2561
|
}
|
|
2533
2562
|
unsubscribe() {
|
|
2534
2563
|
this.disposers.forEach((e) => {
|
|
@@ -2542,11 +2571,11 @@ class Ft {
|
|
|
2542
2571
|
this.isRegistrationFailed = !1;
|
|
2543
2572
|
}
|
|
2544
2573
|
}
|
|
2545
|
-
const
|
|
2574
|
+
const qt = 3e3, Ht = 15e3, j = {
|
|
2546
2575
|
LIMIT_REACHED: "Limit reached",
|
|
2547
2576
|
FAILED_TO_RECONNECT: "Failed to reconnect"
|
|
2548
2577
|
}, Wt = async () => {
|
|
2549
|
-
},
|
|
2578
|
+
}, Vt = (n) => !0;
|
|
2550
2579
|
class Gt {
|
|
2551
2580
|
events;
|
|
2552
2581
|
connectionManager;
|
|
@@ -2561,32 +2590,33 @@ class Gt {
|
|
|
2561
2590
|
canRetryOnError;
|
|
2562
2591
|
networkInterfacesSubscriber;
|
|
2563
2592
|
resumeFromSleepModeSubscriber;
|
|
2593
|
+
notActiveCallSubscriber;
|
|
2564
2594
|
constructor({
|
|
2565
2595
|
connectionQueueManager: e,
|
|
2566
2596
|
connectionManager: t,
|
|
2567
2597
|
callManager: s
|
|
2568
2598
|
}, i) {
|
|
2569
|
-
const r = i?.onBeforeRetry ?? Wt, a = i?.canRetryOnError ??
|
|
2570
|
-
this.connectionQueueManager = e, this.connectionManager = t, this.onBeforeRetry = r, this.canRetryOnError = a, this.networkInterfacesSubscriber = i?.networkInterfacesSubscriber, this.resumeFromSleepModeSubscriber = i?.resumeFromSleepModeSubscriber, this.events = new O(
|
|
2599
|
+
const r = i?.onBeforeRetry ?? Wt, a = i?.canRetryOnError ?? Vt;
|
|
2600
|
+
this.connectionQueueManager = e, this.connectionManager = t, this.onBeforeRetry = r, this.canRetryOnError = a, this.networkInterfacesSubscriber = i?.networkInterfacesSubscriber, this.resumeFromSleepModeSubscriber = i?.resumeFromSleepModeSubscriber, this.events = new O(Ae), this.checkTelephonyRequester = new Ut({
|
|
2571
2601
|
connectionManager: t,
|
|
2572
|
-
interval: i?.checkTelephonyRequestInterval ??
|
|
2602
|
+
interval: i?.checkTelephonyRequestInterval ?? Ht
|
|
2573
2603
|
}), this.pingServerIfNotActiveCallRequester = new kt({
|
|
2574
2604
|
connectionManager: t,
|
|
2575
2605
|
callManager: s
|
|
2576
|
-
}), this.registrationFailedOutOfCallSubscriber = new
|
|
2606
|
+
}), this.registrationFailedOutOfCallSubscriber = new $t({
|
|
2577
2607
|
connectionManager: t,
|
|
2578
2608
|
callManager: s
|
|
2579
|
-
}), this.attemptsState = new
|
|
2609
|
+
}), this.attemptsState = new wt({
|
|
2580
2610
|
onStatusChange: this.emitStatusChange
|
|
2581
2611
|
}), this.cancelableRequestBeforeRetry = new x(r), this.delayBetweenAttempts = new De(
|
|
2582
|
-
i?.timeoutBetweenAttempts ??
|
|
2583
|
-
);
|
|
2612
|
+
i?.timeoutBetweenAttempts ?? qt
|
|
2613
|
+
), this.notActiveCallSubscriber = new Y({ callManager: s });
|
|
2584
2614
|
}
|
|
2585
2615
|
start(e) {
|
|
2586
|
-
h("auto connector start"), this.restartConnectionAttempts(e), this.
|
|
2616
|
+
h("auto connector start"), this.restartConnectionAttempts(e), this.subscribeToNotActiveCall(e);
|
|
2587
2617
|
}
|
|
2588
2618
|
stop() {
|
|
2589
|
-
h("auto connector stop"), this.unsubscribeFromHardwareTriggers(), this.stopConnectionFlow().catch((e) => {
|
|
2619
|
+
h("auto connector stop"), this.unsubscribeFromNotActiveCall(), this.unsubscribeFromHardwareTriggers(), this.stopConnectionFlow().catch((e) => {
|
|
2590
2620
|
h("auto connector stop from stop method: error", e);
|
|
2591
2621
|
});
|
|
2592
2622
|
}
|
|
@@ -2645,7 +2675,7 @@ class Gt {
|
|
|
2645
2675
|
}
|
|
2646
2676
|
}
|
|
2647
2677
|
handleConnectionError(e, t) {
|
|
2648
|
-
if (
|
|
2678
|
+
if (vt(e)) {
|
|
2649
2679
|
this.attemptsState.finishAttempt(), this.events.trigger(I.STOP_ATTEMPTS_BY_ERROR, e);
|
|
2650
2680
|
return;
|
|
2651
2681
|
}
|
|
@@ -2653,14 +2683,14 @@ class Gt {
|
|
|
2653
2683
|
h("executeConnectionAttempt: error does not allow retry", e), this.attemptsState.finishAttempt(), this.events.trigger(I.STOP_ATTEMPTS_BY_ERROR, e);
|
|
2654
2684
|
return;
|
|
2655
2685
|
}
|
|
2656
|
-
if (
|
|
2686
|
+
if (Fe(e)) {
|
|
2657
2687
|
h("executeConnectionAttempt: not actual error", e), this.attemptsState.finishAttempt(), this.events.trigger(I.CANCELLED_ATTEMPTS, e);
|
|
2658
2688
|
return;
|
|
2659
2689
|
}
|
|
2660
2690
|
h("executeConnectionAttempt: error", e), this.scheduleReconnect(t);
|
|
2661
2691
|
}
|
|
2662
2692
|
handleLimitReached(e) {
|
|
2663
|
-
this.attemptsState.finishAttempt(), this.events.trigger(I.LIMIT_REACHED_ATTEMPTS, new Error(
|
|
2693
|
+
this.attemptsState.finishAttempt(), this.events.trigger(I.LIMIT_REACHED_ATTEMPTS, new Error(j.LIMIT_REACHED)), this.startCheckTelephony(e);
|
|
2664
2694
|
}
|
|
2665
2695
|
handleSucceededAttempt(e) {
|
|
2666
2696
|
h("handleSucceededAttempt"), this.subscribeToConnectTriggers(e), this.events.trigger(I.SUCCESS);
|
|
@@ -2670,6 +2700,19 @@ class Gt {
|
|
|
2670
2700
|
h("registrationFailedOutOfCallListener callback"), this.restartConnectionAttempts(e);
|
|
2671
2701
|
});
|
|
2672
2702
|
}
|
|
2703
|
+
subscribeToNotActiveCall(e) {
|
|
2704
|
+
this.notActiveCallSubscriber.subscribe({
|
|
2705
|
+
onActive: () => {
|
|
2706
|
+
h("subscribeToNotActiveCall onActive"), this.unsubscribeFromHardwareTriggers();
|
|
2707
|
+
},
|
|
2708
|
+
onInactive: () => {
|
|
2709
|
+
h("subscribeToNotActiveCall onInactive"), this.subscribeToHardwareTriggers(e);
|
|
2710
|
+
}
|
|
2711
|
+
});
|
|
2712
|
+
}
|
|
2713
|
+
unsubscribeFromNotActiveCall() {
|
|
2714
|
+
this.notActiveCallSubscriber.unsubscribe();
|
|
2715
|
+
}
|
|
2673
2716
|
subscribeToHardwareTriggers(e) {
|
|
2674
2717
|
this.unsubscribeFromHardwareTriggers(), h("subscribeToHardwareTriggers"), this.networkInterfacesSubscriber?.subscribe({
|
|
2675
2718
|
onChange: () => {
|
|
@@ -2708,8 +2751,8 @@ class Gt {
|
|
|
2708
2751
|
}
|
|
2709
2752
|
scheduleReconnect(e) {
|
|
2710
2753
|
h("scheduleReconnect"), this.delayBetweenAttempts.request().then(async () => (h("scheduleReconnect: delayBetweenAttempts success"), this.cancelableRequestBeforeRetry.request())).then(async () => (h("scheduleReconnect: onBeforeRetry success"), this.attemptConnection(e))).catch((t) => {
|
|
2711
|
-
const s = t instanceof Error ? t : new Error(
|
|
2712
|
-
this.attemptsState.finishAttempt(),
|
|
2754
|
+
const s = t instanceof Error ? t : new Error(j.FAILED_TO_RECONNECT);
|
|
2755
|
+
this.attemptsState.finishAttempt(), Oe(t) || we(t) ? this.events.trigger(I.CANCELLED_ATTEMPTS, s) : this.events.trigger(I.FAILED_ALL_ATTEMPTS, s), h("scheduleReconnect: error", t);
|
|
2713
2756
|
});
|
|
2714
2757
|
}
|
|
2715
2758
|
isConnectionUnavailable() {
|
|
@@ -2721,18 +2764,18 @@ class Gt {
|
|
|
2721
2764
|
};
|
|
2722
2765
|
}
|
|
2723
2766
|
var U = /* @__PURE__ */ ((n) => (n.INCOMING_CALL = "incomingCall", n.DECLINED_INCOMING_CALL = "declinedIncomingCall", n.TERMINATED_INCOMING_CALL = "terminatedIncomingCall", n.FAILED_INCOMING_CALL = "failedIncomingCall", n))(U || {});
|
|
2724
|
-
const
|
|
2767
|
+
const Ne = [
|
|
2725
2768
|
"incomingCall",
|
|
2726
2769
|
"declinedIncomingCall",
|
|
2727
2770
|
"terminatedIncomingCall",
|
|
2728
2771
|
"failedIncomingCall"
|
|
2729
|
-
],
|
|
2730
|
-
class
|
|
2772
|
+
], xt = 486, Qt = 487;
|
|
2773
|
+
class Yt {
|
|
2731
2774
|
events;
|
|
2732
2775
|
incomingRTCSession;
|
|
2733
2776
|
connectionManager;
|
|
2734
2777
|
constructor(e) {
|
|
2735
|
-
this.connectionManager = e, this.events = new O(
|
|
2778
|
+
this.connectionManager = e, this.events = new O(Ne), this.start();
|
|
2736
2779
|
}
|
|
2737
2780
|
get remoteCallerData() {
|
|
2738
2781
|
return {
|
|
@@ -2762,7 +2805,7 @@ class Qt {
|
|
|
2762
2805
|
return this.removeIncomingSession(), e;
|
|
2763
2806
|
};
|
|
2764
2807
|
async declineToIncomingCall({
|
|
2765
|
-
statusCode: e =
|
|
2808
|
+
statusCode: e = Qt
|
|
2766
2809
|
} = {}) {
|
|
2767
2810
|
return new Promise((t, s) => {
|
|
2768
2811
|
try {
|
|
@@ -2774,7 +2817,7 @@ class Qt {
|
|
|
2774
2817
|
});
|
|
2775
2818
|
}
|
|
2776
2819
|
async busyIncomingCall() {
|
|
2777
|
-
return this.declineToIncomingCall({ statusCode:
|
|
2820
|
+
return this.declineToIncomingCall({ statusCode: xt });
|
|
2778
2821
|
}
|
|
2779
2822
|
on(e, t) {
|
|
2780
2823
|
return this.events.on(e, t);
|
|
@@ -2816,7 +2859,7 @@ class Qt {
|
|
|
2816
2859
|
}
|
|
2817
2860
|
const w = 1e3;
|
|
2818
2861
|
var E = /* @__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))(E || {});
|
|
2819
|
-
const
|
|
2862
|
+
const me = ["collected"], zt = "api/v2/rtp2webrtc/offer", Xt = async ({
|
|
2820
2863
|
serverUrl: n,
|
|
2821
2864
|
conferenceNumber: e,
|
|
2822
2865
|
quality: t,
|
|
@@ -2824,7 +2867,7 @@ const Ne = ["collected"], Yt = "api/v2/rtp2webrtc/offer", zt = async ({
|
|
|
2824
2867
|
offer: i
|
|
2825
2868
|
}) => {
|
|
2826
2869
|
const r = new URL(
|
|
2827
|
-
`https://${n.replace(/\/$/, "")}/${
|
|
2870
|
+
`https://${n.replace(/\/$/, "")}/${zt}/${encodeURIComponent(e)}`
|
|
2828
2871
|
);
|
|
2829
2872
|
r.searchParams.set("quality", t), r.searchParams.set("audio", String(s));
|
|
2830
2873
|
const a = await fetch(r.toString(), {
|
|
@@ -2846,10 +2889,10 @@ const Ne = ["collected"], Yt = "api/v2/rtp2webrtc/offer", zt = async ({
|
|
|
2846
2889
|
return o;
|
|
2847
2890
|
}
|
|
2848
2891
|
};
|
|
2849
|
-
},
|
|
2892
|
+
}, Z = () => "performance" in window ? performance.now() : Date.now(), L = (n) => [...n.keys()].reduce((e, t) => {
|
|
2850
2893
|
const s = n.get(t);
|
|
2851
2894
|
return s === void 0 ? e : { ...e, [s.type]: s };
|
|
2852
|
-
}, {}),
|
|
2895
|
+
}, {}), Jt = (n) => {
|
|
2853
2896
|
if (!n)
|
|
2854
2897
|
return {
|
|
2855
2898
|
outboundRtp: void 0,
|
|
@@ -2864,7 +2907,7 @@ const Ne = ["collected"], Yt = "api/v2/rtp2webrtc/offer", zt = async ({
|
|
|
2864
2907
|
mediaSource: e[E.MEDIA_SOURCE],
|
|
2865
2908
|
remoteInboundRtp: e[E.REMOTE_INBOUND_RTP]
|
|
2866
2909
|
};
|
|
2867
|
-
},
|
|
2910
|
+
}, ee = (n) => {
|
|
2868
2911
|
if (!n)
|
|
2869
2912
|
return {
|
|
2870
2913
|
outboundRtp: void 0,
|
|
@@ -2879,7 +2922,7 @@ const Ne = ["collected"], Yt = "api/v2/rtp2webrtc/offer", zt = async ({
|
|
|
2879
2922
|
mediaSource: e[E.MEDIA_SOURCE],
|
|
2880
2923
|
remoteInboundRtp: e[E.REMOTE_INBOUND_RTP]
|
|
2881
2924
|
};
|
|
2882
|
-
},
|
|
2925
|
+
}, te = ({
|
|
2883
2926
|
videoReceiversStats: n,
|
|
2884
2927
|
synchronizationSourcesVideo: e
|
|
2885
2928
|
}) => {
|
|
@@ -2895,7 +2938,7 @@ const Ne = ["collected"], Yt = "api/v2/rtp2webrtc/offer", zt = async ({
|
|
|
2895
2938
|
codec: t[E.CODEC],
|
|
2896
2939
|
synchronizationSources: e
|
|
2897
2940
|
};
|
|
2898
|
-
},
|
|
2941
|
+
}, Kt = ({
|
|
2899
2942
|
audioReceiverStats: n,
|
|
2900
2943
|
synchronizationSourcesAudio: e
|
|
2901
2944
|
}) => {
|
|
@@ -2913,7 +2956,7 @@ const Ne = ["collected"], Yt = "api/v2/rtp2webrtc/offer", zt = async ({
|
|
|
2913
2956
|
remoteOutboundRtp: t[E.REMOTE_OUTBOUND_RTP],
|
|
2914
2957
|
synchronizationSources: e
|
|
2915
2958
|
};
|
|
2916
|
-
},
|
|
2959
|
+
}, Ie = (n) => {
|
|
2917
2960
|
if (!n)
|
|
2918
2961
|
return {
|
|
2919
2962
|
candidatePair: void 0,
|
|
@@ -2930,39 +2973,39 @@ const Ne = ["collected"], Yt = "api/v2/rtp2webrtc/offer", zt = async ({
|
|
|
2930
2973
|
remoteCandidate: e[E.REMOTE_CANDIDATE],
|
|
2931
2974
|
transport: e[E.TRANSPORT]
|
|
2932
2975
|
};
|
|
2933
|
-
},
|
|
2976
|
+
}, jt = ({
|
|
2934
2977
|
audioSenderStats: n,
|
|
2935
2978
|
videoSenderFirstStats: e,
|
|
2936
2979
|
videoSenderSecondStats: t
|
|
2937
2980
|
}) => ({
|
|
2938
|
-
video:
|
|
2939
|
-
secondVideo:
|
|
2940
|
-
audio:
|
|
2941
|
-
additional:
|
|
2981
|
+
video: ee(e),
|
|
2982
|
+
secondVideo: ee(t),
|
|
2983
|
+
audio: Jt(n),
|
|
2984
|
+
additional: Ie(
|
|
2942
2985
|
n ?? e ?? t
|
|
2943
2986
|
)
|
|
2944
|
-
}),
|
|
2987
|
+
}), Zt = ({
|
|
2945
2988
|
audioReceiverStats: n,
|
|
2946
2989
|
videoReceiverFirstStats: e,
|
|
2947
2990
|
videoReceiverSecondStats: t,
|
|
2948
2991
|
synchronizationSources: s
|
|
2949
2992
|
}) => ({
|
|
2950
|
-
video:
|
|
2993
|
+
video: te({
|
|
2951
2994
|
videoReceiversStats: e,
|
|
2952
2995
|
synchronizationSourcesVideo: s.video
|
|
2953
2996
|
}),
|
|
2954
|
-
secondVideo:
|
|
2997
|
+
secondVideo: te({
|
|
2955
2998
|
videoReceiversStats: t,
|
|
2956
2999
|
synchronizationSourcesVideo: s.video
|
|
2957
3000
|
}),
|
|
2958
|
-
audio:
|
|
3001
|
+
audio: Kt({
|
|
2959
3002
|
audioReceiverStats: n,
|
|
2960
3003
|
synchronizationSourcesAudio: s.audio
|
|
2961
3004
|
}),
|
|
2962
|
-
additional:
|
|
3005
|
+
additional: Ie(
|
|
2963
3006
|
n ?? e ?? t
|
|
2964
3007
|
)
|
|
2965
|
-
}),
|
|
3008
|
+
}), en = ({
|
|
2966
3009
|
audioSenderStats: n,
|
|
2967
3010
|
videoSenderFirstStats: e,
|
|
2968
3011
|
videoSenderSecondStats: t,
|
|
@@ -2971,11 +3014,11 @@ const Ne = ["collected"], Yt = "api/v2/rtp2webrtc/offer", zt = async ({
|
|
|
2971
3014
|
videoReceiverSecondStats: r,
|
|
2972
3015
|
synchronizationSources: a
|
|
2973
3016
|
}) => {
|
|
2974
|
-
const o =
|
|
3017
|
+
const o = jt({
|
|
2975
3018
|
audioSenderStats: n,
|
|
2976
3019
|
videoSenderFirstStats: e,
|
|
2977
3020
|
videoSenderSecondStats: t
|
|
2978
|
-
}), c =
|
|
3021
|
+
}), c = Zt({
|
|
2979
3022
|
audioReceiverStats: s,
|
|
2980
3023
|
videoReceiverFirstStats: i,
|
|
2981
3024
|
videoReceiverSecondStats: r,
|
|
@@ -2985,7 +3028,7 @@ const Ne = ["collected"], Yt = "api/v2/rtp2webrtc/offer", zt = async ({
|
|
|
2985
3028
|
outbound: o,
|
|
2986
3029
|
inbound: c
|
|
2987
3030
|
};
|
|
2988
|
-
},
|
|
3031
|
+
}, tn = async (n) => {
|
|
2989
3032
|
const e = "audio", t = "video", s = n.getSenders(), i = s.find((T) => T.track?.kind === e), r = s.filter((T) => T.track?.kind === t), a = n.getReceivers(), o = a.find((T) => T.track.kind === e), c = a.filter((T) => T.track.kind === t), d = {
|
|
2990
3033
|
trackIdentifier: o?.track.id,
|
|
2991
3034
|
item: o?.getSynchronizationSources()[0]
|
|
@@ -3008,36 +3051,36 @@ const Ne = ["collected"], Yt = "api/v2/rtp2webrtc/offer", zt = async ({
|
|
|
3008
3051
|
p,
|
|
3009
3052
|
v,
|
|
3010
3053
|
A,
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3054
|
+
y,
|
|
3055
|
+
k,
|
|
3056
|
+
Pe
|
|
3014
3057
|
] = T;
|
|
3015
3058
|
return {
|
|
3016
3059
|
synchronizationSources: g,
|
|
3017
3060
|
audioSenderStats: p,
|
|
3018
3061
|
videoSenderFirstStats: v,
|
|
3019
3062
|
videoSenderSecondStats: A,
|
|
3020
|
-
audioReceiverStats:
|
|
3021
|
-
videoReceiverFirstStats:
|
|
3022
|
-
videoReceiverSecondStats:
|
|
3063
|
+
audioReceiverStats: y,
|
|
3064
|
+
videoReceiverFirstStats: k,
|
|
3065
|
+
videoReceiverSecondStats: Pe
|
|
3023
3066
|
};
|
|
3024
3067
|
});
|
|
3025
|
-
},
|
|
3068
|
+
}, nn = (n) => {
|
|
3026
3069
|
h(String(n));
|
|
3027
3070
|
};
|
|
3028
|
-
class
|
|
3071
|
+
class sn {
|
|
3029
3072
|
events;
|
|
3030
3073
|
setTimeoutRequest;
|
|
3031
|
-
requesterAllStatistics = new x(
|
|
3074
|
+
requesterAllStatistics = new x(tn);
|
|
3032
3075
|
constructor() {
|
|
3033
|
-
this.events = new O(
|
|
3076
|
+
this.events = new O(me), this.setTimeoutRequest = new se();
|
|
3034
3077
|
}
|
|
3035
3078
|
get requested() {
|
|
3036
3079
|
return this.setTimeoutRequest.requested;
|
|
3037
3080
|
}
|
|
3038
3081
|
start(e, {
|
|
3039
3082
|
interval: t = w,
|
|
3040
|
-
onError: s =
|
|
3083
|
+
onError: s = nn
|
|
3041
3084
|
} = {}) {
|
|
3042
3085
|
this.stop(), this.setTimeoutRequest.request(() => {
|
|
3043
3086
|
this.collectStatistics(e, {
|
|
@@ -3066,10 +3109,10 @@ class nn {
|
|
|
3066
3109
|
collectStatistics = (e, {
|
|
3067
3110
|
onError: t
|
|
3068
3111
|
}) => {
|
|
3069
|
-
const s =
|
|
3112
|
+
const s = Z();
|
|
3070
3113
|
this.requesterAllStatistics.request(e).then((i) => {
|
|
3071
|
-
this.events.trigger("collected",
|
|
3072
|
-
const a =
|
|
3114
|
+
this.events.trigger("collected", en(i));
|
|
3115
|
+
const a = Z() - s;
|
|
3073
3116
|
let o = w;
|
|
3074
3117
|
a > 48 ? o = w * 4 : a > 32 ? o = w * 3 : a > 16 && (o = w * 2), this.start(e, {
|
|
3075
3118
|
onError: t,
|
|
@@ -3080,7 +3123,7 @@ class nn {
|
|
|
3080
3123
|
});
|
|
3081
3124
|
};
|
|
3082
3125
|
}
|
|
3083
|
-
class
|
|
3126
|
+
class rn {
|
|
3084
3127
|
availableIncomingBitrate;
|
|
3085
3128
|
statsPeerConnection;
|
|
3086
3129
|
callManager;
|
|
@@ -3090,7 +3133,7 @@ class sn {
|
|
|
3090
3133
|
callManager: e,
|
|
3091
3134
|
apiManager: t
|
|
3092
3135
|
}) {
|
|
3093
|
-
this.callManager = e, this.apiManager = t, this.statsPeerConnection = new
|
|
3136
|
+
this.callManager = e, this.apiManager = t, this.statsPeerConnection = new sn(), this.subscribe();
|
|
3094
3137
|
}
|
|
3095
3138
|
get events() {
|
|
3096
3139
|
return this.statsPeerConnection.events;
|
|
@@ -3132,33 +3175,33 @@ class sn {
|
|
|
3132
3175
|
});
|
|
3133
3176
|
}
|
|
3134
3177
|
}
|
|
3135
|
-
const
|
|
3178
|
+
const an = (n, e) => n.filter((s) => e.some((i) => i.clockRate === s.clockRate && i.mimeType === s.mimeType && i.channels === s.channels && i.sdpFmtpLine === s.sdpFmtpLine)), on = (n) => {
|
|
3136
3179
|
const e = RTCRtpSender.getCapabilities(n), t = RTCRtpReceiver.getCapabilities(n), s = e === null ? [] : e.codecs, i = t === null ? [] : t.codecs;
|
|
3137
|
-
return
|
|
3138
|
-
},
|
|
3180
|
+
return an(s, i);
|
|
3181
|
+
}, cn = (n, e) => e === void 0 || e.length === 0 ? n : n.sort((t, s) => {
|
|
3139
3182
|
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;
|
|
3140
3183
|
return a - o;
|
|
3141
|
-
}),
|
|
3184
|
+
}), hn = (n, e) => e === void 0 || e.length === 0 ? n : n.filter((t) => !e.includes(t.mimeType)), dn = (n, {
|
|
3142
3185
|
preferredMimeTypesVideoCodecs: e,
|
|
3143
3186
|
excludeMimeTypesVideoCodecs: t
|
|
3144
3187
|
}) => {
|
|
3145
3188
|
try {
|
|
3146
3189
|
if (typeof n.setCodecPreferences == "function" && n.sender.track?.kind === "video" && (e !== void 0 && e.length > 0 || t !== void 0 && t.length > 0)) {
|
|
3147
|
-
const s =
|
|
3190
|
+
const s = on("video"), i = hn(s, t), r = cn(i, e);
|
|
3148
3191
|
n.setCodecPreferences(r);
|
|
3149
3192
|
}
|
|
3150
3193
|
} catch (s) {
|
|
3151
3194
|
h("setCodecPreferences error", s);
|
|
3152
3195
|
}
|
|
3153
|
-
},
|
|
3154
|
-
class
|
|
3196
|
+
}, ln = (n) => [...n.keys()].map((e) => n.get(e)), un = (n, e) => ln(n).find((t) => t?.type === e), gn = async (n) => n.getStats().then((e) => un(e, "codec")?.mimeType);
|
|
3197
|
+
class Tn {
|
|
3155
3198
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
3156
3199
|
async getCodecFromSender(e) {
|
|
3157
|
-
return await
|
|
3200
|
+
return await gn(e) ?? "";
|
|
3158
3201
|
}
|
|
3159
3202
|
}
|
|
3160
|
-
class
|
|
3161
|
-
stackPromises =
|
|
3203
|
+
class Sn {
|
|
3204
|
+
stackPromises = re({
|
|
3162
3205
|
noRunIsNotActual: !0
|
|
3163
3206
|
});
|
|
3164
3207
|
/**
|
|
@@ -3182,30 +3225,30 @@ class Tn {
|
|
|
3182
3225
|
});
|
|
3183
3226
|
}
|
|
3184
3227
|
}
|
|
3185
|
-
class
|
|
3228
|
+
class Cn {
|
|
3186
3229
|
taskQueue;
|
|
3187
3230
|
onSetParameters;
|
|
3188
3231
|
constructor(e) {
|
|
3189
|
-
this.onSetParameters = e, this.taskQueue = new
|
|
3232
|
+
this.onSetParameters = e, this.taskQueue = new Sn();
|
|
3190
3233
|
}
|
|
3191
3234
|
async setEncodingsToSender(e, t) {
|
|
3192
|
-
return this.taskQueue.add(async () =>
|
|
3235
|
+
return this.taskQueue.add(async () => ge(e, t, this.onSetParameters));
|
|
3193
3236
|
}
|
|
3194
3237
|
stop() {
|
|
3195
3238
|
this.taskQueue.stop();
|
|
3196
3239
|
}
|
|
3197
3240
|
}
|
|
3198
|
-
const
|
|
3199
|
-
const t =
|
|
3200
|
-
return
|
|
3201
|
-
}, q = 1,
|
|
3241
|
+
const _e = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), En = 1e6, _ = (n) => n * En, fe = _(0.06), Me = _(4), pn = (n) => n <= 64 ? fe : n <= 128 ? _(0.12) : n <= 256 ? _(0.25) : n <= 384 ? _(0.32) : n <= 426 ? _(0.38) : n <= 640 ? _(0.5) : n <= 848 ? _(0.7) : n <= 1280 ? _(1) : n <= 1920 ? _(2) : Me, Rn = "av1", An = (n) => _e(n, Rn), Nn = 0.6, z = (n, e) => An(e) ? n * Nn : n, mn = (n) => z(fe, n), In = (n) => z(Me, n), ne = (n, e) => {
|
|
3242
|
+
const t = pn(n);
|
|
3243
|
+
return z(t, e);
|
|
3244
|
+
}, q = 1, _n = ({
|
|
3202
3245
|
videoTrack: n,
|
|
3203
3246
|
targetSize: e
|
|
3204
3247
|
}) => {
|
|
3205
3248
|
const t = n.getSettings(), s = t.width, i = t.height, r = s === void 0 ? q : s / e.width, a = i === void 0 ? q : i / e.height;
|
|
3206
3249
|
return Math.max(r, a, q);
|
|
3207
3250
|
};
|
|
3208
|
-
class
|
|
3251
|
+
class fn {
|
|
3209
3252
|
ignoreForCodec;
|
|
3210
3253
|
senderFinder;
|
|
3211
3254
|
codecProvider;
|
|
@@ -3238,7 +3281,7 @@ class _n {
|
|
|
3238
3281
|
if (!i?.track)
|
|
3239
3282
|
return { ...this.resultNoChanged, sender: i };
|
|
3240
3283
|
const r = await this.codecProvider.getCodecFromSender(i);
|
|
3241
|
-
if (
|
|
3284
|
+
if (_e(r, this.ignoreForCodec))
|
|
3242
3285
|
return { ...this.resultNoChanged, sender: i };
|
|
3243
3286
|
const { mainCam: a, resolutionMainCam: o } = t ?? {};
|
|
3244
3287
|
return this.processSender(
|
|
@@ -3258,14 +3301,14 @@ class _n {
|
|
|
3258
3301
|
async processSender(e, t) {
|
|
3259
3302
|
const { mainCam: s, resolutionMainCam: i } = e;
|
|
3260
3303
|
switch (s) {
|
|
3261
|
-
case
|
|
3304
|
+
case f.PAUSE_MAIN_CAM:
|
|
3262
3305
|
return this.downgradeResolutionSender(t);
|
|
3263
|
-
case
|
|
3306
|
+
case f.RESUME_MAIN_CAM:
|
|
3264
3307
|
return this.setBitrateByTrackResolution(t);
|
|
3265
|
-
case
|
|
3308
|
+
case f.MAX_MAIN_CAM_RESOLUTION:
|
|
3266
3309
|
return i !== void 0 ? this.setResolutionSender(i, t) : this.setBitrateByTrackResolution(t);
|
|
3267
|
-
case
|
|
3268
|
-
case
|
|
3310
|
+
case f.ADMIN_STOP_MAIN_CAM:
|
|
3311
|
+
case f.ADMIN_START_MAIN_CAM:
|
|
3269
3312
|
case void 0:
|
|
3270
3313
|
return this.setBitrateByTrackResolution(t);
|
|
3271
3314
|
default:
|
|
@@ -3280,7 +3323,7 @@ class _n {
|
|
|
3280
3323
|
async downgradeResolutionSender(e) {
|
|
3281
3324
|
const { sender: t, codec: s } = e, i = {
|
|
3282
3325
|
scaleResolutionDownBy: 200,
|
|
3283
|
-
maxBitrate:
|
|
3326
|
+
maxBitrate: mn(s)
|
|
3284
3327
|
};
|
|
3285
3328
|
return this.parametersSetter.setEncodingsToSender(t, i);
|
|
3286
3329
|
}
|
|
@@ -3290,7 +3333,7 @@ class _n {
|
|
|
3290
3333
|
* @returns Promise с результатом
|
|
3291
3334
|
*/
|
|
3292
3335
|
async setBitrateByTrackResolution(e) {
|
|
3293
|
-
const { sender: t, videoTrack: s, codec: i } = e, a = s.getSettings().width, o = a === void 0 ?
|
|
3336
|
+
const { sender: t, videoTrack: s, codec: i } = e, a = s.getSettings().width, o = a === void 0 ? In(i) : ne(a, i);
|
|
3294
3337
|
return this.parametersSetter.setEncodingsToSender(t, {
|
|
3295
3338
|
scaleResolutionDownBy: 1,
|
|
3296
3339
|
maxBitrate: o
|
|
@@ -3306,10 +3349,10 @@ class _n {
|
|
|
3306
3349
|
const [s, i] = e.split("x"), { sender: r, videoTrack: a, codec: o } = t, c = {
|
|
3307
3350
|
width: Number(s),
|
|
3308
3351
|
height: Number(i)
|
|
3309
|
-
}, d =
|
|
3352
|
+
}, d = _n({
|
|
3310
3353
|
videoTrack: a,
|
|
3311
3354
|
targetSize: c
|
|
3312
|
-
}), S =
|
|
3355
|
+
}), S = ne(c.width, o), g = {
|
|
3313
3356
|
scaleResolutionDownBy: d,
|
|
3314
3357
|
maxBitrate: S
|
|
3315
3358
|
};
|
|
@@ -3317,13 +3360,13 @@ class _n {
|
|
|
3317
3360
|
}
|
|
3318
3361
|
}
|
|
3319
3362
|
const Mn = (n) => n.find((e) => e.track?.kind === "video");
|
|
3320
|
-
class
|
|
3363
|
+
class vn {
|
|
3321
3364
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
3322
3365
|
findVideoSender(e) {
|
|
3323
3366
|
return Mn(e);
|
|
3324
3367
|
}
|
|
3325
3368
|
}
|
|
3326
|
-
class
|
|
3369
|
+
class Pn {
|
|
3327
3370
|
currentSender;
|
|
3328
3371
|
originalReplaceTrack;
|
|
3329
3372
|
lastWidth;
|
|
@@ -3336,7 +3379,7 @@ class vn {
|
|
|
3336
3379
|
pollIntervalMs: e = 1e3,
|
|
3337
3380
|
maxPollIntervalMs: t
|
|
3338
3381
|
}) {
|
|
3339
|
-
this.pollIntervalMs = e, this.maxPollIntervalMs = t ?? e * 16, this.currentPollIntervalMs = this.pollIntervalMs, this.setTimeoutRequest = new
|
|
3382
|
+
this.pollIntervalMs = e, this.maxPollIntervalMs = t ?? e * 16, this.currentPollIntervalMs = this.pollIntervalMs, this.setTimeoutRequest = new se();
|
|
3340
3383
|
}
|
|
3341
3384
|
/**
|
|
3342
3385
|
* Проверяет актуальный video-sender и (при необходимости) перенастраивает наблюдение.
|
|
@@ -3387,7 +3430,7 @@ class vn {
|
|
|
3387
3430
|
this.setTimeoutRequest.cancelRequest(), this.lastWidth = void 0, this.lastHeight = void 0;
|
|
3388
3431
|
}
|
|
3389
3432
|
}
|
|
3390
|
-
class
|
|
3433
|
+
class On {
|
|
3391
3434
|
apiManager;
|
|
3392
3435
|
currentHandler;
|
|
3393
3436
|
constructor(e) {
|
|
@@ -3407,7 +3450,7 @@ class Pn {
|
|
|
3407
3450
|
this.currentHandler && (this.apiManager.off("main-cam-control", this.currentHandler), this.currentHandler = void 0);
|
|
3408
3451
|
}
|
|
3409
3452
|
}
|
|
3410
|
-
class
|
|
3453
|
+
class bn {
|
|
3411
3454
|
eventHandler;
|
|
3412
3455
|
senderBalancer;
|
|
3413
3456
|
parametersSetterWithQueue;
|
|
@@ -3419,16 +3462,16 @@ class On {
|
|
|
3419
3462
|
onSetParameters: i,
|
|
3420
3463
|
pollIntervalMs: r
|
|
3421
3464
|
} = {}) {
|
|
3422
|
-
this.getConnection = t, this.eventHandler = new
|
|
3465
|
+
this.getConnection = t, this.eventHandler = new On(e), this.parametersSetterWithQueue = new Cn(i), this.senderBalancer = new fn(
|
|
3423
3466
|
{
|
|
3424
|
-
senderFinder: new
|
|
3425
|
-
codecProvider: new
|
|
3467
|
+
senderFinder: new vn(),
|
|
3468
|
+
codecProvider: new Tn(),
|
|
3426
3469
|
parametersSetter: this.parametersSetterWithQueue
|
|
3427
3470
|
},
|
|
3428
3471
|
{
|
|
3429
3472
|
ignoreForCodec: s
|
|
3430
3473
|
}
|
|
3431
|
-
), this.trackMonitor = new
|
|
3474
|
+
), this.trackMonitor = new Pn({ pollIntervalMs: r });
|
|
3432
3475
|
}
|
|
3433
3476
|
/**
|
|
3434
3477
|
* Подписывается на события управления главной камерой
|
|
@@ -3473,7 +3516,7 @@ class On {
|
|
|
3473
3516
|
});
|
|
3474
3517
|
};
|
|
3475
3518
|
}
|
|
3476
|
-
const
|
|
3519
|
+
const ve = [
|
|
3477
3520
|
"balancing-scheduled",
|
|
3478
3521
|
"balancing-started",
|
|
3479
3522
|
"balancing-stopped",
|
|
@@ -3487,7 +3530,7 @@ class yn {
|
|
|
3487
3530
|
videoSendingBalancer;
|
|
3488
3531
|
startBalancingTimer;
|
|
3489
3532
|
constructor(e, t, s = {}) {
|
|
3490
|
-
this.events = new O(
|
|
3533
|
+
this.events = new O(ve), this.callManager = e, this.balancingStartDelay = s.balancingStartDelay ?? 1e4, this.videoSendingBalancer = new bn(
|
|
3491
3534
|
t,
|
|
3492
3535
|
() => e.connection,
|
|
3493
3536
|
{
|
|
@@ -3557,17 +3600,18 @@ class yn {
|
|
|
3557
3600
|
this.startBalancingTimer && (clearTimeout(this.startBalancingTimer), this.startBalancingTimer = void 0);
|
|
3558
3601
|
}
|
|
3559
3602
|
}
|
|
3560
|
-
const Dn = 1e6,
|
|
3561
|
-
...bn,
|
|
3603
|
+
const Dn = 1e6, wn = Ae.map((n) => `auto-connect:${n}`), Un = Ce.map((n) => `connection:${n}`), Ln = ce.map((n) => `call:${n}`), Bn = ae.map((n) => `api:${n}`), Fn = Ne.map((n) => `incoming-call:${n}`), kn = Te.map((n) => `presentation:${n}`), $n = me.map((n) => `stats:${n}`), qn = ve.map((n) => `video-balancer:${n}`), Hn = ["disconnected-from-out-of-call"], Wn = [
|
|
3562
3604
|
...wn,
|
|
3563
3605
|
...Un,
|
|
3564
3606
|
...Ln,
|
|
3565
3607
|
...Bn,
|
|
3566
|
-
...kn,
|
|
3567
3608
|
...Fn,
|
|
3568
|
-
|
|
3609
|
+
...kn,
|
|
3610
|
+
...$n,
|
|
3611
|
+
...qn,
|
|
3612
|
+
...Hn
|
|
3569
3613
|
];
|
|
3570
|
-
class
|
|
3614
|
+
class ts {
|
|
3571
3615
|
events;
|
|
3572
3616
|
connectionManager;
|
|
3573
3617
|
connectionQueueManager;
|
|
@@ -3586,15 +3630,15 @@ class Zn {
|
|
|
3586
3630
|
videoBalancerOptions: i,
|
|
3587
3631
|
autoConnectorOptions: r
|
|
3588
3632
|
} = {}) {
|
|
3589
|
-
this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events = new O(
|
|
3633
|
+
this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events = new O(Wn), this.connectionManager = new bt({ JsSIP: e }), this.connectionQueueManager = new yt({
|
|
3590
3634
|
connectionManager: this.connectionManager
|
|
3591
|
-
}), this.callManager = new
|
|
3635
|
+
}), this.callManager = new Ze(), this.apiManager = new Ve({
|
|
3592
3636
|
connectionManager: this.connectionManager,
|
|
3593
3637
|
callManager: this.callManager
|
|
3594
|
-
}), this.incomingCallManager = new
|
|
3638
|
+
}), this.incomingCallManager = new Yt(this.connectionManager), this.presentationManager = new Tt({
|
|
3595
3639
|
callManager: this.callManager,
|
|
3596
3640
|
maxBitrate: Dn
|
|
3597
|
-
}), this.statsManager = new
|
|
3641
|
+
}), this.statsManager = new rn({
|
|
3598
3642
|
callManager: this.callManager,
|
|
3599
3643
|
apiManager: this.apiManager
|
|
3600
3644
|
}), this.autoConnectorManager = new Gt(
|
|
@@ -3777,20 +3821,27 @@ class Zn {
|
|
|
3777
3821
|
async askPermissionToEnableCam(...e) {
|
|
3778
3822
|
return this.apiManager.askPermissionToEnableCam(...e);
|
|
3779
3823
|
}
|
|
3824
|
+
subscribeDisconnectedFromOutOfCall() {
|
|
3825
|
+
this.connectionManager.on("disconnected", () => {
|
|
3826
|
+
this.isCallActive || this.events.trigger("disconnected-from-out-of-call", {});
|
|
3827
|
+
});
|
|
3828
|
+
}
|
|
3780
3829
|
subscribeChangeRole() {
|
|
3781
3830
|
this.apiManager.on("participant:move-request-to-participants", () => {
|
|
3782
3831
|
this.callManager.setCallRoleParticipant();
|
|
3783
3832
|
}), this.apiManager.on("participant:move-request-to-spectators-synthetic", () => {
|
|
3784
|
-
this.callManager.setCallRoleSpectatorSynthetic()
|
|
3833
|
+
this.callManager.setCallRoleSpectatorSynthetic(), this.stopPresentation().catch(() => {
|
|
3834
|
+
});
|
|
3785
3835
|
}), this.apiManager.on("participant:move-request-to-spectators-with-audio-id", ({ audioId: e }) => {
|
|
3786
|
-
this.callManager.setCallRoleSpectator({ audioId: e, sendOffer: this.sendOffer })
|
|
3836
|
+
this.callManager.setCallRoleSpectator({ audioId: e, sendOffer: this.sendOffer }), this.stopPresentation().catch(() => {
|
|
3837
|
+
});
|
|
3787
3838
|
});
|
|
3788
3839
|
}
|
|
3789
3840
|
sendOffer = async (e, t) => {
|
|
3790
3841
|
const i = this.connectionManager.getConnectionConfiguration()?.sipServerUrl;
|
|
3791
3842
|
if (i === void 0)
|
|
3792
3843
|
throw new Error("No sipServerUrl for sendOffer");
|
|
3793
|
-
return
|
|
3844
|
+
return Xt({
|
|
3794
3845
|
serverUrl: i,
|
|
3795
3846
|
offer: t,
|
|
3796
3847
|
conferenceNumber: e.conferenceNumber,
|
|
@@ -3799,13 +3850,13 @@ class Zn {
|
|
|
3799
3850
|
});
|
|
3800
3851
|
};
|
|
3801
3852
|
setCodecPreferences(e) {
|
|
3802
|
-
|
|
3853
|
+
dn(e, {
|
|
3803
3854
|
preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
|
|
3804
3855
|
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
3805
3856
|
});
|
|
3806
3857
|
}
|
|
3807
3858
|
subscribe() {
|
|
3808
|
-
this.bridgeEvents("auto-connect", this.autoConnectorManager), this.bridgeEvents("connection", this.connectionManager), this.bridgeEvents("call", this.callManager), this.bridgeEvents("api", this.apiManager), this.bridgeEvents("incoming-call", this.incomingCallManager), this.bridgeEvents("presentation", this.presentationManager), this.bridgeEvents("stats", this.statsManager), this.bridgeEvents("video-balancer", this.videoSendingBalancerManager), this.subscribeChangeRole();
|
|
3859
|
+
this.bridgeEvents("auto-connect", this.autoConnectorManager), this.bridgeEvents("connection", this.connectionManager), this.bridgeEvents("call", this.callManager), this.bridgeEvents("api", this.apiManager), this.bridgeEvents("incoming-call", this.incomingCallManager), this.bridgeEvents("presentation", this.presentationManager), this.bridgeEvents("stats", this.statsManager), this.bridgeEvents("video-balancer", this.videoSendingBalancerManager), this.subscribeChangeRole(), this.subscribeDisconnectedFromOutOfCall();
|
|
3809
3860
|
}
|
|
3810
3861
|
bridgeEvents = (e, t) => {
|
|
3811
3862
|
t.events.eachTriggers((s, i) => {
|
|
@@ -3819,20 +3870,20 @@ class Zn {
|
|
|
3819
3870
|
};
|
|
3820
3871
|
}
|
|
3821
3872
|
export {
|
|
3822
|
-
|
|
3873
|
+
he as E,
|
|
3823
3874
|
Ge as O,
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3875
|
+
ts as S,
|
|
3876
|
+
ge as a,
|
|
3877
|
+
dt as b,
|
|
3827
3878
|
We as c,
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3879
|
+
Zn as d,
|
|
3880
|
+
jn as e,
|
|
3881
|
+
es as f,
|
|
3831
3882
|
E as g,
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3883
|
+
vt as h,
|
|
3884
|
+
sn as i,
|
|
3885
|
+
gn as j,
|
|
3835
3886
|
h as l,
|
|
3836
|
-
|
|
3837
|
-
|
|
3887
|
+
F as p,
|
|
3888
|
+
Xt as s
|
|
3838
3889
|
};
|