@wazo/sdk 0.37.20 → 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 +5 -5
- package/esm/__tests__/api-client.test.js +44 -5
- package/esm/__tests__/web-rtc-client.test.js +70 -15
- 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 +25 -2
- package/esm/api/calld.js +25 -2
- package/esm/api/chatd.js +25 -2
- package/esm/api/confd.js +44 -5
- package/esm/api/ctid-ng.js +25 -2
- package/esm/api/dird.js +25 -2
- package/esm/api/webhookd.js +25 -2
- package/esm/api-client.js +44 -5
- package/esm/checker/Checker.js +72 -15
- package/esm/checker/checks/aor.js +44 -5
- package/esm/checker/checks/api.js +44 -5
- package/esm/checker/checks/index.js +72 -15
- package/esm/checker/checks/wazo-websocket.js +27 -2
- package/esm/checker/checks/webrtc-transport.js +70 -15
- package/esm/checker/checks/webrtc.js +70 -15
- package/esm/domain/AdHocAPIConference.js +44 -5
- package/esm/domain/Features.js +44 -5
- package/esm/domain/Meeting.js +14 -1
- package/esm/domain/Phone/CTIPhone.js +44 -5
- package/esm/domain/Phone/WebRTCPhone.js +32 -3
- package/esm/index.js +85 -16
- package/esm/lib/WazoSessionDescriptionHandler.js +25 -2
- package/esm/service/CallApi.js +44 -5
- package/esm/service/IssueReporter.js +25 -2
- package/esm/service/__tests__/IssueReporter.test.js +25 -2
- package/esm/service/getApiClient.js +44 -5
- package/esm/simple/Auth.js +85 -16
- package/esm/simple/Configuration.js +85 -16
- package/esm/simple/Directory.js +44 -5
- package/esm/simple/Phone.js +85 -16
- package/esm/simple/Websocket.js +28 -2
- package/esm/simple/index.js +85 -16
- package/esm/simple/room/LocalParticipant.js +85 -16
- package/esm/simple/room/Participant.js +85 -16
- package/esm/simple/room/RemoteParticipant.js +85 -16
- package/esm/simple/room/Room.js +85 -16
- package/esm/simple/room/SipRoom.js +85 -16
- package/esm/simple/room/Stream.js +85 -16
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +85 -16
- package/esm/simple/utils.js +85 -16
- package/esm/utils/__tests__/api-requester.test.js +25 -2
- package/esm/utils/api-requester.js +25 -2
- package/esm/web-rtc-client.js +70 -15
- package/esm/websocket-client.js +28 -3
- package/lib/__tests__/api-client.test.js +44 -5
- package/lib/__tests__/web-rtc-client.test.js +70 -15
- 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 +25 -2
- package/lib/api/calld.js +25 -2
- package/lib/api/chatd.js +25 -2
- package/lib/api/confd.js +44 -5
- package/lib/api/ctid-ng.js +25 -2
- package/lib/api/dird.js +25 -2
- package/lib/api/webhookd.js +25 -2
- package/lib/api-client.js +44 -5
- package/lib/checker/Checker.js +72 -15
- package/lib/checker/checks/aor.js +44 -5
- package/lib/checker/checks/api.js +44 -5
- package/lib/checker/checks/index.js +72 -15
- package/lib/checker/checks/wazo-websocket.js +27 -2
- package/lib/checker/checks/webrtc-transport.js +70 -15
- package/lib/checker/checks/webrtc.js +70 -15
- package/lib/domain/AdHocAPIConference.js +44 -5
- package/lib/domain/Features.js +44 -5
- package/lib/domain/Meeting.js +14 -1
- package/lib/domain/Phone/CTIPhone.js +44 -5
- package/lib/domain/Phone/WebRTCPhone.js +32 -3
- package/lib/index.js +85 -16
- package/lib/lib/WazoSessionDescriptionHandler.js +25 -2
- package/lib/service/CallApi.js +44 -5
- package/lib/service/IssueReporter.js +25 -2
- package/lib/service/__tests__/IssueReporter.test.js +25 -2
- package/lib/service/getApiClient.js +44 -5
- package/lib/simple/Auth.js +85 -16
- package/lib/simple/Configuration.js +85 -16
- package/lib/simple/Directory.js +44 -5
- package/lib/simple/Phone.js +85 -16
- package/lib/simple/Websocket.js +28 -2
- package/lib/simple/index.js +85 -16
- package/lib/simple/room/LocalParticipant.js +85 -16
- package/lib/simple/room/Participant.js +85 -16
- package/lib/simple/room/RemoteParticipant.js +85 -16
- package/lib/simple/room/Room.js +85 -16
- package/lib/simple/room/SipRoom.js +85 -16
- package/lib/simple/room/Stream.js +85 -16
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +85 -16
- package/lib/simple/utils.js +85 -16
- package/lib/utils/__tests__/api-requester.test.js +25 -2
- package/lib/utils/api-requester.js +25 -2
- package/lib/web-rtc-client.js +70 -15
- package/lib/websocket-client.js +28 -2
- package/package.json +1 -1
- package/src/api/confd.js +5 -2
- package/src/domain/Meeting.js +14 -1
- package/src/domain/Phone/WebRTCPhone.js +7 -1
- 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 +26 -10
- package/src/websocket-client.js +2 -0
|
@@ -136,6 +136,7 @@ class IssueReporter {
|
|
|
136
136
|
|
|
137
137
|
|
|
138
138
|
|
|
139
|
+
|
|
139
140
|
|
|
140
141
|
constructor() {
|
|
141
142
|
addLevelsTo(this);
|
|
@@ -147,12 +148,17 @@ class IssueReporter {
|
|
|
147
148
|
this.bufferTimeout = null;
|
|
148
149
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
149
150
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
151
|
+
this._callback = null;
|
|
150
152
|
}
|
|
151
153
|
|
|
152
154
|
init() {
|
|
153
155
|
this._catchConsole();
|
|
154
156
|
}
|
|
155
157
|
|
|
158
|
+
setCallback(cb ) {
|
|
159
|
+
this._callback = cb;
|
|
160
|
+
}
|
|
161
|
+
|
|
156
162
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
157
163
|
this.remoteClientConfiguration = configuration;
|
|
158
164
|
}
|
|
@@ -188,6 +194,7 @@ class IssueReporter {
|
|
|
188
194
|
|
|
189
195
|
// Handle category label
|
|
190
196
|
let category = null;
|
|
197
|
+
let skipSendToRemote = false;
|
|
191
198
|
let extra = {};
|
|
192
199
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
193
200
|
category = args[0].split('=')[1];
|
|
@@ -203,6 +210,7 @@ class IssueReporter {
|
|
|
203
210
|
errorMessage: lastArg.message,
|
|
204
211
|
errorStack: lastArg.stack,
|
|
205
212
|
errorType: lastArg.constructor.name,
|
|
213
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
206
214
|
};
|
|
207
215
|
} else {
|
|
208
216
|
extra = lastArg;
|
|
@@ -211,6 +219,11 @@ class IssueReporter {
|
|
|
211
219
|
args.splice(1, 1);
|
|
212
220
|
}
|
|
213
221
|
|
|
222
|
+
if (extra.skipSendToRemote) {
|
|
223
|
+
skipSendToRemote = true;
|
|
224
|
+
delete extra.skipSendToRemote;
|
|
225
|
+
}
|
|
226
|
+
|
|
214
227
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
215
228
|
const message = args.join(', ');
|
|
216
229
|
let consoleMessage = message;
|
|
@@ -231,7 +244,13 @@ class IssueReporter {
|
|
|
231
244
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
232
245
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
233
246
|
|
|
234
|
-
this.
|
|
247
|
+
if (this._callback) {
|
|
248
|
+
this._callback(level, consoleMessage);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (!skipSendToRemote) {
|
|
252
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
253
|
+
}
|
|
235
254
|
}
|
|
236
255
|
|
|
237
256
|
logRequest(url , options , response , start ) {
|
|
@@ -376,7 +395,11 @@ class IssueReporter {
|
|
|
376
395
|
},
|
|
377
396
|
// $FlowFixMe
|
|
378
397
|
body,
|
|
379
|
-
}).catch(() => {
|
|
398
|
+
}).catch((e ) => {
|
|
399
|
+
// $FlowFixMe
|
|
400
|
+
e.skipSendToRemote = true;
|
|
401
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
402
|
+
|
|
380
403
|
setTimeout(() => {
|
|
381
404
|
if (isArray) {
|
|
382
405
|
payload = payload.map(message => {
|
|
@@ -2620,11 +2643,24 @@ class Meeting {
|
|
|
2620
2643
|
});
|
|
2621
2644
|
}
|
|
2622
2645
|
|
|
2646
|
+
static parseMany(items ) {
|
|
2647
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2623
2650
|
static newFrom(meeting ) {
|
|
2624
2651
|
return newFrom(meeting, Meeting);
|
|
2625
2652
|
}
|
|
2626
2653
|
|
|
2627
|
-
constructor({
|
|
2654
|
+
constructor({
|
|
2655
|
+
uuid,
|
|
2656
|
+
name,
|
|
2657
|
+
guestSipAuthorization,
|
|
2658
|
+
ownerUuids,
|
|
2659
|
+
port,
|
|
2660
|
+
uri,
|
|
2661
|
+
number,
|
|
2662
|
+
persistent,
|
|
2663
|
+
} = {}) {
|
|
2628
2664
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2629
2665
|
this.uri = uri;
|
|
2630
2666
|
this.name = name;
|
|
@@ -2710,8 +2746,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2710
2746
|
}
|
|
2711
2747
|
},
|
|
2712
2748
|
|
|
2713
|
-
|
|
2714
|
-
client.
|
|
2749
|
+
getMyMeetings: () =>
|
|
2750
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2751
|
+
|
|
2752
|
+
createMyMeeting: (name , persistent ) =>
|
|
2753
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2715
2754
|
|
|
2716
2755
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2717
2756
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -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 => {
|
|
@@ -3204,11 +3227,24 @@ class Meeting {
|
|
|
3204
3227
|
});
|
|
3205
3228
|
}
|
|
3206
3229
|
|
|
3230
|
+
static parseMany(items ) {
|
|
3231
|
+
return items.map(plain => Meeting.parse(plain));
|
|
3232
|
+
}
|
|
3233
|
+
|
|
3207
3234
|
static newFrom(meeting ) {
|
|
3208
3235
|
return newFrom(meeting, Meeting);
|
|
3209
3236
|
}
|
|
3210
3237
|
|
|
3211
|
-
constructor({
|
|
3238
|
+
constructor({
|
|
3239
|
+
uuid,
|
|
3240
|
+
name,
|
|
3241
|
+
guestSipAuthorization,
|
|
3242
|
+
ownerUuids,
|
|
3243
|
+
port,
|
|
3244
|
+
uri,
|
|
3245
|
+
number,
|
|
3246
|
+
persistent,
|
|
3247
|
+
} = {}) {
|
|
3212
3248
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
3213
3249
|
this.uri = uri;
|
|
3214
3250
|
this.name = name;
|
|
@@ -3294,8 +3330,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
3294
3330
|
}
|
|
3295
3331
|
},
|
|
3296
3332
|
|
|
3297
|
-
|
|
3298
|
-
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),
|
|
3299
3338
|
|
|
3300
3339
|
deleteMyMeeting: (meetingUuid ) =>
|
|
3301
3340
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -5707,7 +5746,9 @@ class WebRTCClient extends Emitter {
|
|
|
5707
5746
|
const inviteOptions = {
|
|
5708
5747
|
requestDelegate: {
|
|
5709
5748
|
onAccept: (response ) => {
|
|
5710
|
-
session.sessionDescriptionHandler.peerConnection
|
|
5749
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
5750
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
5751
|
+
}
|
|
5711
5752
|
this._onAccepted(session, response.session, true);
|
|
5712
5753
|
},
|
|
5713
5754
|
onReject: (response ) => {
|
|
@@ -6579,6 +6620,16 @@ class WebRTCClient extends Emitter {
|
|
|
6579
6620
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
6580
6621
|
}
|
|
6581
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
|
+
|
|
6582
6633
|
hasVideo(sessionId ) {
|
|
6583
6634
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
6584
6635
|
}
|
|
@@ -7357,18 +7408,22 @@ class WebRTCClient extends Emitter {
|
|
|
7357
7408
|
});
|
|
7358
7409
|
|
|
7359
7410
|
networkStats.packetsLost = packetsLost;
|
|
7360
|
-
networkStats.
|
|
7411
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
7412
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
7413
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
7361
7414
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
7362
|
-
networkStats.
|
|
7363
|
-
networkStats.
|
|
7415
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
7416
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
7417
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
7418
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
7419
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
7364
7420
|
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);
|
|
7421
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
7422
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
7370
7423
|
|
|
7371
|
-
networkStats.bandwidth =
|
|
7424
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
7425
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
7426
|
+
+ networkStats.transportSent;
|
|
7372
7427
|
|
|
7373
7428
|
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
7374
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 => {
|
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 => {
|
package/lib/api/call-logd.js
CHANGED
|
@@ -72,6 +72,7 @@ class IssueReporter {
|
|
|
72
72
|
|
|
73
73
|
|
|
74
74
|
|
|
75
|
+
|
|
75
76
|
|
|
76
77
|
constructor() {
|
|
77
78
|
addLevelsTo(this);
|
|
@@ -83,12 +84,17 @@ class IssueReporter {
|
|
|
83
84
|
this.bufferTimeout = null;
|
|
84
85
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
85
86
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
87
|
+
this._callback = null;
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
init() {
|
|
89
91
|
this._catchConsole();
|
|
90
92
|
}
|
|
91
93
|
|
|
94
|
+
setCallback(cb ) {
|
|
95
|
+
this._callback = cb;
|
|
96
|
+
}
|
|
97
|
+
|
|
92
98
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
93
99
|
this.remoteClientConfiguration = configuration;
|
|
94
100
|
}
|
|
@@ -124,6 +130,7 @@ class IssueReporter {
|
|
|
124
130
|
|
|
125
131
|
// Handle category label
|
|
126
132
|
let category = null;
|
|
133
|
+
let skipSendToRemote = false;
|
|
127
134
|
let extra = {};
|
|
128
135
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
129
136
|
category = args[0].split('=')[1];
|
|
@@ -139,6 +146,7 @@ class IssueReporter {
|
|
|
139
146
|
errorMessage: lastArg.message,
|
|
140
147
|
errorStack: lastArg.stack,
|
|
141
148
|
errorType: lastArg.constructor.name,
|
|
149
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
142
150
|
};
|
|
143
151
|
} else {
|
|
144
152
|
extra = lastArg;
|
|
@@ -147,6 +155,11 @@ class IssueReporter {
|
|
|
147
155
|
args.splice(1, 1);
|
|
148
156
|
}
|
|
149
157
|
|
|
158
|
+
if (extra.skipSendToRemote) {
|
|
159
|
+
skipSendToRemote = true;
|
|
160
|
+
delete extra.skipSendToRemote;
|
|
161
|
+
}
|
|
162
|
+
|
|
150
163
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
151
164
|
const message = args.join(', ');
|
|
152
165
|
let consoleMessage = message;
|
|
@@ -167,7 +180,13 @@ class IssueReporter {
|
|
|
167
180
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
168
181
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
169
182
|
|
|
170
|
-
this.
|
|
183
|
+
if (this._callback) {
|
|
184
|
+
this._callback(level, consoleMessage);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (!skipSendToRemote) {
|
|
188
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
189
|
+
}
|
|
171
190
|
}
|
|
172
191
|
|
|
173
192
|
logRequest(url , options , response , start ) {
|
|
@@ -312,7 +331,11 @@ class IssueReporter {
|
|
|
312
331
|
},
|
|
313
332
|
// $FlowFixMe
|
|
314
333
|
body,
|
|
315
|
-
}).catch(() => {
|
|
334
|
+
}).catch((e ) => {
|
|
335
|
+
// $FlowFixMe
|
|
336
|
+
e.skipSendToRemote = true;
|
|
337
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
338
|
+
|
|
316
339
|
setTimeout(() => {
|
|
317
340
|
if (isArray) {
|
|
318
341
|
payload = payload.map(message => {
|