@wazo/sdk 0.38.5 → 0.38.8

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 (135) hide show
  1. package/README.md +1 -1
  2. package/dist/wazo-sdk.js +2 -2
  3. package/esm/__tests__/api-client.test.js +148 -2
  4. package/esm/__tests__/web-rtc-client.test.js +303 -26
  5. package/esm/api/calld.js +14 -0
  6. package/esm/api/confd.js +134 -2
  7. package/esm/api/ctid-ng.js +6 -0
  8. package/esm/api-client.js +148 -2
  9. package/esm/checker/Checker.js +212 -26
  10. package/esm/checker/checks/aor.js +148 -2
  11. package/esm/checker/checks/api.js +148 -2
  12. package/esm/checker/checks/index.js +212 -26
  13. package/esm/checker/checks/wazo-websocket.js +2 -0
  14. package/esm/checker/checks/webrtc-transport.js +210 -26
  15. package/esm/checker/checks/webrtc.js +210 -26
  16. package/esm/domain/AdHocAPIConference.js +148 -2
  17. package/esm/domain/Call.js +6 -0
  18. package/esm/domain/CallSession.js +1 -1
  19. package/esm/domain/Features.js +148 -2
  20. package/esm/domain/Meeting.js +18 -0
  21. package/esm/domain/MeetingAuthorization.js +70 -0
  22. package/esm/domain/Phone/CTIPhone.js +149 -3
  23. package/esm/domain/Phone/WebRTCPhone.js +3 -3
  24. package/esm/domain/__tests__/Call.test.js +6 -0
  25. package/esm/domain/__tests__/CallSession.test.js +1 -1
  26. package/esm/domain/__tests__/IndirectTransfer.test.js +1 -1
  27. package/esm/domain/__tests__/Meeting.test.js +87 -1
  28. package/esm/domain/__tests__/MeetingAuthorization.test.js +109 -0
  29. package/esm/domain/__tests__/Room.test.js +1 -1
  30. package/esm/index.js +258 -32
  31. package/esm/lib/WazoSessionDescriptionHandler.js +22 -1
  32. package/esm/service/CallApi.js +148 -2
  33. package/esm/service/getApiClient.js +148 -2
  34. package/esm/simple/Auth.js +258 -32
  35. package/esm/simple/Configuration.js +258 -32
  36. package/esm/simple/Directory.js +148 -2
  37. package/esm/simple/Phone.js +258 -32
  38. package/esm/simple/Websocket.js +3 -0
  39. package/esm/simple/index.js +258 -32
  40. package/esm/simple/room/LocalParticipant.js +258 -32
  41. package/esm/simple/room/Participant.js +258 -32
  42. package/esm/simple/room/RemoteParticipant.js +258 -32
  43. package/esm/simple/room/Room.js +258 -32
  44. package/esm/simple/room/SipRoom.js +258 -32
  45. package/esm/simple/room/Stream.js +258 -32
  46. package/esm/simple/room/__tests__/Participant.test.js +14747 -0
  47. package/esm/simple/room/__tests__/RemoteParticipant.test.js +258 -32
  48. package/esm/simple/utils.js +258 -32
  49. package/esm/utils/__tests__/object.test.js +57 -0
  50. package/esm/utils/__tests__/sdp.test.js +50 -0
  51. package/esm/utils/__tests__/string.test.js +30 -0
  52. package/esm/utils/object.js +24 -0
  53. package/esm/utils/sdp.js +19 -1
  54. package/esm/utils/string.js +10 -0
  55. package/esm/web-rtc-client.js +210 -26
  56. package/esm/websocket-client.js +3 -1
  57. package/lib/__tests__/api-client.test.js +148 -2
  58. package/lib/__tests__/web-rtc-client.test.js +303 -26
  59. package/lib/api/calld.js +14 -0
  60. package/lib/api/confd.js +134 -2
  61. package/lib/api/ctid-ng.js +6 -0
  62. package/lib/api-client.js +148 -2
  63. package/lib/checker/Checker.js +212 -26
  64. package/lib/checker/checks/aor.js +148 -2
  65. package/lib/checker/checks/api.js +148 -2
  66. package/lib/checker/checks/index.js +212 -26
  67. package/lib/checker/checks/wazo-websocket.js +2 -0
  68. package/lib/checker/checks/webrtc-transport.js +210 -26
  69. package/lib/checker/checks/webrtc.js +210 -26
  70. package/lib/domain/AdHocAPIConference.js +148 -2
  71. package/lib/domain/Call.js +6 -0
  72. package/lib/domain/CallSession.js +1 -1
  73. package/lib/domain/Features.js +148 -2
  74. package/lib/domain/Meeting.js +18 -0
  75. package/lib/domain/MeetingAuthorization.js +79 -0
  76. package/lib/domain/Phone/CTIPhone.js +149 -3
  77. package/lib/domain/Phone/WebRTCPhone.js +3 -3
  78. package/lib/domain/__tests__/Call.test.js +6 -0
  79. package/lib/domain/__tests__/CallSession.test.js +1 -1
  80. package/lib/domain/__tests__/IndirectTransfer.test.js +1 -1
  81. package/lib/domain/__tests__/Meeting.test.js +87 -1
  82. package/lib/domain/__tests__/MeetingAuthorization.test.js +111 -0
  83. package/lib/domain/__tests__/Room.test.js +1 -1
  84. package/lib/index.js +258 -32
  85. package/lib/lib/WazoSessionDescriptionHandler.js +22 -1
  86. package/lib/service/CallApi.js +148 -2
  87. package/lib/service/getApiClient.js +148 -2
  88. package/lib/simple/Auth.js +258 -32
  89. package/lib/simple/Configuration.js +258 -32
  90. package/lib/simple/Directory.js +148 -2
  91. package/lib/simple/Phone.js +258 -32
  92. package/lib/simple/Websocket.js +3 -0
  93. package/lib/simple/index.js +258 -32
  94. package/lib/simple/room/LocalParticipant.js +258 -32
  95. package/lib/simple/room/Participant.js +258 -32
  96. package/lib/simple/room/RemoteParticipant.js +258 -32
  97. package/lib/simple/room/Room.js +258 -32
  98. package/lib/simple/room/SipRoom.js +258 -32
  99. package/lib/simple/room/Stream.js +258 -32
  100. package/lib/simple/room/__tests__/Participant.test.js +14757 -0
  101. package/lib/simple/room/__tests__/RemoteParticipant.test.js +258 -32
  102. package/lib/simple/utils.js +258 -32
  103. package/lib/utils/__tests__/object.test.js +59 -0
  104. package/lib/utils/__tests__/sdp.test.js +50 -0
  105. package/lib/utils/__tests__/string.test.js +32 -0
  106. package/lib/utils/object.js +28 -0
  107. package/lib/utils/sdp.js +19 -0
  108. package/lib/utils/string.js +14 -0
  109. package/lib/web-rtc-client.js +210 -26
  110. package/lib/websocket-client.js +3 -0
  111. package/package.json +2 -2
  112. package/src/__tests__/web-rtc-client.test.js +93 -0
  113. package/src/api/calld.js +8 -0
  114. package/src/api/confd.js +43 -2
  115. package/src/domain/Call.js +6 -0
  116. package/src/domain/CallSession.js +1 -1
  117. package/src/domain/Meeting.js +20 -0
  118. package/src/domain/MeetingAuthorization.js +67 -0
  119. package/src/domain/Phone/WebRTCPhone.js +2 -2
  120. package/src/domain/__tests__/Meeting.test.js +70 -1
  121. package/src/domain/__tests__/MeetingAuthorization.test.js +58 -0
  122. package/src/lib/WazoSessionDescriptionHandler.js +5 -2
  123. package/src/simple/room/Participant.js +40 -0
  124. package/src/simple/room/Room.js +2 -2
  125. package/src/simple/room/SipRoom.js +1 -1
  126. package/src/simple/room/__tests__/Participant.test.js +81 -0
  127. package/src/types/WebSocketMessage.js +7 -1
  128. package/src/utils/__tests__/object.test.js +35 -0
  129. package/src/utils/__tests__/sdp.test.js +33 -1
  130. package/src/utils/__tests__/string.test.js +23 -0
  131. package/src/utils/object.js +15 -0
  132. package/src/utils/sdp.js +18 -0
  133. package/src/utils/string.js +8 -0
  134. package/src/web-rtc-client.js +40 -23
  135. package/src/websocket-client.js +2 -0
