@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
|
@@ -121,6 +121,7 @@ class IssueReporter {
|
|
|
121
121
|
|
|
122
122
|
|
|
123
123
|
|
|
124
|
+
|
|
124
125
|
|
|
125
126
|
constructor() {
|
|
126
127
|
addLevelsTo(this);
|
|
@@ -132,12 +133,17 @@ class IssueReporter {
|
|
|
132
133
|
this.bufferTimeout = null;
|
|
133
134
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
134
135
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
136
|
+
this._callback = null;
|
|
135
137
|
}
|
|
136
138
|
|
|
137
139
|
init() {
|
|
138
140
|
this._catchConsole();
|
|
139
141
|
}
|
|
140
142
|
|
|
143
|
+
setCallback(cb ) {
|
|
144
|
+
this._callback = cb;
|
|
145
|
+
}
|
|
146
|
+
|
|
141
147
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
142
148
|
this.remoteClientConfiguration = configuration;
|
|
143
149
|
}
|
|
@@ -173,6 +179,7 @@ class IssueReporter {
|
|
|
173
179
|
|
|
174
180
|
// Handle category label
|
|
175
181
|
let category = null;
|
|
182
|
+
let skipSendToRemote = false;
|
|
176
183
|
let extra = {};
|
|
177
184
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
178
185
|
category = args[0].split('=')[1];
|
|
@@ -188,6 +195,7 @@ class IssueReporter {
|
|
|
188
195
|
errorMessage: lastArg.message,
|
|
189
196
|
errorStack: lastArg.stack,
|
|
190
197
|
errorType: lastArg.constructor.name,
|
|
198
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
191
199
|
};
|
|
192
200
|
} else {
|
|
193
201
|
extra = lastArg;
|
|
@@ -196,6 +204,11 @@ class IssueReporter {
|
|
|
196
204
|
args.splice(1, 1);
|
|
197
205
|
}
|
|
198
206
|
|
|
207
|
+
if (extra.skipSendToRemote) {
|
|
208
|
+
skipSendToRemote = true;
|
|
209
|
+
delete extra.skipSendToRemote;
|
|
210
|
+
}
|
|
211
|
+
|
|
199
212
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
200
213
|
const message = args.join(', ');
|
|
201
214
|
let consoleMessage = message;
|
|
@@ -216,7 +229,13 @@ class IssueReporter {
|
|
|
216
229
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
217
230
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
218
231
|
|
|
219
|
-
this.
|
|
232
|
+
if (this._callback) {
|
|
233
|
+
this._callback(level, consoleMessage);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (!skipSendToRemote) {
|
|
237
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
238
|
+
}
|
|
220
239
|
}
|
|
221
240
|
|
|
222
241
|
logRequest(url , options , response , start ) {
|
|
@@ -361,7 +380,11 @@ class IssueReporter {
|
|
|
361
380
|
},
|
|
362
381
|
// $FlowFixMe
|
|
363
382
|
body,
|
|
364
|
-
}).catch(() => {
|
|
383
|
+
}).catch((e ) => {
|
|
384
|
+
// $FlowFixMe
|
|
385
|
+
e.skipSendToRemote = true;
|
|
386
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
387
|
+
|
|
365
388
|
setTimeout(() => {
|
|
366
389
|
if (isArray) {
|
|
367
390
|
payload = payload.map(message => {
|
|
@@ -578,6 +601,7 @@ const AGENT_PAUSED = 'agent_paused';
|
|
|
578
601
|
const AGENT_UNPAUSED = 'agent_unpaused';
|
|
579
602
|
const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
|
|
580
603
|
const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
|
|
604
|
+
const MEETING_USER_PROGRESS = 'meeting_user_progress';
|
|
581
605
|
|
|
582
606
|
const BLACKLIST_EVENTS = [
|
|
583
607
|
CHAT_MESSAGE_SENT,
|
|
@@ -928,6 +952,7 @@ WebSocketClient.eventLists = [
|
|
|
928
952
|
AGENT_UNPAUSED,
|
|
929
953
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
930
954
|
CONFERENCE_ADHOC_DELETED,
|
|
955
|
+
MEETING_USER_PROGRESS,
|
|
931
956
|
];
|
|
932
957
|
|
|
933
958
|
var wazoWebsocket = {
|
|
@@ -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 => {
|
|
@@ -3195,11 +3218,24 @@ class Meeting {
|
|
|
3195
3218
|
});
|
|
3196
3219
|
}
|
|
3197
3220
|
|
|
3221
|
+
static parseMany(items ) {
|
|
3222
|
+
return items.map(plain => Meeting.parse(plain));
|
|
3223
|
+
}
|
|
3224
|
+
|
|
3198
3225
|
static newFrom(meeting ) {
|
|
3199
3226
|
return newFrom(meeting, Meeting);
|
|
3200
3227
|
}
|
|
3201
3228
|
|
|
3202
|
-
constructor({
|
|
3229
|
+
constructor({
|
|
3230
|
+
uuid,
|
|
3231
|
+
name,
|
|
3232
|
+
guestSipAuthorization,
|
|
3233
|
+
ownerUuids,
|
|
3234
|
+
port,
|
|
3235
|
+
uri,
|
|
3236
|
+
number,
|
|
3237
|
+
persistent,
|
|
3238
|
+
} = {}) {
|
|
3203
3239
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
3204
3240
|
this.uri = uri;
|
|
3205
3241
|
this.name = name;
|
|
@@ -3285,8 +3321,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
3285
3321
|
}
|
|
3286
3322
|
},
|
|
3287
3323
|
|
|
3288
|
-
|
|
3289
|
-
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),
|
|
3290
3329
|
|
|
3291
3330
|
deleteMyMeeting: (meetingUuid ) =>
|
|
3292
3331
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -5698,7 +5737,9 @@ class WebRTCClient extends Emitter {
|
|
|
5698
5737
|
const inviteOptions = {
|
|
5699
5738
|
requestDelegate: {
|
|
5700
5739
|
onAccept: (response ) => {
|
|
5701
|
-
session.sessionDescriptionHandler.peerConnection
|
|
5740
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
5741
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
5742
|
+
}
|
|
5702
5743
|
this._onAccepted(session, response.session, true);
|
|
5703
5744
|
},
|
|
5704
5745
|
onReject: (response ) => {
|
|
@@ -6570,6 +6611,16 @@ class WebRTCClient extends Emitter {
|
|
|
6570
6611
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
6571
6612
|
}
|
|
6572
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
|
+
|
|
6573
6624
|
hasVideo(sessionId ) {
|
|
6574
6625
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
6575
6626
|
}
|
|
@@ -7348,18 +7399,22 @@ class WebRTCClient extends Emitter {
|
|
|
7348
7399
|
});
|
|
7349
7400
|
|
|
7350
7401
|
networkStats.packetsLost = packetsLost;
|
|
7351
|
-
networkStats.
|
|
7402
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
7403
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
7404
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
7352
7405
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
7353
|
-
networkStats.
|
|
7354
|
-
networkStats.
|
|
7406
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
7407
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
7408
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
7409
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
7410
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
7355
7411
|
networkStats.transportSent = transportSent;
|
|
7356
|
-
networkStats.
|
|
7357
|
-
|
|
7358
|
-
const bandwidth = (networkStats.audioBytesSent - lastAudioSent) + (networkStats.videoBytesSent - lastVideoSent)
|
|
7359
|
-
+ (networkStats.audioBytesReceived - lastAudioReceived) + (networkStats.videoBytesReceived - lastVideoReceived)
|
|
7360
|
-
+ (networkStats.transportReceived - lastTransportReceived) + (networkStats.transportSent - lastTransportSent);
|
|
7412
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
7413
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
7361
7414
|
|
|
7362
|
-
networkStats.bandwidth =
|
|
7415
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
7416
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
7417
|
+
+ networkStats.transportSent;
|
|
7363
7418
|
|
|
7364
7419
|
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
7365
7420
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
@@ -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 => {
|
|
@@ -3195,11 +3218,24 @@ class Meeting {
|
|
|
3195
3218
|
});
|
|
3196
3219
|
}
|
|
3197
3220
|
|
|
3221
|
+
static parseMany(items ) {
|
|
3222
|
+
return items.map(plain => Meeting.parse(plain));
|
|
3223
|
+
}
|
|
3224
|
+
|
|
3198
3225
|
static newFrom(meeting ) {
|
|
3199
3226
|
return newFrom(meeting, Meeting);
|
|
3200
3227
|
}
|
|
3201
3228
|
|
|
3202
|
-
constructor({
|
|
3229
|
+
constructor({
|
|
3230
|
+
uuid,
|
|
3231
|
+
name,
|
|
3232
|
+
guestSipAuthorization,
|
|
3233
|
+
ownerUuids,
|
|
3234
|
+
port,
|
|
3235
|
+
uri,
|
|
3236
|
+
number,
|
|
3237
|
+
persistent,
|
|
3238
|
+
} = {}) {
|
|
3203
3239
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
3204
3240
|
this.uri = uri;
|
|
3205
3241
|
this.name = name;
|
|
@@ -3285,8 +3321,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
3285
3321
|
}
|
|
3286
3322
|
},
|
|
3287
3323
|
|
|
3288
|
-
|
|
3289
|
-
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),
|
|
3290
3329
|
|
|
3291
3330
|
deleteMyMeeting: (meetingUuid ) =>
|
|
3292
3331
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -5698,7 +5737,9 @@ class WebRTCClient extends Emitter {
|
|
|
5698
5737
|
const inviteOptions = {
|
|
5699
5738
|
requestDelegate: {
|
|
5700
5739
|
onAccept: (response ) => {
|
|
5701
|
-
session.sessionDescriptionHandler.peerConnection
|
|
5740
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
5741
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
5742
|
+
}
|
|
5702
5743
|
this._onAccepted(session, response.session, true);
|
|
5703
5744
|
},
|
|
5704
5745
|
onReject: (response ) => {
|
|
@@ -6570,6 +6611,16 @@ class WebRTCClient extends Emitter {
|
|
|
6570
6611
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
6571
6612
|
}
|
|
6572
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
|
+
|
|
6573
6624
|
hasVideo(sessionId ) {
|
|
6574
6625
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
6575
6626
|
}
|
|
@@ -7348,18 +7399,22 @@ class WebRTCClient extends Emitter {
|
|
|
7348
7399
|
});
|
|
7349
7400
|
|
|
7350
7401
|
networkStats.packetsLost = packetsLost;
|
|
7351
|
-
networkStats.
|
|
7402
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
7403
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
7404
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
7352
7405
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
7353
|
-
networkStats.
|
|
7354
|
-
networkStats.
|
|
7406
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
7407
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
7408
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
7409
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
7410
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
7355
7411
|
networkStats.transportSent = transportSent;
|
|
7356
|
-
networkStats.
|
|
7357
|
-
|
|
7358
|
-
const bandwidth = (networkStats.audioBytesSent - lastAudioSent) + (networkStats.videoBytesSent - lastVideoSent)
|
|
7359
|
-
+ (networkStats.audioBytesReceived - lastAudioReceived) + (networkStats.videoBytesReceived - lastVideoReceived)
|
|
7360
|
-
+ (networkStats.transportReceived - lastTransportReceived) + (networkStats.transportSent - lastTransportSent);
|
|
7412
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
7413
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
7361
7414
|
|
|
7362
|
-
networkStats.bandwidth =
|
|
7415
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
7416
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
7417
|
+
+ networkStats.transportSent;
|
|
7363
7418
|
|
|
7364
7419
|
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
7365
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 => {
|
|
@@ -2820,11 +2843,24 @@ class Meeting {
|
|
|
2820
2843
|
});
|
|
2821
2844
|
}
|
|
2822
2845
|
|
|
2846
|
+
static parseMany(items ) {
|
|
2847
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2823
2850
|
static newFrom(meeting ) {
|
|
2824
2851
|
return newFrom(meeting, Meeting);
|
|
2825
2852
|
}
|
|
2826
2853
|
|
|
2827
|
-
constructor({
|
|
2854
|
+
constructor({
|
|
2855
|
+
uuid,
|
|
2856
|
+
name,
|
|
2857
|
+
guestSipAuthorization,
|
|
2858
|
+
ownerUuids,
|
|
2859
|
+
port,
|
|
2860
|
+
uri,
|
|
2861
|
+
number,
|
|
2862
|
+
persistent,
|
|
2863
|
+
} = {}) {
|
|
2828
2864
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2829
2865
|
this.uri = uri;
|
|
2830
2866
|
this.name = name;
|
|
@@ -2910,8 +2946,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2910
2946
|
}
|
|
2911
2947
|
},
|
|
2912
2948
|
|
|
2913
|
-
|
|
2914
|
-
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),
|
|
2915
2954
|
|
|
2916
2955
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2917
2956
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
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 => {
|
|
@@ -2614,11 +2637,24 @@ class Meeting {
|
|
|
2614
2637
|
});
|
|
2615
2638
|
}
|
|
2616
2639
|
|
|
2640
|
+
static parseMany(items ) {
|
|
2641
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2642
|
+
}
|
|
2643
|
+
|
|
2617
2644
|
static newFrom(meeting ) {
|
|
2618
2645
|
return newFrom(meeting, Meeting);
|
|
2619
2646
|
}
|
|
2620
2647
|
|
|
2621
|
-
constructor({
|
|
2648
|
+
constructor({
|
|
2649
|
+
uuid,
|
|
2650
|
+
name,
|
|
2651
|
+
guestSipAuthorization,
|
|
2652
|
+
ownerUuids,
|
|
2653
|
+
port,
|
|
2654
|
+
uri,
|
|
2655
|
+
number,
|
|
2656
|
+
persistent,
|
|
2657
|
+
} = {}) {
|
|
2622
2658
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2623
2659
|
this.uri = uri;
|
|
2624
2660
|
this.name = name;
|
|
@@ -2704,8 +2740,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2704
2740
|
}
|
|
2705
2741
|
},
|
|
2706
2742
|
|
|
2707
|
-
|
|
2708
|
-
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),
|
|
2709
2748
|
|
|
2710
2749
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2711
2750
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|