@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
@@ -2238,12 +2238,14 @@ var authMethods = (client , baseUrl ) => ({
2238
2238
  backend ,
2239
2239
  expiration ,
2240
2240
  isMobile = false,
2241
+ tenantId ,
2241
2242
  ) => {
2242
2243
  const body = {
2243
2244
  backend: backend || DEFAULT_BACKEND_USER,
2244
2245
  expiration: expiration || DETAULT_EXPIRATION,
2245
2246
  refresh_token: refreshToken,
2246
2247
  client_id: client.clientId,
2248
+ tenant_id: tenantId,
2247
2249
  };
2248
2250
 
2249
2251
  const headers = {
@@ -4581,6 +4583,7 @@ class ApiClient {
4581
4583
 
4582
4584
 
4583
4585
 
4586
+
4584
4587
 
4585
4588
 
4586
4589
 
@@ -4621,6 +4624,7 @@ class ApiClient {
4621
4624
  logger.info('refresh token callback called', {
4622
4625
  refreshToken: this.refreshToken,
4623
4626
  refreshBackend: this.refreshBackend,
4627
+ refreshTenantId: this.refreshTenantId,
4624
4628
  refreshExpiration: this.refreshExpiration,
4625
4629
  isMobile: this.isMobile,
4626
4630
  });
@@ -4634,6 +4638,7 @@ class ApiClient {
4634
4638
  this.refreshBackend,
4635
4639
  this.refreshExpiration,
4636
4640
  this.isMobile,
4641
+ this.refreshTenantId,
4637
4642
  );
4638
4643
 
4639
4644
  logger.info('token refreshed', { token: session.token });
@@ -4675,6 +4680,10 @@ class ApiClient {
4675
4680
  this.refreshBackend = refreshBackend;
4676
4681
  }
4677
4682
 
4683
+ setRefreshTenantId(tenantId ) {
4684
+ this.refreshTenantId = tenantId;
4685
+ }
4686
+
4678
4687
  setIsMobile(isMobile ) {
4679
4688
  this.isMobile = isMobile;
4680
4689
  }
@@ -2786,12 +2786,14 @@ var authMethods = (client , baseUrl ) => ({
2786
2786
  backend ,
2787
2787
  expiration ,
2788
2788
  isMobile = false,
2789
+ tenantId ,
2789
2790
  ) => {
2790
2791
  const body = {
2791
2792
  backend: backend || DEFAULT_BACKEND_USER,
2792
2793
  expiration: expiration || DETAULT_EXPIRATION,
2793
2794
  refresh_token: refreshToken,
2794
2795
  client_id: client.clientId,
2796
+ tenant_id: tenantId,
2795
2797
  };
2796
2798
 
2797
2799
  const headers = {
@@ -5129,6 +5131,7 @@ class ApiClient {
5129
5131
 
5130
5132
 
5131
5133
 
5134
+
5132
5135
 
5133
5136
 
5134
5137
 
@@ -5169,6 +5172,7 @@ class ApiClient {
5169
5172
  logger$1.info('refresh token callback called', {
5170
5173
  refreshToken: this.refreshToken,
5171
5174
  refreshBackend: this.refreshBackend,
5175
+ refreshTenantId: this.refreshTenantId,
5172
5176
  refreshExpiration: this.refreshExpiration,
5173
5177
  isMobile: this.isMobile,
5174
5178
  });
@@ -5182,6 +5186,7 @@ class ApiClient {
5182
5186
  this.refreshBackend,
5183
5187
  this.refreshExpiration,
5184
5188
  this.isMobile,
5189
+ this.refreshTenantId,
5185
5190
  );
5186
5191
 
5187
5192
  logger$1.info('token refreshed', { token: session.token });
@@ -5223,6 +5228,10 @@ class ApiClient {
5223
5228
  this.refreshBackend = refreshBackend;
5224
5229
  }
5225
5230
 
5231
+ setRefreshTenantId(tenantId ) {
5232
+ this.refreshTenantId = tenantId;
5233
+ }
5234
+
5226
5235
  setIsMobile(isMobile ) {
5227
5236
  this.isMobile = isMobile;
5228
5237
  }
@@ -7388,11 +7397,14 @@ class WebRTCClient extends Emitter {
7388
7397
  }
7389
7398
 
7390
7399
  async _disconnectTransport(force = false) {
7391
- if (force) {
7400
+ if (force && this.userAgent && this.userAgent.transport) {
7392
7401
  // Bypass sip.js state machine that prevent to close WS with the state `Connecting`
7393
7402
  this.userAgent.transport.disconnectResolve = () => {};
7394
- // eslint-disable-next-line
7395
- this.userAgent.transport._ws.close(1000);
7403
+
7404
+ if (this.userAgent.transport._ws) {
7405
+ this.userAgent.transport._ws.close(1000);
7406
+ }
7407
+
7396
7408
  return;
7397
7409
  }
7398
7410
 
package/esm/api/auth.js CHANGED
@@ -996,12 +996,14 @@ var auth = (client , baseUrl ) => ({
996
996
  backend ,
997
997
  expiration ,
998
998
  isMobile = false,
999
+ tenantId ,
999
1000
  ) => {
1000
1001
  const body = {
1001
1002
  backend: backend || DEFAULT_BACKEND_USER,
1002
1003
  expiration: expiration || DETAULT_EXPIRATION,
1003
1004
  refresh_token: refreshToken,
1004
1005
  client_id: client.clientId,
1006
+ tenant_id: tenantId,
1005
1007
  };
1006
1008
 
1007
1009
  const headers = {
package/esm/api-client.js CHANGED
@@ -2238,12 +2238,14 @@ var authMethods = (client , baseUrl ) => ({
2238
2238
  backend ,
2239
2239
  expiration ,
2240
2240
  isMobile = false,
2241
+ tenantId ,
2241
2242
  ) => {
2242
2243
  const body = {
2243
2244
  backend: backend || DEFAULT_BACKEND_USER,
2244
2245
  expiration: expiration || DETAULT_EXPIRATION,
2245
2246
  refresh_token: refreshToken,
2246
2247
  client_id: client.clientId,
2248
+ tenant_id: tenantId,
2247
2249
  };
2248
2250
 
2249
2251
  const headers = {
@@ -4581,6 +4583,7 @@ class ApiClient {
4581
4583
 
4582
4584
 
4583
4585
 
4586
+
4584
4587
 
4585
4588
 
4586
4589
 
@@ -4621,6 +4624,7 @@ class ApiClient {
4621
4624
  logger.info('refresh token callback called', {
4622
4625
  refreshToken: this.refreshToken,
4623
4626
  refreshBackend: this.refreshBackend,
4627
+ refreshTenantId: this.refreshTenantId,
4624
4628
  refreshExpiration: this.refreshExpiration,
4625
4629
  isMobile: this.isMobile,
4626
4630
  });
@@ -4634,6 +4638,7 @@ class ApiClient {
4634
4638
  this.refreshBackend,
4635
4639
  this.refreshExpiration,
4636
4640
  this.isMobile,
4641
+ this.refreshTenantId,
4637
4642
  );
4638
4643
 
4639
4644
  logger.info('token refreshed', { token: session.token });
@@ -4675,6 +4680,10 @@ class ApiClient {
4675
4680
  this.refreshBackend = refreshBackend;
4676
4681
  }
4677
4682
 
4683
+ setRefreshTenantId(tenantId ) {
4684
+ this.refreshTenantId = tenantId;
4685
+ }
4686
+
4678
4687
  setIsMobile(isMobile ) {
4679
4688
  this.isMobile = isMobile;
4680
4689
  }
@@ -2256,12 +2256,14 @@ var authMethods = (client , baseUrl ) => ({
2256
2256
  backend ,
2257
2257
  expiration ,
2258
2258
  isMobile = false,
2259
+ tenantId ,
2259
2260
  ) => {
2260
2261
  const body = {
2261
2262
  backend: backend || DEFAULT_BACKEND_USER,
2262
2263
  expiration: expiration || DETAULT_EXPIRATION,
2263
2264
  refresh_token: refreshToken,
2264
2265
  client_id: client.clientId,
2266
+ tenant_id: tenantId,
2265
2267
  };
2266
2268
 
2267
2269
  const headers = {
@@ -4625,6 +4627,7 @@ class ApiClient {
4625
4627
 
4626
4628
 
4627
4629
 
4630
+
4628
4631
 
4629
4632
 
4630
4633
 
@@ -4665,6 +4668,7 @@ class ApiClient {
4665
4668
  logger$3.info('refresh token callback called', {
4666
4669
  refreshToken: this.refreshToken,
4667
4670
  refreshBackend: this.refreshBackend,
4671
+ refreshTenantId: this.refreshTenantId,
4668
4672
  refreshExpiration: this.refreshExpiration,
4669
4673
  isMobile: this.isMobile,
4670
4674
  });
@@ -4678,6 +4682,7 @@ class ApiClient {
4678
4682
  this.refreshBackend,
4679
4683
  this.refreshExpiration,
4680
4684
  this.isMobile,
4685
+ this.refreshTenantId,
4681
4686
  );
4682
4687
 
4683
4688
  logger$3.info('token refreshed', { token: session.token });
@@ -4719,6 +4724,10 @@ class ApiClient {
4719
4724
  this.refreshBackend = refreshBackend;
4720
4725
  }
4721
4726
 
4727
+ setRefreshTenantId(tenantId ) {
4728
+ this.refreshTenantId = tenantId;
4729
+ }
4730
+
4722
4731
  setIsMobile(isMobile ) {
4723
4732
  this.isMobile = isMobile;
4724
4733
  }
@@ -7973,11 +7982,14 @@ class WebRTCClient extends Emitter {
7973
7982
  }
7974
7983
 
7975
7984
  async _disconnectTransport(force = false) {
7976
- if (force) {
7985
+ if (force && this.userAgent && this.userAgent.transport) {
7977
7986
  // Bypass sip.js state machine that prevent to close WS with the state `Connecting`
7978
7987
  this.userAgent.transport.disconnectResolve = () => {};
7979
- // eslint-disable-next-line
7980
- this.userAgent.transport._ws.close(1000);
7988
+
7989
+ if (this.userAgent.transport._ws) {
7990
+ this.userAgent.transport._ws.close(1000);
7991
+ }
7992
+
7981
7993
  return;
7982
7994
  }
7983
7995
 
@@ -2238,12 +2238,14 @@ var authMethods = (client , baseUrl ) => ({
2238
2238
  backend ,
2239
2239
  expiration ,
2240
2240
  isMobile = false,
2241
+ tenantId ,
2241
2242
  ) => {
2242
2243
  const body = {
2243
2244
  backend: backend || DEFAULT_BACKEND_USER,
2244
2245
  expiration: expiration || DETAULT_EXPIRATION,
2245
2246
  refresh_token: refreshToken,
2246
2247
  client_id: client.clientId,
2248
+ tenant_id: tenantId,
2247
2249
  };
2248
2250
 
2249
2251
  const headers = {
@@ -4581,6 +4583,7 @@ class ApiClient {
4581
4583
 
4582
4584
 
4583
4585
 
4586
+
4584
4587
 
4585
4588
 
4586
4589
 
@@ -4621,6 +4624,7 @@ class ApiClient {
4621
4624
  logger.info('refresh token callback called', {
4622
4625
  refreshToken: this.refreshToken,
4623
4626
  refreshBackend: this.refreshBackend,
4627
+ refreshTenantId: this.refreshTenantId,
4624
4628
  refreshExpiration: this.refreshExpiration,
4625
4629
  isMobile: this.isMobile,
4626
4630
  });
@@ -4634,6 +4638,7 @@ class ApiClient {
4634
4638
  this.refreshBackend,
4635
4639
  this.refreshExpiration,
4636
4640
  this.isMobile,
4641
+ this.refreshTenantId,
4637
4642
  );
4638
4643
 
4639
4644
  logger.info('token refreshed', { token: session.token });
@@ -4675,6 +4680,10 @@ class ApiClient {
4675
4680
  this.refreshBackend = refreshBackend;
4676
4681
  }
4677
4682
 
4683
+ setRefreshTenantId(tenantId ) {
4684
+ this.refreshTenantId = tenantId;
4685
+ }
4686
+
4678
4687
  setIsMobile(isMobile ) {
4679
4688
  this.isMobile = isMobile;
4680
4689
  }
@@ -2238,12 +2238,14 @@ var authMethods = (client , baseUrl ) => ({
2238
2238
  backend ,
2239
2239
  expiration ,
2240
2240
  isMobile = false,
2241
+ tenantId ,
2241
2242
  ) => {
2242
2243
  const body = {
2243
2244
  backend: backend || DEFAULT_BACKEND_USER,
2244
2245
  expiration: expiration || DETAULT_EXPIRATION,
2245
2246
  refresh_token: refreshToken,
2246
2247
  client_id: client.clientId,
2248
+ tenant_id: tenantId,
2247
2249
  };
2248
2250
 
2249
2251
  const headers = {
@@ -4581,6 +4583,7 @@ class ApiClient {
4581
4583
 
4582
4584
 
4583
4585
 
4586
+
4584
4587
 
4585
4588
 
4586
4589
 
@@ -4621,6 +4624,7 @@ class ApiClient {
4621
4624
  logger.info('refresh token callback called', {
4622
4625
  refreshToken: this.refreshToken,
4623
4626
  refreshBackend: this.refreshBackend,
4627
+ refreshTenantId: this.refreshTenantId,
4624
4628
  refreshExpiration: this.refreshExpiration,
4625
4629
  isMobile: this.isMobile,
4626
4630
  });
@@ -4634,6 +4638,7 @@ class ApiClient {
4634
4638
  this.refreshBackend,
4635
4639
  this.refreshExpiration,
4636
4640
  this.isMobile,
4641
+ this.refreshTenantId,
4637
4642
  );
4638
4643
 
4639
4644
  logger.info('token refreshed', { token: session.token });
@@ -4675,6 +4680,10 @@ class ApiClient {
4675
4680
  this.refreshBackend = refreshBackend;
4676
4681
  }
4677
4682
 
4683
+ setRefreshTenantId(tenantId ) {
4684
+ this.refreshTenantId = tenantId;
4685
+ }
4686
+
4678
4687
  setIsMobile(isMobile ) {
4679
4688
  this.isMobile = isMobile;
4680
4689
  }
@@ -2256,12 +2256,14 @@ var authMethods = (client , baseUrl ) => ({
2256
2256
  backend ,
2257
2257
  expiration ,
2258
2258
  isMobile = false,
2259
+ tenantId ,
2259
2260
  ) => {
2260
2261
  const body = {
2261
2262
  backend: backend || DEFAULT_BACKEND_USER,
2262
2263
  expiration: expiration || DETAULT_EXPIRATION,
2263
2264
  refresh_token: refreshToken,
2264
2265
  client_id: client.clientId,
2266
+ tenant_id: tenantId,
2265
2267
  };
2266
2268
 
2267
2269
  const headers = {
@@ -4625,6 +4627,7 @@ class ApiClient {
4625
4627
 
4626
4628
 
4627
4629
 
4630
+
4628
4631
 
4629
4632
 
4630
4633
 
@@ -4665,6 +4668,7 @@ class ApiClient {
4665
4668
  logger$2.info('refresh token callback called', {
4666
4669
  refreshToken: this.refreshToken,
4667
4670
  refreshBackend: this.refreshBackend,
4671
+ refreshTenantId: this.refreshTenantId,
4668
4672
  refreshExpiration: this.refreshExpiration,
4669
4673
  isMobile: this.isMobile,
4670
4674
  });
@@ -4678,6 +4682,7 @@ class ApiClient {
4678
4682
  this.refreshBackend,
4679
4683
  this.refreshExpiration,
4680
4684
  this.isMobile,
4685
+ this.refreshTenantId,
4681
4686
  );
4682
4687
 
4683
4688
  logger$2.info('token refreshed', { token: session.token });
@@ -4719,6 +4724,10 @@ class ApiClient {
4719
4724
  this.refreshBackend = refreshBackend;
4720
4725
  }
4721
4726
 
4727
+ setRefreshTenantId(tenantId ) {
4728
+ this.refreshTenantId = tenantId;
4729
+ }
4730
+
4722
4731
  setIsMobile(isMobile ) {
4723
4732
  this.isMobile = isMobile;
4724
4733
  }
@@ -7973,11 +7982,14 @@ class WebRTCClient extends Emitter {
7973
7982
  }
7974
7983
 
7975
7984
  async _disconnectTransport(force = false) {
7976
- if (force) {
7985
+ if (force && this.userAgent && this.userAgent.transport) {
7977
7986
  // Bypass sip.js state machine that prevent to close WS with the state `Connecting`
7978
7987
  this.userAgent.transport.disconnectResolve = () => {};
7979
- // eslint-disable-next-line
7980
- this.userAgent.transport._ws.close(1000);
7988
+
7989
+ if (this.userAgent.transport._ws) {
7990
+ this.userAgent.transport._ws.close(1000);
7991
+ }
7992
+
7981
7993
  return;
7982
7994
  }
7983
7995
 
@@ -2786,12 +2786,14 @@ var authMethods = (client , baseUrl ) => ({
2786
2786
  backend ,
2787
2787
  expiration ,
2788
2788
  isMobile = false,
2789
+ tenantId ,
2789
2790
  ) => {
2790
2791
  const body = {
2791
2792
  backend: backend || DEFAULT_BACKEND_USER,
2792
2793
  expiration: expiration || DETAULT_EXPIRATION,
2793
2794
  refresh_token: refreshToken,
2794
2795
  client_id: client.clientId,
2796
+ tenant_id: tenantId,
2795
2797
  };
2796
2798
 
2797
2799
  const headers = {
@@ -5129,6 +5131,7 @@ class ApiClient {
5129
5131
 
5130
5132
 
5131
5133
 
5134
+
5132
5135
 
5133
5136
 
5134
5137
 
@@ -5169,6 +5172,7 @@ class ApiClient {
5169
5172
  logger$1.info('refresh token callback called', {
5170
5173
  refreshToken: this.refreshToken,
5171
5174
  refreshBackend: this.refreshBackend,
5175
+ refreshTenantId: this.refreshTenantId,
5172
5176
  refreshExpiration: this.refreshExpiration,
5173
5177
  isMobile: this.isMobile,
5174
5178
  });
@@ -5182,6 +5186,7 @@ class ApiClient {
5182
5186
  this.refreshBackend,
5183
5187
  this.refreshExpiration,
5184
5188
  this.isMobile,
5189
+ this.refreshTenantId,
5185
5190
  );
5186
5191
 
5187
5192
  logger$1.info('token refreshed', { token: session.token });
@@ -5223,6 +5228,10 @@ class ApiClient {
5223
5228
  this.refreshBackend = refreshBackend;
5224
5229
  }
5225
5230
 
5231
+ setRefreshTenantId(tenantId ) {
5232
+ this.refreshTenantId = tenantId;
5233
+ }
5234
+
5226
5235
  setIsMobile(isMobile ) {
5227
5236
  this.isMobile = isMobile;
5228
5237
  }
@@ -7388,11 +7397,14 @@ class WebRTCClient extends Emitter {
7388
7397
  }
7389
7398
 
7390
7399
  async _disconnectTransport(force = false) {
7391
- if (force) {
7400
+ if (force && this.userAgent && this.userAgent.transport) {
7392
7401
  // Bypass sip.js state machine that prevent to close WS with the state `Connecting`
7393
7402
  this.userAgent.transport.disconnectResolve = () => {};
7394
- // eslint-disable-next-line
7395
- this.userAgent.transport._ws.close(1000);
7403
+
7404
+ if (this.userAgent.transport._ws) {
7405
+ this.userAgent.transport._ws.close(1000);
7406
+ }
7407
+
7396
7408
  return;
7397
7409
  }
7398
7410
 
@@ -2786,12 +2786,14 @@ var authMethods = (client , baseUrl ) => ({
2786
2786
  backend ,
2787
2787
  expiration ,
2788
2788
  isMobile = false,
2789
+ tenantId ,
2789
2790
  ) => {
2790
2791
  const body = {
2791
2792
  backend: backend || DEFAULT_BACKEND_USER,
2792
2793
  expiration: expiration || DETAULT_EXPIRATION,
2793
2794
  refresh_token: refreshToken,
2794
2795
  client_id: client.clientId,
2796
+ tenant_id: tenantId,
2795
2797
  };
2796
2798
 
2797
2799
  const headers = {
@@ -5129,6 +5131,7 @@ class ApiClient {
5129
5131
 
5130
5132
 
5131
5133
 
5134
+
5132
5135
 
5133
5136
 
5134
5137
 
@@ -5169,6 +5172,7 @@ class ApiClient {
5169
5172
  logger$1.info('refresh token callback called', {
5170
5173
  refreshToken: this.refreshToken,
5171
5174
  refreshBackend: this.refreshBackend,
5175
+ refreshTenantId: this.refreshTenantId,
5172
5176
  refreshExpiration: this.refreshExpiration,
5173
5177
  isMobile: this.isMobile,
5174
5178
  });
@@ -5182,6 +5186,7 @@ class ApiClient {
5182
5186
  this.refreshBackend,
5183
5187
  this.refreshExpiration,
5184
5188
  this.isMobile,
5189
+ this.refreshTenantId,
5185
5190
  );
5186
5191
 
5187
5192
  logger$1.info('token refreshed', { token: session.token });
@@ -5223,6 +5228,10 @@ class ApiClient {
5223
5228
  this.refreshBackend = refreshBackend;
5224
5229
  }
5225
5230
 
5231
+ setRefreshTenantId(tenantId ) {
5232
+ this.refreshTenantId = tenantId;
5233
+ }
5234
+
5226
5235
  setIsMobile(isMobile ) {
5227
5236
  this.isMobile = isMobile;
5228
5237
  }
@@ -7388,11 +7397,14 @@ class WebRTCClient extends Emitter {
7388
7397
  }
7389
7398
 
7390
7399
  async _disconnectTransport(force = false) {
7391
- if (force) {
7400
+ if (force && this.userAgent && this.userAgent.transport) {
7392
7401
  // Bypass sip.js state machine that prevent to close WS with the state `Connecting`
7393
7402
  this.userAgent.transport.disconnectResolve = () => {};
7394
- // eslint-disable-next-line
7395
- this.userAgent.transport._ws.close(1000);
7403
+
7404
+ if (this.userAgent.transport._ws) {
7405
+ this.userAgent.transport._ws.close(1000);
7406
+ }
7407
+
7396
7408
  return;
7397
7409
  }
7398
7410
 
@@ -2447,12 +2447,14 @@ var authMethods = (client , baseUrl ) => ({
2447
2447
  backend ,
2448
2448
  expiration ,
2449
2449
  isMobile = false,
2450
+ tenantId ,
2450
2451
  ) => {
2451
2452
  const body = {
2452
2453
  backend: backend || DEFAULT_BACKEND_USER,
2453
2454
  expiration: expiration || DETAULT_EXPIRATION,
2454
2455
  refresh_token: refreshToken,
2455
2456
  client_id: client.clientId,
2457
+ tenant_id: tenantId,
2456
2458
  };
2457
2459
 
2458
2460
  const headers = {
@@ -4566,6 +4568,7 @@ class ApiClient {
4566
4568
 
4567
4569
 
4568
4570
 
4571
+
4569
4572
 
4570
4573
 
4571
4574
 
@@ -4606,6 +4609,7 @@ class ApiClient {
4606
4609
  logger.info('refresh token callback called', {
4607
4610
  refreshToken: this.refreshToken,
4608
4611
  refreshBackend: this.refreshBackend,
4612
+ refreshTenantId: this.refreshTenantId,
4609
4613
  refreshExpiration: this.refreshExpiration,
4610
4614
  isMobile: this.isMobile,
4611
4615
  });
@@ -4619,6 +4623,7 @@ class ApiClient {
4619
4623
  this.refreshBackend,
4620
4624
  this.refreshExpiration,
4621
4625
  this.isMobile,
4626
+ this.refreshTenantId,
4622
4627
  );
4623
4628
 
4624
4629
  logger.info('token refreshed', { token: session.token });
@@ -4660,6 +4665,10 @@ class ApiClient {
4660
4665
  this.refreshBackend = refreshBackend;
4661
4666
  }
4662
4667
 
4668
+ setRefreshTenantId(tenantId ) {
4669
+ this.refreshTenantId = tenantId;
4670
+ }
4671
+
4663
4672
  setIsMobile(isMobile ) {
4664
4673
  this.isMobile = isMobile;
4665
4674
  }
@@ -4754,7 +4763,7 @@ var getApiClient = (forServer ) => {
4754
4763
 
4755
4764
 
4756
4765
 
4757
-
4766
+
4758
4767
 
4759
4768
 
4760
4769
 
@@ -4774,7 +4783,7 @@ class AdHocAPIConference {
4774
4783
 
4775
4784
 
4776
4785
 
4777
-
4786
+
4778
4787
 
4779
4788
 
4780
4789
 
@@ -4786,7 +4795,7 @@ class AdHocAPIConference {
4786
4795
  participants,
4787
4796
  started,
4788
4797
  finished,
4789
- startTime,
4798
+ answerTime,
4790
4799
  conferenceId,
4791
4800
  muted,
4792
4801
  paused,
@@ -4796,7 +4805,7 @@ class AdHocAPIConference {
4796
4805
  this.participants = participants || {};
4797
4806
  this.started = started || false;
4798
4807
  this.finished = finished || false;
4799
- this.startTime = startTime;
4808
+ this.answerTime = answerTime;
4800
4809
  this.conferenceId = conferenceId || '';
4801
4810
  this.muted = muted || false;
4802
4811
  this.paused = paused || false;
@@ -4809,7 +4818,7 @@ class AdHocAPIConference {
4809
4818
  async start() {
4810
4819
  this.started = true;
4811
4820
  // $FlowFixMe
4812
- this.startTime = Object.values(this.participants).length ? Object.values(this.participants)[0].startTime : null;
4821
+ this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
4813
4822
 
4814
4823
  const participantIds = Object.keys(this.participants);
4815
4824
  const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
@@ -2238,12 +2238,14 @@ var authMethods = (client , baseUrl ) => ({
2238
2238
  backend ,
2239
2239
  expiration ,
2240
2240
  isMobile = false,
2241
+ tenantId ,
2241
2242
  ) => {
2242
2243
  const body = {
2243
2244
  backend: backend || DEFAULT_BACKEND_USER,
2244
2245
  expiration: expiration || DETAULT_EXPIRATION,
2245
2246
  refresh_token: refreshToken,
2246
2247
  client_id: client.clientId,
2248
+ tenant_id: tenantId,
2247
2249
  };
2248
2250
 
2249
2251
  const headers = {
@@ -4566,6 +4568,7 @@ class ApiClient {
4566
4568
 
4567
4569
 
4568
4570
 
4571
+
4569
4572
 
4570
4573
 
4571
4574
 
@@ -4606,6 +4609,7 @@ class ApiClient {
4606
4609
  logger.info('refresh token callback called', {
4607
4610
  refreshToken: this.refreshToken,
4608
4611
  refreshBackend: this.refreshBackend,
4612
+ refreshTenantId: this.refreshTenantId,
4609
4613
  refreshExpiration: this.refreshExpiration,
4610
4614
  isMobile: this.isMobile,
4611
4615
  });
@@ -4619,6 +4623,7 @@ class ApiClient {
4619
4623
  this.refreshBackend,
4620
4624
  this.refreshExpiration,
4621
4625
  this.isMobile,
4626
+ this.refreshTenantId,
4622
4627
  );
4623
4628
 
4624
4629
  logger.info('token refreshed', { token: session.token });
@@ -4660,6 +4665,10 @@ class ApiClient {
4660
4665
  this.refreshBackend = refreshBackend;
4661
4666
  }
4662
4667
 
4668
+ setRefreshTenantId(tenantId ) {
4669
+ this.refreshTenantId = tenantId;
4670
+ }
4671
+
4663
4672
  setIsMobile(isMobile ) {
4664
4673
  this.isMobile = isMobile;
4665
4674
  }