@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
|
@@ -412,6 +412,7 @@ class IssueReporter {
|
|
|
412
412
|
|
|
413
413
|
|
|
414
414
|
|
|
415
|
+
|
|
415
416
|
|
|
416
417
|
constructor() {
|
|
417
418
|
addLevelsTo(this);
|
|
@@ -423,12 +424,17 @@ class IssueReporter {
|
|
|
423
424
|
this.bufferTimeout = null;
|
|
424
425
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
425
426
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
427
|
+
this._callback = null;
|
|
426
428
|
}
|
|
427
429
|
|
|
428
430
|
init() {
|
|
429
431
|
this._catchConsole();
|
|
430
432
|
}
|
|
431
433
|
|
|
434
|
+
setCallback(cb ) {
|
|
435
|
+
this._callback = cb;
|
|
436
|
+
}
|
|
437
|
+
|
|
432
438
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
433
439
|
this.remoteClientConfiguration = configuration;
|
|
434
440
|
}
|
|
@@ -464,6 +470,7 @@ class IssueReporter {
|
|
|
464
470
|
|
|
465
471
|
// Handle category label
|
|
466
472
|
let category = null;
|
|
473
|
+
let skipSendToRemote = false;
|
|
467
474
|
let extra = {};
|
|
468
475
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
469
476
|
category = args[0].split('=')[1];
|
|
@@ -479,6 +486,7 @@ class IssueReporter {
|
|
|
479
486
|
errorMessage: lastArg.message,
|
|
480
487
|
errorStack: lastArg.stack,
|
|
481
488
|
errorType: lastArg.constructor.name,
|
|
489
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
482
490
|
};
|
|
483
491
|
} else {
|
|
484
492
|
extra = lastArg;
|
|
@@ -487,6 +495,11 @@ class IssueReporter {
|
|
|
487
495
|
args.splice(1, 1);
|
|
488
496
|
}
|
|
489
497
|
|
|
498
|
+
if (extra.skipSendToRemote) {
|
|
499
|
+
skipSendToRemote = true;
|
|
500
|
+
delete extra.skipSendToRemote;
|
|
501
|
+
}
|
|
502
|
+
|
|
490
503
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
491
504
|
const message = args.join(', ');
|
|
492
505
|
let consoleMessage = message;
|
|
@@ -507,7 +520,13 @@ class IssueReporter {
|
|
|
507
520
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
508
521
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
509
522
|
|
|
510
|
-
this.
|
|
523
|
+
if (this._callback) {
|
|
524
|
+
this._callback(level, consoleMessage);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
if (!skipSendToRemote) {
|
|
528
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
529
|
+
}
|
|
511
530
|
}
|
|
512
531
|
|
|
513
532
|
logRequest(url , options , response , start ) {
|
|
@@ -652,7 +671,11 @@ class IssueReporter {
|
|
|
652
671
|
},
|
|
653
672
|
// $FlowFixMe
|
|
654
673
|
body,
|
|
655
|
-
}).catch(() => {
|
|
674
|
+
}).catch((e ) => {
|
|
675
|
+
// $FlowFixMe
|
|
676
|
+
e.skipSendToRemote = true;
|
|
677
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
678
|
+
|
|
656
679
|
setTimeout(() => {
|
|
657
680
|
if (isArray) {
|
|
658
681
|
payload = payload.map(message => {
|
|
@@ -664,7 +687,7 @@ class IssueReporter {
|
|
|
664
687
|
payload._retry = retry + 1;
|
|
665
688
|
}
|
|
666
689
|
|
|
667
|
-
this._sendDebugToGrafana(
|
|
690
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
668
691
|
}, 5000 + retry * 1000);
|
|
669
692
|
});
|
|
670
693
|
}
|
|
@@ -3166,7 +3189,8 @@ class ExternalApp {
|
|
|
3166
3189
|
|
|
3167
3190
|
|
|
3168
3191
|
|
|
3169
|
-
|
|
3192
|
+
|
|
3193
|
+
|
|
3170
3194
|
|
|
3171
3195
|
|
|
3172
3196
|
class Meeting {
|
|
@@ -3178,6 +3202,7 @@ class Meeting {
|
|
|
3178
3202
|
|
|
3179
3203
|
|
|
3180
3204
|
|
|
3205
|
+
|
|
3181
3206
|
|
|
3182
3207
|
|
|
3183
3208
|
static parse(plain ) {
|
|
@@ -3189,14 +3214,28 @@ class Meeting {
|
|
|
3189
3214
|
port: plain.port,
|
|
3190
3215
|
uuid: plain.uuid,
|
|
3191
3216
|
number: plain.number,
|
|
3217
|
+
persistent: plain.persistent,
|
|
3192
3218
|
});
|
|
3193
3219
|
}
|
|
3194
3220
|
|
|
3221
|
+
static parseMany(items ) {
|
|
3222
|
+
return items.map(plain => Meeting.parse(plain));
|
|
3223
|
+
}
|
|
3224
|
+
|
|
3195
3225
|
static newFrom(meeting ) {
|
|
3196
3226
|
return newFrom(meeting, Meeting);
|
|
3197
3227
|
}
|
|
3198
3228
|
|
|
3199
|
-
constructor({
|
|
3229
|
+
constructor({
|
|
3230
|
+
uuid,
|
|
3231
|
+
name,
|
|
3232
|
+
guestSipAuthorization,
|
|
3233
|
+
ownerUuids,
|
|
3234
|
+
port,
|
|
3235
|
+
uri,
|
|
3236
|
+
number,
|
|
3237
|
+
persistent,
|
|
3238
|
+
} = {}) {
|
|
3200
3239
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
3201
3240
|
this.uri = uri;
|
|
3202
3241
|
this.name = name;
|
|
@@ -3204,6 +3243,7 @@ class Meeting {
|
|
|
3204
3243
|
this.port = port;
|
|
3205
3244
|
this.uuid = uuid;
|
|
3206
3245
|
this.number = number;
|
|
3246
|
+
this.persistent = persistent;
|
|
3207
3247
|
|
|
3208
3248
|
// Useful to compare instead of instanceof with minified code
|
|
3209
3249
|
this.type = 'Meeting';
|
|
@@ -3281,8 +3321,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
3281
3321
|
}
|
|
3282
3322
|
},
|
|
3283
3323
|
|
|
3284
|
-
|
|
3285
|
-
client.
|
|
3324
|
+
getMyMeetings: () =>
|
|
3325
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
3326
|
+
|
|
3327
|
+
createMyMeeting: (name , persistent ) =>
|
|
3328
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
3286
3329
|
|
|
3287
3330
|
deleteMyMeeting: (meetingUuid ) =>
|
|
3288
3331
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -3767,7 +3810,7 @@ class Recording {
|
|
|
3767
3810
|
|
|
3768
3811
|
|
|
3769
3812
|
|
|
3770
|
-
static parseMany(recordings
|
|
3813
|
+
static parseMany(recordings = []) {
|
|
3771
3814
|
return recordings.map(item => Recording.parse(item));
|
|
3772
3815
|
}
|
|
3773
3816
|
|
|
@@ -3893,7 +3936,7 @@ class CallLog {
|
|
|
3893
3936
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3894
3937
|
start: moment(plain.start).toDate(),
|
|
3895
3938
|
end: plain.end ? moment(plain.end).toDate() : null,
|
|
3896
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
3939
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
3897
3940
|
});
|
|
3898
3941
|
}
|
|
3899
3942
|
|
|
@@ -5288,6 +5331,7 @@ const ON_REINVITE = 'reinvite';
|
|
|
5288
5331
|
const ON_ERROR = 'onError';
|
|
5289
5332
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
5290
5333
|
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
5334
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
5291
5335
|
class CanceledCallError extends Error {}
|
|
5292
5336
|
|
|
5293
5337
|
const MAX_REGISTER_TRIES = 10;
|
|
@@ -5361,6 +5405,7 @@ class WebRTCClient extends Emitter {
|
|
|
5361
5405
|
|
|
5362
5406
|
|
|
5363
5407
|
|
|
5408
|
+
|
|
5364
5409
|
|
|
5365
5410
|
static isAPrivateIp(ip ) {
|
|
5366
5411
|
const regex = /^(?:10|127|172\.(?:1[6-9]|2[0-9]|3[01])|192\.168)\..*/;
|
|
@@ -5426,6 +5471,7 @@ class WebRTCClient extends Emitter {
|
|
|
5426
5471
|
this.ON_ERROR = ON_ERROR;
|
|
5427
5472
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
5428
5473
|
this.ON_NETWORK_STATS = ON_NETWORK_STATS;
|
|
5474
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED;
|
|
5429
5475
|
}
|
|
5430
5476
|
|
|
5431
5477
|
configureMedia(media ) {
|
|
@@ -5691,7 +5737,9 @@ class WebRTCClient extends Emitter {
|
|
|
5691
5737
|
const inviteOptions = {
|
|
5692
5738
|
requestDelegate: {
|
|
5693
5739
|
onAccept: (response ) => {
|
|
5694
|
-
session.sessionDescriptionHandler.peerConnection
|
|
5740
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
5741
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
5742
|
+
}
|
|
5695
5743
|
this._onAccepted(session, response.session, true);
|
|
5696
5744
|
},
|
|
5697
5745
|
onReject: (response ) => {
|
|
@@ -6027,7 +6075,7 @@ class WebRTCClient extends Emitter {
|
|
|
6027
6075
|
// We search for the last transceiver without `video-` in the mid (video- means remote transceiver)
|
|
6028
6076
|
const transceivers = pc.getTransceivers();
|
|
6029
6077
|
const transceiverIdx = lastIndexOf(transceivers, transceiver =>
|
|
6030
|
-
transceiver.sender.track === null && transceiver.mid.indexOf('video') === -1);
|
|
6078
|
+
transceiver.sender.track === null && transceiver.mid && transceiver.mid.indexOf('video') === -1);
|
|
6031
6079
|
|
|
6032
6080
|
videoSender = transceiverIdx !== -1 ? transceivers[transceiverIdx].sender : null;
|
|
6033
6081
|
} else {
|
|
@@ -6563,6 +6611,16 @@ class WebRTCClient extends Emitter {
|
|
|
6563
6611
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
6564
6612
|
}
|
|
6565
6613
|
|
|
6614
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
6615
|
+
getRemoteVideoStreamFromPc(sessionId ) {
|
|
6616
|
+
const pc = this.getPeerConnection(sessionId);
|
|
6617
|
+
if (!pc) {
|
|
6618
|
+
return null;
|
|
6619
|
+
}
|
|
6620
|
+
|
|
6621
|
+
return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
|
|
6622
|
+
}
|
|
6623
|
+
|
|
6566
6624
|
hasVideo(sessionId ) {
|
|
6567
6625
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
6568
6626
|
}
|
|
@@ -7052,6 +7110,7 @@ class WebRTCClient extends Emitter {
|
|
|
7052
7110
|
|
|
7053
7111
|
this.updateRemoteStream(this.getSipSessionId(session));
|
|
7054
7112
|
|
|
7113
|
+
const pc = session.sessionDescriptionHandler.peerConnection;
|
|
7055
7114
|
const onTrack = (event ) => {
|
|
7056
7115
|
const isAudioOnly = this._isAudioOnly(session);
|
|
7057
7116
|
const { kind, label, readyState, id, muted } = event.track;
|
|
@@ -7071,6 +7130,12 @@ class WebRTCClient extends Emitter {
|
|
|
7071
7130
|
|
|
7072
7131
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
7073
7132
|
|
|
7133
|
+
pc.oniceconnectionstatechange = () => {
|
|
7134
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
7135
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
7136
|
+
}
|
|
7137
|
+
};
|
|
7138
|
+
|
|
7074
7139
|
if (withEvent) {
|
|
7075
7140
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
7076
7141
|
}
|
|
@@ -7290,6 +7355,7 @@ class WebRTCClient extends Emitter {
|
|
|
7290
7355
|
let videoBytesReceived = 0;
|
|
7291
7356
|
let transportSent = 0;
|
|
7292
7357
|
let transportReceived = 0;
|
|
7358
|
+
let packetsLost = 0;
|
|
7293
7359
|
|
|
7294
7360
|
stats.forEach(report => {
|
|
7295
7361
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
@@ -7302,7 +7368,7 @@ class WebRTCClient extends Emitter {
|
|
|
7302
7368
|
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
7303
7369
|
}
|
|
7304
7370
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
7305
|
-
|
|
7371
|
+
packetsLost += report.packetsLost;
|
|
7306
7372
|
networkStats.packetsReceived = report.packetsReceived;
|
|
7307
7373
|
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
7308
7374
|
}
|
|
@@ -7319,27 +7385,36 @@ class WebRTCClient extends Emitter {
|
|
|
7319
7385
|
}
|
|
7320
7386
|
}
|
|
7321
7387
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
7388
|
+
packetsLost += report.packetsLost;
|
|
7322
7389
|
networkStats.roundTripTime = report.roundTripTime;
|
|
7323
7390
|
networkStats.jitter = report.jitter;
|
|
7324
7391
|
}
|
|
7392
|
+
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
7393
|
+
packetsLost += report.packetsLost;
|
|
7394
|
+
}
|
|
7325
7395
|
if (report.type === 'transport') {
|
|
7326
7396
|
transportSent += report.bytesSent;
|
|
7327
7397
|
transportReceived += report.bytesReceived;
|
|
7328
7398
|
}
|
|
7329
7399
|
});
|
|
7330
7400
|
|
|
7331
|
-
networkStats.
|
|
7401
|
+
networkStats.packetsLost = packetsLost;
|
|
7402
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
7403
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
7404
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
7332
7405
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
7333
|
-
networkStats.
|
|
7334
|
-
networkStats.
|
|
7406
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
7407
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
7408
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
7409
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
7410
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
7335
7411
|
networkStats.transportSent = transportSent;
|
|
7336
|
-
networkStats.
|
|
7337
|
-
|
|
7338
|
-
const bandwidth = (networkStats.audioBytesSent - lastAudioSent) + (networkStats.videoBytesSent - lastVideoSent)
|
|
7339
|
-
+ (networkStats.audioBytesReceived - lastAudioReceived) + (networkStats.videoBytesReceived - lastVideoReceived)
|
|
7340
|
-
+ (networkStats.transportReceived - lastTransportReceived) + (networkStats.transportSent - lastTransportSent);
|
|
7412
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
7413
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
7341
7414
|
|
|
7342
|
-
networkStats.bandwidth =
|
|
7415
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
7416
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
7417
|
+
+ networkStats.transportSent;
|
|
7343
7418
|
|
|
7344
7419
|
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
7345
7420
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
@@ -347,6 +347,7 @@ class IssueReporter {
|
|
|
347
347
|
|
|
348
348
|
|
|
349
349
|
|
|
350
|
+
|
|
350
351
|
|
|
351
352
|
constructor() {
|
|
352
353
|
addLevelsTo(this);
|
|
@@ -358,12 +359,17 @@ class IssueReporter {
|
|
|
358
359
|
this.bufferTimeout = null;
|
|
359
360
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
360
361
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
362
|
+
this._callback = null;
|
|
361
363
|
}
|
|
362
364
|
|
|
363
365
|
init() {
|
|
364
366
|
this._catchConsole();
|
|
365
367
|
}
|
|
366
368
|
|
|
369
|
+
setCallback(cb ) {
|
|
370
|
+
this._callback = cb;
|
|
371
|
+
}
|
|
372
|
+
|
|
367
373
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
368
374
|
this.remoteClientConfiguration = configuration;
|
|
369
375
|
}
|
|
@@ -399,6 +405,7 @@ class IssueReporter {
|
|
|
399
405
|
|
|
400
406
|
// Handle category label
|
|
401
407
|
let category = null;
|
|
408
|
+
let skipSendToRemote = false;
|
|
402
409
|
let extra = {};
|
|
403
410
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
404
411
|
category = args[0].split('=')[1];
|
|
@@ -414,6 +421,7 @@ class IssueReporter {
|
|
|
414
421
|
errorMessage: lastArg.message,
|
|
415
422
|
errorStack: lastArg.stack,
|
|
416
423
|
errorType: lastArg.constructor.name,
|
|
424
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
417
425
|
};
|
|
418
426
|
} else {
|
|
419
427
|
extra = lastArg;
|
|
@@ -422,6 +430,11 @@ class IssueReporter {
|
|
|
422
430
|
args.splice(1, 1);
|
|
423
431
|
}
|
|
424
432
|
|
|
433
|
+
if (extra.skipSendToRemote) {
|
|
434
|
+
skipSendToRemote = true;
|
|
435
|
+
delete extra.skipSendToRemote;
|
|
436
|
+
}
|
|
437
|
+
|
|
425
438
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
426
439
|
const message = args.join(', ');
|
|
427
440
|
let consoleMessage = message;
|
|
@@ -442,7 +455,13 @@ class IssueReporter {
|
|
|
442
455
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
443
456
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
444
457
|
|
|
445
|
-
this.
|
|
458
|
+
if (this._callback) {
|
|
459
|
+
this._callback(level, consoleMessage);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
if (!skipSendToRemote) {
|
|
463
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
464
|
+
}
|
|
446
465
|
}
|
|
447
466
|
|
|
448
467
|
logRequest(url , options , response , start ) {
|
|
@@ -587,7 +606,11 @@ class IssueReporter {
|
|
|
587
606
|
},
|
|
588
607
|
// $FlowFixMe
|
|
589
608
|
body,
|
|
590
|
-
}).catch(() => {
|
|
609
|
+
}).catch((e ) => {
|
|
610
|
+
// $FlowFixMe
|
|
611
|
+
e.skipSendToRemote = true;
|
|
612
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
613
|
+
|
|
591
614
|
setTimeout(() => {
|
|
592
615
|
if (isArray) {
|
|
593
616
|
payload = payload.map(message => {
|
|
@@ -599,7 +622,7 @@ class IssueReporter {
|
|
|
599
622
|
payload._retry = retry + 1;
|
|
600
623
|
}
|
|
601
624
|
|
|
602
|
-
this._sendDebugToGrafana(
|
|
625
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
603
626
|
}, 5000 + retry * 1000);
|
|
604
627
|
});
|
|
605
628
|
}
|
|
@@ -2791,7 +2814,8 @@ class ExternalApp {
|
|
|
2791
2814
|
|
|
2792
2815
|
|
|
2793
2816
|
|
|
2794
|
-
|
|
2817
|
+
|
|
2818
|
+
|
|
2795
2819
|
|
|
2796
2820
|
|
|
2797
2821
|
class Meeting {
|
|
@@ -2803,6 +2827,7 @@ class Meeting {
|
|
|
2803
2827
|
|
|
2804
2828
|
|
|
2805
2829
|
|
|
2830
|
+
|
|
2806
2831
|
|
|
2807
2832
|
|
|
2808
2833
|
static parse(plain ) {
|
|
@@ -2814,14 +2839,28 @@ class Meeting {
|
|
|
2814
2839
|
port: plain.port,
|
|
2815
2840
|
uuid: plain.uuid,
|
|
2816
2841
|
number: plain.number,
|
|
2842
|
+
persistent: plain.persistent,
|
|
2817
2843
|
});
|
|
2818
2844
|
}
|
|
2819
2845
|
|
|
2846
|
+
static parseMany(items ) {
|
|
2847
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2820
2850
|
static newFrom(meeting ) {
|
|
2821
2851
|
return newFrom(meeting, Meeting);
|
|
2822
2852
|
}
|
|
2823
2853
|
|
|
2824
|
-
constructor({
|
|
2854
|
+
constructor({
|
|
2855
|
+
uuid,
|
|
2856
|
+
name,
|
|
2857
|
+
guestSipAuthorization,
|
|
2858
|
+
ownerUuids,
|
|
2859
|
+
port,
|
|
2860
|
+
uri,
|
|
2861
|
+
number,
|
|
2862
|
+
persistent,
|
|
2863
|
+
} = {}) {
|
|
2825
2864
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2826
2865
|
this.uri = uri;
|
|
2827
2866
|
this.name = name;
|
|
@@ -2829,6 +2868,7 @@ class Meeting {
|
|
|
2829
2868
|
this.port = port;
|
|
2830
2869
|
this.uuid = uuid;
|
|
2831
2870
|
this.number = number;
|
|
2871
|
+
this.persistent = persistent;
|
|
2832
2872
|
|
|
2833
2873
|
// Useful to compare instead of instanceof with minified code
|
|
2834
2874
|
this.type = 'Meeting';
|
|
@@ -2906,8 +2946,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2906
2946
|
}
|
|
2907
2947
|
},
|
|
2908
2948
|
|
|
2909
|
-
|
|
2910
|
-
client.
|
|
2949
|
+
getMyMeetings: () =>
|
|
2950
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2951
|
+
|
|
2952
|
+
createMyMeeting: (name , persistent ) =>
|
|
2953
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2911
2954
|
|
|
2912
2955
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2913
2956
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -3186,7 +3229,7 @@ class Recording {
|
|
|
3186
3229
|
|
|
3187
3230
|
|
|
3188
3231
|
|
|
3189
|
-
static parseMany(recordings
|
|
3232
|
+
static parseMany(recordings = []) {
|
|
3190
3233
|
return recordings.map(item => Recording.parse(item));
|
|
3191
3234
|
}
|
|
3192
3235
|
|
|
@@ -3312,7 +3355,7 @@ class CallLog {
|
|
|
3312
3355
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3313
3356
|
start: moment(plain.start).toDate(),
|
|
3314
3357
|
end: plain.end ? moment(plain.end).toDate() : null,
|
|
3315
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
3358
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
3316
3359
|
});
|
|
3317
3360
|
}
|
|
3318
3361
|
|
package/esm/domain/CallLog.js
CHANGED
|
@@ -53,7 +53,7 @@ class Recording {
|
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
static parseMany(recordings
|
|
56
|
+
static parseMany(recordings = []) {
|
|
57
57
|
return recordings.map(item => Recording.parse(item));
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -179,7 +179,7 @@ class CallLog {
|
|
|
179
179
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
180
180
|
start: moment(plain.start).toDate(),
|
|
181
181
|
end: plain.end ? moment(plain.end).toDate() : null,
|
|
182
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
182
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
185
|
|
package/esm/domain/Features.js
CHANGED
|
@@ -130,6 +130,7 @@ class IssueReporter {
|
|
|
130
130
|
|
|
131
131
|
|
|
132
132
|
|
|
133
|
+
|
|
133
134
|
|
|
134
135
|
constructor() {
|
|
135
136
|
addLevelsTo(this);
|
|
@@ -141,12 +142,17 @@ class IssueReporter {
|
|
|
141
142
|
this.bufferTimeout = null;
|
|
142
143
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
143
144
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
145
|
+
this._callback = null;
|
|
144
146
|
}
|
|
145
147
|
|
|
146
148
|
init() {
|
|
147
149
|
this._catchConsole();
|
|
148
150
|
}
|
|
149
151
|
|
|
152
|
+
setCallback(cb ) {
|
|
153
|
+
this._callback = cb;
|
|
154
|
+
}
|
|
155
|
+
|
|
150
156
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
151
157
|
this.remoteClientConfiguration = configuration;
|
|
152
158
|
}
|
|
@@ -182,6 +188,7 @@ class IssueReporter {
|
|
|
182
188
|
|
|
183
189
|
// Handle category label
|
|
184
190
|
let category = null;
|
|
191
|
+
let skipSendToRemote = false;
|
|
185
192
|
let extra = {};
|
|
186
193
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
187
194
|
category = args[0].split('=')[1];
|
|
@@ -197,6 +204,7 @@ class IssueReporter {
|
|
|
197
204
|
errorMessage: lastArg.message,
|
|
198
205
|
errorStack: lastArg.stack,
|
|
199
206
|
errorType: lastArg.constructor.name,
|
|
207
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
200
208
|
};
|
|
201
209
|
} else {
|
|
202
210
|
extra = lastArg;
|
|
@@ -205,6 +213,11 @@ class IssueReporter {
|
|
|
205
213
|
args.splice(1, 1);
|
|
206
214
|
}
|
|
207
215
|
|
|
216
|
+
if (extra.skipSendToRemote) {
|
|
217
|
+
skipSendToRemote = true;
|
|
218
|
+
delete extra.skipSendToRemote;
|
|
219
|
+
}
|
|
220
|
+
|
|
208
221
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
209
222
|
const message = args.join(', ');
|
|
210
223
|
let consoleMessage = message;
|
|
@@ -225,7 +238,13 @@ class IssueReporter {
|
|
|
225
238
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
226
239
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
227
240
|
|
|
228
|
-
this.
|
|
241
|
+
if (this._callback) {
|
|
242
|
+
this._callback(level, consoleMessage);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (!skipSendToRemote) {
|
|
246
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
247
|
+
}
|
|
229
248
|
}
|
|
230
249
|
|
|
231
250
|
logRequest(url , options , response , start ) {
|
|
@@ -370,7 +389,11 @@ class IssueReporter {
|
|
|
370
389
|
},
|
|
371
390
|
// $FlowFixMe
|
|
372
391
|
body,
|
|
373
|
-
}).catch(() => {
|
|
392
|
+
}).catch((e ) => {
|
|
393
|
+
// $FlowFixMe
|
|
394
|
+
e.skipSendToRemote = true;
|
|
395
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
396
|
+
|
|
374
397
|
setTimeout(() => {
|
|
375
398
|
if (isArray) {
|
|
376
399
|
payload = payload.map(message => {
|
|
@@ -382,7 +405,7 @@ class IssueReporter {
|
|
|
382
405
|
payload._retry = retry + 1;
|
|
383
406
|
}
|
|
384
407
|
|
|
385
|
-
this._sendDebugToGrafana(
|
|
408
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
386
409
|
}, 5000 + retry * 1000);
|
|
387
410
|
});
|
|
388
411
|
}
|
|
@@ -2585,7 +2608,8 @@ class ExternalApp {
|
|
|
2585
2608
|
|
|
2586
2609
|
|
|
2587
2610
|
|
|
2588
|
-
|
|
2611
|
+
|
|
2612
|
+
|
|
2589
2613
|
|
|
2590
2614
|
|
|
2591
2615
|
class Meeting {
|
|
@@ -2597,6 +2621,7 @@ class Meeting {
|
|
|
2597
2621
|
|
|
2598
2622
|
|
|
2599
2623
|
|
|
2624
|
+
|
|
2600
2625
|
|
|
2601
2626
|
|
|
2602
2627
|
static parse(plain ) {
|
|
@@ -2608,14 +2633,28 @@ class Meeting {
|
|
|
2608
2633
|
port: plain.port,
|
|
2609
2634
|
uuid: plain.uuid,
|
|
2610
2635
|
number: plain.number,
|
|
2636
|
+
persistent: plain.persistent,
|
|
2611
2637
|
});
|
|
2612
2638
|
}
|
|
2613
2639
|
|
|
2640
|
+
static parseMany(items ) {
|
|
2641
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2642
|
+
}
|
|
2643
|
+
|
|
2614
2644
|
static newFrom(meeting ) {
|
|
2615
2645
|
return newFrom(meeting, Meeting);
|
|
2616
2646
|
}
|
|
2617
2647
|
|
|
2618
|
-
constructor({
|
|
2648
|
+
constructor({
|
|
2649
|
+
uuid,
|
|
2650
|
+
name,
|
|
2651
|
+
guestSipAuthorization,
|
|
2652
|
+
ownerUuids,
|
|
2653
|
+
port,
|
|
2654
|
+
uri,
|
|
2655
|
+
number,
|
|
2656
|
+
persistent,
|
|
2657
|
+
} = {}) {
|
|
2619
2658
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2620
2659
|
this.uri = uri;
|
|
2621
2660
|
this.name = name;
|
|
@@ -2623,6 +2662,7 @@ class Meeting {
|
|
|
2623
2662
|
this.port = port;
|
|
2624
2663
|
this.uuid = uuid;
|
|
2625
2664
|
this.number = number;
|
|
2665
|
+
this.persistent = persistent;
|
|
2626
2666
|
|
|
2627
2667
|
// Useful to compare instead of instanceof with minified code
|
|
2628
2668
|
this.type = 'Meeting';
|
|
@@ -2700,8 +2740,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2700
2740
|
}
|
|
2701
2741
|
},
|
|
2702
2742
|
|
|
2703
|
-
|
|
2704
|
-
client.
|
|
2743
|
+
getMyMeetings: () =>
|
|
2744
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2745
|
+
|
|
2746
|
+
createMyMeeting: (name , persistent ) =>
|
|
2747
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2705
2748
|
|
|
2706
2749
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2707
2750
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -3186,7 +3229,7 @@ class Recording {
|
|
|
3186
3229
|
|
|
3187
3230
|
|
|
3188
3231
|
|
|
3189
|
-
static parseMany(recordings
|
|
3232
|
+
static parseMany(recordings = []) {
|
|
3190
3233
|
return recordings.map(item => Recording.parse(item));
|
|
3191
3234
|
}
|
|
3192
3235
|
|
|
@@ -3312,7 +3355,7 @@ class CallLog {
|
|
|
3312
3355
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3313
3356
|
start: moment(plain.start).toDate(),
|
|
3314
3357
|
end: plain.end ? moment(plain.end).toDate() : null,
|
|
3315
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
3358
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
3316
3359
|
});
|
|
3317
3360
|
}
|
|
3318
3361
|
|