@wazo/sdk 0.37.21 → 0.37.25
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 +36 -5
- package/esm/__tests__/web-rtc-client.test.js +77 -66
- 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 +3 -0
- package/esm/api-client.js +36 -5
- package/esm/checker/Checker.js +77 -66
- package/esm/checker/checks/aor.js +36 -5
- package/esm/checker/checks/api.js +36 -5
- package/esm/checker/checks/index.js +77 -66
- package/esm/checker/checks/webrtc-transport.js +77 -66
- package/esm/checker/checks/webrtc.js +77 -66
- package/esm/domain/AdHocAPIConference.js +36 -5
- 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 +36 -5
- package/esm/domain/Meeting.js +15 -5
- package/esm/domain/Phone/CTIPhone.js +40 -5
- package/esm/domain/Phone/WebRTCPhone.js +45 -16
- 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__/Meeting.test.js +144 -0
- package/esm/domain/__tests__/Voicemail.test.js +3 -0
- package/esm/index.js +125 -81
- package/esm/lib/WazoSessionDescriptionHandler.js +0 -38
- package/esm/service/CallApi.js +36 -5
- package/esm/service/getApiClient.js +36 -5
- package/esm/simple/Auth.js +125 -81
- package/esm/simple/Configuration.js +125 -81
- package/esm/simple/Directory.js +36 -5
- package/esm/simple/Phone.js +125 -81
- package/esm/simple/index.js +125 -81
- package/esm/simple/room/LocalParticipant.js +125 -81
- package/esm/simple/room/Participant.js +125 -81
- package/esm/simple/room/RemoteParticipant.js +125 -81
- package/esm/simple/room/Room.js +125 -81
- package/esm/simple/room/SipRoom.js +125 -81
- package/esm/simple/room/Stream.js +125 -81
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +125 -81
- package/esm/simple/utils.js +125 -81
- package/esm/types/WebSocketMessage.js +1 -1
- package/esm/web-rtc-client.js +77 -66
- package/lib/__tests__/api-client.test.js +36 -5
- package/lib/__tests__/web-rtc-client.test.js +77 -66
- 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 +3 -0
- package/lib/api-client.js +36 -5
- package/lib/checker/Checker.js +77 -66
- package/lib/checker/checks/aor.js +36 -5
- package/lib/checker/checks/api.js +36 -5
- package/lib/checker/checks/index.js +77 -66
- package/lib/checker/checks/webrtc-transport.js +77 -66
- package/lib/checker/checks/webrtc.js +77 -66
- package/lib/domain/AdHocAPIConference.js +36 -5
- 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 +36 -5
- package/lib/domain/Meeting.js +19 -5
- package/lib/domain/Phone/CTIPhone.js +40 -5
- package/lib/domain/Phone/WebRTCPhone.js +45 -16
- 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__/Meeting.test.js +150 -0
- package/lib/domain/__tests__/Voicemail.test.js +3 -0
- package/lib/index.js +125 -81
- package/lib/lib/WazoSessionDescriptionHandler.js +0 -38
- package/lib/service/CallApi.js +36 -5
- package/lib/service/getApiClient.js +36 -5
- package/lib/simple/Auth.js +125 -81
- package/lib/simple/Configuration.js +125 -81
- package/lib/simple/Directory.js +36 -5
- package/lib/simple/Phone.js +125 -81
- package/lib/simple/index.js +125 -81
- package/lib/simple/room/LocalParticipant.js +125 -81
- package/lib/simple/room/Participant.js +125 -81
- package/lib/simple/room/RemoteParticipant.js +125 -81
- package/lib/simple/room/Room.js +125 -81
- package/lib/simple/room/SipRoom.js +125 -81
- package/lib/simple/room/Stream.js +125 -81
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +125 -81
- package/lib/simple/utils.js +125 -81
- package/lib/types/WebSocketMessage.js +2 -0
- package/lib/web-rtc-client.js +77 -66
- 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 +15 -5
- package/src/domain/Phone/CTIPhone.js +4 -0
- package/src/domain/Phone/Phone.js +2 -0
- package/src/domain/Phone/WebRTCPhone.js +45 -16
- 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 -23
|
@@ -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
|
|
|
@@ -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,11 +7134,14 @@ class WebRTCClient extends Emitter {
|
|
|
7139
7134
|
|
|
7140
7135
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
7141
7136
|
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
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
|
+
}
|
|
7147
7145
|
|
|
7148
7146
|
if (withEvent) {
|
|
7149
7147
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -7353,13 +7351,17 @@ class WebRTCClient extends Emitter {
|
|
|
7353
7351
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
7354
7352
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
7355
7353
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
7354
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
7356
7355
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
7357
7356
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
7357
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
7358
7358
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
7359
7359
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
7360
7360
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
7361
|
-
let audioBytesSent = 0;
|
|
7362
|
-
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;
|
|
7363
7365
|
let videoBytesSent = 0;
|
|
7364
7366
|
let videoBytesReceived = 0;
|
|
7365
7367
|
let transportSent = 0;
|
|
@@ -7368,25 +7370,27 @@ class WebRTCClient extends Emitter {
|
|
|
7368
7370
|
|
|
7369
7371
|
stats.forEach(report => {
|
|
7370
7372
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
7371
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
7373
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
7374
|
+
audioContentSent += Number(report.bytesSent);
|
|
7372
7375
|
}
|
|
7373
7376
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
7374
|
-
audioBytesSent += report.bytesSent;
|
|
7377
|
+
audioBytesSent += Number(report.bytesSent);
|
|
7375
7378
|
}
|
|
7376
7379
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
7377
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
7380
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
7378
7381
|
}
|
|
7379
7382
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
7380
|
-
packetsLost += report.packetsLost;
|
|
7381
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
7382
|
-
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);
|
|
7383
7387
|
}
|
|
7384
7388
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
7385
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
7389
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
7386
7390
|
}
|
|
7387
7391
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
7388
7392
|
if ('framesPerSecond' in report) {
|
|
7389
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
7393
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
7390
7394
|
}
|
|
7391
7395
|
if ('framerateMean' in report) {
|
|
7392
7396
|
// framerateMean is only available in FF
|
|
@@ -7394,24 +7398,31 @@ class WebRTCClient extends Emitter {
|
|
|
7394
7398
|
}
|
|
7395
7399
|
}
|
|
7396
7400
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
7397
|
-
packetsLost += report.packetsLost;
|
|
7398
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
7399
|
-
networkStats.jitter = report.jitter;
|
|
7401
|
+
packetsLost += Number(report.packetsLost);
|
|
7402
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
7403
|
+
networkStats.jitter = Number(report.jitter);
|
|
7400
7404
|
}
|
|
7401
7405
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
7402
|
-
packetsLost += report.packetsLost;
|
|
7406
|
+
packetsLost += Number(report.packetsLost);
|
|
7403
7407
|
}
|
|
7404
7408
|
if (report.type === 'transport') {
|
|
7405
|
-
transportSent += report.bytesSent;
|
|
7406
|
-
transportReceived += report.bytesReceived;
|
|
7409
|
+
transportSent += Number(report.bytesSent);
|
|
7410
|
+
transportReceived += Number(report.bytesReceived);
|
|
7407
7411
|
}
|
|
7408
7412
|
});
|
|
7409
7413
|
|
|
7410
7414
|
networkStats.packetsLost = packetsLost;
|
|
7415
|
+
|
|
7411
7416
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
7412
7417
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
7413
7418
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
7414
7419
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
7420
|
+
|
|
7421
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
7422
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
7423
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
7424
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
7425
|
+
|
|
7415
7426
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
7416
7427
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
7417
7428
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
@@ -82,6 +82,9 @@ class Call {
|
|
|
82
82
|
|
|
83
83
|
|
|
84
84
|
static parseMany(plain ) {
|
|
85
|
+
if (!plain) {
|
|
86
|
+
return [];
|
|
87
|
+
}
|
|
85
88
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
86
89
|
}
|
|
87
90
|
|
|
@@ -1743,6 +1746,9 @@ class Contact {
|
|
|
1743
1746
|
}
|
|
1744
1747
|
|
|
1745
1748
|
static parseMany(response ) {
|
|
1749
|
+
if (!response || !response.results) {
|
|
1750
|
+
return [];
|
|
1751
|
+
}
|
|
1746
1752
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
1747
1753
|
}
|
|
1748
1754
|
|
|
@@ -2820,8 +2826,9 @@ class ExternalApp {
|
|
|
2820
2826
|
|
|
2821
2827
|
|
|
2822
2828
|
|
|
2823
|
-
|
|
2829
|
+
|
|
2824
2830
|
|
|
2831
|
+
|
|
2825
2832
|
|
|
2826
2833
|
|
|
2827
2834
|
class Meeting {
|
|
@@ -2832,9 +2839,10 @@ class Meeting {
|
|
|
2832
2839
|
|
|
2833
2840
|
|
|
2834
2841
|
|
|
2835
|
-
|
|
2842
|
+
|
|
2836
2843
|
|
|
2837
2844
|
|
|
2845
|
+
|
|
2838
2846
|
|
|
2839
2847
|
static parse(plain ) {
|
|
2840
2848
|
return new Meeting({
|
|
@@ -2844,12 +2852,16 @@ class Meeting {
|
|
|
2844
2852
|
ownerUuids: plain.owner_uuids,
|
|
2845
2853
|
port: plain.port,
|
|
2846
2854
|
uuid: plain.uuid,
|
|
2847
|
-
|
|
2855
|
+
extension: plain.exten,
|
|
2848
2856
|
persistent: plain.persistent,
|
|
2857
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
2849
2858
|
});
|
|
2850
2859
|
}
|
|
2851
2860
|
|
|
2852
2861
|
static parseMany(items ) {
|
|
2862
|
+
if (!items) {
|
|
2863
|
+
return [];
|
|
2864
|
+
}
|
|
2853
2865
|
return items.map(plain => Meeting.parse(plain));
|
|
2854
2866
|
}
|
|
2855
2867
|
|
|
@@ -2864,8 +2876,9 @@ class Meeting {
|
|
|
2864
2876
|
ownerUuids,
|
|
2865
2877
|
port,
|
|
2866
2878
|
uri,
|
|
2867
|
-
|
|
2879
|
+
extension,
|
|
2868
2880
|
persistent,
|
|
2881
|
+
creationTime,
|
|
2869
2882
|
} = {}) {
|
|
2870
2883
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2871
2884
|
this.uri = uri;
|
|
@@ -2873,8 +2886,9 @@ class Meeting {
|
|
|
2873
2886
|
this.ownerUuids = ownerUuids;
|
|
2874
2887
|
this.port = port;
|
|
2875
2888
|
this.uuid = uuid;
|
|
2876
|
-
this.
|
|
2889
|
+
this.extension = extension;
|
|
2877
2890
|
this.persistent = persistent;
|
|
2891
|
+
this.creationTime = creationTime;
|
|
2878
2892
|
|
|
2879
2893
|
// Useful to compare instead of instanceof with minified code
|
|
2880
2894
|
this.type = 'Meeting';
|
|
@@ -3052,6 +3066,10 @@ class ChatMessage {
|
|
|
3052
3066
|
|
|
3053
3067
|
|
|
3054
3068
|
static parseMany(plain ) {
|
|
3069
|
+
if (!plain || !plain.items) {
|
|
3070
|
+
return [];
|
|
3071
|
+
}
|
|
3072
|
+
|
|
3055
3073
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
3056
3074
|
}
|
|
3057
3075
|
|
|
@@ -3161,6 +3179,9 @@ class Voicemail {
|
|
|
3161
3179
|
}
|
|
3162
3180
|
|
|
3163
3181
|
static parseMany(plain ) {
|
|
3182
|
+
if (!plain) {
|
|
3183
|
+
return [];
|
|
3184
|
+
}
|
|
3164
3185
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
3165
3186
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
3166
3187
|
|
|
@@ -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
|
|
|
@@ -3894,6 +3922,9 @@ class ChatRoom {
|
|
|
3894
3922
|
|
|
3895
3923
|
|
|
3896
3924
|
static parseMany(plain ) {
|
|
3925
|
+
if (!plain || !plain.items) {
|
|
3926
|
+
return [];
|
|
3927
|
+
}
|
|
3897
3928
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
3898
3929
|
}
|
|
3899
3930
|
|
package/lib/domain/Call.js
CHANGED
package/lib/domain/CallLog.js
CHANGED
|
@@ -60,6 +60,9 @@ class Recording {
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
static parseMany(recordings = []) {
|
|
63
|
+
if (!recordings) {
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
63
66
|
return recordings.map(item => Recording.parse(item));
|
|
64
67
|
}
|
|
65
68
|
|
|
@@ -161,6 +164,10 @@ class CallLog {
|
|
|
161
164
|
}
|
|
162
165
|
|
|
163
166
|
static parseMany(plain ) {
|
|
167
|
+
if (!plain || !plain.items) {
|
|
168
|
+
return [];
|
|
169
|
+
}
|
|
170
|
+
|
|
164
171
|
return plain.items.map(item => CallLog.parse(item));
|
|
165
172
|
}
|
|
166
173
|
|
package/lib/domain/ChatRoom.js
CHANGED
package/lib/domain/Contact.js
CHANGED
package/lib/domain/Features.js
CHANGED
|
@@ -1539,6 +1539,9 @@ class Contact {
|
|
|
1539
1539
|
}
|
|
1540
1540
|
|
|
1541
1541
|
static parseMany(response ) {
|
|
1542
|
+
if (!response || !response.results) {
|
|
1543
|
+
return [];
|
|
1544
|
+
}
|
|
1542
1545
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
1543
1546
|
}
|
|
1544
1547
|
|
|
@@ -2616,8 +2619,9 @@ class ExternalApp {
|
|
|
2616
2619
|
|
|
2617
2620
|
|
|
2618
2621
|
|
|
2619
|
-
|
|
2622
|
+
|
|
2620
2623
|
|
|
2624
|
+
|
|
2621
2625
|
|
|
2622
2626
|
|
|
2623
2627
|
class Meeting {
|
|
@@ -2628,9 +2632,10 @@ class Meeting {
|
|
|
2628
2632
|
|
|
2629
2633
|
|
|
2630
2634
|
|
|
2631
|
-
|
|
2635
|
+
|
|
2632
2636
|
|
|
2633
2637
|
|
|
2638
|
+
|
|
2634
2639
|
|
|
2635
2640
|
static parse(plain ) {
|
|
2636
2641
|
return new Meeting({
|
|
@@ -2640,12 +2645,16 @@ class Meeting {
|
|
|
2640
2645
|
ownerUuids: plain.owner_uuids,
|
|
2641
2646
|
port: plain.port,
|
|
2642
2647
|
uuid: plain.uuid,
|
|
2643
|
-
|
|
2648
|
+
extension: plain.exten,
|
|
2644
2649
|
persistent: plain.persistent,
|
|
2650
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
2645
2651
|
});
|
|
2646
2652
|
}
|
|
2647
2653
|
|
|
2648
2654
|
static parseMany(items ) {
|
|
2655
|
+
if (!items) {
|
|
2656
|
+
return [];
|
|
2657
|
+
}
|
|
2649
2658
|
return items.map(plain => Meeting.parse(plain));
|
|
2650
2659
|
}
|
|
2651
2660
|
|
|
@@ -2660,8 +2669,9 @@ class Meeting {
|
|
|
2660
2669
|
ownerUuids,
|
|
2661
2670
|
port,
|
|
2662
2671
|
uri,
|
|
2663
|
-
|
|
2672
|
+
extension,
|
|
2664
2673
|
persistent,
|
|
2674
|
+
creationTime,
|
|
2665
2675
|
} = {}) {
|
|
2666
2676
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2667
2677
|
this.uri = uri;
|
|
@@ -2669,8 +2679,9 @@ class Meeting {
|
|
|
2669
2679
|
this.ownerUuids = ownerUuids;
|
|
2670
2680
|
this.port = port;
|
|
2671
2681
|
this.uuid = uuid;
|
|
2672
|
-
this.
|
|
2682
|
+
this.extension = extension;
|
|
2673
2683
|
this.persistent = persistent;
|
|
2684
|
+
this.creationTime = creationTime;
|
|
2674
2685
|
|
|
2675
2686
|
// Useful to compare instead of instanceof with minified code
|
|
2676
2687
|
this.type = 'Meeting';
|
|
@@ -2848,6 +2859,10 @@ class ChatMessage {
|
|
|
2848
2859
|
|
|
2849
2860
|
|
|
2850
2861
|
static parseMany(plain ) {
|
|
2862
|
+
if (!plain || !plain.items) {
|
|
2863
|
+
return [];
|
|
2864
|
+
}
|
|
2865
|
+
|
|
2851
2866
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2852
2867
|
}
|
|
2853
2868
|
|
|
@@ -2957,6 +2972,9 @@ class Voicemail {
|
|
|
2957
2972
|
}
|
|
2958
2973
|
|
|
2959
2974
|
static parseMany(plain ) {
|
|
2975
|
+
if (!plain) {
|
|
2976
|
+
return [];
|
|
2977
|
+
}
|
|
2960
2978
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2961
2979
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2962
2980
|
|
|
@@ -3066,6 +3084,9 @@ class Call {
|
|
|
3066
3084
|
|
|
3067
3085
|
|
|
3068
3086
|
static parseMany(plain ) {
|
|
3087
|
+
if (!plain) {
|
|
3088
|
+
return [];
|
|
3089
|
+
}
|
|
3069
3090
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3070
3091
|
}
|
|
3071
3092
|
|
|
@@ -3238,6 +3259,9 @@ class Recording {
|
|
|
3238
3259
|
|
|
3239
3260
|
|
|
3240
3261
|
static parseMany(recordings = []) {
|
|
3262
|
+
if (!recordings) {
|
|
3263
|
+
return [];
|
|
3264
|
+
}
|
|
3241
3265
|
return recordings.map(item => Recording.parse(item));
|
|
3242
3266
|
}
|
|
3243
3267
|
|
|
@@ -3339,6 +3363,10 @@ class CallLog {
|
|
|
3339
3363
|
}
|
|
3340
3364
|
|
|
3341
3365
|
static parseMany(plain ) {
|
|
3366
|
+
if (!plain || !plain.items) {
|
|
3367
|
+
return [];
|
|
3368
|
+
}
|
|
3369
|
+
|
|
3342
3370
|
return plain.items.map(item => CallLog.parse(item));
|
|
3343
3371
|
}
|
|
3344
3372
|
|
|
@@ -3896,6 +3924,9 @@ class ChatRoom {
|
|
|
3896
3924
|
|
|
3897
3925
|
|
|
3898
3926
|
static parseMany(plain ) {
|
|
3927
|
+
if (!plain || !plain.items) {
|
|
3928
|
+
return [];
|
|
3929
|
+
}
|
|
3899
3930
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
3900
3931
|
}
|
|
3901
3932
|
|