@wazo/sdk 0.37.22 → 0.37.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/wazo-sdk.js +5 -5
- package/esm/__tests__/api-client.test.js +26 -0
- package/esm/__tests__/web-rtc-client.test.js +40 -52
- package/esm/api/call-logd.js +7 -0
- package/esm/api/calld.js +10 -0
- package/esm/api/chatd.js +7 -0
- package/esm/api/confd.js +3 -0
- package/esm/api/ctid-ng.js +10 -0
- package/esm/api/dird.js +3 -0
- package/esm/api-client.js +26 -0
- package/esm/checker/Checker.js +40 -52
- package/esm/checker/checks/aor.js +26 -0
- package/esm/checker/checks/api.js +26 -0
- package/esm/checker/checks/index.js +40 -52
- package/esm/checker/checks/webrtc-transport.js +40 -52
- package/esm/checker/checks/webrtc.js +40 -52
- package/esm/domain/AdHocAPIConference.js +26 -0
- package/esm/domain/Call.js +3 -0
- package/esm/domain/CallLog.js +7 -0
- package/esm/domain/ChatMessage.js +4 -0
- package/esm/domain/ChatRoom.js +3 -0
- package/esm/domain/Contact.js +3 -0
- package/esm/domain/Features.js +26 -0
- package/esm/domain/Meeting.js +3 -0
- package/esm/domain/Phone/CTIPhone.js +30 -0
- package/esm/domain/Phone/WebRTCPhone.js +14 -12
- package/esm/domain/Recording.js +3 -0
- package/esm/domain/Voicemail.js +3 -0
- package/esm/domain/__tests__/Call.test.js +3 -0
- package/esm/domain/__tests__/CallLog.test.js +7 -0
- package/esm/domain/__tests__/Contact.test.js +3 -0
- package/esm/domain/__tests__/Voicemail.test.js +3 -0
- package/esm/index.js +57 -63
- package/esm/lib/WazoSessionDescriptionHandler.js +0 -38
- package/esm/service/CallApi.js +26 -0
- package/esm/service/getApiClient.js +26 -0
- package/esm/simple/Auth.js +57 -63
- package/esm/simple/Configuration.js +57 -63
- package/esm/simple/Directory.js +26 -0
- package/esm/simple/Phone.js +57 -63
- package/esm/simple/index.js +57 -63
- package/esm/simple/room/LocalParticipant.js +57 -63
- package/esm/simple/room/Participant.js +57 -63
- package/esm/simple/room/RemoteParticipant.js +57 -63
- package/esm/simple/room/Room.js +57 -63
- package/esm/simple/room/SipRoom.js +57 -63
- package/esm/simple/room/Stream.js +57 -63
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +57 -63
- package/esm/simple/utils.js +57 -63
- package/esm/web-rtc-client.js +40 -52
- package/lib/__tests__/api-client.test.js +26 -0
- package/lib/__tests__/web-rtc-client.test.js +40 -52
- package/lib/api/call-logd.js +7 -0
- package/lib/api/calld.js +10 -0
- package/lib/api/chatd.js +7 -0
- package/lib/api/confd.js +3 -0
- package/lib/api/ctid-ng.js +10 -0
- package/lib/api/dird.js +3 -0
- package/lib/api-client.js +26 -0
- package/lib/checker/Checker.js +40 -52
- package/lib/checker/checks/aor.js +26 -0
- package/lib/checker/checks/api.js +26 -0
- package/lib/checker/checks/index.js +40 -52
- package/lib/checker/checks/webrtc-transport.js +40 -52
- package/lib/checker/checks/webrtc.js +40 -52
- package/lib/domain/AdHocAPIConference.js +26 -0
- package/lib/domain/Call.js +3 -0
- package/lib/domain/CallLog.js +7 -0
- package/lib/domain/ChatMessage.js +4 -0
- package/lib/domain/ChatRoom.js +3 -0
- package/lib/domain/Contact.js +3 -0
- package/lib/domain/Features.js +26 -0
- package/lib/domain/Meeting.js +3 -0
- package/lib/domain/Phone/CTIPhone.js +30 -0
- package/lib/domain/Phone/WebRTCPhone.js +14 -12
- package/lib/domain/Recording.js +3 -0
- package/lib/domain/Voicemail.js +3 -0
- package/lib/domain/__tests__/Call.test.js +3 -0
- package/lib/domain/__tests__/CallLog.test.js +7 -0
- package/lib/domain/__tests__/Contact.test.js +3 -0
- package/lib/domain/__tests__/Voicemail.test.js +3 -0
- package/lib/index.js +57 -63
- package/lib/lib/WazoSessionDescriptionHandler.js +0 -38
- package/lib/service/CallApi.js +26 -0
- package/lib/service/getApiClient.js +26 -0
- package/lib/simple/Auth.js +57 -63
- package/lib/simple/Configuration.js +57 -63
- package/lib/simple/Directory.js +26 -0
- package/lib/simple/Phone.js +57 -63
- package/lib/simple/index.js +57 -63
- package/lib/simple/room/LocalParticipant.js +57 -63
- package/lib/simple/room/Participant.js +57 -63
- package/lib/simple/room/RemoteParticipant.js +57 -63
- package/lib/simple/room/Room.js +57 -63
- package/lib/simple/room/SipRoom.js +57 -63
- package/lib/simple/room/Stream.js +57 -63
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +57 -63
- package/lib/simple/utils.js +57 -63
- package/lib/web-rtc-client.js +40 -52
- package/package.json +1 -1
- package/src/domain/Call.js +3 -0
- package/src/domain/CallLog.js +4 -0
- package/src/domain/ChatMessage.js +4 -0
- package/src/domain/ChatRoom.js +3 -0
- package/src/domain/Contact.js +3 -0
- package/src/domain/Meeting.js +3 -0
- package/src/domain/Phone/CTIPhone.js +4 -0
- package/src/domain/Phone/Phone.js +2 -0
- package/src/domain/Phone/WebRTCPhone.js +14 -12
- package/src/domain/Recording.js +3 -0
- package/src/domain/Voicemail.js +3 -0
- package/src/lib/WazoSessionDescriptionHandler.js +1 -35
- package/src/web-rtc-client.js +14 -14
package/lib/simple/Directory.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
|
|
|
@@ -2644,6 +2647,9 @@ class Meeting {
|
|
|
2644
2647
|
}
|
|
2645
2648
|
|
|
2646
2649
|
static parseMany(items ) {
|
|
2650
|
+
if (!items) {
|
|
2651
|
+
return [];
|
|
2652
|
+
}
|
|
2647
2653
|
return items.map(plain => Meeting.parse(plain));
|
|
2648
2654
|
}
|
|
2649
2655
|
|
|
@@ -2846,6 +2852,10 @@ class ChatMessage {
|
|
|
2846
2852
|
|
|
2847
2853
|
|
|
2848
2854
|
static parseMany(plain ) {
|
|
2855
|
+
if (!plain || !plain.items) {
|
|
2856
|
+
return [];
|
|
2857
|
+
}
|
|
2858
|
+
|
|
2849
2859
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2850
2860
|
}
|
|
2851
2861
|
|
|
@@ -2955,6 +2965,9 @@ class Voicemail {
|
|
|
2955
2965
|
}
|
|
2956
2966
|
|
|
2957
2967
|
static parseMany(plain ) {
|
|
2968
|
+
if (!plain) {
|
|
2969
|
+
return [];
|
|
2970
|
+
}
|
|
2958
2971
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2959
2972
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2960
2973
|
|
|
@@ -3064,6 +3077,9 @@ class Call {
|
|
|
3064
3077
|
|
|
3065
3078
|
|
|
3066
3079
|
static parseMany(plain ) {
|
|
3080
|
+
if (!plain) {
|
|
3081
|
+
return [];
|
|
3082
|
+
}
|
|
3067
3083
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3068
3084
|
}
|
|
3069
3085
|
|
|
@@ -3236,6 +3252,9 @@ class Recording {
|
|
|
3236
3252
|
|
|
3237
3253
|
|
|
3238
3254
|
static parseMany(recordings = []) {
|
|
3255
|
+
if (!recordings) {
|
|
3256
|
+
return [];
|
|
3257
|
+
}
|
|
3239
3258
|
return recordings.map(item => Recording.parse(item));
|
|
3240
3259
|
}
|
|
3241
3260
|
|
|
@@ -3337,6 +3356,10 @@ class CallLog {
|
|
|
3337
3356
|
}
|
|
3338
3357
|
|
|
3339
3358
|
static parseMany(plain ) {
|
|
3359
|
+
if (!plain || !plain.items) {
|
|
3360
|
+
return [];
|
|
3361
|
+
}
|
|
3362
|
+
|
|
3340
3363
|
return plain.items.map(item => CallLog.parse(item));
|
|
3341
3364
|
}
|
|
3342
3365
|
|
|
@@ -3894,6 +3917,9 @@ class ChatRoom {
|
|
|
3894
3917
|
|
|
3895
3918
|
|
|
3896
3919
|
static parseMany(plain ) {
|
|
3920
|
+
if (!plain || !plain.items) {
|
|
3921
|
+
return [];
|
|
3922
|
+
}
|
|
3897
3923
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
3898
3924
|
}
|
|
3899
3925
|
|
package/lib/simple/Phone.js
CHANGED
|
@@ -105,6 +105,9 @@ class Call {
|
|
|
105
105
|
|
|
106
106
|
|
|
107
107
|
static parseMany(plain ) {
|
|
108
|
+
if (!plain) {
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
108
111
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
109
112
|
}
|
|
110
113
|
|
|
@@ -2111,6 +2114,9 @@ class Contact {
|
|
|
2111
2114
|
}
|
|
2112
2115
|
|
|
2113
2116
|
static parseMany(response ) {
|
|
2117
|
+
if (!response || !response.results) {
|
|
2118
|
+
return [];
|
|
2119
|
+
}
|
|
2114
2120
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
2115
2121
|
}
|
|
2116
2122
|
|
|
@@ -3218,6 +3224,9 @@ class Meeting {
|
|
|
3218
3224
|
}
|
|
3219
3225
|
|
|
3220
3226
|
static parseMany(items ) {
|
|
3227
|
+
if (!items) {
|
|
3228
|
+
return [];
|
|
3229
|
+
}
|
|
3221
3230
|
return items.map(plain => Meeting.parse(plain));
|
|
3222
3231
|
}
|
|
3223
3232
|
|
|
@@ -3420,6 +3429,10 @@ class ChatMessage {
|
|
|
3420
3429
|
|
|
3421
3430
|
|
|
3422
3431
|
static parseMany(plain ) {
|
|
3432
|
+
if (!plain || !plain.items) {
|
|
3433
|
+
return [];
|
|
3434
|
+
}
|
|
3435
|
+
|
|
3423
3436
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
3424
3437
|
}
|
|
3425
3438
|
|
|
@@ -3529,6 +3542,9 @@ class Voicemail {
|
|
|
3529
3542
|
}
|
|
3530
3543
|
|
|
3531
3544
|
static parseMany(plain ) {
|
|
3545
|
+
if (!plain) {
|
|
3546
|
+
return [];
|
|
3547
|
+
}
|
|
3532
3548
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
3533
3549
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
3534
3550
|
|
|
@@ -3630,6 +3646,9 @@ class Recording {
|
|
|
3630
3646
|
|
|
3631
3647
|
|
|
3632
3648
|
static parseMany(recordings = []) {
|
|
3649
|
+
if (!recordings) {
|
|
3650
|
+
return [];
|
|
3651
|
+
}
|
|
3633
3652
|
return recordings.map(item => Recording.parse(item));
|
|
3634
3653
|
}
|
|
3635
3654
|
|
|
@@ -3731,6 +3750,10 @@ class CallLog {
|
|
|
3731
3750
|
}
|
|
3732
3751
|
|
|
3733
3752
|
static parseMany(plain ) {
|
|
3753
|
+
if (!plain || !plain.items) {
|
|
3754
|
+
return [];
|
|
3755
|
+
}
|
|
3756
|
+
|
|
3734
3757
|
return plain.items.map(item => CallLog.parse(item));
|
|
3735
3758
|
}
|
|
3736
3759
|
|
|
@@ -4300,6 +4323,10 @@ class CTIPhone extends Emitter {
|
|
|
4300
4323
|
return false;
|
|
4301
4324
|
}
|
|
4302
4325
|
|
|
4326
|
+
hasAVideoTrack() {
|
|
4327
|
+
return false;
|
|
4328
|
+
}
|
|
4329
|
+
|
|
4303
4330
|
getLocalStreamForCall() {
|
|
4304
4331
|
return null;
|
|
4305
4332
|
}
|
|
@@ -4693,6 +4720,9 @@ class ChatRoom {
|
|
|
4693
4720
|
|
|
4694
4721
|
|
|
4695
4722
|
static parseMany(plain ) {
|
|
4723
|
+
if (!plain || !plain.items) {
|
|
4724
|
+
return [];
|
|
4725
|
+
}
|
|
4696
4726
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
4697
4727
|
}
|
|
4698
4728
|
|
|
@@ -5674,10 +5704,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
5674
5704
|
candidates
|
|
5675
5705
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
5676
5706
|
|
|
5677
|
-
const areCandidateValid = (candidates ) =>
|
|
5678
|
-
getSrflxOrRelay(candidates)
|
|
5679
|
-
.length > 0;
|
|
5680
|
-
|
|
5681
5707
|
const getVideoDirection = (sdp ) => {
|
|
5682
5708
|
const parsedSdp = sdpParser__default['default'].parse(sdp);
|
|
5683
5709
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
@@ -5730,8 +5756,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5730
5756
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5731
5757
|
|
|
5732
5758
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
5733
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
5734
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
5735
5759
|
|
|
5736
5760
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
5737
5761
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -5921,38 +5945,6 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
5921
5945
|
this._peerConnection = undefined;
|
|
5922
5946
|
}
|
|
5923
5947
|
|
|
5924
|
-
async _waitForValidGatheredIce() {
|
|
5925
|
-
let tries = 0;
|
|
5926
|
-
|
|
5927
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
5928
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
5929
|
-
tries,
|
|
5930
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
5931
|
-
});
|
|
5932
|
-
|
|
5933
|
-
tries++;
|
|
5934
|
-
|
|
5935
|
-
// eslint-disable-next-line no-await-in-loop
|
|
5936
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
5937
|
-
}
|
|
5938
|
-
|
|
5939
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
5940
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
5941
|
-
const error = new Error(errorMsg);
|
|
5942
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
5943
|
-
|
|
5944
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
5945
|
-
this.eventEmitter.emit('error', error);
|
|
5946
|
-
|
|
5947
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
5948
|
-
}
|
|
5949
|
-
|
|
5950
|
-
// eslint-disable-next-line
|
|
5951
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
5952
|
-
|
|
5953
|
-
return this.getLocalSessionDescription();
|
|
5954
|
-
}
|
|
5955
|
-
|
|
5956
5948
|
// Overridden to send `inactive` in conference
|
|
5957
5949
|
updateDirection(options , isConference = false,
|
|
5958
5950
|
audioOnly = false) {
|
|
@@ -8368,25 +8360,25 @@ class WebRTCClient extends Emitter {
|
|
|
8368
8360
|
|
|
8369
8361
|
stats.forEach(report => {
|
|
8370
8362
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8371
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8363
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8372
8364
|
}
|
|
8373
8365
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8374
|
-
audioBytesSent += report.bytesSent;
|
|
8366
|
+
audioBytesSent += Number(report.bytesSent);
|
|
8375
8367
|
}
|
|
8376
8368
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8377
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8369
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8378
8370
|
}
|
|
8379
8371
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8380
|
-
packetsLost += report.packetsLost;
|
|
8381
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
8382
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8372
|
+
packetsLost += Number(report.packetsLost);
|
|
8373
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8374
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8383
8375
|
}
|
|
8384
8376
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8385
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8377
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8386
8378
|
}
|
|
8387
8379
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8388
8380
|
if ('framesPerSecond' in report) {
|
|
8389
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
8381
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
8390
8382
|
}
|
|
8391
8383
|
if ('framerateMean' in report) {
|
|
8392
8384
|
// framerateMean is only available in FF
|
|
@@ -8394,16 +8386,16 @@ class WebRTCClient extends Emitter {
|
|
|
8394
8386
|
}
|
|
8395
8387
|
}
|
|
8396
8388
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8397
|
-
packetsLost += report.packetsLost;
|
|
8398
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
8399
|
-
networkStats.jitter = report.jitter;
|
|
8389
|
+
packetsLost += Number(report.packetsLost);
|
|
8390
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
8391
|
+
networkStats.jitter = Number(report.jitter);
|
|
8400
8392
|
}
|
|
8401
8393
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8402
|
-
packetsLost += report.packetsLost;
|
|
8394
|
+
packetsLost += Number(report.packetsLost);
|
|
8403
8395
|
}
|
|
8404
8396
|
if (report.type === 'transport') {
|
|
8405
|
-
transportSent += report.bytesSent;
|
|
8406
|
-
transportReceived += report.bytesReceived;
|
|
8397
|
+
transportSent += Number(report.bytesSent);
|
|
8398
|
+
transportReceived += Number(report.bytesReceived);
|
|
8407
8399
|
}
|
|
8408
8400
|
});
|
|
8409
8401
|
|
|
@@ -8989,18 +8981,20 @@ class WebRTCPhone extends Emitter {
|
|
|
8989
8981
|
screenTrack,
|
|
8990
8982
|
});
|
|
8991
8983
|
|
|
8992
|
-
|
|
8993
|
-
|
|
8994
|
-
|
|
8995
|
-
|
|
8996
|
-
|
|
8997
|
-
|
|
8984
|
+
if (screenTrack) {
|
|
8985
|
+
screenTrack.onended = () => {
|
|
8986
|
+
logger$8.info('WebRTC phone - on screenshare ended', {
|
|
8987
|
+
hadVideo,
|
|
8988
|
+
id: this.getSipSessionId(sipSession),
|
|
8989
|
+
screenTrack,
|
|
8990
|
+
});
|
|
8998
8991
|
|
|
8999
|
-
|
|
9000
|
-
|
|
9001
|
-
|
|
9002
|
-
|
|
9003
|
-
|
|
8992
|
+
this.eventEmitter.emit(
|
|
8993
|
+
ON_SHARE_SCREEN_ENDING,
|
|
8994
|
+
this._createCallSession(sipSession, callSession),
|
|
8995
|
+
);
|
|
8996
|
+
};
|
|
8997
|
+
}
|
|
9004
8998
|
|
|
9005
8999
|
this.currentScreenShare = {
|
|
9006
9000
|
stream: screenStream,
|
package/lib/simple/index.js
CHANGED
|
@@ -873,6 +873,9 @@ class Contact {
|
|
|
873
873
|
}
|
|
874
874
|
|
|
875
875
|
static parseMany(response ) {
|
|
876
|
+
if (!response || !response.results) {
|
|
877
|
+
return [];
|
|
878
|
+
}
|
|
876
879
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
877
880
|
}
|
|
878
881
|
|
|
@@ -2667,6 +2670,9 @@ class Meeting {
|
|
|
2667
2670
|
}
|
|
2668
2671
|
|
|
2669
2672
|
static parseMany(items ) {
|
|
2673
|
+
if (!items) {
|
|
2674
|
+
return [];
|
|
2675
|
+
}
|
|
2670
2676
|
return items.map(plain => Meeting.parse(plain));
|
|
2671
2677
|
}
|
|
2672
2678
|
|
|
@@ -2869,6 +2875,10 @@ class ChatMessage {
|
|
|
2869
2875
|
|
|
2870
2876
|
|
|
2871
2877
|
static parseMany(plain ) {
|
|
2878
|
+
if (!plain || !plain.items) {
|
|
2879
|
+
return [];
|
|
2880
|
+
}
|
|
2881
|
+
|
|
2872
2882
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2873
2883
|
}
|
|
2874
2884
|
|
|
@@ -2978,6 +2988,9 @@ class Voicemail {
|
|
|
2978
2988
|
}
|
|
2979
2989
|
|
|
2980
2990
|
static parseMany(plain ) {
|
|
2991
|
+
if (!plain) {
|
|
2992
|
+
return [];
|
|
2993
|
+
}
|
|
2981
2994
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2982
2995
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2983
2996
|
|
|
@@ -3087,6 +3100,9 @@ class Call {
|
|
|
3087
3100
|
|
|
3088
3101
|
|
|
3089
3102
|
static parseMany(plain ) {
|
|
3103
|
+
if (!plain) {
|
|
3104
|
+
return [];
|
|
3105
|
+
}
|
|
3090
3106
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3091
3107
|
}
|
|
3092
3108
|
|
|
@@ -3630,6 +3646,9 @@ class Recording {
|
|
|
3630
3646
|
|
|
3631
3647
|
|
|
3632
3648
|
static parseMany(recordings = []) {
|
|
3649
|
+
if (!recordings) {
|
|
3650
|
+
return [];
|
|
3651
|
+
}
|
|
3633
3652
|
return recordings.map(item => Recording.parse(item));
|
|
3634
3653
|
}
|
|
3635
3654
|
|
|
@@ -3731,6 +3750,10 @@ class CallLog {
|
|
|
3731
3750
|
}
|
|
3732
3751
|
|
|
3733
3752
|
static parseMany(plain ) {
|
|
3753
|
+
if (!plain || !plain.items) {
|
|
3754
|
+
return [];
|
|
3755
|
+
}
|
|
3756
|
+
|
|
3734
3757
|
return plain.items.map(item => CallLog.parse(item));
|
|
3735
3758
|
}
|
|
3736
3759
|
|
|
@@ -4300,6 +4323,10 @@ class CTIPhone extends Emitter {
|
|
|
4300
4323
|
return false;
|
|
4301
4324
|
}
|
|
4302
4325
|
|
|
4326
|
+
hasAVideoTrack() {
|
|
4327
|
+
return false;
|
|
4328
|
+
}
|
|
4329
|
+
|
|
4303
4330
|
getLocalStreamForCall() {
|
|
4304
4331
|
return null;
|
|
4305
4332
|
}
|
|
@@ -4693,6 +4720,9 @@ class ChatRoom {
|
|
|
4693
4720
|
|
|
4694
4721
|
|
|
4695
4722
|
static parseMany(plain ) {
|
|
4723
|
+
if (!plain || !plain.items) {
|
|
4724
|
+
return [];
|
|
4725
|
+
}
|
|
4696
4726
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
4697
4727
|
}
|
|
4698
4728
|
|
|
@@ -5938,10 +5968,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
5938
5968
|
candidates
|
|
5939
5969
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
5940
5970
|
|
|
5941
|
-
const areCandidateValid = (candidates ) =>
|
|
5942
|
-
getSrflxOrRelay(candidates)
|
|
5943
|
-
.length > 0;
|
|
5944
|
-
|
|
5945
5971
|
const getVideoDirection = (sdp ) => {
|
|
5946
5972
|
const parsedSdp = sdpParser__default['default'].parse(sdp);
|
|
5947
5973
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
@@ -5994,8 +6020,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5994
6020
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5995
6021
|
|
|
5996
6022
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
5997
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
5998
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
5999
6023
|
|
|
6000
6024
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
6001
6025
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -6185,38 +6209,6 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6185
6209
|
this._peerConnection = undefined;
|
|
6186
6210
|
}
|
|
6187
6211
|
|
|
6188
|
-
async _waitForValidGatheredIce() {
|
|
6189
|
-
let tries = 0;
|
|
6190
|
-
|
|
6191
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
6192
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
6193
|
-
tries,
|
|
6194
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
6195
|
-
});
|
|
6196
|
-
|
|
6197
|
-
tries++;
|
|
6198
|
-
|
|
6199
|
-
// eslint-disable-next-line no-await-in-loop
|
|
6200
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
6201
|
-
}
|
|
6202
|
-
|
|
6203
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
6204
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
6205
|
-
const error = new Error(errorMsg);
|
|
6206
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
6207
|
-
|
|
6208
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
6209
|
-
this.eventEmitter.emit('error', error);
|
|
6210
|
-
|
|
6211
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
6212
|
-
}
|
|
6213
|
-
|
|
6214
|
-
// eslint-disable-next-line
|
|
6215
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
6216
|
-
|
|
6217
|
-
return this.getLocalSessionDescription();
|
|
6218
|
-
}
|
|
6219
|
-
|
|
6220
6212
|
// Overridden to send `inactive` in conference
|
|
6221
6213
|
updateDirection(options , isConference = false,
|
|
6222
6214
|
audioOnly = false) {
|
|
@@ -8632,25 +8624,25 @@ class WebRTCClient extends Emitter {
|
|
|
8632
8624
|
|
|
8633
8625
|
stats.forEach(report => {
|
|
8634
8626
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8635
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8627
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8636
8628
|
}
|
|
8637
8629
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8638
|
-
audioBytesSent += report.bytesSent;
|
|
8630
|
+
audioBytesSent += Number(report.bytesSent);
|
|
8639
8631
|
}
|
|
8640
8632
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8641
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8633
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8642
8634
|
}
|
|
8643
8635
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8644
|
-
packetsLost += report.packetsLost;
|
|
8645
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
8646
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8636
|
+
packetsLost += Number(report.packetsLost);
|
|
8637
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8638
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8647
8639
|
}
|
|
8648
8640
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8649
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8641
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8650
8642
|
}
|
|
8651
8643
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8652
8644
|
if ('framesPerSecond' in report) {
|
|
8653
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
8645
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
8654
8646
|
}
|
|
8655
8647
|
if ('framerateMean' in report) {
|
|
8656
8648
|
// framerateMean is only available in FF
|
|
@@ -8658,16 +8650,16 @@ class WebRTCClient extends Emitter {
|
|
|
8658
8650
|
}
|
|
8659
8651
|
}
|
|
8660
8652
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8661
|
-
packetsLost += report.packetsLost;
|
|
8662
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
8663
|
-
networkStats.jitter = report.jitter;
|
|
8653
|
+
packetsLost += Number(report.packetsLost);
|
|
8654
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
8655
|
+
networkStats.jitter = Number(report.jitter);
|
|
8664
8656
|
}
|
|
8665
8657
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8666
|
-
packetsLost += report.packetsLost;
|
|
8658
|
+
packetsLost += Number(report.packetsLost);
|
|
8667
8659
|
}
|
|
8668
8660
|
if (report.type === 'transport') {
|
|
8669
|
-
transportSent += report.bytesSent;
|
|
8670
|
-
transportReceived += report.bytesReceived;
|
|
8661
|
+
transportSent += Number(report.bytesSent);
|
|
8662
|
+
transportReceived += Number(report.bytesReceived);
|
|
8671
8663
|
}
|
|
8672
8664
|
});
|
|
8673
8665
|
|
|
@@ -9253,18 +9245,20 @@ class WebRTCPhone extends Emitter {
|
|
|
9253
9245
|
screenTrack,
|
|
9254
9246
|
});
|
|
9255
9247
|
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
|
|
9261
|
-
|
|
9248
|
+
if (screenTrack) {
|
|
9249
|
+
screenTrack.onended = () => {
|
|
9250
|
+
logger$7.info('WebRTC phone - on screenshare ended', {
|
|
9251
|
+
hadVideo,
|
|
9252
|
+
id: this.getSipSessionId(sipSession),
|
|
9253
|
+
screenTrack,
|
|
9254
|
+
});
|
|
9262
9255
|
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
|
|
9266
|
-
|
|
9267
|
-
|
|
9256
|
+
this.eventEmitter.emit(
|
|
9257
|
+
ON_SHARE_SCREEN_ENDING,
|
|
9258
|
+
this._createCallSession(sipSession, callSession),
|
|
9259
|
+
);
|
|
9260
|
+
};
|
|
9261
|
+
}
|
|
9268
9262
|
|
|
9269
9263
|
this.currentScreenShare = {
|
|
9270
9264
|
stream: screenStream,
|