@wazo/sdk 0.38.6 → 0.38.9

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 (118) hide show
  1. package/dist/wazo-sdk.js +2 -2
  2. package/esm/__tests__/api-client.test.js +142 -2
  3. package/esm/__tests__/web-rtc-client.test.js +249 -28
  4. package/esm/api/calld.js +8 -0
  5. package/esm/api/confd.js +134 -2
  6. package/esm/api-client.js +142 -2
  7. package/esm/checker/Checker.js +205 -25
  8. package/esm/checker/checks/aor.js +142 -2
  9. package/esm/checker/checks/api.js +142 -2
  10. package/esm/checker/checks/index.js +205 -25
  11. package/esm/checker/checks/wazo-websocket.js +2 -0
  12. package/esm/checker/checks/webrtc-transport.js +203 -25
  13. package/esm/checker/checks/webrtc.js +203 -25
  14. package/esm/domain/AdHocAPIConference.js +142 -2
  15. package/esm/domain/Features.js +142 -2
  16. package/esm/domain/Meeting.js +18 -0
  17. package/esm/domain/MeetingAuthorization.js +70 -0
  18. package/esm/domain/Phone/CTIPhone.js +142 -2
  19. package/esm/domain/Phone/WebRTCPhone.js +1 -3
  20. package/esm/domain/__tests__/Meeting.test.js +87 -1
  21. package/esm/domain/__tests__/MeetingAuthorization.test.js +109 -0
  22. package/esm/index.js +249 -31
  23. package/esm/lib/WazoSessionDescriptionHandler.js +22 -1
  24. package/esm/service/CallApi.js +142 -2
  25. package/esm/service/getApiClient.js +142 -2
  26. package/esm/simple/Auth.js +249 -31
  27. package/esm/simple/Configuration.js +249 -31
  28. package/esm/simple/Directory.js +142 -2
  29. package/esm/simple/Phone.js +249 -31
  30. package/esm/simple/Websocket.js +3 -0
  31. package/esm/simple/index.js +249 -31
  32. package/esm/simple/room/LocalParticipant.js +249 -31
  33. package/esm/simple/room/Participant.js +249 -31
  34. package/esm/simple/room/RemoteParticipant.js +249 -31
  35. package/esm/simple/room/Room.js +249 -31
  36. package/esm/simple/room/SipRoom.js +249 -31
  37. package/esm/simple/room/Stream.js +249 -31
  38. package/esm/simple/room/__tests__/Participant.test.js +14745 -0
  39. package/esm/simple/room/__tests__/RemoteParticipant.test.js +249 -31
  40. package/esm/simple/utils.js +249 -31
  41. package/esm/utils/__tests__/object.test.js +57 -0
  42. package/esm/utils/__tests__/sdp.test.js +50 -0
  43. package/esm/utils/__tests__/string.test.js +30 -0
  44. package/esm/utils/object.js +24 -0
  45. package/esm/utils/sdp.js +19 -1
  46. package/esm/utils/string.js +10 -0
  47. package/esm/web-rtc-client.js +203 -25
  48. package/esm/websocket-client.js +3 -1
  49. package/lib/__tests__/api-client.test.js +142 -2
  50. package/lib/__tests__/web-rtc-client.test.js +249 -28
  51. package/lib/api/calld.js +8 -0
  52. package/lib/api/confd.js +134 -2
  53. package/lib/api-client.js +142 -2
  54. package/lib/checker/Checker.js +205 -25
  55. package/lib/checker/checks/aor.js +142 -2
  56. package/lib/checker/checks/api.js +142 -2
  57. package/lib/checker/checks/index.js +205 -25
  58. package/lib/checker/checks/wazo-websocket.js +2 -0
  59. package/lib/checker/checks/webrtc-transport.js +203 -25
  60. package/lib/checker/checks/webrtc.js +203 -25
  61. package/lib/domain/AdHocAPIConference.js +142 -2
  62. package/lib/domain/Features.js +142 -2
  63. package/lib/domain/Meeting.js +18 -0
  64. package/lib/domain/MeetingAuthorization.js +79 -0
  65. package/lib/domain/Phone/CTIPhone.js +142 -2
  66. package/lib/domain/Phone/WebRTCPhone.js +1 -3
  67. package/lib/domain/__tests__/Meeting.test.js +87 -1
  68. package/lib/domain/__tests__/MeetingAuthorization.test.js +111 -0
  69. package/lib/index.js +249 -31
  70. package/lib/lib/WazoSessionDescriptionHandler.js +22 -1
  71. package/lib/service/CallApi.js +142 -2
  72. package/lib/service/getApiClient.js +142 -2
  73. package/lib/simple/Auth.js +249 -31
  74. package/lib/simple/Configuration.js +249 -31
  75. package/lib/simple/Directory.js +142 -2
  76. package/lib/simple/Phone.js +249 -31
  77. package/lib/simple/Websocket.js +3 -0
  78. package/lib/simple/index.js +249 -31
  79. package/lib/simple/room/LocalParticipant.js +249 -31
  80. package/lib/simple/room/Participant.js +249 -31
  81. package/lib/simple/room/RemoteParticipant.js +249 -31
  82. package/lib/simple/room/Room.js +249 -31
  83. package/lib/simple/room/SipRoom.js +249 -31
  84. package/lib/simple/room/Stream.js +249 -31
  85. package/lib/simple/room/__tests__/Participant.test.js +14755 -0
  86. package/lib/simple/room/__tests__/RemoteParticipant.test.js +249 -31
  87. package/lib/simple/utils.js +249 -31
  88. package/lib/utils/__tests__/object.test.js +59 -0
  89. package/lib/utils/__tests__/sdp.test.js +50 -0
  90. package/lib/utils/__tests__/string.test.js +32 -0
  91. package/lib/utils/object.js +28 -0
  92. package/lib/utils/sdp.js +19 -0
  93. package/lib/utils/string.js +14 -0
  94. package/lib/web-rtc-client.js +203 -25
  95. package/lib/websocket-client.js +3 -0
  96. package/package.json +2 -2
  97. package/src/__tests__/web-rtc-client.test.js +46 -3
  98. package/src/api/calld.js +8 -0
  99. package/src/api/confd.js +43 -2
  100. package/src/domain/Meeting.js +20 -0
  101. package/src/domain/MeetingAuthorization.js +67 -0
  102. package/src/domain/Phone/WebRTCPhone.js +1 -3
  103. package/src/domain/__tests__/Meeting.test.js +70 -1
  104. package/src/domain/__tests__/MeetingAuthorization.test.js +58 -0
  105. package/src/lib/WazoSessionDescriptionHandler.js +5 -2
  106. package/src/simple/room/Participant.js +40 -0
  107. package/src/simple/room/Room.js +2 -2
  108. package/src/simple/room/SipRoom.js +1 -1
  109. package/src/simple/room/__tests__/Participant.test.js +81 -0
  110. package/src/types/WebSocketMessage.js +7 -1
  111. package/src/utils/__tests__/object.test.js +35 -0
  112. package/src/utils/__tests__/sdp.test.js +33 -1
  113. package/src/utils/__tests__/string.test.js +23 -0
  114. package/src/utils/object.js +15 -0
  115. package/src/utils/sdp.js +18 -0
  116. package/src/utils/string.js +8 -0
  117. package/src/web-rtc-client.js +39 -22
  118. package/src/websocket-client.js +2 -0
