sip-connector 15.2.0 → 15.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@SipConnector-DV4Ywba-.cjs +1 -0
- package/dist/{@SipConnector-BEZk1hmx.js → @SipConnector-Gt9XLkRE.js} +151 -121
- package/dist/ApiManager/@ApiManager.d.ts +3 -0
- package/dist/ApiManager/constants.d.ts +4 -2
- package/dist/StatsManager/@StatsManager.d.ts +9 -1
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/package.json +3 -3
- package/dist/@SipConnector-hpySQIBa.cjs +0 -1
|
@@ -41,7 +41,7 @@ const z = [
|
|
|
41
41
|
], Q = [
|
|
42
42
|
...z,
|
|
43
43
|
...he
|
|
44
|
-
],
|
|
44
|
+
], le = (n, e) => {
|
|
45
45
|
n.getVideoTracks().forEach((s) => {
|
|
46
46
|
"contentHint" in s && s.contentHint !== e && (s.contentHint = e);
|
|
47
47
|
});
|
|
@@ -53,12 +53,12 @@ const z = [
|
|
|
53
53
|
if (!n || e === "recvonly" && t === "recvonly")
|
|
54
54
|
return;
|
|
55
55
|
const i = t === "recvonly" ? [] : n.getAudioTracks(), r = e === "recvonly" ? [] : n.getVideoTracks(), a = [...i, ...r], o = new MediaStream(a);
|
|
56
|
-
return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" &&
|
|
56
|
+
return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" && le(o, s), o;
|
|
57
57
|
};
|
|
58
58
|
function Se(n) {
|
|
59
59
|
return (e) => `sip:${e}@${n}`;
|
|
60
60
|
}
|
|
61
|
-
const
|
|
61
|
+
const Ee = (n, e) => () => Math.floor(Math.random() * (e - n)) + n, X = (n) => n.trim().replaceAll(" ", "_"), ue = Ee(1e5, 99999999), Ce = (n) => n.some((t) => {
|
|
62
62
|
const { kind: s } = t;
|
|
63
63
|
return s === "video";
|
|
64
64
|
});
|
|
@@ -129,20 +129,20 @@ class Re extends Ne {
|
|
|
129
129
|
iceServers: o,
|
|
130
130
|
directionVideo: c,
|
|
131
131
|
directionAudio: g,
|
|
132
|
-
contentHint:
|
|
132
|
+
contentHint: l,
|
|
133
133
|
offerToReceiveAudio: u = !0,
|
|
134
134
|
offerToReceiveVideo: d = !0,
|
|
135
135
|
sendEncodings: S,
|
|
136
136
|
onAddedTransceiver: _
|
|
137
137
|
}) => (this.isPendingCall = !0, new Promise((C, p) => {
|
|
138
|
-
this.callConfiguration.number = s, this.callConfiguration.answer = !1, this.handleCall({ ontrack: a }).then(C).catch((
|
|
139
|
-
p(
|
|
138
|
+
this.callConfiguration.number = s, this.callConfiguration.answer = !1, this.handleCall({ ontrack: a }).then(C).catch((v) => {
|
|
139
|
+
p(v);
|
|
140
140
|
}), this.rtcSession = e.call(t(s), {
|
|
141
141
|
extraHeaders: r,
|
|
142
142
|
mediaStream: w(i, {
|
|
143
143
|
directionVideo: c,
|
|
144
144
|
directionAudio: g,
|
|
145
|
-
contentHint:
|
|
145
|
+
contentHint: l
|
|
146
146
|
}),
|
|
147
147
|
// необходимо передавать в методе call, чтобы подписаться на события peerconnection,
|
|
148
148
|
// так как в методе call создается RTCSession
|
|
@@ -182,19 +182,19 @@ class Re extends Ne {
|
|
|
182
182
|
directionAudio: o,
|
|
183
183
|
offerToReceiveAudio: c,
|
|
184
184
|
offerToReceiveVideo: g,
|
|
185
|
-
contentHint:
|
|
185
|
+
contentHint: l,
|
|
186
186
|
sendEncodings: u,
|
|
187
187
|
onAddedTransceiver: d
|
|
188
188
|
}) => (this.isPendingAnswer = !0, new Promise((S, _) => {
|
|
189
189
|
try {
|
|
190
190
|
const C = e();
|
|
191
|
-
this.rtcSession = C, this.subscribeToSessionEvents(C), this.callConfiguration.answer = !0, this.callConfiguration.number = C.remote_identity.uri.user, this.handleCall({ ontrack: s }).then(S).catch((
|
|
192
|
-
_(
|
|
191
|
+
this.rtcSession = C, this.subscribeToSessionEvents(C), this.callConfiguration.answer = !0, this.callConfiguration.number = C.remote_identity.uri.user, this.handleCall({ ontrack: s }).then(S).catch((v) => {
|
|
192
|
+
_(v);
|
|
193
193
|
});
|
|
194
194
|
const p = w(t, {
|
|
195
195
|
directionVideo: a,
|
|
196
196
|
directionAudio: o,
|
|
197
|
-
contentHint:
|
|
197
|
+
contentHint: l
|
|
198
198
|
});
|
|
199
199
|
C.answer({
|
|
200
200
|
extraHeaders: i,
|
|
@@ -241,9 +241,9 @@ class Re extends Ne {
|
|
|
241
241
|
ontrack: e
|
|
242
242
|
}) => new Promise((t, s) => {
|
|
243
243
|
const i = () => {
|
|
244
|
-
this.events.on(N.PEER_CONNECTION,
|
|
244
|
+
this.events.on(N.PEER_CONNECTION, l), this.events.on(N.CONFIRMED, u);
|
|
245
245
|
}, r = () => {
|
|
246
|
-
this.events.off(N.PEER_CONNECTION,
|
|
246
|
+
this.events.off(N.PEER_CONNECTION, l), this.events.off(N.CONFIRMED, u);
|
|
247
247
|
}, a = () => {
|
|
248
248
|
this.events.on(N.FAILED, c), this.events.on(N.ENDED, c);
|
|
249
249
|
}, o = () => {
|
|
@@ -252,7 +252,7 @@ class Re extends Ne {
|
|
|
252
252
|
r(), o(), s(d);
|
|
253
253
|
};
|
|
254
254
|
let g;
|
|
255
|
-
const
|
|
255
|
+
const l = ({ peerconnection: d }) => {
|
|
256
256
|
g = d;
|
|
257
257
|
const S = (_) => {
|
|
258
258
|
this.events.trigger(N.PEER_CONNECTION_ONTRACK, d), e && e(_);
|
|
@@ -334,12 +334,12 @@ class _e {
|
|
|
334
334
|
getRemoteStreams = () => this.strategy.getRemoteStreams();
|
|
335
335
|
replaceMediaStream = async (...e) => this.strategy.replaceMediaStream(...e);
|
|
336
336
|
}
|
|
337
|
-
const
|
|
338
|
-
B.enable(
|
|
339
|
-
},
|
|
340
|
-
B.enable(`-${
|
|
341
|
-
}, Ie = "Error decline with 603", Me = 1006, pe = (n) => typeof n == "object" && n !== null && "code" in n && n.code === Me,
|
|
342
|
-
var h = /* @__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))(h || {}), L = /* @__PURE__ */ ((n) => (n.AVAILABLE_SECOND_REMOTE_STREAM = "YOUCANRECEIVECONTENT", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "CONTENTEND", n.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", n))(L || {}), F = /* @__PURE__ */ ((n) => (n.SPECTATOR = "SPECTATOR", n.PARTICIPANT = "PARTICIPANT", n.SPECTATOR_OVER_SFU = "SPECTATOROVERSFU", n))(F || {}),
|
|
337
|
+
const G = "sip-connector", P = B(G), ht = () => {
|
|
338
|
+
B.enable(G);
|
|
339
|
+
}, lt = () => {
|
|
340
|
+
B.enable(`-${G}`);
|
|
341
|
+
}, Ie = "Error decline with 603", Me = 1006, pe = (n) => typeof n == "object" && n !== null && "code" in n && n.code === Me, me = (n) => n.message === Ie;
|
|
342
|
+
var h = /* @__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))(h || {}), L = /* @__PURE__ */ ((n) => (n.AVAILABLE_SECOND_REMOTE_STREAM = "YOUCANRECEIVECONTENT", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "CONTENTEND", n.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", n))(L || {}), F = /* @__PURE__ */ ((n) => (n.SPECTATOR = "SPECTATOR", n.PARTICIPANT = "PARTICIPANT", n.SPECTATOR_OVER_SFU = "SPECTATOROVERSFU", n))(F || {}), m = /* @__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))(m || {}), I = /* @__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))(I || {}), y = /* @__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))(y || {}), k = /* @__PURE__ */ ((n) => (n.ADMIN_STOP_MIC = "ADMINSTOPMIC", n.ADMIN_START_MIC = "ADMINSTARTMIC", n))(k || {}), W = /* @__PURE__ */ ((n) => (n.ADMIN_SYNC_FORCED = "1", n.ADMIN_SYNC_NOT_FORCED = "0", n))(W || {}), Pe = /* @__PURE__ */ ((n) => (n.AUDIO = "AUDIO", n.VIDEO = "VIDEO", n.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", n))(Pe || {}), T = /* @__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.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_OVER_SFU = "participant:move-request-to-spectators-over-sfu", 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))(T || {});
|
|
343
343
|
const j = [
|
|
344
344
|
"participation:accepting-word-request",
|
|
345
345
|
"participation:cancelling-word-request",
|
|
@@ -371,7 +371,7 @@ const j = [
|
|
|
371
371
|
"newDTMF"
|
|
372
372
|
];
|
|
373
373
|
var R = /* @__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))(R || {});
|
|
374
|
-
class
|
|
374
|
+
class Oe {
|
|
375
375
|
events;
|
|
376
376
|
connectionManager;
|
|
377
377
|
callManager;
|
|
@@ -422,6 +422,15 @@ class me {
|
|
|
422
422
|
extraHeaders: c
|
|
423
423
|
});
|
|
424
424
|
}
|
|
425
|
+
async sendStats({
|
|
426
|
+
availableIncomingBitrate: e
|
|
427
|
+
}) {
|
|
428
|
+
const t = this.getEstablishedRTCSessionProtected(), i = [`${h.AVAILABLE_INCOMING_BITRATE}: ${e}`];
|
|
429
|
+
return t.sendInfo(I.STATS, void 0, {
|
|
430
|
+
noTerminateWhenError: !0,
|
|
431
|
+
extraHeaders: i
|
|
432
|
+
});
|
|
433
|
+
}
|
|
425
434
|
async sendRefusalToTurnOn(e, t = {}) {
|
|
426
435
|
const s = this.getEstablishedRTCSessionProtected(), a = e === "mic" ? 0 : 1, c = [`${h.MEDIA_TYPE}: ${a}`];
|
|
427
436
|
return s.sendInfo(I.REFUSAL, void 0, {
|
|
@@ -468,7 +477,7 @@ class me {
|
|
|
468
477
|
...e,
|
|
469
478
|
extraHeaders: s
|
|
470
479
|
}).catch((i) => {
|
|
471
|
-
if (
|
|
480
|
+
if (me(i))
|
|
472
481
|
throw i;
|
|
473
482
|
});
|
|
474
483
|
}
|
|
@@ -513,7 +522,7 @@ class me {
|
|
|
513
522
|
this.handleNotify(s);
|
|
514
523
|
}
|
|
515
524
|
} catch (t) {
|
|
516
|
-
|
|
525
|
+
P("error parse notify", t);
|
|
517
526
|
}
|
|
518
527
|
};
|
|
519
528
|
handleNotify = (e) => {
|
|
@@ -572,7 +581,7 @@ class me {
|
|
|
572
581
|
break;
|
|
573
582
|
}
|
|
574
583
|
default:
|
|
575
|
-
|
|
584
|
+
P("unknown cmd", e);
|
|
576
585
|
}
|
|
577
586
|
};
|
|
578
587
|
handleNewInfo = (e) => {
|
|
@@ -582,31 +591,31 @@ class me {
|
|
|
582
591
|
const { request: s } = e, i = s.getHeader(h.CONTENT_TYPE);
|
|
583
592
|
if (i !== void 0)
|
|
584
593
|
switch (i) {
|
|
585
|
-
case
|
|
594
|
+
case m.ENTER_ROOM: {
|
|
586
595
|
this.triggerEnterRoom(s), this.maybeTriggerChannels(s);
|
|
587
596
|
break;
|
|
588
597
|
}
|
|
589
|
-
case
|
|
598
|
+
case m.NOTIFY: {
|
|
590
599
|
this.maybeHandleNotify(s);
|
|
591
600
|
break;
|
|
592
601
|
}
|
|
593
|
-
case
|
|
602
|
+
case m.SHARE_STATE: {
|
|
594
603
|
this.triggerShareState(s);
|
|
595
604
|
break;
|
|
596
605
|
}
|
|
597
|
-
case
|
|
606
|
+
case m.MAIN_CAM: {
|
|
598
607
|
this.triggerMainCamControl(s);
|
|
599
608
|
break;
|
|
600
609
|
}
|
|
601
|
-
case
|
|
610
|
+
case m.MIC: {
|
|
602
611
|
this.triggerMicControl(s);
|
|
603
612
|
break;
|
|
604
613
|
}
|
|
605
|
-
case
|
|
614
|
+
case m.USE_LICENSE: {
|
|
606
615
|
this.triggerUseLicense(s);
|
|
607
616
|
break;
|
|
608
617
|
}
|
|
609
|
-
case
|
|
618
|
+
case m.PARTICIPANT_STATE: {
|
|
610
619
|
this.maybeTriggerParticipantMoveRequest(s);
|
|
611
620
|
break;
|
|
612
621
|
}
|
|
@@ -772,7 +781,7 @@ const K = [
|
|
|
772
781
|
"presentation:ended",
|
|
773
782
|
"presentation:failed"
|
|
774
783
|
], fe = 1, St = (n) => ce(n);
|
|
775
|
-
class
|
|
784
|
+
class ve {
|
|
776
785
|
events;
|
|
777
786
|
promisePendingStartPresentation;
|
|
778
787
|
promisePendingStopPresentation;
|
|
@@ -908,8 +917,8 @@ class De {
|
|
|
908
917
|
const g = e().then(async () => t.startPresentation(c, i, {
|
|
909
918
|
sendEncodings: a,
|
|
910
919
|
onAddedTransceiver: o
|
|
911
|
-
})).then(() => s).catch((
|
|
912
|
-
throw this.removeStreamPresentationCurrent(), this.events.trigger(M.FAILED_PRESENTATION,
|
|
920
|
+
})).then(() => s).catch((l) => {
|
|
921
|
+
throw this.removeStreamPresentationCurrent(), this.events.trigger(M.FAILED_PRESENTATION, l), l;
|
|
913
922
|
});
|
|
914
923
|
return this.promisePendingStartPresentation = g, g.finally(() => {
|
|
915
924
|
this.promisePendingStartPresentation = void 0;
|
|
@@ -934,7 +943,7 @@ class De {
|
|
|
934
943
|
delete this.streamPresentationCurrent;
|
|
935
944
|
}
|
|
936
945
|
}
|
|
937
|
-
class
|
|
946
|
+
class De {
|
|
938
947
|
data = {};
|
|
939
948
|
getUa;
|
|
940
949
|
constructor(e) {
|
|
@@ -1019,7 +1028,7 @@ const Z = [
|
|
|
1019
1028
|
"newMessage",
|
|
1020
1029
|
"sipEvent"
|
|
1021
1030
|
], ee = [...Z], ye = 3;
|
|
1022
|
-
class
|
|
1031
|
+
class be {
|
|
1023
1032
|
cancelableConnectWithRepeatedCalls;
|
|
1024
1033
|
JsSIP;
|
|
1025
1034
|
events;
|
|
@@ -1094,7 +1103,7 @@ class Ue {
|
|
|
1094
1103
|
registerExpires: o,
|
|
1095
1104
|
connectionRecoveryMinInterval: c,
|
|
1096
1105
|
connectionRecoveryMaxInterval: g,
|
|
1097
|
-
userAgent:
|
|
1106
|
+
userAgent: l,
|
|
1098
1107
|
displayName: u = "",
|
|
1099
1108
|
register: d = !1,
|
|
1100
1109
|
extraHeaders: S = []
|
|
@@ -1118,7 +1127,7 @@ class Ue {
|
|
|
1118
1127
|
registerExpires: o,
|
|
1119
1128
|
connectionRecoveryMinInterval: c,
|
|
1120
1129
|
connectionRecoveryMaxInterval: g,
|
|
1121
|
-
userAgent:
|
|
1130
|
+
userAgent: l,
|
|
1122
1131
|
remoteAddress: r,
|
|
1123
1132
|
extraHeaders: S
|
|
1124
1133
|
},
|
|
@@ -1155,17 +1164,17 @@ class Ue {
|
|
|
1155
1164
|
}
|
|
1156
1165
|
}
|
|
1157
1166
|
var te = /* @__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))(te || {});
|
|
1158
|
-
const
|
|
1167
|
+
const Ue = ge({
|
|
1159
1168
|
types: {
|
|
1160
1169
|
context: {},
|
|
1161
1170
|
events: {}
|
|
1162
1171
|
},
|
|
1163
1172
|
actions: {
|
|
1164
1173
|
logTransition: (n, e) => {
|
|
1165
|
-
|
|
1174
|
+
P(`State transition: ${e.from} -> ${e.to} (${e.event})`);
|
|
1166
1175
|
},
|
|
1167
1176
|
logStateChange: (n, e) => {
|
|
1168
|
-
|
|
1177
|
+
P("ConnectionStateMachine state changed", e.state);
|
|
1169
1178
|
}
|
|
1170
1179
|
}
|
|
1171
1180
|
}).createMachine({
|
|
@@ -1476,7 +1485,7 @@ class we {
|
|
|
1476
1485
|
unsubscribeFromEvents;
|
|
1477
1486
|
actorSubscription;
|
|
1478
1487
|
constructor(e) {
|
|
1479
|
-
this.events = e, this.actor = de(
|
|
1488
|
+
this.events = e, this.actor = de(Ue), this.actorSubscription = this.actor.subscribe((t) => {
|
|
1480
1489
|
const s = t.value;
|
|
1481
1490
|
this.stateChangeListeners.forEach((i) => {
|
|
1482
1491
|
i(s);
|
|
@@ -1570,7 +1579,7 @@ class we {
|
|
|
1570
1579
|
sendEvent(e) {
|
|
1571
1580
|
const t = this.actor.getSnapshot(), s = { type: e };
|
|
1572
1581
|
if (!t.can(s)) {
|
|
1573
|
-
|
|
1582
|
+
P(
|
|
1574
1583
|
`Invalid transition: ${s.type} from ${this.state}. Event cannot be processed in current state.`
|
|
1575
1584
|
);
|
|
1576
1585
|
return;
|
|
@@ -1653,7 +1662,7 @@ class Le {
|
|
|
1653
1662
|
try {
|
|
1654
1663
|
await this.unregister();
|
|
1655
1664
|
} catch (e) {
|
|
1656
|
-
|
|
1665
|
+
P("tryRegister", e);
|
|
1657
1666
|
}
|
|
1658
1667
|
return this.register();
|
|
1659
1668
|
}
|
|
@@ -1719,17 +1728,17 @@ class Fe {
|
|
|
1719
1728
|
displayName: t,
|
|
1720
1729
|
userAgent: e,
|
|
1721
1730
|
sipServerUrl: s
|
|
1722
|
-
}),
|
|
1731
|
+
}), l = this.uaFactory.createUA({ ...g, remoteAddress: r, extraHeaders: a }), u = () => {
|
|
1723
1732
|
const S = new Error("Telephony is not available");
|
|
1724
1733
|
c(S);
|
|
1725
1734
|
};
|
|
1726
|
-
|
|
1735
|
+
l.once(A.DISCONNECTED, u);
|
|
1727
1736
|
const d = () => {
|
|
1728
|
-
|
|
1737
|
+
l.removeAllListeners(), l.once(A.DISCONNECTED, () => {
|
|
1729
1738
|
o();
|
|
1730
|
-
}),
|
|
1739
|
+
}), l.stop();
|
|
1731
1740
|
};
|
|
1732
|
-
|
|
1741
|
+
l.once(A.CONNECTED, d), l.start();
|
|
1733
1742
|
});
|
|
1734
1743
|
}
|
|
1735
1744
|
}
|
|
@@ -1737,7 +1746,7 @@ const $e = (n) => {
|
|
|
1737
1746
|
const e = [];
|
|
1738
1747
|
return n !== void 0 && n !== "" && e.push(`X-Vinteo-Remote: ${n}`), e;
|
|
1739
1748
|
};
|
|
1740
|
-
class
|
|
1749
|
+
class O {
|
|
1741
1750
|
JsSIP;
|
|
1742
1751
|
constructor(e) {
|
|
1743
1752
|
this.JsSIP = e;
|
|
@@ -1779,17 +1788,17 @@ class m {
|
|
|
1779
1788
|
registerExpires: c = 300,
|
|
1780
1789
|
// 5 minutes in sec
|
|
1781
1790
|
connectionRecoveryMinInterval: g = 2,
|
|
1782
|
-
connectionRecoveryMaxInterval:
|
|
1791
|
+
connectionRecoveryMaxInterval: l = 6,
|
|
1783
1792
|
userAgent: u
|
|
1784
1793
|
}) {
|
|
1785
|
-
|
|
1794
|
+
O.validateConfiguration({
|
|
1786
1795
|
register: a,
|
|
1787
1796
|
password: t,
|
|
1788
1797
|
user: e,
|
|
1789
1798
|
sipServerUrl: r,
|
|
1790
1799
|
sipWebSocketServerURL: s
|
|
1791
1800
|
});
|
|
1792
|
-
const d =
|
|
1801
|
+
const d = O.resolveAuthorizationUser(a, e), S = Se(r), _ = S(d), C = new this.JsSIP.WebSocketInterface(s);
|
|
1793
1802
|
return {
|
|
1794
1803
|
configuration: {
|
|
1795
1804
|
password: t,
|
|
@@ -1802,7 +1811,7 @@ class m {
|
|
|
1802
1811
|
session_timers: o,
|
|
1803
1812
|
register_expires: c,
|
|
1804
1813
|
connection_recovery_min_interval: g,
|
|
1805
|
-
connection_recovery_max_interval:
|
|
1814
|
+
connection_recovery_max_interval: l
|
|
1806
1815
|
},
|
|
1807
1816
|
helpers: {
|
|
1808
1817
|
socket: C,
|
|
@@ -1811,7 +1820,7 @@ class m {
|
|
|
1811
1820
|
};
|
|
1812
1821
|
}
|
|
1813
1822
|
createUA({ remoteAddress: e, extraHeaders: t, ...s }) {
|
|
1814
|
-
const i = new this.JsSIP.UA(s), r =
|
|
1823
|
+
const i = new this.JsSIP.UA(s), r = O.buildExtraHeaders(e, t);
|
|
1815
1824
|
return r.length > 0 && i.registrator().setExtraHeaders(r), i;
|
|
1816
1825
|
}
|
|
1817
1826
|
/**
|
|
@@ -1841,15 +1850,15 @@ class ke {
|
|
|
1841
1850
|
configurationManager;
|
|
1842
1851
|
JsSIP;
|
|
1843
1852
|
constructor({ JsSIP: e }) {
|
|
1844
|
-
this.JsSIP = e, this.events = new f(ee), this.uaFactory = new
|
|
1853
|
+
this.JsSIP = e, this.events = new f(ee), this.uaFactory = new O(e), this.registrationManager = new Le({
|
|
1845
1854
|
events: this.events,
|
|
1846
1855
|
getUaProtected: this.getUaProtected
|
|
1847
|
-
}), this.stateMachine = new we(this.events), this.configurationManager = new
|
|
1856
|
+
}), this.stateMachine = new we(this.events), this.configurationManager = new De({
|
|
1848
1857
|
getUa: this.getUa
|
|
1849
1858
|
}), this.sipOperations = new Fe({
|
|
1850
1859
|
uaFactory: this.uaFactory,
|
|
1851
1860
|
getUaProtected: this.getUaProtected
|
|
1852
|
-
}), this.connectionFlow = new
|
|
1861
|
+
}), this.connectionFlow = new be({
|
|
1853
1862
|
JsSIP: this.JsSIP,
|
|
1854
1863
|
events: this.events,
|
|
1855
1864
|
uaFactory: this.uaFactory,
|
|
@@ -1887,7 +1896,7 @@ class ke {
|
|
|
1887
1896
|
return this.stateMachine.state;
|
|
1888
1897
|
}
|
|
1889
1898
|
get isRegistered() {
|
|
1890
|
-
return
|
|
1899
|
+
return O.isRegisteredUA(this.ua);
|
|
1891
1900
|
}
|
|
1892
1901
|
get isRegisterConfig() {
|
|
1893
1902
|
return this.configurationManager.isRegister();
|
|
@@ -1940,7 +1949,7 @@ class ke {
|
|
|
1940
1949
|
};
|
|
1941
1950
|
getUa = () => this.ua;
|
|
1942
1951
|
}
|
|
1943
|
-
var
|
|
1952
|
+
var b = /* @__PURE__ */ ((n) => (n.INCOMING_CALL = "incomingCall", n.DECLINED_INCOMING_CALL = "declinedIncomingCall", n.TERMINATED_INCOMING_CALL = "terminatedIncomingCall", n.FAILED_INCOMING_CALL = "failedIncomingCall", n))(b || {}), V = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))(V || {});
|
|
1944
1953
|
const ne = [
|
|
1945
1954
|
"incomingCall",
|
|
1946
1955
|
"declinedIncomingCall",
|
|
@@ -1987,7 +1996,7 @@ class Be {
|
|
|
1987
1996
|
return new Promise((t, s) => {
|
|
1988
1997
|
try {
|
|
1989
1998
|
const i = this.getIncomingRTCSession(), r = this.remoteCallerData;
|
|
1990
|
-
this.removeIncomingSession(), this.events.trigger(
|
|
1999
|
+
this.removeIncomingSession(), this.events.trigger(b.DECLINED_INCOMING_CALL, r), i.terminate({ status_code: e }), t();
|
|
1991
2000
|
} catch (i) {
|
|
1992
2001
|
s(i);
|
|
1993
2002
|
}
|
|
@@ -2031,19 +2040,19 @@ class Be {
|
|
|
2031
2040
|
this.incomingRTCSession = e;
|
|
2032
2041
|
const t = this.remoteCallerData;
|
|
2033
2042
|
e.on("failed", (s) => {
|
|
2034
|
-
this.removeIncomingSession(), s.originator === V.LOCAL ? this.events.trigger(
|
|
2035
|
-
}), this.events.trigger(
|
|
2043
|
+
this.removeIncomingSession(), s.originator === V.LOCAL ? this.events.trigger(b.TERMINATED_INCOMING_CALL, t) : this.events.trigger(b.FAILED_INCOMING_CALL, t);
|
|
2044
|
+
}), this.events.trigger(b.INCOMING_CALL, t);
|
|
2036
2045
|
}
|
|
2037
2046
|
removeIncomingSession() {
|
|
2038
2047
|
delete this.incomingRTCSession;
|
|
2039
2048
|
}
|
|
2040
2049
|
}
|
|
2041
|
-
const
|
|
2042
|
-
var
|
|
2043
|
-
const se = ["collected"],
|
|
2050
|
+
const D = 1e3;
|
|
2051
|
+
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 || {});
|
|
2052
|
+
const se = ["collected"], H = () => "performance" in window ? performance.now() : Date.now(), U = (n) => [...n.keys()].reduce((e, t) => {
|
|
2044
2053
|
const s = n.get(t);
|
|
2045
2054
|
return s === void 0 ? e : { ...e, [s.type]: s };
|
|
2046
|
-
}, {}),
|
|
2055
|
+
}, {}), Ge = (n) => {
|
|
2047
2056
|
if (!n)
|
|
2048
2057
|
return {
|
|
2049
2058
|
outboundRtp: void 0,
|
|
@@ -2051,14 +2060,14 @@ const se = ["collected"], q = () => "performance" in window ? performance.now()
|
|
|
2051
2060
|
mediaSource: void 0,
|
|
2052
2061
|
remoteInboundRtp: void 0
|
|
2053
2062
|
};
|
|
2054
|
-
const e =
|
|
2063
|
+
const e = U(n);
|
|
2055
2064
|
return {
|
|
2056
|
-
outboundRtp: e[
|
|
2057
|
-
codec: e[
|
|
2058
|
-
mediaSource: e[
|
|
2059
|
-
remoteInboundRtp: e[
|
|
2065
|
+
outboundRtp: e[E.OUTBOUND_RTP],
|
|
2066
|
+
codec: e[E.CODEC],
|
|
2067
|
+
mediaSource: e[E.MEDIA_SOURCE],
|
|
2068
|
+
remoteInboundRtp: e[E.REMOTE_INBOUND_RTP]
|
|
2060
2069
|
};
|
|
2061
|
-
},
|
|
2070
|
+
}, q = (n) => {
|
|
2062
2071
|
if (!n)
|
|
2063
2072
|
return {
|
|
2064
2073
|
outboundRtp: void 0,
|
|
@@ -2066,12 +2075,12 @@ const se = ["collected"], q = () => "performance" in window ? performance.now()
|
|
|
2066
2075
|
mediaSource: void 0,
|
|
2067
2076
|
remoteInboundRtp: void 0
|
|
2068
2077
|
};
|
|
2069
|
-
const e =
|
|
2078
|
+
const e = U(n);
|
|
2070
2079
|
return {
|
|
2071
|
-
outboundRtp: e[
|
|
2072
|
-
codec: e[
|
|
2073
|
-
mediaSource: e[
|
|
2074
|
-
remoteInboundRtp: e[
|
|
2080
|
+
outboundRtp: e[E.OUTBOUND_RTP],
|
|
2081
|
+
codec: e[E.CODEC],
|
|
2082
|
+
mediaSource: e[E.MEDIA_SOURCE],
|
|
2083
|
+
remoteInboundRtp: e[E.REMOTE_INBOUND_RTP]
|
|
2075
2084
|
};
|
|
2076
2085
|
}, x = ({
|
|
2077
2086
|
videoReceiversStats: n,
|
|
@@ -2083,13 +2092,13 @@ const se = ["collected"], q = () => "performance" in window ? performance.now()
|
|
|
2083
2092
|
codec: void 0,
|
|
2084
2093
|
synchronizationSources: e
|
|
2085
2094
|
};
|
|
2086
|
-
const t =
|
|
2095
|
+
const t = U(n);
|
|
2087
2096
|
return {
|
|
2088
|
-
inboundRtp: t[
|
|
2089
|
-
codec: t[
|
|
2097
|
+
inboundRtp: t[E.INBOUND_RTP],
|
|
2098
|
+
codec: t[E.CODEC],
|
|
2090
2099
|
synchronizationSources: e
|
|
2091
2100
|
};
|
|
2092
|
-
},
|
|
2101
|
+
}, He = ({
|
|
2093
2102
|
audioReceiverStats: n,
|
|
2094
2103
|
synchronizationSourcesAudio: e
|
|
2095
2104
|
}) => {
|
|
@@ -2100,11 +2109,11 @@ const se = ["collected"], q = () => "performance" in window ? performance.now()
|
|
|
2100
2109
|
remoteOutboundRtp: void 0,
|
|
2101
2110
|
synchronizationSources: e
|
|
2102
2111
|
};
|
|
2103
|
-
const t =
|
|
2112
|
+
const t = U(n);
|
|
2104
2113
|
return {
|
|
2105
|
-
inboundRtp: t[
|
|
2106
|
-
codec: t[
|
|
2107
|
-
remoteOutboundRtp: t[
|
|
2114
|
+
inboundRtp: t[E.INBOUND_RTP],
|
|
2115
|
+
codec: t[E.CODEC],
|
|
2116
|
+
remoteOutboundRtp: t[E.REMOTE_OUTBOUND_RTP],
|
|
2108
2117
|
synchronizationSources: e
|
|
2109
2118
|
};
|
|
2110
2119
|
}, ie = (n) => {
|
|
@@ -2116,22 +2125,22 @@ const se = ["collected"], q = () => "performance" in window ? performance.now()
|
|
|
2116
2125
|
remoteCandidate: void 0,
|
|
2117
2126
|
transport: void 0
|
|
2118
2127
|
};
|
|
2119
|
-
const e =
|
|
2128
|
+
const e = U(n);
|
|
2120
2129
|
return {
|
|
2121
|
-
candidatePair: e[
|
|
2122
|
-
certificate: e[
|
|
2123
|
-
localCandidate: e[
|
|
2124
|
-
remoteCandidate: e[
|
|
2125
|
-
transport: e[
|
|
2130
|
+
candidatePair: e[E.CANDIDATE_PAIR],
|
|
2131
|
+
certificate: e[E.CERTIFICATE],
|
|
2132
|
+
localCandidate: e[E.LOCAL_CANDIDATE],
|
|
2133
|
+
remoteCandidate: e[E.REMOTE_CANDIDATE],
|
|
2134
|
+
transport: e[E.TRANSPORT]
|
|
2126
2135
|
};
|
|
2127
|
-
},
|
|
2136
|
+
}, qe = ({
|
|
2128
2137
|
audioSenderStats: n,
|
|
2129
2138
|
videoSenderFirstStats: e,
|
|
2130
2139
|
videoSenderSecondStats: t
|
|
2131
2140
|
}) => ({
|
|
2132
|
-
video:
|
|
2133
|
-
secondVideo:
|
|
2134
|
-
audio:
|
|
2141
|
+
video: q(e),
|
|
2142
|
+
secondVideo: q(t),
|
|
2143
|
+
audio: Ge(n),
|
|
2135
2144
|
additional: ie(
|
|
2136
2145
|
n ?? e ?? t
|
|
2137
2146
|
)
|
|
@@ -2149,7 +2158,7 @@ const se = ["collected"], q = () => "performance" in window ? performance.now()
|
|
|
2149
2158
|
videoReceiversStats: t,
|
|
2150
2159
|
synchronizationSourcesVideo: s.video
|
|
2151
2160
|
}),
|
|
2152
|
-
audio:
|
|
2161
|
+
audio: He({
|
|
2153
2162
|
audioReceiverStats: n,
|
|
2154
2163
|
synchronizationSourcesAudio: s.audio
|
|
2155
2164
|
}),
|
|
@@ -2165,7 +2174,7 @@ const se = ["collected"], q = () => "performance" in window ? performance.now()
|
|
|
2165
2174
|
videoReceiverSecondStats: r,
|
|
2166
2175
|
synchronizationSources: a
|
|
2167
2176
|
}) => {
|
|
2168
|
-
const o =
|
|
2177
|
+
const o = qe({
|
|
2169
2178
|
audioSenderStats: n,
|
|
2170
2179
|
videoSenderFirstStats: e,
|
|
2171
2180
|
videoSenderSecondStats: t
|
|
@@ -2183,12 +2192,12 @@ const se = ["collected"], q = () => "performance" in window ? performance.now()
|
|
|
2183
2192
|
const e = "audio", t = "video", s = n.getSenders(), i = s.find((d) => d.track?.kind === e), r = s.filter((d) => d.track?.kind === t), a = n.getReceivers(), o = a.find((d) => d.track.kind === e), c = a.filter((d) => d.track.kind === t), g = {
|
|
2184
2193
|
trackIdentifier: o?.track.id,
|
|
2185
2194
|
item: o?.getSynchronizationSources()[0]
|
|
2186
|
-
},
|
|
2195
|
+
}, l = {
|
|
2187
2196
|
trackIdentifier: c[0]?.track.id,
|
|
2188
2197
|
item: c[0]?.getSynchronizationSources()[0]
|
|
2189
2198
|
}, u = {
|
|
2190
2199
|
audio: g,
|
|
2191
|
-
video:
|
|
2200
|
+
video: l
|
|
2192
2201
|
};
|
|
2193
2202
|
return Promise.all([
|
|
2194
2203
|
i?.getStats(),
|
|
@@ -2203,7 +2212,7 @@ const se = ["collected"], q = () => "performance" in window ? performance.now()
|
|
|
2203
2212
|
_,
|
|
2204
2213
|
C,
|
|
2205
2214
|
p,
|
|
2206
|
-
|
|
2215
|
+
v,
|
|
2207
2216
|
re
|
|
2208
2217
|
] = d;
|
|
2209
2218
|
return {
|
|
@@ -2212,12 +2221,12 @@ const se = ["collected"], q = () => "performance" in window ? performance.now()
|
|
|
2212
2221
|
videoSenderFirstStats: _,
|
|
2213
2222
|
videoSenderSecondStats: C,
|
|
2214
2223
|
audioReceiverStats: p,
|
|
2215
|
-
videoReceiverFirstStats:
|
|
2224
|
+
videoReceiverFirstStats: v,
|
|
2216
2225
|
videoReceiverSecondStats: re
|
|
2217
2226
|
};
|
|
2218
2227
|
});
|
|
2219
2228
|
}, Qe = (n) => {
|
|
2220
|
-
|
|
2229
|
+
P(String(n));
|
|
2221
2230
|
};
|
|
2222
2231
|
class Xe {
|
|
2223
2232
|
events;
|
|
@@ -2230,7 +2239,7 @@ class Xe {
|
|
|
2230
2239
|
return this.setTimeoutRequest.requested;
|
|
2231
2240
|
}
|
|
2232
2241
|
start(e, {
|
|
2233
|
-
interval: t =
|
|
2242
|
+
interval: t = D,
|
|
2234
2243
|
onError: s = Qe
|
|
2235
2244
|
} = {}) {
|
|
2236
2245
|
const i = this.resolveCollectStatistics(e, {
|
|
@@ -2259,12 +2268,12 @@ class Xe {
|
|
|
2259
2268
|
resolveCollectStatistics = (e, {
|
|
2260
2269
|
onError: t
|
|
2261
2270
|
}) => () => {
|
|
2262
|
-
const s =
|
|
2271
|
+
const s = H();
|
|
2263
2272
|
this.requesterAllStatistics.request(e).then((i) => {
|
|
2264
2273
|
this.events.trigger("collected", Ye(i));
|
|
2265
|
-
const a =
|
|
2266
|
-
let o =
|
|
2267
|
-
a > 48 ? o =
|
|
2274
|
+
const a = H() - s;
|
|
2275
|
+
let o = D;
|
|
2276
|
+
a > 48 ? o = D * 4 : a > 32 ? o = D * 3 : a > 16 && (o = D * 2), this.start(e, {
|
|
2268
2277
|
onError: t,
|
|
2269
2278
|
interval: o
|
|
2270
2279
|
});
|
|
@@ -2274,10 +2283,16 @@ class Xe {
|
|
|
2274
2283
|
};
|
|
2275
2284
|
}
|
|
2276
2285
|
class Je {
|
|
2286
|
+
availableIncomingBitrate;
|
|
2277
2287
|
statsPeerConnection;
|
|
2278
2288
|
callManager;
|
|
2279
|
-
|
|
2280
|
-
|
|
2289
|
+
apiManager;
|
|
2290
|
+
previousAvailableIncomingBitrate;
|
|
2291
|
+
constructor({
|
|
2292
|
+
callManager: e,
|
|
2293
|
+
apiManager: t
|
|
2294
|
+
}) {
|
|
2295
|
+
this.callManager = e, this.apiManager = t, this.statsPeerConnection = new Xe(), this.subscribe();
|
|
2281
2296
|
}
|
|
2282
2297
|
get events() {
|
|
2283
2298
|
return this.statsPeerConnection.events;
|
|
@@ -2297,15 +2312,27 @@ class Je {
|
|
|
2297
2312
|
off(e, t) {
|
|
2298
2313
|
this.statsPeerConnection.off(e, t);
|
|
2299
2314
|
}
|
|
2315
|
+
hasAvailableIncomingBitrateChangedQuarter() {
|
|
2316
|
+
const e = this.previousAvailableIncomingBitrate, t = this.availableIncomingBitrate;
|
|
2317
|
+
return e === void 0 || t === void 0 ? !1 : e === 0 ? t > 0 : Math.abs(t - e) / e >= 0.25;
|
|
2318
|
+
}
|
|
2300
2319
|
subscribe() {
|
|
2301
|
-
this.callManager.on("peerconnection:confirmed", this.handleStarted), this.callManager.on("failed", this.handleEnded), this.callManager.on("ended", this.handleEnded);
|
|
2320
|
+
this.callManager.on("peerconnection:confirmed", this.handleStarted), this.callManager.on("failed", this.handleEnded), this.callManager.on("ended", this.handleEnded), this.statsPeerConnection.on("collected", this.handleStatsCollected);
|
|
2302
2321
|
}
|
|
2322
|
+
handleStatsCollected = (e) => {
|
|
2323
|
+
this.previousAvailableIncomingBitrate = this.availableIncomingBitrate, this.availableIncomingBitrate = e.inbound.additional.candidatePair?.availableIncomingBitrate, this.maybeSendStats();
|
|
2324
|
+
};
|
|
2303
2325
|
handleStarted = (e) => {
|
|
2304
2326
|
this.statsPeerConnection.start(e);
|
|
2305
2327
|
};
|
|
2306
2328
|
handleEnded = () => {
|
|
2307
|
-
this.statsPeerConnection.stop();
|
|
2329
|
+
this.statsPeerConnection.stop(), this.availableIncomingBitrate = void 0, this.previousAvailableIncomingBitrate = void 0;
|
|
2308
2330
|
};
|
|
2331
|
+
maybeSendStats() {
|
|
2332
|
+
this.availableIncomingBitrate !== void 0 && this.hasAvailableIncomingBitrateChangedQuarter() && this.apiManager.sendStats({ availableIncomingBitrate: this.availableIncomingBitrate }).catch((e) => {
|
|
2333
|
+
P("Failed to send stats", e);
|
|
2334
|
+
});
|
|
2335
|
+
}
|
|
2309
2336
|
}
|
|
2310
2337
|
const je = ee.map((n) => `connection:${n}`), Ke = Q.map((n) => `call:${n}`), Ze = j.map((n) => `api:${n}`), et = ne.map((n) => `incoming-call:${n}`), tt = K.map((n) => `presentation:${n}`), nt = se.map((n) => `stats:${n}`), st = [
|
|
2311
2338
|
...je,
|
|
@@ -2315,7 +2342,7 @@ const je = ee.map((n) => `connection:${n}`), Ke = Q.map((n) => `call:${n}`), Ze
|
|
|
2315
2342
|
...tt,
|
|
2316
2343
|
...nt
|
|
2317
2344
|
];
|
|
2318
|
-
class
|
|
2345
|
+
class Et {
|
|
2319
2346
|
events;
|
|
2320
2347
|
connectionManager;
|
|
2321
2348
|
callManager;
|
|
@@ -2324,12 +2351,15 @@ class lt {
|
|
|
2324
2351
|
presentationManager;
|
|
2325
2352
|
statsManager;
|
|
2326
2353
|
constructor({ JsSIP: e }) {
|
|
2327
|
-
this.events = new f(st), this.connectionManager = new ke({ JsSIP: e }), this.callManager = new _e(), this.apiManager = new
|
|
2354
|
+
this.events = new f(st), this.connectionManager = new ke({ JsSIP: e }), this.callManager = new _e(), this.apiManager = new Oe({
|
|
2328
2355
|
connectionManager: this.connectionManager,
|
|
2329
2356
|
callManager: this.callManager
|
|
2330
|
-
}), this.incomingCallManager = new Be(this.connectionManager), this.presentationManager = new
|
|
2357
|
+
}), this.incomingCallManager = new Be(this.connectionManager), this.presentationManager = new ve({
|
|
2331
2358
|
callManager: this.callManager
|
|
2332
|
-
}), this.statsManager = new Je({
|
|
2359
|
+
}), this.statsManager = new Je({
|
|
2360
|
+
callManager: this.callManager,
|
|
2361
|
+
apiManager: this.apiManager
|
|
2362
|
+
}), this.subscribe();
|
|
2333
2363
|
}
|
|
2334
2364
|
get requestedConnection() {
|
|
2335
2365
|
return this.connectionManager.requested;
|
|
@@ -2516,14 +2546,14 @@ class lt {
|
|
|
2516
2546
|
export {
|
|
2517
2547
|
J as E,
|
|
2518
2548
|
$ as O,
|
|
2519
|
-
|
|
2549
|
+
Et as S,
|
|
2520
2550
|
y as a,
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2551
|
+
Pe as b,
|
|
2552
|
+
E as c,
|
|
2553
|
+
lt as d,
|
|
2524
2554
|
ht as e,
|
|
2525
2555
|
Xe as f,
|
|
2526
2556
|
St as h,
|
|
2527
|
-
|
|
2557
|
+
P as l,
|
|
2528
2558
|
w as p
|
|
2529
2559
|
};
|