@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
|
@@ -412,6 +412,7 @@ class IssueReporter {
|
|
|
412
412
|
|
|
413
413
|
|
|
414
414
|
|
|
415
|
+
|
|
415
416
|
|
|
416
417
|
constructor() {
|
|
417
418
|
addLevelsTo(this);
|
|
@@ -423,12 +424,17 @@ class IssueReporter {
|
|
|
423
424
|
this.bufferTimeout = null;
|
|
424
425
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
425
426
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
427
|
+
this._callback = null;
|
|
426
428
|
}
|
|
427
429
|
|
|
428
430
|
init() {
|
|
429
431
|
this._catchConsole();
|
|
430
432
|
}
|
|
431
433
|
|
|
434
|
+
setCallback(cb ) {
|
|
435
|
+
this._callback = cb;
|
|
436
|
+
}
|
|
437
|
+
|
|
432
438
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
433
439
|
this.remoteClientConfiguration = configuration;
|
|
434
440
|
}
|
|
@@ -464,6 +470,7 @@ class IssueReporter {
|
|
|
464
470
|
|
|
465
471
|
// Handle category label
|
|
466
472
|
let category = null;
|
|
473
|
+
let skipSendToRemote = false;
|
|
467
474
|
let extra = {};
|
|
468
475
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
469
476
|
category = args[0].split('=')[1];
|
|
@@ -479,6 +486,7 @@ class IssueReporter {
|
|
|
479
486
|
errorMessage: lastArg.message,
|
|
480
487
|
errorStack: lastArg.stack,
|
|
481
488
|
errorType: lastArg.constructor.name,
|
|
489
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
482
490
|
};
|
|
483
491
|
} else {
|
|
484
492
|
extra = lastArg;
|
|
@@ -487,6 +495,11 @@ class IssueReporter {
|
|
|
487
495
|
args.splice(1, 1);
|
|
488
496
|
}
|
|
489
497
|
|
|
498
|
+
if (extra.skipSendToRemote) {
|
|
499
|
+
skipSendToRemote = true;
|
|
500
|
+
delete extra.skipSendToRemote;
|
|
501
|
+
}
|
|
502
|
+
|
|
490
503
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
491
504
|
const message = args.join(', ');
|
|
492
505
|
let consoleMessage = message;
|
|
@@ -507,7 +520,13 @@ class IssueReporter {
|
|
|
507
520
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
508
521
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
509
522
|
|
|
510
|
-
this.
|
|
523
|
+
if (this._callback) {
|
|
524
|
+
this._callback(level, consoleMessage);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
if (!skipSendToRemote) {
|
|
528
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
529
|
+
}
|
|
511
530
|
}
|
|
512
531
|
|
|
513
532
|
logRequest(url , options , response , start ) {
|
|
@@ -652,7 +671,11 @@ class IssueReporter {
|
|
|
652
671
|
},
|
|
653
672
|
// $FlowFixMe
|
|
654
673
|
body,
|
|
655
|
-
}).catch(() => {
|
|
674
|
+
}).catch((e ) => {
|
|
675
|
+
// $FlowFixMe
|
|
676
|
+
e.skipSendToRemote = true;
|
|
677
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
678
|
+
|
|
656
679
|
setTimeout(() => {
|
|
657
680
|
if (isArray) {
|
|
658
681
|
payload = payload.map(message => {
|
|
@@ -701,10 +724,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
701
724
|
candidates
|
|
702
725
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
703
726
|
|
|
704
|
-
const areCandidateValid = (candidates ) =>
|
|
705
|
-
getSrflxOrRelay(candidates)
|
|
706
|
-
.length > 0;
|
|
707
|
-
|
|
708
727
|
const getVideoDirection = (sdp ) => {
|
|
709
728
|
const parsedSdp = sdpParser.parse(sdp);
|
|
710
729
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
@@ -757,8 +776,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
757
776
|
/* global RTCSessionDescriptionInit, navigator */
|
|
758
777
|
|
|
759
778
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
760
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
761
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
762
779
|
|
|
763
780
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
764
781
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -948,38 +965,6 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
948
965
|
this._peerConnection = undefined;
|
|
949
966
|
}
|
|
950
967
|
|
|
951
|
-
async _waitForValidGatheredIce() {
|
|
952
|
-
let tries = 0;
|
|
953
|
-
|
|
954
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
955
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
956
|
-
tries,
|
|
957
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
958
|
-
});
|
|
959
|
-
|
|
960
|
-
tries++;
|
|
961
|
-
|
|
962
|
-
// eslint-disable-next-line no-await-in-loop
|
|
963
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
967
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
968
|
-
const error = new Error(errorMsg);
|
|
969
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
970
|
-
|
|
971
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
972
|
-
this.eventEmitter.emit('error', error);
|
|
973
|
-
|
|
974
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
975
|
-
}
|
|
976
|
-
|
|
977
|
-
// eslint-disable-next-line
|
|
978
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
979
|
-
|
|
980
|
-
return this.getLocalSessionDescription();
|
|
981
|
-
}
|
|
982
|
-
|
|
983
968
|
// Overridden to send `inactive` in conference
|
|
984
969
|
updateDirection(options , isConference = false,
|
|
985
970
|
audioOnly = false) {
|
|
@@ -2089,6 +2074,9 @@ class Contact {
|
|
|
2089
2074
|
}
|
|
2090
2075
|
|
|
2091
2076
|
static parseMany(response ) {
|
|
2077
|
+
if (!response || !response.results) {
|
|
2078
|
+
return [];
|
|
2079
|
+
}
|
|
2092
2080
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
2093
2081
|
}
|
|
2094
2082
|
|
|
@@ -3195,11 +3183,27 @@ class Meeting {
|
|
|
3195
3183
|
});
|
|
3196
3184
|
}
|
|
3197
3185
|
|
|
3186
|
+
static parseMany(items ) {
|
|
3187
|
+
if (!items) {
|
|
3188
|
+
return [];
|
|
3189
|
+
}
|
|
3190
|
+
return items.map(plain => Meeting.parse(plain));
|
|
3191
|
+
}
|
|
3192
|
+
|
|
3198
3193
|
static newFrom(meeting ) {
|
|
3199
3194
|
return newFrom(meeting, Meeting);
|
|
3200
3195
|
}
|
|
3201
3196
|
|
|
3202
|
-
constructor({
|
|
3197
|
+
constructor({
|
|
3198
|
+
uuid,
|
|
3199
|
+
name,
|
|
3200
|
+
guestSipAuthorization,
|
|
3201
|
+
ownerUuids,
|
|
3202
|
+
port,
|
|
3203
|
+
uri,
|
|
3204
|
+
number,
|
|
3205
|
+
persistent,
|
|
3206
|
+
} = {}) {
|
|
3203
3207
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
3204
3208
|
this.uri = uri;
|
|
3205
3209
|
this.name = name;
|
|
@@ -3285,8 +3289,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
3285
3289
|
}
|
|
3286
3290
|
},
|
|
3287
3291
|
|
|
3288
|
-
|
|
3289
|
-
client.
|
|
3292
|
+
getMyMeetings: () =>
|
|
3293
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
3294
|
+
|
|
3295
|
+
createMyMeeting: (name , persistent ) =>
|
|
3296
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
3290
3297
|
|
|
3291
3298
|
deleteMyMeeting: (meetingUuid ) =>
|
|
3292
3299
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -3382,6 +3389,10 @@ class ChatMessage {
|
|
|
3382
3389
|
|
|
3383
3390
|
|
|
3384
3391
|
static parseMany(plain ) {
|
|
3392
|
+
if (!plain || !plain.items) {
|
|
3393
|
+
return [];
|
|
3394
|
+
}
|
|
3395
|
+
|
|
3385
3396
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
3386
3397
|
}
|
|
3387
3398
|
|
|
@@ -3491,6 +3502,9 @@ class Voicemail {
|
|
|
3491
3502
|
}
|
|
3492
3503
|
|
|
3493
3504
|
static parseMany(plain ) {
|
|
3505
|
+
if (!plain) {
|
|
3506
|
+
return [];
|
|
3507
|
+
}
|
|
3494
3508
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
3495
3509
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
3496
3510
|
|
|
@@ -3600,6 +3614,9 @@ class Call {
|
|
|
3600
3614
|
|
|
3601
3615
|
|
|
3602
3616
|
static parseMany(plain ) {
|
|
3617
|
+
if (!plain) {
|
|
3618
|
+
return [];
|
|
3619
|
+
}
|
|
3603
3620
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3604
3621
|
}
|
|
3605
3622
|
|
|
@@ -3772,6 +3789,9 @@ class Recording {
|
|
|
3772
3789
|
|
|
3773
3790
|
|
|
3774
3791
|
static parseMany(recordings = []) {
|
|
3792
|
+
if (!recordings) {
|
|
3793
|
+
return [];
|
|
3794
|
+
}
|
|
3775
3795
|
return recordings.map(item => Recording.parse(item));
|
|
3776
3796
|
}
|
|
3777
3797
|
|
|
@@ -3873,6 +3893,10 @@ class CallLog {
|
|
|
3873
3893
|
}
|
|
3874
3894
|
|
|
3875
3895
|
static parseMany(plain ) {
|
|
3896
|
+
if (!plain || !plain.items) {
|
|
3897
|
+
return [];
|
|
3898
|
+
}
|
|
3899
|
+
|
|
3876
3900
|
return plain.items.map(item => CallLog.parse(item));
|
|
3877
3901
|
}
|
|
3878
3902
|
|
|
@@ -4445,6 +4469,9 @@ class ChatRoom {
|
|
|
4445
4469
|
|
|
4446
4470
|
|
|
4447
4471
|
static parseMany(plain ) {
|
|
4472
|
+
if (!plain || !plain.items) {
|
|
4473
|
+
return [];
|
|
4474
|
+
}
|
|
4448
4475
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
4449
4476
|
}
|
|
4450
4477
|
|
|
@@ -5698,7 +5725,9 @@ class WebRTCClient extends Emitter {
|
|
|
5698
5725
|
const inviteOptions = {
|
|
5699
5726
|
requestDelegate: {
|
|
5700
5727
|
onAccept: (response ) => {
|
|
5701
|
-
session.sessionDescriptionHandler.peerConnection
|
|
5728
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
5729
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
5730
|
+
}
|
|
5702
5731
|
this._onAccepted(session, response.session, true);
|
|
5703
5732
|
},
|
|
5704
5733
|
onReject: (response ) => {
|
|
@@ -6570,6 +6599,16 @@ class WebRTCClient extends Emitter {
|
|
|
6570
6599
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
6571
6600
|
}
|
|
6572
6601
|
|
|
6602
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
6603
|
+
getRemoteVideoStreamFromPc(sessionId ) {
|
|
6604
|
+
const pc = this.getPeerConnection(sessionId);
|
|
6605
|
+
if (!pc) {
|
|
6606
|
+
return null;
|
|
6607
|
+
}
|
|
6608
|
+
|
|
6609
|
+
return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
|
|
6610
|
+
}
|
|
6611
|
+
|
|
6573
6612
|
hasVideo(sessionId ) {
|
|
6574
6613
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
6575
6614
|
}
|
|
@@ -7080,6 +7119,7 @@ class WebRTCClient extends Emitter {
|
|
|
7080
7119
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
7081
7120
|
|
|
7082
7121
|
pc.oniceconnectionstatechange = () => {
|
|
7122
|
+
logger.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
7083
7123
|
if (pc.iceConnectionState === 'disconnected') {
|
|
7084
7124
|
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
7085
7125
|
}
|
|
@@ -7308,25 +7348,25 @@ class WebRTCClient extends Emitter {
|
|
|
7308
7348
|
|
|
7309
7349
|
stats.forEach(report => {
|
|
7310
7350
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
7311
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
7351
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
7312
7352
|
}
|
|
7313
7353
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
7314
|
-
audioBytesSent += report.bytesSent;
|
|
7354
|
+
audioBytesSent += Number(report.bytesSent);
|
|
7315
7355
|
}
|
|
7316
7356
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
7317
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
7357
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
7318
7358
|
}
|
|
7319
7359
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
7320
|
-
packetsLost += report.packetsLost;
|
|
7321
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
7322
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
7360
|
+
packetsLost += Number(report.packetsLost);
|
|
7361
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
7362
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
7323
7363
|
}
|
|
7324
7364
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
7325
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
7365
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
7326
7366
|
}
|
|
7327
7367
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
7328
7368
|
if ('framesPerSecond' in report) {
|
|
7329
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
7369
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
7330
7370
|
}
|
|
7331
7371
|
if ('framerateMean' in report) {
|
|
7332
7372
|
// framerateMean is only available in FF
|
|
@@ -7334,32 +7374,36 @@ class WebRTCClient extends Emitter {
|
|
|
7334
7374
|
}
|
|
7335
7375
|
}
|
|
7336
7376
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
7337
|
-
packetsLost += report.packetsLost;
|
|
7338
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
7339
|
-
networkStats.jitter = report.jitter;
|
|
7377
|
+
packetsLost += Number(report.packetsLost);
|
|
7378
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
7379
|
+
networkStats.jitter = Number(report.jitter);
|
|
7340
7380
|
}
|
|
7341
7381
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
7342
|
-
packetsLost += report.packetsLost;
|
|
7382
|
+
packetsLost += Number(report.packetsLost);
|
|
7343
7383
|
}
|
|
7344
7384
|
if (report.type === 'transport') {
|
|
7345
|
-
transportSent += report.bytesSent;
|
|
7346
|
-
transportReceived += report.bytesReceived;
|
|
7385
|
+
transportSent += Number(report.bytesSent);
|
|
7386
|
+
transportReceived += Number(report.bytesReceived);
|
|
7347
7387
|
}
|
|
7348
7388
|
});
|
|
7349
7389
|
|
|
7350
7390
|
networkStats.packetsLost = packetsLost;
|
|
7351
|
-
networkStats.
|
|
7391
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
7392
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
7393
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
7352
7394
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
7353
|
-
networkStats.
|
|
7354
|
-
networkStats.
|
|
7395
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
7396
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
7397
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
7398
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
7399
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
7355
7400
|
networkStats.transportSent = transportSent;
|
|
7356
|
-
networkStats.
|
|
7357
|
-
|
|
7358
|
-
const bandwidth = (networkStats.audioBytesSent - lastAudioSent) + (networkStats.videoBytesSent - lastVideoSent)
|
|
7359
|
-
+ (networkStats.audioBytesReceived - lastAudioReceived) + (networkStats.videoBytesReceived - lastVideoReceived)
|
|
7360
|
-
+ (networkStats.transportReceived - lastTransportReceived) + (networkStats.transportSent - lastTransportSent);
|
|
7401
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
7402
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
7361
7403
|
|
|
7362
|
-
networkStats.bandwidth =
|
|
7404
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
7405
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
7406
|
+
+ networkStats.transportSent;
|
|
7363
7407
|
|
|
7364
7408
|
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
7365
7409
|
this.sessionNetworkStats[sessionId].push(networkStats);
|