@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
|
@@ -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
|
|
|
@@ -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
|
|
|
@@ -148,6 +148,7 @@ class IssueReporter {
|
|
|
148
148
|
|
|
149
149
|
|
|
150
150
|
|
|
151
|
+
|
|
151
152
|
|
|
152
153
|
constructor() {
|
|
153
154
|
addLevelsTo(this);
|
|
@@ -159,12 +160,17 @@ class IssueReporter {
|
|
|
159
160
|
this.bufferTimeout = null;
|
|
160
161
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
161
162
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
163
|
+
this._callback = null;
|
|
162
164
|
}
|
|
163
165
|
|
|
164
166
|
init() {
|
|
165
167
|
this._catchConsole();
|
|
166
168
|
}
|
|
167
169
|
|
|
170
|
+
setCallback(cb ) {
|
|
171
|
+
this._callback = cb;
|
|
172
|
+
}
|
|
173
|
+
|
|
168
174
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
169
175
|
this.remoteClientConfiguration = configuration;
|
|
170
176
|
}
|
|
@@ -200,6 +206,7 @@ class IssueReporter {
|
|
|
200
206
|
|
|
201
207
|
// Handle category label
|
|
202
208
|
let category = null;
|
|
209
|
+
let skipSendToRemote = false;
|
|
203
210
|
let extra = {};
|
|
204
211
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
205
212
|
category = args[0].split('=')[1];
|
|
@@ -215,6 +222,7 @@ class IssueReporter {
|
|
|
215
222
|
errorMessage: lastArg.message,
|
|
216
223
|
errorStack: lastArg.stack,
|
|
217
224
|
errorType: lastArg.constructor.name,
|
|
225
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
218
226
|
};
|
|
219
227
|
} else {
|
|
220
228
|
extra = lastArg;
|
|
@@ -223,6 +231,11 @@ class IssueReporter {
|
|
|
223
231
|
args.splice(1, 1);
|
|
224
232
|
}
|
|
225
233
|
|
|
234
|
+
if (extra.skipSendToRemote) {
|
|
235
|
+
skipSendToRemote = true;
|
|
236
|
+
delete extra.skipSendToRemote;
|
|
237
|
+
}
|
|
238
|
+
|
|
226
239
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
227
240
|
const message = args.join(', ');
|
|
228
241
|
let consoleMessage = message;
|
|
@@ -243,7 +256,13 @@ class IssueReporter {
|
|
|
243
256
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
244
257
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
245
258
|
|
|
246
|
-
this.
|
|
259
|
+
if (this._callback) {
|
|
260
|
+
this._callback(level, consoleMessage);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if (!skipSendToRemote) {
|
|
264
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
265
|
+
}
|
|
247
266
|
}
|
|
248
267
|
|
|
249
268
|
logRequest(url , options , response , start ) {
|
|
@@ -388,7 +407,11 @@ class IssueReporter {
|
|
|
388
407
|
},
|
|
389
408
|
// $FlowFixMe
|
|
390
409
|
body,
|
|
391
|
-
}).catch(() => {
|
|
410
|
+
}).catch((e ) => {
|
|
411
|
+
// $FlowFixMe
|
|
412
|
+
e.skipSendToRemote = true;
|
|
413
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
414
|
+
|
|
392
415
|
setTimeout(() => {
|
|
393
416
|
if (isArray) {
|
|
394
417
|
payload = payload.map(message => {
|
|
@@ -400,7 +423,7 @@ class IssueReporter {
|
|
|
400
423
|
payload._retry = retry + 1;
|
|
401
424
|
}
|
|
402
425
|
|
|
403
|
-
this._sendDebugToGrafana(
|
|
426
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
404
427
|
}, 5000 + retry * 1000);
|
|
405
428
|
});
|
|
406
429
|
}
|
|
@@ -2603,7 +2626,8 @@ class ExternalApp {
|
|
|
2603
2626
|
|
|
2604
2627
|
|
|
2605
2628
|
|
|
2606
|
-
|
|
2629
|
+
|
|
2630
|
+
|
|
2607
2631
|
|
|
2608
2632
|
|
|
2609
2633
|
class Meeting {
|
|
@@ -2615,6 +2639,7 @@ class Meeting {
|
|
|
2615
2639
|
|
|
2616
2640
|
|
|
2617
2641
|
|
|
2642
|
+
|
|
2618
2643
|
|
|
2619
2644
|
|
|
2620
2645
|
static parse(plain ) {
|
|
@@ -2626,14 +2651,28 @@ class Meeting {
|
|
|
2626
2651
|
port: plain.port,
|
|
2627
2652
|
uuid: plain.uuid,
|
|
2628
2653
|
number: plain.number,
|
|
2654
|
+
persistent: plain.persistent,
|
|
2629
2655
|
});
|
|
2630
2656
|
}
|
|
2631
2657
|
|
|
2658
|
+
static parseMany(items ) {
|
|
2659
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2660
|
+
}
|
|
2661
|
+
|
|
2632
2662
|
static newFrom(meeting ) {
|
|
2633
2663
|
return newFrom(meeting, Meeting);
|
|
2634
2664
|
}
|
|
2635
2665
|
|
|
2636
|
-
constructor({
|
|
2666
|
+
constructor({
|
|
2667
|
+
uuid,
|
|
2668
|
+
name,
|
|
2669
|
+
guestSipAuthorization,
|
|
2670
|
+
ownerUuids,
|
|
2671
|
+
port,
|
|
2672
|
+
uri,
|
|
2673
|
+
number,
|
|
2674
|
+
persistent,
|
|
2675
|
+
} = {}) {
|
|
2637
2676
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2638
2677
|
this.uri = uri;
|
|
2639
2678
|
this.name = name;
|
|
@@ -2641,6 +2680,7 @@ class Meeting {
|
|
|
2641
2680
|
this.port = port;
|
|
2642
2681
|
this.uuid = uuid;
|
|
2643
2682
|
this.number = number;
|
|
2683
|
+
this.persistent = persistent;
|
|
2644
2684
|
|
|
2645
2685
|
// Useful to compare instead of instanceof with minified code
|
|
2646
2686
|
this.type = 'Meeting';
|
|
@@ -2718,8 +2758,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2718
2758
|
}
|
|
2719
2759
|
},
|
|
2720
2760
|
|
|
2721
|
-
|
|
2722
|
-
client.
|
|
2761
|
+
getMyMeetings: () =>
|
|
2762
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2763
|
+
|
|
2764
|
+
createMyMeeting: (name , persistent ) =>
|
|
2765
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2723
2766
|
|
|
2724
2767
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2725
2768
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -3230,7 +3273,7 @@ class Recording {
|
|
|
3230
3273
|
|
|
3231
3274
|
|
|
3232
3275
|
|
|
3233
|
-
static parseMany(recordings
|
|
3276
|
+
static parseMany(recordings = []) {
|
|
3234
3277
|
return recordings.map(item => Recording.parse(item));
|
|
3235
3278
|
}
|
|
3236
3279
|
|
|
@@ -3356,7 +3399,7 @@ class CallLog {
|
|
|
3356
3399
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3357
3400
|
start: moment(plain.start).toDate(),
|
|
3358
3401
|
end: plain.end ? moment(plain.end).toDate() : null,
|
|
3359
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
3402
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
3360
3403
|
});
|
|
3361
3404
|
}
|
|
3362
3405
|
|
|
@@ -4899,6 +4942,7 @@ const AGENT_PAUSED = 'agent_paused';
|
|
|
4899
4942
|
const AGENT_UNPAUSED = 'agent_unpaused';
|
|
4900
4943
|
const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
|
|
4901
4944
|
const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
|
|
4945
|
+
const MEETING_USER_PROGRESS = 'meeting_user_progress';
|
|
4902
4946
|
|
|
4903
4947
|
const BLACKLIST_EVENTS = [
|
|
4904
4948
|
CHAT_MESSAGE_SENT,
|
|
@@ -5249,6 +5293,7 @@ WebSocketClient.eventLists = [
|
|
|
5249
5293
|
AGENT_UNPAUSED,
|
|
5250
5294
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
5251
5295
|
CONFERENCE_ADHOC_DELETED,
|
|
5296
|
+
MEETING_USER_PROGRESS,
|
|
5252
5297
|
];
|
|
5253
5298
|
|
|
5254
5299
|
var wazoWebsocket = {
|
|
@@ -5871,6 +5916,7 @@ const ON_REINVITE = 'reinvite';
|
|
|
5871
5916
|
const ON_ERROR = 'onError';
|
|
5872
5917
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
5873
5918
|
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
5919
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
5874
5920
|
class CanceledCallError extends Error {}
|
|
5875
5921
|
|
|
5876
5922
|
const MAX_REGISTER_TRIES = 10;
|
|
@@ -5944,6 +5990,7 @@ class WebRTCClient extends Emitter {
|
|
|
5944
5990
|
|
|
5945
5991
|
|
|
5946
5992
|
|
|
5993
|
+
|
|
5947
5994
|
|
|
5948
5995
|
static isAPrivateIp(ip ) {
|
|
5949
5996
|
const regex = /^(?:10|127|172\.(?:1[6-9]|2[0-9]|3[01])|192\.168)\..*/;
|
|
@@ -6009,6 +6056,7 @@ class WebRTCClient extends Emitter {
|
|
|
6009
6056
|
this.ON_ERROR = ON_ERROR;
|
|
6010
6057
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6011
6058
|
this.ON_NETWORK_STATS = ON_NETWORK_STATS;
|
|
6059
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED;
|
|
6012
6060
|
}
|
|
6013
6061
|
|
|
6014
6062
|
configureMedia(media ) {
|
|
@@ -6274,7 +6322,9 @@ class WebRTCClient extends Emitter {
|
|
|
6274
6322
|
const inviteOptions = {
|
|
6275
6323
|
requestDelegate: {
|
|
6276
6324
|
onAccept: (response ) => {
|
|
6277
|
-
session.sessionDescriptionHandler.peerConnection
|
|
6325
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
6326
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
6327
|
+
}
|
|
6278
6328
|
this._onAccepted(session, response.session, true);
|
|
6279
6329
|
},
|
|
6280
6330
|
onReject: (response ) => {
|
|
@@ -6610,7 +6660,7 @@ class WebRTCClient extends Emitter {
|
|
|
6610
6660
|
// We search for the last transceiver without `video-` in the mid (video- means remote transceiver)
|
|
6611
6661
|
const transceivers = pc.getTransceivers();
|
|
6612
6662
|
const transceiverIdx = lastIndexOf(transceivers, transceiver =>
|
|
6613
|
-
transceiver.sender.track === null && transceiver.mid.indexOf('video') === -1);
|
|
6663
|
+
transceiver.sender.track === null && transceiver.mid && transceiver.mid.indexOf('video') === -1);
|
|
6614
6664
|
|
|
6615
6665
|
videoSender = transceiverIdx !== -1 ? transceivers[transceiverIdx].sender : null;
|
|
6616
6666
|
} else {
|
|
@@ -7146,6 +7196,16 @@ class WebRTCClient extends Emitter {
|
|
|
7146
7196
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
7147
7197
|
}
|
|
7148
7198
|
|
|
7199
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
7200
|
+
getRemoteVideoStreamFromPc(sessionId ) {
|
|
7201
|
+
const pc = this.getPeerConnection(sessionId);
|
|
7202
|
+
if (!pc) {
|
|
7203
|
+
return null;
|
|
7204
|
+
}
|
|
7205
|
+
|
|
7206
|
+
return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
|
|
7207
|
+
}
|
|
7208
|
+
|
|
7149
7209
|
hasVideo(sessionId ) {
|
|
7150
7210
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
7151
7211
|
}
|
|
@@ -7635,6 +7695,7 @@ class WebRTCClient extends Emitter {
|
|
|
7635
7695
|
|
|
7636
7696
|
this.updateRemoteStream(this.getSipSessionId(session));
|
|
7637
7697
|
|
|
7698
|
+
const pc = session.sessionDescriptionHandler.peerConnection;
|
|
7638
7699
|
const onTrack = (event ) => {
|
|
7639
7700
|
const isAudioOnly = this._isAudioOnly(session);
|
|
7640
7701
|
const { kind, label, readyState, id, muted } = event.track;
|
|
@@ -7654,6 +7715,12 @@ class WebRTCClient extends Emitter {
|
|
|
7654
7715
|
|
|
7655
7716
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
7656
7717
|
|
|
7718
|
+
pc.oniceconnectionstatechange = () => {
|
|
7719
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
7720
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
7721
|
+
}
|
|
7722
|
+
};
|
|
7723
|
+
|
|
7657
7724
|
if (withEvent) {
|
|
7658
7725
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
7659
7726
|
}
|
|
@@ -7873,6 +7940,7 @@ class WebRTCClient extends Emitter {
|
|
|
7873
7940
|
let videoBytesReceived = 0;
|
|
7874
7941
|
let transportSent = 0;
|
|
7875
7942
|
let transportReceived = 0;
|
|
7943
|
+
let packetsLost = 0;
|
|
7876
7944
|
|
|
7877
7945
|
stats.forEach(report => {
|
|
7878
7946
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
@@ -7885,7 +7953,7 @@ class WebRTCClient extends Emitter {
|
|
|
7885
7953
|
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
7886
7954
|
}
|
|
7887
7955
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
7888
|
-
|
|
7956
|
+
packetsLost += report.packetsLost;
|
|
7889
7957
|
networkStats.packetsReceived = report.packetsReceived;
|
|
7890
7958
|
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
7891
7959
|
}
|
|
@@ -7902,27 +7970,36 @@ class WebRTCClient extends Emitter {
|
|
|
7902
7970
|
}
|
|
7903
7971
|
}
|
|
7904
7972
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
7973
|
+
packetsLost += report.packetsLost;
|
|
7905
7974
|
networkStats.roundTripTime = report.roundTripTime;
|
|
7906
7975
|
networkStats.jitter = report.jitter;
|
|
7907
7976
|
}
|
|
7977
|
+
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
7978
|
+
packetsLost += report.packetsLost;
|
|
7979
|
+
}
|
|
7908
7980
|
if (report.type === 'transport') {
|
|
7909
7981
|
transportSent += report.bytesSent;
|
|
7910
7982
|
transportReceived += report.bytesReceived;
|
|
7911
7983
|
}
|
|
7912
7984
|
});
|
|
7913
7985
|
|
|
7914
|
-
networkStats.
|
|
7986
|
+
networkStats.packetsLost = packetsLost;
|
|
7987
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
7988
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
7989
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
7915
7990
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
7916
|
-
networkStats.
|
|
7917
|
-
networkStats.
|
|
7991
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
7992
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
7993
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
7994
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
7995
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
7918
7996
|
networkStats.transportSent = transportSent;
|
|
7919
|
-
networkStats.
|
|
7920
|
-
|
|
7921
|
-
const bandwidth = (networkStats.audioBytesSent - lastAudioSent) + (networkStats.videoBytesSent - lastVideoSent)
|
|
7922
|
-
+ (networkStats.audioBytesReceived - lastAudioReceived) + (networkStats.videoBytesReceived - lastVideoReceived)
|
|
7923
|
-
+ (networkStats.transportReceived - lastTransportReceived) + (networkStats.transportSent - lastTransportSent);
|
|
7997
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
7998
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
7924
7999
|
|
|
7925
|
-
networkStats.bandwidth =
|
|
8000
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
8001
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8002
|
+
+ networkStats.transportSent;
|
|
7926
8003
|
|
|
7927
8004
|
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
7928
8005
|
this.sessionNetworkStats[sessionId].push(networkStats);
|