@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.
Files changed (113) hide show
  1. package/dist/wazo-sdk.js +5 -5
  2. package/esm/__tests__/api-client.test.js +26 -0
  3. package/esm/__tests__/web-rtc-client.test.js +40 -52
  4. package/esm/api/call-logd.js +7 -0
  5. package/esm/api/calld.js +10 -0
  6. package/esm/api/chatd.js +7 -0
  7. package/esm/api/confd.js +3 -0
  8. package/esm/api/ctid-ng.js +10 -0
  9. package/esm/api/dird.js +3 -0
  10. package/esm/api-client.js +26 -0
  11. package/esm/checker/Checker.js +40 -52
  12. package/esm/checker/checks/aor.js +26 -0
  13. package/esm/checker/checks/api.js +26 -0
  14. package/esm/checker/checks/index.js +40 -52
  15. package/esm/checker/checks/webrtc-transport.js +40 -52
  16. package/esm/checker/checks/webrtc.js +40 -52
  17. package/esm/domain/AdHocAPIConference.js +26 -0
  18. package/esm/domain/Call.js +3 -0
  19. package/esm/domain/CallLog.js +7 -0
  20. package/esm/domain/ChatMessage.js +4 -0
  21. package/esm/domain/ChatRoom.js +3 -0
  22. package/esm/domain/Contact.js +3 -0
  23. package/esm/domain/Features.js +26 -0
  24. package/esm/domain/Meeting.js +3 -0
  25. package/esm/domain/Phone/CTIPhone.js +30 -0
  26. package/esm/domain/Phone/WebRTCPhone.js +14 -12
  27. package/esm/domain/Recording.js +3 -0
  28. package/esm/domain/Voicemail.js +3 -0
  29. package/esm/domain/__tests__/Call.test.js +3 -0
  30. package/esm/domain/__tests__/CallLog.test.js +7 -0
  31. package/esm/domain/__tests__/Contact.test.js +3 -0
  32. package/esm/domain/__tests__/Voicemail.test.js +3 -0
  33. package/esm/index.js +57 -63
  34. package/esm/lib/WazoSessionDescriptionHandler.js +0 -38
  35. package/esm/service/CallApi.js +26 -0
  36. package/esm/service/getApiClient.js +26 -0
  37. package/esm/simple/Auth.js +57 -63
  38. package/esm/simple/Configuration.js +57 -63
  39. package/esm/simple/Directory.js +26 -0
  40. package/esm/simple/Phone.js +57 -63
  41. package/esm/simple/index.js +57 -63
  42. package/esm/simple/room/LocalParticipant.js +57 -63
  43. package/esm/simple/room/Participant.js +57 -63
  44. package/esm/simple/room/RemoteParticipant.js +57 -63
  45. package/esm/simple/room/Room.js +57 -63
  46. package/esm/simple/room/SipRoom.js +57 -63
  47. package/esm/simple/room/Stream.js +57 -63
  48. package/esm/simple/room/__tests__/RemoteParticipant.test.js +57 -63
  49. package/esm/simple/utils.js +57 -63
  50. package/esm/web-rtc-client.js +40 -52
  51. package/lib/__tests__/api-client.test.js +26 -0
  52. package/lib/__tests__/web-rtc-client.test.js +40 -52
  53. package/lib/api/call-logd.js +7 -0
  54. package/lib/api/calld.js +10 -0
  55. package/lib/api/chatd.js +7 -0
  56. package/lib/api/confd.js +3 -0
  57. package/lib/api/ctid-ng.js +10 -0
  58. package/lib/api/dird.js +3 -0
  59. package/lib/api-client.js +26 -0
  60. package/lib/checker/Checker.js +40 -52
  61. package/lib/checker/checks/aor.js +26 -0
  62. package/lib/checker/checks/api.js +26 -0
  63. package/lib/checker/checks/index.js +40 -52
  64. package/lib/checker/checks/webrtc-transport.js +40 -52
  65. package/lib/checker/checks/webrtc.js +40 -52
  66. package/lib/domain/AdHocAPIConference.js +26 -0
  67. package/lib/domain/Call.js +3 -0
  68. package/lib/domain/CallLog.js +7 -0
  69. package/lib/domain/ChatMessage.js +4 -0
  70. package/lib/domain/ChatRoom.js +3 -0
  71. package/lib/domain/Contact.js +3 -0
  72. package/lib/domain/Features.js +26 -0
  73. package/lib/domain/Meeting.js +3 -0
  74. package/lib/domain/Phone/CTIPhone.js +30 -0
  75. package/lib/domain/Phone/WebRTCPhone.js +14 -12
  76. package/lib/domain/Recording.js +3 -0
  77. package/lib/domain/Voicemail.js +3 -0
  78. package/lib/domain/__tests__/Call.test.js +3 -0
  79. package/lib/domain/__tests__/CallLog.test.js +7 -0
  80. package/lib/domain/__tests__/Contact.test.js +3 -0
  81. package/lib/domain/__tests__/Voicemail.test.js +3 -0
  82. package/lib/index.js +57 -63
  83. package/lib/lib/WazoSessionDescriptionHandler.js +0 -38
  84. package/lib/service/CallApi.js +26 -0
  85. package/lib/service/getApiClient.js +26 -0
  86. package/lib/simple/Auth.js +57 -63
  87. package/lib/simple/Configuration.js +57 -63
  88. package/lib/simple/Directory.js +26 -0
  89. package/lib/simple/Phone.js +57 -63
  90. package/lib/simple/index.js +57 -63
  91. package/lib/simple/room/LocalParticipant.js +57 -63
  92. package/lib/simple/room/Participant.js +57 -63
  93. package/lib/simple/room/RemoteParticipant.js +57 -63
  94. package/lib/simple/room/Room.js +57 -63
  95. package/lib/simple/room/SipRoom.js +57 -63
  96. package/lib/simple/room/Stream.js +57 -63
  97. package/lib/simple/room/__tests__/RemoteParticipant.test.js +57 -63
  98. package/lib/simple/utils.js +57 -63
  99. package/lib/web-rtc-client.js +40 -52
  100. package/package.json +1 -1
  101. package/src/domain/Call.js +3 -0
  102. package/src/domain/CallLog.js +4 -0
  103. package/src/domain/ChatMessage.js +4 -0
  104. package/src/domain/ChatRoom.js +3 -0
  105. package/src/domain/Contact.js +3 -0
  106. package/src/domain/Meeting.js +3 -0
  107. package/src/domain/Phone/CTIPhone.js +4 -0
  108. package/src/domain/Phone/Phone.js +2 -0
  109. package/src/domain/Phone/WebRTCPhone.js +14 -12
  110. package/src/domain/Recording.js +3 -0
  111. package/src/domain/Voicemail.js +3 -0
  112. package/src/lib/WazoSessionDescriptionHandler.js +1 -35
  113. package/src/web-rtc-client.js +14 -14