@@ -2846,6 +2846,70 @@ class ExternalApp {
2846
2846
 
2847
2847
  //
2848
2848
 
2849
+ class MeetingAuthorization {
2850
+
2851
+
2852
+
2853
+
2854
+
2855
+
2856
+ constructor({
2857
+ meetingUuid,
2858
+ uuid,
2859
+ userUuid,
2860
+ userName,
2861
+ } = {}) {
2862
+ this.meetingUuid = meetingUuid;
2863
+ this.uuid = uuid;
2864
+ this.userUuid = userUuid;
2865
+ this.userName = userName;
2866
+ }
2867
+
2868
+ setStatus(status ) {
2869
+ this.status = status;
2870
+ }
2871
+
2872
+ getStatus() {
2873
+ return this.status;
2874
+ }
2875
+
2876
+ static parse(plain ) {
2877
+ const {
2878
+ meeting_uuid: meetingUuid,
2879
+ uuid,
2880
+ guest_uuid: userUuid,
2881
+ guest_name: userName,
2882
+ } = plain;
2883
+
2884
+ return new MeetingAuthorization({
2885
+ meetingUuid,
2886
+ uuid,
2887
+ userUuid,
2888
+ userName,
2889
+ });
2890
+ }
2891
+
2892
+ static parseMany(items ) {
2893
+ if (!items) {
2894
+ return [];
2895
+ }
2896
+ return items.map(MeetingAuthorization.parse);
2897
+ }
2898
+ }
2899
+
2900
+ //
2901
+
2902
+
2903
+
2904
+
2905
+
2906
+
2907
+
2908
+
2909
+
2910
+
2911
+
2912
+
2849
2913
 
2850
2914
 
2851
2915
 
@@ -2856,6 +2920,7 @@ class ExternalApp {
2856
2920
 
2857
2921
 
2858
2922
 
2923
+
2859
2924
 
2860
2925
 
2861
2926
  class Meeting {
@@ -2870,6 +2935,8 @@ class Meeting {
2870
2935
 
2871
2936
 
2872
2937
 
2938
+
2939
+
2873
2940
 
2874
2941
  static parse(plain ) {
2875
2942
  return new Meeting({
@@ -2882,6 +2949,7 @@ class Meeting {
2882
2949
  extension: plain.exten,
2883
2950
  persistent: plain.persistent,
2884
2951
  creationTime: moment__default['default'](plain.creation_time).toDate(),
2952
+ requireAuthorization: plain.require_authorization,
2885
2953
  });
2886
2954
  }
2887
2955
 
@@ -2906,6 +2974,7 @@ class Meeting {
2906
2974
  extension,
2907
2975
  persistent,
2908
2976
  creationTime,
2977
+ requireAuthorization,
2909
2978
  } = {}) {
2910
2979
  this.guestSipAuthorization = guestSipAuthorization;
2911
2980
  this.uri = uri;
@@ -2916,6 +2985,7 @@ class Meeting {
2916
2985
  this.extension = extension;
2917
2986
  this.persistent = persistent;
2918
2987
  this.creationTime = creationTime;
2988
+ this.requireAuthorization = requireAuthorization;
2919
2989
 
2920
2990
  // Useful to compare instead of instanceof with minified code
2921
2991
  this.type = 'Meeting';
@@ -2926,8 +2996,32 @@ class Meeting {
2926
2996
  const [username, secret] = atob(this.guestSipAuthorization).split(':');
2927
2997
  return { username, secret };
2928
2998
  }
2999
+
2929
3000
  }
2930
3001
 
3002
+ //
3003
+
3004
+ const camelToUnderscore = (key ) => {
3005
+ if (typeof key !== 'string') {
3006
+ throw new Error('Input is not a string');
3007
+ }
3008
+ return key.charAt(0).toLowerCase() + key.substring(1).replace(/([A-Z])/g, '_$1').toLowerCase();
3009
+ };
3010
+
3011
+ //
3012
+
3013
+ const convertKeysFromCamelToUnderscore = (args ) => {
3014
+ if (!args || typeof args !== 'object' || Array.isArray(args)) {
3015
+ throw new Error('Input is not an object');
3016
+ }
3017
+
3018
+ return Object.keys(args).reduce((acc, key) => {
3019
+ acc[camelToUnderscore(key)] = typeof args[key] === 'object' && !Array.isArray(args[key])
3020
+ ? convertKeysFromCamelToUnderscore(args[key]) : args[key];
3021
+ return acc;
3022
+ }, {});
3023
+ };
3024
+
2931
3025
  /* */
2932
3026
 
2933
3027
  var confdMethods = (client , baseUrl ) => ({
@@ -2996,8 +3090,18 @@ var confdMethods = (client , baseUrl ) => ({
2996
3090
  getMyMeetings: () =>
2997
3091
  client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
2998
3092
 
2999
- createMyMeeting: (name , persistent ) =>
3000
- client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
3093
+ createMyMeeting: (args ) =>
3094
+ client
3095
+ .post(`${baseUrl}/users/me/meetings`, convertKeysFromCamelToUnderscore(args))
3096
+ .then(Meeting.parse),
3097
+
3098
+ updateMyMeeting: (meetingUuid , data ) =>
3099
+ client.put(
3100
+ `${baseUrl}/users/me/meetings/${meetingUuid}`,
3101
+ convertKeysFromCamelToUnderscore(data),
3102
+ null,
3103
+ ApiRequester.successResponseParser,
3104
+ ),
3001
3105
 
3002
3106
  deleteMyMeeting: (meetingUuid ) =>
3003
3107
  client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
@@ -3005,8 +3109,36 @@ var confdMethods = (client , baseUrl ) => ({
3005
3109
  getMeeting: (meetingUuid ) =>
3006
3110
  client.get(`${baseUrl}/meetings/${meetingUuid}`, null).then(Meeting.parse),
3007
3111
 
3112
+ meetingAuthorizations: (meetingUuid ) =>
3113
+ client.get(`${baseUrl}/users/me/meetings/${meetingUuid}/authorizations`, null).then(MeetingAuthorization.parseMany),
3114
+
3115
+ meetingAuthorizationReject: (meetingUuid , authorizationUuid ) =>
3116
+ client.put(
3117
+ `${baseUrl}/users/me/meetings/${meetingUuid}/authorizations/${authorizationUuid}/reject`,
3118
+ {},
3119
+ null,
3120
+ ApiRequester.successResponseParser,
3121
+ ),
3122
+
3123
+ meetingAuthorizationAccept: (meetingUuid , authorizationUuid ) =>
3124
+ client.put(
3125
+ `${baseUrl}/users/me/meetings/${meetingUuid}/authorizations/${authorizationUuid}/accept`,
3126
+ {},
3127
+ null,
3128
+ ApiRequester.successResponseParser,
3129
+ ),
3130
+
3008
3131
  guestGetMeeting: (meetingUuid ) =>
3009
3132
  client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}`, null).then(Meeting.parse),
3133
+
3134
+ guestAuthorizationRequest: (userUuid , meetingUuid , username ) =>
3135
+ client
3136
+ .post(`${baseUrl}/guests/${userUuid}/meetings/${meetingUuid}/authorizations`, { guest_name: username })
3137
+ .then(MeetingAuthorization.parse),
3138
+
3139
+ guestAuthorizationCheck: (userUuid , meetingUuid , authorizationUuid ) =>
3140
+ client.get(`${baseUrl}/guests/${userUuid}/meetings/${meetingUuid}/authorizations/${authorizationUuid}`, null),
3141
+
3010
3142
  });
3011
3143
 
3012
3144
  //
@@ -4213,6 +4345,14 @@ var calldMethods = (client , baseUrl ) => ({
4213
4345
  getMeetingParticipantsAsUser: async (meetingUuid ) =>
4214
4346
  client.get(`${baseUrl}/users/me/meetings/${meetingUuid}/participants`),
4215
4347
 
4348
+ banMeetingParticipant: (meetingUuid , participantUuid ) =>
4349
+ client.delete(
4350
+ `${baseUrl}/users/me/meetings/${meetingUuid}/participants/${participantUuid}`,
4351
+ null,
4352
+ null,
4353
+ ApiRequester.successResponseParser,
4354
+ ),
4355
+
4216
4356
  listTrunks: () => client.get(`${baseUrl}/trunks`),
4217
4357
 
4218
4358
  mute: (callId ) =>
@@ -2633,6 +2633,70 @@ class ExternalApp {
2633
2633
 
2634
2634
  //
2635
2635
 
2636
+ class MeetingAuthorization {
2637
+
2638
+
2639
+
2640
+
2641
+
2642
+
2643
+ constructor({
2644
+ meetingUuid,
2645
+ uuid,
2646
+ userUuid,
2647
+ userName,
2648
+ } = {}) {
2649
+ this.meetingUuid = meetingUuid;
2650
+ this.uuid = uuid;
2651
+ this.userUuid = userUuid;
2652
+ this.userName = userName;
2653
+ }
2654
+
2655
+ setStatus(status ) {
2656
+ this.status = status;
2657
+ }
2658
+
2659
+ getStatus() {
2660
+ return this.status;
2661
+ }
2662
+
2663
+ static parse(plain ) {
2664
+ const {
2665
+ meeting_uuid: meetingUuid,
2666
+ uuid,
2667
+ guest_uuid: userUuid,
2668
+ guest_name: userName,
2669
+ } = plain;
2670
+
2671
+ return new MeetingAuthorization({
2672
+ meetingUuid,
2673
+ uuid,
2674
+ userUuid,
2675
+ userName,
2676
+ });
2677
+ }
2678
+
2679
+ static parseMany(items ) {
2680
+ if (!items) {
2681
+ return [];
2682
+ }
2683
+ return items.map(MeetingAuthorization.parse);
2684
+ }
2685
+ }
2686
+
2687
+ //
2688
+
2689
+
2690
+
2691
+
2692
+
2693
+
2694
+
2695
+
2696
+
2697
+
2698
+
2699
+
2636
2700
 
2637
2701
 
2638
2702
 
@@ -2643,6 +2707,7 @@ class ExternalApp {
2643
2707
 
2644
2708
 
2645
2709
 
2710
+
2646
2711
 
2647
2712
 
2648
2713
  class Meeting {
@@ -2657,6 +2722,8 @@ class Meeting {
2657
2722
 
2658
2723
 
2659
2724
 
2725
+
2726
+
2660
2727
 
2661
2728
  static parse(plain ) {
2662
2729
  return new Meeting({
@@ -2669,6 +2736,7 @@ class Meeting {
2669
2736
  extension: plain.exten,
2670
2737
  persistent: plain.persistent,
2671
2738
  creationTime: moment__default['default'](plain.creation_time).toDate(),
2739
+ requireAuthorization: plain.require_authorization,
2672
2740
  });
2673
2741
  }
2674
2742
 
@@ -2693,6 +2761,7 @@ class Meeting {
2693
2761
  extension,
2694
2762
  persistent,
2695
2763
  creationTime,
2764
+ requireAuthorization,
2696
2765
  } = {}) {
2697
2766
  this.guestSipAuthorization = guestSipAuthorization;
2698
2767
  this.uri = uri;
@@ -2703,6 +2772,7 @@ class Meeting {
2703
2772
  this.extension = extension;
2704
2773
  this.persistent = persistent;
2705
2774
  this.creationTime = creationTime;
2775
+ this.requireAuthorization = requireAuthorization;
2706
2776
 
2707
2777
  // Useful to compare instead of instanceof with minified code
2708
2778
  this.type = 'Meeting';
@@ -2713,8 +2783,32 @@ class Meeting {
2713
2783
  const [username, secret] = atob(this.guestSipAuthorization).split(':');
2714
2784
  return { username, secret };
2715
2785
  }
2786
+
2716
2787
  }
2717
2788
 
2789
+ //
2790
+
2791
+ const camelToUnderscore = (key ) => {
2792
+ if (typeof key !== 'string') {
2793
+ throw new Error('Input is not a string');
2794
+ }
2795
+ return key.charAt(0).toLowerCase() + key.substring(1).replace(/([A-Z])/g, '_$1').toLowerCase();
2796
+ };
2797
+
2798
+ //
2799
+
2800
+ const convertKeysFromCamelToUnderscore = (args ) => {
2801
+ if (!args || typeof args !== 'object' || Array.isArray(args)) {
2802
+ throw new Error('Input is not an object');
2803
+ }
2804
+
2805
+ return Object.keys(args).reduce((acc, key) => {
2806
+ acc[camelToUnderscore(key)] = typeof args[key] === 'object' && !Array.isArray(args[key])
2807
+ ? convertKeysFromCamelToUnderscore(args[key]) : args[key];
2808
+ return acc;
2809
+ }, {});
2810
+ };
2811
+
2718
2812
  /* */
2719
2813
 
2720
2814
  var confdMethods = (client , baseUrl ) => ({
@@ -2783,8 +2877,18 @@ var confdMethods = (client , baseUrl ) => ({
2783
2877
  getMyMeetings: () =>
2784
2878
  client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
2785
2879
 
2786
- createMyMeeting: (name , persistent ) =>
2787
- client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
2880
+ createMyMeeting: (args ) =>
2881
+ client
2882
+ .post(`${baseUrl}/users/me/meetings`, convertKeysFromCamelToUnderscore(args))
2883
+ .then(Meeting.parse),
2884
+
2885
+ updateMyMeeting: (meetingUuid , data ) =>
2886
+ client.put(
2887
+ `${baseUrl}/users/me/meetings/${meetingUuid}`,
2888
+ convertKeysFromCamelToUnderscore(data),
2889
+ null,
2890
+ ApiRequester.successResponseParser,
2891
+ ),
2788
2892
 
2789
2893
  deleteMyMeeting: (meetingUuid ) =>
2790
2894
  client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
@@ -2792,8 +2896,36 @@ var confdMethods = (client , baseUrl ) => ({
2792
2896
  getMeeting: (meetingUuid ) =>
2793
2897
  client.get(`${baseUrl}/meetings/${meetingUuid}`, null).then(Meeting.parse),
2794
2898
 
2899
+ meetingAuthorizations: (meetingUuid ) =>
2900
+ client.get(`${baseUrl}/users/me/meetings/${meetingUuid}/authorizations`, null).then(MeetingAuthorization.parseMany),
2901
+
2902
+ meetingAuthorizationReject: (meetingUuid , authorizationUuid ) =>
2903
+ client.put(
2904
+ `${baseUrl}/users/me/meetings/${meetingUuid}/authorizations/${authorizationUuid}/reject`,
2905
+ {},
2906
+ null,
2907
+ ApiRequester.successResponseParser,
2908
+ ),
2909
+
2910
+ meetingAuthorizationAccept: (meetingUuid , authorizationUuid ) =>
2911
+ client.put(
2912
+ `${baseUrl}/users/me/meetings/${meetingUuid}/authorizations/${authorizationUuid}/accept`,
2913
+ {},
2914
+ null,
2915
+ ApiRequester.successResponseParser,
2916
+ ),
2917
+
2795
2918
  guestGetMeeting: (meetingUuid ) =>
2796
2919
  client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}`, null).then(Meeting.parse),
2920
+
2921
+ guestAuthorizationRequest: (userUuid , meetingUuid , username ) =>
2922
+ client
2923
+ .post(`${baseUrl}/guests/${userUuid}/meetings/${meetingUuid}/authorizations`, { guest_name: username })
2924
+ .then(MeetingAuthorization.parse),
2925
+
2926
+ guestAuthorizationCheck: (userUuid , meetingUuid , authorizationUuid ) =>
2927
+ client.get(`${baseUrl}/guests/${userUuid}/meetings/${meetingUuid}/authorizations/${authorizationUuid}`, null),
2928
+
2797
2929
  });
2798
2930
 
2799
2931
  //
@@ -4215,6 +4347,14 @@ var calldMethods = (client , baseUrl ) => ({
4215
4347
  getMeetingParticipantsAsUser: async (meetingUuid ) =>
4216
4348
  client.get(`${baseUrl}/users/me/meetings/${meetingUuid}/participants`),
4217
4349
 
4350
+ banMeetingParticipant: (meetingUuid , participantUuid ) =>
4351
+ client.delete(
4352
+ `${baseUrl}/users/me/meetings/${meetingUuid}/participants/${participantUuid}`,
4353
+ null,
4354
+ null,
4355
+ ApiRequester.successResponseParser,
4356
+ ),
4357
+
4218
4358
  listTrunks: () => client.get(`${baseUrl}/trunks`),
4219
4359
 
4220
4360
  mute: (callId ) =>
@@ -19,6 +19,17 @@ var newFrom = (instance , ToClass ) => {
19
19
 
20
20
  //
21
21
 
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
22
33
 
23
34
 
24
35
 
@@ -29,6 +40,7 @@ var newFrom = (instance , ToClass ) => {
29
40
 
30
41
 
31
42
 
43
+
32
44
 
33
45
 
34
46
  class Meeting {
@@ -43,6 +55,8 @@ class Meeting {
43
55
 
44
56
 
45
57
 
58
+
59
+
46
60
 
47
61
  static parse(plain ) {
48
62
  return new Meeting({
@@ -55,6 +69,7 @@ class Meeting {
55
69
  extension: plain.exten,
56
70
  persistent: plain.persistent,
57
71
  creationTime: moment__default['default'](plain.creation_time).toDate(),
72
+ requireAuthorization: plain.require_authorization,
58
73
  });
59
74
  }
60
75
 
@@ -79,6 +94,7 @@ class Meeting {
79
94
  extension,
80
95
  persistent,
81
96
  creationTime,
97
+ requireAuthorization,
82
98
  } = {}) {
83
99
  this.guestSipAuthorization = guestSipAuthorization;
84
100
  this.uri = uri;
@@ -89,6 +105,7 @@ class Meeting {
89
105
  this.extension = extension;
90
106
  this.persistent = persistent;
91
107
  this.creationTime = creationTime;
108
+ this.requireAuthorization = requireAuthorization;
92
109
 
93
110
  // Useful to compare instead of instanceof with minified code
94
111
  this.type = 'Meeting';
@@ -99,6 +116,7 @@ class Meeting {
99
116
  const [username, secret] = atob(this.guestSipAuthorization).split(':');
100
117
  return { username, secret };
101
118
  }
119
+
102
120
  }
103
121
 
104
122
  module.exports = Meeting;
@@ -0,0 +1,79 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ //
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+ const PENDING = 'pending';
16
+ const ACCEPTED = 'accepted';
17
+ const REJECTED = 'rejected';
18
+ const POST_PROCESSING = 'post_processing';
19
+ const POST_PROCESSED_SUCCESS = 'post_processed_success';
20
+ const POST_PROCESSED_ERROR = 'post_processed_error';
21
+
22
+ class MeetingAuthorization {
23
+
24
+
25
+
26
+
27
+
28
+
29
+ constructor({
30
+ meetingUuid,
31
+ uuid,
32
+ userUuid,
33
+ userName,
34
+ } = {}) {
35
+ this.meetingUuid = meetingUuid;
36
+ this.uuid = uuid;
37
+ this.userUuid = userUuid;
38
+ this.userName = userName;
39
+ }
40
+
41
+ setStatus(status ) {
42
+ this.status = status;
43
+ }
44
+
45
+ getStatus() {
46
+ return this.status;
47
+ }
48
+
49
+ static parse(plain ) {
50
+ const {
51
+ meeting_uuid: meetingUuid,
52
+ uuid,
53
+ guest_uuid: userUuid,
54
+ guest_name: userName,
55
+ } = plain;
56
+
57
+ return new MeetingAuthorization({
58
+ meetingUuid,
59
+ uuid,
60
+ userUuid,
61
+ userName,
62
+ });
63
+ }
64
+
65
+ static parseMany(items ) {
66
+ if (!items) {
67
+ return [];
68
+ }
69
+ return items.map(MeetingAuthorization.parse);
70
+ }
71
+ }
72
+
73
+ exports.ACCEPTED = ACCEPTED;
74
+ exports.PENDING = PENDING;
75
+ exports.POST_PROCESSED_ERROR = POST_PROCESSED_ERROR;
76
+ exports.POST_PROCESSED_SUCCESS = POST_PROCESSED_SUCCESS;
77
+ exports.POST_PROCESSING = POST_PROCESSING;
78
+ exports.REJECTED = REJECTED;
79
+ exports.default = MeetingAuthorization;