@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
@@ -2294,12 +2294,14 @@ var authMethods = (client , baseUrl ) => ({
2294
2294
  backend ,
2295
2295
  expiration ,
2296
2296
  isMobile = false,
2297
+ tenantId ,
2297
2298
  ) => {
2298
2299
  const body = {
2299
2300
  backend: backend || DEFAULT_BACKEND_USER,
2300
2301
  expiration: expiration || DETAULT_EXPIRATION,
2301
2302
  refresh_token: refreshToken,
2302
2303
  client_id: client.clientId,
2304
+ tenant_id: tenantId,
2303
2305
  };
2304
2306
 
2305
2307
  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
 
@@ -12134,7 +12153,7 @@ class Room$1 {
12134
12153
 
12135
12154
 
12136
12155
 
12137
-
12156
+
12138
12157
 
12139
12158
 
12140
12159
 
@@ -12160,7 +12179,7 @@ class SwitchboardCall {
12160
12179
 
12161
12180
 
12162
12181
 
12163
-
12182
+
12164
12183
 
12165
12184
 
12166
12185
 
@@ -12174,7 +12193,7 @@ class SwitchboardCall {
12174
12193
  callerIdName: plain.caller_id_name || null,
12175
12194
  callerIdNumber: plain.caller_id_number || null,
12176
12195
  participantId: plain.participantId || null,
12177
- startTime: plain.startTime,
12196
+ answerTime: plain.startTime,
12178
12197
  state: plain.state,
12179
12198
  switchboardName: plain.switchboardName,
12180
12199
  switchboardUuid: plain.switchboardUuid,
@@ -12187,7 +12206,7 @@ class SwitchboardCall {
12187
12206
  callerIdName,
12188
12207
  callerIdNumber,
12189
12208
  participantId,
12190
- startTime,
12209
+ answerTime,
12191
12210
  state,
12192
12211
  switchboardName,
12193
12212
  switchboardUuid,
@@ -12197,7 +12216,7 @@ class SwitchboardCall {
12197
12216
  this.callerIdName = callerIdName;
12198
12217
  this.callerIdNumber = callerIdNumber;
12199
12218
  this.participantId = participantId;
12200
- this.startTime = startTime;
12219
+ this.answerTime = answerTime;
12201
12220
  this.state = state;
12202
12221
  this.switchboardName = switchboardName;
12203
12222
  this.switchboardUuid = switchboardUuid;
@@ -2294,12 +2294,14 @@ var authMethods = (client , baseUrl ) => ({
2294
2294
  backend ,
2295
2295
  expiration ,
2296
2296
  isMobile = false,
2297
+ tenantId ,
2297
2298
  ) => {
2298
2299
  const body = {
2299
2300
  backend: backend || DEFAULT_BACKEND_USER,
2300
2301
  expiration: expiration || DETAULT_EXPIRATION,
2301
2302
  refresh_token: refreshToken,
2302
2303
  client_id: client.clientId,
2304
+ tenant_id: tenantId,
2303
2305
  };
2304
2306
 
2305
2307
  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
 
@@ -12139,7 +12158,7 @@ class Room$1 {
12139
12158
 
12140
12159
 
12141
12160
 
12142
-
12161
+
12143
12162
 
12144
12163
 
12145
12164
 
@@ -12165,7 +12184,7 @@ class SwitchboardCall {
12165
12184
 
12166
12185
 
12167
12186
 
12168
-
12187
+
12169
12188
 
12170
12189
 
12171
12190
 
@@ -12179,7 +12198,7 @@ class SwitchboardCall {
12179
12198
  callerIdName: plain.caller_id_name || null,
12180
12199
  callerIdNumber: plain.caller_id_number || null,
12181
12200
  participantId: plain.participantId || null,
12182
- startTime: plain.startTime,
12201
+ answerTime: plain.startTime,
12183
12202
  state: plain.state,
12184
12203
  switchboardName: plain.switchboardName,
12185
12204
  switchboardUuid: plain.switchboardUuid,
@@ -12192,7 +12211,7 @@ class SwitchboardCall {
12192
12211
  callerIdName,
12193
12212
  callerIdNumber,
12194
12213
  participantId,
12195
- startTime,
12214
+ answerTime,
12196
12215
  state,
12197
12216
  switchboardName,
12198
12217
  switchboardUuid,
@@ -12202,7 +12221,7 @@ class SwitchboardCall {
12202
12221
  this.callerIdName = callerIdName;
12203
12222
  this.callerIdNumber = callerIdNumber;
12204
12223
  this.participantId = participantId;
12205
- this.startTime = startTime;
12224
+ this.answerTime = answerTime;
12206
12225
  this.state = state;
12207
12226
  this.switchboardName = switchboardName;
12208
12227
  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
 
@@ -12418,7 +12437,7 @@ class Room$1 {
12418
12437
 
12419
12438
 
12420
12439
 
12421
-
12440
+
12422
12441
 
12423
12442
 
12424
12443
 
@@ -12444,7 +12463,7 @@ class SwitchboardCall {
12444
12463
 
12445
12464
 
12446
12465
 
12447
-
12466
+
12448
12467
 
12449
12468
 
12450
12469
 
@@ -12458,7 +12477,7 @@ class SwitchboardCall {
12458
12477
  callerIdName: plain.caller_id_name || null,
12459
12478
  callerIdNumber: plain.caller_id_number || null,
12460
12479
  participantId: plain.participantId || null,
12461
- startTime: plain.startTime,
12480
+ answerTime: plain.startTime,
12462
12481
  state: plain.state,
12463
12482
  switchboardName: plain.switchboardName,
12464
12483
  switchboardUuid: plain.switchboardUuid,
@@ -12471,7 +12490,7 @@ class SwitchboardCall {
12471
12490
  callerIdName,
12472
12491
  callerIdNumber,
12473
12492
  participantId,
12474
- startTime,
12493
+ answerTime,
12475
12494
  state,
12476
12495
  switchboardName,
12477
12496
  switchboardUuid,
@@ -12481,7 +12500,7 @@ class SwitchboardCall {
12481
12500
  this.callerIdName = callerIdName;
12482
12501
  this.callerIdNumber = callerIdNumber;
12483
12502
  this.participantId = participantId;
12484
- this.startTime = startTime;
12503
+ this.answerTime = answerTime;
12485
12504
  this.state = state;
12486
12505
  this.switchboardName = switchboardName;
12487
12506
  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
 
@@ -12431,7 +12450,7 @@ class Room$1 {
12431
12450
 
12432
12451
 
12433
12452
 
12434
-
12453
+
12435
12454
 
12436
12455
 
12437
12456
 
@@ -12457,7 +12476,7 @@ class SwitchboardCall {
12457
12476
 
12458
12477
 
12459
12478
 
12460
-
12479
+
12461
12480
 
12462
12481
 
12463
12482
 
@@ -12471,7 +12490,7 @@ class SwitchboardCall {
12471
12490
  callerIdName: plain.caller_id_name || null,
12472
12491
  callerIdNumber: plain.caller_id_number || null,
12473
12492
  participantId: plain.participantId || null,
12474
- startTime: plain.startTime,
12493
+ answerTime: plain.startTime,
12475
12494
  state: plain.state,
12476
12495
  switchboardName: plain.switchboardName,
12477
12496
  switchboardUuid: plain.switchboardUuid,
@@ -12484,7 +12503,7 @@ class SwitchboardCall {
12484
12503
  callerIdName,
12485
12504
  callerIdNumber,
12486
12505
  participantId,
12487
- startTime,
12506
+ answerTime,
12488
12507
  state,
12489
12508
  switchboardName,
12490
12509
  switchboardUuid,
@@ -12494,7 +12513,7 @@ class SwitchboardCall {
12494
12513
  this.callerIdName = callerIdName;
12495
12514
  this.callerIdNumber = callerIdNumber;
12496
12515
  this.participantId = participantId;
12497
- this.startTime = startTime;
12516
+ this.answerTime = answerTime;
12498
12517
  this.state = state;
12499
12518
  this.switchboardName = switchboardName;
12500
12519
  this.switchboardUuid = switchboardUuid;