@wazo/sdk 0.37.22 → 0.37.23
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 +5 -5
- package/esm/__tests__/api-client.test.js +26 -0
- package/esm/__tests__/web-rtc-client.test.js +40 -52
- package/esm/api/call-logd.js +7 -0
- package/esm/api/calld.js +10 -0
- package/esm/api/chatd.js +7 -0
- package/esm/api/confd.js +3 -0
- package/esm/api/ctid-ng.js +10 -0
- package/esm/api/dird.js +3 -0
- package/esm/api-client.js +26 -0
- package/esm/checker/Checker.js +40 -52
- package/esm/checker/checks/aor.js +26 -0
- package/esm/checker/checks/api.js +26 -0
- package/esm/checker/checks/index.js +40 -52
- package/esm/checker/checks/webrtc-transport.js +40 -52
- package/esm/checker/checks/webrtc.js +40 -52
- package/esm/domain/AdHocAPIConference.js +26 -0
- package/esm/domain/Call.js +3 -0
- package/esm/domain/CallLog.js +7 -0
- package/esm/domain/ChatMessage.js +4 -0
- package/esm/domain/ChatRoom.js +3 -0
- package/esm/domain/Contact.js +3 -0
- package/esm/domain/Features.js +26 -0
- package/esm/domain/Meeting.js +3 -0
- package/esm/domain/Phone/CTIPhone.js +30 -0
- package/esm/domain/Phone/WebRTCPhone.js +14 -12
- package/esm/domain/Recording.js +3 -0
- package/esm/domain/Voicemail.js +3 -0
- package/esm/domain/__tests__/Call.test.js +3 -0
- package/esm/domain/__tests__/CallLog.test.js +7 -0
- package/esm/domain/__tests__/Contact.test.js +3 -0
- package/esm/domain/__tests__/Voicemail.test.js +3 -0
- package/esm/index.js +57 -63
- package/esm/lib/WazoSessionDescriptionHandler.js +0 -38
- package/esm/service/CallApi.js +26 -0
- package/esm/service/getApiClient.js +26 -0
- package/esm/simple/Auth.js +57 -63
- package/esm/simple/Configuration.js +57 -63
- package/esm/simple/Directory.js +26 -0
- package/esm/simple/Phone.js +57 -63
- package/esm/simple/index.js +57 -63
- package/esm/simple/room/LocalParticipant.js +57 -63
- package/esm/simple/room/Participant.js +57 -63
- package/esm/simple/room/RemoteParticipant.js +57 -63
- package/esm/simple/room/Room.js +57 -63
- package/esm/simple/room/SipRoom.js +57 -63
- package/esm/simple/room/Stream.js +57 -63
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +57 -63
- package/esm/simple/utils.js +57 -63
- package/esm/web-rtc-client.js +40 -52
- package/lib/__tests__/api-client.test.js +26 -0
- package/lib/__tests__/web-rtc-client.test.js +40 -52
- package/lib/api/call-logd.js +7 -0
- package/lib/api/calld.js +10 -0
- package/lib/api/chatd.js +7 -0
- package/lib/api/confd.js +3 -0
- package/lib/api/ctid-ng.js +10 -0
- package/lib/api/dird.js +3 -0
- package/lib/api-client.js +26 -0
- package/lib/checker/Checker.js +40 -52
- package/lib/checker/checks/aor.js +26 -0
- package/lib/checker/checks/api.js +26 -0
- package/lib/checker/checks/index.js +40 -52
- package/lib/checker/checks/webrtc-transport.js +40 -52
- package/lib/checker/checks/webrtc.js +40 -52
- package/lib/domain/AdHocAPIConference.js +26 -0
- package/lib/domain/Call.js +3 -0
- package/lib/domain/CallLog.js +7 -0
- package/lib/domain/ChatMessage.js +4 -0
- package/lib/domain/ChatRoom.js +3 -0
- package/lib/domain/Contact.js +3 -0
- package/lib/domain/Features.js +26 -0
- package/lib/domain/Meeting.js +3 -0
- package/lib/domain/Phone/CTIPhone.js +30 -0
- package/lib/domain/Phone/WebRTCPhone.js +14 -12
- package/lib/domain/Recording.js +3 -0
- package/lib/domain/Voicemail.js +3 -0
- package/lib/domain/__tests__/Call.test.js +3 -0
- package/lib/domain/__tests__/CallLog.test.js +7 -0
- package/lib/domain/__tests__/Contact.test.js +3 -0
- package/lib/domain/__tests__/Voicemail.test.js +3 -0
- package/lib/index.js +57 -63
- package/lib/lib/WazoSessionDescriptionHandler.js +0 -38
- package/lib/service/CallApi.js +26 -0
- package/lib/service/getApiClient.js +26 -0
- package/lib/simple/Auth.js +57 -63
- package/lib/simple/Configuration.js +57 -63
- package/lib/simple/Directory.js +26 -0
- package/lib/simple/Phone.js +57 -63
- package/lib/simple/index.js +57 -63
- package/lib/simple/room/LocalParticipant.js +57 -63
- package/lib/simple/room/Participant.js +57 -63
- package/lib/simple/room/RemoteParticipant.js +57 -63
- package/lib/simple/room/Room.js +57 -63
- package/lib/simple/room/SipRoom.js +57 -63
- package/lib/simple/room/Stream.js +57 -63
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +57 -63
- package/lib/simple/utils.js +57 -63
- package/lib/web-rtc-client.js +40 -52
- package/package.json +1 -1
- package/src/domain/Call.js +3 -0
- package/src/domain/CallLog.js +4 -0
- package/src/domain/ChatMessage.js +4 -0
- package/src/domain/ChatRoom.js +3 -0
- package/src/domain/Contact.js +3 -0
- package/src/domain/Meeting.js +3 -0
- package/src/domain/Phone/CTIPhone.js +4 -0
- package/src/domain/Phone/Phone.js +2 -0
- package/src/domain/Phone/WebRTCPhone.js +14 -12
- package/src/domain/Recording.js +3 -0
- package/src/domain/Voicemail.js +3 -0
- package/src/lib/WazoSessionDescriptionHandler.js +1 -35
- package/src/web-rtc-client.js +14 -14
package/esm/simple/utils.js
CHANGED
|
@@ -863,6 +863,9 @@ class Contact {
|
|
|
863
863
|
}
|
|
864
864
|
|
|
865
865
|
static parseMany(response ) {
|
|
866
|
+
if (!response || !response.results) {
|
|
867
|
+
return [];
|
|
868
|
+
}
|
|
866
869
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
867
870
|
}
|
|
868
871
|
|
|
@@ -2657,6 +2660,9 @@ class Meeting {
|
|
|
2657
2660
|
}
|
|
2658
2661
|
|
|
2659
2662
|
static parseMany(items ) {
|
|
2663
|
+
if (!items) {
|
|
2664
|
+
return [];
|
|
2665
|
+
}
|
|
2660
2666
|
return items.map(plain => Meeting.parse(plain));
|
|
2661
2667
|
}
|
|
2662
2668
|
|
|
@@ -2859,6 +2865,10 @@ class ChatMessage {
|
|
|
2859
2865
|
|
|
2860
2866
|
|
|
2861
2867
|
static parseMany(plain ) {
|
|
2868
|
+
if (!plain || !plain.items) {
|
|
2869
|
+
return [];
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2862
2872
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2863
2873
|
}
|
|
2864
2874
|
|
|
@@ -2968,6 +2978,9 @@ class Voicemail {
|
|
|
2968
2978
|
}
|
|
2969
2979
|
|
|
2970
2980
|
static parseMany(plain ) {
|
|
2981
|
+
if (!plain) {
|
|
2982
|
+
return [];
|
|
2983
|
+
}
|
|
2971
2984
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2972
2985
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2973
2986
|
|
|
@@ -3077,6 +3090,9 @@ class Call {
|
|
|
3077
3090
|
|
|
3078
3091
|
|
|
3079
3092
|
static parseMany(plain ) {
|
|
3093
|
+
if (!plain) {
|
|
3094
|
+
return [];
|
|
3095
|
+
}
|
|
3080
3096
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3081
3097
|
}
|
|
3082
3098
|
|
|
@@ -3620,6 +3636,9 @@ class Recording {
|
|
|
3620
3636
|
|
|
3621
3637
|
|
|
3622
3638
|
static parseMany(recordings = []) {
|
|
3639
|
+
if (!recordings) {
|
|
3640
|
+
return [];
|
|
3641
|
+
}
|
|
3623
3642
|
return recordings.map(item => Recording.parse(item));
|
|
3624
3643
|
}
|
|
3625
3644
|
|
|
@@ -3721,6 +3740,10 @@ class CallLog {
|
|
|
3721
3740
|
}
|
|
3722
3741
|
|
|
3723
3742
|
static parseMany(plain ) {
|
|
3743
|
+
if (!plain || !plain.items) {
|
|
3744
|
+
return [];
|
|
3745
|
+
}
|
|
3746
|
+
|
|
3724
3747
|
return plain.items.map(item => CallLog.parse(item));
|
|
3725
3748
|
}
|
|
3726
3749
|
|
|
@@ -4290,6 +4313,10 @@ class CTIPhone extends Emitter {
|
|
|
4290
4313
|
return false;
|
|
4291
4314
|
}
|
|
4292
4315
|
|
|
4316
|
+
hasAVideoTrack() {
|
|
4317
|
+
return false;
|
|
4318
|
+
}
|
|
4319
|
+
|
|
4293
4320
|
getLocalStreamForCall() {
|
|
4294
4321
|
return null;
|
|
4295
4322
|
}
|
|
@@ -4683,6 +4710,9 @@ class ChatRoom {
|
|
|
4683
4710
|
|
|
4684
4711
|
|
|
4685
4712
|
static parseMany(plain ) {
|
|
4713
|
+
if (!plain || !plain.items) {
|
|
4714
|
+
return [];
|
|
4715
|
+
}
|
|
4686
4716
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
4687
4717
|
}
|
|
4688
4718
|
|
|
@@ -5928,10 +5958,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
5928
5958
|
candidates
|
|
5929
5959
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
5930
5960
|
|
|
5931
|
-
const areCandidateValid = (candidates ) =>
|
|
5932
|
-
getSrflxOrRelay(candidates)
|
|
5933
|
-
.length > 0;
|
|
5934
|
-
|
|
5935
5961
|
const getVideoDirection = (sdp ) => {
|
|
5936
5962
|
const parsedSdp = sdpParser.parse(sdp);
|
|
5937
5963
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
@@ -5984,8 +6010,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5984
6010
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5985
6011
|
|
|
5986
6012
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
5987
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
5988
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
5989
6013
|
|
|
5990
6014
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
5991
6015
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -6175,38 +6199,6 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
6175
6199
|
this._peerConnection = undefined;
|
|
6176
6200
|
}
|
|
6177
6201
|
|
|
6178
|
-
async _waitForValidGatheredIce() {
|
|
6179
|
-
let tries = 0;
|
|
6180
|
-
|
|
6181
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
6182
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
6183
|
-
tries,
|
|
6184
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
6185
|
-
});
|
|
6186
|
-
|
|
6187
|
-
tries++;
|
|
6188
|
-
|
|
6189
|
-
// eslint-disable-next-line no-await-in-loop
|
|
6190
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
6191
|
-
}
|
|
6192
|
-
|
|
6193
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
6194
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
6195
|
-
const error = new Error(errorMsg);
|
|
6196
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
6197
|
-
|
|
6198
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
6199
|
-
this.eventEmitter.emit('error', error);
|
|
6200
|
-
|
|
6201
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
6202
|
-
}
|
|
6203
|
-
|
|
6204
|
-
// eslint-disable-next-line
|
|
6205
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
6206
|
-
|
|
6207
|
-
return this.getLocalSessionDescription();
|
|
6208
|
-
}
|
|
6209
|
-
|
|
6210
6202
|
// Overridden to send `inactive` in conference
|
|
6211
6203
|
updateDirection(options , isConference = false,
|
|
6212
6204
|
audioOnly = false) {
|
|
@@ -8622,25 +8614,25 @@ class WebRTCClient extends Emitter {
|
|
|
8622
8614
|
|
|
8623
8615
|
stats.forEach(report => {
|
|
8624
8616
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8625
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8617
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8626
8618
|
}
|
|
8627
8619
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8628
|
-
audioBytesSent += report.bytesSent;
|
|
8620
|
+
audioBytesSent += Number(report.bytesSent);
|
|
8629
8621
|
}
|
|
8630
8622
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8631
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8623
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8632
8624
|
}
|
|
8633
8625
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8634
|
-
packetsLost += report.packetsLost;
|
|
8635
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
8636
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8626
|
+
packetsLost += Number(report.packetsLost);
|
|
8627
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8628
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8637
8629
|
}
|
|
8638
8630
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8639
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8631
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8640
8632
|
}
|
|
8641
8633
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8642
8634
|
if ('framesPerSecond' in report) {
|
|
8643
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
8635
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
8644
8636
|
}
|
|
8645
8637
|
if ('framerateMean' in report) {
|
|
8646
8638
|
// framerateMean is only available in FF
|
|
@@ -8648,16 +8640,16 @@ class WebRTCClient extends Emitter {
|
|
|
8648
8640
|
}
|
|
8649
8641
|
}
|
|
8650
8642
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8651
|
-
packetsLost += report.packetsLost;
|
|
8652
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
8653
|
-
networkStats.jitter = report.jitter;
|
|
8643
|
+
packetsLost += Number(report.packetsLost);
|
|
8644
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
8645
|
+
networkStats.jitter = Number(report.jitter);
|
|
8654
8646
|
}
|
|
8655
8647
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8656
|
-
packetsLost += report.packetsLost;
|
|
8648
|
+
packetsLost += Number(report.packetsLost);
|
|
8657
8649
|
}
|
|
8658
8650
|
if (report.type === 'transport') {
|
|
8659
|
-
transportSent += report.bytesSent;
|
|
8660
|
-
transportReceived += report.bytesReceived;
|
|
8651
|
+
transportSent += Number(report.bytesSent);
|
|
8652
|
+
transportReceived += Number(report.bytesReceived);
|
|
8661
8653
|
}
|
|
8662
8654
|
});
|
|
8663
8655
|
|
|
@@ -9243,18 +9235,20 @@ class WebRTCPhone extends Emitter {
|
|
|
9243
9235
|
screenTrack,
|
|
9244
9236
|
});
|
|
9245
9237
|
|
|
9246
|
-
|
|
9247
|
-
|
|
9248
|
-
|
|
9249
|
-
|
|
9250
|
-
|
|
9251
|
-
|
|
9238
|
+
if (screenTrack) {
|
|
9239
|
+
screenTrack.onended = () => {
|
|
9240
|
+
logger$7.info('WebRTC phone - on screenshare ended', {
|
|
9241
|
+
hadVideo,
|
|
9242
|
+
id: this.getSipSessionId(sipSession),
|
|
9243
|
+
screenTrack,
|
|
9244
|
+
});
|
|
9252
9245
|
|
|
9253
|
-
|
|
9254
|
-
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
9246
|
+
this.eventEmitter.emit(
|
|
9247
|
+
ON_SHARE_SCREEN_ENDING,
|
|
9248
|
+
this._createCallSession(sipSession, callSession),
|
|
9249
|
+
);
|
|
9250
|
+
};
|
|
9251
|
+
}
|
|
9258
9252
|
|
|
9259
9253
|
this.currentScreenShare = {
|
|
9260
9254
|
stream: screenStream,
|
package/esm/web-rtc-client.js
CHANGED
|
@@ -724,10 +724,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
724
724
|
candidates
|
|
725
725
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
726
726
|
|
|
727
|
-
const areCandidateValid = (candidates ) =>
|
|
728
|
-
getSrflxOrRelay(candidates)
|
|
729
|
-
.length > 0;
|
|
730
|
-
|
|
731
727
|
const getVideoDirection = (sdp ) => {
|
|
732
728
|
const parsedSdp = sdpParser.parse(sdp);
|
|
733
729
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
@@ -780,8 +776,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
780
776
|
/* global RTCSessionDescriptionInit, navigator */
|
|
781
777
|
|
|
782
778
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
783
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
784
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
785
779
|
|
|
786
780
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
787
781
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -971,38 +965,6 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
971
965
|
this._peerConnection = undefined;
|
|
972
966
|
}
|
|
973
967
|
|
|
974
|
-
async _waitForValidGatheredIce() {
|
|
975
|
-
let tries = 0;
|
|
976
|
-
|
|
977
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
978
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
979
|
-
tries,
|
|
980
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
981
|
-
});
|
|
982
|
-
|
|
983
|
-
tries++;
|
|
984
|
-
|
|
985
|
-
// eslint-disable-next-line no-await-in-loop
|
|
986
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
990
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
991
|
-
const error = new Error(errorMsg);
|
|
992
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
993
|
-
|
|
994
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
995
|
-
this.eventEmitter.emit('error', error);
|
|
996
|
-
|
|
997
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
// eslint-disable-next-line
|
|
1001
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
1002
|
-
|
|
1003
|
-
return this.getLocalSessionDescription();
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
968
|
// Overridden to send `inactive` in conference
|
|
1007
969
|
updateDirection(options , isConference = false,
|
|
1008
970
|
audioOnly = false) {
|
|
@@ -2112,6 +2074,9 @@ class Contact {
|
|
|
2112
2074
|
}
|
|
2113
2075
|
|
|
2114
2076
|
static parseMany(response ) {
|
|
2077
|
+
if (!response || !response.results) {
|
|
2078
|
+
return [];
|
|
2079
|
+
}
|
|
2115
2080
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
2116
2081
|
}
|
|
2117
2082
|
|
|
@@ -3219,6 +3184,9 @@ class Meeting {
|
|
|
3219
3184
|
}
|
|
3220
3185
|
|
|
3221
3186
|
static parseMany(items ) {
|
|
3187
|
+
if (!items) {
|
|
3188
|
+
return [];
|
|
3189
|
+
}
|
|
3222
3190
|
return items.map(plain => Meeting.parse(plain));
|
|
3223
3191
|
}
|
|
3224
3192
|
|
|
@@ -3421,6 +3389,10 @@ class ChatMessage {
|
|
|
3421
3389
|
|
|
3422
3390
|
|
|
3423
3391
|
static parseMany(plain ) {
|
|
3392
|
+
if (!plain || !plain.items) {
|
|
3393
|
+
return [];
|
|
3394
|
+
}
|
|
3395
|
+
|
|
3424
3396
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
3425
3397
|
}
|
|
3426
3398
|
|
|
@@ -3530,6 +3502,9 @@ class Voicemail {
|
|
|
3530
3502
|
}
|
|
3531
3503
|
|
|
3532
3504
|
static parseMany(plain ) {
|
|
3505
|
+
if (!plain) {
|
|
3506
|
+
return [];
|
|
3507
|
+
}
|
|
3533
3508
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
3534
3509
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
3535
3510
|
|
|
@@ -3639,6 +3614,9 @@ class Call {
|
|
|
3639
3614
|
|
|
3640
3615
|
|
|
3641
3616
|
static parseMany(plain ) {
|
|
3617
|
+
if (!plain) {
|
|
3618
|
+
return [];
|
|
3619
|
+
}
|
|
3642
3620
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3643
3621
|
}
|
|
3644
3622
|
|
|
@@ -3811,6 +3789,9 @@ class Recording {
|
|
|
3811
3789
|
|
|
3812
3790
|
|
|
3813
3791
|
static parseMany(recordings = []) {
|
|
3792
|
+
if (!recordings) {
|
|
3793
|
+
return [];
|
|
3794
|
+
}
|
|
3814
3795
|
return recordings.map(item => Recording.parse(item));
|
|
3815
3796
|
}
|
|
3816
3797
|
|
|
@@ -3912,6 +3893,10 @@ class CallLog {
|
|
|
3912
3893
|
}
|
|
3913
3894
|
|
|
3914
3895
|
static parseMany(plain ) {
|
|
3896
|
+
if (!plain || !plain.items) {
|
|
3897
|
+
return [];
|
|
3898
|
+
}
|
|
3899
|
+
|
|
3915
3900
|
return plain.items.map(item => CallLog.parse(item));
|
|
3916
3901
|
}
|
|
3917
3902
|
|
|
@@ -4484,6 +4469,9 @@ class ChatRoom {
|
|
|
4484
4469
|
|
|
4485
4470
|
|
|
4486
4471
|
static parseMany(plain ) {
|
|
4472
|
+
if (!plain || !plain.items) {
|
|
4473
|
+
return [];
|
|
4474
|
+
}
|
|
4487
4475
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
4488
4476
|
}
|
|
4489
4477
|
|
|
@@ -7363,25 +7351,25 @@ class WebRTCClient extends Emitter {
|
|
|
7363
7351
|
|
|
7364
7352
|
stats.forEach(report => {
|
|
7365
7353
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
7366
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
7354
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
7367
7355
|
}
|
|
7368
7356
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
7369
|
-
audioBytesSent += report.bytesSent;
|
|
7357
|
+
audioBytesSent += Number(report.bytesSent);
|
|
7370
7358
|
}
|
|
7371
7359
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
7372
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
7360
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
7373
7361
|
}
|
|
7374
7362
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
7375
|
-
packetsLost += report.packetsLost;
|
|
7376
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
7377
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
7363
|
+
packetsLost += Number(report.packetsLost);
|
|
7364
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
7365
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
7378
7366
|
}
|
|
7379
7367
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
7380
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
7368
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
7381
7369
|
}
|
|
7382
7370
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
7383
7371
|
if ('framesPerSecond' in report) {
|
|
7384
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
7372
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
7385
7373
|
}
|
|
7386
7374
|
if ('framerateMean' in report) {
|
|
7387
7375
|
// framerateMean is only available in FF
|
|
@@ -7389,16 +7377,16 @@ class WebRTCClient extends Emitter {
|
|
|
7389
7377
|
}
|
|
7390
7378
|
}
|
|
7391
7379
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
7392
|
-
packetsLost += report.packetsLost;
|
|
7393
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
7394
|
-
networkStats.jitter = report.jitter;
|
|
7380
|
+
packetsLost += Number(report.packetsLost);
|
|
7381
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
7382
|
+
networkStats.jitter = Number(report.jitter);
|
|
7395
7383
|
}
|
|
7396
7384
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
7397
|
-
packetsLost += report.packetsLost;
|
|
7385
|
+
packetsLost += Number(report.packetsLost);
|
|
7398
7386
|
}
|
|
7399
7387
|
if (report.type === 'transport') {
|
|
7400
|
-
transportSent += report.bytesSent;
|
|
7401
|
-
transportReceived += report.bytesReceived;
|
|
7388
|
+
transportSent += Number(report.bytesSent);
|
|
7389
|
+
transportReceived += Number(report.bytesReceived);
|
|
7402
7390
|
}
|
|
7403
7391
|
});
|
|
7404
7392
|
|
|
@@ -1537,6 +1537,9 @@ class Contact {
|
|
|
1537
1537
|
}
|
|
1538
1538
|
|
|
1539
1539
|
static parseMany(response ) {
|
|
1540
|
+
if (!response || !response.results) {
|
|
1541
|
+
return [];
|
|
1542
|
+
}
|
|
1540
1543
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
1541
1544
|
}
|
|
1542
1545
|
|
|
@@ -2644,6 +2647,9 @@ class Meeting {
|
|
|
2644
2647
|
}
|
|
2645
2648
|
|
|
2646
2649
|
static parseMany(items ) {
|
|
2650
|
+
if (!items) {
|
|
2651
|
+
return [];
|
|
2652
|
+
}
|
|
2647
2653
|
return items.map(plain => Meeting.parse(plain));
|
|
2648
2654
|
}
|
|
2649
2655
|
|
|
@@ -2846,6 +2852,10 @@ class ChatMessage {
|
|
|
2846
2852
|
|
|
2847
2853
|
|
|
2848
2854
|
static parseMany(plain ) {
|
|
2855
|
+
if (!plain || !plain.items) {
|
|
2856
|
+
return [];
|
|
2857
|
+
}
|
|
2858
|
+
|
|
2849
2859
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2850
2860
|
}
|
|
2851
2861
|
|
|
@@ -2955,6 +2965,9 @@ class Voicemail {
|
|
|
2955
2965
|
}
|
|
2956
2966
|
|
|
2957
2967
|
static parseMany(plain ) {
|
|
2968
|
+
if (!plain) {
|
|
2969
|
+
return [];
|
|
2970
|
+
}
|
|
2958
2971
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2959
2972
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2960
2973
|
|
|
@@ -3064,6 +3077,9 @@ class Call {
|
|
|
3064
3077
|
|
|
3065
3078
|
|
|
3066
3079
|
static parseMany(plain ) {
|
|
3080
|
+
if (!plain) {
|
|
3081
|
+
return [];
|
|
3082
|
+
}
|
|
3067
3083
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3068
3084
|
}
|
|
3069
3085
|
|
|
@@ -3236,6 +3252,9 @@ class Recording {
|
|
|
3236
3252
|
|
|
3237
3253
|
|
|
3238
3254
|
static parseMany(recordings = []) {
|
|
3255
|
+
if (!recordings) {
|
|
3256
|
+
return [];
|
|
3257
|
+
}
|
|
3239
3258
|
return recordings.map(item => Recording.parse(item));
|
|
3240
3259
|
}
|
|
3241
3260
|
|
|
@@ -3337,6 +3356,10 @@ class CallLog {
|
|
|
3337
3356
|
}
|
|
3338
3357
|
|
|
3339
3358
|
static parseMany(plain ) {
|
|
3359
|
+
if (!plain || !plain.items) {
|
|
3360
|
+
return [];
|
|
3361
|
+
}
|
|
3362
|
+
|
|
3340
3363
|
return plain.items.map(item => CallLog.parse(item));
|
|
3341
3364
|
}
|
|
3342
3365
|
|
|
@@ -3909,6 +3932,9 @@ class ChatRoom {
|
|
|
3909
3932
|
|
|
3910
3933
|
|
|
3911
3934
|
static parseMany(plain ) {
|
|
3935
|
+
if (!plain || !plain.items) {
|
|
3936
|
+
return [];
|
|
3937
|
+
}
|
|
3912
3938
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
3913
3939
|
}
|
|
3914
3940
|
|