@wazo/sdk 0.37.18 → 0.37.22
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 +13 -5
- package/esm/__tests__/api-client.test.js +52 -9
- package/esm/__tests__/web-rtc-client.test.js +80 -20
- package/esm/api/agentd.js +27 -4
- package/esm/api/amid.js +27 -4
- package/esm/api/application.js +27 -4
- package/esm/api/auth.js +29 -5
- package/esm/api/call-logd.js +29 -6
- package/esm/api/calld.js +27 -4
- package/esm/api/chatd.js +27 -4
- package/esm/api/confd.js +51 -8
- package/esm/api/ctid-ng.js +27 -4
- package/esm/api/dird.js +27 -4
- package/esm/api/webhookd.js +27 -4
- package/esm/api-client.js +54 -11
- package/esm/checker/Checker.js +83 -21
- package/esm/checker/checks/aor.js +54 -11
- package/esm/checker/checks/api.js +54 -11
- package/esm/checker/checks/ice-ipv4.js +1 -1
- package/esm/checker/checks/index.js +84 -22
- package/esm/checker/checks/symmetric-nat.js +1 -1
- package/esm/checker/checks/wazo-websocket.js +29 -4
- package/esm/checker/checks/webrtc-transport.js +82 -22
- package/esm/checker/checks/webrtc.js +82 -22
- package/esm/domain/AdHocAPIConference.js +54 -11
- package/esm/domain/Agent.js +1 -1
- package/esm/domain/BadResponse.js +1 -1
- package/esm/domain/Call.js +1 -1
- package/esm/domain/CallLog.js +3 -3
- package/esm/domain/CallSession.js +1 -1
- package/esm/domain/ChatMessage.js +1 -1
- package/esm/domain/ChatRoom.js +1 -1
- package/esm/domain/Contact.js +2 -1
- package/esm/domain/Country.js +1 -1
- package/esm/domain/Device/DebugDevice.js +1 -1
- package/esm/domain/ExternalApp.js +1 -1
- package/esm/domain/Features.js +54 -10
- package/esm/domain/ForwardOption.js +2 -1
- package/esm/domain/IndirectTransfer.js +1 -1
- package/esm/domain/Line.js +1 -1
- package/esm/domain/Meeting.js +20 -3
- package/esm/domain/NotificationOptions.js +1 -1
- package/esm/domain/Phone/CTIPhone.js +55 -11
- package/esm/domain/Phone/WebRTCPhone.js +39 -6
- package/esm/domain/Profile.js +2 -1
- package/esm/domain/Recording.js +2 -2
- package/esm/domain/Relocation.js +1 -1
- package/esm/domain/Room.js +1 -1
- package/esm/domain/ServerError.js +1 -1
- package/esm/domain/Session.js +2 -2
- package/esm/domain/SipLine.js +1 -1
- package/esm/domain/Subscription.js +1 -1
- package/esm/domain/SwitchboardCall.js +1 -1
- package/esm/domain/Voicemail.js +1 -1
- package/esm/domain/__tests__/CallLog.test.js +2 -2
- package/esm/index.js +101 -24
- package/esm/lib/WazoSessionDescriptionHandler.js +28 -4
- package/esm/service/CallApi.js +54 -11
- package/esm/service/IssueReporter.js +27 -4
- package/esm/service/__tests__/IssueReporter.test.js +26 -3
- package/esm/service/getApiClient.js +55 -11
- package/esm/simple/Auth.js +101 -23
- package/esm/simple/Configuration.js +100 -23
- package/esm/simple/Directory.js +53 -10
- package/esm/simple/Phone.js +100 -23
- package/esm/simple/Websocket.js +30 -4
- package/esm/simple/index.js +100 -23
- package/esm/simple/room/LocalParticipant.js +113 -40
- package/esm/simple/room/Participant.js +112 -37
- package/esm/simple/room/RemoteParticipant.js +114 -41
- package/esm/simple/room/Room.js +113 -37
- package/esm/simple/room/SipRoom.js +101 -26
- package/esm/simple/room/Stream.js +101 -26
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +99 -22
- package/esm/simple/utils.js +99 -22
- package/esm/utils/Emitter.js +1 -1
- package/esm/utils/Heartbeat.js +1 -1
- package/esm/utils/__tests__/api-requester.test.js +26 -3
- package/esm/utils/api-requester.js +28 -4
- package/esm/utils/compare-version.js +1 -1
- package/esm/utils/isMobile.js +1 -1
- package/esm/utils/new-from.js +1 -1
- package/esm/utils/once.js +1 -1
- package/esm/utils/update-from.js +1 -1
- package/esm/web-rtc-client.js +83 -22
- package/esm/websocket-client.js +30 -4
- package/lib/__tests__/api-client.test.js +61 -18
- package/lib/__tests__/web-rtc-client.test.js +97 -37
- package/lib/api/agentd.js +27 -4
- package/lib/api/amid.js +27 -4
- package/lib/api/application.js +27 -4
- package/lib/api/auth.js +28 -5
- package/lib/api/call-logd.js +34 -11
- package/lib/api/calld.js +30 -7
- package/lib/api/chatd.js +28 -5
- package/lib/api/confd.js +51 -8
- package/lib/api/ctid-ng.js +30 -7
- package/lib/api/dird.js +27 -4
- package/lib/api/webhookd.js +27 -4
- package/lib/api-client.js +61 -18
- package/lib/checker/Checker.js +100 -38
- package/lib/checker/checks/aor.js +61 -18
- package/lib/checker/checks/api.js +61 -18
- package/lib/checker/checks/index.js +100 -38
- package/lib/checker/checks/wazo-websocket.js +31 -6
- package/lib/checker/checks/webrtc-transport.js +97 -37
- package/lib/checker/checks/webrtc.js +97 -37
- package/lib/domain/AdHocAPIConference.js +61 -18
- package/lib/domain/Call.js +1 -1
- package/lib/domain/CallLog.js +7 -7
- package/lib/domain/ChatMessage.js +1 -1
- package/lib/domain/Contact.js +1 -1
- package/lib/domain/Features.js +62 -19
- package/lib/domain/ForwardOption.js +1 -1
- package/lib/domain/Meeting.js +19 -2
- package/lib/domain/Phone/CTIPhone.js +63 -20
- package/lib/domain/Phone/WebRTCPhone.js +40 -8
- package/lib/domain/Profile.js +1 -1
- package/lib/domain/Recording.js +3 -3
- package/lib/domain/Voicemail.js +1 -1
- package/lib/domain/__tests__/Call.test.js +1 -1
- package/lib/domain/__tests__/CallLog.test.js +13 -13
- package/lib/domain/__tests__/Voicemail.test.js +1 -1
- package/lib/index.js +120 -43
- package/lib/lib/WazoSessionDescriptionHandler.js +32 -9
- package/lib/service/CallApi.js +61 -18
- package/lib/service/IssueReporter.js +27 -4
- package/lib/service/__tests__/IssueReporter.test.js +27 -4
- package/lib/service/getApiClient.js +62 -19
- package/lib/simple/Auth.js +119 -42
- package/lib/simple/Configuration.js +118 -41
- package/lib/simple/Directory.js +61 -18
- package/lib/simple/Phone.js +118 -41
- package/lib/simple/Websocket.js +32 -6
- package/lib/simple/index.js +118 -41
- package/lib/simple/room/LocalParticipant.js +132 -59
- package/lib/simple/room/Participant.js +130 -55
- package/lib/simple/room/RemoteParticipant.js +133 -60
- package/lib/simple/room/Room.js +131 -56
- package/lib/simple/room/SipRoom.js +120 -45
- package/lib/simple/room/Stream.js +120 -45
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +118 -41
- package/lib/simple/utils.js +118 -41
- package/lib/utils/Emitter.js +1 -1
- package/lib/utils/PhoneNumberUtil.js +2 -2
- package/lib/utils/__tests__/PhoneNumberUtil.test.js +2 -2
- package/lib/utils/__tests__/api-requester.test.js +27 -4
- package/lib/utils/__tests__/sdp.test.js +12 -12
- package/lib/utils/api-requester.js +28 -5
- package/lib/utils/sdp.js +10 -10
- package/lib/web-rtc-client.js +98 -38
- package/lib/websocket-client.js +33 -7
- 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 +11 -2
- 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 +28 -11
- package/src/websocket-client.js +2 -0
|
@@ -53,7 +53,7 @@ class Recording {
|
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
static parseMany(recordings
|
|
56
|
+
static parseMany(recordings = []) {
|
|
57
57
|
return recordings.map(item => Recording.parse(item));
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -179,7 +179,7 @@ class CallLog {
|
|
|
179
179
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
180
180
|
start: moment(plain.start).toDate(),
|
|
181
181
|
end: plain.end ? moment(plain.end).toDate() : null,
|
|
182
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
182
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
185
|
|
package/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Base64 } from 'js-base64';
|
|
2
2
|
import moment from 'moment';
|
|
3
|
-
import {
|
|
3
|
+
import { jws, b64utoutf8, KEYUTIL } from 'jsrsasign';
|
|
4
4
|
import { SessionState } from 'sip.js/lib/api/session-state';
|
|
5
5
|
import EventEmitter from 'events';
|
|
6
6
|
import { jsonToGraphQLQuery } from 'json-to-graphql-query/lib/jsonToGraphQLQuery';
|
|
@@ -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
|
|
|
@@ -6518,7 +6561,9 @@ class WebRTCClient extends Emitter {
|
|
|
6518
6561
|
const inviteOptions = {
|
|
6519
6562
|
requestDelegate: {
|
|
6520
6563
|
onAccept: (response ) => {
|
|
6521
|
-
session.sessionDescriptionHandler.peerConnection
|
|
6564
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
6565
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
6566
|
+
}
|
|
6522
6567
|
this._onAccepted(session, response.session, true);
|
|
6523
6568
|
},
|
|
6524
6569
|
onReject: (response ) => {
|
|
@@ -6854,7 +6899,7 @@ class WebRTCClient extends Emitter {
|
|
|
6854
6899
|
// We search for the last transceiver without `video-` in the mid (video- means remote transceiver)
|
|
6855
6900
|
const transceivers = pc.getTransceivers();
|
|
6856
6901
|
const transceiverIdx = lastIndexOf(transceivers, transceiver =>
|
|
6857
|
-
transceiver.sender.track === null && transceiver.mid.indexOf('video') === -1);
|
|
6902
|
+
transceiver.sender.track === null && transceiver.mid && transceiver.mid.indexOf('video') === -1);
|
|
6858
6903
|
|
|
6859
6904
|
videoSender = transceiverIdx !== -1 ? transceivers[transceiverIdx].sender : null;
|
|
6860
6905
|
} else {
|
|
@@ -7390,6 +7435,16 @@ class WebRTCClient extends Emitter {
|
|
|
7390
7435
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
7391
7436
|
}
|
|
7392
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
|
+
|
|
7393
7448
|
hasVideo(sessionId ) {
|
|
7394
7449
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
7395
7450
|
}
|
|
@@ -7900,6 +7955,7 @@ class WebRTCClient extends Emitter {
|
|
|
7900
7955
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
7901
7956
|
|
|
7902
7957
|
pc.oniceconnectionstatechange = () => {
|
|
7958
|
+
logger$9.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
7903
7959
|
if (pc.iceConnectionState === 'disconnected') {
|
|
7904
7960
|
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
7905
7961
|
}
|
|
@@ -8168,18 +8224,22 @@ class WebRTCClient extends Emitter {
|
|
|
8168
8224
|
});
|
|
8169
8225
|
|
|
8170
8226
|
networkStats.packetsLost = packetsLost;
|
|
8171
|
-
networkStats.
|
|
8227
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8228
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8229
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8172
8230
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8173
|
-
networkStats.
|
|
8174
|
-
networkStats.
|
|
8231
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8232
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8233
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
8234
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
8235
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
8175
8236
|
networkStats.transportSent = transportSent;
|
|
8176
|
-
networkStats.
|
|
8177
|
-
|
|
8178
|
-
const bandwidth = (networkStats.audioBytesSent - lastAudioSent) + (networkStats.videoBytesSent - lastVideoSent)
|
|
8179
|
-
+ (networkStats.audioBytesReceived - lastAudioReceived) + (networkStats.videoBytesReceived - lastVideoReceived)
|
|
8180
|
-
+ (networkStats.transportReceived - lastTransportReceived) + (networkStats.transportSent - lastTransportSent);
|
|
8237
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
8238
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
8181
8239
|
|
|
8182
|
-
networkStats.bandwidth =
|
|
8240
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
8241
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8242
|
+
+ networkStats.transportSent;
|
|
8183
8243
|
|
|
8184
8244
|
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8185
8245
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
@@ -8275,6 +8335,7 @@ const AGENT_PAUSED = 'agent_paused';
|
|
|
8275
8335
|
const AGENT_UNPAUSED = 'agent_unpaused';
|
|
8276
8336
|
const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
|
|
8277
8337
|
const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
|
|
8338
|
+
const MEETING_USER_PROGRESS = 'meeting_user_progress';
|
|
8278
8339
|
|
|
8279
8340
|
const BLACKLIST_EVENTS = [
|
|
8280
8341
|
CHAT_MESSAGE_SENT,
|
|
@@ -8625,6 +8686,7 @@ WebSocketClient.eventLists = [
|
|
|
8625
8686
|
AGENT_UNPAUSED,
|
|
8626
8687
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
8627
8688
|
CONFERENCE_ADHOC_DELETED,
|
|
8689
|
+
MEETING_USER_PROGRESS,
|
|
8628
8690
|
];
|
|
8629
8691
|
|
|
8630
8692
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -8695,6 +8757,7 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
8695
8757
|
AGENT_UNPAUSED: AGENT_UNPAUSED,
|
|
8696
8758
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT: CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
8697
8759
|
CONFERENCE_ADHOC_DELETED: CONFERENCE_ADHOC_DELETED,
|
|
8760
|
+
MEETING_USER_PROGRESS: MEETING_USER_PROGRESS,
|
|
8698
8761
|
HEARTBEAT_ENGINE_VERSION: HEARTBEAT_ENGINE_VERSION,
|
|
8699
8762
|
'default': WebSocketClient
|
|
8700
8763
|
});
|
|
@@ -9451,7 +9514,10 @@ class WebRTCPhone extends Emitter {
|
|
|
9451
9514
|
|
|
9452
9515
|
onCancel(message);
|
|
9453
9516
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
9454
|
-
|
|
9517
|
+
const callSession = this._createCallSession(sipSession);
|
|
9518
|
+
delete this.callSessions[callSession.getId()];
|
|
9519
|
+
|
|
9520
|
+
this.eventEmitter.emit(ON_CALL_CANCELED, callSession, elsewhere);
|
|
9455
9521
|
};
|
|
9456
9522
|
} else if (sipSession instanceof Invitation) {
|
|
9457
9523
|
console.warn('sipSession._onCancel not found, please update the wazo SDK accordingly');
|
|
@@ -9480,9 +9546,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9480
9546
|
case SessionState.Terminated: {
|
|
9481
9547
|
logger$7.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
9482
9548
|
|
|
9549
|
+
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9550
|
+
const callSession = this._createCallSession(sipSession);
|
|
9483
9551
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
9484
9552
|
|
|
9485
|
-
return this.eventEmitter.emit(ON_CALL_ENDED,
|
|
9553
|
+
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
9486
9554
|
}
|
|
9487
9555
|
}
|
|
9488
9556
|
});
|
|
@@ -10430,6 +10498,10 @@ class WebRTCPhone extends Emitter {
|
|
|
10430
10498
|
return callSession ? this.client.getRemoteVideoStream(callSession.sipCallId) : null;
|
|
10431
10499
|
}
|
|
10432
10500
|
|
|
10501
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
10502
|
+
return callSession ? this.client.getRemoteVideoStreamFromPc(callSession.sipCallId) : null;
|
|
10503
|
+
}
|
|
10504
|
+
|
|
10433
10505
|
hasRemoteVideo(callSession ) {
|
|
10434
10506
|
return callSession ? this.client.hasRemoteVideo(callSession.sipCallId) : false;
|
|
10435
10507
|
}
|
|
@@ -12148,6 +12220,11 @@ class Phone extends Emitter {
|
|
|
12148
12220
|
return this.getRemoteVideoStream(callSession);
|
|
12149
12221
|
}
|
|
12150
12222
|
|
|
12223
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
12224
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
12225
|
+
return this.phone ? this.phone.getRemoteVideoStreamFromPc(callSession) : false;
|
|
12226
|
+
}
|
|
12227
|
+
|
|
12151
12228
|
hasVideo(callSession ) {
|
|
12152
12229
|
return this.phone ? this.phone.hasVideo(callSession) : false;
|
|
12153
12230
|
}
|
|
@@ -13827,4 +13904,4 @@ var index = {
|
|
|
13827
13904
|
Meeting,
|
|
13828
13905
|
};
|
|
13829
13906
|
|
|
13830
|
-
export
|
|
13907
|
+
export default index;
|
|
@@ -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
|
}
|
|
@@ -888,4 +911,5 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
888
911
|
}
|
|
889
912
|
}
|
|
890
913
|
|
|
891
|
-
export
|
|
914
|
+
export default WazoSessionDescriptionHandler;
|
|
915
|
+
export { wazoMediaStreamFactory };
|
package/esm/service/CallApi.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import moment from 'moment';
|
|
2
|
-
import {
|
|
2
|
+
import { jws, b64utoutf8, KEYUTIL } from 'jsrsasign';
|
|
3
3
|
import 'sip.js/lib/api/session-state';
|
|
4
4
|
import { Base64 } from 'js-base64';
|
|
5
5
|
import 'events';
|
|
@@ -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),
|
|
@@ -4689,4 +4732,4 @@ class CallApi {
|
|
|
4689
4732
|
}
|
|
4690
4733
|
}
|
|
4691
4734
|
|
|
4692
|
-
export
|
|
4735
|
+
export default CallApi;
|