@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
@@ -2453,12 +2453,14 @@ var authMethods = (client , baseUrl ) => ({
2453
2453
  backend ,
2454
2454
  expiration ,
2455
2455
  isMobile = false,
2456
+ tenantId ,
2456
2457
  ) => {
2457
2458
  const body = {
2458
2459
  backend: backend || DEFAULT_BACKEND_USER,
2459
2460
  expiration: expiration || DETAULT_EXPIRATION,
2460
2461
  refresh_token: refreshToken,
2461
2462
  client_id: client.clientId,
2463
+ tenant_id: tenantId,
2462
2464
  };
2463
2465
 
2464
2466
  const headers = {
@@ -4572,6 +4574,7 @@ class ApiClient {
4572
4574
 
4573
4575
 
4574
4576
 
4577
+
4575
4578
 
4576
4579
 
4577
4580
 
@@ -4612,6 +4615,7 @@ class ApiClient {
4612
4615
  logger.info('refresh token callback called', {
4613
4616
  refreshToken: this.refreshToken,
4614
4617
  refreshBackend: this.refreshBackend,
4618
+ refreshTenantId: this.refreshTenantId,
4615
4619
  refreshExpiration: this.refreshExpiration,
4616
4620
  isMobile: this.isMobile,
4617
4621
  });
@@ -4625,6 +4629,7 @@ class ApiClient {
4625
4629
  this.refreshBackend,
4626
4630
  this.refreshExpiration,
4627
4631
  this.isMobile,
4632
+ this.refreshTenantId,
4628
4633
  );
4629
4634
 
4630
4635
  logger.info('token refreshed', { token: session.token });
@@ -4666,6 +4671,10 @@ class ApiClient {
4666
4671
  this.refreshBackend = refreshBackend;
4667
4672
  }
4668
4673
 
4674
+ setRefreshTenantId(tenantId ) {
4675
+ this.refreshTenantId = tenantId;
4676
+ }
4677
+
4669
4678
  setIsMobile(isMobile ) {
4670
4679
  this.isMobile = isMobile;
4671
4680
  }
@@ -4760,7 +4769,7 @@ var getApiClient = (forServer ) => {
4760
4769
 
4761
4770
 
4762
4771
 
4763
-
4772
+
4764
4773
 
4765
4774
 
4766
4775
 
@@ -4780,7 +4789,7 @@ class AdHocAPIConference {
4780
4789
 
4781
4790
 
4782
4791
 
4783
-
4792
+
4784
4793
 
4785
4794
 
4786
4795
 
@@ -4792,7 +4801,7 @@ class AdHocAPIConference {
4792
4801
  participants,
4793
4802
  started,
4794
4803
  finished,
4795
- startTime,
4804
+ answerTime,
4796
4805
  conferenceId,
4797
4806
  muted,
4798
4807
  paused,
@@ -4802,7 +4811,7 @@ class AdHocAPIConference {
4802
4811
  this.participants = participants || {};
4803
4812
  this.started = started || false;
4804
4813
  this.finished = finished || false;
4805
- this.startTime = startTime;
4814
+ this.answerTime = answerTime;
4806
4815
  this.conferenceId = conferenceId || '';
4807
4816
  this.muted = muted || false;
4808
4817
  this.paused = paused || false;
@@ -4815,7 +4824,7 @@ class AdHocAPIConference {
4815
4824
  async start() {
4816
4825
  this.started = true;
4817
4826
  // $FlowFixMe
4818
- this.startTime = Object.values(this.participants).length ? Object.values(this.participants)[0].startTime : null;
4827
+ this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
4819
4828
 
4820
4829
  const participantIds = Object.keys(this.participants);
4821
4830
  const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
@@ -2246,12 +2246,14 @@ var authMethods = (client , baseUrl ) => ({
2246
2246
  backend ,
2247
2247
  expiration ,
2248
2248
  isMobile = false,
2249
+ tenantId ,
2249
2250
  ) => {
2250
2251
  const body = {
2251
2252
  backend: backend || DEFAULT_BACKEND_USER,
2252
2253
  expiration: expiration || DETAULT_EXPIRATION,
2253
2254
  refresh_token: refreshToken,
2254
2255
  client_id: client.clientId,
2256
+ tenant_id: tenantId,
2255
2257
  };
2256
2258
 
2257
2259
  const headers = {
@@ -4574,6 +4576,7 @@ class ApiClient {
4574
4576
 
4575
4577
 
4576
4578
 
4579
+
4577
4580
 
4578
4581
 
4579
4582
 
@@ -4614,6 +4617,7 @@ class ApiClient {
4614
4617
  logger.info('refresh token callback called', {
4615
4618
  refreshToken: this.refreshToken,
4616
4619
  refreshBackend: this.refreshBackend,
4620
+ refreshTenantId: this.refreshTenantId,
4617
4621
  refreshExpiration: this.refreshExpiration,
4618
4622
  isMobile: this.isMobile,
4619
4623
  });
@@ -4627,6 +4631,7 @@ class ApiClient {
4627
4631
  this.refreshBackend,
4628
4632
  this.refreshExpiration,
4629
4633
  this.isMobile,
4634
+ this.refreshTenantId,
4630
4635
  );
4631
4636
 
4632
4637
  logger.info('token refreshed', { token: session.token });
@@ -4668,6 +4673,10 @@ class ApiClient {
4668
4673
  this.refreshBackend = refreshBackend;
4669
4674
  }
4670
4675
 
4676
+ setRefreshTenantId(tenantId ) {
4677
+ this.refreshTenantId = tenantId;
4678
+ }
4679
+
4671
4680
  setIsMobile(isMobile ) {
4672
4681
  this.isMobile = isMobile;
4673
4682
  }
@@ -3207,12 +3207,14 @@ var authMethods = (client , baseUrl ) => ({
3207
3207
  backend ,
3208
3208
  expiration ,
3209
3209
  isMobile = false,
3210
+ tenantId ,
3210
3211
  ) => {
3211
3212
  const body = {
3212
3213
  backend: backend || DEFAULT_BACKEND_USER,
3213
3214
  expiration: expiration || DETAULT_EXPIRATION,
3214
3215
  refresh_token: refreshToken,
3215
3216
  client_id: client.clientId,
3217
+ tenant_id: tenantId,
3216
3218
  };
3217
3219
 
3218
3220
  const headers = {
@@ -4988,6 +4990,7 @@ class ApiClient {
4988
4990
 
4989
4991
 
4990
4992
 
4993
+
4991
4994
 
4992
4995
 
4993
4996
 
@@ -5028,6 +5031,7 @@ class ApiClient {
5028
5031
  logger$1.info('refresh token callback called', {
5029
5032
  refreshToken: this.refreshToken,
5030
5033
  refreshBackend: this.refreshBackend,
5034
+ refreshTenantId: this.refreshTenantId,
5031
5035
  refreshExpiration: this.refreshExpiration,
5032
5036
  isMobile: this.isMobile,
5033
5037
  });
@@ -5041,6 +5045,7 @@ class ApiClient {
5041
5045
  this.refreshBackend,
5042
5046
  this.refreshExpiration,
5043
5047
  this.isMobile,
5048
+ this.refreshTenantId,
5044
5049
  );
5045
5050
 
5046
5051
  logger$1.info('token refreshed', { token: session.token });
@@ -5082,6 +5087,10 @@ class ApiClient {
5082
5087
  this.refreshBackend = refreshBackend;
5083
5088
  }
5084
5089
 
5090
+ setRefreshTenantId(tenantId ) {
5091
+ this.refreshTenantId = tenantId;
5092
+ }
5093
+
5085
5094
  setIsMobile(isMobile ) {
5086
5095
  this.isMobile = isMobile;
5087
5096
  }
@@ -2467,7 +2467,7 @@ class WebRTCPhone extends Emitter {
2467
2467
  });
2468
2468
 
2469
2469
  this.client.on(this.client.DISCONNECTED, () => {
2470
- logger.info('WebRTC client disconnected');
2470
+ logger.warn('WebRTC client disconnected');
2471
2471
 
2472
2472
  this.eventEmitter.emit(ON_UNREGISTERED);
2473
2473
 
@@ -56,7 +56,7 @@ var updateFrom = (instance , from ) => {
56
56
 
57
57
 
58
58
 
59
-
59
+
60
60
 
61
61
 
62
62
 
@@ -82,7 +82,7 @@ class SwitchboardCall {
82
82
 
83
83
 
84
84
 
85
-
85
+
86
86
 
87
87
 
88
88
 
@@ -96,7 +96,7 @@ class SwitchboardCall {
96
96
  callerIdName: plain.caller_id_name || null,
97
97
  callerIdNumber: plain.caller_id_number || null,
98
98
  participantId: plain.participantId || null,
99
- startTime: plain.startTime,
99
+ answerTime: plain.startTime,
100
100
  state: plain.state,
101
101
  switchboardName: plain.switchboardName,
102
102
  switchboardUuid: plain.switchboardUuid,
@@ -109,7 +109,7 @@ class SwitchboardCall {
109
109
  callerIdName,
110
110
  callerIdNumber,
111
111
  participantId,
112
- startTime,
112
+ answerTime,
113
113
  state,
114
114
  switchboardName,
115
115
  switchboardUuid,
@@ -119,7 +119,7 @@ class SwitchboardCall {
119
119
  this.callerIdName = callerIdName;
120
120
  this.callerIdNumber = callerIdNumber;
121
121
  this.participantId = participantId;
122
- this.startTime = startTime;
122
+ this.answerTime = answerTime;
123
123
  this.state = state;
124
124
  this.switchboardName = switchboardName;
125
125
  this.switchboardUuid = switchboardUuid;
package/lib/index.js CHANGED
@@ -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 = {
@@ -5510,6 +5512,7 @@ class ApiClient {
5510
5512
 
5511
5513
 
5512
5514
 
5515
+
5513
5516
 
5514
5517
 
5515
5518
 
@@ -5550,6 +5553,7 @@ class ApiClient {
5550
5553
  logger$a.info('refresh token callback called', {
5551
5554
  refreshToken: this.refreshToken,
5552
5555
  refreshBackend: this.refreshBackend,
5556
+ refreshTenantId: this.refreshTenantId,
5553
5557
  refreshExpiration: this.refreshExpiration,
5554
5558
  isMobile: this.isMobile,
5555
5559
  });
@@ -5563,6 +5567,7 @@ class ApiClient {
5563
5567
  this.refreshBackend,
5564
5568
  this.refreshExpiration,
5565
5569
  this.isMobile,
5570
+ this.refreshTenantId,
5566
5571
  );
5567
5572
 
5568
5573
  logger$a.info('token refreshed', { token: session.token });
@@ -5604,6 +5609,10 @@ class ApiClient {
5604
5609
  this.refreshBackend = refreshBackend;
5605
5610
  }
5606
5611
 
5612
+ setRefreshTenantId(tenantId ) {
5613
+ this.refreshTenantId = tenantId;
5614
+ }
5615
+
5607
5616
  setIsMobile(isMobile ) {
5608
5617
  this.isMobile = isMobile;
5609
5618
  }
@@ -8277,11 +8286,14 @@ class WebRTCClient extends Emitter {
8277
8286
  }
8278
8287
 
8279
8288
  async _disconnectTransport(force = false) {
8280
- if (force) {
8289
+ if (force && this.userAgent && this.userAgent.transport) {
8281
8290
  // Bypass sip.js state machine that prevent to close WS with the state `Connecting`
8282
8291
  this.userAgent.transport.disconnectResolve = () => {};
8283
- // eslint-disable-next-line
8284
- this.userAgent.transport._ws.close(1000);
8292
+
8293
+ if (this.userAgent.transport._ws) {
8294
+ this.userAgent.transport._ws.close(1000);
8295
+ }
8296
+
8285
8297
  return;
8286
8298
  }
8287
8299
 
@@ -9213,7 +9225,7 @@ class Room$1 {
9213
9225
 
9214
9226
 
9215
9227
 
9216
-
9228
+
9217
9229
 
9218
9230
 
9219
9231
 
@@ -9239,7 +9251,7 @@ class SwitchboardCall {
9239
9251
 
9240
9252
 
9241
9253
 
9242
-
9254
+
9243
9255
 
9244
9256
 
9245
9257
 
@@ -9253,7 +9265,7 @@ class SwitchboardCall {
9253
9265
  callerIdName: plain.caller_id_name || null,
9254
9266
  callerIdNumber: plain.caller_id_number || null,
9255
9267
  participantId: plain.participantId || null,
9256
- startTime: plain.startTime,
9268
+ answerTime: plain.startTime,
9257
9269
  state: plain.state,
9258
9270
  switchboardName: plain.switchboardName,
9259
9271
  switchboardUuid: plain.switchboardUuid,
@@ -9266,7 +9278,7 @@ class SwitchboardCall {
9266
9278
  callerIdName,
9267
9279
  callerIdNumber,
9268
9280
  participantId,
9269
- startTime,
9281
+ answerTime,
9270
9282
  state,
9271
9283
  switchboardName,
9272
9284
  switchboardUuid,
@@ -9276,7 +9288,7 @@ class SwitchboardCall {
9276
9288
  this.callerIdName = callerIdName;
9277
9289
  this.callerIdNumber = callerIdNumber;
9278
9290
  this.participantId = participantId;
9279
- this.startTime = startTime;
9291
+ this.answerTime = answerTime;
9280
9292
  this.state = state;
9281
9293
  this.switchboardName = switchboardName;
9282
9294
  this.switchboardUuid = switchboardUuid;
@@ -10854,7 +10866,7 @@ class WebRTCPhone extends Emitter {
10854
10866
  });
10855
10867
 
10856
10868
  this.client.on(this.client.DISCONNECTED, () => {
10857
- logger$7.info('WebRTC client disconnected');
10869
+ logger$7.warn('WebRTC client disconnected');
10858
10870
 
10859
10871
  this.eventEmitter.emit(ON_UNREGISTERED);
10860
10872
 
@@ -11778,6 +11790,13 @@ class Auth {
11778
11790
  expiration: this.expiration,
11779
11791
  mobile: this.mobile,
11780
11792
  });
11793
+
11794
+ if (backend) {
11795
+ getApiClient().setRefreshBackend(backend);
11796
+ }
11797
+
11798
+ getApiClient().setRefreshTenantId(tenantId);
11799
+
11781
11800
  return this._onAuthenticated(rawSession);
11782
11801
  }
11783
11802
 
@@ -12004,7 +12023,7 @@ var Auth$1 = global.wazoAuthInstance;
12004
12023
 
12005
12024
 
12006
12025
 
12007
-
12026
+
12008
12027
 
12009
12028
 
12010
12029
 
@@ -12024,7 +12043,7 @@ class AdHocAPIConference {
12024
12043
 
12025
12044
 
12026
12045
 
12027
-
12046
+
12028
12047
 
12029
12048
 
12030
12049
 
@@ -12036,7 +12055,7 @@ class AdHocAPIConference {
12036
12055
  participants,
12037
12056
  started,
12038
12057
  finished,
12039
- startTime,
12058
+ answerTime,
12040
12059
  conferenceId,
12041
12060
  muted,
12042
12061
  paused,
@@ -12046,7 +12065,7 @@ class AdHocAPIConference {
12046
12065
  this.participants = participants || {};
12047
12066
  this.started = started || false;
12048
12067
  this.finished = finished || false;
12049
- this.startTime = startTime;
12068
+ this.answerTime = answerTime;
12050
12069
  this.conferenceId = conferenceId || '';
12051
12070
  this.muted = muted || false;
12052
12071
  this.paused = paused || false;
@@ -12059,7 +12078,7 @@ class AdHocAPIConference {
12059
12078
  async start() {
12060
12079
  this.started = true;
12061
12080
  // $FlowFixMe
12062
- this.startTime = Object.values(this.participants).length ? Object.values(this.participants)[0].startTime : null;
12081
+ this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
12063
12082
 
12064
12083
  const participantIds = Object.keys(this.participants);
12065
12084
  const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
@@ -2784,12 +2784,14 @@ var authMethods = (client , baseUrl ) => ({
2784
2784
  backend ,
2785
2785
  expiration ,
2786
2786
  isMobile = false,
2787
+ tenantId ,
2787
2788
  ) => {
2788
2789
  const body = {
2789
2790
  backend: backend || DEFAULT_BACKEND_USER,
2790
2791
  expiration: expiration || DETAULT_EXPIRATION,
2791
2792
  refresh_token: refreshToken,
2792
2793
  client_id: client.clientId,
2794
+ tenant_id: tenantId,
2793
2795
  };
2794
2796
 
2795
2797
  const headers = {
@@ -4572,6 +4574,7 @@ class ApiClient {
4572
4574
 
4573
4575
 
4574
4576
 
4577
+
4575
4578
 
4576
4579
 
4577
4580
 
@@ -4612,6 +4615,7 @@ class ApiClient {
4612
4615
  logger.info('refresh token callback called', {
4613
4616
  refreshToken: this.refreshToken,
4614
4617
  refreshBackend: this.refreshBackend,
4618
+ refreshTenantId: this.refreshTenantId,
4615
4619
  refreshExpiration: this.refreshExpiration,
4616
4620
  isMobile: this.isMobile,
4617
4621
  });
@@ -4625,6 +4629,7 @@ class ApiClient {
4625
4629
  this.refreshBackend,
4626
4630
  this.refreshExpiration,
4627
4631
  this.isMobile,
4632
+ this.refreshTenantId,
4628
4633
  );
4629
4634
 
4630
4635
  logger.info('token refreshed', { token: session.token });
@@ -4666,6 +4671,10 @@ class ApiClient {
4666
4671
  this.refreshBackend = refreshBackend;
4667
4672
  }
4668
4673
 
4674
+ setRefreshTenantId(tenantId ) {
4675
+ this.refreshTenantId = tenantId;
4676
+ }
4677
+
4669
4678
  setIsMobile(isMobile ) {
4670
4679
  this.isMobile = isMobile;
4671
4680
  }
@@ -2246,12 +2246,14 @@ var authMethods = (client , baseUrl ) => ({
2246
2246
  backend ,
2247
2247
  expiration ,
2248
2248
  isMobile = false,
2249
+ tenantId ,
2249
2250
  ) => {
2250
2251
  const body = {
2251
2252
  backend: backend || DEFAULT_BACKEND_USER,
2252
2253
  expiration: expiration || DETAULT_EXPIRATION,
2253
2254
  refresh_token: refreshToken,
2254
2255
  client_id: client.clientId,
2256
+ tenant_id: tenantId,
2255
2257
  };
2256
2258
 
2257
2259
  const headers = {
@@ -4574,6 +4576,7 @@ class ApiClient {
4574
4576
 
4575
4577
 
4576
4578
 
4579
+
4577
4580
 
4578
4581
 
4579
4582
 
@@ -4614,6 +4617,7 @@ class ApiClient {
4614
4617
  logger.info('refresh token callback called', {
4615
4618
  refreshToken: this.refreshToken,
4616
4619
  refreshBackend: this.refreshBackend,
4620
+ refreshTenantId: this.refreshTenantId,
4617
4621
  refreshExpiration: this.refreshExpiration,
4618
4622
  isMobile: this.isMobile,
4619
4623
  });
@@ -4627,6 +4631,7 @@ class ApiClient {
4627
4631
  this.refreshBackend,
4628
4632
  this.refreshExpiration,
4629
4633
  this.isMobile,
4634
+ this.refreshTenantId,
4630
4635
  );
4631
4636
 
4632
4637
  logger.info('token refreshed', { token: session.token });
@@ -4668,6 +4673,10 @@ class ApiClient {
4668
4673
  this.refreshBackend = refreshBackend;
4669
4674
  }
4670
4675
 
4676
+ setRefreshTenantId(tenantId ) {
4677
+ this.refreshTenantId = tenantId;
4678
+ }
4679
+
4671
4680
  setIsMobile(isMobile ) {
4672
4681
  this.isMobile = isMobile;
4673
4682
  }
@@ -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
  }
@@ -5643,7 +5652,7 @@ var getApiClient = (forServer ) => {
5643
5652
 
5644
5653
 
5645
5654
 
5646
-
5655
+
5647
5656
 
5648
5657
 
5649
5658
 
@@ -5663,7 +5672,7 @@ class AdHocAPIConference {
5663
5672
 
5664
5673
 
5665
5674
 
5666
-
5675
+
5667
5676
 
5668
5677
 
5669
5678
 
@@ -5675,7 +5684,7 @@ class AdHocAPIConference {
5675
5684
  participants,
5676
5685
  started,
5677
5686
  finished,
5678
- startTime,
5687
+ answerTime,
5679
5688
  conferenceId,
5680
5689
  muted,
5681
5690
  paused,
@@ -5685,7 +5694,7 @@ class AdHocAPIConference {
5685
5694
  this.participants = participants || {};
5686
5695
  this.started = started || false;
5687
5696
  this.finished = finished || false;
5688
- this.startTime = startTime;
5697
+ this.answerTime = answerTime;
5689
5698
  this.conferenceId = conferenceId || '';
5690
5699
  this.muted = muted || false;
5691
5700
  this.paused = paused || false;
@@ -5698,7 +5707,7 @@ class AdHocAPIConference {
5698
5707
  async start() {
5699
5708
  this.started = true;
5700
5709
  // $FlowFixMe
5701
- this.startTime = Object.values(this.participants).length ? Object.values(this.participants)[0].startTime : null;
5710
+ this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
5702
5711
 
5703
5712
  const participantIds = Object.keys(this.participants);
5704
5713
  const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
@@ -8456,11 +8465,14 @@ class WebRTCClient extends Emitter {
8456
8465
  }
8457
8466
 
8458
8467
  async _disconnectTransport(force = false) {
8459
- if (force) {
8468
+ if (force && this.userAgent && this.userAgent.transport) {
8460
8469
  // Bypass sip.js state machine that prevent to close WS with the state `Connecting`
8461
8470
  this.userAgent.transport.disconnectResolve = () => {};
8462
- // eslint-disable-next-line
8463
- this.userAgent.transport._ws.close(1000);
8471
+
8472
+ if (this.userAgent.transport._ws) {
8473
+ this.userAgent.transport._ws.close(1000);
8474
+ }
8475
+
8464
8476
  return;
8465
8477
  }
8466
8478
 
@@ -10132,7 +10144,7 @@ class WebRTCPhone extends Emitter {
10132
10144
  });
10133
10145
 
10134
10146
  this.client.on(this.client.DISCONNECTED, () => {
10135
- logger$8.info('WebRTC client disconnected');
10147
+ logger$8.warn('WebRTC client disconnected');
10136
10148
 
10137
10149
  this.eventEmitter.emit(ON_UNREGISTERED);
10138
10150
 
@@ -12992,7 +13004,7 @@ class Room {
12992
13004
 
12993
13005
 
12994
13006
 
12995
-
13007
+
12996
13008
 
12997
13009
 
12998
13010
 
@@ -13018,7 +13030,7 @@ class SwitchboardCall {
13018
13030
 
13019
13031
 
13020
13032
 
13021
-
13033
+
13022
13034
 
13023
13035
 
13024
13036
 
@@ -13032,7 +13044,7 @@ class SwitchboardCall {
13032
13044
  callerIdName: plain.caller_id_name || null,
13033
13045
  callerIdNumber: plain.caller_id_number || null,
13034
13046
  participantId: plain.participantId || null,
13035
- startTime: plain.startTime,
13047
+ answerTime: plain.startTime,
13036
13048
  state: plain.state,
13037
13049
  switchboardName: plain.switchboardName,
13038
13050
  switchboardUuid: plain.switchboardUuid,
@@ -13045,7 +13057,7 @@ class SwitchboardCall {
13045
13057
  callerIdName,
13046
13058
  callerIdNumber,
13047
13059
  participantId,
13048
- startTime,
13060
+ answerTime,
13049
13061
  state,
13050
13062
  switchboardName,
13051
13063
  switchboardUuid,
@@ -13055,7 +13067,7 @@ class SwitchboardCall {
13055
13067
  this.callerIdName = callerIdName;
13056
13068
  this.callerIdNumber = callerIdNumber;
13057
13069
  this.participantId = participantId;
13058
- this.startTime = startTime;
13070
+ this.answerTime = answerTime;
13059
13071
  this.state = state;
13060
13072
  this.switchboardName = switchboardName;
13061
13073
  this.switchboardUuid = switchboardUuid;
@@ -13776,6 +13788,13 @@ class Auth {
13776
13788
  expiration: this.expiration,
13777
13789
  mobile: this.mobile,
13778
13790
  });
13791
+
13792
+ if (backend) {
13793
+ getApiClient().setRefreshBackend(backend);
13794
+ }
13795
+
13796
+ getApiClient().setRefreshTenantId(tenantId);
13797
+
13779
13798
  return this._onAuthenticated(rawSession);
13780
13799
  }
13781
13800