@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
@@ -2268,12 +2268,14 @@ var authMethods = (client , baseUrl ) => ({
2268
2268
  backend ,
2269
2269
  expiration ,
2270
2270
  isMobile = false,
2271
+ tenantId ,
2271
2272
  ) => {
2272
2273
  const body = {
2273
2274
  backend: backend || DEFAULT_BACKEND_USER,
2274
2275
  expiration: expiration || DETAULT_EXPIRATION,
2275
2276
  refresh_token: refreshToken,
2276
2277
  client_id: client.clientId,
2278
+ tenant_id: tenantId,
2277
2279
  };
2278
2280
 
2279
2281
  const headers = {
@@ -5425,6 +5427,7 @@ class ApiClient {
5425
5427
 
5426
5428
 
5427
5429
 
5430
+
5428
5431
 
5429
5432
 
5430
5433
 
@@ -5465,6 +5468,7 @@ class ApiClient {
5465
5468
  logger$a.info('refresh token callback called', {
5466
5469
  refreshToken: this.refreshToken,
5467
5470
  refreshBackend: this.refreshBackend,
5471
+ refreshTenantId: this.refreshTenantId,
5468
5472
  refreshExpiration: this.refreshExpiration,
5469
5473
  isMobile: this.isMobile,
5470
5474
  });
@@ -5478,6 +5482,7 @@ class ApiClient {
5478
5482
  this.refreshBackend,
5479
5483
  this.refreshExpiration,
5480
5484
  this.isMobile,
5485
+ this.refreshTenantId,
5481
5486
  );
5482
5487
 
5483
5488
  logger$a.info('token refreshed', { token: session.token });
@@ -5519,6 +5524,10 @@ class ApiClient {
5519
5524
  this.refreshBackend = refreshBackend;
5520
5525
  }
5521
5526
 
5527
+ setRefreshTenantId(tenantId ) {
5528
+ this.refreshTenantId = tenantId;
5529
+ }
5530
+
5522
5531
  setIsMobile(isMobile ) {
5523
5532
  this.isMobile = isMobile;
5524
5533
  }
@@ -5690,6 +5699,13 @@ class Auth {
5690
5699
  expiration: this.expiration,
5691
5700
  mobile: this.mobile,
5692
5701
  });
5702
+
5703
+ if (backend) {
5704
+ getApiClient().setRefreshBackend(backend);
5705
+ }
5706
+
5707
+ getApiClient().setRefreshTenantId(tenantId);
5708
+
5693
5709
  return this._onAuthenticated(rawSession);
5694
5710
  }
5695
5711
 
@@ -5916,7 +5932,7 @@ var Auth$1 = global.wazoAuthInstance;
5916
5932
 
5917
5933
 
5918
5934
 
5919
-
5935
+
5920
5936
 
5921
5937
 
5922
5938
 
@@ -5936,7 +5952,7 @@ class AdHocAPIConference {
5936
5952
 
5937
5953
 
5938
5954
 
5939
-
5955
+
5940
5956
 
5941
5957
 
5942
5958
 
@@ -5948,7 +5964,7 @@ class AdHocAPIConference {
5948
5964
  participants,
5949
5965
  started,
5950
5966
  finished,
5951
- startTime,
5967
+ answerTime,
5952
5968
  conferenceId,
5953
5969
  muted,
5954
5970
  paused,
@@ -5958,7 +5974,7 @@ class AdHocAPIConference {
5958
5974
  this.participants = participants || {};
5959
5975
  this.started = started || false;
5960
5976
  this.finished = finished || false;
5961
- this.startTime = startTime;
5977
+ this.answerTime = answerTime;
5962
5978
  this.conferenceId = conferenceId || '';
5963
5979
  this.muted = muted || false;
5964
5980
  this.paused = paused || false;
@@ -5971,7 +5987,7 @@ class AdHocAPIConference {
5971
5987
  async start() {
5972
5988
  this.started = true;
5973
5989
  // $FlowFixMe
5974
- this.startTime = Object.values(this.participants).length ? Object.values(this.participants)[0].startTime : null;
5990
+ this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
5975
5991
 
5976
5992
  const participantIds = Object.keys(this.participants);
5977
5993
  const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
@@ -8729,11 +8745,14 @@ class WebRTCClient extends Emitter {
8729
8745
  }
8730
8746
 
8731
8747
  async _disconnectTransport(force = false) {
8732
- if (force) {
8748
+ if (force && this.userAgent && this.userAgent.transport) {
8733
8749
  // Bypass sip.js state machine that prevent to close WS with the state `Connecting`
8734
8750
  this.userAgent.transport.disconnectResolve = () => {};
8735
- // eslint-disable-next-line
8736
- this.userAgent.transport._ws.close(1000);
8751
+
8752
+ if (this.userAgent.transport._ws) {
8753
+ this.userAgent.transport._ws.close(1000);
8754
+ }
8755
+
8737
8756
  return;
8738
8757
  }
8739
8758
 
@@ -10405,7 +10424,7 @@ class WebRTCPhone extends Emitter {
10405
10424
  });
10406
10425
 
10407
10426
  this.client.on(this.client.DISCONNECTED, () => {
10408
- logger$7.info('WebRTC client disconnected');
10427
+ logger$7.warn('WebRTC client disconnected');
10409
10428
 
10410
10429
  this.eventEmitter.emit(ON_UNREGISTERED);
10411
10430
 
@@ -13126,7 +13145,7 @@ class Room {
13126
13145
 
13127
13146
 
13128
13147
 
13129
-
13148
+
13130
13149
 
13131
13150
 
13132
13151
 
@@ -13152,7 +13171,7 @@ class SwitchboardCall {
13152
13171
 
13153
13172
 
13154
13173
 
13155
-
13174
+
13156
13175
 
13157
13176
 
13158
13177
 
@@ -13166,7 +13185,7 @@ class SwitchboardCall {
13166
13185
  callerIdName: plain.caller_id_name || null,
13167
13186
  callerIdNumber: plain.caller_id_number || null,
13168
13187
  participantId: plain.participantId || null,
13169
- startTime: plain.startTime,
13188
+ answerTime: plain.startTime,
13170
13189
  state: plain.state,
13171
13190
  switchboardName: plain.switchboardName,
13172
13191
  switchboardUuid: plain.switchboardUuid,
@@ -13179,7 +13198,7 @@ class SwitchboardCall {
13179
13198
  callerIdName,
13180
13199
  callerIdNumber,
13181
13200
  participantId,
13182
- startTime,
13201
+ answerTime,
13183
13202
  state,
13184
13203
  switchboardName,
13185
13204
  switchboardUuid,
@@ -13189,7 +13208,7 @@ class SwitchboardCall {
13189
13208
  this.callerIdName = callerIdName;
13190
13209
  this.callerIdNumber = callerIdNumber;
13191
13210
  this.participantId = participantId;
13192
- this.startTime = startTime;
13211
+ this.answerTime = answerTime;
13193
13212
  this.state = state;
13194
13213
  this.switchboardName = switchboardName;
13195
13214
  this.switchboardUuid = switchboardUuid;
@@ -2268,12 +2268,14 @@ var authMethods = (client , baseUrl ) => ({
2268
2268
  backend ,
2269
2269
  expiration ,
2270
2270
  isMobile = false,
2271
+ tenantId ,
2271
2272
  ) => {
2272
2273
  const body = {
2273
2274
  backend: backend || DEFAULT_BACKEND_USER,
2274
2275
  expiration: expiration || DETAULT_EXPIRATION,
2275
2276
  refresh_token: refreshToken,
2276
2277
  client_id: client.clientId,
2278
+ tenant_id: tenantId,
2277
2279
  };
2278
2280
 
2279
2281
  const headers = {
@@ -5425,6 +5427,7 @@ class ApiClient {
5425
5427
 
5426
5428
 
5427
5429
 
5430
+
5428
5431
 
5429
5432
 
5430
5433
 
@@ -5465,6 +5468,7 @@ class ApiClient {
5465
5468
  logger$a.info('refresh token callback called', {
5466
5469
  refreshToken: this.refreshToken,
5467
5470
  refreshBackend: this.refreshBackend,
5471
+ refreshTenantId: this.refreshTenantId,
5468
5472
  refreshExpiration: this.refreshExpiration,
5469
5473
  isMobile: this.isMobile,
5470
5474
  });
@@ -5478,6 +5482,7 @@ class ApiClient {
5478
5482
  this.refreshBackend,
5479
5483
  this.refreshExpiration,
5480
5484
  this.isMobile,
5485
+ this.refreshTenantId,
5481
5486
  );
5482
5487
 
5483
5488
  logger$a.info('token refreshed', { token: session.token });
@@ -5519,6 +5524,10 @@ class ApiClient {
5519
5524
  this.refreshBackend = refreshBackend;
5520
5525
  }
5521
5526
 
5527
+ setRefreshTenantId(tenantId ) {
5528
+ this.refreshTenantId = tenantId;
5529
+ }
5530
+
5522
5531
  setIsMobile(isMobile ) {
5523
5532
  this.isMobile = isMobile;
5524
5533
  }
@@ -5690,6 +5699,13 @@ class Auth {
5690
5699
  expiration: this.expiration,
5691
5700
  mobile: this.mobile,
5692
5701
  });
5702
+
5703
+ if (backend) {
5704
+ getApiClient().setRefreshBackend(backend);
5705
+ }
5706
+
5707
+ getApiClient().setRefreshTenantId(tenantId);
5708
+
5693
5709
  return this._onAuthenticated(rawSession);
5694
5710
  }
5695
5711
 
@@ -5916,7 +5932,7 @@ var Auth$1 = global.wazoAuthInstance;
5916
5932
 
5917
5933
 
5918
5934
 
5919
-
5935
+
5920
5936
 
5921
5937
 
5922
5938
 
@@ -5936,7 +5952,7 @@ class AdHocAPIConference {
5936
5952
 
5937
5953
 
5938
5954
 
5939
-
5955
+
5940
5956
 
5941
5957
 
5942
5958
 
@@ -5948,7 +5964,7 @@ class AdHocAPIConference {
5948
5964
  participants,
5949
5965
  started,
5950
5966
  finished,
5951
- startTime,
5967
+ answerTime,
5952
5968
  conferenceId,
5953
5969
  muted,
5954
5970
  paused,
@@ -5958,7 +5974,7 @@ class AdHocAPIConference {
5958
5974
  this.participants = participants || {};
5959
5975
  this.started = started || false;
5960
5976
  this.finished = finished || false;
5961
- this.startTime = startTime;
5977
+ this.answerTime = answerTime;
5962
5978
  this.conferenceId = conferenceId || '';
5963
5979
  this.muted = muted || false;
5964
5980
  this.paused = paused || false;
@@ -5971,7 +5987,7 @@ class AdHocAPIConference {
5971
5987
  async start() {
5972
5988
  this.started = true;
5973
5989
  // $FlowFixMe
5974
- this.startTime = Object.values(this.participants).length ? Object.values(this.participants)[0].startTime : null;
5990
+ this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
5975
5991
 
5976
5992
  const participantIds = Object.keys(this.participants);
5977
5993
  const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
@@ -8729,11 +8745,14 @@ class WebRTCClient extends Emitter {
8729
8745
  }
8730
8746
 
8731
8747
  async _disconnectTransport(force = false) {
8732
- if (force) {
8748
+ if (force && this.userAgent && this.userAgent.transport) {
8733
8749
  // Bypass sip.js state machine that prevent to close WS with the state `Connecting`
8734
8750
  this.userAgent.transport.disconnectResolve = () => {};
8735
- // eslint-disable-next-line
8736
- this.userAgent.transport._ws.close(1000);
8751
+
8752
+ if (this.userAgent.transport._ws) {
8753
+ this.userAgent.transport._ws.close(1000);
8754
+ }
8755
+
8737
8756
  return;
8738
8757
  }
8739
8758
 
@@ -10405,7 +10424,7 @@ class WebRTCPhone extends Emitter {
10405
10424
  });
10406
10425
 
10407
10426
  this.client.on(this.client.DISCONNECTED, () => {
10408
- logger$7.info('WebRTC client disconnected');
10427
+ logger$7.warn('WebRTC client disconnected');
10409
10428
 
10410
10429
  this.eventEmitter.emit(ON_UNREGISTERED);
10411
10430
 
@@ -13207,7 +13226,7 @@ class Room {
13207
13226
 
13208
13227
 
13209
13228
 
13210
-
13229
+
13211
13230
 
13212
13231
 
13213
13232
 
@@ -13233,7 +13252,7 @@ class SwitchboardCall {
13233
13252
 
13234
13253
 
13235
13254
 
13236
-
13255
+
13237
13256
 
13238
13257
 
13239
13258
 
@@ -13247,7 +13266,7 @@ class SwitchboardCall {
13247
13266
  callerIdName: plain.caller_id_name || null,
13248
13267
  callerIdNumber: plain.caller_id_number || null,
13249
13268
  participantId: plain.participantId || null,
13250
- startTime: plain.startTime,
13269
+ answerTime: plain.startTime,
13251
13270
  state: plain.state,
13252
13271
  switchboardName: plain.switchboardName,
13253
13272
  switchboardUuid: plain.switchboardUuid,
@@ -13260,7 +13279,7 @@ class SwitchboardCall {
13260
13279
  callerIdName,
13261
13280
  callerIdNumber,
13262
13281
  participantId,
13263
- startTime,
13282
+ answerTime,
13264
13283
  state,
13265
13284
  switchboardName,
13266
13285
  switchboardUuid,
@@ -13270,7 +13289,7 @@ class SwitchboardCall {
13270
13289
  this.callerIdName = callerIdName;
13271
13290
  this.callerIdNumber = callerIdNumber;
13272
13291
  this.participantId = participantId;
13273
- this.startTime = startTime;
13292
+ this.answerTime = answerTime;
13274
13293
  this.state = state;
13275
13294
  this.switchboardName = switchboardName;
13276
13295
  this.switchboardUuid = switchboardUuid;
@@ -2268,12 +2268,14 @@ var authMethods = (client , baseUrl ) => ({
2268
2268
  backend ,
2269
2269
  expiration ,
2270
2270
  isMobile = false,
2271
+ tenantId ,
2271
2272
  ) => {
2272
2273
  const body = {
2273
2274
  backend: backend || DEFAULT_BACKEND_USER,
2274
2275
  expiration: expiration || DETAULT_EXPIRATION,
2275
2276
  refresh_token: refreshToken,
2276
2277
  client_id: client.clientId,
2278
+ tenant_id: tenantId,
2277
2279
  };
2278
2280
 
2279
2281
  const headers = {
@@ -5425,6 +5427,7 @@ class ApiClient {
5425
5427
 
5426
5428
 
5427
5429
 
5430
+
5428
5431
 
5429
5432
 
5430
5433
 
@@ -5465,6 +5468,7 @@ class ApiClient {
5465
5468
  logger$a.info('refresh token callback called', {
5466
5469
  refreshToken: this.refreshToken,
5467
5470
  refreshBackend: this.refreshBackend,
5471
+ refreshTenantId: this.refreshTenantId,
5468
5472
  refreshExpiration: this.refreshExpiration,
5469
5473
  isMobile: this.isMobile,
5470
5474
  });
@@ -5478,6 +5482,7 @@ class ApiClient {
5478
5482
  this.refreshBackend,
5479
5483
  this.refreshExpiration,
5480
5484
  this.isMobile,
5485
+ this.refreshTenantId,
5481
5486
  );
5482
5487
 
5483
5488
  logger$a.info('token refreshed', { token: session.token });
@@ -5519,6 +5524,10 @@ class ApiClient {
5519
5524
  this.refreshBackend = refreshBackend;
5520
5525
  }
5521
5526
 
5527
+ setRefreshTenantId(tenantId ) {
5528
+ this.refreshTenantId = tenantId;
5529
+ }
5530
+
5522
5531
  setIsMobile(isMobile ) {
5523
5532
  this.isMobile = isMobile;
5524
5533
  }
@@ -5690,6 +5699,13 @@ class Auth {
5690
5699
  expiration: this.expiration,
5691
5700
  mobile: this.mobile,
5692
5701
  });
5702
+
5703
+ if (backend) {
5704
+ getApiClient().setRefreshBackend(backend);
5705
+ }
5706
+
5707
+ getApiClient().setRefreshTenantId(tenantId);
5708
+
5693
5709
  return this._onAuthenticated(rawSession);
5694
5710
  }
5695
5711
 
@@ -5916,7 +5932,7 @@ var Auth$1 = global.wazoAuthInstance;
5916
5932
 
5917
5933
 
5918
5934
 
5919
-
5935
+
5920
5936
 
5921
5937
 
5922
5938
 
@@ -5936,7 +5952,7 @@ class AdHocAPIConference {
5936
5952
 
5937
5953
 
5938
5954
 
5939
-
5955
+
5940
5956
 
5941
5957
 
5942
5958
 
@@ -5948,7 +5964,7 @@ class AdHocAPIConference {
5948
5964
  participants,
5949
5965
  started,
5950
5966
  finished,
5951
- startTime,
5967
+ answerTime,
5952
5968
  conferenceId,
5953
5969
  muted,
5954
5970
  paused,
@@ -5958,7 +5974,7 @@ class AdHocAPIConference {
5958
5974
  this.participants = participants || {};
5959
5975
  this.started = started || false;
5960
5976
  this.finished = finished || false;
5961
- this.startTime = startTime;
5977
+ this.answerTime = answerTime;
5962
5978
  this.conferenceId = conferenceId || '';
5963
5979
  this.muted = muted || false;
5964
5980
  this.paused = paused || false;
@@ -5971,7 +5987,7 @@ class AdHocAPIConference {
5971
5987
  async start() {
5972
5988
  this.started = true;
5973
5989
  // $FlowFixMe
5974
- this.startTime = Object.values(this.participants).length ? Object.values(this.participants)[0].startTime : null;
5990
+ this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
5975
5991
 
5976
5992
  const participantIds = Object.keys(this.participants);
5977
5993
  const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
@@ -8729,11 +8745,14 @@ class WebRTCClient extends Emitter {
8729
8745
  }
8730
8746
 
8731
8747
  async _disconnectTransport(force = false) {
8732
- if (force) {
8748
+ if (force && this.userAgent && this.userAgent.transport) {
8733
8749
  // Bypass sip.js state machine that prevent to close WS with the state `Connecting`
8734
8750
  this.userAgent.transport.disconnectResolve = () => {};
8735
- // eslint-disable-next-line
8736
- this.userAgent.transport._ws.close(1000);
8751
+
8752
+ if (this.userAgent.transport._ws) {
8753
+ this.userAgent.transport._ws.close(1000);
8754
+ }
8755
+
8737
8756
  return;
8738
8757
  }
8739
8758
 
@@ -10405,7 +10424,7 @@ class WebRTCPhone extends Emitter {
10405
10424
  });
10406
10425
 
10407
10426
  this.client.on(this.client.DISCONNECTED, () => {
10408
- logger$7.info('WebRTC client disconnected');
10427
+ logger$7.warn('WebRTC client disconnected');
10409
10428
 
10410
10429
  this.eventEmitter.emit(ON_UNREGISTERED);
10411
10430
 
@@ -13265,7 +13284,7 @@ class Room {
13265
13284
 
13266
13285
 
13267
13286
 
13268
-
13287
+
13269
13288
 
13270
13289
 
13271
13290
 
@@ -13291,7 +13310,7 @@ class SwitchboardCall {
13291
13310
 
13292
13311
 
13293
13312
 
13294
-
13313
+
13295
13314
 
13296
13315
 
13297
13316
 
@@ -13305,7 +13324,7 @@ class SwitchboardCall {
13305
13324
  callerIdName: plain.caller_id_name || null,
13306
13325
  callerIdNumber: plain.caller_id_number || null,
13307
13326
  participantId: plain.participantId || null,
13308
- startTime: plain.startTime,
13327
+ answerTime: plain.startTime,
13309
13328
  state: plain.state,
13310
13329
  switchboardName: plain.switchboardName,
13311
13330
  switchboardUuid: plain.switchboardUuid,
@@ -13318,7 +13337,7 @@ class SwitchboardCall {
13318
13337
  callerIdName,
13319
13338
  callerIdNumber,
13320
13339
  participantId,
13321
- startTime,
13340
+ answerTime,
13322
13341
  state,
13323
13342
  switchboardName,
13324
13343
  switchboardUuid,
@@ -13328,7 +13347,7 @@ class SwitchboardCall {
13328
13347
  this.callerIdName = callerIdName;
13329
13348
  this.callerIdNumber = callerIdNumber;
13330
13349
  this.participantId = participantId;
13331
- this.startTime = startTime;
13350
+ this.answerTime = answerTime;
13332
13351
  this.state = state;
13333
13352
  this.switchboardName = switchboardName;
13334
13353
  this.switchboardUuid = switchboardUuid;
@@ -2270,12 +2270,14 @@ var authMethods = (client , baseUrl ) => ({
2270
2270
  backend ,
2271
2271
  expiration ,
2272
2272
  isMobile = false,
2273
+ tenantId ,
2273
2274
  ) => {
2274
2275
  const body = {
2275
2276
  backend: backend || DEFAULT_BACKEND_USER,
2276
2277
  expiration: expiration || DETAULT_EXPIRATION,
2277
2278
  refresh_token: refreshToken,
2278
2279
  client_id: client.clientId,
2280
+ tenant_id: tenantId,
2279
2281
  };
2280
2282
 
2281
2283
  const headers = {
@@ -5427,6 +5429,7 @@ class ApiClient {
5427
5429
 
5428
5430
 
5429
5431
 
5432
+
5430
5433
 
5431
5434
 
5432
5435
 
@@ -5467,6 +5470,7 @@ class ApiClient {
5467
5470
  logger$a.info('refresh token callback called', {
5468
5471
  refreshToken: this.refreshToken,
5469
5472
  refreshBackend: this.refreshBackend,
5473
+ refreshTenantId: this.refreshTenantId,
5470
5474
  refreshExpiration: this.refreshExpiration,
5471
5475
  isMobile: this.isMobile,
5472
5476
  });
@@ -5480,6 +5484,7 @@ class ApiClient {
5480
5484
  this.refreshBackend,
5481
5485
  this.refreshExpiration,
5482
5486
  this.isMobile,
5487
+ this.refreshTenantId,
5483
5488
  );
5484
5489
 
5485
5490
  logger$a.info('token refreshed', { token: session.token });
@@ -5521,6 +5526,10 @@ class ApiClient {
5521
5526
  this.refreshBackend = refreshBackend;
5522
5527
  }
5523
5528
 
5529
+ setRefreshTenantId(tenantId ) {
5530
+ this.refreshTenantId = tenantId;
5531
+ }
5532
+
5524
5533
  setIsMobile(isMobile ) {
5525
5534
  this.isMobile = isMobile;
5526
5535
  }
@@ -5692,6 +5701,13 @@ class Auth {
5692
5701
  expiration: this.expiration,
5693
5702
  mobile: this.mobile,
5694
5703
  });
5704
+
5705
+ if (backend) {
5706
+ getApiClient().setRefreshBackend(backend);
5707
+ }
5708
+
5709
+ getApiClient().setRefreshTenantId(tenantId);
5710
+
5695
5711
  return this._onAuthenticated(rawSession);
5696
5712
  }
5697
5713
 
@@ -5918,7 +5934,7 @@ var Auth$1 = global.wazoAuthInstance;
5918
5934
 
5919
5935
 
5920
5936
 
5921
-
5937
+
5922
5938
 
5923
5939
 
5924
5940
 
@@ -5938,7 +5954,7 @@ class AdHocAPIConference {
5938
5954
 
5939
5955
 
5940
5956
 
5941
-
5957
+
5942
5958
 
5943
5959
 
5944
5960
 
@@ -5950,7 +5966,7 @@ class AdHocAPIConference {
5950
5966
  participants,
5951
5967
  started,
5952
5968
  finished,
5953
- startTime,
5969
+ answerTime,
5954
5970
  conferenceId,
5955
5971
  muted,
5956
5972
  paused,
@@ -5960,7 +5976,7 @@ class AdHocAPIConference {
5960
5976
  this.participants = participants || {};
5961
5977
  this.started = started || false;
5962
5978
  this.finished = finished || false;
5963
- this.startTime = startTime;
5979
+ this.answerTime = answerTime;
5964
5980
  this.conferenceId = conferenceId || '';
5965
5981
  this.muted = muted || false;
5966
5982
  this.paused = paused || false;
@@ -5973,7 +5989,7 @@ class AdHocAPIConference {
5973
5989
  async start() {
5974
5990
  this.started = true;
5975
5991
  // $FlowFixMe
5976
- this.startTime = Object.values(this.participants).length ? Object.values(this.participants)[0].startTime : null;
5992
+ this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
5977
5993
 
5978
5994
  const participantIds = Object.keys(this.participants);
5979
5995
  const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
@@ -8731,11 +8747,14 @@ class WebRTCClient extends Emitter {
8731
8747
  }
8732
8748
 
8733
8749
  async _disconnectTransport(force = false) {
8734
- if (force) {
8750
+ if (force && this.userAgent && this.userAgent.transport) {
8735
8751
  // Bypass sip.js state machine that prevent to close WS with the state `Connecting`
8736
8752
  this.userAgent.transport.disconnectResolve = () => {};
8737
- // eslint-disable-next-line
8738
- this.userAgent.transport._ws.close(1000);
8753
+
8754
+ if (this.userAgent.transport._ws) {
8755
+ this.userAgent.transport._ws.close(1000);
8756
+ }
8757
+
8739
8758
  return;
8740
8759
  }
8741
8760
 
@@ -10407,7 +10426,7 @@ class WebRTCPhone extends Emitter {
10407
10426
  });
10408
10427
 
10409
10428
  this.client.on(this.client.DISCONNECTED, () => {
10410
- logger$7.info('WebRTC client disconnected');
10429
+ logger$7.warn('WebRTC client disconnected');
10411
10430
 
10412
10431
  this.eventEmitter.emit(ON_UNREGISTERED);
10413
10432
 
@@ -13251,7 +13270,7 @@ class Room {
13251
13270
 
13252
13271
 
13253
13272
 
13254
-
13273
+
13255
13274
 
13256
13275
 
13257
13276
 
@@ -13277,7 +13296,7 @@ class SwitchboardCall {
13277
13296
 
13278
13297
 
13279
13298
 
13280
-
13299
+
13281
13300
 
13282
13301
 
13283
13302
 
@@ -13291,7 +13310,7 @@ class SwitchboardCall {
13291
13310
  callerIdName: plain.caller_id_name || null,
13292
13311
  callerIdNumber: plain.caller_id_number || null,
13293
13312
  participantId: plain.participantId || null,
13294
- startTime: plain.startTime,
13313
+ answerTime: plain.startTime,
13295
13314
  state: plain.state,
13296
13315
  switchboardName: plain.switchboardName,
13297
13316
  switchboardUuid: plain.switchboardUuid,
@@ -13304,7 +13323,7 @@ class SwitchboardCall {
13304
13323
  callerIdName,
13305
13324
  callerIdNumber,
13306
13325
  participantId,
13307
- startTime,
13326
+ answerTime,
13308
13327
  state,
13309
13328
  switchboardName,
13310
13329
  switchboardUuid,
@@ -13314,7 +13333,7 @@ class SwitchboardCall {
13314
13333
  this.callerIdName = callerIdName;
13315
13334
  this.callerIdNumber = callerIdNumber;
13316
13335
  this.participantId = participantId;
13317
- this.startTime = startTime;
13336
+ this.answerTime = answerTime;
13318
13337
  this.state = state;
13319
13338
  this.switchboardName = switchboardName;
13320
13339
  this.switchboardUuid = switchboardUuid;