@wazo/sdk 0.37.17 → 0.37.21
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 +3 -3
- package/esm/__tests__/api-client.test.js +52 -9
- package/esm/__tests__/web-rtc-client.test.js +96 -21
- package/esm/api/agentd.js +26 -3
- package/esm/api/amid.js +26 -3
- package/esm/api/application.js +26 -3
- package/esm/api/auth.js +26 -3
- package/esm/api/call-logd.js +28 -5
- package/esm/api/calld.js +26 -3
- package/esm/api/chatd.js +26 -3
- package/esm/api/confd.js +50 -7
- package/esm/api/ctid-ng.js +26 -3
- package/esm/api/dird.js +26 -3
- package/esm/api/webhookd.js +26 -3
- package/esm/api-client.js +52 -9
- package/esm/checker/Checker.js +98 -21
- package/esm/checker/checks/aor.js +52 -9
- package/esm/checker/checks/api.js +52 -9
- package/esm/checker/checks/index.js +98 -21
- package/esm/checker/checks/wazo-websocket.js +28 -3
- package/esm/checker/checks/webrtc-transport.js +96 -21
- package/esm/checker/checks/webrtc.js +96 -21
- package/esm/domain/AdHocAPIConference.js +52 -9
- package/esm/domain/CallLog.js +2 -2
- package/esm/domain/Features.js +52 -9
- package/esm/domain/Meeting.js +19 -2
- package/esm/domain/Phone/CTIPhone.js +52 -9
- package/esm/domain/Phone/WebRTCPhone.js +41 -5
- package/esm/domain/Recording.js +1 -1
- package/esm/domain/__tests__/CallLog.test.js +2 -2
- package/esm/index.js +119 -22
- package/esm/lib/WazoSessionDescriptionHandler.js +26 -3
- package/esm/service/CallApi.js +52 -9
- package/esm/service/IssueReporter.js +26 -3
- package/esm/service/__tests__/IssueReporter.test.js +26 -3
- package/esm/service/getApiClient.js +52 -9
- package/esm/simple/Auth.js +119 -22
- package/esm/simple/Configuration.js +119 -22
- package/esm/simple/Directory.js +52 -9
- package/esm/simple/Phone.js +119 -22
- package/esm/simple/Websocket.js +29 -3
- package/esm/simple/index.js +119 -22
- package/esm/simple/room/LocalParticipant.js +119 -22
- package/esm/simple/room/Participant.js +119 -22
- package/esm/simple/room/RemoteParticipant.js +119 -22
- package/esm/simple/room/Room.js +119 -22
- package/esm/simple/room/SipRoom.js +119 -22
- package/esm/simple/room/Stream.js +119 -22
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +119 -22
- package/esm/simple/utils.js +119 -22
- package/esm/utils/__tests__/api-requester.test.js +26 -3
- package/esm/utils/api-requester.js +26 -3
- package/esm/web-rtc-client.js +96 -21
- package/esm/websocket-client.js +29 -4
- package/lib/__tests__/api-client.test.js +52 -9
- package/lib/__tests__/web-rtc-client.test.js +96 -21
- package/lib/api/agentd.js +26 -3
- package/lib/api/amid.js +26 -3
- package/lib/api/application.js +26 -3
- package/lib/api/auth.js +26 -3
- package/lib/api/call-logd.js +28 -5
- package/lib/api/calld.js +26 -3
- package/lib/api/chatd.js +26 -3
- package/lib/api/confd.js +50 -7
- package/lib/api/ctid-ng.js +26 -3
- package/lib/api/dird.js +26 -3
- package/lib/api/webhookd.js +26 -3
- package/lib/api-client.js +52 -9
- package/lib/checker/Checker.js +98 -21
- package/lib/checker/checks/aor.js +52 -9
- package/lib/checker/checks/api.js +52 -9
- package/lib/checker/checks/index.js +98 -21
- package/lib/checker/checks/wazo-websocket.js +28 -3
- package/lib/checker/checks/webrtc-transport.js +96 -21
- package/lib/checker/checks/webrtc.js +96 -21
- package/lib/domain/AdHocAPIConference.js +52 -9
- package/lib/domain/CallLog.js +2 -2
- package/lib/domain/Features.js +52 -9
- package/lib/domain/Meeting.js +19 -2
- package/lib/domain/Phone/CTIPhone.js +52 -9
- package/lib/domain/Phone/WebRTCPhone.js +41 -4
- package/lib/domain/Recording.js +1 -1
- package/lib/domain/__tests__/CallLog.test.js +2 -2
- package/lib/index.js +119 -22
- package/lib/lib/WazoSessionDescriptionHandler.js +26 -3
- package/lib/service/CallApi.js +52 -9
- package/lib/service/IssueReporter.js +26 -3
- package/lib/service/__tests__/IssueReporter.test.js +26 -3
- package/lib/service/getApiClient.js +52 -9
- package/lib/simple/Auth.js +119 -22
- package/lib/simple/Configuration.js +119 -22
- package/lib/simple/Directory.js +52 -9
- package/lib/simple/Phone.js +119 -22
- package/lib/simple/Websocket.js +29 -3
- package/lib/simple/index.js +119 -22
- package/lib/simple/room/LocalParticipant.js +119 -22
- package/lib/simple/room/Participant.js +119 -22
- package/lib/simple/room/RemoteParticipant.js +119 -22
- package/lib/simple/room/Room.js +119 -22
- package/lib/simple/room/SipRoom.js +119 -22
- package/lib/simple/room/Stream.js +119 -22
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +119 -22
- package/lib/simple/utils.js +119 -22
- package/lib/utils/__tests__/api-requester.test.js +26 -3
- package/lib/utils/api-requester.js +26 -3
- package/lib/web-rtc-client.js +96 -21
- package/lib/websocket-client.js +29 -3
- package/package.json +2 -2
- package/src/api/confd.js +5 -2
- package/src/domain/CallLog.js +1 -1
- package/src/domain/Meeting.js +19 -2
- package/src/domain/Phone/WebRTCPhone.js +14 -1
- package/src/domain/Recording.js +1 -1
- package/src/service/IssueReporter.js +26 -3
- package/src/simple/Phone.js +5 -0
- package/src/types/WebSocketMessage.js +5 -1
- package/src/web-rtc-client.js +44 -12
- 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 => {
|
|
@@ -673,7 +696,7 @@ class IssueReporter {
|
|
|
673
696
|
payload._retry = retry + 1;
|
|
674
697
|
}
|
|
675
698
|
|
|
676
|
-
this._sendDebugToGrafana(
|
|
699
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
677
700
|
}, 5000 + retry * 1000);
|
|
678
701
|
});
|
|
679
702
|
}
|
|
@@ -3175,7 +3198,8 @@ class ExternalApp {
|
|
|
3175
3198
|
|
|
3176
3199
|
|
|
3177
3200
|
|
|
3178
|
-
|
|
3201
|
+
|
|
3202
|
+
|
|
3179
3203
|
|
|
3180
3204
|
|
|
3181
3205
|
class Meeting {
|
|
@@ -3187,6 +3211,7 @@ class Meeting {
|
|
|
3187
3211
|
|
|
3188
3212
|
|
|
3189
3213
|
|
|
3214
|
+
|
|
3190
3215
|
|
|
3191
3216
|
|
|
3192
3217
|
static parse(plain ) {
|
|
@@ -3198,14 +3223,28 @@ class Meeting {
|
|
|
3198
3223
|
port: plain.port,
|
|
3199
3224
|
uuid: plain.uuid,
|
|
3200
3225
|
number: plain.number,
|
|
3226
|
+
persistent: plain.persistent,
|
|
3201
3227
|
});
|
|
3202
3228
|
}
|
|
3203
3229
|
|
|
3230
|
+
static parseMany(items ) {
|
|
3231
|
+
return items.map(plain => Meeting.parse(plain));
|
|
3232
|
+
}
|
|
3233
|
+
|
|
3204
3234
|
static newFrom(meeting ) {
|
|
3205
3235
|
return newFrom(meeting, Meeting);
|
|
3206
3236
|
}
|
|
3207
3237
|
|
|
3208
|
-
constructor({
|
|
3238
|
+
constructor({
|
|
3239
|
+
uuid,
|
|
3240
|
+
name,
|
|
3241
|
+
guestSipAuthorization,
|
|
3242
|
+
ownerUuids,
|
|
3243
|
+
port,
|
|
3244
|
+
uri,
|
|
3245
|
+
number,
|
|
3246
|
+
persistent,
|
|
3247
|
+
} = {}) {
|
|
3209
3248
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
3210
3249
|
this.uri = uri;
|
|
3211
3250
|
this.name = name;
|
|
@@ -3213,6 +3252,7 @@ class Meeting {
|
|
|
3213
3252
|
this.port = port;
|
|
3214
3253
|
this.uuid = uuid;
|
|
3215
3254
|
this.number = number;
|
|
3255
|
+
this.persistent = persistent;
|
|
3216
3256
|
|
|
3217
3257
|
// Useful to compare instead of instanceof with minified code
|
|
3218
3258
|
this.type = 'Meeting';
|
|
@@ -3290,8 +3330,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
3290
3330
|
}
|
|
3291
3331
|
},
|
|
3292
3332
|
|
|
3293
|
-
|
|
3294
|
-
client.
|
|
3333
|
+
getMyMeetings: () =>
|
|
3334
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
3335
|
+
|
|
3336
|
+
createMyMeeting: (name , persistent ) =>
|
|
3337
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
3295
3338
|
|
|
3296
3339
|
deleteMyMeeting: (meetingUuid ) =>
|
|
3297
3340
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -3776,7 +3819,7 @@ class Recording {
|
|
|
3776
3819
|
|
|
3777
3820
|
|
|
3778
3821
|
|
|
3779
|
-
static parseMany(recordings
|
|
3822
|
+
static parseMany(recordings = []) {
|
|
3780
3823
|
return recordings.map(item => Recording.parse(item));
|
|
3781
3824
|
}
|
|
3782
3825
|
|
|
@@ -3902,7 +3945,7 @@ class CallLog {
|
|
|
3902
3945
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3903
3946
|
start: moment__default['default'](plain.start).toDate(),
|
|
3904
3947
|
end: plain.end ? moment__default['default'](plain.end).toDate() : null,
|
|
3905
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
3948
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
3906
3949
|
});
|
|
3907
3950
|
}
|
|
3908
3951
|
|
|
@@ -5297,6 +5340,7 @@ const ON_REINVITE = 'reinvite';
|
|
|
5297
5340
|
const ON_ERROR = 'onError';
|
|
5298
5341
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
5299
5342
|
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
5343
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
5300
5344
|
class CanceledCallError extends Error {}
|
|
5301
5345
|
|
|
5302
5346
|
const MAX_REGISTER_TRIES = 10;
|
|
@@ -5370,6 +5414,7 @@ class WebRTCClient extends Emitter {
|
|
|
5370
5414
|
|
|
5371
5415
|
|
|
5372
5416
|
|
|
5417
|
+
|
|
5373
5418
|
|
|
5374
5419
|
static isAPrivateIp(ip ) {
|
|
5375
5420
|
const regex = /^(?:10|127|172\.(?:1[6-9]|2[0-9]|3[01])|192\.168)\..*/;
|
|
@@ -5435,6 +5480,7 @@ class WebRTCClient extends Emitter {
|
|
|
5435
5480
|
this.ON_ERROR = ON_ERROR;
|
|
5436
5481
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
5437
5482
|
this.ON_NETWORK_STATS = ON_NETWORK_STATS;
|
|
5483
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED;
|
|
5438
5484
|
}
|
|
5439
5485
|
|
|
5440
5486
|
configureMedia(media ) {
|
|
@@ -5700,7 +5746,9 @@ class WebRTCClient extends Emitter {
|
|
|
5700
5746
|
const inviteOptions = {
|
|
5701
5747
|
requestDelegate: {
|
|
5702
5748
|
onAccept: (response ) => {
|
|
5703
|
-
session.sessionDescriptionHandler.peerConnection
|
|
5749
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
5750
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
5751
|
+
}
|
|
5704
5752
|
this._onAccepted(session, response.session, true);
|
|
5705
5753
|
},
|
|
5706
5754
|
onReject: (response ) => {
|
|
@@ -6036,7 +6084,7 @@ class WebRTCClient extends Emitter {
|
|
|
6036
6084
|
// We search for the last transceiver without `video-` in the mid (video- means remote transceiver)
|
|
6037
6085
|
const transceivers = pc.getTransceivers();
|
|
6038
6086
|
const transceiverIdx = lastIndexOf(transceivers, transceiver =>
|
|
6039
|
-
transceiver.sender.track === null && transceiver.mid.indexOf('video') === -1);
|
|
6087
|
+
transceiver.sender.track === null && transceiver.mid && transceiver.mid.indexOf('video') === -1);
|
|
6040
6088
|
|
|
6041
6089
|
videoSender = transceiverIdx !== -1 ? transceivers[transceiverIdx].sender : null;
|
|
6042
6090
|
} else {
|
|
@@ -6572,6 +6620,16 @@ class WebRTCClient extends Emitter {
|
|
|
6572
6620
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
6573
6621
|
}
|
|
6574
6622
|
|
|
6623
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
6624
|
+
getRemoteVideoStreamFromPc(sessionId ) {
|
|
6625
|
+
const pc = this.getPeerConnection(sessionId);
|
|
6626
|
+
if (!pc) {
|
|
6627
|
+
return null;
|
|
6628
|
+
}
|
|
6629
|
+
|
|
6630
|
+
return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
|
|
6631
|
+
}
|
|
6632
|
+
|
|
6575
6633
|
hasVideo(sessionId ) {
|
|
6576
6634
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
6577
6635
|
}
|
|
@@ -7061,6 +7119,7 @@ class WebRTCClient extends Emitter {
|
|
|
7061
7119
|
|
|
7062
7120
|
this.updateRemoteStream(this.getSipSessionId(session));
|
|
7063
7121
|
|
|
7122
|
+
const pc = session.sessionDescriptionHandler.peerConnection;
|
|
7064
7123
|
const onTrack = (event ) => {
|
|
7065
7124
|
const isAudioOnly = this._isAudioOnly(session);
|
|
7066
7125
|
const { kind, label, readyState, id, muted } = event.track;
|
|
@@ -7080,6 +7139,12 @@ class WebRTCClient extends Emitter {
|
|
|
7080
7139
|
|
|
7081
7140
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
7082
7141
|
|
|
7142
|
+
pc.oniceconnectionstatechange = () => {
|
|
7143
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
7144
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
7145
|
+
}
|
|
7146
|
+
};
|
|
7147
|
+
|
|
7083
7148
|
if (withEvent) {
|
|
7084
7149
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
7085
7150
|
}
|
|
@@ -7299,6 +7364,7 @@ class WebRTCClient extends Emitter {
|
|
|
7299
7364
|
let videoBytesReceived = 0;
|
|
7300
7365
|
let transportSent = 0;
|
|
7301
7366
|
let transportReceived = 0;
|
|
7367
|
+
let packetsLost = 0;
|
|
7302
7368
|
|
|
7303
7369
|
stats.forEach(report => {
|
|
7304
7370
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
@@ -7311,7 +7377,7 @@ class WebRTCClient extends Emitter {
|
|
|
7311
7377
|
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
7312
7378
|
}
|
|
7313
7379
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
7314
|
-
|
|
7380
|
+
packetsLost += report.packetsLost;
|
|
7315
7381
|
networkStats.packetsReceived = report.packetsReceived;
|
|
7316
7382
|
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
7317
7383
|
}
|
|
@@ -7328,27 +7394,36 @@ class WebRTCClient extends Emitter {
|
|
|
7328
7394
|
}
|
|
7329
7395
|
}
|
|
7330
7396
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
7397
|
+
packetsLost += report.packetsLost;
|
|
7331
7398
|
networkStats.roundTripTime = report.roundTripTime;
|
|
7332
7399
|
networkStats.jitter = report.jitter;
|
|
7333
7400
|
}
|
|
7401
|
+
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
7402
|
+
packetsLost += report.packetsLost;
|
|
7403
|
+
}
|
|
7334
7404
|
if (report.type === 'transport') {
|
|
7335
7405
|
transportSent += report.bytesSent;
|
|
7336
7406
|
transportReceived += report.bytesReceived;
|
|
7337
7407
|
}
|
|
7338
7408
|
});
|
|
7339
7409
|
|
|
7340
|
-
networkStats.
|
|
7410
|
+
networkStats.packetsLost = packetsLost;
|
|
7411
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
7412
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
7413
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
7341
7414
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
7342
|
-
networkStats.
|
|
7343
|
-
networkStats.
|
|
7415
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
7416
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
7417
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
7418
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
7419
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
7344
7420
|
networkStats.transportSent = transportSent;
|
|
7345
|
-
networkStats.
|
|
7346
|
-
|
|
7347
|
-
const bandwidth = (networkStats.audioBytesSent - lastAudioSent) + (networkStats.videoBytesSent - lastVideoSent)
|
|
7348
|
-
+ (networkStats.audioBytesReceived - lastAudioReceived) + (networkStats.videoBytesReceived - lastVideoReceived)
|
|
7349
|
-
+ (networkStats.transportReceived - lastTransportReceived) + (networkStats.transportSent - lastTransportSent);
|
|
7421
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
7422
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
7350
7423
|
|
|
7351
|
-
networkStats.bandwidth =
|
|
7424
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
7425
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
7426
|
+
+ networkStats.transportSent;
|
|
7352
7427
|
|
|
7353
7428
|
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
7354
7429
|
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 => {
|
|
@@ -384,7 +407,7 @@ class IssueReporter {
|
|
|
384
407
|
payload._retry = retry + 1;
|
|
385
408
|
}
|
|
386
409
|
|
|
387
|
-
this._sendDebugToGrafana(
|
|
410
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
388
411
|
}, 5000 + retry * 1000);
|
|
389
412
|
});
|
|
390
413
|
}
|
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 => {
|
|
@@ -323,7 +346,7 @@ class IssueReporter {
|
|
|
323
346
|
payload._retry = retry + 1;
|
|
324
347
|
}
|
|
325
348
|
|
|
326
|
-
this._sendDebugToGrafana(
|
|
349
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
327
350
|
}, 5000 + retry * 1000);
|
|
328
351
|
});
|
|
329
352
|
}
|
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 => {
|
|
@@ -384,7 +407,7 @@ class IssueReporter {
|
|
|
384
407
|
payload._retry = retry + 1;
|
|
385
408
|
}
|
|
386
409
|
|
|
387
|
-
this._sendDebugToGrafana(
|
|
410
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
388
411
|
}, 5000 + retry * 1000);
|
|
389
412
|
});
|
|
390
413
|
}
|
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 => {
|
|
@@ -387,7 +410,7 @@ class IssueReporter {
|
|
|
387
410
|
payload._retry = retry + 1;
|
|
388
411
|
}
|
|
389
412
|
|
|
390
|
-
this._sendDebugToGrafana(
|
|
413
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
391
414
|
}, 5000 + retry * 1000);
|
|
392
415
|
});
|
|
393
416
|
}
|