@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/esm/index.js
CHANGED
|
@@ -150,6 +150,7 @@ class IssueReporter {
|
|
|
150
150
|
|
|
151
151
|
|
|
152
152
|
|
|
153
|
+
|
|
153
154
|
|
|
154
155
|
constructor() {
|
|
155
156
|
addLevelsTo(this);
|
|
@@ -161,12 +162,17 @@ class IssueReporter {
|
|
|
161
162
|
this.bufferTimeout = null;
|
|
162
163
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
163
164
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
165
|
+
this._callback = null;
|
|
164
166
|
}
|
|
165
167
|
|
|
166
168
|
init() {
|
|
167
169
|
this._catchConsole();
|
|
168
170
|
}
|
|
169
171
|
|
|
172
|
+
setCallback(cb ) {
|
|
173
|
+
this._callback = cb;
|
|
174
|
+
}
|
|
175
|
+
|
|
170
176
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
171
177
|
this.remoteClientConfiguration = configuration;
|
|
172
178
|
}
|
|
@@ -202,6 +208,7 @@ class IssueReporter {
|
|
|
202
208
|
|
|
203
209
|
// Handle category label
|
|
204
210
|
let category = null;
|
|
211
|
+
let skipSendToRemote = false;
|
|
205
212
|
let extra = {};
|
|
206
213
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
207
214
|
category = args[0].split('=')[1];
|
|
@@ -217,6 +224,7 @@ class IssueReporter {
|
|
|
217
224
|
errorMessage: lastArg.message,
|
|
218
225
|
errorStack: lastArg.stack,
|
|
219
226
|
errorType: lastArg.constructor.name,
|
|
227
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
220
228
|
};
|
|
221
229
|
} else {
|
|
222
230
|
extra = lastArg;
|
|
@@ -225,6 +233,11 @@ class IssueReporter {
|
|
|
225
233
|
args.splice(1, 1);
|
|
226
234
|
}
|
|
227
235
|
|
|
236
|
+
if (extra.skipSendToRemote) {
|
|
237
|
+
skipSendToRemote = true;
|
|
238
|
+
delete extra.skipSendToRemote;
|
|
239
|
+
}
|
|
240
|
+
|
|
228
241
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
229
242
|
const message = args.join(', ');
|
|
230
243
|
let consoleMessage = message;
|
|
@@ -245,7 +258,13 @@ class IssueReporter {
|
|
|
245
258
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
246
259
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
247
260
|
|
|
248
|
-
this.
|
|
261
|
+
if (this._callback) {
|
|
262
|
+
this._callback(level, consoleMessage);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
if (!skipSendToRemote) {
|
|
266
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
267
|
+
}
|
|
249
268
|
}
|
|
250
269
|
|
|
251
270
|
logRequest(url , options , response , start ) {
|
|
@@ -390,7 +409,11 @@ class IssueReporter {
|
|
|
390
409
|
},
|
|
391
410
|
// $FlowFixMe
|
|
392
411
|
body,
|
|
393
|
-
}).catch(() => {
|
|
412
|
+
}).catch((e ) => {
|
|
413
|
+
// $FlowFixMe
|
|
414
|
+
e.skipSendToRemote = true;
|
|
415
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
416
|
+
|
|
394
417
|
setTimeout(() => {
|
|
395
418
|
if (isArray) {
|
|
396
419
|
payload = payload.map(message => {
|
|
@@ -402,7 +425,7 @@ class IssueReporter {
|
|
|
402
425
|
payload._retry = retry + 1;
|
|
403
426
|
}
|
|
404
427
|
|
|
405
|
-
this._sendDebugToGrafana(
|
|
428
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
406
429
|
}, 5000 + retry * 1000);
|
|
407
430
|
});
|
|
408
431
|
}
|
|
@@ -2605,7 +2628,8 @@ class ExternalApp {
|
|
|
2605
2628
|
|
|
2606
2629
|
|
|
2607
2630
|
|
|
2608
|
-
|
|
2631
|
+
|
|
2632
|
+
|
|
2609
2633
|
|
|
2610
2634
|
|
|
2611
2635
|
class Meeting {
|
|
@@ -2617,6 +2641,7 @@ class Meeting {
|
|
|
2617
2641
|
|
|
2618
2642
|
|
|
2619
2643
|
|
|
2644
|
+
|
|
2620
2645
|
|
|
2621
2646
|
|
|
2622
2647
|
static parse(plain ) {
|
|
@@ -2628,14 +2653,28 @@ class Meeting {
|
|
|
2628
2653
|
port: plain.port,
|
|
2629
2654
|
uuid: plain.uuid,
|
|
2630
2655
|
number: plain.number,
|
|
2656
|
+
persistent: plain.persistent,
|
|
2631
2657
|
});
|
|
2632
2658
|
}
|
|
2633
2659
|
|
|
2660
|
+
static parseMany(items ) {
|
|
2661
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2662
|
+
}
|
|
2663
|
+
|
|
2634
2664
|
static newFrom(meeting ) {
|
|
2635
2665
|
return newFrom(meeting, Meeting);
|
|
2636
2666
|
}
|
|
2637
2667
|
|
|
2638
|
-
constructor({
|
|
2668
|
+
constructor({
|
|
2669
|
+
uuid,
|
|
2670
|
+
name,
|
|
2671
|
+
guestSipAuthorization,
|
|
2672
|
+
ownerUuids,
|
|
2673
|
+
port,
|
|
2674
|
+
uri,
|
|
2675
|
+
number,
|
|
2676
|
+
persistent,
|
|
2677
|
+
} = {}) {
|
|
2639
2678
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2640
2679
|
this.uri = uri;
|
|
2641
2680
|
this.name = name;
|
|
@@ -2643,6 +2682,7 @@ class Meeting {
|
|
|
2643
2682
|
this.port = port;
|
|
2644
2683
|
this.uuid = uuid;
|
|
2645
2684
|
this.number = number;
|
|
2685
|
+
this.persistent = persistent;
|
|
2646
2686
|
|
|
2647
2687
|
// Useful to compare instead of instanceof with minified code
|
|
2648
2688
|
this.type = 'Meeting';
|
|
@@ -2720,8 +2760,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2720
2760
|
}
|
|
2721
2761
|
},
|
|
2722
2762
|
|
|
2723
|
-
|
|
2724
|
-
client.
|
|
2763
|
+
getMyMeetings: () =>
|
|
2764
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2765
|
+
|
|
2766
|
+
createMyMeeting: (name , persistent ) =>
|
|
2767
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2725
2768
|
|
|
2726
2769
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2727
2770
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -3577,7 +3620,7 @@ class Recording {
|
|
|
3577
3620
|
|
|
3578
3621
|
|
|
3579
3622
|
|
|
3580
|
-
static parseMany(recordings
|
|
3623
|
+
static parseMany(recordings = []) {
|
|
3581
3624
|
return recordings.map(item => Recording.parse(item));
|
|
3582
3625
|
}
|
|
3583
3626
|
|
|
@@ -3703,7 +3746,7 @@ class CallLog {
|
|
|
3703
3746
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3704
3747
|
start: moment(plain.start).toDate(),
|
|
3705
3748
|
end: plain.end ? moment(plain.end).toDate() : null,
|
|
3706
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
3749
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
3707
3750
|
});
|
|
3708
3751
|
}
|
|
3709
3752
|
|
|
@@ -6109,6 +6152,7 @@ const ON_REINVITE$1 = 'reinvite';
|
|
|
6109
6152
|
const ON_ERROR = 'onError';
|
|
6110
6153
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
6111
6154
|
const ON_NETWORK_STATS$1 = 'onNetworkStats';
|
|
6155
|
+
const ON_DISCONNECTED$1 = 'onDisconnected';
|
|
6112
6156
|
|
|
6113
6157
|
const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6114
6158
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
@@ -6185,6 +6229,7 @@ class WebRTCClient extends Emitter {
|
|
|
6185
6229
|
|
|
6186
6230
|
|
|
6187
6231
|
|
|
6232
|
+
|
|
6188
6233
|
|
|
6189
6234
|
static isAPrivateIp(ip ) {
|
|
6190
6235
|
const regex = /^(?:10|127|172\.(?:1[6-9]|2[0-9]|3[01])|192\.168)\..*/;
|
|
@@ -6250,6 +6295,7 @@ class WebRTCClient extends Emitter {
|
|
|
6250
6295
|
this.ON_ERROR = ON_ERROR;
|
|
6251
6296
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6252
6297
|
this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
|
|
6298
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED$1;
|
|
6253
6299
|
}
|
|
6254
6300
|
|
|
6255
6301
|
configureMedia(media ) {
|
|
@@ -6515,7 +6561,9 @@ class WebRTCClient extends Emitter {
|
|
|
6515
6561
|
const inviteOptions = {
|
|
6516
6562
|
requestDelegate: {
|
|
6517
6563
|
onAccept: (response ) => {
|
|
6518
|
-
session.sessionDescriptionHandler.peerConnection
|
|
6564
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
6565
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
6566
|
+
}
|
|
6519
6567
|
this._onAccepted(session, response.session, true);
|
|
6520
6568
|
},
|
|
6521
6569
|
onReject: (response ) => {
|
|
@@ -6851,7 +6899,7 @@ class WebRTCClient extends Emitter {
|
|
|
6851
6899
|
// We search for the last transceiver without `video-` in the mid (video- means remote transceiver)
|
|
6852
6900
|
const transceivers = pc.getTransceivers();
|
|
6853
6901
|
const transceiverIdx = lastIndexOf(transceivers, transceiver =>
|
|
6854
|
-
transceiver.sender.track === null && transceiver.mid.indexOf('video') === -1);
|
|
6902
|
+
transceiver.sender.track === null && transceiver.mid && transceiver.mid.indexOf('video') === -1);
|
|
6855
6903
|
|
|
6856
6904
|
videoSender = transceiverIdx !== -1 ? transceivers[transceiverIdx].sender : null;
|
|
6857
6905
|
} else {
|
|
@@ -7387,6 +7435,16 @@ class WebRTCClient extends Emitter {
|
|
|
7387
7435
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
7388
7436
|
}
|
|
7389
7437
|
|
|
7438
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
7439
|
+
getRemoteVideoStreamFromPc(sessionId ) {
|
|
7440
|
+
const pc = this.getPeerConnection(sessionId);
|
|
7441
|
+
if (!pc) {
|
|
7442
|
+
return null;
|
|
7443
|
+
}
|
|
7444
|
+
|
|
7445
|
+
return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
|
|
7446
|
+
}
|
|
7447
|
+
|
|
7390
7448
|
hasVideo(sessionId ) {
|
|
7391
7449
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
7392
7450
|
}
|
|
@@ -7876,6 +7934,7 @@ class WebRTCClient extends Emitter {
|
|
|
7876
7934
|
|
|
7877
7935
|
this.updateRemoteStream(this.getSipSessionId(session));
|
|
7878
7936
|
|
|
7937
|
+
const pc = session.sessionDescriptionHandler.peerConnection;
|
|
7879
7938
|
const onTrack = (event ) => {
|
|
7880
7939
|
const isAudioOnly = this._isAudioOnly(session);
|
|
7881
7940
|
const { kind, label, readyState, id, muted } = event.track;
|
|
@@ -7895,6 +7954,12 @@ class WebRTCClient extends Emitter {
|
|
|
7895
7954
|
|
|
7896
7955
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
7897
7956
|
|
|
7957
|
+
pc.oniceconnectionstatechange = () => {
|
|
7958
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
7959
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
7960
|
+
}
|
|
7961
|
+
};
|
|
7962
|
+
|
|
7898
7963
|
if (withEvent) {
|
|
7899
7964
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
7900
7965
|
}
|
|
@@ -8114,6 +8179,7 @@ class WebRTCClient extends Emitter {
|
|
|
8114
8179
|
let videoBytesReceived = 0;
|
|
8115
8180
|
let transportSent = 0;
|
|
8116
8181
|
let transportReceived = 0;
|
|
8182
|
+
let packetsLost = 0;
|
|
8117
8183
|
|
|
8118
8184
|
stats.forEach(report => {
|
|
8119
8185
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
@@ -8126,7 +8192,7 @@ class WebRTCClient extends Emitter {
|
|
|
8126
8192
|
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8127
8193
|
}
|
|
8128
8194
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8129
|
-
|
|
8195
|
+
packetsLost += report.packetsLost;
|
|
8130
8196
|
networkStats.packetsReceived = report.packetsReceived;
|
|
8131
8197
|
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8132
8198
|
}
|
|
@@ -8143,27 +8209,36 @@ class WebRTCClient extends Emitter {
|
|
|
8143
8209
|
}
|
|
8144
8210
|
}
|
|
8145
8211
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8212
|
+
packetsLost += report.packetsLost;
|
|
8146
8213
|
networkStats.roundTripTime = report.roundTripTime;
|
|
8147
8214
|
networkStats.jitter = report.jitter;
|
|
8148
8215
|
}
|
|
8216
|
+
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8217
|
+
packetsLost += report.packetsLost;
|
|
8218
|
+
}
|
|
8149
8219
|
if (report.type === 'transport') {
|
|
8150
8220
|
transportSent += report.bytesSent;
|
|
8151
8221
|
transportReceived += report.bytesReceived;
|
|
8152
8222
|
}
|
|
8153
8223
|
});
|
|
8154
8224
|
|
|
8155
|
-
networkStats.
|
|
8225
|
+
networkStats.packetsLost = packetsLost;
|
|
8226
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8227
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8228
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8156
8229
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8157
|
-
networkStats.
|
|
8158
|
-
networkStats.
|
|
8230
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8231
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8232
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
8233
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
8234
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
8159
8235
|
networkStats.transportSent = transportSent;
|
|
8160
|
-
networkStats.
|
|
8236
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
8237
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
8161
8238
|
|
|
8162
|
-
|
|
8163
|
-
+
|
|
8164
|
-
+
|
|
8165
|
-
|
|
8166
|
-
networkStats.bandwidth = bandwidth;
|
|
8239
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
8240
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8241
|
+
+ networkStats.transportSent;
|
|
8167
8242
|
|
|
8168
8243
|
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8169
8244
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
@@ -8259,6 +8334,7 @@ const AGENT_PAUSED = 'agent_paused';
|
|
|
8259
8334
|
const AGENT_UNPAUSED = 'agent_unpaused';
|
|
8260
8335
|
const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
|
|
8261
8336
|
const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
|
|
8337
|
+
const MEETING_USER_PROGRESS = 'meeting_user_progress';
|
|
8262
8338
|
|
|
8263
8339
|
const BLACKLIST_EVENTS = [
|
|
8264
8340
|
CHAT_MESSAGE_SENT,
|
|
@@ -8609,6 +8685,7 @@ WebSocketClient.eventLists = [
|
|
|
8609
8685
|
AGENT_UNPAUSED,
|
|
8610
8686
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
8611
8687
|
CONFERENCE_ADHOC_DELETED,
|
|
8688
|
+
MEETING_USER_PROGRESS,
|
|
8612
8689
|
];
|
|
8613
8690
|
|
|
8614
8691
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -8679,6 +8756,7 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
8679
8756
|
AGENT_UNPAUSED: AGENT_UNPAUSED,
|
|
8680
8757
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT: CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
8681
8758
|
CONFERENCE_ADHOC_DELETED: CONFERENCE_ADHOC_DELETED,
|
|
8759
|
+
MEETING_USER_PROGRESS: MEETING_USER_PROGRESS,
|
|
8682
8760
|
HEARTBEAT_ENGINE_VERSION: HEARTBEAT_ENGINE_VERSION,
|
|
8683
8761
|
'default': WebSocketClient
|
|
8684
8762
|
});
|
|
@@ -9102,6 +9180,7 @@ const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
|
9102
9180
|
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
9103
9181
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
9104
9182
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
9183
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
9105
9184
|
|
|
9106
9185
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
9107
9186
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
@@ -9141,6 +9220,7 @@ const events = [
|
|
|
9141
9220
|
ON_CHAT,
|
|
9142
9221
|
ON_SIGNAL,
|
|
9143
9222
|
ON_NETWORK_STATS,
|
|
9223
|
+
ON_DISCONNECTED,
|
|
9144
9224
|
];
|
|
9145
9225
|
|
|
9146
9226
|
const logger$7 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
@@ -9462,9 +9542,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9462
9542
|
case SessionState.Terminated: {
|
|
9463
9543
|
logger$7.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
9464
9544
|
|
|
9545
|
+
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9546
|
+
const callSession = this._createCallSession(sipSession);
|
|
9465
9547
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
9466
9548
|
|
|
9467
|
-
return this.eventEmitter.emit(ON_CALL_ENDED,
|
|
9549
|
+
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
9468
9550
|
}
|
|
9469
9551
|
}
|
|
9470
9552
|
});
|
|
@@ -10412,6 +10494,10 @@ class WebRTCPhone extends Emitter {
|
|
|
10412
10494
|
return callSession ? this.client.getRemoteVideoStream(callSession.sipCallId) : null;
|
|
10413
10495
|
}
|
|
10414
10496
|
|
|
10497
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
10498
|
+
return callSession ? this.client.getRemoteVideoStreamFromPc(callSession.sipCallId) : null;
|
|
10499
|
+
}
|
|
10500
|
+
|
|
10415
10501
|
hasRemoteVideo(callSession ) {
|
|
10416
10502
|
return callSession ? this.client.hasRemoteVideo(callSession.sipCallId) : false;
|
|
10417
10503
|
}
|
|
@@ -10493,6 +10579,11 @@ class WebRTCPhone extends Emitter {
|
|
|
10493
10579
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10494
10580
|
});
|
|
10495
10581
|
|
|
10582
|
+
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
10583
|
+
logger$7.info('WebRTC disconnected');
|
|
10584
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
10585
|
+
});
|
|
10586
|
+
|
|
10496
10587
|
this.client.on(this.client.REGISTERED, () => {
|
|
10497
10588
|
logger$7.info('WebRTC registered', {
|
|
10498
10589
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
@@ -10749,6 +10840,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10749
10840
|
ON_NETWORK_STATS: ON_NETWORK_STATS,
|
|
10750
10841
|
ON_CHAT: ON_CHAT,
|
|
10751
10842
|
ON_SIGNAL: ON_SIGNAL,
|
|
10843
|
+
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
10752
10844
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
10753
10845
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
10754
10846
|
events: events,
|
|
@@ -12124,6 +12216,11 @@ class Phone extends Emitter {
|
|
|
12124
12216
|
return this.getRemoteVideoStream(callSession);
|
|
12125
12217
|
}
|
|
12126
12218
|
|
|
12219
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
12220
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
12221
|
+
return this.phone ? this.phone.getRemoteVideoStreamFromPc(callSession) : false;
|
|
12222
|
+
}
|
|
12223
|
+
|
|
12127
12224
|
hasVideo(callSession ) {
|
|
12128
12225
|
return this.phone ? this.phone.hasVideo(callSession) : false;
|
|
12129
12226
|
}
|
|
@@ -97,6 +97,7 @@ class IssueReporter {
|
|
|
97
97
|
|
|
98
98
|
|
|
99
99
|
|
|
100
|
+
|
|
100
101
|
|
|
101
102
|
constructor() {
|
|
102
103
|
addLevelsTo(this);
|
|
@@ -108,12 +109,17 @@ class IssueReporter {
|
|
|
108
109
|
this.bufferTimeout = null;
|
|
109
110
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
110
111
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
112
|
+
this._callback = null;
|
|
111
113
|
}
|
|
112
114
|
|
|
113
115
|
init() {
|
|
114
116
|
this._catchConsole();
|
|
115
117
|
}
|
|
116
118
|
|
|
119
|
+
setCallback(cb ) {
|
|
120
|
+
this._callback = cb;
|
|
121
|
+
}
|
|
122
|
+
|
|
117
123
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
118
124
|
this.remoteClientConfiguration = configuration;
|
|
119
125
|
}
|
|
@@ -149,6 +155,7 @@ class IssueReporter {
|
|
|
149
155
|
|
|
150
156
|
// Handle category label
|
|
151
157
|
let category = null;
|
|
158
|
+
let skipSendToRemote = false;
|
|
152
159
|
let extra = {};
|
|
153
160
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
154
161
|
category = args[0].split('=')[1];
|
|
@@ -164,6 +171,7 @@ class IssueReporter {
|
|
|
164
171
|
errorMessage: lastArg.message,
|
|
165
172
|
errorStack: lastArg.stack,
|
|
166
173
|
errorType: lastArg.constructor.name,
|
|
174
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
167
175
|
};
|
|
168
176
|
} else {
|
|
169
177
|
extra = lastArg;
|
|
@@ -172,6 +180,11 @@ class IssueReporter {
|
|
|
172
180
|
args.splice(1, 1);
|
|
173
181
|
}
|
|
174
182
|
|
|
183
|
+
if (extra.skipSendToRemote) {
|
|
184
|
+
skipSendToRemote = true;
|
|
185
|
+
delete extra.skipSendToRemote;
|
|
186
|
+
}
|
|
187
|
+
|
|
175
188
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
176
189
|
const message = args.join(', ');
|
|
177
190
|
let consoleMessage = message;
|
|
@@ -192,7 +205,13 @@ class IssueReporter {
|
|
|
192
205
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
193
206
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
194
207
|
|
|
195
|
-
this.
|
|
208
|
+
if (this._callback) {
|
|
209
|
+
this._callback(level, consoleMessage);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (!skipSendToRemote) {
|
|
213
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
214
|
+
}
|
|
196
215
|
}
|
|
197
216
|
|
|
198
217
|
logRequest(url , options , response , start ) {
|
|
@@ -337,7 +356,11 @@ class IssueReporter {
|
|
|
337
356
|
},
|
|
338
357
|
// $FlowFixMe
|
|
339
358
|
body,
|
|
340
|
-
}).catch(() => {
|
|
359
|
+
}).catch((e ) => {
|
|
360
|
+
// $FlowFixMe
|
|
361
|
+
e.skipSendToRemote = true;
|
|
362
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
363
|
+
|
|
341
364
|
setTimeout(() => {
|
|
342
365
|
if (isArray) {
|
|
343
366
|
payload = payload.map(message => {
|
|
@@ -349,7 +372,7 @@ class IssueReporter {
|
|
|
349
372
|
payload._retry = retry + 1;
|
|
350
373
|
}
|
|
351
374
|
|
|
352
|
-
this._sendDebugToGrafana(
|
|
375
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
353
376
|
}, 5000 + retry * 1000);
|
|
354
377
|
});
|
|
355
378
|
}
|
package/esm/service/CallApi.js
CHANGED
|
@@ -1705,7 +1705,7 @@ class Recording {
|
|
|
1705
1705
|
|
|
1706
1706
|
|
|
1707
1707
|
|
|
1708
|
-
static parseMany(recordings
|
|
1708
|
+
static parseMany(recordings = []) {
|
|
1709
1709
|
return recordings.map(item => Recording.parse(item));
|
|
1710
1710
|
}
|
|
1711
1711
|
|
|
@@ -1831,7 +1831,7 @@ class CallLog {
|
|
|
1831
1831
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
1832
1832
|
start: moment(plain.start).toDate(),
|
|
1833
1833
|
end: plain.end ? moment(plain.end).toDate() : null,
|
|
1834
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
1834
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
1835
1835
|
});
|
|
1836
1836
|
}
|
|
1837
1837
|
|
|
@@ -2139,6 +2139,7 @@ class IssueReporter {
|
|
|
2139
2139
|
|
|
2140
2140
|
|
|
2141
2141
|
|
|
2142
|
+
|
|
2142
2143
|
|
|
2143
2144
|
constructor() {
|
|
2144
2145
|
addLevelsTo(this);
|
|
@@ -2150,12 +2151,17 @@ class IssueReporter {
|
|
|
2150
2151
|
this.bufferTimeout = null;
|
|
2151
2152
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
2152
2153
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
2154
|
+
this._callback = null;
|
|
2153
2155
|
}
|
|
2154
2156
|
|
|
2155
2157
|
init() {
|
|
2156
2158
|
this._catchConsole();
|
|
2157
2159
|
}
|
|
2158
2160
|
|
|
2161
|
+
setCallback(cb ) {
|
|
2162
|
+
this._callback = cb;
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2159
2165
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
2160
2166
|
this.remoteClientConfiguration = configuration;
|
|
2161
2167
|
}
|
|
@@ -2191,6 +2197,7 @@ class IssueReporter {
|
|
|
2191
2197
|
|
|
2192
2198
|
// Handle category label
|
|
2193
2199
|
let category = null;
|
|
2200
|
+
let skipSendToRemote = false;
|
|
2194
2201
|
let extra = {};
|
|
2195
2202
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
2196
2203
|
category = args[0].split('=')[1];
|
|
@@ -2206,6 +2213,7 @@ class IssueReporter {
|
|
|
2206
2213
|
errorMessage: lastArg.message,
|
|
2207
2214
|
errorStack: lastArg.stack,
|
|
2208
2215
|
errorType: lastArg.constructor.name,
|
|
2216
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
2209
2217
|
};
|
|
2210
2218
|
} else {
|
|
2211
2219
|
extra = lastArg;
|
|
@@ -2214,6 +2222,11 @@ class IssueReporter {
|
|
|
2214
2222
|
args.splice(1, 1);
|
|
2215
2223
|
}
|
|
2216
2224
|
|
|
2225
|
+
if (extra.skipSendToRemote) {
|
|
2226
|
+
skipSendToRemote = true;
|
|
2227
|
+
delete extra.skipSendToRemote;
|
|
2228
|
+
}
|
|
2229
|
+
|
|
2217
2230
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
2218
2231
|
const message = args.join(', ');
|
|
2219
2232
|
let consoleMessage = message;
|
|
@@ -2234,7 +2247,13 @@ class IssueReporter {
|
|
|
2234
2247
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
2235
2248
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
2236
2249
|
|
|
2237
|
-
this.
|
|
2250
|
+
if (this._callback) {
|
|
2251
|
+
this._callback(level, consoleMessage);
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
if (!skipSendToRemote) {
|
|
2255
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
2256
|
+
}
|
|
2238
2257
|
}
|
|
2239
2258
|
|
|
2240
2259
|
logRequest(url , options , response , start ) {
|
|
@@ -2379,7 +2398,11 @@ class IssueReporter {
|
|
|
2379
2398
|
},
|
|
2380
2399
|
// $FlowFixMe
|
|
2381
2400
|
body,
|
|
2382
|
-
}).catch(() => {
|
|
2401
|
+
}).catch((e ) => {
|
|
2402
|
+
// $FlowFixMe
|
|
2403
|
+
e.skipSendToRemote = true;
|
|
2404
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
2405
|
+
|
|
2383
2406
|
setTimeout(() => {
|
|
2384
2407
|
if (isArray) {
|
|
2385
2408
|
payload = payload.map(message => {
|
|
@@ -2391,7 +2414,7 @@ class IssueReporter {
|
|
|
2391
2414
|
payload._retry = retry + 1;
|
|
2392
2415
|
}
|
|
2393
2416
|
|
|
2394
|
-
this._sendDebugToGrafana(
|
|
2417
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
2395
2418
|
}, 5000 + retry * 1000);
|
|
2396
2419
|
});
|
|
2397
2420
|
}
|
|
@@ -3109,7 +3132,8 @@ class ExternalApp {
|
|
|
3109
3132
|
|
|
3110
3133
|
|
|
3111
3134
|
|
|
3112
|
-
|
|
3135
|
+
|
|
3136
|
+
|
|
3113
3137
|
|
|
3114
3138
|
|
|
3115
3139
|
class Meeting {
|
|
@@ -3121,6 +3145,7 @@ class Meeting {
|
|
|
3121
3145
|
|
|
3122
3146
|
|
|
3123
3147
|
|
|
3148
|
+
|
|
3124
3149
|
|
|
3125
3150
|
|
|
3126
3151
|
static parse(plain ) {
|
|
@@ -3132,14 +3157,28 @@ class Meeting {
|
|
|
3132
3157
|
port: plain.port,
|
|
3133
3158
|
uuid: plain.uuid,
|
|
3134
3159
|
number: plain.number,
|
|
3160
|
+
persistent: plain.persistent,
|
|
3135
3161
|
});
|
|
3136
3162
|
}
|
|
3137
3163
|
|
|
3164
|
+
static parseMany(items ) {
|
|
3165
|
+
return items.map(plain => Meeting.parse(plain));
|
|
3166
|
+
}
|
|
3167
|
+
|
|
3138
3168
|
static newFrom(meeting ) {
|
|
3139
3169
|
return newFrom(meeting, Meeting);
|
|
3140
3170
|
}
|
|
3141
3171
|
|
|
3142
|
-
constructor({
|
|
3172
|
+
constructor({
|
|
3173
|
+
uuid,
|
|
3174
|
+
name,
|
|
3175
|
+
guestSipAuthorization,
|
|
3176
|
+
ownerUuids,
|
|
3177
|
+
port,
|
|
3178
|
+
uri,
|
|
3179
|
+
number,
|
|
3180
|
+
persistent,
|
|
3181
|
+
} = {}) {
|
|
3143
3182
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
3144
3183
|
this.uri = uri;
|
|
3145
3184
|
this.name = name;
|
|
@@ -3147,6 +3186,7 @@ class Meeting {
|
|
|
3147
3186
|
this.port = port;
|
|
3148
3187
|
this.uuid = uuid;
|
|
3149
3188
|
this.number = number;
|
|
3189
|
+
this.persistent = persistent;
|
|
3150
3190
|
|
|
3151
3191
|
// Useful to compare instead of instanceof with minified code
|
|
3152
3192
|
this.type = 'Meeting';
|
|
@@ -3224,8 +3264,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
3224
3264
|
}
|
|
3225
3265
|
},
|
|
3226
3266
|
|
|
3227
|
-
|
|
3228
|
-
client.
|
|
3267
|
+
getMyMeetings: () =>
|
|
3268
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
3269
|
+
|
|
3270
|
+
createMyMeeting: (name , persistent ) =>
|
|
3271
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
3229
3272
|
|
|
3230
3273
|
deleteMyMeeting: (meetingUuid ) =>
|
|
3231
3274
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|