@wazo/sdk 0.37.19 → 0.37.23
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/wazo-sdk.js +5 -5
- package/esm/__tests__/api-client.test.js +70 -5
- package/esm/__tests__/web-rtc-client.test.js +111 -67
- package/esm/api/agentd.js +25 -2
- package/esm/api/amid.js +25 -2
- package/esm/api/application.js +25 -2
- package/esm/api/auth.js +25 -2
- package/esm/api/call-logd.js +32 -2
- package/esm/api/calld.js +35 -2
- package/esm/api/chatd.js +32 -2
- package/esm/api/confd.js +47 -5
- package/esm/api/ctid-ng.js +35 -2
- package/esm/api/dird.js +28 -2
- package/esm/api/webhookd.js +25 -2
- package/esm/api-client.js +70 -5
- package/esm/checker/Checker.js +113 -67
- package/esm/checker/checks/aor.js +70 -5
- package/esm/checker/checks/api.js +70 -5
- package/esm/checker/checks/index.js +113 -67
- package/esm/checker/checks/wazo-websocket.js +27 -2
- package/esm/checker/checks/webrtc-transport.js +111 -67
- package/esm/checker/checks/webrtc.js +111 -67
- package/esm/domain/AdHocAPIConference.js +70 -5
- package/esm/domain/Call.js +3 -0
- package/esm/domain/CallLog.js +7 -0
- package/esm/domain/ChatMessage.js +4 -0
- package/esm/domain/ChatRoom.js +3 -0
- package/esm/domain/Contact.js +3 -0
- package/esm/domain/Features.js +70 -5
- package/esm/domain/Meeting.js +17 -1
- package/esm/domain/Phone/CTIPhone.js +74 -5
- package/esm/domain/Phone/WebRTCPhone.js +50 -16
- package/esm/domain/Recording.js +3 -0
- package/esm/domain/Voicemail.js +3 -0
- package/esm/domain/__tests__/Call.test.js +3 -0
- package/esm/domain/__tests__/CallLog.test.js +7 -0
- package/esm/domain/__tests__/Contact.test.js +3 -0
- package/esm/domain/__tests__/Voicemail.test.js +3 -0
- package/esm/index.js +147 -80
- package/esm/lib/WazoSessionDescriptionHandler.js +25 -40
- package/esm/service/CallApi.js +70 -5
- package/esm/service/IssueReporter.js +25 -2
- package/esm/service/__tests__/IssueReporter.test.js +25 -2
- package/esm/service/getApiClient.js +70 -5
- package/esm/simple/Auth.js +147 -80
- package/esm/simple/Configuration.js +147 -80
- package/esm/simple/Directory.js +70 -5
- package/esm/simple/Phone.js +147 -80
- package/esm/simple/Websocket.js +28 -2
- package/esm/simple/index.js +147 -80
- package/esm/simple/room/LocalParticipant.js +147 -80
- package/esm/simple/room/Participant.js +147 -80
- package/esm/simple/room/RemoteParticipant.js +147 -80
- package/esm/simple/room/Room.js +147 -80
- package/esm/simple/room/SipRoom.js +147 -80
- package/esm/simple/room/Stream.js +147 -80
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +147 -80
- package/esm/simple/utils.js +147 -80
- package/esm/utils/__tests__/api-requester.test.js +25 -2
- package/esm/utils/api-requester.js +25 -2
- package/esm/web-rtc-client.js +111 -67
- package/esm/websocket-client.js +28 -3
- package/lib/__tests__/api-client.test.js +70 -5
- package/lib/__tests__/web-rtc-client.test.js +111 -67
- package/lib/api/agentd.js +25 -2
- package/lib/api/amid.js +25 -2
- package/lib/api/application.js +25 -2
- package/lib/api/auth.js +25 -2
- package/lib/api/call-logd.js +32 -2
- package/lib/api/calld.js +35 -2
- package/lib/api/chatd.js +32 -2
- package/lib/api/confd.js +47 -5
- package/lib/api/ctid-ng.js +35 -2
- package/lib/api/dird.js +28 -2
- package/lib/api/webhookd.js +25 -2
- package/lib/api-client.js +70 -5
- package/lib/checker/Checker.js +113 -67
- package/lib/checker/checks/aor.js +70 -5
- package/lib/checker/checks/api.js +70 -5
- package/lib/checker/checks/index.js +113 -67
- package/lib/checker/checks/wazo-websocket.js +27 -2
- package/lib/checker/checks/webrtc-transport.js +111 -67
- package/lib/checker/checks/webrtc.js +111 -67
- package/lib/domain/AdHocAPIConference.js +70 -5
- package/lib/domain/Call.js +3 -0
- package/lib/domain/CallLog.js +7 -0
- package/lib/domain/ChatMessage.js +4 -0
- package/lib/domain/ChatRoom.js +3 -0
- package/lib/domain/Contact.js +3 -0
- package/lib/domain/Features.js +70 -5
- package/lib/domain/Meeting.js +17 -1
- package/lib/domain/Phone/CTIPhone.js +74 -5
- package/lib/domain/Phone/WebRTCPhone.js +50 -16
- package/lib/domain/Recording.js +3 -0
- package/lib/domain/Voicemail.js +3 -0
- package/lib/domain/__tests__/Call.test.js +3 -0
- package/lib/domain/__tests__/CallLog.test.js +7 -0
- package/lib/domain/__tests__/Contact.test.js +3 -0
- package/lib/domain/__tests__/Voicemail.test.js +3 -0
- package/lib/index.js +147 -80
- package/lib/lib/WazoSessionDescriptionHandler.js +25 -40
- package/lib/service/CallApi.js +70 -5
- package/lib/service/IssueReporter.js +25 -2
- package/lib/service/__tests__/IssueReporter.test.js +25 -2
- package/lib/service/getApiClient.js +70 -5
- package/lib/simple/Auth.js +147 -80
- package/lib/simple/Configuration.js +147 -80
- package/lib/simple/Directory.js +70 -5
- package/lib/simple/Phone.js +147 -80
- package/lib/simple/Websocket.js +28 -2
- package/lib/simple/index.js +147 -80
- package/lib/simple/room/LocalParticipant.js +147 -80
- package/lib/simple/room/Participant.js +147 -80
- package/lib/simple/room/RemoteParticipant.js +147 -80
- package/lib/simple/room/Room.js +147 -80
- package/lib/simple/room/SipRoom.js +147 -80
- package/lib/simple/room/Stream.js +147 -80
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +147 -80
- package/lib/simple/utils.js +147 -80
- package/lib/utils/__tests__/api-requester.test.js +25 -2
- package/lib/utils/api-requester.js +25 -2
- package/lib/web-rtc-client.js +111 -67
- package/lib/websocket-client.js +28 -2
- package/package.json +2 -2
- package/src/api/confd.js +5 -2
- package/src/domain/Call.js +3 -0
- package/src/domain/CallLog.js +4 -0
- package/src/domain/ChatMessage.js +4 -0
- package/src/domain/ChatRoom.js +3 -0
- package/src/domain/Contact.js +3 -0
- package/src/domain/Meeting.js +17 -1
- package/src/domain/Phone/CTIPhone.js +4 -0
- package/src/domain/Phone/Phone.js +2 -0
- package/src/domain/Phone/WebRTCPhone.js +25 -14
- package/src/domain/Recording.js +3 -0
- package/src/domain/Voicemail.js +3 -0
- package/src/lib/WazoSessionDescriptionHandler.js +1 -35
- package/src/service/IssueReporter.js +25 -2
- package/src/simple/Phone.js +5 -0
- package/src/types/WebSocketMessage.js +5 -1
- package/src/web-rtc-client.js +41 -24
- package/src/websocket-client.js +2 -0
|
@@ -421,6 +421,7 @@ class IssueReporter {
|
|
|
421
421
|
|
|
422
422
|
|
|
423
423
|
|
|
424
|
+
|
|
424
425
|
|
|
425
426
|
constructor() {
|
|
426
427
|
addLevelsTo(this);
|
|
@@ -432,12 +433,17 @@ class IssueReporter {
|
|
|
432
433
|
this.bufferTimeout = null;
|
|
433
434
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
434
435
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
436
|
+
this._callback = null;
|
|
435
437
|
}
|
|
436
438
|
|
|
437
439
|
init() {
|
|
438
440
|
this._catchConsole();
|
|
439
441
|
}
|
|
440
442
|
|
|
443
|
+
setCallback(cb ) {
|
|
444
|
+
this._callback = cb;
|
|
445
|
+
}
|
|
446
|
+
|
|
441
447
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
442
448
|
this.remoteClientConfiguration = configuration;
|
|
443
449
|
}
|
|
@@ -473,6 +479,7 @@ class IssueReporter {
|
|
|
473
479
|
|
|
474
480
|
// Handle category label
|
|
475
481
|
let category = null;
|
|
482
|
+
let skipSendToRemote = false;
|
|
476
483
|
let extra = {};
|
|
477
484
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
478
485
|
category = args[0].split('=')[1];
|
|
@@ -488,6 +495,7 @@ class IssueReporter {
|
|
|
488
495
|
errorMessage: lastArg.message,
|
|
489
496
|
errorStack: lastArg.stack,
|
|
490
497
|
errorType: lastArg.constructor.name,
|
|
498
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
491
499
|
};
|
|
492
500
|
} else {
|
|
493
501
|
extra = lastArg;
|
|
@@ -496,6 +504,11 @@ class IssueReporter {
|
|
|
496
504
|
args.splice(1, 1);
|
|
497
505
|
}
|
|
498
506
|
|
|
507
|
+
if (extra.skipSendToRemote) {
|
|
508
|
+
skipSendToRemote = true;
|
|
509
|
+
delete extra.skipSendToRemote;
|
|
510
|
+
}
|
|
511
|
+
|
|
499
512
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
500
513
|
const message = args.join(', ');
|
|
501
514
|
let consoleMessage = message;
|
|
@@ -516,7 +529,13 @@ class IssueReporter {
|
|
|
516
529
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
517
530
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
518
531
|
|
|
519
|
-
this.
|
|
532
|
+
if (this._callback) {
|
|
533
|
+
this._callback(level, consoleMessage);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
if (!skipSendToRemote) {
|
|
537
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
538
|
+
}
|
|
520
539
|
}
|
|
521
540
|
|
|
522
541
|
logRequest(url , options , response , start ) {
|
|
@@ -661,7 +680,11 @@ class IssueReporter {
|
|
|
661
680
|
},
|
|
662
681
|
// $FlowFixMe
|
|
663
682
|
body,
|
|
664
|
-
}).catch(() => {
|
|
683
|
+
}).catch((e ) => {
|
|
684
|
+
// $FlowFixMe
|
|
685
|
+
e.skipSendToRemote = true;
|
|
686
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
687
|
+
|
|
665
688
|
setTimeout(() => {
|
|
666
689
|
if (isArray) {
|
|
667
690
|
payload = payload.map(message => {
|
|
@@ -710,10 +733,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
710
733
|
candidates
|
|
711
734
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
712
735
|
|
|
713
|
-
const areCandidateValid = (candidates ) =>
|
|
714
|
-
getSrflxOrRelay(candidates)
|
|
715
|
-
.length > 0;
|
|
716
|
-
|
|
717
736
|
const getVideoDirection = (sdp ) => {
|
|
718
737
|
const parsedSdp = sdpParser__default['default'].parse(sdp);
|
|
719
738
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
@@ -766,8 +785,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
766
785
|
/* global RTCSessionDescriptionInit, navigator */
|
|
767
786
|
|
|
768
787
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
769
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
770
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
771
788
|
|
|
772
789
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
773
790
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -957,38 +974,6 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
957
974
|
this._peerConnection = undefined;
|
|
958
975
|
}
|
|
959
976
|
|
|
960
|
-
async _waitForValidGatheredIce() {
|
|
961
|
-
let tries = 0;
|
|
962
|
-
|
|
963
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
964
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
965
|
-
tries,
|
|
966
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
967
|
-
});
|
|
968
|
-
|
|
969
|
-
tries++;
|
|
970
|
-
|
|
971
|
-
// eslint-disable-next-line no-await-in-loop
|
|
972
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
976
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
977
|
-
const error = new Error(errorMsg);
|
|
978
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
979
|
-
|
|
980
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
981
|
-
this.eventEmitter.emit('error', error);
|
|
982
|
-
|
|
983
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
// eslint-disable-next-line
|
|
987
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
988
|
-
|
|
989
|
-
return this.getLocalSessionDescription();
|
|
990
|
-
}
|
|
991
|
-
|
|
992
977
|
// Overridden to send `inactive` in conference
|
|
993
978
|
updateDirection(options , isConference = false,
|
|
994
979
|
audioOnly = false) {
|
|
@@ -2098,6 +2083,9 @@ class Contact {
|
|
|
2098
2083
|
}
|
|
2099
2084
|
|
|
2100
2085
|
static parseMany(response ) {
|
|
2086
|
+
if (!response || !response.results) {
|
|
2087
|
+
return [];
|
|
2088
|
+
}
|
|
2101
2089
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
2102
2090
|
}
|
|
2103
2091
|
|
|
@@ -3204,11 +3192,27 @@ class Meeting {
|
|
|
3204
3192
|
});
|
|
3205
3193
|
}
|
|
3206
3194
|
|
|
3195
|
+
static parseMany(items ) {
|
|
3196
|
+
if (!items) {
|
|
3197
|
+
return [];
|
|
3198
|
+
}
|
|
3199
|
+
return items.map(plain => Meeting.parse(plain));
|
|
3200
|
+
}
|
|
3201
|
+
|
|
3207
3202
|
static newFrom(meeting ) {
|
|
3208
3203
|
return newFrom(meeting, Meeting);
|
|
3209
3204
|
}
|
|
3210
3205
|
|
|
3211
|
-
constructor({
|
|
3206
|
+
constructor({
|
|
3207
|
+
uuid,
|
|
3208
|
+
name,
|
|
3209
|
+
guestSipAuthorization,
|
|
3210
|
+
ownerUuids,
|
|
3211
|
+
port,
|
|
3212
|
+
uri,
|
|
3213
|
+
number,
|
|
3214
|
+
persistent,
|
|
3215
|
+
} = {}) {
|
|
3212
3216
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
3213
3217
|
this.uri = uri;
|
|
3214
3218
|
this.name = name;
|
|
@@ -3294,8 +3298,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
3294
3298
|
}
|
|
3295
3299
|
},
|
|
3296
3300
|
|
|
3297
|
-
|
|
3298
|
-
client.
|
|
3301
|
+
getMyMeetings: () =>
|
|
3302
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
3303
|
+
|
|
3304
|
+
createMyMeeting: (name , persistent ) =>
|
|
3305
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
3299
3306
|
|
|
3300
3307
|
deleteMyMeeting: (meetingUuid ) =>
|
|
3301
3308
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -3391,6 +3398,10 @@ class ChatMessage {
|
|
|
3391
3398
|
|
|
3392
3399
|
|
|
3393
3400
|
static parseMany(plain ) {
|
|
3401
|
+
if (!plain || !plain.items) {
|
|
3402
|
+
return [];
|
|
3403
|
+
}
|
|
3404
|
+
|
|
3394
3405
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
3395
3406
|
}
|
|
3396
3407
|
|
|
@@ -3500,6 +3511,9 @@ class Voicemail {
|
|
|
3500
3511
|
}
|
|
3501
3512
|
|
|
3502
3513
|
static parseMany(plain ) {
|
|
3514
|
+
if (!plain) {
|
|
3515
|
+
return [];
|
|
3516
|
+
}
|
|
3503
3517
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
3504
3518
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
3505
3519
|
|
|
@@ -3609,6 +3623,9 @@ class Call {
|
|
|
3609
3623
|
|
|
3610
3624
|
|
|
3611
3625
|
static parseMany(plain ) {
|
|
3626
|
+
if (!plain) {
|
|
3627
|
+
return [];
|
|
3628
|
+
}
|
|
3612
3629
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3613
3630
|
}
|
|
3614
3631
|
|
|
@@ -3781,6 +3798,9 @@ class Recording {
|
|
|
3781
3798
|
|
|
3782
3799
|
|
|
3783
3800
|
static parseMany(recordings = []) {
|
|
3801
|
+
if (!recordings) {
|
|
3802
|
+
return [];
|
|
3803
|
+
}
|
|
3784
3804
|
return recordings.map(item => Recording.parse(item));
|
|
3785
3805
|
}
|
|
3786
3806
|
|
|
@@ -3882,6 +3902,10 @@ class CallLog {
|
|
|
3882
3902
|
}
|
|
3883
3903
|
|
|
3884
3904
|
static parseMany(plain ) {
|
|
3905
|
+
if (!plain || !plain.items) {
|
|
3906
|
+
return [];
|
|
3907
|
+
}
|
|
3908
|
+
|
|
3885
3909
|
return plain.items.map(item => CallLog.parse(item));
|
|
3886
3910
|
}
|
|
3887
3911
|
|
|
@@ -4454,6 +4478,9 @@ class ChatRoom {
|
|
|
4454
4478
|
|
|
4455
4479
|
|
|
4456
4480
|
static parseMany(plain ) {
|
|
4481
|
+
if (!plain || !plain.items) {
|
|
4482
|
+
return [];
|
|
4483
|
+
}
|
|
4457
4484
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
4458
4485
|
}
|
|
4459
4486
|
|
|
@@ -5707,7 +5734,9 @@ class WebRTCClient extends Emitter {
|
|
|
5707
5734
|
const inviteOptions = {
|
|
5708
5735
|
requestDelegate: {
|
|
5709
5736
|
onAccept: (response ) => {
|
|
5710
|
-
session.sessionDescriptionHandler.peerConnection
|
|
5737
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
5738
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
5739
|
+
}
|
|
5711
5740
|
this._onAccepted(session, response.session, true);
|
|
5712
5741
|
},
|
|
5713
5742
|
onReject: (response ) => {
|
|
@@ -6579,6 +6608,16 @@ class WebRTCClient extends Emitter {
|
|
|
6579
6608
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
6580
6609
|
}
|
|
6581
6610
|
|
|
6611
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
6612
|
+
getRemoteVideoStreamFromPc(sessionId ) {
|
|
6613
|
+
const pc = this.getPeerConnection(sessionId);
|
|
6614
|
+
if (!pc) {
|
|
6615
|
+
return null;
|
|
6616
|
+
}
|
|
6617
|
+
|
|
6618
|
+
return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
|
|
6619
|
+
}
|
|
6620
|
+
|
|
6582
6621
|
hasVideo(sessionId ) {
|
|
6583
6622
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
6584
6623
|
}
|
|
@@ -7089,6 +7128,7 @@ class WebRTCClient extends Emitter {
|
|
|
7089
7128
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
7090
7129
|
|
|
7091
7130
|
pc.oniceconnectionstatechange = () => {
|
|
7131
|
+
logger.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
7092
7132
|
if (pc.iceConnectionState === 'disconnected') {
|
|
7093
7133
|
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
7094
7134
|
}
|
|
@@ -7317,25 +7357,25 @@ class WebRTCClient extends Emitter {
|
|
|
7317
7357
|
|
|
7318
7358
|
stats.forEach(report => {
|
|
7319
7359
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
7320
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
7360
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
7321
7361
|
}
|
|
7322
7362
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
7323
|
-
audioBytesSent += report.bytesSent;
|
|
7363
|
+
audioBytesSent += Number(report.bytesSent);
|
|
7324
7364
|
}
|
|
7325
7365
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
7326
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
7366
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
7327
7367
|
}
|
|
7328
7368
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
7329
|
-
packetsLost += report.packetsLost;
|
|
7330
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
7331
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
7369
|
+
packetsLost += Number(report.packetsLost);
|
|
7370
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
7371
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
7332
7372
|
}
|
|
7333
7373
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
7334
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
7374
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
7335
7375
|
}
|
|
7336
7376
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
7337
7377
|
if ('framesPerSecond' in report) {
|
|
7338
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
7378
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
7339
7379
|
}
|
|
7340
7380
|
if ('framerateMean' in report) {
|
|
7341
7381
|
// framerateMean is only available in FF
|
|
@@ -7343,32 +7383,36 @@ class WebRTCClient extends Emitter {
|
|
|
7343
7383
|
}
|
|
7344
7384
|
}
|
|
7345
7385
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
7346
|
-
packetsLost += report.packetsLost;
|
|
7347
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
7348
|
-
networkStats.jitter = report.jitter;
|
|
7386
|
+
packetsLost += Number(report.packetsLost);
|
|
7387
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
7388
|
+
networkStats.jitter = Number(report.jitter);
|
|
7349
7389
|
}
|
|
7350
7390
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
7351
|
-
packetsLost += report.packetsLost;
|
|
7391
|
+
packetsLost += Number(report.packetsLost);
|
|
7352
7392
|
}
|
|
7353
7393
|
if (report.type === 'transport') {
|
|
7354
|
-
transportSent += report.bytesSent;
|
|
7355
|
-
transportReceived += report.bytesReceived;
|
|
7394
|
+
transportSent += Number(report.bytesSent);
|
|
7395
|
+
transportReceived += Number(report.bytesReceived);
|
|
7356
7396
|
}
|
|
7357
7397
|
});
|
|
7358
7398
|
|
|
7359
7399
|
networkStats.packetsLost = packetsLost;
|
|
7360
|
-
networkStats.
|
|
7400
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
7401
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
7402
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
7361
7403
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
7362
|
-
networkStats.
|
|
7363
|
-
networkStats.
|
|
7404
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
7405
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
7406
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
7407
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
7408
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
7364
7409
|
networkStats.transportSent = transportSent;
|
|
7365
|
-
networkStats.
|
|
7366
|
-
|
|
7367
|
-
const bandwidth = (networkStats.audioBytesSent - lastAudioSent) + (networkStats.videoBytesSent - lastVideoSent)
|
|
7368
|
-
+ (networkStats.audioBytesReceived - lastAudioReceived) + (networkStats.videoBytesReceived - lastVideoReceived)
|
|
7369
|
-
+ (networkStats.transportReceived - lastTransportReceived) + (networkStats.transportSent - lastTransportSent);
|
|
7410
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
7411
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
7370
7412
|
|
|
7371
|
-
networkStats.bandwidth =
|
|
7413
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
7414
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
7415
|
+
+ networkStats.transportSent;
|
|
7372
7416
|
|
|
7373
7417
|
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
7374
7418
|
this.sessionNetworkStats[sessionId].push(networkStats);
|