@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
|
@@ -419,10 +419,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
419
419
|
candidates
|
|
420
420
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
421
421
|
|
|
422
|
-
const areCandidateValid = (candidates ) =>
|
|
423
|
-
getSrflxOrRelay(candidates)
|
|
424
|
-
.length > 0;
|
|
425
|
-
|
|
426
422
|
const fixSdp = (sdp , candidates , forcePort = true) => {
|
|
427
423
|
const parsedSdp = sdpParser__default['default'].parse(sdp);
|
|
428
424
|
const mainCandidate = getSrflxOrRelay(candidates)[0];
|
|
@@ -454,8 +450,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
454
450
|
/* global RTCSessionDescriptionInit, navigator */
|
|
455
451
|
|
|
456
452
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
457
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
458
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
459
453
|
|
|
460
454
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
461
455
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -645,38 +639,6 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
645
639
|
this._peerConnection = undefined;
|
|
646
640
|
}
|
|
647
641
|
|
|
648
|
-
async _waitForValidGatheredIce() {
|
|
649
|
-
let tries = 0;
|
|
650
|
-
|
|
651
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
652
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
653
|
-
tries,
|
|
654
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
655
|
-
});
|
|
656
|
-
|
|
657
|
-
tries++;
|
|
658
|
-
|
|
659
|
-
// eslint-disable-next-line no-await-in-loop
|
|
660
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
664
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
665
|
-
const error = new Error(errorMsg);
|
|
666
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
667
|
-
|
|
668
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
669
|
-
this.eventEmitter.emit('error', error);
|
|
670
|
-
|
|
671
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
// eslint-disable-next-line
|
|
675
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
676
|
-
|
|
677
|
-
return this.getLocalSessionDescription();
|
|
678
|
-
}
|
|
679
|
-
|
|
680
642
|
// Overridden to send `inactive` in conference
|
|
681
643
|
updateDirection(options , isConference = false,
|
|
682
644
|
audioOnly = false) {
|
package/lib/service/CallApi.js
CHANGED
|
@@ -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
|
|
|
@@ -1040,6 +1043,9 @@ class Contact {
|
|
|
1040
1043
|
}
|
|
1041
1044
|
|
|
1042
1045
|
static parseMany(response ) {
|
|
1046
|
+
if (!response || !response.results) {
|
|
1047
|
+
return [];
|
|
1048
|
+
}
|
|
1043
1049
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
1044
1050
|
}
|
|
1045
1051
|
|
|
@@ -1712,6 +1718,9 @@ class Recording {
|
|
|
1712
1718
|
|
|
1713
1719
|
|
|
1714
1720
|
static parseMany(recordings = []) {
|
|
1721
|
+
if (!recordings) {
|
|
1722
|
+
return [];
|
|
1723
|
+
}
|
|
1715
1724
|
return recordings.map(item => Recording.parse(item));
|
|
1716
1725
|
}
|
|
1717
1726
|
|
|
@@ -1813,6 +1822,10 @@ class CallLog {
|
|
|
1813
1822
|
}
|
|
1814
1823
|
|
|
1815
1824
|
static parseMany(plain ) {
|
|
1825
|
+
if (!plain || !plain.items) {
|
|
1826
|
+
return [];
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1816
1829
|
return plain.items.map(item => CallLog.parse(item));
|
|
1817
1830
|
}
|
|
1818
1831
|
|
|
@@ -3168,6 +3181,9 @@ class Meeting {
|
|
|
3168
3181
|
}
|
|
3169
3182
|
|
|
3170
3183
|
static parseMany(items ) {
|
|
3184
|
+
if (!items) {
|
|
3185
|
+
return [];
|
|
3186
|
+
}
|
|
3171
3187
|
return items.map(plain => Meeting.parse(plain));
|
|
3172
3188
|
}
|
|
3173
3189
|
|
|
@@ -3327,6 +3343,10 @@ class ChatMessage {
|
|
|
3327
3343
|
|
|
3328
3344
|
|
|
3329
3345
|
static parseMany(plain ) {
|
|
3346
|
+
if (!plain || !plain.items) {
|
|
3347
|
+
return [];
|
|
3348
|
+
}
|
|
3349
|
+
|
|
3330
3350
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
3331
3351
|
}
|
|
3332
3352
|
|
|
@@ -3436,6 +3456,9 @@ class Voicemail {
|
|
|
3436
3456
|
}
|
|
3437
3457
|
|
|
3438
3458
|
static parseMany(plain ) {
|
|
3459
|
+
if (!plain) {
|
|
3460
|
+
return [];
|
|
3461
|
+
}
|
|
3439
3462
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
3440
3463
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
3441
3464
|
|
|
@@ -3826,6 +3849,9 @@ class ChatRoom {
|
|
|
3826
3849
|
|
|
3827
3850
|
|
|
3828
3851
|
static parseMany(plain ) {
|
|
3852
|
+
if (!plain || !plain.items) {
|
|
3853
|
+
return [];
|
|
3854
|
+
}
|
|
3829
3855
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
3830
3856
|
}
|
|
3831
3857
|
|
|
@@ -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
|
|
|
@@ -2646,6 +2649,9 @@ class Meeting {
|
|
|
2646
2649
|
}
|
|
2647
2650
|
|
|
2648
2651
|
static parseMany(items ) {
|
|
2652
|
+
if (!items) {
|
|
2653
|
+
return [];
|
|
2654
|
+
}
|
|
2649
2655
|
return items.map(plain => Meeting.parse(plain));
|
|
2650
2656
|
}
|
|
2651
2657
|
|
|
@@ -2848,6 +2854,10 @@ class ChatMessage {
|
|
|
2848
2854
|
|
|
2849
2855
|
|
|
2850
2856
|
static parseMany(plain ) {
|
|
2857
|
+
if (!plain || !plain.items) {
|
|
2858
|
+
return [];
|
|
2859
|
+
}
|
|
2860
|
+
|
|
2851
2861
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2852
2862
|
}
|
|
2853
2863
|
|
|
@@ -2957,6 +2967,9 @@ class Voicemail {
|
|
|
2957
2967
|
}
|
|
2958
2968
|
|
|
2959
2969
|
static parseMany(plain ) {
|
|
2970
|
+
if (!plain) {
|
|
2971
|
+
return [];
|
|
2972
|
+
}
|
|
2960
2973
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2961
2974
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2962
2975
|
|
|
@@ -3066,6 +3079,9 @@ class Call {
|
|
|
3066
3079
|
|
|
3067
3080
|
|
|
3068
3081
|
static parseMany(plain ) {
|
|
3082
|
+
if (!plain) {
|
|
3083
|
+
return [];
|
|
3084
|
+
}
|
|
3069
3085
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3070
3086
|
}
|
|
3071
3087
|
|
|
@@ -3238,6 +3254,9 @@ class Recording {
|
|
|
3238
3254
|
|
|
3239
3255
|
|
|
3240
3256
|
static parseMany(recordings = []) {
|
|
3257
|
+
if (!recordings) {
|
|
3258
|
+
return [];
|
|
3259
|
+
}
|
|
3241
3260
|
return recordings.map(item => Recording.parse(item));
|
|
3242
3261
|
}
|
|
3243
3262
|
|
|
@@ -3339,6 +3358,10 @@ class CallLog {
|
|
|
3339
3358
|
}
|
|
3340
3359
|
|
|
3341
3360
|
static parseMany(plain ) {
|
|
3361
|
+
if (!plain || !plain.items) {
|
|
3362
|
+
return [];
|
|
3363
|
+
}
|
|
3364
|
+
|
|
3342
3365
|
return plain.items.map(item => CallLog.parse(item));
|
|
3343
3366
|
}
|
|
3344
3367
|
|
|
@@ -3896,6 +3919,9 @@ class ChatRoom {
|
|
|
3896
3919
|
|
|
3897
3920
|
|
|
3898
3921
|
static parseMany(plain ) {
|
|
3922
|
+
if (!plain || !plain.items) {
|
|
3923
|
+
return [];
|
|
3924
|
+
}
|
|
3899
3925
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
3900
3926
|
}
|
|
3901
3927
|
|
package/lib/simple/Auth.js
CHANGED
|
@@ -875,6 +875,9 @@ class Contact {
|
|
|
875
875
|
}
|
|
876
876
|
|
|
877
877
|
static parseMany(response ) {
|
|
878
|
+
if (!response || !response.results) {
|
|
879
|
+
return [];
|
|
880
|
+
}
|
|
878
881
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
879
882
|
}
|
|
880
883
|
|
|
@@ -2669,6 +2672,9 @@ class Meeting {
|
|
|
2669
2672
|
}
|
|
2670
2673
|
|
|
2671
2674
|
static parseMany(items ) {
|
|
2675
|
+
if (!items) {
|
|
2676
|
+
return [];
|
|
2677
|
+
}
|
|
2672
2678
|
return items.map(plain => Meeting.parse(plain));
|
|
2673
2679
|
}
|
|
2674
2680
|
|
|
@@ -2871,6 +2877,10 @@ class ChatMessage {
|
|
|
2871
2877
|
|
|
2872
2878
|
|
|
2873
2879
|
static parseMany(plain ) {
|
|
2880
|
+
if (!plain || !plain.items) {
|
|
2881
|
+
return [];
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2874
2884
|
return plain.items.map(item => ChatMessage.parse(item));
|
|
2875
2885
|
}
|
|
2876
2886
|
|
|
@@ -2980,6 +2990,9 @@ class Voicemail {
|
|
|
2980
2990
|
}
|
|
2981
2991
|
|
|
2982
2992
|
static parseMany(plain ) {
|
|
2993
|
+
if (!plain) {
|
|
2994
|
+
return [];
|
|
2995
|
+
}
|
|
2983
2996
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
2984
2997
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
2985
2998
|
|
|
@@ -3089,6 +3102,9 @@ class Call {
|
|
|
3089
3102
|
|
|
3090
3103
|
|
|
3091
3104
|
static parseMany(plain ) {
|
|
3105
|
+
if (!plain) {
|
|
3106
|
+
return [];
|
|
3107
|
+
}
|
|
3092
3108
|
return plain.map((plainCall ) => Call.parse(plainCall));
|
|
3093
3109
|
}
|
|
3094
3110
|
|
|
@@ -3632,6 +3648,9 @@ class Recording {
|
|
|
3632
3648
|
|
|
3633
3649
|
|
|
3634
3650
|
static parseMany(recordings = []) {
|
|
3651
|
+
if (!recordings) {
|
|
3652
|
+
return [];
|
|
3653
|
+
}
|
|
3635
3654
|
return recordings.map(item => Recording.parse(item));
|
|
3636
3655
|
}
|
|
3637
3656
|
|
|
@@ -3733,6 +3752,10 @@ class CallLog {
|
|
|
3733
3752
|
}
|
|
3734
3753
|
|
|
3735
3754
|
static parseMany(plain ) {
|
|
3755
|
+
if (!plain || !plain.items) {
|
|
3756
|
+
return [];
|
|
3757
|
+
}
|
|
3758
|
+
|
|
3736
3759
|
return plain.items.map(item => CallLog.parse(item));
|
|
3737
3760
|
}
|
|
3738
3761
|
|
|
@@ -4302,6 +4325,10 @@ class CTIPhone extends Emitter {
|
|
|
4302
4325
|
return false;
|
|
4303
4326
|
}
|
|
4304
4327
|
|
|
4328
|
+
hasAVideoTrack() {
|
|
4329
|
+
return false;
|
|
4330
|
+
}
|
|
4331
|
+
|
|
4305
4332
|
getLocalStreamForCall() {
|
|
4306
4333
|
return null;
|
|
4307
4334
|
}
|
|
@@ -4695,6 +4722,9 @@ class ChatRoom {
|
|
|
4695
4722
|
|
|
4696
4723
|
|
|
4697
4724
|
static parseMany(plain ) {
|
|
4725
|
+
if (!plain || !plain.items) {
|
|
4726
|
+
return [];
|
|
4727
|
+
}
|
|
4698
4728
|
return plain.items.map(item => ChatRoom.parse(item));
|
|
4699
4729
|
}
|
|
4700
4730
|
|
|
@@ -5676,10 +5706,6 @@ const getSrflxOrRelay = (candidates ) =>
|
|
|
5676
5706
|
candidates
|
|
5677
5707
|
.filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
|
|
5678
5708
|
|
|
5679
|
-
const areCandidateValid = (candidates ) =>
|
|
5680
|
-
getSrflxOrRelay(candidates)
|
|
5681
|
-
.length > 0;
|
|
5682
|
-
|
|
5683
5709
|
const getVideoDirection = (sdp ) => {
|
|
5684
5710
|
const parsedSdp = sdpParser__default['default'].parse(sdp);
|
|
5685
5711
|
const videoMedia = parsedSdp.media.find(media => media.type === 'video');
|
|
@@ -5732,8 +5758,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
|
|
|
5732
5758
|
/* global RTCSessionDescriptionInit, navigator */
|
|
5733
5759
|
|
|
5734
5760
|
const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
|
|
5735
|
-
const MAX_WAIT_FOR_ICE_TRIES = 20;
|
|
5736
|
-
const WAIT_FOR_ICE_TIMEOUT = 500;
|
|
5737
5761
|
|
|
5738
5762
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
5739
5763
|
const wazoMediaStreamFactory = (constraints ) => {
|
|
@@ -5923,38 +5947,6 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
5923
5947
|
this._peerConnection = undefined;
|
|
5924
5948
|
}
|
|
5925
5949
|
|
|
5926
|
-
async _waitForValidGatheredIce() {
|
|
5927
|
-
let tries = 0;
|
|
5928
|
-
|
|
5929
|
-
while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
|
|
5930
|
-
wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
|
|
5931
|
-
tries,
|
|
5932
|
-
max: MAX_WAIT_FOR_ICE_TRIES,
|
|
5933
|
-
});
|
|
5934
|
-
|
|
5935
|
-
tries++;
|
|
5936
|
-
|
|
5937
|
-
// eslint-disable-next-line no-await-in-loop
|
|
5938
|
-
await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
|
|
5939
|
-
}
|
|
5940
|
-
|
|
5941
|
-
if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
|
|
5942
|
-
const errorMsg = 'No valid candidates found, can\'t answer the call';
|
|
5943
|
-
const error = new Error(errorMsg);
|
|
5944
|
-
wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
|
|
5945
|
-
|
|
5946
|
-
// Emit an error, because sip.js catches the exception and switch to status Terminated.
|
|
5947
|
-
this.eventEmitter.emit('error', error);
|
|
5948
|
-
|
|
5949
|
-
wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
5950
|
-
}
|
|
5951
|
-
|
|
5952
|
-
// eslint-disable-next-line
|
|
5953
|
-
wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
|
|
5954
|
-
|
|
5955
|
-
return this.getLocalSessionDescription();
|
|
5956
|
-
}
|
|
5957
|
-
|
|
5958
5950
|
// Overridden to send `inactive` in conference
|
|
5959
5951
|
updateDirection(options , isConference = false,
|
|
5960
5952
|
audioOnly = false) {
|
|
@@ -8370,25 +8362,25 @@ class WebRTCClient extends Emitter {
|
|
|
8370
8362
|
|
|
8371
8363
|
stats.forEach(report => {
|
|
8372
8364
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8373
|
-
audioBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8365
|
+
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8374
8366
|
}
|
|
8375
8367
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8376
|
-
audioBytesSent += report.bytesSent;
|
|
8368
|
+
audioBytesSent += Number(report.bytesSent);
|
|
8377
8369
|
}
|
|
8378
8370
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8379
|
-
videoBytesSent += report.bytesSent + report.headerBytesSent;
|
|
8371
|
+
videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8380
8372
|
}
|
|
8381
8373
|
if (report.type === 'inbound-rtp' && report.kind === 'audio') {
|
|
8382
|
-
packetsLost += report.packetsLost;
|
|
8383
|
-
networkStats.packetsReceived = report.packetsReceived;
|
|
8384
|
-
audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8374
|
+
packetsLost += Number(report.packetsLost);
|
|
8375
|
+
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8376
|
+
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8385
8377
|
}
|
|
8386
8378
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8387
|
-
videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
|
|
8379
|
+
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8388
8380
|
}
|
|
8389
8381
|
if (report.type === 'outbound-rtp' && report.kind === 'video') {
|
|
8390
8382
|
if ('framesPerSecond' in report) {
|
|
8391
|
-
networkStats.framesPerSecond = report.framesPerSecond;
|
|
8383
|
+
networkStats.framesPerSecond = Number(report.framesPerSecond);
|
|
8392
8384
|
}
|
|
8393
8385
|
if ('framerateMean' in report) {
|
|
8394
8386
|
// framerateMean is only available in FF
|
|
@@ -8396,16 +8388,16 @@ class WebRTCClient extends Emitter {
|
|
|
8396
8388
|
}
|
|
8397
8389
|
}
|
|
8398
8390
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
|
|
8399
|
-
packetsLost += report.packetsLost;
|
|
8400
|
-
networkStats.roundTripTime = report.roundTripTime;
|
|
8401
|
-
networkStats.jitter = report.jitter;
|
|
8391
|
+
packetsLost += Number(report.packetsLost);
|
|
8392
|
+
networkStats.roundTripTime = Number(report.roundTripTime);
|
|
8393
|
+
networkStats.jitter = Number(report.jitter);
|
|
8402
8394
|
}
|
|
8403
8395
|
if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
|
|
8404
|
-
packetsLost += report.packetsLost;
|
|
8396
|
+
packetsLost += Number(report.packetsLost);
|
|
8405
8397
|
}
|
|
8406
8398
|
if (report.type === 'transport') {
|
|
8407
|
-
transportSent += report.bytesSent;
|
|
8408
|
-
transportReceived += report.bytesReceived;
|
|
8399
|
+
transportSent += Number(report.bytesSent);
|
|
8400
|
+
transportReceived += Number(report.bytesReceived);
|
|
8409
8401
|
}
|
|
8410
8402
|
});
|
|
8411
8403
|
|
|
@@ -8991,18 +8983,20 @@ class WebRTCPhone extends Emitter {
|
|
|
8991
8983
|
screenTrack,
|
|
8992
8984
|
});
|
|
8993
8985
|
|
|
8994
|
-
|
|
8995
|
-
|
|
8996
|
-
|
|
8997
|
-
|
|
8998
|
-
|
|
8999
|
-
|
|
8986
|
+
if (screenTrack) {
|
|
8987
|
+
screenTrack.onended = () => {
|
|
8988
|
+
logger$8.info('WebRTC phone - on screenshare ended', {
|
|
8989
|
+
hadVideo,
|
|
8990
|
+
id: this.getSipSessionId(sipSession),
|
|
8991
|
+
screenTrack,
|
|
8992
|
+
});
|
|
9000
8993
|
|
|
9001
|
-
|
|
9002
|
-
|
|
9003
|
-
|
|
9004
|
-
|
|
9005
|
-
|
|
8994
|
+
this.eventEmitter.emit(
|
|
8995
|
+
ON_SHARE_SCREEN_ENDING,
|
|
8996
|
+
this._createCallSession(sipSession, callSession),
|
|
8997
|
+
);
|
|
8998
|
+
};
|
|
8999
|
+
}
|
|
9006
9000
|
|
|
9007
9001
|
this.currentScreenShare = {
|
|
9008
9002
|
stream: screenStream,
|
|
@@ -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
|
|
|
@@ -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,
|