@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
|
@@ -496,6 +496,7 @@ class IssueReporter {
|
|
|
496
496
|
|
|
497
497
|
|
|
498
498
|
|
|
499
|
+
|
|
499
500
|
|
|
500
501
|
constructor() {
|
|
501
502
|
addLevelsTo(this);
|
|
@@ -507,12 +508,17 @@ class IssueReporter {
|
|
|
507
508
|
this.bufferTimeout = null;
|
|
508
509
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
509
510
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
511
|
+
this._callback = null;
|
|
510
512
|
}
|
|
511
513
|
|
|
512
514
|
init() {
|
|
513
515
|
this._catchConsole();
|
|
514
516
|
}
|
|
515
517
|
|
|
518
|
+
setCallback(cb ) {
|
|
519
|
+
this._callback = cb;
|
|
520
|
+
}
|
|
521
|
+
|
|
516
522
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
517
523
|
this.remoteClientConfiguration = configuration;
|
|
518
524
|
}
|
|
@@ -548,6 +554,7 @@ class IssueReporter {
|
|
|
548
554
|
|
|
549
555
|
// Handle category label
|
|
550
556
|
let category = null;
|
|
557
|
+
let skipSendToRemote = false;
|
|
551
558
|
let extra = {};
|
|
552
559
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
553
560
|
category = args[0].split('=')[1];
|
|
@@ -563,6 +570,7 @@ class IssueReporter {
|
|
|
563
570
|
errorMessage: lastArg.message,
|
|
564
571
|
errorStack: lastArg.stack,
|
|
565
572
|
errorType: lastArg.constructor.name,
|
|
573
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
566
574
|
};
|
|
567
575
|
} else {
|
|
568
576
|
extra = lastArg;
|
|
@@ -571,6 +579,11 @@ class IssueReporter {
|
|
|
571
579
|
args.splice(1, 1);
|
|
572
580
|
}
|
|
573
581
|
|
|
582
|
+
if (extra.skipSendToRemote) {
|
|
583
|
+
skipSendToRemote = true;
|
|
584
|
+
delete extra.skipSendToRemote;
|
|
585
|
+
}
|
|
586
|
+
|
|
574
587
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
575
588
|
const message = args.join(', ');
|
|
576
589
|
let consoleMessage = message;
|
|
@@ -591,7 +604,13 @@ class IssueReporter {
|
|
|
591
604
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
592
605
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
593
606
|
|
|
594
|
-
this.
|
|
607
|
+
if (this._callback) {
|
|
608
|
+
this._callback(level, consoleMessage);
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
if (!skipSendToRemote) {
|
|
612
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
613
|
+
}
|
|
595
614
|
}
|
|
596
615
|
|
|
597
616
|
logRequest(url , options , response , start ) {
|
|
@@ -736,7 +755,11 @@ class IssueReporter {
|
|
|
736
755
|
},
|
|
737
756
|
// $FlowFixMe
|
|
738
757
|
body,
|
|
739
|
-
}).catch(() => {
|
|
758
|
+
}).catch((e ) => {
|
|
759
|
+
// $FlowFixMe
|
|
760
|
+
e.skipSendToRemote = true;
|
|
761
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
762
|
+
|
|
740
763
|
setTimeout(() => {
|
|
741
764
|
if (isArray) {
|
|
742
765
|
payload = payload.map(message => {
|
|
@@ -748,7 +771,7 @@ class IssueReporter {
|
|
|
748
771
|
payload._retry = retry + 1;
|
|
749
772
|
}
|
|
750
773
|
|
|
751
|
-
this._sendDebugToGrafana(
|
|
774
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
752
775
|
}, 5000 + retry * 1000);
|
|
753
776
|
});
|
|
754
777
|
}
|
|
@@ -886,6 +909,7 @@ const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
|
886
909
|
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
887
910
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
888
911
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
912
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
889
913
|
|
|
890
914
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
891
915
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
@@ -925,6 +949,7 @@ const events = [
|
|
|
925
949
|
ON_CHAT,
|
|
926
950
|
ON_SIGNAL,
|
|
927
951
|
ON_NETWORK_STATS,
|
|
952
|
+
ON_DISCONNECTED,
|
|
928
953
|
];
|
|
929
954
|
|
|
930
955
|
const logger = IssueReporter$1.loggerFor('webrtc-phone');
|
|
@@ -1246,9 +1271,11 @@ class WebRTCPhone extends Emitter {
|
|
|
1246
1271
|
case sessionState.SessionState.Terminated: {
|
|
1247
1272
|
logger.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
1248
1273
|
|
|
1274
|
+
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
1275
|
+
const callSession = this._createCallSession(sipSession);
|
|
1249
1276
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
1250
1277
|
|
|
1251
|
-
return this.eventEmitter.emit(ON_CALL_ENDED,
|
|
1278
|
+
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
1252
1279
|
}
|
|
1253
1280
|
}
|
|
1254
1281
|
});
|
|
@@ -2196,6 +2223,10 @@ class WebRTCPhone extends Emitter {
|
|
|
2196
2223
|
return callSession ? this.client.getRemoteVideoStream(callSession.sipCallId) : null;
|
|
2197
2224
|
}
|
|
2198
2225
|
|
|
2226
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
2227
|
+
return callSession ? this.client.getRemoteVideoStreamFromPc(callSession.sipCallId) : null;
|
|
2228
|
+
}
|
|
2229
|
+
|
|
2199
2230
|
hasRemoteVideo(callSession ) {
|
|
2200
2231
|
return callSession ? this.client.hasRemoteVideo(callSession.sipCallId) : false;
|
|
2201
2232
|
}
|
|
@@ -2277,6 +2308,11 @@ class WebRTCPhone extends Emitter {
|
|
|
2277
2308
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
2278
2309
|
});
|
|
2279
2310
|
|
|
2311
|
+
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
2312
|
+
logger.info('WebRTC disconnected');
|
|
2313
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
2314
|
+
});
|
|
2315
|
+
|
|
2280
2316
|
this.client.on(this.client.REGISTERED, () => {
|
|
2281
2317
|
logger.info('WebRTC registered', {
|
|
2282
2318
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
@@ -2512,6 +2548,7 @@ exports.ON_CALL_UNMUTED = ON_CALL_UNMUTED;
|
|
|
2512
2548
|
exports.ON_CAMERA_DISABLED = ON_CAMERA_DISABLED;
|
|
2513
2549
|
exports.ON_CAMERA_RESUMED = ON_CAMERA_RESUMED;
|
|
2514
2550
|
exports.ON_CHAT = ON_CHAT;
|
|
2551
|
+
exports.ON_DISCONNECTED = ON_DISCONNECTED;
|
|
2515
2552
|
exports.ON_MESSAGE = ON_MESSAGE;
|
|
2516
2553
|
exports.ON_MESSAGE_TRACK_UPDATED = ON_MESSAGE_TRACK_UPDATED;
|
|
2517
2554
|
exports.ON_NETWORK_STATS = ON_NETWORK_STATS;
|
package/lib/domain/Recording.js
CHANGED
|
@@ -59,7 +59,7 @@ class Recording {
|
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
|
|
62
|
-
static parseMany(recordings
|
|
62
|
+
static parseMany(recordings = []) {
|
|
63
63
|
return recordings.map(item => Recording.parse(item));
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -185,7 +185,7 @@ class CallLog {
|
|
|
185
185
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
186
186
|
start: moment__default['default'](plain.start).toDate(),
|
|
187
187
|
end: plain.end ? moment__default['default'](plain.end).toDate() : null,
|
|
188
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
188
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
191
|
|
package/lib/index.js
CHANGED
|
@@ -161,6 +161,7 @@ class IssueReporter {
|
|
|
161
161
|
|
|
162
162
|
|
|
163
163
|
|
|
164
|
+
|
|
164
165
|
|
|
165
166
|
constructor() {
|
|
166
167
|
addLevelsTo(this);
|
|
@@ -172,12 +173,17 @@ class IssueReporter {
|
|
|
172
173
|
this.bufferTimeout = null;
|
|
173
174
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
174
175
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
176
|
+
this._callback = null;
|
|
175
177
|
}
|
|
176
178
|
|
|
177
179
|
init() {
|
|
178
180
|
this._catchConsole();
|
|
179
181
|
}
|
|
180
182
|
|
|
183
|
+
setCallback(cb ) {
|
|
184
|
+
this._callback = cb;
|
|
185
|
+
}
|
|
186
|
+
|
|
181
187
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
182
188
|
this.remoteClientConfiguration = configuration;
|
|
183
189
|
}
|
|
@@ -213,6 +219,7 @@ class IssueReporter {
|
|
|
213
219
|
|
|
214
220
|
// Handle category label
|
|
215
221
|
let category = null;
|
|
222
|
+
let skipSendToRemote = false;
|
|
216
223
|
let extra = {};
|
|
217
224
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
218
225
|
category = args[0].split('=')[1];
|
|
@@ -228,6 +235,7 @@ class IssueReporter {
|
|
|
228
235
|
errorMessage: lastArg.message,
|
|
229
236
|
errorStack: lastArg.stack,
|
|
230
237
|
errorType: lastArg.constructor.name,
|
|
238
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
231
239
|
};
|
|
232
240
|
} else {
|
|
233
241
|
extra = lastArg;
|
|
@@ -236,6 +244,11 @@ class IssueReporter {
|
|
|
236
244
|
args.splice(1, 1);
|
|
237
245
|
}
|
|
238
246
|
|
|
247
|
+
if (extra.skipSendToRemote) {
|
|
248
|
+
skipSendToRemote = true;
|
|
249
|
+
delete extra.skipSendToRemote;
|
|
250
|
+
}
|
|
251
|
+
|
|
239
252
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
240
253
|
const message = args.join(', ');
|
|
241
254
|
let consoleMessage = message;
|
|
@@ -256,7 +269,13 @@ class IssueReporter {
|
|
|
256
269
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
257
270
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
258
271
|
|
|
259
|
-
this.
|
|
272
|
+
if (this._callback) {
|
|
273
|
+
this._callback(level, consoleMessage);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
if (!skipSendToRemote) {
|
|
277
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
278
|
+
}
|
|
260
279
|
}
|
|
261
280
|
|
|
262
281
|
logRequest(url , options , response , start ) {
|
|
@@ -401,7 +420,11 @@ class IssueReporter {
|
|
|
401
420
|
},
|
|
402
421
|
// $FlowFixMe
|
|
403
422
|
body,
|
|
404
|
-
}).catch(() => {
|
|
423
|
+
}).catch((e ) => {
|
|
424
|
+
// $FlowFixMe
|
|
425
|
+
e.skipSendToRemote = true;
|
|
426
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
427
|
+
|
|
405
428
|
setTimeout(() => {
|
|
406
429
|
if (isArray) {
|
|
407
430
|
payload = payload.map(message => {
|
|
@@ -413,7 +436,7 @@ class IssueReporter {
|
|
|
413
436
|
payload._retry = retry + 1;
|
|
414
437
|
}
|
|
415
438
|
|
|
416
|
-
this._sendDebugToGrafana(
|
|
439
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
417
440
|
}, 5000 + retry * 1000);
|
|
418
441
|
});
|
|
419
442
|
}
|
|
@@ -2616,7 +2639,8 @@ class ExternalApp {
|
|
|
2616
2639
|
|
|
2617
2640
|
|
|
2618
2641
|
|
|
2619
|
-
|
|
2642
|
+
|
|
2643
|
+
|
|
2620
2644
|
|
|
2621
2645
|
|
|
2622
2646
|
class Meeting {
|
|
@@ -2628,6 +2652,7 @@ class Meeting {
|
|
|
2628
2652
|
|
|
2629
2653
|
|
|
2630
2654
|
|
|
2655
|
+
|
|
2631
2656
|
|
|
2632
2657
|
|
|
2633
2658
|
static parse(plain ) {
|
|
@@ -2639,14 +2664,28 @@ class Meeting {
|
|
|
2639
2664
|
port: plain.port,
|
|
2640
2665
|
uuid: plain.uuid,
|
|
2641
2666
|
number: plain.number,
|
|
2667
|
+
persistent: plain.persistent,
|
|
2642
2668
|
});
|
|
2643
2669
|
}
|
|
2644
2670
|
|
|
2671
|
+
static parseMany(items ) {
|
|
2672
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2673
|
+
}
|
|
2674
|
+
|
|
2645
2675
|
static newFrom(meeting ) {
|
|
2646
2676
|
return newFrom(meeting, Meeting);
|
|
2647
2677
|
}
|
|
2648
2678
|
|
|
2649
|
-
constructor({
|
|
2679
|
+
constructor({
|
|
2680
|
+
uuid,
|
|
2681
|
+
name,
|
|
2682
|
+
guestSipAuthorization,
|
|
2683
|
+
ownerUuids,
|
|
2684
|
+
port,
|
|
2685
|
+
uri,
|
|
2686
|
+
number,
|
|
2687
|
+
persistent,
|
|
2688
|
+
} = {}) {
|
|
2650
2689
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2651
2690
|
this.uri = uri;
|
|
2652
2691
|
this.name = name;
|
|
@@ -2654,6 +2693,7 @@ class Meeting {
|
|
|
2654
2693
|
this.port = port;
|
|
2655
2694
|
this.uuid = uuid;
|
|
2656
2695
|
this.number = number;
|
|
2696
|
+
this.persistent = persistent;
|
|
2657
2697
|
|
|
2658
2698
|
// Useful to compare instead of instanceof with minified code
|
|
2659
2699
|
this.type = 'Meeting';
|
|
@@ -2731,8 +2771,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2731
2771
|
}
|
|
2732
2772
|
},
|
|
2733
2773
|
|
|
2734
|
-
|
|
2735
|
-
client.
|
|
2774
|
+
getMyMeetings: () =>
|
|
2775
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2776
|
+
|
|
2777
|
+
createMyMeeting: (name , persistent ) =>
|
|
2778
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2736
2779
|
|
|
2737
2780
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2738
2781
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -3588,7 +3631,7 @@ class Recording {
|
|
|
3588
3631
|
|
|
3589
3632
|
|
|
3590
3633
|
|
|
3591
|
-
static parseMany(recordings
|
|
3634
|
+
static parseMany(recordings = []) {
|
|
3592
3635
|
return recordings.map(item => Recording.parse(item));
|
|
3593
3636
|
}
|
|
3594
3637
|
|
|
@@ -3714,7 +3757,7 @@ class CallLog {
|
|
|
3714
3757
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3715
3758
|
start: moment__default['default'](plain.start).toDate(),
|
|
3716
3759
|
end: plain.end ? moment__default['default'](plain.end).toDate() : null,
|
|
3717
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
3760
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
3718
3761
|
});
|
|
3719
3762
|
}
|
|
3720
3763
|
|
|
@@ -6120,6 +6163,7 @@ const ON_REINVITE$1 = 'reinvite';
|
|
|
6120
6163
|
const ON_ERROR = 'onError';
|
|
6121
6164
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
6122
6165
|
const ON_NETWORK_STATS$1 = 'onNetworkStats';
|
|
6166
|
+
const ON_DISCONNECTED$1 = 'onDisconnected';
|
|
6123
6167
|
|
|
6124
6168
|
const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6125
6169
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
@@ -6196,6 +6240,7 @@ class WebRTCClient extends Emitter {
|
|
|
6196
6240
|
|
|
6197
6241
|
|
|
6198
6242
|
|
|
6243
|
+
|
|
6199
6244
|
|
|
6200
6245
|
static isAPrivateIp(ip ) {
|
|
6201
6246
|
const regex = /^(?:10|127|172\.(?:1[6-9]|2[0-9]|3[01])|192\.168)\..*/;
|
|
@@ -6261,6 +6306,7 @@ class WebRTCClient extends Emitter {
|
|
|
6261
6306
|
this.ON_ERROR = ON_ERROR;
|
|
6262
6307
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6263
6308
|
this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
|
|
6309
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED$1;
|
|
6264
6310
|
}
|
|
6265
6311
|
|
|
6266
6312
|
configureMedia(media ) {
|
|
@@ -6526,7 +6572,9 @@ class WebRTCClient extends Emitter {
|
|
|
6526
6572
|
const inviteOptions = {
|
|
6527
6573
|
requestDelegate: {
|
|
6528
6574
|
onAccept: (response ) => {
|
|
6529
|
-
session.sessionDescriptionHandler.peerConnection
|
|
6575
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
6576
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
6577
|
+
}
|
|
6530
6578
|
this._onAccepted(session, response.session, true);
|
|
6531
6579
|
},
|
|
6532
6580
|
onReject: (response ) => {
|
|
@@ -6862,7 +6910,7 @@ class WebRTCClient extends Emitter {
|
|
|
6862
6910
|
// We search for the last transceiver without `video-` in the mid (video- means remote transceiver)
|
|
6863
6911
|
const transceivers = pc.getTransceivers();
|
|
6864
6912
|
const transceiverIdx = lastIndexOf(transceivers, transceiver =>
|
|
6865
|
-
transceiver.sender.track === null && transceiver.mid.indexOf('video') === -1);
|
|
6913
|
+
transceiver.sender.track === null && transceiver.mid && transceiver.mid.indexOf('video') === -1);
|
|
6866
6914
|
|
|
6867
6915
|
videoSender = transceiverIdx !== -1 ? transceivers[transceiverIdx].sender : null;
|
|
6868
6916
|
} else {
|
|
@@ -7398,6 +7446,16 @@ class WebRTCClient extends Emitter {
|
|
|
7398
7446
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
7399
7447
|
}
|
|
7400
7448
|
|
|
7449
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
7450
|
+
getRemoteVideoStreamFromPc(sessionId ) {
|
|
7451
|
+
const pc = this.getPeerConnection(sessionId);
|
|
7452
|
+
if (!pc) {
|
|
7453
|
+
return null;
|
|
7454
|
+
}
|
|
7455
|
+
|
|
7456
|
+
return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
|
|
7457
|
+
}
|
|
7458
|
+
|
|
7401
7459
|
hasVideo(sessionId ) {
|
|
7402
7460
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
7403
7461
|
}
|
|
@@ -7887,6 +7945,7 @@ class WebRTCClient extends Emitter {
|
|
|
7887
7945
|
|
|
7888
7946
|
this.updateRemoteStream(this.getSipSessionId(session));
|
|
7889
7947
|
|
|
7948
|
+
const pc = session.sessionDescriptionHandler.peerConnection;
|
|
7890
7949
|
const onTrack = (event ) => {
|
|
7891
7950
|
const isAudioOnly = this._isAudioOnly(session);
|
|
7892
7951
|
const { kind, label, readyState, id, muted } = event.track;
|
|
@@ -7906,6 +7965,12 @@ class WebRTCClient extends Emitter {
|
|
|
7906
7965
|
|
|
7907
7966
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
7908
7967
|
|
|
7968
|
+
pc.oniceconnectionstatechange = () => {
|
|
7969
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
7970
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
7971
|
+
}
|
|
7972
|
+
};
|
|
7973
|
+
|
|
7909
7974
|
if (withEvent) {
|
|
7910
7975
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
7911
7976
|
}
|
|
@@ -8125,6 +8190,7 @@ class WebRTCClient extends Emitter {
|
|
|
8125
8190
|
let videoBytesReceived = 0;
|
|
8126
8191
|
let transportSent = 0;
|
|
8127
8192
|
let transportReceived = 0;
|
|
8193
|
+
let packetsLost = 0;
|
|
8128
8194
|
|
|
8129
8195
|
stats.forEach(report => {
|
|
8130
8196
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
@@ -8137,7 +8203,7 @@ class WebRTCClient extends Emitter {
|
|
|
8137
8203
|
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8138
8204
|
}
|
|
8139
8205
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8140
|
-
|
|
8206
|
+
packetsLost += report.packetsLost;
|
|
8141
8207
|
networkStats.packetsReceived = report.packetsReceived;
|
|
8142
8208
|
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8143
8209
|
}
|
|
@@ -8154,27 +8220,36 @@ class WebRTCClient extends Emitter {
|
|
|
8154
8220
|
}
|
|
8155
8221
|
}
|
|
8156
8222
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8223
|
+
packetsLost += report.packetsLost;
|
|
8157
8224
|
networkStats.roundTripTime = report.roundTripTime;
|
|
8158
8225
|
networkStats.jitter = report.jitter;
|
|
8159
8226
|
}
|
|
8227
|
+
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8228
|
+
packetsLost += report.packetsLost;
|
|
8229
|
+
}
|
|
8160
8230
|
if (report.type === 'transport') {
|
|
8161
8231
|
transportSent += report.bytesSent;
|
|
8162
8232
|
transportReceived += report.bytesReceived;
|
|
8163
8233
|
}
|
|
8164
8234
|
});
|
|
8165
8235
|
|
|
8166
|
-
networkStats.
|
|
8236
|
+
networkStats.packetsLost = packetsLost;
|
|
8237
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8238
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8239
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8167
8240
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8168
|
-
networkStats.
|
|
8169
|
-
networkStats.
|
|
8241
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8242
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8243
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
8244
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
8245
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
8170
8246
|
networkStats.transportSent = transportSent;
|
|
8171
|
-
networkStats.
|
|
8247
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
8248
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
8172
8249
|
|
|
8173
|
-
|
|
8174
|
-
+
|
|
8175
|
-
+
|
|
8176
|
-
|
|
8177
|
-
networkStats.bandwidth = bandwidth;
|
|
8250
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
8251
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8252
|
+
+ networkStats.transportSent;
|
|
8178
8253
|
|
|
8179
8254
|
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8180
8255
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
@@ -8270,6 +8345,7 @@ const AGENT_PAUSED = 'agent_paused';
|
|
|
8270
8345
|
const AGENT_UNPAUSED = 'agent_unpaused';
|
|
8271
8346
|
const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
|
|
8272
8347
|
const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
|
|
8348
|
+
const MEETING_USER_PROGRESS = 'meeting_user_progress';
|
|
8273
8349
|
|
|
8274
8350
|
const BLACKLIST_EVENTS = [
|
|
8275
8351
|
CHAT_MESSAGE_SENT,
|
|
@@ -8620,6 +8696,7 @@ WebSocketClient.eventLists = [
|
|
|
8620
8696
|
AGENT_UNPAUSED,
|
|
8621
8697
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
8622
8698
|
CONFERENCE_ADHOC_DELETED,
|
|
8699
|
+
MEETING_USER_PROGRESS,
|
|
8623
8700
|
];
|
|
8624
8701
|
|
|
8625
8702
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -8690,6 +8767,7 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
8690
8767
|
AGENT_UNPAUSED: AGENT_UNPAUSED,
|
|
8691
8768
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT: CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
8692
8769
|
CONFERENCE_ADHOC_DELETED: CONFERENCE_ADHOC_DELETED,
|
|
8770
|
+
MEETING_USER_PROGRESS: MEETING_USER_PROGRESS,
|
|
8693
8771
|
HEARTBEAT_ENGINE_VERSION: HEARTBEAT_ENGINE_VERSION,
|
|
8694
8772
|
'default': WebSocketClient
|
|
8695
8773
|
});
|
|
@@ -9113,6 +9191,7 @@ const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
|
9113
9191
|
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
9114
9192
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
9115
9193
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
9194
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
9116
9195
|
|
|
9117
9196
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
9118
9197
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
@@ -9152,6 +9231,7 @@ const events = [
|
|
|
9152
9231
|
ON_CHAT,
|
|
9153
9232
|
ON_SIGNAL,
|
|
9154
9233
|
ON_NETWORK_STATS,
|
|
9234
|
+
ON_DISCONNECTED,
|
|
9155
9235
|
];
|
|
9156
9236
|
|
|
9157
9237
|
const logger$7 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
@@ -9473,9 +9553,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9473
9553
|
case sessionState.SessionState.Terminated: {
|
|
9474
9554
|
logger$7.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
9475
9555
|
|
|
9556
|
+
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9557
|
+
const callSession = this._createCallSession(sipSession);
|
|
9476
9558
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
9477
9559
|
|
|
9478
|
-
return this.eventEmitter.emit(ON_CALL_ENDED,
|
|
9560
|
+
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
9479
9561
|
}
|
|
9480
9562
|
}
|
|
9481
9563
|
});
|
|
@@ -10423,6 +10505,10 @@ class WebRTCPhone extends Emitter {
|
|
|
10423
10505
|
return callSession ? this.client.getRemoteVideoStream(callSession.sipCallId) : null;
|
|
10424
10506
|
}
|
|
10425
10507
|
|
|
10508
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
10509
|
+
return callSession ? this.client.getRemoteVideoStreamFromPc(callSession.sipCallId) : null;
|
|
10510
|
+
}
|
|
10511
|
+
|
|
10426
10512
|
hasRemoteVideo(callSession ) {
|
|
10427
10513
|
return callSession ? this.client.hasRemoteVideo(callSession.sipCallId) : false;
|
|
10428
10514
|
}
|
|
@@ -10504,6 +10590,11 @@ class WebRTCPhone extends Emitter {
|
|
|
10504
10590
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10505
10591
|
});
|
|
10506
10592
|
|
|
10593
|
+
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
10594
|
+
logger$7.info('WebRTC disconnected');
|
|
10595
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
10596
|
+
});
|
|
10597
|
+
|
|
10507
10598
|
this.client.on(this.client.REGISTERED, () => {
|
|
10508
10599
|
logger$7.info('WebRTC registered', {
|
|
10509
10600
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
@@ -10760,6 +10851,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10760
10851
|
ON_NETWORK_STATS: ON_NETWORK_STATS,
|
|
10761
10852
|
ON_CHAT: ON_CHAT,
|
|
10762
10853
|
ON_SIGNAL: ON_SIGNAL,
|
|
10854
|
+
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
10763
10855
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
10764
10856
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
10765
10857
|
events: events,
|
|
@@ -12135,6 +12227,11 @@ class Phone extends Emitter {
|
|
|
12135
12227
|
return this.getRemoteVideoStream(callSession);
|
|
12136
12228
|
}
|
|
12137
12229
|
|
|
12230
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
12231
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
12232
|
+
return this.phone ? this.phone.getRemoteVideoStreamFromPc(callSession) : false;
|
|
12233
|
+
}
|
|
12234
|
+
|
|
12138
12235
|
hasVideo(callSession ) {
|
|
12139
12236
|
return this.phone ? this.phone.hasVideo(callSession) : false;
|
|
12140
12237
|
}
|
|
@@ -107,6 +107,7 @@ class IssueReporter {
|
|
|
107
107
|
|
|
108
108
|
|
|
109
109
|
|
|
110
|
+
|
|
110
111
|
|
|
111
112
|
constructor() {
|
|
112
113
|
addLevelsTo(this);
|
|
@@ -118,12 +119,17 @@ class IssueReporter {
|
|
|
118
119
|
this.bufferTimeout = null;
|
|
119
120
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
120
121
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
122
|
+
this._callback = null;
|
|
121
123
|
}
|
|
122
124
|
|
|
123
125
|
init() {
|
|
124
126
|
this._catchConsole();
|
|
125
127
|
}
|
|
126
128
|
|
|
129
|
+
setCallback(cb ) {
|
|
130
|
+
this._callback = cb;
|
|
131
|
+
}
|
|
132
|
+
|
|
127
133
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
128
134
|
this.remoteClientConfiguration = configuration;
|
|
129
135
|
}
|
|
@@ -159,6 +165,7 @@ class IssueReporter {
|
|
|
159
165
|
|
|
160
166
|
// Handle category label
|
|
161
167
|
let category = null;
|
|
168
|
+
let skipSendToRemote = false;
|
|
162
169
|
let extra = {};
|
|
163
170
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
164
171
|
category = args[0].split('=')[1];
|
|
@@ -174,6 +181,7 @@ class IssueReporter {
|
|
|
174
181
|
errorMessage: lastArg.message,
|
|
175
182
|
errorStack: lastArg.stack,
|
|
176
183
|
errorType: lastArg.constructor.name,
|
|
184
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
177
185
|
};
|
|
178
186
|
} else {
|
|
179
187
|
extra = lastArg;
|
|
@@ -182,6 +190,11 @@ class IssueReporter {
|
|
|
182
190
|
args.splice(1, 1);
|
|
183
191
|
}
|
|
184
192
|
|
|
193
|
+
if (extra.skipSendToRemote) {
|
|
194
|
+
skipSendToRemote = true;
|
|
195
|
+
delete extra.skipSendToRemote;
|
|
196
|
+
}
|
|
197
|
+
|
|
185
198
|
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
186
199
|
const message = args.join(', ');
|
|
187
200
|
let consoleMessage = message;
|
|
@@ -202,7 +215,13 @@ class IssueReporter {
|
|
|
202
215
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
203
216
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
204
217
|
|
|
205
|
-
this.
|
|
218
|
+
if (this._callback) {
|
|
219
|
+
this._callback(level, consoleMessage);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (!skipSendToRemote) {
|
|
223
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
224
|
+
}
|
|
206
225
|
}
|
|
207
226
|
|
|
208
227
|
logRequest(url , options , response , start ) {
|
|
@@ -347,7 +366,11 @@ class IssueReporter {
|
|
|
347
366
|
},
|
|
348
367
|
// $FlowFixMe
|
|
349
368
|
body,
|
|
350
|
-
}).catch(() => {
|
|
369
|
+
}).catch((e ) => {
|
|
370
|
+
// $FlowFixMe
|
|
371
|
+
e.skipSendToRemote = true;
|
|
372
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
373
|
+
|
|
351
374
|
setTimeout(() => {
|
|
352
375
|
if (isArray) {
|
|
353
376
|
payload = payload.map(message => {
|
|
@@ -359,7 +382,7 @@ class IssueReporter {
|
|
|
359
382
|
payload._retry = retry + 1;
|
|
360
383
|
}
|
|
361
384
|
|
|
362
|
-
this._sendDebugToGrafana(
|
|
385
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
363
386
|
}, 5000 + retry * 1000);
|
|
364
387
|
});
|
|
365
388
|
}
|