@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
package/lib/api-client.js
CHANGED
|
@@ -136,6 +136,7 @@ class IssueReporter {
|
|
|
136
136
|
|
|
137
137
|
|
|
138
138
|
|
|
139
|
+
|
|
139
140
|
|
|
140
141
|
constructor() {
|
|
141
142
|
addLevelsTo(this);
|
|
@@ -147,12 +148,17 @@ class IssueReporter {
|
|
|
147
148
|
this.bufferTimeout = null;
|
|
148
149
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
149
150
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
151
|
+
this._callback = null;
|
|
150
152
|
}
|
|
151
153
|
|
|
152
154
|
init() {
|
|
153
155
|
this._catchConsole();
|
|
154
156
|
}
|
|
155
157
|
|
|
158
|
+
setCallback(cb ) {
|
|
159
|
+
this._callback = cb;
|
|
160
|
+
}
|
|
161
|
+
|
|
156
162
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
157
163
|
this.remoteClientConfiguration = configuration;
|
|
158
164
|
}
|
|
@@ -188,6 +194,7 @@ class IssueReporter {
|
|
|
188
194
|
|
|
189
195
|
// Handle category label
|
|
190
196
|
let category = null;
|
|
197
|
+
let skipSendToRemote = false;
|
|
191
198
|
let extra = {};
|
|
192
199
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
193
200
|
category = args[0].split('=')[1];
|
|
@@ -203,6 +210,7 @@ class IssueReporter {
|
|
|
203
210
|
errorMessage: lastArg.message,
|
|
204
211
|
errorStack: lastArg.stack,
|
|
205
212
|
errorType: lastArg.constructor.name,
|
|
213
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
206
214
|
};
|
|
207
215
|
} else {
|
|
208
216
|
extra = lastArg;
|
|
@@ -211,6 +219,11 @@ class IssueReporter {
|
|
|
211
219
|
args.splice(1, 1);
|
|
212
220
|
}
|
|
213
221
|
|
|
222
|
+
if (extra.skipSendToRemote) {
|
|
223
|
+
skipSendToRemote = true;
|
|
224
|
+
delete extra.skipSendToRemote;
|
|
225
|
+
}
|
|
226
|
+
|
|
214
227
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
215
228
|
const message = args.join(', ');
|
|
216
229
|
let consoleMessage = message;
|
|
@@ -231,7 +244,13 @@ class IssueReporter {
|
|
|
231
244
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
232
245
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
233
246
|
|
|
234
|
-
this.
|
|
247
|
+
if (this._callback) {
|
|
248
|
+
this._callback(level, consoleMessage);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (!skipSendToRemote) {
|
|
252
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
253
|
+
}
|
|
235
254
|
}
|
|
236
255
|
|
|
237
256
|
logRequest(url , options , response , start ) {
|
|
@@ -376,7 +395,11 @@ class IssueReporter {
|
|
|
376
395
|
},
|
|
377
396
|
// $FlowFixMe
|
|
378
397
|
body,
|
|
379
|
-
}).catch(() => {
|
|
398
|
+
}).catch((e ) => {
|
|
399
|
+
// $FlowFixMe
|
|
400
|
+
e.skipSendToRemote = true;
|
|
401
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
402
|
+
|
|
380
403
|
setTimeout(() => {
|
|
381
404
|
if (isArray) {
|
|
382
405
|
payload = payload.map(message => {
|
|
@@ -388,7 +411,7 @@ class IssueReporter {
|
|
|
388
411
|
payload._retry = retry + 1;
|
|
389
412
|
}
|
|
390
413
|
|
|
391
|
-
this._sendDebugToGrafana(
|
|
414
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
392
415
|
}, 5000 + retry * 1000);
|
|
393
416
|
});
|
|
394
417
|
}
|
|
@@ -2591,7 +2614,8 @@ class ExternalApp {
|
|
|
2591
2614
|
|
|
2592
2615
|
|
|
2593
2616
|
|
|
2594
|
-
|
|
2617
|
+
|
|
2618
|
+
|
|
2595
2619
|
|
|
2596
2620
|
|
|
2597
2621
|
class Meeting {
|
|
@@ -2603,6 +2627,7 @@ class Meeting {
|
|
|
2603
2627
|
|
|
2604
2628
|
|
|
2605
2629
|
|
|
2630
|
+
|
|
2606
2631
|
|
|
2607
2632
|
|
|
2608
2633
|
static parse(plain ) {
|
|
@@ -2614,14 +2639,28 @@ class Meeting {
|
|
|
2614
2639
|
port: plain.port,
|
|
2615
2640
|
uuid: plain.uuid,
|
|
2616
2641
|
number: plain.number,
|
|
2642
|
+
persistent: plain.persistent,
|
|
2617
2643
|
});
|
|
2618
2644
|
}
|
|
2619
2645
|
|
|
2646
|
+
static parseMany(items ) {
|
|
2647
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2620
2650
|
static newFrom(meeting ) {
|
|
2621
2651
|
return newFrom(meeting, Meeting);
|
|
2622
2652
|
}
|
|
2623
2653
|
|
|
2624
|
-
constructor({
|
|
2654
|
+
constructor({
|
|
2655
|
+
uuid,
|
|
2656
|
+
name,
|
|
2657
|
+
guestSipAuthorization,
|
|
2658
|
+
ownerUuids,
|
|
2659
|
+
port,
|
|
2660
|
+
uri,
|
|
2661
|
+
number,
|
|
2662
|
+
persistent,
|
|
2663
|
+
} = {}) {
|
|
2625
2664
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2626
2665
|
this.uri = uri;
|
|
2627
2666
|
this.name = name;
|
|
@@ -2629,6 +2668,7 @@ class Meeting {
|
|
|
2629
2668
|
this.port = port;
|
|
2630
2669
|
this.uuid = uuid;
|
|
2631
2670
|
this.number = number;
|
|
2671
|
+
this.persistent = persistent;
|
|
2632
2672
|
|
|
2633
2673
|
// Useful to compare instead of instanceof with minified code
|
|
2634
2674
|
this.type = 'Meeting';
|
|
@@ -2706,8 +2746,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2706
2746
|
}
|
|
2707
2747
|
},
|
|
2708
2748
|
|
|
2709
|
-
|
|
2710
|
-
client.
|
|
2749
|
+
getMyMeetings: () =>
|
|
2750
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2751
|
+
|
|
2752
|
+
createMyMeeting: (name , persistent ) =>
|
|
2753
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2711
2754
|
|
|
2712
2755
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2713
2756
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -3192,7 +3235,7 @@ class Recording {
|
|
|
3192
3235
|
|
|
3193
3236
|
|
|
3194
3237
|
|
|
3195
|
-
static parseMany(recordings
|
|
3238
|
+
static parseMany(recordings = []) {
|
|
3196
3239
|
return recordings.map(item => Recording.parse(item));
|
|
3197
3240
|
}
|
|
3198
3241
|
|
|
@@ -3318,7 +3361,7 @@ class CallLog {
|
|
|
3318
3361
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3319
3362
|
start: moment__default['default'](plain.start).toDate(),
|
|
3320
3363
|
end: plain.end ? moment__default['default'](plain.end).toDate() : null,
|
|
3321
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
3364
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
3322
3365
|
});
|
|
3323
3366
|
}
|
|
3324
3367
|
|
package/lib/checker/Checker.js
CHANGED
|
@@ -158,6 +158,7 @@ class IssueReporter {
|
|
|
158
158
|
|
|
159
159
|
|
|
160
160
|
|
|
161
|
+
|
|
161
162
|
|
|
162
163
|
constructor() {
|
|
163
164
|
addLevelsTo(this);
|
|
@@ -169,12 +170,17 @@ class IssueReporter {
|
|
|
169
170
|
this.bufferTimeout = null;
|
|
170
171
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
171
172
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
173
|
+
this._callback = null;
|
|
172
174
|
}
|
|
173
175
|
|
|
174
176
|
init() {
|
|
175
177
|
this._catchConsole();
|
|
176
178
|
}
|
|
177
179
|
|
|
180
|
+
setCallback(cb ) {
|
|
181
|
+
this._callback = cb;
|
|
182
|
+
}
|
|
183
|
+
|
|
178
184
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
179
185
|
this.remoteClientConfiguration = configuration;
|
|
180
186
|
}
|
|
@@ -210,6 +216,7 @@ class IssueReporter {
|
|
|
210
216
|
|
|
211
217
|
// Handle category label
|
|
212
218
|
let category = null;
|
|
219
|
+
let skipSendToRemote = false;
|
|
213
220
|
let extra = {};
|
|
214
221
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
215
222
|
category = args[0].split('=')[1];
|
|
@@ -225,6 +232,7 @@ class IssueReporter {
|
|
|
225
232
|
errorMessage: lastArg.message,
|
|
226
233
|
errorStack: lastArg.stack,
|
|
227
234
|
errorType: lastArg.constructor.name,
|
|
235
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
228
236
|
};
|
|
229
237
|
} else {
|
|
230
238
|
extra = lastArg;
|
|
@@ -233,6 +241,11 @@ class IssueReporter {
|
|
|
233
241
|
args.splice(1, 1);
|
|
234
242
|
}
|
|
235
243
|
|
|
244
|
+
if (extra.skipSendToRemote) {
|
|
245
|
+
skipSendToRemote = true;
|
|
246
|
+
delete extra.skipSendToRemote;
|
|
247
|
+
}
|
|
248
|
+
|
|
236
249
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
237
250
|
const message = args.join(', ');
|
|
238
251
|
let consoleMessage = message;
|
|
@@ -253,7 +266,13 @@ class IssueReporter {
|
|
|
253
266
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
254
267
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
255
268
|
|
|
256
|
-
this.
|
|
269
|
+
if (this._callback) {
|
|
270
|
+
this._callback(level, consoleMessage);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (!skipSendToRemote) {
|
|
274
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
275
|
+
}
|
|
257
276
|
}
|
|
258
277
|
|
|
259
278
|
logRequest(url , options , response , start ) {
|
|
@@ -398,7 +417,11 @@ class IssueReporter {
|
|
|
398
417
|
},
|
|
399
418
|
// $FlowFixMe
|
|
400
419
|
body,
|
|
401
|
-
}).catch(() => {
|
|
420
|
+
}).catch((e ) => {
|
|
421
|
+
// $FlowFixMe
|
|
422
|
+
e.skipSendToRemote = true;
|
|
423
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
424
|
+
|
|
402
425
|
setTimeout(() => {
|
|
403
426
|
if (isArray) {
|
|
404
427
|
payload = payload.map(message => {
|
|
@@ -410,7 +433,7 @@ class IssueReporter {
|
|
|
410
433
|
payload._retry = retry + 1;
|
|
411
434
|
}
|
|
412
435
|
|
|
413
|
-
this._sendDebugToGrafana(
|
|
436
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
414
437
|
}, 5000 + retry * 1000);
|
|
415
438
|
});
|
|
416
439
|
}
|
|
@@ -2613,7 +2636,8 @@ class ExternalApp {
|
|
|
2613
2636
|
|
|
2614
2637
|
|
|
2615
2638
|
|
|
2616
|
-
|
|
2639
|
+
|
|
2640
|
+
|
|
2617
2641
|
|
|
2618
2642
|
|
|
2619
2643
|
class Meeting {
|
|
@@ -2625,6 +2649,7 @@ class Meeting {
|
|
|
2625
2649
|
|
|
2626
2650
|
|
|
2627
2651
|
|
|
2652
|
+
|
|
2628
2653
|
|
|
2629
2654
|
|
|
2630
2655
|
static parse(plain ) {
|
|
@@ -2636,14 +2661,28 @@ class Meeting {
|
|
|
2636
2661
|
port: plain.port,
|
|
2637
2662
|
uuid: plain.uuid,
|
|
2638
2663
|
number: plain.number,
|
|
2664
|
+
persistent: plain.persistent,
|
|
2639
2665
|
});
|
|
2640
2666
|
}
|
|
2641
2667
|
|
|
2668
|
+
static parseMany(items ) {
|
|
2669
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2670
|
+
}
|
|
2671
|
+
|
|
2642
2672
|
static newFrom(meeting ) {
|
|
2643
2673
|
return newFrom(meeting, Meeting);
|
|
2644
2674
|
}
|
|
2645
2675
|
|
|
2646
|
-
constructor({
|
|
2676
|
+
constructor({
|
|
2677
|
+
uuid,
|
|
2678
|
+
name,
|
|
2679
|
+
guestSipAuthorization,
|
|
2680
|
+
ownerUuids,
|
|
2681
|
+
port,
|
|
2682
|
+
uri,
|
|
2683
|
+
number,
|
|
2684
|
+
persistent,
|
|
2685
|
+
} = {}) {
|
|
2647
2686
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2648
2687
|
this.uri = uri;
|
|
2649
2688
|
this.name = name;
|
|
@@ -2651,6 +2690,7 @@ class Meeting {
|
|
|
2651
2690
|
this.port = port;
|
|
2652
2691
|
this.uuid = uuid;
|
|
2653
2692
|
this.number = number;
|
|
2693
|
+
this.persistent = persistent;
|
|
2654
2694
|
|
|
2655
2695
|
// Useful to compare instead of instanceof with minified code
|
|
2656
2696
|
this.type = 'Meeting';
|
|
@@ -2728,8 +2768,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2728
2768
|
}
|
|
2729
2769
|
},
|
|
2730
2770
|
|
|
2731
|
-
|
|
2732
|
-
client.
|
|
2771
|
+
getMyMeetings: () =>
|
|
2772
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2773
|
+
|
|
2774
|
+
createMyMeeting: (name , persistent ) =>
|
|
2775
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2733
2776
|
|
|
2734
2777
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2735
2778
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -3240,7 +3283,7 @@ class Recording {
|
|
|
3240
3283
|
|
|
3241
3284
|
|
|
3242
3285
|
|
|
3243
|
-
static parseMany(recordings
|
|
3286
|
+
static parseMany(recordings = []) {
|
|
3244
3287
|
return recordings.map(item => Recording.parse(item));
|
|
3245
3288
|
}
|
|
3246
3289
|
|
|
@@ -3366,7 +3409,7 @@ class CallLog {
|
|
|
3366
3409
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3367
3410
|
start: moment__default['default'](plain.start).toDate(),
|
|
3368
3411
|
end: plain.end ? moment__default['default'](plain.end).toDate() : null,
|
|
3369
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
3412
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
3370
3413
|
});
|
|
3371
3414
|
}
|
|
3372
3415
|
|
|
@@ -4909,6 +4952,7 @@ const AGENT_PAUSED = 'agent_paused';
|
|
|
4909
4952
|
const AGENT_UNPAUSED = 'agent_unpaused';
|
|
4910
4953
|
const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
|
|
4911
4954
|
const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
|
|
4955
|
+
const MEETING_USER_PROGRESS = 'meeting_user_progress';
|
|
4912
4956
|
|
|
4913
4957
|
const BLACKLIST_EVENTS = [
|
|
4914
4958
|
CHAT_MESSAGE_SENT,
|
|
@@ -5259,6 +5303,7 @@ WebSocketClient.eventLists = [
|
|
|
5259
5303
|
AGENT_UNPAUSED,
|
|
5260
5304
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
5261
5305
|
CONFERENCE_ADHOC_DELETED,
|
|
5306
|
+
MEETING_USER_PROGRESS,
|
|
5262
5307
|
];
|
|
5263
5308
|
|
|
5264
5309
|
var wazoWebsocket = {
|
|
@@ -5881,6 +5926,7 @@ const ON_REINVITE = 'reinvite';
|
|
|
5881
5926
|
const ON_ERROR = 'onError';
|
|
5882
5927
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
5883
5928
|
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
5929
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
5884
5930
|
class CanceledCallError extends Error {}
|
|
5885
5931
|
|
|
5886
5932
|
const MAX_REGISTER_TRIES = 10;
|
|
@@ -5954,6 +6000,7 @@ class WebRTCClient extends Emitter {
|
|
|
5954
6000
|
|
|
5955
6001
|
|
|
5956
6002
|
|
|
6003
|
+
|
|
5957
6004
|
|
|
5958
6005
|
static isAPrivateIp(ip ) {
|
|
5959
6006
|
const regex = /^(?:10|127|172\.(?:1[6-9]|2[0-9]|3[01])|192\.168)\..*/;
|
|
@@ -6019,6 +6066,7 @@ class WebRTCClient extends Emitter {
|
|
|
6019
6066
|
this.ON_ERROR = ON_ERROR;
|
|
6020
6067
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6021
6068
|
this.ON_NETWORK_STATS = ON_NETWORK_STATS;
|
|
6069
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED;
|
|
6022
6070
|
}
|
|
6023
6071
|
|
|
6024
6072
|
configureMedia(media ) {
|
|
@@ -6284,7 +6332,9 @@ class WebRTCClient extends Emitter {
|
|
|
6284
6332
|
const inviteOptions = {
|
|
6285
6333
|
requestDelegate: {
|
|
6286
6334
|
onAccept: (response ) => {
|
|
6287
|
-
session.sessionDescriptionHandler.peerConnection
|
|
6335
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
6336
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
6337
|
+
}
|
|
6288
6338
|
this._onAccepted(session, response.session, true);
|
|
6289
6339
|
},
|
|
6290
6340
|
onReject: (response ) => {
|
|
@@ -6620,7 +6670,7 @@ class WebRTCClient extends Emitter {
|
|
|
6620
6670
|
// We search for the last transceiver without `video-` in the mid (video- means remote transceiver)
|
|
6621
6671
|
const transceivers = pc.getTransceivers();
|
|
6622
6672
|
const transceiverIdx = lastIndexOf(transceivers, transceiver =>
|
|
6623
|
-
transceiver.sender.track === null && transceiver.mid.indexOf('video') === -1);
|
|
6673
|
+
transceiver.sender.track === null && transceiver.mid && transceiver.mid.indexOf('video') === -1);
|
|
6624
6674
|
|
|
6625
6675
|
videoSender = transceiverIdx !== -1 ? transceivers[transceiverIdx].sender : null;
|
|
6626
6676
|
} else {
|
|
@@ -7156,6 +7206,16 @@ class WebRTCClient extends Emitter {
|
|
|
7156
7206
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
7157
7207
|
}
|
|
7158
7208
|
|
|
7209
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
7210
|
+
getRemoteVideoStreamFromPc(sessionId ) {
|
|
7211
|
+
const pc = this.getPeerConnection(sessionId);
|
|
7212
|
+
if (!pc) {
|
|
7213
|
+
return null;
|
|
7214
|
+
}
|
|
7215
|
+
|
|
7216
|
+
return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
|
|
7217
|
+
}
|
|
7218
|
+
|
|
7159
7219
|
hasVideo(sessionId ) {
|
|
7160
7220
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
7161
7221
|
}
|
|
@@ -7645,6 +7705,7 @@ class WebRTCClient extends Emitter {
|
|
|
7645
7705
|
|
|
7646
7706
|
this.updateRemoteStream(this.getSipSessionId(session));
|
|
7647
7707
|
|
|
7708
|
+
const pc = session.sessionDescriptionHandler.peerConnection;
|
|
7648
7709
|
const onTrack = (event ) => {
|
|
7649
7710
|
const isAudioOnly = this._isAudioOnly(session);
|
|
7650
7711
|
const { kind, label, readyState, id, muted } = event.track;
|
|
@@ -7664,6 +7725,12 @@ class WebRTCClient extends Emitter {
|
|
|
7664
7725
|
|
|
7665
7726
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
7666
7727
|
|
|
7728
|
+
pc.oniceconnectionstatechange = () => {
|
|
7729
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
7730
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
7731
|
+
}
|
|
7732
|
+
};
|
|
7733
|
+
|
|
7667
7734
|
if (withEvent) {
|
|
7668
7735
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
7669
7736
|
}
|
|
@@ -7883,6 +7950,7 @@ class WebRTCClient extends Emitter {
|
|
|
7883
7950
|
let videoBytesReceived = 0;
|
|
7884
7951
|
let transportSent = 0;
|
|
7885
7952
|
let transportReceived = 0;
|
|
7953
|
+
let packetsLost = 0;
|
|
7886
7954
|
|
|
7887
7955
|
stats.forEach(report => {
|
|
7888
7956
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
@@ -7895,7 +7963,7 @@ class WebRTCClient extends Emitter {
|
|
|
7895
7963
|
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
7896
7964
|
}
|
|
7897
7965
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
7898
|
-
|
|
7966
|
+
packetsLost += report.packetsLost;
|
|
7899
7967
|
networkStats.packetsReceived = report.packetsReceived;
|
|
7900
7968
|
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
7901
7969
|
}
|
|
@@ -7912,27 +7980,36 @@ class WebRTCClient extends Emitter {
|
|
|
7912
7980
|
}
|
|
7913
7981
|
}
|
|
7914
7982
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
7983
|
+
packetsLost += report.packetsLost;
|
|
7915
7984
|
networkStats.roundTripTime = report.roundTripTime;
|
|
7916
7985
|
networkStats.jitter = report.jitter;
|
|
7917
7986
|
}
|
|
7987
|
+
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
7988
|
+
packetsLost += report.packetsLost;
|
|
7989
|
+
}
|
|
7918
7990
|
if (report.type === 'transport') {
|
|
7919
7991
|
transportSent += report.bytesSent;
|
|
7920
7992
|
transportReceived += report.bytesReceived;
|
|
7921
7993
|
}
|
|
7922
7994
|
});
|
|
7923
7995
|
|
|
7924
|
-
networkStats.
|
|
7996
|
+
networkStats.packetsLost = packetsLost;
|
|
7997
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
7998
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
7999
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
7925
8000
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
7926
|
-
networkStats.
|
|
7927
|
-
networkStats.
|
|
8001
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8002
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8003
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
8004
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
8005
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
7928
8006
|
networkStats.transportSent = transportSent;
|
|
7929
|
-
networkStats.
|
|
7930
|
-
|
|
7931
|
-
const bandwidth = (networkStats.audioBytesSent - lastAudioSent) + (networkStats.videoBytesSent - lastVideoSent)
|
|
7932
|
-
+ (networkStats.audioBytesReceived - lastAudioReceived) + (networkStats.videoBytesReceived - lastVideoReceived)
|
|
7933
|
-
+ (networkStats.transportReceived - lastTransportReceived) + (networkStats.transportSent - lastTransportSent);
|
|
8007
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
8008
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
7934
8009
|
|
|
7935
|
-
networkStats.bandwidth =
|
|
8010
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
8011
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8012
|
+
+ networkStats.transportSent;
|
|
7936
8013
|
|
|
7937
8014
|
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
7938
8015
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
@@ -136,6 +136,7 @@ class IssueReporter {
|
|
|
136
136
|
|
|
137
137
|
|
|
138
138
|
|
|
139
|
+
|
|
139
140
|
|
|
140
141
|
constructor() {
|
|
141
142
|
addLevelsTo(this);
|
|
@@ -147,12 +148,17 @@ class IssueReporter {
|
|
|
147
148
|
this.bufferTimeout = null;
|
|
148
149
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
149
150
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
151
|
+
this._callback = null;
|
|
150
152
|
}
|
|
151
153
|
|
|
152
154
|
init() {
|
|
153
155
|
this._catchConsole();
|
|
154
156
|
}
|
|
155
157
|
|
|
158
|
+
setCallback(cb ) {
|
|
159
|
+
this._callback = cb;
|
|
160
|
+
}
|
|
161
|
+
|
|
156
162
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
157
163
|
this.remoteClientConfiguration = configuration;
|
|
158
164
|
}
|
|
@@ -188,6 +194,7 @@ class IssueReporter {
|
|
|
188
194
|
|
|
189
195
|
// Handle category label
|
|
190
196
|
let category = null;
|
|
197
|
+
let skipSendToRemote = false;
|
|
191
198
|
let extra = {};
|
|
192
199
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
193
200
|
category = args[0].split('=')[1];
|
|
@@ -203,6 +210,7 @@ class IssueReporter {
|
|
|
203
210
|
errorMessage: lastArg.message,
|
|
204
211
|
errorStack: lastArg.stack,
|
|
205
212
|
errorType: lastArg.constructor.name,
|
|
213
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
206
214
|
};
|
|
207
215
|
} else {
|
|
208
216
|
extra = lastArg;
|
|
@@ -211,6 +219,11 @@ class IssueReporter {
|
|
|
211
219
|
args.splice(1, 1);
|
|
212
220
|
}
|
|
213
221
|
|
|
222
|
+
if (extra.skipSendToRemote) {
|
|
223
|
+
skipSendToRemote = true;
|
|
224
|
+
delete extra.skipSendToRemote;
|
|
225
|
+
}
|
|
226
|
+
|
|
214
227
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
215
228
|
const message = args.join(', ');
|
|
216
229
|
let consoleMessage = message;
|
|
@@ -231,7 +244,13 @@ class IssueReporter {
|
|
|
231
244
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
232
245
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
233
246
|
|
|
234
|
-
this.
|
|
247
|
+
if (this._callback) {
|
|
248
|
+
this._callback(level, consoleMessage);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (!skipSendToRemote) {
|
|
252
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
253
|
+
}
|
|
235
254
|
}
|
|
236
255
|
|
|
237
256
|
logRequest(url , options , response , start ) {
|
|
@@ -376,7 +395,11 @@ class IssueReporter {
|
|
|
376
395
|
},
|
|
377
396
|
// $FlowFixMe
|
|
378
397
|
body,
|
|
379
|
-
}).catch(() => {
|
|
398
|
+
}).catch((e ) => {
|
|
399
|
+
// $FlowFixMe
|
|
400
|
+
e.skipSendToRemote = true;
|
|
401
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
402
|
+
|
|
380
403
|
setTimeout(() => {
|
|
381
404
|
if (isArray) {
|
|
382
405
|
payload = payload.map(message => {
|
|
@@ -388,7 +411,7 @@ class IssueReporter {
|
|
|
388
411
|
payload._retry = retry + 1;
|
|
389
412
|
}
|
|
390
413
|
|
|
391
|
-
this._sendDebugToGrafana(
|
|
414
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
392
415
|
}, 5000 + retry * 1000);
|
|
393
416
|
});
|
|
394
417
|
}
|
|
@@ -2591,7 +2614,8 @@ class ExternalApp {
|
|
|
2591
2614
|
|
|
2592
2615
|
|
|
2593
2616
|
|
|
2594
|
-
|
|
2617
|
+
|
|
2618
|
+
|
|
2595
2619
|
|
|
2596
2620
|
|
|
2597
2621
|
class Meeting {
|
|
@@ -2603,6 +2627,7 @@ class Meeting {
|
|
|
2603
2627
|
|
|
2604
2628
|
|
|
2605
2629
|
|
|
2630
|
+
|
|
2606
2631
|
|
|
2607
2632
|
|
|
2608
2633
|
static parse(plain ) {
|
|
@@ -2614,14 +2639,28 @@ class Meeting {
|
|
|
2614
2639
|
port: plain.port,
|
|
2615
2640
|
uuid: plain.uuid,
|
|
2616
2641
|
number: plain.number,
|
|
2642
|
+
persistent: plain.persistent,
|
|
2617
2643
|
});
|
|
2618
2644
|
}
|
|
2619
2645
|
|
|
2646
|
+
static parseMany(items ) {
|
|
2647
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2620
2650
|
static newFrom(meeting ) {
|
|
2621
2651
|
return newFrom(meeting, Meeting);
|
|
2622
2652
|
}
|
|
2623
2653
|
|
|
2624
|
-
constructor({
|
|
2654
|
+
constructor({
|
|
2655
|
+
uuid,
|
|
2656
|
+
name,
|
|
2657
|
+
guestSipAuthorization,
|
|
2658
|
+
ownerUuids,
|
|
2659
|
+
port,
|
|
2660
|
+
uri,
|
|
2661
|
+
number,
|
|
2662
|
+
persistent,
|
|
2663
|
+
} = {}) {
|
|
2625
2664
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2626
2665
|
this.uri = uri;
|
|
2627
2666
|
this.name = name;
|
|
@@ -2629,6 +2668,7 @@ class Meeting {
|
|
|
2629
2668
|
this.port = port;
|
|
2630
2669
|
this.uuid = uuid;
|
|
2631
2670
|
this.number = number;
|
|
2671
|
+
this.persistent = persistent;
|
|
2632
2672
|
|
|
2633
2673
|
// Useful to compare instead of instanceof with minified code
|
|
2634
2674
|
this.type = 'Meeting';
|
|
@@ -2706,8 +2746,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2706
2746
|
}
|
|
2707
2747
|
},
|
|
2708
2748
|
|
|
2709
|
-
|
|
2710
|
-
client.
|
|
2749
|
+
getMyMeetings: () =>
|
|
2750
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2751
|
+
|
|
2752
|
+
createMyMeeting: (name , persistent ) =>
|
|
2753
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2711
2754
|
|
|
2712
2755
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2713
2756
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -3192,7 +3235,7 @@ class Recording {
|
|
|
3192
3235
|
|
|
3193
3236
|
|
|
3194
3237
|
|
|
3195
|
-
static parseMany(recordings
|
|
3238
|
+
static parseMany(recordings = []) {
|
|
3196
3239
|
return recordings.map(item => Recording.parse(item));
|
|
3197
3240
|
}
|
|
3198
3241
|
|
|
@@ -3318,7 +3361,7 @@ class CallLog {
|
|
|
3318
3361
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3319
3362
|
start: moment__default['default'](plain.start).toDate(),
|
|
3320
3363
|
end: plain.end ? moment__default['default'](plain.end).toDate() : null,
|
|
3321
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
3364
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
3322
3365
|
});
|
|
3323
3366
|
}
|
|
3324
3367
|
|