@wazo/sdk 0.37.22 → 0.37.26
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 +37 -6
- package/esm/__tests__/web-rtc-client.test.js +78 -68
- 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 +13 -5
- package/esm/api/ctid-ng.js +10 -0
- package/esm/api/dird.js +4 -1
- package/esm/api-client.js +37 -6
- package/esm/checker/Checker.js +78 -68
- package/esm/checker/checks/aor.js +37 -6
- package/esm/checker/checks/api.js +37 -6
- package/esm/checker/checks/index.js +78 -68
- package/esm/checker/checks/webrtc-transport.js +78 -68
- package/esm/checker/checks/webrtc.js +78 -68
- package/esm/domain/AdHocAPIConference.js +37 -6
- 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 +4 -1
- package/esm/domain/Features.js +37 -6
- package/esm/domain/Meeting.js +15 -5
- package/esm/domain/Phone/CTIPhone.js +41 -6
- package/esm/domain/Phone/WebRTCPhone.js +41 -15
- 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 +4 -1
- package/esm/domain/__tests__/Meeting.test.js +144 -0
- package/esm/domain/__tests__/Voicemail.test.js +3 -0
- package/esm/index.js +122 -82
- package/esm/lib/WazoSessionDescriptionHandler.js +0 -38
- package/esm/service/CallApi.js +37 -6
- package/esm/service/getApiClient.js +37 -6
- package/esm/simple/Auth.js +122 -82
- package/esm/simple/Configuration.js +122 -82
- package/esm/simple/Directory.js +37 -6
- package/esm/simple/Phone.js +122 -82
- package/esm/simple/index.js +122 -82
- package/esm/simple/room/LocalParticipant.js +122 -82
- package/esm/simple/room/Participant.js +122 -82
- package/esm/simple/room/RemoteParticipant.js +122 -82
- package/esm/simple/room/Room.js +122 -82
- package/esm/simple/room/SipRoom.js +122 -82
- package/esm/simple/room/Stream.js +122 -82
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +122 -82
- package/esm/simple/utils.js +122 -82
- package/esm/types/WebSocketMessage.js +1 -1
- package/esm/web-rtc-client.js +78 -68
- package/lib/__tests__/api-client.test.js +37 -6
- package/lib/__tests__/web-rtc-client.test.js +78 -68
- 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 +13 -5
- package/lib/api/ctid-ng.js +10 -0
- package/lib/api/dird.js +4 -1
- package/lib/api-client.js +37 -6
- package/lib/checker/Checker.js +78 -68
- package/lib/checker/checks/aor.js +37 -6
- package/lib/checker/checks/api.js +37 -6
- package/lib/checker/checks/index.js +78 -68
- package/lib/checker/checks/webrtc-transport.js +78 -68
- package/lib/checker/checks/webrtc.js +78 -68
- package/lib/domain/AdHocAPIConference.js +37 -6
- 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 +4 -1
- package/lib/domain/Features.js +37 -6
- package/lib/domain/Meeting.js +19 -5
- package/lib/domain/Phone/CTIPhone.js +41 -6
- package/lib/domain/Phone/WebRTCPhone.js +41 -15
- 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 +4 -1
- package/lib/domain/__tests__/Meeting.test.js +150 -0
- package/lib/domain/__tests__/Voicemail.test.js +3 -0
- package/lib/index.js +122 -82
- package/lib/lib/WazoSessionDescriptionHandler.js +0 -38
- package/lib/service/CallApi.js +37 -6
- package/lib/service/getApiClient.js +37 -6
- package/lib/simple/Auth.js +122 -82
- package/lib/simple/Configuration.js +122 -82
- package/lib/simple/Directory.js +37 -6
- package/lib/simple/Phone.js +122 -82
- package/lib/simple/index.js +122 -82
- package/lib/simple/room/LocalParticipant.js +122 -82
- package/lib/simple/room/Participant.js +122 -82
- package/lib/simple/room/RemoteParticipant.js +122 -82
- package/lib/simple/room/Room.js +122 -82
- package/lib/simple/room/SipRoom.js +122 -82
- package/lib/simple/room/Stream.js +122 -82
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +122 -82
- package/lib/simple/utils.js +122 -82
- package/lib/types/WebSocketMessage.js +2 -0
- package/lib/web-rtc-client.js +78 -68
- 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 +4 -1
- package/src/domain/Meeting.js +15 -5
- package/src/domain/Phone/CTIPhone.js +4 -0
- package/src/domain/Phone/Phone.js +2 -0
- package/src/domain/Phone/WebRTCPhone.js +41 -15
- package/src/domain/Recording.js +3 -0
- package/src/domain/Voicemail.js +3 -0
- package/src/domain/__tests__/Meeting.test.js +50 -0
- package/src/lib/WazoSessionDescriptionHandler.js +1 -35
- package/src/web-rtc-client.js +41 -24
|
@@ -733,10 +733,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
733
733
|
candidates
|
|
734
734
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
735
735
|
|
|
736
|
-
const areCandidateValid = (candidates ) =>
|
|
737
|
-
getSrflxOrRelay(candidates)
|
|
738
|
-
.length > 0;
|
|
739
|
-
|
|
740
736
|
const getVideoDirection = (sdp ) => {
|
|
741
737
|
const parsedSdp = sdpParser__default['default'].parse(sdp);
|
|
742
738
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
@@ -789,8 +785,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
789
785
|
/* global RTCSessionDescriptionInit, navigator */
|
|
790
786
|
|
|
791
787
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
792
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
793
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
794
788
|
|
|
795
789
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
796
790
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -980,38 +974,6 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
980
974
|
this._peerConnection = undefined;
|
|
981
975
|
}
|
|
982
976
|
|
|
983
|
-
async _waitForValidGatheredIce() {
|
|
984
|
-
let tries = 0;
|
|
985
|
-
|
|
986
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
987
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
988
|
-
tries,
|
|
989
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
990
|
-
});
|
|
991
|
-
|
|
992
|
-
tries++;
|
|
993
|
-
|
|
994
|
-
// eslint-disable-next-line no-await-in-loop
|
|
995
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
996
|
-
}
|
|
997
|
-
|
|
998
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
999
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
1000
|
-
const error = new Error(errorMsg);
|
|
1001
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
1002
|
-
|
|
1003
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
1004
|
-
this.eventEmitter.emit('error', error);
|
|
1005
|
-
|
|
1006
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
// eslint-disable-next-line
|
|
1010
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
1011
|
-
|
|
1012
|
-
return this.getLocalSessionDescription();
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
977
|
// Overridden to send `inactive` in conference
|
|
1016
978
|
updateDirection(options , isConference = false,
|
|
1017
979
|
audioOnly = false) {
|
|
@@ -2121,6 +2083,9 @@ class Contact {
|
|
|
2121
2083
|
}
|
|
2122
2084
|
|
|
2123
2085
|
static parseMany(response ) {
|
|
2086
|
+
if (!response || !response.results) {
|
|
2087
|
+
return [];
|
|
2088
|
+
}
|
|
2124
2089
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
2125
2090
|
}
|
|
2126
2091
|
|
|
@@ -2491,7 +2456,7 @@ class Contact {
|
|
|
2491
2456
|
this[key] = old[key] || this[key];
|
|
2492
2457
|
});
|
|
2493
2458
|
|
|
2494
|
-
if (old.lineState
|
|
2459
|
+
if (old.lineState) {
|
|
2495
2460
|
this.lineState = old.lineState;
|
|
2496
2461
|
}
|
|
2497
2462
|
|
|
@@ -3198,8 +3163,9 @@ class ExternalApp {
|
|
|
3198
3163
|
|
|
3199
3164
|
|
|
3200
3165
|
|
|
3201
|
-
|
|
3166
|
+
|
|
3202
3167
|
|
|
3168
|
+
|
|
3203
3169
|
|
|
3204
3170
|
|
|
3205
3171
|
class Meeting {
|
|
@@ -3210,9 +3176,10 @@ class Meeting {
|
|
|
3210
3176
|
|
|
3211
3177
|
|
|
3212
3178
|
|
|
3213
|
-
|
|
3179
|
+
|
|
3214
3180
|
|
|
3215
3181
|
|
|
3182
|
+
|
|
3216
3183
|
|
|
3217
3184
|
static parse(plain ) {
|
|
3218
3185
|
return new Meeting({
|
|
@@ -3222,12 +3189,16 @@ class Meeting {
|
|
|
3222
3189
|
ownerUuids: plain.owner_uuids,
|
|
3223
3190
|
port: plain.port,
|
|
3224
3191
|
uuid: plain.uuid,
|
|
3225
|
-
|
|
3192
|
+
extension: plain.exten,
|
|
3226
3193
|
persistent: plain.persistent,
|
|
3194
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
3227
3195
|
});
|
|
3228
3196
|
}
|
|
3229
3197
|
|
|
3230
3198
|
static parseMany(items ) {
|
|
3199
|
+
if (!items) {
|
|
3200
|
+
return [];
|
|
3201
|
+
}
|
|
3231
3202
|
return items.map(plain => Meeting.parse(plain));
|
|
3232
3203
|
}
|
|
3233
3204
|
|
|
@@ -3242,8 +3213,9 @@ class Meeting {
|
|
|
3242
3213
|
ownerUuids,
|
|
3243
3214
|
port,
|
|
3244
3215
|
uri,
|
|
3245
|
-
|
|
3216
|
+
extension,
|
|
3246
3217
|
persistent,
|
|
3218
|
+
creationTime,
|
|
3247
3219
|
} = {}) {
|
|
3248
3220
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
3249
3221
|
this.uri = uri;
|
|
@@ -3251,8 +3223,9 @@ class Meeting {
|
|
|
3251
3223
|
this.ownerUuids = ownerUuids;
|
|
3252
3224
|
this.port = port;
|
|
3253
3225
|
this.uuid = uuid;
|
|
3254
|
-
this.
|
|
3226
|
+
this.extension = extension;
|
|
3255
3227
|
this.persistent = persistent;
|
|
3228
|
+
this.creationTime = creationTime;
|
|
3256
3229
|
|
|
3257
3230
|
// Useful to compare instead of instanceof with minified code
|
|
3258
3231
|
this.type = 'Meeting';
|
|
@@ -3430,6 +3403,10 @@ class ChatMessage {
|
|
|
3430
3403
|
|
|
3431
3404
|
|
|
3432
3405
|
static parseMany(plain ) {
|
|
3406
|
+
if (!plain || !plain.items) {
|
|
3407
|
+
return [];
|
|
3408
|
+
}
|
|
3409
|
+
|
|
3433
3410
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
3434
3411
|
}
|
|
3435
3412
|
|
|
@@ -3539,6 +3516,9 @@ class Voicemail {
|
|
|
3539
3516
|
}
|
|
3540
3517
|
|
|
3541
3518
|
static parseMany(plain ) {
|
|
3519
|
+
if (!plain) {
|
|
3520
|
+
return [];
|
|
3521
|
+
}
|
|
3542
3522
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
3543
3523
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
3544
3524
|
|
|
@@ -3648,6 +3628,9 @@ class Call {
|
|
|
3648
3628
|
|
|
3649
3629
|
|
|
3650
3630
|
static parseMany(plain ) {
|
|
3631
|
+
if (!plain) {
|
|
3632
|
+
return [];
|
|
3633
|
+
}
|
|
3651
3634
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3652
3635
|
}
|
|
3653
3636
|
|
|
@@ -3820,6 +3803,9 @@ class Recording {
|
|
|
3820
3803
|
|
|
3821
3804
|
|
|
3822
3805
|
static parseMany(recordings = []) {
|
|
3806
|
+
if (!recordings) {
|
|
3807
|
+
return [];
|
|
3808
|
+
}
|
|
3823
3809
|
return recordings.map(item => Recording.parse(item));
|
|
3824
3810
|
}
|
|
3825
3811
|
|
|
@@ -3921,6 +3907,10 @@ class CallLog {
|
|
|
3921
3907
|
}
|
|
3922
3908
|
|
|
3923
3909
|
static parseMany(plain ) {
|
|
3910
|
+
if (!plain || !plain.items) {
|
|
3911
|
+
return [];
|
|
3912
|
+
}
|
|
3913
|
+
|
|
3924
3914
|
return plain.items.map(item => CallLog.parse(item));
|
|
3925
3915
|
}
|
|
3926
3916
|
|
|
@@ -4493,6 +4483,9 @@ class ChatRoom {
|
|
|
4493
4483
|
|
|
4494
4484
|
|
|
4495
4485
|
static parseMany(plain ) {
|
|
4486
|
+
if (!plain || !plain.items) {
|
|
4487
|
+
return [];
|
|
4488
|
+
}
|
|
4496
4489
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
4497
4490
|
}
|
|
4498
4491
|
|
|
@@ -5721,7 +5714,7 @@ class WebRTCClient extends Emitter {
|
|
|
5721
5714
|
}
|
|
5722
5715
|
|
|
5723
5716
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
5724
|
-
logger.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
5717
|
+
logger.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
|
|
5725
5718
|
const inviterOptions = {
|
|
5726
5719
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
5727
5720
|
conference,
|
|
@@ -6797,6 +6790,7 @@ class WebRTCClient extends Emitter {
|
|
|
6797
6790
|
const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
|
|
6798
6791
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
6799
6792
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
6793
|
+
const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
|
|
6800
6794
|
|
|
6801
6795
|
logger.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
6802
6796
|
|
|
@@ -6804,7 +6798,8 @@ class WebRTCClient extends Emitter {
|
|
|
6804
6798
|
constraints: {
|
|
6805
6799
|
// Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
|
|
6806
6800
|
audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
|
|
6807
|
-
video: screenSharing ? (isDesktop
|
|
6801
|
+
video: screenSharing ? (isDesktop
|
|
6802
|
+
? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
|
|
6808
6803
|
: this._getVideoConstraints(enableVideo),
|
|
6809
6804
|
screen: screenSharing,
|
|
6810
6805
|
desktop: isDesktop,
|
|
@@ -7139,12 +7134,14 @@ class WebRTCClient extends Emitter {
|
|
|
7139
7134
|
|
|
7140
7135
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
7141
7136
|
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7137
|
+
if (pc) {
|
|
7138
|
+
pc.oniceconnectionstatechange = () => {
|
|
7139
|
+
logger.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
7140
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
7141
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
7142
|
+
}
|
|
7143
|
+
};
|
|
7144
|
+
}
|
|
7148
7145
|
|
|
7149
7146
|
if (withEvent) {
|
|
7150
7147
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -7354,13 +7351,17 @@ class WebRTCClient extends Emitter {
|
|
|
7354
7351
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
7355
7352
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
7356
7353
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
7354
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
7357
7355
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
7358
7356
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
7357
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
7359
7358
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
7360
7359
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
7361
7360
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
7362
|
-
let audioBytesSent = 0;
|
|
7363
|
-
let audioBytesReceived = 0;
|
|
7361
|
+
let audioBytesSent = 0; // content + header
|
|
7362
|
+
let audioBytesReceived = 0; // content + header
|
|
7363
|
+
let audioContentSent = 0; // useful to detect blank call
|
|
7364
|
+
let audioContentReceived = 0;
|
|
7364
7365
|
let videoBytesSent = 0;
|
|
7365
7366
|
let videoBytesReceived = 0;
|
|
7366
7367
|
let transportSent = 0;
|
|
@@ -7369,25 +7370,27 @@ class WebRTCClient extends Emitter {
|
|
|
7369
7370
|
|
|
7370
7371
|
stats.forEach(report => {
|
|
7371
7372
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
7372
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
7373
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
7374
|
+
audioContentSent += Number(report.bytesSent);
|
|
7373
7375
|
}
|
|
7374
7376
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
7375
|
-
audioBytesSent += report.bytesSent;
|
|
7377
|
+
audioBytesSent += Number(report.bytesSent);
|
|
7376
7378
|
}
|
|
7377
7379
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
7378
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
7380
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
7379
7381
|
}
|
|
7380
7382
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
7381
|
-
packetsLost += report.packetsLost;
|
|
7382
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
7383
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
7383
|
+
packetsLost += Number(report.packetsLost);
|
|
7384
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
7385
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
7386
|
+
audioContentReceived += Number(report.bytesReceived);
|
|
7384
7387
|
}
|
|
7385
7388
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
7386
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
7389
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
7387
7390
|
}
|
|
7388
7391
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
7389
7392
|
if ('framesPerSecond' in report) {
|
|
7390
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
7393
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
7391
7394
|
}
|
|
7392
7395
|
if ('framerateMean' in report) {
|
|
7393
7396
|
// framerateMean is only available in FF
|
|
@@ -7395,24 +7398,31 @@ class WebRTCClient extends Emitter {
|
|
|
7395
7398
|
}
|
|
7396
7399
|
}
|
|
7397
7400
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
7398
|
-
packetsLost += report.packetsLost;
|
|
7399
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
7400
|
-
networkStats.jitter = report.jitter;
|
|
7401
|
+
packetsLost += Number(report.packetsLost);
|
|
7402
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
7403
|
+
networkStats.jitter = Number(report.jitter);
|
|
7401
7404
|
}
|
|
7402
7405
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
7403
|
-
packetsLost += report.packetsLost;
|
|
7406
|
+
packetsLost += Number(report.packetsLost);
|
|
7404
7407
|
}
|
|
7405
7408
|
if (report.type === 'transport') {
|
|
7406
|
-
transportSent += report.bytesSent;
|
|
7407
|
-
transportReceived += report.bytesReceived;
|
|
7409
|
+
transportSent += Number(report.bytesSent);
|
|
7410
|
+
transportReceived += Number(report.bytesReceived);
|
|
7408
7411
|
}
|
|
7409
7412
|
});
|
|
7410
7413
|
|
|
7411
7414
|
networkStats.packetsLost = packetsLost;
|
|
7415
|
+
|
|
7412
7416
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
7413
7417
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
7414
7418
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
7415
7419
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
7420
|
+
|
|
7421
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
7422
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
7423
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
7424
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
7425
|
+
|
|
7416
7426
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
7417
7427
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
7418
7428
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
package/lib/api/call-logd.js
CHANGED
|
@@ -450,6 +450,9 @@ class Recording {
|
|
|
450
450
|
|
|
451
451
|
|
|
452
452
|
static parseMany(recordings = []) {
|
|
453
|
+
if (!recordings) {
|
|
454
|
+
return [];
|
|
455
|
+
}
|
|
453
456
|
return recordings.map(item => Recording.parse(item));
|
|
454
457
|
}
|
|
455
458
|
|
|
@@ -551,6 +554,10 @@ class CallLog {
|
|
|
551
554
|
}
|
|
552
555
|
|
|
553
556
|
static parseMany(plain ) {
|
|
557
|
+
if (!plain || !plain.items) {
|
|
558
|
+
return [];
|
|
559
|
+
}
|
|
560
|
+
|
|
554
561
|
return plain.items.map(item => CallLog.parse(item));
|
|
555
562
|
}
|
|
556
563
|
|
package/lib/api/calld.js
CHANGED
|
@@ -790,6 +790,10 @@ class ChatMessage {
|
|
|
790
790
|
|
|
791
791
|
|
|
792
792
|
static parseMany(plain ) {
|
|
793
|
+
if (!plain || !plain.items) {
|
|
794
|
+
return [];
|
|
795
|
+
}
|
|
796
|
+
|
|
793
797
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
794
798
|
}
|
|
795
799
|
|
|
@@ -899,6 +903,9 @@ class Voicemail {
|
|
|
899
903
|
}
|
|
900
904
|
|
|
901
905
|
static parseMany(plain ) {
|
|
906
|
+
if (!plain) {
|
|
907
|
+
return [];
|
|
908
|
+
}
|
|
902
909
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
903
910
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
904
911
|
|
|
@@ -1008,6 +1015,9 @@ class Call {
|
|
|
1008
1015
|
|
|
1009
1016
|
|
|
1010
1017
|
static parseMany(plain ) {
|
|
1018
|
+
if (!plain) {
|
|
1019
|
+
return [];
|
|
1020
|
+
}
|
|
1011
1021
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
1012
1022
|
}
|
|
1013
1023
|
|
package/lib/api/chatd.js
CHANGED
|
@@ -1109,6 +1109,9 @@ class ChatRoom {
|
|
|
1109
1109
|
|
|
1110
1110
|
|
|
1111
1111
|
static parseMany(plain ) {
|
|
1112
|
+
if (!plain || !plain.items) {
|
|
1113
|
+
return [];
|
|
1114
|
+
}
|
|
1112
1115
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
1113
1116
|
}
|
|
1114
1117
|
|
|
@@ -1175,6 +1178,10 @@ class ChatMessage {
|
|
|
1175
1178
|
|
|
1176
1179
|
|
|
1177
1180
|
static parseMany(plain ) {
|
|
1181
|
+
if (!plain || !plain.items) {
|
|
1182
|
+
return [];
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1178
1185
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
1179
1186
|
}
|
|
1180
1187
|
|
package/lib/api/confd.js
CHANGED
|
@@ -1288,8 +1288,9 @@ class ExternalApp {
|
|
|
1288
1288
|
|
|
1289
1289
|
|
|
1290
1290
|
|
|
1291
|
-
|
|
1291
|
+
|
|
1292
1292
|
|
|
1293
|
+
|
|
1293
1294
|
|
|
1294
1295
|
|
|
1295
1296
|
class Meeting {
|
|
@@ -1300,9 +1301,10 @@ class Meeting {
|
|
|
1300
1301
|
|
|
1301
1302
|
|
|
1302
1303
|
|
|
1303
|
-
|
|
1304
|
+
|
|
1304
1305
|
|
|
1305
1306
|
|
|
1307
|
+
|
|
1306
1308
|
|
|
1307
1309
|
static parse(plain ) {
|
|
1308
1310
|
return new Meeting({
|
|
@@ -1312,12 +1314,16 @@ class Meeting {
|
|
|
1312
1314
|
ownerUuids: plain.owner_uuids,
|
|
1313
1315
|
port: plain.port,
|
|
1314
1316
|
uuid: plain.uuid,
|
|
1315
|
-
|
|
1317
|
+
extension: plain.exten,
|
|
1316
1318
|
persistent: plain.persistent,
|
|
1319
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
1317
1320
|
});
|
|
1318
1321
|
}
|
|
1319
1322
|
|
|
1320
1323
|
static parseMany(items ) {
|
|
1324
|
+
if (!items) {
|
|
1325
|
+
return [];
|
|
1326
|
+
}
|
|
1321
1327
|
return items.map(plain => Meeting.parse(plain));
|
|
1322
1328
|
}
|
|
1323
1329
|
|
|
@@ -1332,8 +1338,9 @@ class Meeting {
|
|
|
1332
1338
|
ownerUuids,
|
|
1333
1339
|
port,
|
|
1334
1340
|
uri,
|
|
1335
|
-
|
|
1341
|
+
extension,
|
|
1336
1342
|
persistent,
|
|
1343
|
+
creationTime,
|
|
1337
1344
|
} = {}) {
|
|
1338
1345
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
1339
1346
|
this.uri = uri;
|
|
@@ -1341,8 +1348,9 @@ class Meeting {
|
|
|
1341
1348
|
this.ownerUuids = ownerUuids;
|
|
1342
1349
|
this.port = port;
|
|
1343
1350
|
this.uuid = uuid;
|
|
1344
|
-
this.
|
|
1351
|
+
this.extension = extension;
|
|
1345
1352
|
this.persistent = persistent;
|
|
1353
|
+
this.creationTime = creationTime;
|
|
1346
1354
|
|
|
1347
1355
|
// Useful to compare instead of instanceof with minified code
|
|
1348
1356
|
this.type = 'Meeting';
|
package/lib/api/ctid-ng.js
CHANGED
|
@@ -793,6 +793,10 @@ class ChatMessage {
|
|
|
793
793
|
|
|
794
794
|
|
|
795
795
|
static parseMany(plain ) {
|
|
796
|
+
if (!plain || !plain.items) {
|
|
797
|
+
return [];
|
|
798
|
+
}
|
|
799
|
+
|
|
796
800
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
797
801
|
}
|
|
798
802
|
|
|
@@ -902,6 +906,9 @@ class Voicemail {
|
|
|
902
906
|
}
|
|
903
907
|
|
|
904
908
|
static parseMany(plain ) {
|
|
909
|
+
if (!plain) {
|
|
910
|
+
return [];
|
|
911
|
+
}
|
|
905
912
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
906
913
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
907
914
|
|
|
@@ -1011,6 +1018,9 @@ class Call {
|
|
|
1011
1018
|
|
|
1012
1019
|
|
|
1013
1020
|
static parseMany(plain ) {
|
|
1021
|
+
if (!plain) {
|
|
1022
|
+
return [];
|
|
1023
|
+
}
|
|
1014
1024
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
1015
1025
|
}
|
|
1016
1026
|
|
package/lib/api/dird.js
CHANGED
|
@@ -1021,6 +1021,9 @@ class Contact {
|
|
|
1021
1021
|
}
|
|
1022
1022
|
|
|
1023
1023
|
static parseMany(response ) {
|
|
1024
|
+
if (!response || !response.results) {
|
|
1025
|
+
return [];
|
|
1026
|
+
}
|
|
1024
1027
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
1025
1028
|
}
|
|
1026
1029
|
|
|
@@ -1391,7 +1394,7 @@ class Contact {
|
|
|
1391
1394
|
this[key] = old[key] || this[key];
|
|
1392
1395
|
});
|
|
1393
1396
|
|
|
1394
|
-
if (old.lineState
|
|
1397
|
+
if (old.lineState) {
|
|
1395
1398
|
this.lineState = old.lineState;
|
|
1396
1399
|
}
|
|
1397
1400
|
|
package/lib/api-client.js
CHANGED
|
@@ -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
|
|
|
@@ -1907,7 +1910,7 @@ class Contact {
|
|
|
1907
1910
|
this[key] = old[key] || this[key];
|
|
1908
1911
|
});
|
|
1909
1912
|
|
|
1910
|
-
if (old.lineState
|
|
1913
|
+
if (old.lineState) {
|
|
1911
1914
|
this.lineState = old.lineState;
|
|
1912
1915
|
}
|
|
1913
1916
|
|
|
@@ -2614,8 +2617,9 @@ class ExternalApp {
|
|
|
2614
2617
|
|
|
2615
2618
|
|
|
2616
2619
|
|
|
2617
|
-
|
|
2620
|
+
|
|
2618
2621
|
|
|
2622
|
+
|
|
2619
2623
|
|
|
2620
2624
|
|
|
2621
2625
|
class Meeting {
|
|
@@ -2626,9 +2630,10 @@ class Meeting {
|
|
|
2626
2630
|
|
|
2627
2631
|
|
|
2628
2632
|
|
|
2629
|
-
|
|
2633
|
+
|
|
2630
2634
|
|
|
2631
2635
|
|
|
2636
|
+
|
|
2632
2637
|
|
|
2633
2638
|
static parse(plain ) {
|
|
2634
2639
|
return new Meeting({
|
|
@@ -2638,12 +2643,16 @@ class Meeting {
|
|
|
2638
2643
|
ownerUuids: plain.owner_uuids,
|
|
2639
2644
|
port: plain.port,
|
|
2640
2645
|
uuid: plain.uuid,
|
|
2641
|
-
|
|
2646
|
+
extension: plain.exten,
|
|
2642
2647
|
persistent: plain.persistent,
|
|
2648
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
2643
2649
|
});
|
|
2644
2650
|
}
|
|
2645
2651
|
|
|
2646
2652
|
static parseMany(items ) {
|
|
2653
|
+
if (!items) {
|
|
2654
|
+
return [];
|
|
2655
|
+
}
|
|
2647
2656
|
return items.map(plain => Meeting.parse(plain));
|
|
2648
2657
|
}
|
|
2649
2658
|
|
|
@@ -2658,8 +2667,9 @@ class Meeting {
|
|
|
2658
2667
|
ownerUuids,
|
|
2659
2668
|
port,
|
|
2660
2669
|
uri,
|
|
2661
|
-
|
|
2670
|
+
extension,
|
|
2662
2671
|
persistent,
|
|
2672
|
+
creationTime,
|
|
2663
2673
|
} = {}) {
|
|
2664
2674
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2665
2675
|
this.uri = uri;
|
|
@@ -2667,8 +2677,9 @@ class Meeting {
|
|
|
2667
2677
|
this.ownerUuids = ownerUuids;
|
|
2668
2678
|
this.port = port;
|
|
2669
2679
|
this.uuid = uuid;
|
|
2670
|
-
this.
|
|
2680
|
+
this.extension = extension;
|
|
2671
2681
|
this.persistent = persistent;
|
|
2682
|
+
this.creationTime = creationTime;
|
|
2672
2683
|
|
|
2673
2684
|
// Useful to compare instead of instanceof with minified code
|
|
2674
2685
|
this.type = 'Meeting';
|
|
@@ -2846,6 +2857,10 @@ class ChatMessage {
|
|
|
2846
2857
|
|
|
2847
2858
|
|
|
2848
2859
|
static parseMany(plain ) {
|
|
2860
|
+
if (!plain || !plain.items) {
|
|
2861
|
+
return [];
|
|
2862
|
+
}
|
|
2863
|
+
|
|
2849
2864
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2850
2865
|
}
|
|
2851
2866
|
|
|
@@ -2955,6 +2970,9 @@ class Voicemail {
|
|
|
2955
2970
|
}
|
|
2956
2971
|
|
|
2957
2972
|
static parseMany(plain ) {
|
|
2973
|
+
if (!plain) {
|
|
2974
|
+
return [];
|
|
2975
|
+
}
|
|
2958
2976
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2959
2977
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2960
2978
|
|
|
@@ -3064,6 +3082,9 @@ class Call {
|
|
|
3064
3082
|
|
|
3065
3083
|
|
|
3066
3084
|
static parseMany(plain ) {
|
|
3085
|
+
if (!plain) {
|
|
3086
|
+
return [];
|
|
3087
|
+
}
|
|
3067
3088
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3068
3089
|
}
|
|
3069
3090
|
|
|
@@ -3236,6 +3257,9 @@ class Recording {
|
|
|
3236
3257
|
|
|
3237
3258
|
|
|
3238
3259
|
static parseMany(recordings = []) {
|
|
3260
|
+
if (!recordings) {
|
|
3261
|
+
return [];
|
|
3262
|
+
}
|
|
3239
3263
|
return recordings.map(item => Recording.parse(item));
|
|
3240
3264
|
}
|
|
3241
3265
|
|
|
@@ -3337,6 +3361,10 @@ class CallLog {
|
|
|
3337
3361
|
}
|
|
3338
3362
|
|
|
3339
3363
|
static parseMany(plain ) {
|
|
3364
|
+
if (!plain || !plain.items) {
|
|
3365
|
+
return [];
|
|
3366
|
+
}
|
|
3367
|
+
|
|
3340
3368
|
return plain.items.map(item => CallLog.parse(item));
|
|
3341
3369
|
}
|
|
3342
3370
|
|
|
@@ -3909,6 +3937,9 @@ class ChatRoom {
|
|
|
3909
3937
|
|
|
3910
3938
|
|
|
3911
3939
|
static parseMany(plain ) {
|
|
3940
|
+
if (!plain || !plain.items) {
|
|
3941
|
+
return [];
|
|
3942
|
+
}
|
|
3912
3943
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
3913
3944
|
}
|
|
3914
3945
|
|