@wazo/sdk 0.37.37 → 0.37.40

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 (74) hide show
  1. package/README.md +2 -1
  2. package/dist/wazo-sdk.js +2 -2
  3. package/esm/__tests__/api-client.test.js +9 -0
  4. package/esm/__tests__/web-rtc-client.test.js +15 -3
  5. package/esm/api/auth.js +2 -0
  6. package/esm/api-client.js +9 -0
  7. package/esm/checker/Checker.js +15 -3
  8. package/esm/checker/checks/aor.js +9 -0
  9. package/esm/checker/checks/api.js +9 -0
  10. package/esm/checker/checks/index.js +15 -3
  11. package/esm/checker/checks/webrtc-transport.js +15 -3
  12. package/esm/checker/checks/webrtc.js +15 -3
  13. package/esm/domain/AdHocAPIConference.js +14 -5
  14. package/esm/domain/Features.js +9 -0
  15. package/esm/domain/Phone/CTIPhone.js +9 -0
  16. package/esm/domain/Phone/WebRTCPhone.js +1 -1
  17. package/esm/domain/SwitchboardCall.js +5 -5
  18. package/esm/index.js +33 -14
  19. package/esm/service/CallApi.js +9 -0
  20. package/esm/service/getApiClient.js +9 -0
  21. package/esm/simple/Auth.js +33 -14
  22. package/esm/simple/Configuration.js +33 -14
  23. package/esm/simple/Directory.js +9 -0
  24. package/esm/simple/Phone.js +33 -14
  25. package/esm/simple/index.js +33 -14
  26. package/esm/simple/room/LocalParticipant.js +33 -14
  27. package/esm/simple/room/Participant.js +33 -14
  28. package/esm/simple/room/RemoteParticipant.js +33 -14
  29. package/esm/simple/room/Room.js +33 -14
  30. package/esm/simple/room/SipRoom.js +33 -14
  31. package/esm/simple/room/Stream.js +33 -14
  32. package/esm/simple/room/__tests__/RemoteParticipant.test.js +33 -14
  33. package/esm/simple/utils.js +33 -14
  34. package/esm/web-rtc-client.js +15 -3
  35. package/lib/__tests__/api-client.test.js +9 -0
  36. package/lib/__tests__/web-rtc-client.test.js +15 -3
  37. package/lib/api/auth.js +2 -0
  38. package/lib/api-client.js +9 -0
  39. package/lib/checker/Checker.js +15 -3
  40. package/lib/checker/checks/aor.js +9 -0
  41. package/lib/checker/checks/api.js +9 -0
  42. package/lib/checker/checks/index.js +15 -3
  43. package/lib/checker/checks/webrtc-transport.js +15 -3
  44. package/lib/checker/checks/webrtc.js +15 -3
  45. package/lib/domain/AdHocAPIConference.js +14 -5
  46. package/lib/domain/Features.js +9 -0
  47. package/lib/domain/Phone/CTIPhone.js +9 -0
  48. package/lib/domain/Phone/WebRTCPhone.js +1 -1
  49. package/lib/domain/SwitchboardCall.js +5 -5
  50. package/lib/index.js +33 -14
  51. package/lib/service/CallApi.js +9 -0
  52. package/lib/service/getApiClient.js +9 -0
  53. package/lib/simple/Auth.js +33 -14
  54. package/lib/simple/Configuration.js +33 -14
  55. package/lib/simple/Directory.js +9 -0
  56. package/lib/simple/Phone.js +33 -14
  57. package/lib/simple/index.js +33 -14
  58. package/lib/simple/room/LocalParticipant.js +33 -14
  59. package/lib/simple/room/Participant.js +33 -14
  60. package/lib/simple/room/RemoteParticipant.js +33 -14
  61. package/lib/simple/room/Room.js +33 -14
  62. package/lib/simple/room/SipRoom.js +33 -14
  63. package/lib/simple/room/Stream.js +33 -14
  64. package/lib/simple/room/__tests__/RemoteParticipant.test.js +33 -14
  65. package/lib/simple/utils.js +33 -14
  66. package/lib/web-rtc-client.js +15 -3
  67. package/package.json +1 -1
  68. package/src/api/auth.js +2 -0
  69. package/src/api-client.js +7 -0
  70. package/src/domain/AdHocAPIConference.js +5 -5
  71. package/src/domain/Phone/WebRTCPhone.js +1 -1
  72. package/src/domain/SwitchboardCall.js +5 -5
  73. package/src/simple/Auth.js +7 -0
  74. package/src/web-rtc-client.js +7 -4