@@ -82,6 +82,9 @@ class Call {
82
82
 
83
83
 
84
84
  static parseMany(plain ) {
85
+ if (!plain) {
86
+ return [];
87
+ }
85
88
  return plain.map((plainCall ) => Call.parse(plainCall));
86
89
  }
87
90
 
@@ -1743,6 +1746,9 @@ class Contact {
1743
1746
  }
1744
1747
 
1745
1748
  static parseMany(response ) {
1749
+ if (!response || !response.results) {
1750
+ return [];
1751
+ }
1746
1752
  return response.results.map(r => Contact.parse(r, response.column_types));
1747
1753
  }
1748
1754
 
@@ -2850,6 +2856,9 @@ class Meeting {
2850
2856
  }
2851
2857
 
2852
2858
  static parseMany(items ) {
2859
+ if (!items) {
2860
+ return [];
2861
+ }
2853
2862
  return items.map(plain => Meeting.parse(plain));
2854
2863
  }
2855
2864
 
@@ -3052,6 +3061,10 @@ class ChatMessage {
3052
3061
 
3053
3062
 
3054
3063
  static parseMany(plain ) {
3064
+ if (!plain || !plain.items) {
3065
+ return [];
3066
+ }
3067
+
3055
3068
  return plain.items.map(item => ChatMessage.parse(item));
3056
3069
  }
3057
3070
 
@@ -3161,6 +3174,9 @@ class Voicemail {
3161
3174
  }
3162
3175
 
3163
3176
  static parseMany(plain ) {
3177
+ if (!plain) {
3178
+ return [];
3179
+ }
3164
3180
  const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
3165
3181
  const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
3166
3182
 
@@ -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
 
@@ -77,6 +77,9 @@ class Call {
77
77
 
78
78
 
79
79
  static parseMany(plain ) {
80
+ if (!plain) {
81
+ return [];
82
+ }
80
83
  return plain.map((plainCall ) => Call.parse(plainCall));
81
84
  }
82
85
 
@@ -60,6 +60,9 @@ class Recording {
60
60
 
61
61
 
62
62
  static parseMany(recordings = []) {
63
+ if (!recordings) {
64
+ return [];
65
+ }
63
66
  return recordings.map(item => Recording.parse(item));
64
67
  }
65
68
 
@@ -161,6 +164,10 @@ class CallLog {
161
164
  }
162
165
 
163
166
  static parseMany(plain ) {
167
+ if (!plain || !plain.items) {
168
+ return [];
169
+ }
170
+
164
171
  return plain.items.map(item => CallLog.parse(item));
165
172
  }
166
173
 
@@ -58,6 +58,10 @@ class ChatMessage {
58
58
 
59
59
 
60
60
  static parseMany(plain ) {
61
+ if (!plain || !plain.items) {
62
+ return [];
63
+ }
64
+
61
65
  return plain.items.map(item => ChatMessage.parse(item));
62
66
  }
63
67
 
@@ -33,6 +33,9 @@ class ChatRoom {
33
33
 
34
34
 
35
35
  static parseMany(plain ) {
36
+ if (!plain || !plain.items) {
37
+ return [];
38
+ }
36
39
  return plain.items.map(item => ChatRoom.parse(item));
37
40
  }
38
41
 
@@ -329,6 +329,9 @@ class Contact {
329
329
  }
330
330
 
331
331
  static parseMany(response ) {
332
+ if (!response || !response.results) {
333
+ return [];
334
+ }
332
335
  return response.results.map(r => Contact.parse(r, response.column_types));
333
336
  }
334
337
 
@@ -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
 
@@ -50,6 +50,9 @@ class Meeting {
50
50
  }
51
51
 
52
52
  static parseMany(items ) {
53
+ if (!items) {
54
+ return [];
55
+ }
53
56
  return items.map(plain => Meeting.parse(plain));
54
57
  }
55
58
 
@@ -853,6 +853,9 @@ class Contact {
853
853
  }
854
854
 
855
855
  static parseMany(response ) {
856
+ if (!response || !response.results) {
857
+ return [];
858
+ }
856
859
  return response.results.map(r => Contact.parse(r, response.column_types));
857
860
  }
858
861
 
@@ -1559,6 +1562,9 @@ class Call {
1559
1562
 
1560
1563
 
1561
1564
  static parseMany(plain ) {
1565
+ if (!plain) {
1566
+ return [];
1567
+ }
1562
1568
  return plain.map((plainCall ) => Call.parse(plainCall));
1563
1569
  }
1564
1570
 
@@ -2102,6 +2108,9 @@ class Recording {
2102
2108
 
2103
2109
 
2104
2110
  static parseMany(recordings = []) {
2111
+ if (!recordings) {
2112
+ return [];
2113
+ }
2105
2114
  return recordings.map(item => Recording.parse(item));
2106
2115
  }
2107
2116
 
@@ -2203,6 +2212,10 @@ class CallLog {
2203
2212
  }
2204
2213
 
2205
2214
  static parseMany(plain ) {
2215
+ if (!plain || !plain.items) {
2216
+ return [];
2217
+ }
2218
+
2206
2219
  return plain.items.map(item => CallLog.parse(item));
2207
2220
  }
2208
2221
 
@@ -3542,6 +3555,9 @@ class Meeting {
3542
3555
  }
3543
3556
 
3544
3557
  static parseMany(items ) {
3558
+ if (!items) {
3559
+ return [];
3560
+ }
3545
3561
  return items.map(plain => Meeting.parse(plain));
3546
3562
  }
3547
3563
 
@@ -3701,6 +3717,10 @@ class ChatMessage {
3701
3717
 
3702
3718
 
3703
3719
  static parseMany(plain ) {
3720
+ if (!plain || !plain.items) {
3721
+ return [];
3722
+ }
3723
+
3704
3724
  return plain.items.map(item => ChatMessage.parse(item));
3705
3725
  }
3706
3726
 
@@ -3810,6 +3830,9 @@ class Voicemail {
3810
3830
  }
3811
3831
 
3812
3832
  static parseMany(plain ) {
3833
+ if (!plain) {
3834
+ return [];
3835
+ }
3813
3836
  const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
3814
3837
  const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
3815
3838
 
@@ -4193,6 +4216,9 @@ class ChatRoom {
4193
4216
 
4194
4217
 
4195
4218
  static parseMany(plain ) {
4219
+ if (!plain || !plain.items) {
4220
+ return [];
4221
+ }
4196
4222
  return plain.items.map(item => ChatRoom.parse(item));
4197
4223
  }
4198
4224
 
@@ -5377,6 +5403,10 @@ class CTIPhone extends Emitter {
5377
5403
  return false;
5378
5404
  }
5379
5405
 
5406
+ hasAVideoTrack() {
5407
+ return false;
5408
+ }
5409
+
5380
5410
  getLocalStreamForCall() {
5381
5411
  return null;
5382
5412
  }
@@ -1426,18 +1426,20 @@ class WebRTCPhone extends Emitter {
1426
1426
  screenTrack,
1427
1427
  });
1428
1428
 
1429
- screenTrack.onended = () => {
1430
- logger.info('WebRTC phone - on screenshare ended', {
1431
- hadVideo,
1432
- id: this.getSipSessionId(sipSession),
1433
- screenTrack,
1434
- });
1435
-
1436
- this.eventEmitter.emit(
1437
- ON_SHARE_SCREEN_ENDING,
1438
- this._createCallSession(sipSession, callSession),
1439
- );
1440
- };
1429
+ if (screenTrack) {
1430
+ screenTrack.onended = () => {
1431
+ logger.info('WebRTC phone - on screenshare ended', {
1432
+ hadVideo,
1433
+ id: this.getSipSessionId(sipSession),
1434
+ screenTrack,
1435
+ });
1436
+
1437
+ this.eventEmitter.emit(
1438
+ ON_SHARE_SCREEN_ENDING,
1439
+ this._createCallSession(sipSession, callSession),
1440
+ );
1441
+ };
1442
+ }
1441
1443
 
1442
1444
  this.currentScreenShare = {
1443
1445
  stream: screenStream,
@@ -32,6 +32,9 @@ class Recording {
32
32
 
33
33
 
34
34
  static parseMany(recordings = []) {
35
+ if (!recordings) {
36
+ return [];
37
+ }
35
38
  return recordings.map(item => Recording.parse(item));
36
39
  }
37
40
 
@@ -77,6 +77,9 @@ class Voicemail {
77
77
  }
78
78
 
79
79
  static parseMany(plain ) {
80
+ if (!plain) {
81
+ return [];
82
+ }
80
83
  const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
81
84
  const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
82
85
 
@@ -77,6 +77,9 @@ class Call {
77
77
 
78
78
 
79
79
  static parseMany(plain ) {
80
+ if (!plain) {
81
+ return [];
82
+ }
80
83
  return plain.map((plainCall ) => Call.parse(plainCall));
81
84
  }
82
85
 
@@ -60,6 +60,9 @@ class Recording {
60
60
 
61
61
 
62
62
  static parseMany(recordings = []) {
63
+ if (!recordings) {
64
+ return [];
65
+ }
63
66
  return recordings.map(item => Recording.parse(item));
64
67
  }
65
68
 
@@ -161,6 +164,10 @@ class CallLog {
161
164
  }
162
165
 
163
166
  static parseMany(plain ) {
167
+ if (!plain || !plain.items) {
168
+ return [];
169
+ }
170
+
164
171
  return plain.items.map(item => CallLog.parse(item));
165
172
  }
166
173
 
@@ -327,6 +327,9 @@ class Contact {
327
327
  }
328
328
 
329
329
  static parseMany(response ) {
330
+ if (!response || !response.results) {
331
+ return [];
332
+ }
330
333
  return response.results.map(r => Contact.parse(r, response.column_types));
331
334
  }
332
335
 
@@ -77,6 +77,9 @@ class Voicemail {
77
77
  }
78
78
 
79
79
  static parseMany(plain ) {
80
+ if (!plain) {
81
+ return [];
82
+ }
80
83
  const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
81
84
  const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
82
85
 
package/lib/index.js CHANGED
@@ -1562,6 +1562,9 @@ class Contact {
1562
1562
  }
1563
1563
 
1564
1564
  static parseMany(response ) {
1565
+ if (!response || !response.results) {
1566
+ return [];
1567
+ }
1565
1568
  return response.results.map(r => Contact.parse(r, response.column_types));
1566
1569
  }
1567
1570
 
@@ -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
 
@@ -4385,6 +4408,10 @@ class CTIPhone extends Emitter {
4385
4408
  return false;
4386
4409
  }
4387
4410
 
4411
+ hasAVideoTrack() {
4412
+ return false;
4413
+ }
4414
+
4388
4415
  getLocalStreamForCall() {
4389
4416
  return null;
4390
4417
  }
@@ -4778,6 +4805,9 @@ class ChatRoom {
4778
4805
 
4779
4806
 
4780
4807
  static parseMany(plain ) {
4808
+ if (!plain || !plain.items) {
4809
+ return [];
4810
+ }
4781
4811
  return plain.items.map(item => ChatRoom.parse(item));
4782
4812
  }
4783
4813
 
@@ -5501,10 +5531,6 @@ const getSrflxOrRelay = (candidates ) =>
5501
5531
  candidates
5502
5532
  .filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
5503
5533
 
5504
- const areCandidateValid = (candidates ) =>
5505
- getSrflxOrRelay(candidates)
5506
- .length > 0;
5507
-
5508
5534
  const getVideoDirection = (sdp ) => {
5509
5535
  const parsedSdp = sdpParser__default['default'].parse(sdp);
5510
5536
  const videoMedia = parsedSdp.media.find(media => media.type === 'video');
@@ -5557,8 +5583,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
5557
5583
  /* global RTCSessionDescriptionInit, navigator */
5558
5584
 
5559
5585
  const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
5560
- const MAX_WAIT_FOR_ICE_TRIES = 20;
5561
- const WAIT_FOR_ICE_TIMEOUT = 500;
5562
5586
 
5563
5587
  // Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
5564
5588
  const wazoMediaStreamFactory = (constraints ) => {
@@ -5748,38 +5772,6 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
5748
5772
  this._peerConnection = undefined;
5749
5773
  }
5750
5774
 
5751
- async _waitForValidGatheredIce() {
5752
- let tries = 0;
5753
-
5754
- while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
5755
- wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
5756
- tries,
5757
- max: MAX_WAIT_FOR_ICE_TRIES,
5758
- });
5759
-
5760
- tries++;
5761
-
5762
- // eslint-disable-next-line no-await-in-loop
5763
- await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
5764
- }
5765
-
5766
- if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
5767
- const errorMsg = 'No valid candidates found, can\'t answer the call';
5768
- const error = new Error(errorMsg);
5769
- wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
5770
-
5771
- // Emit an error, because sip.js catches the exception and switch to status Terminated.
5772
- this.eventEmitter.emit('error', error);
5773
-
5774
- wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
5775
- }
5776
-
5777
- // eslint-disable-next-line
5778
- wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
5779
-
5780
- return this.getLocalSessionDescription();
5781
- }
5782
-
5783
5775
  // Overridden to send `inactive` in conference
5784
5776
  updateDirection(options , isConference = false,
5785
5777
  audioOnly = false) {
@@ -8195,25 +8187,25 @@ class WebRTCClient extends Emitter {
8195
8187
 
8196
8188
  stats.forEach(report => {
8197
8189
  if (report.type === 'outbound-rtp' && report.kind === 'audio') {
8198
- audioBytesSent += report.bytesSent + report.headerBytesSent;
8190
+ audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
8199
8191
  }
8200
8192
  if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
8201
- audioBytesSent += report.bytesSent;
8193
+ audioBytesSent += Number(report.bytesSent);
8202
8194
  }
8203
8195
  if (report.type === 'outbound-rtp' && report.kind === 'video') {
8204
- videoBytesSent += report.bytesSent + report.headerBytesSent;
8196
+ videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
8205
8197
  }
8206
8198
  if (report.type === 'inbound-rtp' && report.kind === 'audio') {
8207
- packetsLost += report.packetsLost;
8208
- networkStats.packetsReceived = report.packetsReceived;
8209
- audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
8199
+ packetsLost += Number(report.packetsLost);
8200
+ networkStats.packetsReceived = Number(report.packetsReceived);
8201
+ audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
8210
8202
  }
8211
8203
  if (report.type === 'inbound-rtp' && report.kind === 'video') {
8212
- videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
8204
+ videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
8213
8205
  }
8214
8206
  if (report.type === 'outbound-rtp' && report.kind === 'video') {
8215
8207
  if ('framesPerSecond' in report) {
8216
- networkStats.framesPerSecond = report.framesPerSecond;
8208
+ networkStats.framesPerSecond = Number(report.framesPerSecond);
8217
8209
  }
8218
8210
  if ('framerateMean' in report) {
8219
8211
  // framerateMean is only available in FF
@@ -8221,16 +8213,16 @@ class WebRTCClient extends Emitter {
8221
8213
  }
8222
8214
  }
8223
8215
  if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
8224
- packetsLost += report.packetsLost;
8225
- networkStats.roundTripTime = report.roundTripTime;
8226
- networkStats.jitter = report.jitter;
8216
+ packetsLost += Number(report.packetsLost);
8217
+ networkStats.roundTripTime = Number(report.roundTripTime);
8218
+ networkStats.jitter = Number(report.jitter);
8227
8219
  }
8228
8220
  if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
8229
- packetsLost += report.packetsLost;
8221
+ packetsLost += Number(report.packetsLost);
8230
8222
  }
8231
8223
  if (report.type === 'transport') {
8232
- transportSent += report.bytesSent;
8233
- transportReceived += report.bytesReceived;
8224
+ transportSent += Number(report.bytesSent);
8225
+ transportReceived += Number(report.bytesReceived);
8234
8226
  }
8235
8227
  });
8236
8228
 
@@ -9709,18 +9701,20 @@ class WebRTCPhone extends Emitter {
9709
9701
  screenTrack,
9710
9702
  });
9711
9703
 
9712
- screenTrack.onended = () => {
9713
- logger$7.info('WebRTC phone - on screenshare ended', {
9714
- hadVideo,
9715
- id: this.getSipSessionId(sipSession),
9716
- screenTrack,
9717
- });
9704
+ if (screenTrack) {
9705
+ screenTrack.onended = () => {
9706
+ logger$7.info('WebRTC phone - on screenshare ended', {
9707
+ hadVideo,
9708
+ id: this.getSipSessionId(sipSession),
9709
+ screenTrack,
9710
+ });
9718
9711
 
9719
- this.eventEmitter.emit(
9720
- ON_SHARE_SCREEN_ENDING,
9721
- this._createCallSession(sipSession, callSession),
9722
- );
9723
- };
9712
+ this.eventEmitter.emit(
9713
+ ON_SHARE_SCREEN_ENDING,
9714
+ this._createCallSession(sipSession, callSession),
9715
+ );
9716
+ };
9717
+ }
9724
9718
 
9725
9719
  this.currentScreenShare = {
9726
9720
  stream: screenStream,