@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
@@ -2284,12 +2284,14 @@ var authMethods = (client , baseUrl ) => ({
2284
2284
  backend ,
2285
2285
  expiration ,
2286
2286
  isMobile = false,
2287
+ tenantId ,
2287
2288
  ) => {
2288
2289
  const body = {
2289
2290
  backend: backend || DEFAULT_BACKEND_USER,
2290
2291
  expiration: expiration || DETAULT_EXPIRATION,
2291
2292
  refresh_token: refreshToken,
2292
2293
  client_id: client.clientId,
2294
+ tenant_id: tenantId,
2293
2295
  };
2294
2296
 
2295
2297
  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
 
@@ -12124,7 +12143,7 @@ class Room$1 {
12124
12143
 
12125
12144
 
12126
12145
 
12127
-
12146
+
12128
12147
 
12129
12148
 
12130
12149
 
@@ -12150,7 +12169,7 @@ class SwitchboardCall {
12150
12169
 
12151
12170
 
12152
12171
 
12153
-
12172
+
12154
12173
 
12155
12174
 
12156
12175
 
@@ -12164,7 +12183,7 @@ class SwitchboardCall {
12164
12183
  callerIdName: plain.caller_id_name || null,
12165
12184
  callerIdNumber: plain.caller_id_number || null,
12166
12185
  participantId: plain.participantId || null,
12167
- startTime: plain.startTime,
12186
+ answerTime: plain.startTime,
12168
12187
  state: plain.state,
12169
12188
  switchboardName: plain.switchboardName,
12170
12189
  switchboardUuid: plain.switchboardUuid,
@@ -12177,7 +12196,7 @@ class SwitchboardCall {
12177
12196
  callerIdName,
12178
12197
  callerIdNumber,
12179
12198
  participantId,
12180
- startTime,
12199
+ answerTime,
12181
12200
  state,
12182
12201
  switchboardName,
12183
12202
  switchboardUuid,
@@ -12187,7 +12206,7 @@ class SwitchboardCall {
12187
12206
  this.callerIdName = callerIdName;
12188
12207
  this.callerIdNumber = callerIdNumber;
12189
12208
  this.participantId = participantId;
12190
- this.startTime = startTime;
12209
+ this.answerTime = answerTime;
12191
12210
  this.state = state;
12192
12211
  this.switchboardName = switchboardName;
12193
12212
  this.switchboardUuid = switchboardUuid;
@@ -2284,12 +2284,14 @@ var authMethods = (client , baseUrl ) => ({
2284
2284
  backend ,
2285
2285
  expiration ,
2286
2286
  isMobile = false,
2287
+ tenantId ,
2287
2288
  ) => {
2288
2289
  const body = {
2289
2290
  backend: backend || DEFAULT_BACKEND_USER,
2290
2291
  expiration: expiration || DETAULT_EXPIRATION,
2291
2292
  refresh_token: refreshToken,
2292
2293
  client_id: client.clientId,
2294
+ tenant_id: tenantId,
2293
2295
  };
2294
2296
 
2295
2297
  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
 
@@ -12129,7 +12148,7 @@ class Room$1 {
12129
12148
 
12130
12149
 
12131
12150
 
12132
-
12151
+
12133
12152
 
12134
12153
 
12135
12154
 
@@ -12155,7 +12174,7 @@ class SwitchboardCall {
12155
12174
 
12156
12175
 
12157
12176
 
12158
-
12177
+
12159
12178
 
12160
12179
 
12161
12180
 
@@ -12169,7 +12188,7 @@ class SwitchboardCall {
12169
12188
  callerIdName: plain.caller_id_name || null,
12170
12189
  callerIdNumber: plain.caller_id_number || null,
12171
12190
  participantId: plain.participantId || null,
12172
- startTime: plain.startTime,
12191
+ answerTime: plain.startTime,
12173
12192
  state: plain.state,
12174
12193
  switchboardName: plain.switchboardName,
12175
12194
  switchboardUuid: plain.switchboardUuid,
@@ -12182,7 +12201,7 @@ class SwitchboardCall {
12182
12201
  callerIdName,
12183
12202
  callerIdNumber,
12184
12203
  participantId,
12185
- startTime,
12204
+ answerTime,
12186
12205
  state,
12187
12206
  switchboardName,
12188
12207
  switchboardUuid,
@@ -12192,7 +12211,7 @@ class SwitchboardCall {
12192
12211
  this.callerIdName = callerIdName;
12193
12212
  this.callerIdNumber = callerIdNumber;
12194
12213
  this.participantId = participantId;
12195
- this.startTime = startTime;
12214
+ this.answerTime = answerTime;
12196
12215
  this.state = state;
12197
12216
  this.switchboardName = switchboardName;
12198
12217
  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
 
@@ -12408,7 +12427,7 @@ class Room$1 {
12408
12427
 
12409
12428
 
12410
12429
 
12411
-
12430
+
12412
12431
 
12413
12432
 
12414
12433
 
@@ -12434,7 +12453,7 @@ class SwitchboardCall {
12434
12453
 
12435
12454
 
12436
12455
 
12437
-
12456
+
12438
12457
 
12439
12458
 
12440
12459
 
@@ -12448,7 +12467,7 @@ class SwitchboardCall {
12448
12467
  callerIdName: plain.caller_id_name || null,
12449
12468
  callerIdNumber: plain.caller_id_number || null,
12450
12469
  participantId: plain.participantId || null,
12451
- startTime: plain.startTime,
12470
+ answerTime: plain.startTime,
12452
12471
  state: plain.state,
12453
12472
  switchboardName: plain.switchboardName,
12454
12473
  switchboardUuid: plain.switchboardUuid,
@@ -12461,7 +12480,7 @@ class SwitchboardCall {
12461
12480
  callerIdName,
12462
12481
  callerIdNumber,
12463
12482
  participantId,
12464
- startTime,
12483
+ answerTime,
12465
12484
  state,
12466
12485
  switchboardName,
12467
12486
  switchboardUuid,
@@ -12471,7 +12490,7 @@ class SwitchboardCall {
12471
12490
  this.callerIdName = callerIdName;
12472
12491
  this.callerIdNumber = callerIdNumber;
12473
12492
  this.participantId = participantId;
12474
- this.startTime = startTime;
12493
+ this.answerTime = answerTime;
12475
12494
  this.state = state;
12476
12495
  this.switchboardName = switchboardName;
12477
12496
  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
 
@@ -12419,7 +12438,7 @@ class Room$1 {
12419
12438
 
12420
12439
 
12421
12440
 
12422
-
12441
+
12423
12442
 
12424
12443
 
12425
12444
 
@@ -12445,7 +12464,7 @@ class SwitchboardCall {
12445
12464
 
12446
12465
 
12447
12466
 
12448
-
12467
+
12449
12468
 
12450
12469
 
12451
12470
 
@@ -12459,7 +12478,7 @@ class SwitchboardCall {
12459
12478
  callerIdName: plain.caller_id_name || null,
12460
12479
  callerIdNumber: plain.caller_id_number || null,
12461
12480
  participantId: plain.participantId || null,
12462
- startTime: plain.startTime,
12481
+ answerTime: plain.startTime,
12463
12482
  state: plain.state,
12464
12483
  switchboardName: plain.switchboardName,
12465
12484
  switchboardUuid: plain.switchboardUuid,
@@ -12472,7 +12491,7 @@ class SwitchboardCall {
12472
12491
  callerIdName,
12473
12492
  callerIdNumber,
12474
12493
  participantId,
12475
- startTime,
12494
+ answerTime,
12476
12495
  state,
12477
12496
  switchboardName,
12478
12497
  switchboardUuid,
@@ -12482,7 +12501,7 @@ class SwitchboardCall {
12482
12501
  this.callerIdName = callerIdName;
12483
12502
  this.callerIdNumber = callerIdNumber;
12484
12503
  this.participantId = participantId;
12485
- this.startTime = startTime;
12504
+ this.answerTime = answerTime;
12486
12505
  this.state = state;
12487
12506
  this.switchboardName = switchboardName;
12488
12507
  this.switchboardUuid = switchboardUuid;