@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
package/lib/checker/Checker.js
CHANGED
|
@@ -1559,6 +1559,9 @@ class Contact {
|
|
|
1559
1559
|
}
|
|
1560
1560
|
|
|
1561
1561
|
static parseMany(response ) {
|
|
1562
|
+
if (!response || !response.results) {
|
|
1563
|
+
return [];
|
|
1564
|
+
}
|
|
1562
1565
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
1563
1566
|
}
|
|
1564
1567
|
|
|
@@ -1929,7 +1932,7 @@ class Contact {
|
|
|
1929
1932
|
this[key] = old[key] || this[key];
|
|
1930
1933
|
});
|
|
1931
1934
|
|
|
1932
|
-
if (old.lineState
|
|
1935
|
+
if (old.lineState) {
|
|
1933
1936
|
this.lineState = old.lineState;
|
|
1934
1937
|
}
|
|
1935
1938
|
|
|
@@ -2636,8 +2639,9 @@ class ExternalApp {
|
|
|
2636
2639
|
|
|
2637
2640
|
|
|
2638
2641
|
|
|
2639
|
-
|
|
2642
|
+
|
|
2640
2643
|
|
|
2644
|
+
|
|
2641
2645
|
|
|
2642
2646
|
|
|
2643
2647
|
class Meeting {
|
|
@@ -2648,9 +2652,10 @@ class Meeting {
|
|
|
2648
2652
|
|
|
2649
2653
|
|
|
2650
2654
|
|
|
2651
|
-
|
|
2655
|
+
|
|
2652
2656
|
|
|
2653
2657
|
|
|
2658
|
+
|
|
2654
2659
|
|
|
2655
2660
|
static parse(plain ) {
|
|
2656
2661
|
return new Meeting({
|
|
@@ -2660,12 +2665,16 @@ class Meeting {
|
|
|
2660
2665
|
ownerUuids: plain.owner_uuids,
|
|
2661
2666
|
port: plain.port,
|
|
2662
2667
|
uuid: plain.uuid,
|
|
2663
|
-
|
|
2668
|
+
extension: plain.exten,
|
|
2664
2669
|
persistent: plain.persistent,
|
|
2670
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
2665
2671
|
});
|
|
2666
2672
|
}
|
|
2667
2673
|
|
|
2668
2674
|
static parseMany(items ) {
|
|
2675
|
+
if (!items) {
|
|
2676
|
+
return [];
|
|
2677
|
+
}
|
|
2669
2678
|
return items.map(plain => Meeting.parse(plain));
|
|
2670
2679
|
}
|
|
2671
2680
|
|
|
@@ -2680,8 +2689,9 @@ class Meeting {
|
|
|
2680
2689
|
ownerUuids,
|
|
2681
2690
|
port,
|
|
2682
2691
|
uri,
|
|
2683
|
-
|
|
2692
|
+
extension,
|
|
2684
2693
|
persistent,
|
|
2694
|
+
creationTime,
|
|
2685
2695
|
} = {}) {
|
|
2686
2696
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2687
2697
|
this.uri = uri;
|
|
@@ -2689,8 +2699,9 @@ class Meeting {
|
|
|
2689
2699
|
this.ownerUuids = ownerUuids;
|
|
2690
2700
|
this.port = port;
|
|
2691
2701
|
this.uuid = uuid;
|
|
2692
|
-
this.
|
|
2702
|
+
this.extension = extension;
|
|
2693
2703
|
this.persistent = persistent;
|
|
2704
|
+
this.creationTime = creationTime;
|
|
2694
2705
|
|
|
2695
2706
|
// Useful to compare instead of instanceof with minified code
|
|
2696
2707
|
this.type = 'Meeting';
|
|
@@ -2868,6 +2879,10 @@ class ChatMessage {
|
|
|
2868
2879
|
|
|
2869
2880
|
|
|
2870
2881
|
static parseMany(plain ) {
|
|
2882
|
+
if (!plain || !plain.items) {
|
|
2883
|
+
return [];
|
|
2884
|
+
}
|
|
2885
|
+
|
|
2871
2886
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2872
2887
|
}
|
|
2873
2888
|
|
|
@@ -2977,6 +2992,9 @@ class Voicemail {
|
|
|
2977
2992
|
}
|
|
2978
2993
|
|
|
2979
2994
|
static parseMany(plain ) {
|
|
2995
|
+
if (!plain) {
|
|
2996
|
+
return [];
|
|
2997
|
+
}
|
|
2980
2998
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2981
2999
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2982
3000
|
|
|
@@ -3086,6 +3104,9 @@ class Call {
|
|
|
3086
3104
|
|
|
3087
3105
|
|
|
3088
3106
|
static parseMany(plain ) {
|
|
3107
|
+
if (!plain) {
|
|
3108
|
+
return [];
|
|
3109
|
+
}
|
|
3089
3110
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3090
3111
|
}
|
|
3091
3112
|
|
|
@@ -3284,6 +3305,9 @@ class Recording {
|
|
|
3284
3305
|
|
|
3285
3306
|
|
|
3286
3307
|
static parseMany(recordings = []) {
|
|
3308
|
+
if (!recordings) {
|
|
3309
|
+
return [];
|
|
3310
|
+
}
|
|
3287
3311
|
return recordings.map(item => Recording.parse(item));
|
|
3288
3312
|
}
|
|
3289
3313
|
|
|
@@ -3385,6 +3409,10 @@ class CallLog {
|
|
|
3385
3409
|
}
|
|
3386
3410
|
|
|
3387
3411
|
static parseMany(plain ) {
|
|
3412
|
+
if (!plain || !plain.items) {
|
|
3413
|
+
return [];
|
|
3414
|
+
}
|
|
3415
|
+
|
|
3388
3416
|
return plain.items.map(item => CallLog.parse(item));
|
|
3389
3417
|
}
|
|
3390
3418
|
|
|
@@ -3957,6 +3985,9 @@ class ChatRoom {
|
|
|
3957
3985
|
|
|
3958
3986
|
|
|
3959
3987
|
static parseMany(plain ) {
|
|
3988
|
+
if (!plain || !plain.items) {
|
|
3989
|
+
return [];
|
|
3990
|
+
}
|
|
3960
3991
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
3961
3992
|
}
|
|
3962
3993
|
|
|
@@ -5359,10 +5390,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
5359
5390
|
candidates
|
|
5360
5391
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
5361
5392
|
|
|
5362
|
-
const areCandidateValid = (candidates ) =>
|
|
5363
|
-
getSrflxOrRelay(candidates)
|
|
5364
|
-
.length > 0;
|
|
5365
|
-
|
|
5366
5393
|
const getVideoDirection = (sdp ) => {
|
|
5367
5394
|
const parsedSdp = sdpParser__default['default'].parse(sdp);
|
|
5368
5395
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
@@ -5415,8 +5442,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5415
5442
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5416
5443
|
|
|
5417
5444
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
5418
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
5419
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
5420
5445
|
|
|
5421
5446
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
5422
5447
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -5606,38 +5631,6 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
5606
5631
|
this._peerConnection = undefined;
|
|
5607
5632
|
}
|
|
5608
5633
|
|
|
5609
|
-
async _waitForValidGatheredIce() {
|
|
5610
|
-
let tries = 0;
|
|
5611
|
-
|
|
5612
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
5613
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
5614
|
-
tries,
|
|
5615
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
5616
|
-
});
|
|
5617
|
-
|
|
5618
|
-
tries++;
|
|
5619
|
-
|
|
5620
|
-
// eslint-disable-next-line no-await-in-loop
|
|
5621
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
5622
|
-
}
|
|
5623
|
-
|
|
5624
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
5625
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
5626
|
-
const error = new Error(errorMsg);
|
|
5627
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
5628
|
-
|
|
5629
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
5630
|
-
this.eventEmitter.emit('error', error);
|
|
5631
|
-
|
|
5632
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
5633
|
-
}
|
|
5634
|
-
|
|
5635
|
-
// eslint-disable-next-line
|
|
5636
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
5637
|
-
|
|
5638
|
-
return this.getLocalSessionDescription();
|
|
5639
|
-
}
|
|
5640
|
-
|
|
5641
5634
|
// Overridden to send `inactive` in conference
|
|
5642
5635
|
updateDirection(options , isConference = false,
|
|
5643
5636
|
audioOnly = false) {
|
|
@@ -6307,7 +6300,7 @@ class WebRTCClient extends Emitter {
|
|
|
6307
6300
|
}
|
|
6308
6301
|
|
|
6309
6302
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6310
|
-
logger$1.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
6303
|
+
logger$1.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
|
|
6311
6304
|
const inviterOptions = {
|
|
6312
6305
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6313
6306
|
conference,
|
|
@@ -7383,6 +7376,7 @@ class WebRTCClient extends Emitter {
|
|
|
7383
7376
|
const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
|
|
7384
7377
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
7385
7378
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
7379
|
+
const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
|
|
7386
7380
|
|
|
7387
7381
|
logger$1.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
7388
7382
|
|
|
@@ -7390,7 +7384,8 @@ class WebRTCClient extends Emitter {
|
|
|
7390
7384
|
constraints: {
|
|
7391
7385
|
// Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
|
|
7392
7386
|
audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
|
|
7393
|
-
video: screenSharing ? (isDesktop
|
|
7387
|
+
video: screenSharing ? (isDesktop
|
|
7388
|
+
? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
|
|
7394
7389
|
: this._getVideoConstraints(enableVideo),
|
|
7395
7390
|
screen: screenSharing,
|
|
7396
7391
|
desktop: isDesktop,
|
|
@@ -7725,12 +7720,14 @@ class WebRTCClient extends Emitter {
|
|
|
7725
7720
|
|
|
7726
7721
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
7727
7722
|
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7723
|
+
if (pc) {
|
|
7724
|
+
pc.oniceconnectionstatechange = () => {
|
|
7725
|
+
logger$1.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
7726
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
7727
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
7728
|
+
}
|
|
7729
|
+
};
|
|
7730
|
+
}
|
|
7734
7731
|
|
|
7735
7732
|
if (withEvent) {
|
|
7736
7733
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -7940,13 +7937,17 @@ class WebRTCClient extends Emitter {
|
|
|
7940
7937
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
7941
7938
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
7942
7939
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
7940
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
7943
7941
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
7944
7942
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
7943
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
7945
7944
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
7946
7945
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
7947
7946
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
7948
|
-
let audioBytesSent = 0;
|
|
7949
|
-
let audioBytesReceived = 0;
|
|
7947
|
+
let audioBytesSent = 0; // content + header
|
|
7948
|
+
let audioBytesReceived = 0; // content + header
|
|
7949
|
+
let audioContentSent = 0; // useful to detect blank call
|
|
7950
|
+
let audioContentReceived = 0;
|
|
7950
7951
|
let videoBytesSent = 0;
|
|
7951
7952
|
let videoBytesReceived = 0;
|
|
7952
7953
|
let transportSent = 0;
|
|
@@ -7955,25 +7956,27 @@ class WebRTCClient extends Emitter {
|
|
|
7955
7956
|
|
|
7956
7957
|
stats.forEach(report => {
|
|
7957
7958
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
7958
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
7959
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
7960
|
+
audioContentSent += Number(report.bytesSent);
|
|
7959
7961
|
}
|
|
7960
7962
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
7961
|
-
audioBytesSent += report.bytesSent;
|
|
7963
|
+
audioBytesSent += Number(report.bytesSent);
|
|
7962
7964
|
}
|
|
7963
7965
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
7964
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
7966
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
7965
7967
|
}
|
|
7966
7968
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
7967
|
-
packetsLost += report.packetsLost;
|
|
7968
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
7969
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
7969
|
+
packetsLost += Number(report.packetsLost);
|
|
7970
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
7971
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
7972
|
+
audioContentReceived += Number(report.bytesReceived);
|
|
7970
7973
|
}
|
|
7971
7974
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
7972
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
7975
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
7973
7976
|
}
|
|
7974
7977
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
7975
7978
|
if ('framesPerSecond' in report) {
|
|
7976
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
7979
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
7977
7980
|
}
|
|
7978
7981
|
if ('framerateMean' in report) {
|
|
7979
7982
|
// framerateMean is only available in FF
|
|
@@ -7981,24 +7984,31 @@ class WebRTCClient extends Emitter {
|
|
|
7981
7984
|
}
|
|
7982
7985
|
}
|
|
7983
7986
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
7984
|
-
packetsLost += report.packetsLost;
|
|
7985
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
7986
|
-
networkStats.jitter = report.jitter;
|
|
7987
|
+
packetsLost += Number(report.packetsLost);
|
|
7988
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
7989
|
+
networkStats.jitter = Number(report.jitter);
|
|
7987
7990
|
}
|
|
7988
7991
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
7989
|
-
packetsLost += report.packetsLost;
|
|
7992
|
+
packetsLost += Number(report.packetsLost);
|
|
7990
7993
|
}
|
|
7991
7994
|
if (report.type === 'transport') {
|
|
7992
|
-
transportSent += report.bytesSent;
|
|
7993
|
-
transportReceived += report.bytesReceived;
|
|
7995
|
+
transportSent += Number(report.bytesSent);
|
|
7996
|
+
transportReceived += Number(report.bytesReceived);
|
|
7994
7997
|
}
|
|
7995
7998
|
});
|
|
7996
7999
|
|
|
7997
8000
|
networkStats.packetsLost = packetsLost;
|
|
8001
|
+
|
|
7998
8002
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
7999
8003
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8000
8004
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8001
8005
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8006
|
+
|
|
8007
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
8008
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
8009
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
8010
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
8011
|
+
|
|
8002
8012
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8003
8013
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8004
8014
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
@@ -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
|
|
|
@@ -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
|
|