@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);
|
package/lib/api/agentd.js
CHANGED
|
@@ -132,6 +132,7 @@ class IssueReporter {
|
|
|
132
132
|
|
|
133
133
|
|
|
134
134
|
|
|
135
|
+
|
|
135
136
|
|
|
136
137
|
constructor() {
|
|
137
138
|
addLevelsTo(this);
|
|
@@ -143,12 +144,17 @@ class IssueReporter {
|
|
|
143
144
|
this.bufferTimeout = null;
|
|
144
145
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
145
146
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
147
|
+
this._callback = null;
|
|
146
148
|
}
|
|
147
149
|
|
|
148
150
|
init() {
|
|
149
151
|
this._catchConsole();
|
|
150
152
|
}
|
|
151
153
|
|
|
154
|
+
setCallback(cb ) {
|
|
155
|
+
this._callback = cb;
|
|
156
|
+
}
|
|
157
|
+
|
|
152
158
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
153
159
|
this.remoteClientConfiguration = configuration;
|
|
154
160
|
}
|
|
@@ -184,6 +190,7 @@ class IssueReporter {
|
|
|
184
190
|
|
|
185
191
|
// Handle category label
|
|
186
192
|
let category = null;
|
|
193
|
+
let skipSendToRemote = false;
|
|
187
194
|
let extra = {};
|
|
188
195
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
189
196
|
category = args[0].split('=')[1];
|
|
@@ -199,6 +206,7 @@ class IssueReporter {
|
|
|
199
206
|
errorMessage: lastArg.message,
|
|
200
207
|
errorStack: lastArg.stack,
|
|
201
208
|
errorType: lastArg.constructor.name,
|
|
209
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
202
210
|
};
|
|
203
211
|
} else {
|
|
204
212
|
extra = lastArg;
|
|
@@ -207,6 +215,11 @@ class IssueReporter {
|
|
|
207
215
|
args.splice(1, 1);
|
|
208
216
|
}
|
|
209
217
|
|
|
218
|
+
if (extra.skipSendToRemote) {
|
|
219
|
+
skipSendToRemote = true;
|
|
220
|
+
delete extra.skipSendToRemote;
|
|
221
|
+
}
|
|
222
|
+
|
|
210
223
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
211
224
|
const message = args.join(', ');
|
|
212
225
|
let consoleMessage = message;
|
|
@@ -227,7 +240,13 @@ class IssueReporter {
|
|
|
227
240
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
228
241
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
229
242
|
|
|
230
|
-
this.
|
|
243
|
+
if (this._callback) {
|
|
244
|
+
this._callback(level, consoleMessage);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (!skipSendToRemote) {
|
|
248
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
249
|
+
}
|
|
231
250
|
}
|
|
232
251
|
|
|
233
252
|
logRequest(url , options , response , start ) {
|
|
@@ -372,7 +391,11 @@ class IssueReporter {
|
|
|
372
391
|
},
|
|
373
392
|
// $FlowFixMe
|
|
374
393
|
body,
|
|
375
|
-
}).catch(() => {
|
|
394
|
+
}).catch((e ) => {
|
|
395
|
+
// $FlowFixMe
|
|
396
|
+
e.skipSendToRemote = true;
|
|
397
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
398
|
+
|
|
376
399
|
setTimeout(() => {
|
|
377
400
|
if (isArray) {
|
|
378
401
|
payload = payload.map(message => {
|
package/lib/api/amid.js
CHANGED
|
@@ -71,6 +71,7 @@ class IssueReporter {
|
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
|
|
74
|
+
|
|
74
75
|
|
|
75
76
|
constructor() {
|
|
76
77
|
addLevelsTo(this);
|
|
@@ -82,12 +83,17 @@ class IssueReporter {
|
|
|
82
83
|
this.bufferTimeout = null;
|
|
83
84
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
84
85
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
86
|
+
this._callback = null;
|
|
85
87
|
}
|
|
86
88
|
|
|
87
89
|
init() {
|
|
88
90
|
this._catchConsole();
|
|
89
91
|
}
|
|
90
92
|
|
|
93
|
+
setCallback(cb ) {
|
|
94
|
+
this._callback = cb;
|
|
95
|
+
}
|
|
96
|
+
|
|
91
97
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
92
98
|
this.remoteClientConfiguration = configuration;
|
|
93
99
|
}
|
|
@@ -123,6 +129,7 @@ class IssueReporter {
|
|
|
123
129
|
|
|
124
130
|
// Handle category label
|
|
125
131
|
let category = null;
|
|
132
|
+
let skipSendToRemote = false;
|
|
126
133
|
let extra = {};
|
|
127
134
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
128
135
|
category = args[0].split('=')[1];
|
|
@@ -138,6 +145,7 @@ class IssueReporter {
|
|
|
138
145
|
errorMessage: lastArg.message,
|
|
139
146
|
errorStack: lastArg.stack,
|
|
140
147
|
errorType: lastArg.constructor.name,
|
|
148
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
141
149
|
};
|
|
142
150
|
} else {
|
|
143
151
|
extra = lastArg;
|
|
@@ -146,6 +154,11 @@ class IssueReporter {
|
|
|
146
154
|
args.splice(1, 1);
|
|
147
155
|
}
|
|
148
156
|
|
|
157
|
+
if (extra.skipSendToRemote) {
|
|
158
|
+
skipSendToRemote = true;
|
|
159
|
+
delete extra.skipSendToRemote;
|
|
160
|
+
}
|
|
161
|
+
|
|
149
162
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
150
163
|
const message = args.join(', ');
|
|
151
164
|
let consoleMessage = message;
|
|
@@ -166,7 +179,13 @@ class IssueReporter {
|
|
|
166
179
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
167
180
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
168
181
|
|
|
169
|
-
this.
|
|
182
|
+
if (this._callback) {
|
|
183
|
+
this._callback(level, consoleMessage);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (!skipSendToRemote) {
|
|
187
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
188
|
+
}
|
|
170
189
|
}
|
|
171
190
|
|
|
172
191
|
logRequest(url , options , response , start ) {
|
|
@@ -311,7 +330,11 @@ class IssueReporter {
|
|
|
311
330
|
},
|
|
312
331
|
// $FlowFixMe
|
|
313
332
|
body,
|
|
314
|
-
}).catch(() => {
|
|
333
|
+
}).catch((e ) => {
|
|
334
|
+
// $FlowFixMe
|
|
335
|
+
e.skipSendToRemote = true;
|
|
336
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
337
|
+
|
|
315
338
|
setTimeout(() => {
|
|
316
339
|
if (isArray) {
|
|
317
340
|
payload = payload.map(message => {
|
package/lib/api/application.js
CHANGED
|
@@ -132,6 +132,7 @@ class IssueReporter {
|
|
|
132
132
|
|
|
133
133
|
|
|
134
134
|
|
|
135
|
+
|
|
135
136
|
|
|
136
137
|
constructor() {
|
|
137
138
|
addLevelsTo(this);
|
|
@@ -143,12 +144,17 @@ class IssueReporter {
|
|
|
143
144
|
this.bufferTimeout = null;
|
|
144
145
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
145
146
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
147
|
+
this._callback = null;
|
|
146
148
|
}
|
|
147
149
|
|
|
148
150
|
init() {
|
|
149
151
|
this._catchConsole();
|
|
150
152
|
}
|
|
151
153
|
|
|
154
|
+
setCallback(cb ) {
|
|
155
|
+
this._callback = cb;
|
|
156
|
+
}
|
|
157
|
+
|
|
152
158
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
153
159
|
this.remoteClientConfiguration = configuration;
|
|
154
160
|
}
|
|
@@ -184,6 +190,7 @@ class IssueReporter {
|
|
|
184
190
|
|
|
185
191
|
// Handle category label
|
|
186
192
|
let category = null;
|
|
193
|
+
let skipSendToRemote = false;
|
|
187
194
|
let extra = {};
|
|
188
195
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
189
196
|
category = args[0].split('=')[1];
|
|
@@ -199,6 +206,7 @@ class IssueReporter {
|
|
|
199
206
|
errorMessage: lastArg.message,
|
|
200
207
|
errorStack: lastArg.stack,
|
|
201
208
|
errorType: lastArg.constructor.name,
|
|
209
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
202
210
|
};
|
|
203
211
|
} else {
|
|
204
212
|
extra = lastArg;
|
|
@@ -207,6 +215,11 @@ class IssueReporter {
|
|
|
207
215
|
args.splice(1, 1);
|
|
208
216
|
}
|
|
209
217
|
|
|
218
|
+
if (extra.skipSendToRemote) {
|
|
219
|
+
skipSendToRemote = true;
|
|
220
|
+
delete extra.skipSendToRemote;
|
|
221
|
+
}
|
|
222
|
+
|
|
210
223
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
211
224
|
const message = args.join(', ');
|
|
212
225
|
let consoleMessage = message;
|
|
@@ -227,7 +240,13 @@ class IssueReporter {
|
|
|
227
240
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
228
241
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
229
242
|
|
|
230
|
-
this.
|
|
243
|
+
if (this._callback) {
|
|
244
|
+
this._callback(level, consoleMessage);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (!skipSendToRemote) {
|
|
248
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
249
|
+
}
|
|
231
250
|
}
|
|
232
251
|
|
|
233
252
|
logRequest(url , options , response , start ) {
|
|
@@ -372,7 +391,11 @@ class IssueReporter {
|
|
|
372
391
|
},
|
|
373
392
|
// $FlowFixMe
|
|
374
393
|
body,
|
|
375
|
-
}).catch(() => {
|
|
394
|
+
}).catch((e ) => {
|
|
395
|
+
// $FlowFixMe
|
|
396
|
+
e.skipSendToRemote = true;
|
|
397
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
398
|
+
|
|
376
399
|
setTimeout(() => {
|
|
377
400
|
if (isArray) {
|
|
378
401
|
payload = payload.map(message => {
|
package/lib/api/auth.js
CHANGED
|
@@ -135,6 +135,7 @@ class IssueReporter {
|
|
|
135
135
|
|
|
136
136
|
|
|
137
137
|
|
|
138
|
+
|
|
138
139
|
|
|
139
140
|
constructor() {
|
|
140
141
|
addLevelsTo(this);
|
|
@@ -146,12 +147,17 @@ class IssueReporter {
|
|
|
146
147
|
this.bufferTimeout = null;
|
|
147
148
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
148
149
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
150
|
+
this._callback = null;
|
|
149
151
|
}
|
|
150
152
|
|
|
151
153
|
init() {
|
|
152
154
|
this._catchConsole();
|
|
153
155
|
}
|
|
154
156
|
|
|
157
|
+
setCallback(cb ) {
|
|
158
|
+
this._callback = cb;
|
|
159
|
+
}
|
|
160
|
+
|
|
155
161
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
156
162
|
this.remoteClientConfiguration = configuration;
|
|
157
163
|
}
|
|
@@ -187,6 +193,7 @@ class IssueReporter {
|
|
|
187
193
|
|
|
188
194
|
// Handle category label
|
|
189
195
|
let category = null;
|
|
196
|
+
let skipSendToRemote = false;
|
|
190
197
|
let extra = {};
|
|
191
198
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
192
199
|
category = args[0].split('=')[1];
|
|
@@ -202,6 +209,7 @@ class IssueReporter {
|
|
|
202
209
|
errorMessage: lastArg.message,
|
|
203
210
|
errorStack: lastArg.stack,
|
|
204
211
|
errorType: lastArg.constructor.name,
|
|
212
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
205
213
|
};
|
|
206
214
|
} else {
|
|
207
215
|
extra = lastArg;
|
|
@@ -210,6 +218,11 @@ class IssueReporter {
|
|
|
210
218
|
args.splice(1, 1);
|
|
211
219
|
}
|
|
212
220
|
|
|
221
|
+
if (extra.skipSendToRemote) {
|
|
222
|
+
skipSendToRemote = true;
|
|
223
|
+
delete extra.skipSendToRemote;
|
|
224
|
+
}
|
|
225
|
+
|
|
213
226
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
214
227
|
const message = args.join(', ');
|
|
215
228
|
let consoleMessage = message;
|
|
@@ -230,7 +243,13 @@ class IssueReporter {
|
|
|
230
243
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
231
244
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
232
245
|
|
|
233
|
-
this.
|
|
246
|
+
if (this._callback) {
|
|
247
|
+
this._callback(level, consoleMessage);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (!skipSendToRemote) {
|
|
251
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
252
|
+
}
|
|
234
253
|
}
|
|
235
254
|
|
|
236
255
|
logRequest(url , options , response , start ) {
|
|
@@ -375,7 +394,11 @@ class IssueReporter {
|
|
|
375
394
|
},
|
|
376
395
|
// $FlowFixMe
|
|
377
396
|
body,
|
|
378
|
-
}).catch(() => {
|
|
397
|
+
}).catch((e ) => {
|
|
398
|
+
// $FlowFixMe
|
|
399
|
+
e.skipSendToRemote = true;
|
|
400
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
401
|
+
|
|
379
402
|
setTimeout(() => {
|
|
380
403
|
if (isArray) {
|
|
381
404
|
payload = payload.map(message => {
|