@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
|
@@ -1531,6 +1531,9 @@ class Contact {
|
|
|
1531
1531
|
}
|
|
1532
1532
|
|
|
1533
1533
|
static parseMany(response ) {
|
|
1534
|
+
if (!response || !response.results) {
|
|
1535
|
+
return [];
|
|
1536
|
+
}
|
|
1534
1537
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
1535
1538
|
}
|
|
1536
1539
|
|
|
@@ -2638,6 +2641,9 @@ class Meeting {
|
|
|
2638
2641
|
}
|
|
2639
2642
|
|
|
2640
2643
|
static parseMany(items ) {
|
|
2644
|
+
if (!items) {
|
|
2645
|
+
return [];
|
|
2646
|
+
}
|
|
2641
2647
|
return items.map(plain => Meeting.parse(plain));
|
|
2642
2648
|
}
|
|
2643
2649
|
|
|
@@ -2840,6 +2846,10 @@ class ChatMessage {
|
|
|
2840
2846
|
|
|
2841
2847
|
|
|
2842
2848
|
static parseMany(plain ) {
|
|
2849
|
+
if (!plain || !plain.items) {
|
|
2850
|
+
return [];
|
|
2851
|
+
}
|
|
2852
|
+
|
|
2843
2853
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2844
2854
|
}
|
|
2845
2855
|
|
|
@@ -2949,6 +2959,9 @@ class Voicemail {
|
|
|
2949
2959
|
}
|
|
2950
2960
|
|
|
2951
2961
|
static parseMany(plain ) {
|
|
2962
|
+
if (!plain) {
|
|
2963
|
+
return [];
|
|
2964
|
+
}
|
|
2952
2965
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2953
2966
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2954
2967
|
|
|
@@ -3058,6 +3071,9 @@ class Call {
|
|
|
3058
3071
|
|
|
3059
3072
|
|
|
3060
3073
|
static parseMany(plain ) {
|
|
3074
|
+
if (!plain) {
|
|
3075
|
+
return [];
|
|
3076
|
+
}
|
|
3061
3077
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3062
3078
|
}
|
|
3063
3079
|
|
|
@@ -3230,6 +3246,9 @@ class Recording {
|
|
|
3230
3246
|
|
|
3231
3247
|
|
|
3232
3248
|
static parseMany(recordings = []) {
|
|
3249
|
+
if (!recordings) {
|
|
3250
|
+
return [];
|
|
3251
|
+
}
|
|
3233
3252
|
return recordings.map(item => Recording.parse(item));
|
|
3234
3253
|
}
|
|
3235
3254
|
|
|
@@ -3331,6 +3350,10 @@ class CallLog {
|
|
|
3331
3350
|
}
|
|
3332
3351
|
|
|
3333
3352
|
static parseMany(plain ) {
|
|
3353
|
+
if (!plain || !plain.items) {
|
|
3354
|
+
return [];
|
|
3355
|
+
}
|
|
3356
|
+
|
|
3334
3357
|
return plain.items.map(item => CallLog.parse(item));
|
|
3335
3358
|
}
|
|
3336
3359
|
|
|
@@ -3903,6 +3926,9 @@ class ChatRoom {
|
|
|
3903
3926
|
|
|
3904
3927
|
|
|
3905
3928
|
static parseMany(plain ) {
|
|
3929
|
+
if (!plain || !plain.items) {
|
|
3930
|
+
return [];
|
|
3931
|
+
}
|
|
3906
3932
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
3907
3933
|
}
|
|
3908
3934
|
|
|
@@ -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
|
|
|
@@ -7360,25 +7348,25 @@ class WebRTCClient extends Emitter {
|
|
|
7360
7348
|
|
|
7361
7349
|
stats.forEach(report => {
|
|
7362
7350
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
7363
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
7351
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
7364
7352
|
}
|
|
7365
7353
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
7366
|
-
audioBytesSent += report.bytesSent;
|
|
7354
|
+
audioBytesSent += Number(report.bytesSent);
|
|
7367
7355
|
}
|
|
7368
7356
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
7369
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
7357
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
7370
7358
|
}
|
|
7371
7359
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
7372
|
-
packetsLost += report.packetsLost;
|
|
7373
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
7374
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
7360
|
+
packetsLost += Number(report.packetsLost);
|
|
7361
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
7362
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
7375
7363
|
}
|
|
7376
7364
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
7377
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
7365
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
7378
7366
|
}
|
|
7379
7367
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
7380
7368
|
if ('framesPerSecond' in report) {
|
|
7381
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
7369
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
7382
7370
|
}
|
|
7383
7371
|
if ('framerateMean' in report) {
|
|
7384
7372
|
// framerateMean is only available in FF
|
|
@@ -7386,16 +7374,16 @@ class WebRTCClient extends Emitter {
|
|
|
7386
7374
|
}
|
|
7387
7375
|
}
|
|
7388
7376
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
7389
|
-
packetsLost += report.packetsLost;
|
|
7390
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
7391
|
-
networkStats.jitter = report.jitter;
|
|
7377
|
+
packetsLost += Number(report.packetsLost);
|
|
7378
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
7379
|
+
networkStats.jitter = Number(report.jitter);
|
|
7392
7380
|
}
|
|
7393
7381
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
7394
|
-
packetsLost += report.packetsLost;
|
|
7382
|
+
packetsLost += Number(report.packetsLost);
|
|
7395
7383
|
}
|
|
7396
7384
|
if (report.type === 'transport') {
|
|
7397
|
-
transportSent += report.bytesSent;
|
|
7398
|
-
transportReceived += report.bytesReceived;
|
|
7385
|
+
transportSent += Number(report.bytesSent);
|
|
7386
|
+
transportReceived += Number(report.bytesReceived);
|
|
7399
7387
|
}
|
|
7400
7388
|
});
|
|
7401
7389
|
|
package/esm/api/call-logd.js
CHANGED
|
@@ -444,6 +444,9 @@ class Recording {
|
|
|
444
444
|
|
|
445
445
|
|
|
446
446
|
static parseMany(recordings = []) {
|
|
447
|
+
if (!recordings) {
|
|
448
|
+
return [];
|
|
449
|
+
}
|
|
447
450
|
return recordings.map(item => Recording.parse(item));
|
|
448
451
|
}
|
|
449
452
|
|
|
@@ -545,6 +548,10 @@ class CallLog {
|
|
|
545
548
|
}
|
|
546
549
|
|
|
547
550
|
static parseMany(plain ) {
|
|
551
|
+
if (!plain || !plain.items) {
|
|
552
|
+
return [];
|
|
553
|
+
}
|
|
554
|
+
|
|
548
555
|
return plain.items.map(item => CallLog.parse(item));
|
|
549
556
|
}
|
|
550
557
|
|
package/esm/api/calld.js
CHANGED
|
@@ -784,6 +784,10 @@ class ChatMessage {
|
|
|
784
784
|
|
|
785
785
|
|
|
786
786
|
static parseMany(plain ) {
|
|
787
|
+
if (!plain || !plain.items) {
|
|
788
|
+
return [];
|
|
789
|
+
}
|
|
790
|
+
|
|
787
791
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
788
792
|
}
|
|
789
793
|
|
|
@@ -893,6 +897,9 @@ class Voicemail {
|
|
|
893
897
|
}
|
|
894
898
|
|
|
895
899
|
static parseMany(plain ) {
|
|
900
|
+
if (!plain) {
|
|
901
|
+
return [];
|
|
902
|
+
}
|
|
896
903
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
897
904
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
898
905
|
|
|
@@ -1002,6 +1009,9 @@ class Call {
|
|
|
1002
1009
|
|
|
1003
1010
|
|
|
1004
1011
|
static parseMany(plain ) {
|
|
1012
|
+
if (!plain) {
|
|
1013
|
+
return [];
|
|
1014
|
+
}
|
|
1005
1015
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
1006
1016
|
}
|
|
1007
1017
|
|
package/esm/api/chatd.js
CHANGED
|
@@ -1103,6 +1103,9 @@ class ChatRoom {
|
|
|
1103
1103
|
|
|
1104
1104
|
|
|
1105
1105
|
static parseMany(plain ) {
|
|
1106
|
+
if (!plain || !plain.items) {
|
|
1107
|
+
return [];
|
|
1108
|
+
}
|
|
1106
1109
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
1107
1110
|
}
|
|
1108
1111
|
|
|
@@ -1169,6 +1172,10 @@ class ChatMessage {
|
|
|
1169
1172
|
|
|
1170
1173
|
|
|
1171
1174
|
static parseMany(plain ) {
|
|
1175
|
+
if (!plain || !plain.items) {
|
|
1176
|
+
return [];
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1172
1179
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
1173
1180
|
}
|
|
1174
1181
|
|
package/esm/api/confd.js
CHANGED
package/esm/api/ctid-ng.js
CHANGED
|
@@ -787,6 +787,10 @@ class ChatMessage {
|
|
|
787
787
|
|
|
788
788
|
|
|
789
789
|
static parseMany(plain ) {
|
|
790
|
+
if (!plain || !plain.items) {
|
|
791
|
+
return [];
|
|
792
|
+
}
|
|
793
|
+
|
|
790
794
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
791
795
|
}
|
|
792
796
|
|
|
@@ -896,6 +900,9 @@ class Voicemail {
|
|
|
896
900
|
}
|
|
897
901
|
|
|
898
902
|
static parseMany(plain ) {
|
|
903
|
+
if (!plain) {
|
|
904
|
+
return [];
|
|
905
|
+
}
|
|
899
906
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
900
907
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
901
908
|
|
|
@@ -1005,6 +1012,9 @@ class Call {
|
|
|
1005
1012
|
|
|
1006
1013
|
|
|
1007
1014
|
static parseMany(plain ) {
|
|
1015
|
+
if (!plain) {
|
|
1016
|
+
return [];
|
|
1017
|
+
}
|
|
1008
1018
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
1009
1019
|
}
|
|
1010
1020
|
|
package/esm/api/dird.js
CHANGED
package/esm/api-client.js
CHANGED
|
@@ -1531,6 +1531,9 @@ class Contact {
|
|
|
1531
1531
|
}
|
|
1532
1532
|
|
|
1533
1533
|
static parseMany(response ) {
|
|
1534
|
+
if (!response || !response.results) {
|
|
1535
|
+
return [];
|
|
1536
|
+
}
|
|
1534
1537
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
1535
1538
|
}
|
|
1536
1539
|
|
|
@@ -2638,6 +2641,9 @@ class Meeting {
|
|
|
2638
2641
|
}
|
|
2639
2642
|
|
|
2640
2643
|
static parseMany(items ) {
|
|
2644
|
+
if (!items) {
|
|
2645
|
+
return [];
|
|
2646
|
+
}
|
|
2641
2647
|
return items.map(plain => Meeting.parse(plain));
|
|
2642
2648
|
}
|
|
2643
2649
|
|
|
@@ -2840,6 +2846,10 @@ class ChatMessage {
|
|
|
2840
2846
|
|
|
2841
2847
|
|
|
2842
2848
|
static parseMany(plain ) {
|
|
2849
|
+
if (!plain || !plain.items) {
|
|
2850
|
+
return [];
|
|
2851
|
+
}
|
|
2852
|
+
|
|
2843
2853
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2844
2854
|
}
|
|
2845
2855
|
|
|
@@ -2949,6 +2959,9 @@ class Voicemail {
|
|
|
2949
2959
|
}
|
|
2950
2960
|
|
|
2951
2961
|
static parseMany(plain ) {
|
|
2962
|
+
if (!plain) {
|
|
2963
|
+
return [];
|
|
2964
|
+
}
|
|
2952
2965
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2953
2966
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2954
2967
|
|
|
@@ -3058,6 +3071,9 @@ class Call {
|
|
|
3058
3071
|
|
|
3059
3072
|
|
|
3060
3073
|
static parseMany(plain ) {
|
|
3074
|
+
if (!plain) {
|
|
3075
|
+
return [];
|
|
3076
|
+
}
|
|
3061
3077
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3062
3078
|
}
|
|
3063
3079
|
|
|
@@ -3230,6 +3246,9 @@ class Recording {
|
|
|
3230
3246
|
|
|
3231
3247
|
|
|
3232
3248
|
static parseMany(recordings = []) {
|
|
3249
|
+
if (!recordings) {
|
|
3250
|
+
return [];
|
|
3251
|
+
}
|
|
3233
3252
|
return recordings.map(item => Recording.parse(item));
|
|
3234
3253
|
}
|
|
3235
3254
|
|
|
@@ -3331,6 +3350,10 @@ class CallLog {
|
|
|
3331
3350
|
}
|
|
3332
3351
|
|
|
3333
3352
|
static parseMany(plain ) {
|
|
3353
|
+
if (!plain || !plain.items) {
|
|
3354
|
+
return [];
|
|
3355
|
+
}
|
|
3356
|
+
|
|
3334
3357
|
return plain.items.map(item => CallLog.parse(item));
|
|
3335
3358
|
}
|
|
3336
3359
|
|
|
@@ -3903,6 +3926,9 @@ class ChatRoom {
|
|
|
3903
3926
|
|
|
3904
3927
|
|
|
3905
3928
|
static parseMany(plain ) {
|
|
3929
|
+
if (!plain || !plain.items) {
|
|
3930
|
+
return [];
|
|
3931
|
+
}
|
|
3906
3932
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
3907
3933
|
}
|
|
3908
3934
|
|
package/esm/checker/Checker.js
CHANGED
|
@@ -1549,6 +1549,9 @@ class Contact {
|
|
|
1549
1549
|
}
|
|
1550
1550
|
|
|
1551
1551
|
static parseMany(response ) {
|
|
1552
|
+
if (!response || !response.results) {
|
|
1553
|
+
return [];
|
|
1554
|
+
}
|
|
1552
1555
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
1553
1556
|
}
|
|
1554
1557
|
|
|
@@ -2656,6 +2659,9 @@ class Meeting {
|
|
|
2656
2659
|
}
|
|
2657
2660
|
|
|
2658
2661
|
static parseMany(items ) {
|
|
2662
|
+
if (!items) {
|
|
2663
|
+
return [];
|
|
2664
|
+
}
|
|
2659
2665
|
return items.map(plain => Meeting.parse(plain));
|
|
2660
2666
|
}
|
|
2661
2667
|
|
|
@@ -2858,6 +2864,10 @@ class ChatMessage {
|
|
|
2858
2864
|
|
|
2859
2865
|
|
|
2860
2866
|
static parseMany(plain ) {
|
|
2867
|
+
if (!plain || !plain.items) {
|
|
2868
|
+
return [];
|
|
2869
|
+
}
|
|
2870
|
+
|
|
2861
2871
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2862
2872
|
}
|
|
2863
2873
|
|
|
@@ -2967,6 +2977,9 @@ class Voicemail {
|
|
|
2967
2977
|
}
|
|
2968
2978
|
|
|
2969
2979
|
static parseMany(plain ) {
|
|
2980
|
+
if (!plain) {
|
|
2981
|
+
return [];
|
|
2982
|
+
}
|
|
2970
2983
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2971
2984
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2972
2985
|
|
|
@@ -3076,6 +3089,9 @@ class Call {
|
|
|
3076
3089
|
|
|
3077
3090
|
|
|
3078
3091
|
static parseMany(plain ) {
|
|
3092
|
+
if (!plain) {
|
|
3093
|
+
return [];
|
|
3094
|
+
}
|
|
3079
3095
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3080
3096
|
}
|
|
3081
3097
|
|
|
@@ -3274,6 +3290,9 @@ class Recording {
|
|
|
3274
3290
|
|
|
3275
3291
|
|
|
3276
3292
|
static parseMany(recordings = []) {
|
|
3293
|
+
if (!recordings) {
|
|
3294
|
+
return [];
|
|
3295
|
+
}
|
|
3277
3296
|
return recordings.map(item => Recording.parse(item));
|
|
3278
3297
|
}
|
|
3279
3298
|
|
|
@@ -3375,6 +3394,10 @@ class CallLog {
|
|
|
3375
3394
|
}
|
|
3376
3395
|
|
|
3377
3396
|
static parseMany(plain ) {
|
|
3397
|
+
if (!plain || !plain.items) {
|
|
3398
|
+
return [];
|
|
3399
|
+
}
|
|
3400
|
+
|
|
3378
3401
|
return plain.items.map(item => CallLog.parse(item));
|
|
3379
3402
|
}
|
|
3380
3403
|
|
|
@@ -3947,6 +3970,9 @@ class ChatRoom {
|
|
|
3947
3970
|
|
|
3948
3971
|
|
|
3949
3972
|
static parseMany(plain ) {
|
|
3973
|
+
if (!plain || !plain.items) {
|
|
3974
|
+
return [];
|
|
3975
|
+
}
|
|
3950
3976
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
3951
3977
|
}
|
|
3952
3978
|
|
|
@@ -5349,10 +5375,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
5349
5375
|
candidates
|
|
5350
5376
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
5351
5377
|
|
|
5352
|
-
const areCandidateValid = (candidates ) =>
|
|
5353
|
-
getSrflxOrRelay(candidates)
|
|
5354
|
-
.length > 0;
|
|
5355
|
-
|
|
5356
5378
|
const getVideoDirection = (sdp ) => {
|
|
5357
5379
|
const parsedSdp = sdpParser.parse(sdp);
|
|
5358
5380
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
@@ -5405,8 +5427,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5405
5427
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5406
5428
|
|
|
5407
5429
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
5408
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
5409
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
5410
5430
|
|
|
5411
5431
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
5412
5432
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -5596,38 +5616,6 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
5596
5616
|
this._peerConnection = undefined;
|
|
5597
5617
|
}
|
|
5598
5618
|
|
|
5599
|
-
async _waitForValidGatheredIce() {
|
|
5600
|
-
let tries = 0;
|
|
5601
|
-
|
|
5602
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
5603
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
5604
|
-
tries,
|
|
5605
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
5606
|
-
});
|
|
5607
|
-
|
|
5608
|
-
tries++;
|
|
5609
|
-
|
|
5610
|
-
// eslint-disable-next-line no-await-in-loop
|
|
5611
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
5612
|
-
}
|
|
5613
|
-
|
|
5614
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
5615
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
5616
|
-
const error = new Error(errorMsg);
|
|
5617
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
5618
|
-
|
|
5619
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
5620
|
-
this.eventEmitter.emit('error', error);
|
|
5621
|
-
|
|
5622
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
5623
|
-
}
|
|
5624
|
-
|
|
5625
|
-
// eslint-disable-next-line
|
|
5626
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
5627
|
-
|
|
5628
|
-
return this.getLocalSessionDescription();
|
|
5629
|
-
}
|
|
5630
|
-
|
|
5631
5619
|
// Overridden to send `inactive` in conference
|
|
5632
5620
|
updateDirection(options , isConference = false,
|
|
5633
5621
|
audioOnly = false) {
|
|
@@ -7945,25 +7933,25 @@ class WebRTCClient extends Emitter {
|
|
|
7945
7933
|
|
|
7946
7934
|
stats.forEach(report => {
|
|
7947
7935
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
7948
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
7936
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
7949
7937
|
}
|
|
7950
7938
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
7951
|
-
audioBytesSent += report.bytesSent;
|
|
7939
|
+
audioBytesSent += Number(report.bytesSent);
|
|
7952
7940
|
}
|
|
7953
7941
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
7954
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
7942
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
7955
7943
|
}
|
|
7956
7944
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
7957
|
-
packetsLost += report.packetsLost;
|
|
7958
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
7959
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
7945
|
+
packetsLost += Number(report.packetsLost);
|
|
7946
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
7947
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
7960
7948
|
}
|
|
7961
7949
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
7962
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
7950
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
7963
7951
|
}
|
|
7964
7952
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
7965
7953
|
if ('framesPerSecond' in report) {
|
|
7966
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
7954
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
7967
7955
|
}
|
|
7968
7956
|
if ('framerateMean' in report) {
|
|
7969
7957
|
// framerateMean is only available in FF
|
|
@@ -7971,16 +7959,16 @@ class WebRTCClient extends Emitter {
|
|
|
7971
7959
|
}
|
|
7972
7960
|
}
|
|
7973
7961
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
7974
|
-
packetsLost += report.packetsLost;
|
|
7975
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
7976
|
-
networkStats.jitter = report.jitter;
|
|
7962
|
+
packetsLost += Number(report.packetsLost);
|
|
7963
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
7964
|
+
networkStats.jitter = Number(report.jitter);
|
|
7977
7965
|
}
|
|
7978
7966
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
7979
|
-
packetsLost += report.packetsLost;
|
|
7967
|
+
packetsLost += Number(report.packetsLost);
|
|
7980
7968
|
}
|
|
7981
7969
|
if (report.type === 'transport') {
|
|
7982
|
-
transportSent += report.bytesSent;
|
|
7983
|
-
transportReceived += report.bytesReceived;
|
|
7970
|
+
transportSent += Number(report.bytesSent);
|
|
7971
|
+
transportReceived += Number(report.bytesReceived);
|
|
7984
7972
|
}
|
|
7985
7973
|
});
|
|
7986
7974
|
|