@@ -2258,12 +2258,14 @@ var authMethods = (client , baseUrl ) => ({
2258
2258
  backend ,
2259
2259
  expiration ,
2260
2260
  isMobile = false,
2261
+ tenantId ,
2261
2262
  ) => {
2262
2263
  const body = {
2263
2264
  backend: backend || DEFAULT_BACKEND_USER,
2264
2265
  expiration: expiration || DETAULT_EXPIRATION,
2265
2266
  refresh_token: refreshToken,
2266
2267
  client_id: client.clientId,
2268
+ tenant_id: tenantId,
2267
2269
  };
2268
2270
 
2269
2271
  const headers = {
@@ -5415,6 +5417,7 @@ class ApiClient {
5415
5417
 
5416
5418
 
5417
5419
 
5420
+
5418
5421
 
5419
5422
 
5420
5423
 
@@ -5455,6 +5458,7 @@ class ApiClient {
5455
5458
  logger$a.info('refresh token callback called', {
5456
5459
  refreshToken: this.refreshToken,
5457
5460
  refreshBackend: this.refreshBackend,
5461
+ refreshTenantId: this.refreshTenantId,
5458
5462
  refreshExpiration: this.refreshExpiration,
5459
5463
  isMobile: this.isMobile,
5460
5464
  });
@@ -5468,6 +5472,7 @@ class ApiClient {
5468
5472
  this.refreshBackend,
5469
5473
  this.refreshExpiration,
5470
5474
  this.isMobile,
5475
+ this.refreshTenantId,
5471
5476
  );
5472
5477
 
5473
5478
  logger$a.info('token refreshed', { token: session.token });
@@ -5509,6 +5514,10 @@ class ApiClient {
5509
5514
  this.refreshBackend = refreshBackend;
5510
5515
  }
5511
5516
 
5517
+ setRefreshTenantId(tenantId ) {
5518
+ this.refreshTenantId = tenantId;
5519
+ }
5520
+
5512
5521
  setIsMobile(isMobile ) {
5513
5522
  this.isMobile = isMobile;
5514
5523
  }
@@ -5680,6 +5689,13 @@ class Auth {
5680
5689
  expiration: this.expiration,
5681
5690
  mobile: this.mobile,
5682
5691
  });
5692
+
5693
+ if (backend) {
5694
+ getApiClient().setRefreshBackend(backend);
5695
+ }
5696
+
5697
+ getApiClient().setRefreshTenantId(tenantId);
5698
+
5683
5699
  return this._onAuthenticated(rawSession);
5684
5700
  }
5685
5701
 
@@ -5906,7 +5922,7 @@ var Auth$1 = global.wazoAuthInstance;
5906
5922
 
5907
5923
 
5908
5924
 
5909
-
5925
+
5910
5926
 
5911
5927
 
5912
5928
 
@@ -5926,7 +5942,7 @@ class AdHocAPIConference {
5926
5942
 
5927
5943
 
5928
5944
 
5929
-
5945
+
5930
5946
 
5931
5947
 
5932
5948
 
@@ -5938,7 +5954,7 @@ class AdHocAPIConference {
5938
5954
  participants,
5939
5955
  started,
5940
5956
  finished,
5941
- startTime,
5957
+ answerTime,
5942
5958
  conferenceId,
5943
5959
  muted,
5944
5960
  paused,
@@ -5948,7 +5964,7 @@ class AdHocAPIConference {
5948
5964
  this.participants = participants || {};
5949
5965
  this.started = started || false;
5950
5966
  this.finished = finished || false;
5951
- this.startTime = startTime;
5967
+ this.answerTime = answerTime;
5952
5968
  this.conferenceId = conferenceId || '';
5953
5969
  this.muted = muted || false;
5954
5970
  this.paused = paused || false;
@@ -5961,7 +5977,7 @@ class AdHocAPIConference {
5961
5977
  async start() {
5962
5978
  this.started = true;
5963
5979
  // $FlowFixMe
5964
- this.startTime = Object.values(this.participants).length ? Object.values(this.participants)[0].startTime : null;
5980
+ this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
5965
5981
 
5966
5982
  const participantIds = Object.keys(this.participants);
5967
5983
  const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
@@ -8719,11 +8735,14 @@ class WebRTCClient extends Emitter {
8719
8735
  }
8720
8736
 
8721
8737
  async _disconnectTransport(force = false) {
8722
- if (force) {
8738
+ if (force && this.userAgent && this.userAgent.transport) {
8723
8739
  // Bypass sip.js state machine that prevent to close WS with the state `Connecting`
8724
8740
  this.userAgent.transport.disconnectResolve = () => {};
8725
- // eslint-disable-next-line
8726
- this.userAgent.transport._ws.close(1000);
8741
+
8742
+ if (this.userAgent.transport._ws) {
8743
+ this.userAgent.transport._ws.close(1000);
8744
+ }
8745
+
8727
8746
  return;
8728
8747
  }
8729
8748
 
@@ -10395,7 +10414,7 @@ class WebRTCPhone extends Emitter {
10395
10414
  });
10396
10415
 
10397
10416
  this.client.on(this.client.DISCONNECTED, () => {
10398
- logger$7.info('WebRTC client disconnected');
10417
+ logger$7.warn('WebRTC client disconnected');
10399
10418
 
10400
10419
  this.eventEmitter.emit(ON_UNREGISTERED);
10401
10420
 
@@ -13116,7 +13135,7 @@ class Room {
13116
13135
 
13117
13136
 
13118
13137
 
13119
-
13138
+
13120
13139
 
13121
13140
 
13122
13141
 
@@ -13142,7 +13161,7 @@ class SwitchboardCall {
13142
13161
 
13143
13162
 
13144
13163
 
13145
-
13164
+
13146
13165
 
13147
13166
 
13148
13167
 
@@ -13156,7 +13175,7 @@ class SwitchboardCall {
13156
13175
  callerIdName: plain.caller_id_name || null,
13157
13176
  callerIdNumber: plain.caller_id_number || null,
13158
13177
  participantId: plain.participantId || null,
13159
- startTime: plain.startTime,
13178
+ answerTime: plain.startTime,
13160
13179
  state: plain.state,
13161
13180
  switchboardName: plain.switchboardName,
13162
13181
  switchboardUuid: plain.switchboardUuid,
@@ -13169,7 +13188,7 @@ class SwitchboardCall {
13169
13188
  callerIdName,
13170
13189
  callerIdNumber,
13171
13190
  participantId,
13172
- startTime,
13191
+ answerTime,
13173
13192
  state,
13174
13193
  switchboardName,
13175
13194
  switchboardUuid,
@@ -13179,7 +13198,7 @@ class SwitchboardCall {
13179
13198
  this.callerIdName = callerIdName;
13180
13199
  this.callerIdNumber = callerIdNumber;
13181
13200
  this.participantId = participantId;
13182
- this.startTime = startTime;
13201
+ this.answerTime = answerTime;
13183
13202
  this.state = state;
13184
13203
  this.switchboardName = switchboardName;
13185
13204
  this.switchboardUuid = switchboardUuid;
@@ -2258,12 +2258,14 @@ var authMethods = (client , baseUrl ) => ({
2258
2258
  backend ,
2259
2259
  expiration ,
2260
2260
  isMobile = false,
2261
+ tenantId ,
2261
2262
  ) => {
2262
2263
  const body = {
2263
2264
  backend: backend || DEFAULT_BACKEND_USER,
2264
2265
  expiration: expiration || DETAULT_EXPIRATION,
2265
2266
  refresh_token: refreshToken,
2266
2267
  client_id: client.clientId,
2268
+ tenant_id: tenantId,
2267
2269
  };
2268
2270
 
2269
2271
  const headers = {
@@ -5415,6 +5417,7 @@ class ApiClient {
5415
5417
 
5416
5418
 
5417
5419
 
5420
+
5418
5421
 
5419
5422
 
5420
5423
 
@@ -5455,6 +5458,7 @@ class ApiClient {
5455
5458
  logger$a.info('refresh token callback called', {
5456
5459
  refreshToken: this.refreshToken,
5457
5460
  refreshBackend: this.refreshBackend,
5461
+ refreshTenantId: this.refreshTenantId,
5458
5462
  refreshExpiration: this.refreshExpiration,
5459
5463
  isMobile: this.isMobile,
5460
5464
  });
@@ -5468,6 +5472,7 @@ class ApiClient {
5468
5472
  this.refreshBackend,
5469
5473
  this.refreshExpiration,
5470
5474
  this.isMobile,
5475
+ this.refreshTenantId,
5471
5476
  );
5472
5477
 
5473
5478
  logger$a.info('token refreshed', { token: session.token });
@@ -5509,6 +5514,10 @@ class ApiClient {
5509
5514
  this.refreshBackend = refreshBackend;
5510
5515
  }
5511
5516
 
5517
+ setRefreshTenantId(tenantId ) {
5518
+ this.refreshTenantId = tenantId;
5519
+ }
5520
+
5512
5521
  setIsMobile(isMobile ) {
5513
5522
  this.isMobile = isMobile;
5514
5523
  }
@@ -5680,6 +5689,13 @@ class Auth {
5680
5689
  expiration: this.expiration,
5681
5690
  mobile: this.mobile,
5682
5691
  });
5692
+
5693
+ if (backend) {
5694
+ getApiClient().setRefreshBackend(backend);
5695
+ }
5696
+
5697
+ getApiClient().setRefreshTenantId(tenantId);
5698
+
5683
5699
  return this._onAuthenticated(rawSession);
5684
5700
  }
5685
5701
 
@@ -5906,7 +5922,7 @@ var Auth$1 = global.wazoAuthInstance;
5906
5922
 
5907
5923
 
5908
5924
 
5909
-
5925
+
5910
5926
 
5911
5927
 
5912
5928
 
@@ -5926,7 +5942,7 @@ class AdHocAPIConference {
5926
5942
 
5927
5943
 
5928
5944
 
5929
-
5945
+
5930
5946
 
5931
5947
 
5932
5948
 
@@ -5938,7 +5954,7 @@ class AdHocAPIConference {
5938
5954
  participants,
5939
5955
  started,
5940
5956
  finished,
5941
- startTime,
5957
+ answerTime,
5942
5958
  conferenceId,
5943
5959
  muted,
5944
5960
  paused,
@@ -5948,7 +5964,7 @@ class AdHocAPIConference {
5948
5964
  this.participants = participants || {};
5949
5965
  this.started = started || false;
5950
5966
  this.finished = finished || false;
5951
- this.startTime = startTime;
5967
+ this.answerTime = answerTime;
5952
5968
  this.conferenceId = conferenceId || '';
5953
5969
  this.muted = muted || false;
5954
5970
  this.paused = paused || false;
@@ -5961,7 +5977,7 @@ class AdHocAPIConference {
5961
5977
  async start() {
5962
5978
  this.started = true;
5963
5979
  // $FlowFixMe
5964
- this.startTime = Object.values(this.participants).length ? Object.values(this.participants)[0].startTime : null;
5980
+ this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
5965
5981
 
5966
5982
  const participantIds = Object.keys(this.participants);
5967
5983
  const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
@@ -8719,11 +8735,14 @@ class WebRTCClient extends Emitter {
8719
8735
  }
8720
8736
 
8721
8737
  async _disconnectTransport(force = false) {
8722
- if (force) {
8738
+ if (force && this.userAgent && this.userAgent.transport) {
8723
8739
  // Bypass sip.js state machine that prevent to close WS with the state `Connecting`
8724
8740
  this.userAgent.transport.disconnectResolve = () => {};
8725
- // eslint-disable-next-line
8726
- this.userAgent.transport._ws.close(1000);
8741
+
8742
+ if (this.userAgent.transport._ws) {
8743
+ this.userAgent.transport._ws.close(1000);
8744
+ }
8745
+
8727
8746
  return;
8728
8747
  }
8729
8748
 
@@ -10395,7 +10414,7 @@ class WebRTCPhone extends Emitter {
10395
10414
  });
10396
10415
 
10397
10416
  this.client.on(this.client.DISCONNECTED, () => {
10398
- logger$7.info('WebRTC client disconnected');
10417
+ logger$7.warn('WebRTC client disconnected');
10399
10418
 
10400
10419
  this.eventEmitter.emit(ON_UNREGISTERED);
10401
10420
 
@@ -13197,7 +13216,7 @@ class Room {
13197
13216
 
13198
13217
 
13199
13218
 
13200
-
13219
+
13201
13220
 
13202
13221
 
13203
13222
 
@@ -13223,7 +13242,7 @@ class SwitchboardCall {
13223
13242
 
13224
13243
 
13225
13244
 
13226
-
13245
+
13227
13246
 
13228
13247
 
13229
13248
 
@@ -13237,7 +13256,7 @@ class SwitchboardCall {
13237
13256
  callerIdName: plain.caller_id_name || null,
13238
13257
  callerIdNumber: plain.caller_id_number || null,
13239
13258
  participantId: plain.participantId || null,
13240
- startTime: plain.startTime,
13259
+ answerTime: plain.startTime,
13241
13260
  state: plain.state,
13242
13261
  switchboardName: plain.switchboardName,
13243
13262
  switchboardUuid: plain.switchboardUuid,
@@ -13250,7 +13269,7 @@ class SwitchboardCall {
13250
13269
  callerIdName,
13251
13270
  callerIdNumber,
13252
13271
  participantId,
13253
- startTime,
13272
+ answerTime,
13254
13273
  state,
13255
13274
  switchboardName,
13256
13275
  switchboardUuid,
@@ -13260,7 +13279,7 @@ class SwitchboardCall {
13260
13279
  this.callerIdName = callerIdName;
13261
13280
  this.callerIdNumber = callerIdNumber;
13262
13281
  this.participantId = participantId;
13263
- this.startTime = startTime;
13282
+ this.answerTime = answerTime;
13264
13283
  this.state = state;
13265
13284
  this.switchboardName = switchboardName;
13266
13285
  this.switchboardUuid = switchboardUuid;
@@ -2258,12 +2258,14 @@ var authMethods = (client , baseUrl ) => ({
2258
2258
  backend ,
2259
2259
  expiration ,
2260
2260
  isMobile = false,
2261
+ tenantId ,
2261
2262
  ) => {
2262
2263
  const body = {
2263
2264
  backend: backend || DEFAULT_BACKEND_USER,
2264
2265
  expiration: expiration || DETAULT_EXPIRATION,
2265
2266
  refresh_token: refreshToken,
2266
2267
  client_id: client.clientId,
2268
+ tenant_id: tenantId,
2267
2269
  };
2268
2270
 
2269
2271
  const headers = {
@@ -5415,6 +5417,7 @@ class ApiClient {
5415
5417
 
5416
5418
 
5417
5419
 
5420
+
5418
5421
 
5419
5422
 
5420
5423
 
@@ -5455,6 +5458,7 @@ class ApiClient {
5455
5458
  logger$a.info('refresh token callback called', {
5456
5459
  refreshToken: this.refreshToken,
5457
5460
  refreshBackend: this.refreshBackend,
5461
+ refreshTenantId: this.refreshTenantId,
5458
5462
  refreshExpiration: this.refreshExpiration,
5459
5463
  isMobile: this.isMobile,
5460
5464
  });
@@ -5468,6 +5472,7 @@ class ApiClient {
5468
5472
  this.refreshBackend,
5469
5473
  this.refreshExpiration,
5470
5474
  this.isMobile,
5475
+ this.refreshTenantId,
5471
5476
  );
5472
5477
 
5473
5478
  logger$a.info('token refreshed', { token: session.token });
@@ -5509,6 +5514,10 @@ class ApiClient {
5509
5514
  this.refreshBackend = refreshBackend;
5510
5515
  }
5511
5516
 
5517
+ setRefreshTenantId(tenantId ) {
5518
+ this.refreshTenantId = tenantId;
5519
+ }
5520
+
5512
5521
  setIsMobile(isMobile ) {
5513
5522
  this.isMobile = isMobile;
5514
5523
  }
@@ -5680,6 +5689,13 @@ class Auth {
5680
5689
  expiration: this.expiration,
5681
5690
  mobile: this.mobile,
5682
5691
  });
5692
+
5693
+ if (backend) {
5694
+ getApiClient().setRefreshBackend(backend);
5695
+ }
5696
+
5697
+ getApiClient().setRefreshTenantId(tenantId);
5698
+
5683
5699
  return this._onAuthenticated(rawSession);
5684
5700
  }
5685
5701
 
@@ -5906,7 +5922,7 @@ var Auth$1 = global.wazoAuthInstance;
5906
5922
 
5907
5923
 
5908
5924
 
5909
-
5925
+
5910
5926
 
5911
5927
 
5912
5928
 
@@ -5926,7 +5942,7 @@ class AdHocAPIConference {
5926
5942
 
5927
5943
 
5928
5944
 
5929
-
5945
+
5930
5946
 
5931
5947
 
5932
5948
 
@@ -5938,7 +5954,7 @@ class AdHocAPIConference {
5938
5954
  participants,
5939
5955
  started,
5940
5956
  finished,
5941
- startTime,
5957
+ answerTime,
5942
5958
  conferenceId,
5943
5959
  muted,
5944
5960
  paused,
@@ -5948,7 +5964,7 @@ class AdHocAPIConference {
5948
5964
  this.participants = participants || {};
5949
5965
  this.started = started || false;
5950
5966
  this.finished = finished || false;
5951
- this.startTime = startTime;
5967
+ this.answerTime = answerTime;
5952
5968
  this.conferenceId = conferenceId || '';
5953
5969
  this.muted = muted || false;
5954
5970
  this.paused = paused || false;
@@ -5961,7 +5977,7 @@ class AdHocAPIConference {
5961
5977
  async start() {
5962
5978
  this.started = true;
5963
5979
  // $FlowFixMe
5964
- this.startTime = Object.values(this.participants).length ? Object.values(this.participants)[0].startTime : null;
5980
+ this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
5965
5981
 
5966
5982
  const participantIds = Object.keys(this.participants);
5967
5983
  const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
@@ -8719,11 +8735,14 @@ class WebRTCClient extends Emitter {
8719
8735
  }
8720
8736
 
8721
8737
  async _disconnectTransport(force = false) {
8722
- if (force) {
8738
+ if (force && this.userAgent && this.userAgent.transport) {
8723
8739
  // Bypass sip.js state machine that prevent to close WS with the state `Connecting`
8724
8740
  this.userAgent.transport.disconnectResolve = () => {};
8725
- // eslint-disable-next-line
8726
- this.userAgent.transport._ws.close(1000);
8741
+
8742
+ if (this.userAgent.transport._ws) {
8743
+ this.userAgent.transport._ws.close(1000);
8744
+ }
8745
+
8727
8746
  return;
8728
8747
  }
8729
8748
 
@@ -10395,7 +10414,7 @@ class WebRTCPhone extends Emitter {
10395
10414
  });
10396
10415
 
10397
10416
  this.client.on(this.client.DISCONNECTED, () => {
10398
- logger$7.info('WebRTC client disconnected');
10417
+ logger$7.warn('WebRTC client disconnected');
10399
10418
 
10400
10419
  this.eventEmitter.emit(ON_UNREGISTERED);
10401
10420
 
@@ -13255,7 +13274,7 @@ class Room {
13255
13274
 
13256
13275
 
13257
13276
 
13258
-
13277
+
13259
13278
 
13260
13279
 
13261
13280
 
@@ -13281,7 +13300,7 @@ class SwitchboardCall {
13281
13300
 
13282
13301
 
13283
13302
 
13284
-
13303
+
13285
13304
 
13286
13305
 
13287
13306
 
@@ -13295,7 +13314,7 @@ class SwitchboardCall {
13295
13314
  callerIdName: plain.caller_id_name || null,
13296
13315
  callerIdNumber: plain.caller_id_number || null,
13297
13316
  participantId: plain.participantId || null,
13298
- startTime: plain.startTime,
13317
+ answerTime: plain.startTime,
13299
13318
  state: plain.state,
13300
13319
  switchboardName: plain.switchboardName,
13301
13320
  switchboardUuid: plain.switchboardUuid,
@@ -13308,7 +13327,7 @@ class SwitchboardCall {
13308
13327
  callerIdName,
13309
13328
  callerIdNumber,
13310
13329
  participantId,
13311
- startTime,
13330
+ answerTime,
13312
13331
  state,
13313
13332
  switchboardName,
13314
13333
  switchboardUuid,
@@ -13318,7 +13337,7 @@ class SwitchboardCall {
13318
13337
  this.callerIdName = callerIdName;
13319
13338
  this.callerIdNumber = callerIdNumber;
13320
13339
  this.participantId = participantId;
13321
- this.startTime = startTime;
13340
+ this.answerTime = answerTime;
13322
13341
  this.state = state;
13323
13342
  this.switchboardName = switchboardName;
13324
13343
  this.switchboardUuid = switchboardUuid;
@@ -2258,12 +2258,14 @@ var authMethods = (client , baseUrl ) => ({
2258
2258
  backend ,
2259
2259
  expiration ,
2260
2260
  isMobile = false,
2261
+ tenantId ,
2261
2262
  ) => {
2262
2263
  const body = {
2263
2264
  backend: backend || DEFAULT_BACKEND_USER,
2264
2265
  expiration: expiration || DETAULT_EXPIRATION,
2265
2266
  refresh_token: refreshToken,
2266
2267
  client_id: client.clientId,
2268
+ tenant_id: tenantId,
2267
2269
  };
2268
2270
 
2269
2271
  const headers = {
@@ -5415,6 +5417,7 @@ class ApiClient {
5415
5417
 
5416
5418
 
5417
5419
 
5420
+
5418
5421
 
5419
5422
 
5420
5423
 
@@ -5455,6 +5458,7 @@ class ApiClient {
5455
5458
  logger$a.info('refresh token callback called', {
5456
5459
  refreshToken: this.refreshToken,
5457
5460
  refreshBackend: this.refreshBackend,
5461
+ refreshTenantId: this.refreshTenantId,
5458
5462
  refreshExpiration: this.refreshExpiration,
5459
5463
  isMobile: this.isMobile,
5460
5464
  });
@@ -5468,6 +5472,7 @@ class ApiClient {
5468
5472
  this.refreshBackend,
5469
5473
  this.refreshExpiration,
5470
5474
  this.isMobile,
5475
+ this.refreshTenantId,
5471
5476
  );
5472
5477
 
5473
5478
  logger$a.info('token refreshed', { token: session.token });
@@ -5509,6 +5514,10 @@ class ApiClient {
5509
5514
  this.refreshBackend = refreshBackend;
5510
5515
  }
5511
5516
 
5517
+ setRefreshTenantId(tenantId ) {
5518
+ this.refreshTenantId = tenantId;
5519
+ }
5520
+
5512
5521
  setIsMobile(isMobile ) {
5513
5522
  this.isMobile = isMobile;
5514
5523
  }
@@ -5680,6 +5689,13 @@ class Auth {
5680
5689
  expiration: this.expiration,
5681
5690
  mobile: this.mobile,
5682
5691
  });
5692
+
5693
+ if (backend) {
5694
+ getApiClient().setRefreshBackend(backend);
5695
+ }
5696
+
5697
+ getApiClient().setRefreshTenantId(tenantId);
5698
+
5683
5699
  return this._onAuthenticated(rawSession);
5684
5700
  }
5685
5701
 
@@ -5906,7 +5922,7 @@ var Auth$1 = global.wazoAuthInstance;
5906
5922
 
5907
5923
 
5908
5924
 
5909
-
5925
+
5910
5926
 
5911
5927
 
5912
5928
 
@@ -5926,7 +5942,7 @@ class AdHocAPIConference {
5926
5942
 
5927
5943
 
5928
5944
 
5929
-
5945
+
5930
5946
 
5931
5947
 
5932
5948
 
@@ -5938,7 +5954,7 @@ class AdHocAPIConference {
5938
5954
  participants,
5939
5955
  started,
5940
5956
  finished,
5941
- startTime,
5957
+ answerTime,
5942
5958
  conferenceId,
5943
5959
  muted,
5944
5960
  paused,
@@ -5948,7 +5964,7 @@ class AdHocAPIConference {
5948
5964
  this.participants = participants || {};
5949
5965
  this.started = started || false;
5950
5966
  this.finished = finished || false;
5951
- this.startTime = startTime;
5967
+ this.answerTime = answerTime;
5952
5968
  this.conferenceId = conferenceId || '';
5953
5969
  this.muted = muted || false;
5954
5970
  this.paused = paused || false;
@@ -5961,7 +5977,7 @@ class AdHocAPIConference {
5961
5977
  async start() {
5962
5978
  this.started = true;
5963
5979
  // $FlowFixMe
5964
- this.startTime = Object.values(this.participants).length ? Object.values(this.participants)[0].startTime : null;
5980
+ this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
5965
5981
 
5966
5982
  const participantIds = Object.keys(this.participants);
5967
5983
  const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
@@ -8719,11 +8735,14 @@ class WebRTCClient extends Emitter {
8719
8735
  }
8720
8736
 
8721
8737
  async _disconnectTransport(force = false) {
8722
- if (force) {
8738
+ if (force && this.userAgent && this.userAgent.transport) {
8723
8739
  // Bypass sip.js state machine that prevent to close WS with the state `Connecting`
8724
8740
  this.userAgent.transport.disconnectResolve = () => {};
8725
- // eslint-disable-next-line
8726
- this.userAgent.transport._ws.close(1000);
8741
+
8742
+ if (this.userAgent.transport._ws) {
8743
+ this.userAgent.transport._ws.close(1000);
8744
+ }
8745
+
8727
8746
  return;
8728
8747
  }
8729
8748
 
@@ -10395,7 +10414,7 @@ class WebRTCPhone extends Emitter {
10395
10414
  });
10396
10415
 
10397
10416
  this.client.on(this.client.DISCONNECTED, () => {
10398
- logger$7.info('WebRTC client disconnected');
10417
+ logger$7.warn('WebRTC client disconnected');
10399
10418
 
10400
10419
  this.eventEmitter.emit(ON_UNREGISTERED);
10401
10420
 
@@ -13239,7 +13258,7 @@ class Room {
13239
13258
 
13240
13259
 
13241
13260
 
13242
-
13261
+
13243
13262
 
13244
13263
 
13245
13264
 
@@ -13265,7 +13284,7 @@ class SwitchboardCall {
13265
13284
 
13266
13285
 
13267
13286
 
13268
-
13287
+
13269
13288
 
13270
13289
 
13271
13290
 
@@ -13279,7 +13298,7 @@ class SwitchboardCall {
13279
13298
  callerIdName: plain.caller_id_name || null,
13280
13299
  callerIdNumber: plain.caller_id_number || null,
13281
13300
  participantId: plain.participantId || null,
13282
- startTime: plain.startTime,
13301
+ answerTime: plain.startTime,
13283
13302
  state: plain.state,
13284
13303
  switchboardName: plain.switchboardName,
13285
13304
  switchboardUuid: plain.switchboardUuid,
@@ -13292,7 +13311,7 @@ class SwitchboardCall {
13292
13311
  callerIdName,
13293
13312
  callerIdNumber,
13294
13313
  participantId,
13295
- startTime,
13314
+ answerTime,
13296
13315
  state,
13297
13316
  switchboardName,
13298
13317
  switchboardUuid,
@@ -13302,7 +13321,7 @@ class SwitchboardCall {
13302
13321
  this.callerIdName = callerIdName;
13303
13322
  this.callerIdNumber = callerIdNumber;
13304
13323
  this.participantId = participantId;
13305
- this.startTime = startTime;
13324
+ this.answerTime = answerTime;
13306
13325
  this.state = state;
13307
13326
  this.switchboardName = switchboardName;
13308
13327
  this.switchboardUuid = switchboardUuid;