@@ -2631,6 +2631,70 @@ class ExternalApp {
2631
2631
 
2632
2632
  //
2633
2633
 
2634
+ class MeetingAuthorization {
2635
+
2636
+
2637
+
2638
+
2639
+
2640
+
2641
+ constructor({
2642
+ meetingUuid,
2643
+ uuid,
2644
+ userUuid,
2645
+ userName,
2646
+ } = {}) {
2647
+ this.meetingUuid = meetingUuid;
2648
+ this.uuid = uuid;
2649
+ this.userUuid = userUuid;
2650
+ this.userName = userName;
2651
+ }
2652
+
2653
+ setStatus(status ) {
2654
+ this.status = status;
2655
+ }
2656
+
2657
+ getStatus() {
2658
+ return this.status;
2659
+ }
2660
+
2661
+ static parse(plain ) {
2662
+ const {
2663
+ meeting_uuid: meetingUuid,
2664
+ uuid,
2665
+ guest_uuid: userUuid,
2666
+ guest_name: userName,
2667
+ } = plain;
2668
+
2669
+ return new MeetingAuthorization({
2670
+ meetingUuid,
2671
+ uuid,
2672
+ userUuid,
2673
+ userName,
2674
+ });
2675
+ }
2676
+
2677
+ static parseMany(items ) {
2678
+ if (!items) {
2679
+ return [];
2680
+ }
2681
+ return items.map(MeetingAuthorization.parse);
2682
+ }
2683
+ }
2684
+
2685
+ //
2686
+
2687
+
2688
+
2689
+
2690
+
2691
+
2692
+
2693
+
2694
+
2695
+
2696
+
2697
+
2634
2698
 
2635
2699
 
2636
2700
 
@@ -2641,6 +2705,7 @@ class ExternalApp {
2641
2705
 
2642
2706
 
2643
2707
 
2708
+
2644
2709
 
2645
2710
 
2646
2711
  class Meeting {
@@ -2655,6 +2720,8 @@ class Meeting {
2655
2720
 
2656
2721
 
2657
2722
 
2723
+
2724
+
2658
2725
 
2659
2726
  static parse(plain ) {
2660
2727
  return new Meeting({
@@ -2667,6 +2734,7 @@ class Meeting {
2667
2734
  extension: plain.exten,
2668
2735
  persistent: plain.persistent,
2669
2736
  creationTime: moment__default['default'](plain.creation_time).toDate(),
2737
+ requireAuthorization: plain.require_authorization,
2670
2738
  });
2671
2739
  }
2672
2740
 
@@ -2691,6 +2759,7 @@ class Meeting {
2691
2759
  extension,
2692
2760
  persistent,
2693
2761
  creationTime,
2762
+ requireAuthorization,
2694
2763
  } = {}) {
2695
2764
  this.guestSipAuthorization = guestSipAuthorization;
2696
2765
  this.uri = uri;
@@ -2701,6 +2770,7 @@ class Meeting {
2701
2770
  this.extension = extension;
2702
2771
  this.persistent = persistent;
2703
2772
  this.creationTime = creationTime;
2773
+ this.requireAuthorization = requireAuthorization;
2704
2774
 
2705
2775
  // Useful to compare instead of instanceof with minified code
2706
2776
  this.type = 'Meeting';
@@ -2711,8 +2781,32 @@ class Meeting {
2711
2781
  const [username, secret] = atob(this.guestSipAuthorization).split(':');
2712
2782
  return { username, secret };
2713
2783
  }
2784
+
2714
2785
  }
2715
2786
 
2787
+ //
2788
+
2789
+ const camelToUnderscore = (key ) => {
2790
+ if (typeof key !== 'string') {
2791
+ throw new Error('Input is not a string');
2792
+ }
2793
+ return key.charAt(0).toLowerCase() + key.substring(1).replace(/([A-Z])/g, '_$1').toLowerCase();
2794
+ };
2795
+
2796
+ //
2797
+
2798
+ const convertKeysFromCamelToUnderscore = (args ) => {
2799
+ if (!args || typeof args !== 'object' || Array.isArray(args)) {
2800
+ throw new Error('Input is not an object');
2801
+ }
2802
+
2803
+ return Object.keys(args).reduce((acc, key) => {
2804
+ acc[camelToUnderscore(key)] = typeof args[key] === 'object' && !Array.isArray(args[key])
2805
+ ? convertKeysFromCamelToUnderscore(args[key]) : args[key];
2806
+ return acc;
2807
+ }, {});
2808
+ };
2809
+
2716
2810
  /* */
2717
2811
 
2718
2812
  var confdMethods = (client , baseUrl ) => ({
@@ -2781,8 +2875,18 @@ var confdMethods = (client , baseUrl ) => ({
2781
2875
  getMyMeetings: () =>
2782
2876
  client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
2783
2877
 
2784
- createMyMeeting: (name , persistent ) =>
2785
- client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
2878
+ createMyMeeting: (args ) =>
2879
+ client
2880
+ .post(`${baseUrl}/users/me/meetings`, convertKeysFromCamelToUnderscore(args))
2881
+ .then(Meeting.parse),
2882
+
2883
+ updateMyMeeting: (meetingUuid , data ) =>
2884
+ client.put(
2885
+ `${baseUrl}/users/me/meetings/${meetingUuid}`,
2886
+ convertKeysFromCamelToUnderscore(data),
2887
+ null,
2888
+ ApiRequester.successResponseParser,
2889
+ ),
2786
2890
 
2787
2891
  deleteMyMeeting: (meetingUuid ) =>
2788
2892
  client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
@@ -2790,8 +2894,36 @@ var confdMethods = (client , baseUrl ) => ({
2790
2894
  getMeeting: (meetingUuid ) =>
2791
2895
  client.get(`${baseUrl}/meetings/${meetingUuid}`, null).then(Meeting.parse),
2792
2896
 
2897
+ meetingAuthorizations: (meetingUuid ) =>
2898
+ client.get(`${baseUrl}/users/me/meetings/${meetingUuid}/authorizations`, null).then(MeetingAuthorization.parseMany),
2899
+
2900
+ meetingAuthorizationReject: (meetingUuid , authorizationUuid ) =>
2901
+ client.put(
2902
+ `${baseUrl}/users/me/meetings/${meetingUuid}/authorizations/${authorizationUuid}/reject`,
2903
+ {},
2904
+ null,
2905
+ ApiRequester.successResponseParser,
2906
+ ),
2907
+
2908
+ meetingAuthorizationAccept: (meetingUuid , authorizationUuid ) =>
2909
+ client.put(
2910
+ `${baseUrl}/users/me/meetings/${meetingUuid}/authorizations/${authorizationUuid}/accept`,
2911
+ {},
2912
+ null,
2913
+ ApiRequester.successResponseParser,
2914
+ ),
2915
+
2793
2916
  guestGetMeeting: (meetingUuid ) =>
2794
2917
  client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}`, null).then(Meeting.parse),
2918
+
2919
+ guestAuthorizationRequest: (userUuid , meetingUuid , username ) =>
2920
+ client
2921
+ .post(`${baseUrl}/guests/${userUuid}/meetings/${meetingUuid}/authorizations`, { guest_name: username })
2922
+ .then(MeetingAuthorization.parse),
2923
+
2924
+ guestAuthorizationCheck: (userUuid , meetingUuid , authorizationUuid ) =>
2925
+ client.get(`${baseUrl}/guests/${userUuid}/meetings/${meetingUuid}/authorizations/${authorizationUuid}`, null),
2926
+
2795
2927
  });
2796
2928
 
2797
2929
  //
@@ -3057,6 +3189,7 @@ const RECORD_STATE_ACTIVE = 'active';
3057
3189
 
3058
3190
 
3059
3191
 
3192
+
3060
3193
 
3061
3194
 
3062
3195
 
@@ -3067,6 +3200,7 @@ const RECORD_STATE_ACTIVE = 'active';
3067
3200
 
3068
3201
 
3069
3202
 
3203
+
3070
3204
 
3071
3205
 
3072
3206
 
@@ -3095,6 +3229,7 @@ class Call {
3095
3229
 
3096
3230
 
3097
3231
 
3232
+
3098
3233
 
3099
3234
 
3100
3235
 
@@ -3119,6 +3254,7 @@ class Call {
3119
3254
  calleeNumber: plain.peer_caller_id_number,
3120
3255
  dialedExtension: plain.dialed_extension,
3121
3256
  isCaller: plain.is_caller,
3257
+ isVideo: plain.is_video,
3122
3258
  muted: plain.muted,
3123
3259
  onHold: plain.on_hold,
3124
3260
  status: plain.status,
@@ -3142,6 +3278,7 @@ class Call {
3142
3278
  calleeNumber,
3143
3279
  dialedExtension,
3144
3280
  isCaller,
3281
+ isVideo,
3145
3282
  lineId,
3146
3283
  muted,
3147
3284
  onHold,
@@ -3165,6 +3302,7 @@ class Call {
3165
3302
  this.startingTime = startingTime;
3166
3303
  this.talkingToIds = talkingToIds || [];
3167
3304
  this.recording = recording;
3305
+ this.isVideo = !!isVideo;
3168
3306
 
3169
3307
  // Useful to compare instead of instanceof with minified code
3170
3308
  this.type = 'Call';
@@ -4224,6 +4362,14 @@ var calldMethods = (client , baseUrl ) => ({
4224
4362
  getMeetingParticipantsAsUser: async (meetingUuid ) =>
4225
4363
  client.get(`${baseUrl}/users/me/meetings/${meetingUuid}/participants`),
4226
4364
 
4365
+ banMeetingParticipant: (meetingUuid , participantUuid ) =>
4366
+ client.delete(
4367
+ `${baseUrl}/users/me/meetings/${meetingUuid}/participants/${participantUuid}`,
4368
+ null,
4369
+ null,
4370
+ ApiRequester.successResponseParser,
4371
+ ),
4372
+
4227
4373
  listTrunks: () => client.get(`${baseUrl}/trunks`),
4228
4374
 
4229
4375
  mute: (callId ) =>
@@ -2653,6 +2653,70 @@ class ExternalApp {
2653
2653
 
2654
2654
  //
2655
2655
 
2656
+ class MeetingAuthorization {
2657
+
2658
+
2659
+
2660
+
2661
+
2662
+
2663
+ constructor({
2664
+ meetingUuid,
2665
+ uuid,
2666
+ userUuid,
2667
+ userName,
2668
+ } = {}) {
2669
+ this.meetingUuid = meetingUuid;
2670
+ this.uuid = uuid;
2671
+ this.userUuid = userUuid;
2672
+ this.userName = userName;
2673
+ }
2674
+
2675
+ setStatus(status ) {
2676
+ this.status = status;
2677
+ }
2678
+
2679
+ getStatus() {
2680
+ return this.status;
2681
+ }
2682
+
2683
+ static parse(plain ) {
2684
+ const {
2685
+ meeting_uuid: meetingUuid,
2686
+ uuid,
2687
+ guest_uuid: userUuid,
2688
+ guest_name: userName,
2689
+ } = plain;
2690
+
2691
+ return new MeetingAuthorization({
2692
+ meetingUuid,
2693
+ uuid,
2694
+ userUuid,
2695
+ userName,
2696
+ });
2697
+ }
2698
+
2699
+ static parseMany(items ) {
2700
+ if (!items) {
2701
+ return [];
2702
+ }
2703
+ return items.map(MeetingAuthorization.parse);
2704
+ }
2705
+ }
2706
+
2707
+ //
2708
+
2709
+
2710
+
2711
+
2712
+
2713
+
2714
+
2715
+
2716
+
2717
+
2718
+
2719
+
2656
2720
 
2657
2721
 
2658
2722
 
@@ -2663,6 +2727,7 @@ class ExternalApp {
2663
2727
 
2664
2728
 
2665
2729
 
2730
+
2666
2731
 
2667
2732
 
2668
2733
  class Meeting {
@@ -2677,6 +2742,8 @@ class Meeting {
2677
2742
 
2678
2743
 
2679
2744
 
2745
+
2746
+
2680
2747
 
2681
2748
  static parse(plain ) {
2682
2749
  return new Meeting({
@@ -2689,6 +2756,7 @@ class Meeting {
2689
2756
  extension: plain.exten,
2690
2757
  persistent: plain.persistent,
2691
2758
  creationTime: moment__default['default'](plain.creation_time).toDate(),
2759
+ requireAuthorization: plain.require_authorization,
2692
2760
  });
2693
2761
  }
2694
2762
 
@@ -2713,6 +2781,7 @@ class Meeting {
2713
2781
  extension,
2714
2782
  persistent,
2715
2783
  creationTime,
2784
+ requireAuthorization,
2716
2785
  } = {}) {
2717
2786
  this.guestSipAuthorization = guestSipAuthorization;
2718
2787
  this.uri = uri;
@@ -2723,6 +2792,7 @@ class Meeting {
2723
2792
  this.extension = extension;
2724
2793
  this.persistent = persistent;
2725
2794
  this.creationTime = creationTime;
2795
+ this.requireAuthorization = requireAuthorization;
2726
2796
 
2727
2797
  // Useful to compare instead of instanceof with minified code
2728
2798
  this.type = 'Meeting';
@@ -2733,8 +2803,32 @@ class Meeting {
2733
2803
  const [username, secret] = atob(this.guestSipAuthorization).split(':');
2734
2804
  return { username, secret };
2735
2805
  }
2806
+
2736
2807
  }
2737
2808
 
2809
+ //
2810
+
2811
+ const camelToUnderscore = (key ) => {
2812
+ if (typeof key !== 'string') {
2813
+ throw new Error('Input is not a string');
2814
+ }
2815
+ return key.charAt(0).toLowerCase() + key.substring(1).replace(/([A-Z])/g, '_$1').toLowerCase();
2816
+ };
2817
+
2818
+ //
2819
+
2820
+ const convertKeysFromCamelToUnderscore = (args ) => {
2821
+ if (!args || typeof args !== 'object' || Array.isArray(args)) {
2822
+ throw new Error('Input is not an object');
2823
+ }
2824
+
2825
+ return Object.keys(args).reduce((acc, key) => {
2826
+ acc[camelToUnderscore(key)] = typeof args[key] === 'object' && !Array.isArray(args[key])
2827
+ ? convertKeysFromCamelToUnderscore(args[key]) : args[key];
2828
+ return acc;
2829
+ }, {});
2830
+ };
2831
+
2738
2832
  /* */
2739
2833
 
2740
2834
  var confdMethods = (client , baseUrl ) => ({
@@ -2803,8 +2897,18 @@ var confdMethods = (client , baseUrl ) => ({
2803
2897
  getMyMeetings: () =>
2804
2898
  client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
2805
2899
 
2806
- createMyMeeting: (name , persistent ) =>
2807
- client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
2900
+ createMyMeeting: (args ) =>
2901
+ client
2902
+ .post(`${baseUrl}/users/me/meetings`, convertKeysFromCamelToUnderscore(args))
2903
+ .then(Meeting.parse),
2904
+
2905
+ updateMyMeeting: (meetingUuid , data ) =>
2906
+ client.put(
2907
+ `${baseUrl}/users/me/meetings/${meetingUuid}`,
2908
+ convertKeysFromCamelToUnderscore(data),
2909
+ null,
2910
+ ApiRequester.successResponseParser,
2911
+ ),
2808
2912
 
2809
2913
  deleteMyMeeting: (meetingUuid ) =>
2810
2914
  client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
@@ -2812,8 +2916,36 @@ var confdMethods = (client , baseUrl ) => ({
2812
2916
  getMeeting: (meetingUuid ) =>
2813
2917
  client.get(`${baseUrl}/meetings/${meetingUuid}`, null).then(Meeting.parse),
2814
2918
 
2919
+ meetingAuthorizations: (meetingUuid ) =>
2920
+ client.get(`${baseUrl}/users/me/meetings/${meetingUuid}/authorizations`, null).then(MeetingAuthorization.parseMany),
2921
+
2922
+ meetingAuthorizationReject: (meetingUuid , authorizationUuid ) =>
2923
+ client.put(
2924
+ `${baseUrl}/users/me/meetings/${meetingUuid}/authorizations/${authorizationUuid}/reject`,
2925
+ {},
2926
+ null,
2927
+ ApiRequester.successResponseParser,
2928
+ ),
2929
+
2930
+ meetingAuthorizationAccept: (meetingUuid , authorizationUuid ) =>
2931
+ client.put(
2932
+ `${baseUrl}/users/me/meetings/${meetingUuid}/authorizations/${authorizationUuid}/accept`,
2933
+ {},
2934
+ null,
2935
+ ApiRequester.successResponseParser,
2936
+ ),
2937
+
2815
2938
  guestGetMeeting: (meetingUuid ) =>
2816
2939
  client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}`, null).then(Meeting.parse),
2940
+
2941
+ guestAuthorizationRequest: (userUuid , meetingUuid , username ) =>
2942
+ client
2943
+ .post(`${baseUrl}/guests/${userUuid}/meetings/${meetingUuid}/authorizations`, { guest_name: username })
2944
+ .then(MeetingAuthorization.parse),
2945
+
2946
+ guestAuthorizationCheck: (userUuid , meetingUuid , authorizationUuid ) =>
2947
+ client.get(`${baseUrl}/guests/${userUuid}/meetings/${meetingUuid}/authorizations/${authorizationUuid}`, null),
2948
+
2817
2949
  });
2818
2950
 
2819
2951
  //
@@ -3079,6 +3211,7 @@ const RECORD_STATE_ACTIVE = 'active';
3079
3211
 
3080
3212
 
3081
3213
 
3214
+
3082
3215
 
3083
3216
 
3084
3217
 
@@ -3089,6 +3222,7 @@ const RECORD_STATE_ACTIVE = 'active';
3089
3222
 
3090
3223
 
3091
3224
 
3225
+
3092
3226
 
3093
3227
 
3094
3228
 
@@ -3117,6 +3251,7 @@ class Call {
3117
3251
 
3118
3252
 
3119
3253
 
3254
+
3120
3255
 
3121
3256
 
3122
3257
 
@@ -3141,6 +3276,7 @@ class Call {
3141
3276
  calleeNumber: plain.peer_caller_id_number,
3142
3277
  dialedExtension: plain.dialed_extension,
3143
3278
  isCaller: plain.is_caller,
3279
+ isVideo: plain.is_video,
3144
3280
  muted: plain.muted,
3145
3281
  onHold: plain.on_hold,
3146
3282
  status: plain.status,
@@ -3164,6 +3300,7 @@ class Call {
3164
3300
  calleeNumber,
3165
3301
  dialedExtension,
3166
3302
  isCaller,
3303
+ isVideo,
3167
3304
  lineId,
3168
3305
  muted,
3169
3306
  onHold,
@@ -3187,6 +3324,7 @@ class Call {
3187
3324
  this.startingTime = startingTime;
3188
3325
  this.talkingToIds = talkingToIds || [];
3189
3326
  this.recording = recording;
3327
+ this.isVideo = !!isVideo;
3190
3328
 
3191
3329
  // Useful to compare instead of instanceof with minified code
3192
3330
  this.type = 'Call';
@@ -4272,6 +4410,14 @@ var calldMethods = (client , baseUrl ) => ({
4272
4410
  getMeetingParticipantsAsUser: async (meetingUuid ) =>
4273
4411
  client.get(`${baseUrl}/users/me/meetings/${meetingUuid}/participants`),
4274
4412
 
4413
+ banMeetingParticipant: (meetingUuid , participantUuid ) =>
4414
+ client.delete(
4415
+ `${baseUrl}/users/me/meetings/${meetingUuid}/participants/${participantUuid}`,
4416
+ null,
4417
+ null,
4418
+ ApiRequester.successResponseParser,
4419
+ ),
4420
+
4275
4421
  listTrunks: () => client.get(`${baseUrl}/trunks`),
4276
4422
 
4277
4423
  mute: (callId ) =>
@@ -5063,6 +5209,7 @@ const AGENT_UNPAUSED = 'agent_unpaused';
5063
5209
  const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
5064
5210
  const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
5065
5211
  const MEETING_USER_PROGRESS = 'meeting_user_progress';
5212
+ const MEETING_USER_GUEST_AUTHORIZATION_CREATED = 'meeting_user_guest_authorization_created';
5066
5213
 
5067
5214
  const BLACKLIST_EVENTS = [
5068
5215
  CHAT_MESSAGE_SENT,
@@ -5414,6 +5561,7 @@ WebSocketClient.eventLists = [
5414
5561
  CONFERENCE_ADHOC_PARTICIPANT_LEFT,
5415
5562
  CONFERENCE_ADHOC_DELETED,
5416
5563
  MEETING_USER_PROGRESS,
5564
+ MEETING_USER_GUEST_AUTHORIZATION_CREATED,
5417
5565
  ];
5418
5566
 
5419
5567
  var wazoWebsocket = {
@@ -5518,6 +5666,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
5518
5666
  return fixed;
5519
5667
  };
5520
5668
 
5669
+ const addIcesInAllBundles = (sdp ) => {
5670
+ const parsedSdp = sdpParser__default['default'].parse(sdp);
5671
+
5672
+ const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
5673
+ if (!mediaWithCandidate) {
5674
+ return sdp;
5675
+ }
5676
+
5677
+ const { candidates } = mediaWithCandidate;
5678
+
5679
+ parsedSdp.media = parsedSdp.media.map(media => ({
5680
+ ...media,
5681
+ candidates: media.candidates || candidates,
5682
+ }));
5683
+
5684
+ return sdpParser__default['default'].write(parsedSdp);
5685
+ };
5686
+
5521
5687
  /* global RTCSessionDescriptionInit, navigator */
5522
5688
 
5523
5689
  const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
@@ -5647,7 +5813,10 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
5647
5813
 
5648
5814
  // Check if we got ICEs
5649
5815
  if (sdp.indexOf('a=candidate') !== -1) {
5650
- return description;
5816
+ return {
5817
+ type: description.type,
5818
+ sdp: addIcesInAllBundles(sdp),
5819
+ };
5651
5820
  }
5652
5821
 
5653
5822
  wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
@@ -7009,41 +7178,58 @@ class WebRTCClient extends Emitter {
7009
7178
  });
7010
7179
  }
7011
7180
 
7012
- changeAudioInputDevice(id , session ) {
7181
+ async changeAudioInputDevice(id , session , force ) {
7013
7182
  const currentId = this.getAudioDeviceId();
7014
7183
  logger.info('setting audio input device', { id, currentId, session: !!session });
7015
7184
 
7016
- if (id === currentId) {
7185
+ if (!force && id === currentId) {
7017
7186
  return null;
7018
7187
  }
7019
7188
 
7189
+ // in order to handle an audio track change for default devices
7190
+ // we need the actual id of the device (not 'default')
7191
+ let deviceId = id;
7192
+ if (id === 'default' && navigator.mediaDevices) {
7193
+ const devices = await navigator.mediaDevices.enumerateDevices();
7194
+ const defaultDevice = devices.find(device => device.deviceId === 'default');
7195
+ if (defaultDevice) {
7196
+ const deviceLabel = defaultDevice.label.replace('Default - ', '');
7197
+ const targetDevice = devices.find(device => device.label === deviceLabel);
7198
+ if (targetDevice) {
7199
+ deviceId = targetDevice.deviceId;
7200
+ if (!force && deviceId === currentId) {
7201
+ return null;
7202
+ }
7203
+ }
7204
+ }
7205
+ }
7206
+
7020
7207
  // let's update the local audio value
7021
7208
  if (this.audio) {
7022
7209
  this.audio = {
7023
7210
  deviceId: {
7024
- exact: id,
7211
+ exact: deviceId,
7025
7212
  },
7026
7213
  };
7027
7214
  }
7028
7215
 
7029
- if (session) {
7216
+ if (session && navigator.mediaDevices) {
7030
7217
  const sdh = session.sessionDescriptionHandler;
7031
7218
  const pc = sdh.peerConnection;
7032
7219
 
7033
- // $FlowFixMe
7034
- return navigator.mediaDevices.getUserMedia({ audio: { deviceId: { exact: id } } }).then(async stream => {
7035
- const audioTrack = stream.getAudioTracks()[0];
7036
- const sender = pc && pc.getSenders().find(s => audioTrack && s && s.track && s.track.kind === audioTrack.kind);
7220
+ const constraints = { audio: { deviceId: { exact: deviceId } } };
7221
+ const stream = await navigator.mediaDevices.getUserMedia(constraints);
7222
+ const audioTrack = stream.getAudioTracks()[0];
7223
+ const sender = pc && pc.getSenders().find(s => audioTrack && s && s.track && s.track.kind === audioTrack.kind);
7037
7224
 
7038
- if (sender) {
7039
- if (sender.track) {
7040
- audioTrack.enabled = sender.track.enabled;
7041
- }
7042
- sender.replaceTrack(audioTrack);
7225
+ if (sender) {
7226
+ if (sender.track) {
7227
+ audioTrack.enabled = sender.track.enabled;
7043
7228
  }
7229
+ sender.replaceTrack(audioTrack);
7230
+ }
7044
7231
 
7045
- return stream;
7046
- });
7232
+ return stream;
7047
7233
  }
7048
7234
  }
7049
7235
 
@@ -7063,14 +7249,14 @@ class WebRTCClient extends Emitter {
7063
7249
  return null;
7064
7250
  }
7065
7251
 
7066
- // let's update the local video value
7067
- if (this.video) {
7068
- this.video = {
7069
- deviceId: {
7070
- exact: id,
7071
- },
7072
- };
7073
- }
7252
+ // let's make sure we don't lose other video constraints settings -- width, height, frameRate...
7253
+ const videoObject = typeof this.video === 'object' ? this.video : {};
7254
+ this.video = {
7255
+ ...videoObject,
7256
+ deviceId: {
7257
+ exact: id,
7258
+ },
7259
+ };
7074
7260
  }
7075
7261
 
7076
7262
  changeSessionVideoInputDevice(id , session ) {
@@ -615,6 +615,7 @@ const AGENT_UNPAUSED = 'agent_unpaused';
615
615
  const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
616
616
  const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
617
617
  const MEETING_USER_PROGRESS = 'meeting_user_progress';
618
+ const MEETING_USER_GUEST_AUTHORIZATION_CREATED = 'meeting_user_guest_authorization_created';
618
619
 
619
620
  const BLACKLIST_EVENTS = [
620
621
  CHAT_MESSAGE_SENT,
@@ -966,6 +967,7 @@ WebSocketClient.eventLists = [
966
967
  CONFERENCE_ADHOC_PARTICIPANT_LEFT,
967
968
  CONFERENCE_ADHOC_DELETED,
968
969
  MEETING_USER_PROGRESS,
970
+ MEETING_USER_GUEST_AUTHORIZATION_CREATED,
969
971
  ];
970
972
 
971
973
  var wazoWebsocket = {