@wazo/sdk 0.38.7 → 0.38.10

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 (121) hide show
  1. package/dist/wazo-sdk.js +2 -2
  2. package/esm/__tests__/api-client.test.js +163 -2
  3. package/esm/__tests__/web-rtc-client.test.js +248 -27
  4. package/esm/api/auth.js +12 -0
  5. package/esm/api/calld.js +8 -0
  6. package/esm/api/confd.js +134 -2
  7. package/esm/api/ctid-ng.js +1 -0
  8. package/esm/api-client.js +163 -2
  9. package/esm/checker/Checker.js +204 -24
  10. package/esm/checker/checks/aor.js +163 -2
  11. package/esm/checker/checks/api.js +163 -2
  12. package/esm/checker/checks/index.js +204 -24
  13. package/esm/checker/checks/wazo-websocket.js +2 -0
  14. package/esm/checker/checks/webrtc-transport.js +202 -24
  15. package/esm/checker/checks/webrtc.js +202 -24
  16. package/esm/domain/AdHocAPIConference.js +170 -4
  17. package/esm/domain/Features.js +170 -4
  18. package/esm/domain/Meeting.js +18 -0
  19. package/esm/domain/MeetingAuthorization.js +70 -0
  20. package/esm/domain/Phone/CTIPhone.js +170 -4
  21. package/esm/domain/Phone/WebRTCPhone.js +2 -3
  22. package/esm/domain/__tests__/Meeting.test.js +87 -1
  23. package/esm/domain/__tests__/MeetingAuthorization.test.js +109 -0
  24. package/esm/index.js +300 -36
  25. package/esm/service/CallApi.js +170 -4
  26. package/esm/service/getApiClient.js +176 -5
  27. package/esm/simple/Auth.js +301 -37
  28. package/esm/simple/Configuration.js +300 -36
  29. package/esm/simple/Directory.js +170 -4
  30. package/esm/simple/Phone.js +300 -36
  31. package/esm/simple/Softphone.js +5 -0
  32. package/esm/simple/Websocket.js +3 -0
  33. package/esm/simple/index.js +300 -36
  34. package/esm/simple/room/LocalParticipant.js +300 -36
  35. package/esm/simple/room/Participant.js +300 -36
  36. package/esm/simple/room/RemoteParticipant.js +300 -36
  37. package/esm/simple/room/Room.js +300 -36
  38. package/esm/simple/room/SipRoom.js +300 -36
  39. package/esm/simple/room/Stream.js +300 -36
  40. package/esm/simple/room/__tests__/Participant.test.js +14812 -0
  41. package/esm/simple/room/__tests__/RemoteParticipant.test.js +300 -36
  42. package/esm/simple/utils.js +300 -36
  43. package/esm/utils/__tests__/object.test.js +57 -0
  44. package/esm/utils/__tests__/string.test.js +30 -0
  45. package/esm/utils/object.js +24 -0
  46. package/esm/utils/string.js +10 -0
  47. package/esm/web-rtc-client.js +202 -24
  48. package/esm/websocket-client.js +3 -1
  49. package/lib/__tests__/api-client.test.js +163 -2
  50. package/lib/__tests__/web-rtc-client.test.js +248 -27
  51. package/lib/api/auth.js +12 -0
  52. package/lib/api/calld.js +8 -0
  53. package/lib/api/confd.js +134 -2
  54. package/lib/api/ctid-ng.js +1 -0
  55. package/lib/api-client.js +163 -2
  56. package/lib/checker/Checker.js +204 -24
  57. package/lib/checker/checks/aor.js +163 -2
  58. package/lib/checker/checks/api.js +163 -2
  59. package/lib/checker/checks/index.js +204 -24
  60. package/lib/checker/checks/wazo-websocket.js +2 -0
  61. package/lib/checker/checks/webrtc-transport.js +202 -24
  62. package/lib/checker/checks/webrtc.js +202 -24
  63. package/lib/domain/AdHocAPIConference.js +170 -4
  64. package/lib/domain/Features.js +170 -4
  65. package/lib/domain/Meeting.js +18 -0
  66. package/lib/domain/MeetingAuthorization.js +79 -0
  67. package/lib/domain/Phone/CTIPhone.js +170 -4
  68. package/lib/domain/Phone/WebRTCPhone.js +2 -3
  69. package/lib/domain/__tests__/Meeting.test.js +87 -1
  70. package/lib/domain/__tests__/MeetingAuthorization.test.js +111 -0
  71. package/lib/index.js +300 -36
  72. package/lib/service/CallApi.js +170 -4
  73. package/lib/service/getApiClient.js +176 -4
  74. package/lib/simple/Auth.js +301 -36
  75. package/lib/simple/Configuration.js +300 -36
  76. package/lib/simple/Directory.js +170 -4
  77. package/lib/simple/Phone.js +300 -36
  78. package/lib/simple/Softphone.js +5 -0
  79. package/lib/simple/Websocket.js +3 -0
  80. package/lib/simple/index.js +300 -36
  81. package/lib/simple/room/LocalParticipant.js +300 -36
  82. package/lib/simple/room/Participant.js +300 -36
  83. package/lib/simple/room/RemoteParticipant.js +300 -36
  84. package/lib/simple/room/Room.js +300 -36
  85. package/lib/simple/room/SipRoom.js +300 -36
  86. package/lib/simple/room/Stream.js +300 -36
  87. package/lib/simple/room/__tests__/Participant.test.js +14822 -0
  88. package/lib/simple/room/__tests__/RemoteParticipant.test.js +300 -36
  89. package/lib/simple/utils.js +300 -36
  90. package/lib/utils/__tests__/object.test.js +59 -0
  91. package/lib/utils/__tests__/string.test.js +32 -0
  92. package/lib/utils/object.js +28 -0
  93. package/lib/utils/string.js +14 -0
  94. package/lib/web-rtc-client.js +202 -24
  95. package/lib/websocket-client.js +3 -0
  96. package/package.json +1 -1
  97. package/src/__tests__/web-rtc-client.test.js +46 -3
  98. package/src/api/auth.js +12 -0
  99. package/src/api/calld.js +8 -0
  100. package/src/api/confd.js +43 -2
  101. package/src/api-client.js +8 -0
  102. package/src/domain/Meeting.js +20 -0
  103. package/src/domain/MeetingAuthorization.js +67 -0
  104. package/src/domain/Phone/WebRTCPhone.js +1 -3
  105. package/src/domain/__tests__/Meeting.test.js +70 -1
  106. package/src/domain/__tests__/MeetingAuthorization.test.js +58 -0
  107. package/src/service/getApiClient.js +13 -2
  108. package/src/simple/Auth.js +35 -4
  109. package/src/simple/Softphone.js +5 -0
  110. package/src/simple/index.js +2 -1
  111. package/src/simple/room/Participant.js +40 -0
  112. package/src/simple/room/Room.js +2 -2
  113. package/src/simple/room/SipRoom.js +1 -1
  114. package/src/simple/room/__tests__/Participant.test.js +81 -0
  115. package/src/types/WebSocketMessage.js +7 -1
  116. package/src/utils/__tests__/object.test.js +35 -0
  117. package/src/utils/__tests__/string.test.js +23 -0
  118. package/src/utils/object.js +15 -0
  119. package/src/utils/string.js +8 -0
  120. package/src/web-rtc-client.js +39 -22
  121. package/src/websocket-client.js +2 -0
@@ -13,6 +13,17 @@ var newFrom = (instance , ToClass ) => {
13
13
 
14
14
  //
15
15
 
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
16
27
 
17
28
 
18
29
 
@@ -23,6 +34,7 @@ var newFrom = (instance , ToClass ) => {
23
34
 
24
35
 
25
36
 
37
+
26
38
 
27
39
 
28
40
  class Meeting {
@@ -37,6 +49,8 @@ class Meeting {
37
49
 
38
50
 
39
51
 
52
+
53
+
40
54
 
41
55
  static parse(plain ) {
42
56
  return new Meeting({
@@ -49,6 +63,7 @@ class Meeting {
49
63
  extension: plain.exten,
50
64
  persistent: plain.persistent,
51
65
  creationTime: moment(plain.creation_time).toDate(),
66
+ requireAuthorization: plain.require_authorization,
52
67
  });
53
68
  }
54
69
 
@@ -73,6 +88,7 @@ class Meeting {
73
88
  extension,
74
89
  persistent,
75
90
  creationTime,
91
+ requireAuthorization,
76
92
  } = {}) {
77
93
  this.guestSipAuthorization = guestSipAuthorization;
78
94
  this.uri = uri;
@@ -83,6 +99,7 @@ class Meeting {
83
99
  this.extension = extension;
84
100
  this.persistent = persistent;
85
101
  this.creationTime = creationTime;
102
+ this.requireAuthorization = requireAuthorization;
86
103
 
87
104
  // Useful to compare instead of instanceof with minified code
88
105
  this.type = 'Meeting';
@@ -93,6 +110,7 @@ class Meeting {
93
110
  const [username, secret] = atob(this.guestSipAuthorization).split(':');
94
111
  return { username, secret };
95
112
  }
113
+
96
114
  }
97
115
 
98
116
  export default Meeting;
@@ -0,0 +1,70 @@
1
+ //
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+ const PENDING = 'pending';
12
+ const ACCEPTED = 'accepted';
13
+ const REJECTED = 'rejected';
14
+ const POST_PROCESSING = 'post_processing';
15
+ const POST_PROCESSED_SUCCESS = 'post_processed_success';
16
+ const POST_PROCESSED_ERROR = 'post_processed_error';
17
+
18
+ class MeetingAuthorization {
19
+
20
+
21
+
22
+
23
+
24
+
25
+ constructor({
26
+ meetingUuid,
27
+ uuid,
28
+ userUuid,
29
+ userName,
30
+ } = {}) {
31
+ this.meetingUuid = meetingUuid;
32
+ this.uuid = uuid;
33
+ this.userUuid = userUuid;
34
+ this.userName = userName;
35
+ }
36
+
37
+ setStatus(status ) {
38
+ this.status = status;
39
+ }
40
+
41
+ getStatus() {
42
+ return this.status;
43
+ }
44
+
45
+ static parse(plain ) {
46
+ const {
47
+ meeting_uuid: meetingUuid,
48
+ uuid,
49
+ guest_uuid: userUuid,
50
+ guest_name: userName,
51
+ } = plain;
52
+
53
+ return new MeetingAuthorization({
54
+ meetingUuid,
55
+ uuid,
56
+ userUuid,
57
+ userName,
58
+ });
59
+ }
60
+
61
+ static parseMany(items ) {
62
+ if (!items) {
63
+ return [];
64
+ }
65
+ return items.map(MeetingAuthorization.parse);
66
+ }
67
+ }
68
+
69
+ export default MeetingAuthorization;
70
+ export { ACCEPTED, PENDING, POST_PROCESSED_ERROR, POST_PROCESSED_SUCCESS, POST_PROCESSING, REJECTED };
@@ -3175,6 +3175,7 @@ var authMethods = (client , baseUrl ) => ({
3175
3175
 
3176
3176
 
3177
3177
 
3178
+
3178
3179
  ) {
3179
3180
  const body = {
3180
3181
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -3195,9 +3196,14 @@ var authMethods = (client , baseUrl ) => ({
3195
3196
  }
3196
3197
 
3197
3198
  if (params.tenantId) {
3199
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
3198
3200
  body.tenant_id = params.tenantId;
3199
3201
  }
3200
3202
 
3203
+ if (params.domainName) {
3204
+ body.domain_name = params.domainName;
3205
+ }
3206
+
3201
3207
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
3202
3208
  },
3203
3209
 
@@ -3210,6 +3216,7 @@ var authMethods = (client , baseUrl ) => ({
3210
3216
  expiration ,
3211
3217
  isMobile = false,
3212
3218
  tenantId ,
3219
+ domainName ,
3213
3220
  ) => {
3214
3221
  const body = {
3215
3222
  backend: backend || DEFAULT_BACKEND_USER,
@@ -3219,9 +3226,14 @@ var authMethods = (client , baseUrl ) => ({
3219
3226
  };
3220
3227
 
3221
3228
  if (tenantId) {
3229
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
3222
3230
  body.tenant_id = tenantId;
3223
3231
  }
3224
3232
 
3233
+ if (domainName) {
3234
+ body.domain_name = domainName;
3235
+ }
3236
+
3225
3237
  const headers = {
3226
3238
  'Content-Type': 'application/json',
3227
3239
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -3591,6 +3603,70 @@ class ExternalApp {
3591
3603
 
3592
3604
  //
3593
3605
 
3606
+ class MeetingAuthorization {
3607
+
3608
+
3609
+
3610
+
3611
+
3612
+
3613
+ constructor({
3614
+ meetingUuid,
3615
+ uuid,
3616
+ userUuid,
3617
+ userName,
3618
+ } = {}) {
3619
+ this.meetingUuid = meetingUuid;
3620
+ this.uuid = uuid;
3621
+ this.userUuid = userUuid;
3622
+ this.userName = userName;
3623
+ }
3624
+
3625
+ setStatus(status ) {
3626
+ this.status = status;
3627
+ }
3628
+
3629
+ getStatus() {
3630
+ return this.status;
3631
+ }
3632
+
3633
+ static parse(plain ) {
3634
+ const {
3635
+ meeting_uuid: meetingUuid,
3636
+ uuid,
3637
+ guest_uuid: userUuid,
3638
+ guest_name: userName,
3639
+ } = plain;
3640
+
3641
+ return new MeetingAuthorization({
3642
+ meetingUuid,
3643
+ uuid,
3644
+ userUuid,
3645
+ userName,
3646
+ });
3647
+ }
3648
+
3649
+ static parseMany(items ) {
3650
+ if (!items) {
3651
+ return [];
3652
+ }
3653
+ return items.map(MeetingAuthorization.parse);
3654
+ }
3655
+ }
3656
+
3657
+ //
3658
+
3659
+
3660
+
3661
+
3662
+
3663
+
3664
+
3665
+
3666
+
3667
+
3668
+
3669
+
3594
3670
 
3595
3671
 
3596
3672
 
@@ -3601,6 +3677,7 @@ class ExternalApp {
3601
3677
 
3602
3678
 
3603
3679
 
3680
+
3604
3681
 
3605
3682
 
3606
3683
  class Meeting {
@@ -3615,6 +3692,8 @@ class Meeting {
3615
3692
 
3616
3693
 
3617
3694
 
3695
+
3696
+
3618
3697
 
3619
3698
  static parse(plain ) {
3620
3699
  return new Meeting({
@@ -3627,6 +3706,7 @@ class Meeting {
3627
3706
  extension: plain.exten,
3628
3707
  persistent: plain.persistent,
3629
3708
  creationTime: moment(plain.creation_time).toDate(),
3709
+ requireAuthorization: plain.require_authorization,
3630
3710
  });
3631
3711
  }
3632
3712
 
@@ -3651,6 +3731,7 @@ class Meeting {
3651
3731
  extension,
3652
3732
  persistent,
3653
3733
  creationTime,
3734
+ requireAuthorization,
3654
3735
  } = {}) {
3655
3736
  this.guestSipAuthorization = guestSipAuthorization;
3656
3737
  this.uri = uri;
@@ -3661,6 +3742,7 @@ class Meeting {
3661
3742
  this.extension = extension;
3662
3743
  this.persistent = persistent;
3663
3744
  this.creationTime = creationTime;
3745
+ this.requireAuthorization = requireAuthorization;
3664
3746
 
3665
3747
  // Useful to compare instead of instanceof with minified code
3666
3748
  this.type = 'Meeting';
@@ -3671,8 +3753,32 @@ class Meeting {
3671
3753
  const [username, secret] = atob(this.guestSipAuthorization).split(':');
3672
3754
  return { username, secret };
3673
3755
  }
3756
+
3674
3757
  }
3675
3758
 
3759
+ //
3760
+
3761
+ const camelToUnderscore = (key ) => {
3762
+ if (typeof key !== 'string') {
3763
+ throw new Error('Input is not a string');
3764
+ }
3765
+ return key.charAt(0).toLowerCase() + key.substring(1).replace(/([A-Z])/g, '_$1').toLowerCase();
3766
+ };
3767
+
3768
+ //
3769
+
3770
+ const convertKeysFromCamelToUnderscore = (args ) => {
3771
+ if (!args || typeof args !== 'object' || Array.isArray(args)) {
3772
+ throw new Error('Input is not an object');
3773
+ }
3774
+
3775
+ return Object.keys(args).reduce((acc, key) => {
3776
+ acc[camelToUnderscore(key)] = typeof args[key] === 'object' && !Array.isArray(args[key])
3777
+ ? convertKeysFromCamelToUnderscore(args[key]) : args[key];
3778
+ return acc;
3779
+ }, {});
3780
+ };
3781
+
3676
3782
  /* */
3677
3783
 
3678
3784
  var confdMethods = (client , baseUrl ) => ({
@@ -3741,8 +3847,18 @@ var confdMethods = (client , baseUrl ) => ({
3741
3847
  getMyMeetings: () =>
3742
3848
  client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
3743
3849
 
3744
- createMyMeeting: (name , persistent ) =>
3745
- client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
3850
+ createMyMeeting: (args ) =>
3851
+ client
3852
+ .post(`${baseUrl}/users/me/meetings`, convertKeysFromCamelToUnderscore(args))
3853
+ .then(Meeting.parse),
3854
+
3855
+ updateMyMeeting: (meetingUuid , data ) =>
3856
+ client.put(
3857
+ `${baseUrl}/users/me/meetings/${meetingUuid}`,
3858
+ convertKeysFromCamelToUnderscore(data),
3859
+ null,
3860
+ ApiRequester.successResponseParser,
3861
+ ),
3746
3862
 
3747
3863
  deleteMyMeeting: (meetingUuid ) =>
3748
3864
  client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
@@ -3750,8 +3866,36 @@ var confdMethods = (client , baseUrl ) => ({
3750
3866
  getMeeting: (meetingUuid ) =>
3751
3867
  client.get(`${baseUrl}/meetings/${meetingUuid}`, null).then(Meeting.parse),
3752
3868
 
3869
+ meetingAuthorizations: (meetingUuid ) =>
3870
+ client.get(`${baseUrl}/users/me/meetings/${meetingUuid}/authorizations`, null).then(MeetingAuthorization.parseMany),
3871
+
3872
+ meetingAuthorizationReject: (meetingUuid , authorizationUuid ) =>
3873
+ client.put(
3874
+ `${baseUrl}/users/me/meetings/${meetingUuid}/authorizations/${authorizationUuid}/reject`,
3875
+ {},
3876
+ null,
3877
+ ApiRequester.successResponseParser,
3878
+ ),
3879
+
3880
+ meetingAuthorizationAccept: (meetingUuid , authorizationUuid ) =>
3881
+ client.put(
3882
+ `${baseUrl}/users/me/meetings/${meetingUuid}/authorizations/${authorizationUuid}/accept`,
3883
+ {},
3884
+ null,
3885
+ ApiRequester.successResponseParser,
3886
+ ),
3887
+
3753
3888
  guestGetMeeting: (meetingUuid ) =>
3754
3889
  client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}`, null).then(Meeting.parse),
3890
+
3891
+ guestAuthorizationRequest: (userUuid , meetingUuid , username ) =>
3892
+ client
3893
+ .post(`${baseUrl}/guests/${userUuid}/meetings/${meetingUuid}/authorizations`, { guest_name: username })
3894
+ .then(MeetingAuthorization.parse),
3895
+
3896
+ guestAuthorizationCheck: (userUuid , meetingUuid , authorizationUuid ) =>
3897
+ client.get(`${baseUrl}/guests/${userUuid}/meetings/${meetingUuid}/authorizations/${authorizationUuid}`, null),
3898
+
3755
3899
  });
3756
3900
 
3757
3901
  //
@@ -4620,6 +4764,14 @@ var calldMethods = (client , baseUrl ) => ({
4620
4764
  getMeetingParticipantsAsUser: async (meetingUuid ) =>
4621
4765
  client.get(`${baseUrl}/users/me/meetings/${meetingUuid}/participants`),
4622
4766
 
4767
+ banMeetingParticipant: (meetingUuid , participantUuid ) =>
4768
+ client.delete(
4769
+ `${baseUrl}/users/me/meetings/${meetingUuid}/participants/${participantUuid}`,
4770
+ null,
4771
+ null,
4772
+ ApiRequester.successResponseParser,
4773
+ ),
4774
+
4623
4775
  listTrunks: () => client.get(`${baseUrl}/trunks`),
4624
4776
 
4625
4777
  mute: (callId ) =>
@@ -4997,6 +5149,7 @@ class ApiClient {
4997
5149
 
4998
5150
 
4999
5151
 
5152
+
5000
5153
 
5001
5154
 
5002
5155
 
@@ -5038,6 +5191,7 @@ class ApiClient {
5038
5191
  refreshToken: this.refreshToken,
5039
5192
  refreshBackend: this.refreshBackend,
5040
5193
  refreshTenantId: this.refreshTenantId,
5194
+ refreshDomainName: this.refreshDomainName,
5041
5195
  refreshExpiration: this.refreshExpiration,
5042
5196
  isMobile: this.isMobile,
5043
5197
  });
@@ -5053,6 +5207,7 @@ class ApiClient {
5053
5207
  this.refreshExpiration,
5054
5208
  this.isMobile,
5055
5209
  this.refreshTenantId,
5210
+ this.refreshDomainName,
5056
5211
  );
5057
5212
 
5058
5213
  logger$1.info('token refreshed', { token: session.token });
@@ -5106,9 +5261,14 @@ class ApiClient {
5106
5261
  }
5107
5262
 
5108
5263
  setRefreshTenantId(tenantId ) {
5264
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
5109
5265
  this.refreshTenantId = tenantId;
5110
5266
  }
5111
5267
 
5268
+ setRefreshDomainName(domainName ) {
5269
+ this.refreshDomainName = domainName;
5270
+ }
5271
+
5112
5272
  setIsMobile(isMobile ) {
5113
5273
  this.isMobile = isMobile;
5114
5274
  }
@@ -5133,6 +5293,7 @@ global.wazoClientId = global.wazoClientId || {};
5133
5293
  global.wazoClientToken = global.wazoClientToken || {};
5134
5294
  global.wazoRefreshToken = global.wazoRefreshToken || {};
5135
5295
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
5296
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
5136
5297
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
5137
5298
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
5138
5299
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -5142,6 +5303,7 @@ global.wazoFetchOptions = global.wazoFetchOptions || {};
5142
5303
 
5143
5304
  const fillClient = (apiClient ) => {
5144
5305
  const { server, token, clientId } = apiClient.client;
5306
+ const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
5145
5307
 
5146
5308
  // try with null server when dealing with non-related server info
5147
5309
  apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
@@ -5150,8 +5312,12 @@ const fillClient = (apiClient ) => {
5150
5312
 
5151
5313
  apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
5152
5314
 
5153
- apiClient.setRefreshTenantId(
5154
- global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId,
5315
+ if (tenantId) {
5316
+ apiClient.setRefreshTenantId(tenantId);
5317
+ }
5318
+
5319
+ apiClient.setRefreshDomainName(
5320
+ global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
5155
5321
  );
5156
5322
 
5157
5323
  apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
@@ -894,6 +894,7 @@ global.wazoClientId = global.wazoClientId || {};
894
894
  global.wazoClientToken = global.wazoClientToken || {};
895
895
  global.wazoRefreshToken = global.wazoRefreshToken || {};
896
896
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
897
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
897
898
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
898
899
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
899
900
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -1433,9 +1434,7 @@ class WebRTCPhone extends Emitter {
1433
1434
 
1434
1435
  try {
1435
1436
  if (this.currentScreenShare.stream) {
1436
- this.currentScreenShare.stream.getTracks()
1437
- .filter(track => track.kind === 'video')
1438
- .forEach(track => track.stop());
1437
+ this.currentScreenShare.stream.getTracks().forEach(track => track.stop());
1439
1438
  }
1440
1439
 
1441
1440
  if (restoreLocalStream) {
@@ -13,6 +13,17 @@ var newFrom = (instance , ToClass ) => {
13
13
 
14
14
  //
15
15
 
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
16
27
 
17
28
 
18
29
 
@@ -23,6 +34,7 @@ var newFrom = (instance , ToClass ) => {
23
34
 
24
35
 
25
36
 
37
+
26
38
 
27
39
 
28
40
  class Meeting {
@@ -37,6 +49,8 @@ class Meeting {
37
49
 
38
50
 
39
51
 
52
+
53
+
40
54
 
41
55
  static parse(plain ) {
42
56
  return new Meeting({
@@ -49,6 +63,7 @@ class Meeting {
49
63
  extension: plain.exten,
50
64
  persistent: plain.persistent,
51
65
  creationTime: moment(plain.creation_time).toDate(),
66
+ requireAuthorization: plain.require_authorization,
52
67
  });
53
68
  }
54
69
 
@@ -73,6 +88,7 @@ class Meeting {
73
88
  extension,
74
89
  persistent,
75
90
  creationTime,
91
+ requireAuthorization,
76
92
  } = {}) {
77
93
  this.guestSipAuthorization = guestSipAuthorization;
78
94
  this.uri = uri;
@@ -83,6 +99,7 @@ class Meeting {
83
99
  this.extension = extension;
84
100
  this.persistent = persistent;
85
101
  this.creationTime = creationTime;
102
+ this.requireAuthorization = requireAuthorization;
86
103
 
87
104
  // Useful to compare instead of instanceof with minified code
88
105
  this.type = 'Meeting';
@@ -93,11 +110,78 @@ class Meeting {
93
110
  const [username, secret] = atob(this.guestSipAuthorization).split(':');
94
111
  return { username, secret };
95
112
  }
113
+
96
114
  }
97
115
 
98
116
  //
99
117
 
118
+ const rawCreationTime = '2021-12-21T15:56:42.880Z';
119
+
100
120
  describe('Meeting domain', () => {
121
+ it('should retain its values when parsed', () => {
122
+ const args = {
123
+ guest_sip_authorization: 'some-guest-sip-authorization',
124
+ ingress_http_uri: 'some-uri',
125
+ name: 'some-name',
126
+ owner_uuids: ['some-owner-uuid'],
127
+ port: 'some-port',
128
+ uuid: 'some-uuid',
129
+ exten: 'some-exten',
130
+ persistent: true,
131
+ creation_time: rawCreationTime,
132
+ require_authorization: true,
133
+ };
134
+
135
+ const meeting = Meeting.parse(args);
136
+ const {
137
+ uri,
138
+ uuid,
139
+ name,
140
+ port,
141
+ extension,
142
+ persistent,
143
+ ownerUuids,
144
+ creationTime,
145
+ requireAuthorization,
146
+ } = meeting;
147
+
148
+ expect(uri).toEqual(args.ingress_http_uri);
149
+ expect(uuid).toEqual(args.uuid);
150
+ expect(name).toEqual(args.name);
151
+ expect(port).toEqual(args.port);
152
+ expect(extension).toEqual(args.exten);
153
+ expect(persistent).toEqual(args.persistent);
154
+ expect(ownerUuids).toEqual(args.owner_uuids);
155
+ expect(creationTime).toEqual(moment(rawCreationTime).toDate());
156
+ expect(requireAuthorization).toEqual(args.require_authorization);
157
+ });
158
+
159
+ it('should retain its values when instantiated', () => {
160
+ const keys = [
161
+ 'uuid',
162
+ 'name',
163
+ 'guestSipAuthorization',
164
+ 'ownerUuids',
165
+ 'port',
166
+ 'uri',
167
+ 'extension',
168
+ 'persistent',
169
+ 'creationTime',
170
+ 'requireAuthorization',
171
+ ];
172
+
173
+ const args = keys.reduce((acc, key) => {
174
+ acc[key] = `some-${key}`;
175
+ return acc;
176
+ }, {});
177
+
178
+ const meeting = new Meeting(args);
179
+
180
+ keys.forEach(key =>
181
+ // $FlowFixMe
182
+ expect(meeting[key]).toEqual(`some-${key}`));
183
+ });
184
+
101
185
  it('can return username and secret from an base64 encrypted string', () => {
102
186
  const USERNAME = 'username';
103
187
  const SECRET = 'secret';
@@ -112,6 +196,7 @@ describe('Meeting domain', () => {
112
196
  uuid: '',
113
197
  exten: '',
114
198
  persistent: false,
199
+ require_authorization: false,
115
200
  };
116
201
 
117
202
  const meeting = Meeting.parse(args);
@@ -124,7 +209,7 @@ describe('Meeting domain', () => {
124
209
 
125
210
  it('should return a date from a string', () => {
126
211
  const args = {
127
- creation_time: '2021-12-21T15:56:42.880Z',
212
+ creation_time: rawCreationTime,
128
213
  guest_sip_authorization: '',
129
214
  ingress_http_uri: '',
130
215
  name: '',
@@ -133,6 +218,7 @@ describe('Meeting domain', () => {
133
218
  uuid: '',
134
219
  exten: '',
135
220
  persistent: false,
221
+ require_authorization: false,
136
222
  };
137
223
 
138
224
  const { creationTime } = Meeting.parse(args);