@wazo/sdk 0.37.31 → 0.37.35

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 (90) hide show
  1. package/dist/wazo-sdk.js +2 -2
  2. package/esm/__tests__/api-client.test.js +41 -0
  3. package/esm/__tests__/web-rtc-client.test.js +68 -6
  4. package/esm/api/auth.js +5 -0
  5. package/esm/api/call-logd.js +6 -0
  6. package/esm/api/calld.js +30 -0
  7. package/esm/api-client.js +41 -0
  8. package/esm/checker/Checker.js +68 -6
  9. package/esm/checker/checks/aor.js +41 -0
  10. package/esm/checker/checks/api.js +41 -0
  11. package/esm/checker/checks/index.js +68 -6
  12. package/esm/checker/checks/webrtc-transport.js +68 -6
  13. package/esm/checker/checks/webrtc.js +68 -6
  14. package/esm/domain/AdHocAPIConference.js +41 -0
  15. package/esm/domain/CallLog.js +6 -0
  16. package/esm/domain/CallSession.js +8 -0
  17. package/esm/domain/Features.js +41 -0
  18. package/esm/domain/MeetingStatus.js +29 -0
  19. package/esm/domain/Phone/CTIPhone.js +49 -0
  20. package/esm/domain/Phone/WebRTCPhone.js +33 -6
  21. package/esm/domain/__tests__/CallLog.test.js +6 -0
  22. package/esm/domain/__tests__/CallSession.test.js +40 -4
  23. package/esm/domain/__tests__/IndirectTransfer.test.js +8 -0
  24. package/esm/domain/__tests__/Room.test.js +8 -0
  25. package/esm/index.js +101 -12
  26. package/esm/service/CallApi.js +41 -0
  27. package/esm/service/getApiClient.js +41 -0
  28. package/esm/simple/Auth.js +101 -12
  29. package/esm/simple/Configuration.js +101 -12
  30. package/esm/simple/Directory.js +41 -0
  31. package/esm/simple/Phone.js +101 -12
  32. package/esm/simple/index.js +101 -12
  33. package/esm/simple/room/LocalParticipant.js +101 -12
  34. package/esm/simple/room/Participant.js +101 -12
  35. package/esm/simple/room/RemoteParticipant.js +101 -12
  36. package/esm/simple/room/Room.js +101 -12
  37. package/esm/simple/room/SipRoom.js +101 -12
  38. package/esm/simple/room/Stream.js +101 -12
  39. package/esm/simple/room/__tests__/RemoteParticipant.test.js +101 -12
  40. package/esm/simple/utils.js +101 -12
  41. package/esm/web-rtc-client.js +68 -6
  42. package/lib/__tests__/api-client.test.js +41 -0
  43. package/lib/__tests__/web-rtc-client.test.js +68 -6
  44. package/lib/api/auth.js +5 -0
  45. package/lib/api/call-logd.js +6 -0
  46. package/lib/api/calld.js +30 -0
  47. package/lib/api-client.js +41 -0
  48. package/lib/checker/Checker.js +68 -6
  49. package/lib/checker/checks/aor.js +41 -0
  50. package/lib/checker/checks/api.js +41 -0
  51. package/lib/checker/checks/index.js +68 -6
  52. package/lib/checker/checks/webrtc-transport.js +68 -6
  53. package/lib/checker/checks/webrtc.js +68 -6
  54. package/lib/domain/AdHocAPIConference.js +41 -0
  55. package/lib/domain/CallLog.js +6 -0
  56. package/lib/domain/CallSession.js +8 -0
  57. package/lib/domain/Features.js +41 -0
  58. package/lib/domain/MeetingStatus.js +31 -0
  59. package/lib/domain/Phone/CTIPhone.js +49 -0
  60. package/lib/domain/Phone/WebRTCPhone.js +33 -6
  61. package/lib/domain/__tests__/CallLog.test.js +6 -0
  62. package/lib/domain/__tests__/CallSession.test.js +40 -4
  63. package/lib/domain/__tests__/IndirectTransfer.test.js +8 -0
  64. package/lib/domain/__tests__/Room.test.js +8 -0
  65. package/lib/index.js +101 -12
  66. package/lib/service/CallApi.js +41 -0
  67. package/lib/service/getApiClient.js +41 -0
  68. package/lib/simple/Auth.js +101 -12
  69. package/lib/simple/Configuration.js +101 -12
  70. package/lib/simple/Directory.js +41 -0
  71. package/lib/simple/Phone.js +101 -12
  72. package/lib/simple/index.js +101 -12
  73. package/lib/simple/room/LocalParticipant.js +101 -12
  74. package/lib/simple/room/Participant.js +101 -12
  75. package/lib/simple/room/RemoteParticipant.js +101 -12
  76. package/lib/simple/room/Room.js +101 -12
  77. package/lib/simple/room/SipRoom.js +101 -12
  78. package/lib/simple/room/Stream.js +101 -12
  79. package/lib/simple/room/__tests__/RemoteParticipant.test.js +101 -12
  80. package/lib/simple/utils.js +101 -12
  81. package/lib/web-rtc-client.js +68 -6
  82. package/package.json +1 -1
  83. package/src/api/auth.js +5 -0
  84. package/src/api/calld.js +3 -0
  85. package/src/domain/CallLog.js +6 -0
  86. package/src/domain/CallSession.js +8 -0
  87. package/src/domain/MeetingStatus.js +27 -0
  88. package/src/domain/Phone/WebRTCPhone.js +25 -6
  89. package/src/domain/__tests__/CallSession.test.js +32 -4
  90. package/src/web-rtc-client.js +27 -6
@@ -2754,6 +2754,7 @@ var authMethods = (client , baseUrl ) => ({
2754
2754
 
2755
2755
 
2756
2756
 
2757
+
2757
2758
  ) {
2758
2759
  const body = {
2759
2760
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2773,6 +2774,10 @@ var authMethods = (client , baseUrl ) => ({
2773
2774
  headers['Wazo-Session-Type'] = 'mobile';
2774
2775
  }
2775
2776
 
2777
+ if (params.tenantId) {
2778
+ body.tenant_id = params.tenantId;
2779
+ }
2780
+
2776
2781
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2777
2782
  },
2778
2783
 
@@ -3841,11 +3846,13 @@ class Recording {
3841
3846
 
3842
3847
 
3843
3848
 
3849
+
3844
3850
 
3845
3851
 
3846
3852
 
3847
3853
 
3848
3854
 
3855
+
3849
3856
 
3850
3857
 
3851
3858
 
@@ -3866,10 +3873,12 @@ class Recording {
3866
3873
 
3867
3874
 
3868
3875
 
3876
+
3869
3877
 
3870
3878
 
3871
3879
 
3872
3880
 
3881
+
3873
3882
 
3874
3883
 
3875
3884
 
@@ -3931,10 +3940,12 @@ class CallLog {
3931
3940
  || plain.destination_extension
3932
3941
  || `meeting-${plain.requested_name || plain.destination_name || ''}`,
3933
3942
  name: plain.requested_name || plain.destination_name || '',
3943
+ uuid: plain.destination_user_uuid,
3934
3944
  },
3935
3945
  source: {
3936
3946
  extension: plain.source_extension,
3937
3947
  name: plain.source_name,
3948
+ uuid: plain.source_user_uuid,
3938
3949
  },
3939
3950
  id: plain.id,
3940
3951
  duration: (plain.duration || 0) * 1000, // duration is in seconds
@@ -4588,6 +4599,34 @@ var chatdMethods = (client , baseUrl ) => ({
4588
4599
  client.get(`${baseUrl}/users/me/rooms/messages`, options),
4589
4600
  });
4590
4601
 
4602
+ //
4603
+
4604
+
4605
+
4606
+
4607
+
4608
+ class MeetingStatus {
4609
+
4610
+
4611
+
4612
+
4613
+ constructor({
4614
+ full,
4615
+ } = {}) {
4616
+ this.full = full;
4617
+
4618
+ // Useful to compare instead of instanceof with minified code
4619
+ this.type = 'MeetingStatus';
4620
+ }
4621
+
4622
+ static parse(plain ) {
4623
+ return new MeetingStatus({
4624
+ full: plain.full,
4625
+ });
4626
+ }
4627
+
4628
+ }
4629
+
4591
4630
  /* */
4592
4631
 
4593
4632
 
@@ -4782,6 +4821,8 @@ var calldMethods = (client , baseUrl ) => ({
4782
4821
  client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
4783
4822
  ApiRequester.successResponseParser),
4784
4823
 
4824
+ guestGetMeetingStatus: (meetingUuid ) =>
4825
+ client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
4785
4826
  });
4786
4827
 
4787
4828
  //
@@ -5341,7 +5382,7 @@ const ON_NETWORK_STATS = 'onNetworkStats';
5341
5382
  const ON_DISCONNECTED = 'onDisconnected';
5342
5383
  class CanceledCallError extends Error {}
5343
5384
 
5344
- const MAX_REGISTER_TRIES = 10;
5385
+ const MAX_REGISTER_TRIES = 5;
5345
5386
 
5346
5387
 
5347
5388
 
@@ -5395,6 +5436,7 @@ class WebRTCClient extends Emitter {
5395
5436
 
5396
5437
 
5397
5438
 
5439
+
5398
5440
 
5399
5441
  // sugar
5400
5442
 
@@ -5457,6 +5499,7 @@ class WebRTCClient extends Emitter {
5457
5499
  this.conferences = {};
5458
5500
  this.networkMonitoringInterval = {};
5459
5501
  this.sessionNetworkStats = {};
5502
+ this.forceClosed = false;
5460
5503
 
5461
5504
  this._boundOnHeartbeat = this._onHeartbeat.bind(this);
5462
5505
  this.heartbeat = new Heartbeat(config.heartbeatDelay, config.heartbeatTimeout, config.maxHeartbeats);
@@ -5578,6 +5621,8 @@ class WebRTCClient extends Emitter {
5578
5621
  skipRegister: this.skipRegister,
5579
5622
  };
5580
5623
 
5624
+ this.forceClosed = false;
5625
+
5581
5626
  if (this.skipRegister) {
5582
5627
  logger.info('sdk webrtc skip register...', logInfo);
5583
5628
  return Promise.resolve();
@@ -5602,7 +5647,15 @@ class WebRTCClient extends Emitter {
5602
5647
  const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
5603
5648
 
5604
5649
  const onRegisterFailed = () => {
5605
- logger.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
5650
+ logger.info('sdk webrtc registering failed', {
5651
+ tries,
5652
+ registerer: !!this.registerer,
5653
+ forceClosed: this.forceClosed,
5654
+ });
5655
+ if (this.forceClosed) {
5656
+ return;
5657
+ }
5658
+
5606
5659
  this.connectionPromise = null;
5607
5660
  if (this.registerer && this.registerer.waiting) {
5608
5661
  this.registerer.waitingToggle(false);
@@ -5880,8 +5933,9 @@ class WebRTCClient extends Emitter {
5880
5933
  }
5881
5934
  }
5882
5935
 
5883
- async close() {
5884
- logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
5936
+ async close(force = false) {
5937
+ logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent, force });
5938
+ this.forceClosed = force;
5885
5939
  this._cleanupMedia();
5886
5940
  this.connectionPromise = null;
5887
5941
 
@@ -5900,7 +5954,7 @@ class WebRTCClient extends Emitter {
5900
5954
  this.userAgent.delegate = null;
5901
5955
  this.userAgent.stateChange.removeAllListeners();
5902
5956
 
5903
- await this._disconnectTransport();
5957
+ await this._disconnectTransport(force);
5904
5958
 
5905
5959
  this._cleanupRegister();
5906
5960
 
@@ -7336,7 +7390,15 @@ class WebRTCClient extends Emitter {
7336
7390
  return userAgent.UserAgent.makeURI(`sip:${target}@${this.config.host}`);
7337
7391
  }
7338
7392
 
7339
- async _disconnectTransport() {
7393
+ async _disconnectTransport(force = false) {
7394
+ if (force) {
7395
+ // Bypass sip.js state machine that prevent to close WS with the state `Connecting`
7396
+ this.userAgent.transport.disconnectResolve = () => {};
7397
+ // eslint-disable-next-line
7398
+ this.userAgent.transport._ws.close(1000);
7399
+ return;
7400
+ }
7401
+
7340
7402
  // Check if `disconnectPromise` is not present to avoid `Disconnect promise must not be defined` errors.
7341
7403
  if (this.userAgent && this.userAgent.transport && !this.userAgent.transport.disconnectPromise) {
7342
7404
  try {
@@ -2754,6 +2754,7 @@ var authMethods = (client , baseUrl ) => ({
2754
2754
 
2755
2755
 
2756
2756
 
2757
+
2757
2758
  ) {
2758
2759
  const body = {
2759
2760
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2773,6 +2774,10 @@ var authMethods = (client , baseUrl ) => ({
2773
2774
  headers['Wazo-Session-Type'] = 'mobile';
2774
2775
  }
2775
2776
 
2777
+ if (params.tenantId) {
2778
+ body.tenant_id = params.tenantId;
2779
+ }
2780
+
2776
2781
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2777
2782
  },
2778
2783
 
@@ -3841,11 +3846,13 @@ class Recording {
3841
3846
 
3842
3847
 
3843
3848
 
3849
+
3844
3850
 
3845
3851
 
3846
3852
 
3847
3853
 
3848
3854
 
3855
+
3849
3856
 
3850
3857
 
3851
3858
 
@@ -3866,10 +3873,12 @@ class Recording {
3866
3873
 
3867
3874
 
3868
3875
 
3876
+
3869
3877
 
3870
3878
 
3871
3879
 
3872
3880
 
3881
+
3873
3882
 
3874
3883
 
3875
3884
 
@@ -3931,10 +3940,12 @@ class CallLog {
3931
3940
  || plain.destination_extension
3932
3941
  || `meeting-${plain.requested_name || plain.destination_name || ''}`,
3933
3942
  name: plain.requested_name || plain.destination_name || '',
3943
+ uuid: plain.destination_user_uuid,
3934
3944
  },
3935
3945
  source: {
3936
3946
  extension: plain.source_extension,
3937
3947
  name: plain.source_name,
3948
+ uuid: plain.source_user_uuid,
3938
3949
  },
3939
3950
  id: plain.id,
3940
3951
  duration: (plain.duration || 0) * 1000, // duration is in seconds
@@ -4588,6 +4599,34 @@ var chatdMethods = (client , baseUrl ) => ({
4588
4599
  client.get(`${baseUrl}/users/me/rooms/messages`, options),
4589
4600
  });
4590
4601
 
4602
+ //
4603
+
4604
+
4605
+
4606
+
4607
+
4608
+ class MeetingStatus {
4609
+
4610
+
4611
+
4612
+
4613
+ constructor({
4614
+ full,
4615
+ } = {}) {
4616
+ this.full = full;
4617
+
4618
+ // Useful to compare instead of instanceof with minified code
4619
+ this.type = 'MeetingStatus';
4620
+ }
4621
+
4622
+ static parse(plain ) {
4623
+ return new MeetingStatus({
4624
+ full: plain.full,
4625
+ });
4626
+ }
4627
+
4628
+ }
4629
+
4591
4630
  /* */
4592
4631
 
4593
4632
 
@@ -4782,6 +4821,8 @@ var calldMethods = (client , baseUrl ) => ({
4782
4821
  client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
4783
4822
  ApiRequester.successResponseParser),
4784
4823
 
4824
+ guestGetMeetingStatus: (meetingUuid ) =>
4825
+ client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
4785
4826
  });
4786
4827
 
4787
4828
  //
@@ -5341,7 +5382,7 @@ const ON_NETWORK_STATS = 'onNetworkStats';
5341
5382
  const ON_DISCONNECTED = 'onDisconnected';
5342
5383
  class CanceledCallError extends Error {}
5343
5384
 
5344
- const MAX_REGISTER_TRIES = 10;
5385
+ const MAX_REGISTER_TRIES = 5;
5345
5386
 
5346
5387
 
5347
5388
 
@@ -5395,6 +5436,7 @@ class WebRTCClient extends Emitter {
5395
5436
 
5396
5437
 
5397
5438
 
5439
+
5398
5440
 
5399
5441
  // sugar
5400
5442
 
@@ -5457,6 +5499,7 @@ class WebRTCClient extends Emitter {
5457
5499
  this.conferences = {};
5458
5500
  this.networkMonitoringInterval = {};
5459
5501
  this.sessionNetworkStats = {};
5502
+ this.forceClosed = false;
5460
5503
 
5461
5504
  this._boundOnHeartbeat = this._onHeartbeat.bind(this);
5462
5505
  this.heartbeat = new Heartbeat(config.heartbeatDelay, config.heartbeatTimeout, config.maxHeartbeats);
@@ -5578,6 +5621,8 @@ class WebRTCClient extends Emitter {
5578
5621
  skipRegister: this.skipRegister,
5579
5622
  };
5580
5623
 
5624
+ this.forceClosed = false;
5625
+
5581
5626
  if (this.skipRegister) {
5582
5627
  logger.info('sdk webrtc skip register...', logInfo);
5583
5628
  return Promise.resolve();
@@ -5602,7 +5647,15 @@ class WebRTCClient extends Emitter {
5602
5647
  const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
5603
5648
 
5604
5649
  const onRegisterFailed = () => {
5605
- logger.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
5650
+ logger.info('sdk webrtc registering failed', {
5651
+ tries,
5652
+ registerer: !!this.registerer,
5653
+ forceClosed: this.forceClosed,
5654
+ });
5655
+ if (this.forceClosed) {
5656
+ return;
5657
+ }
5658
+
5606
5659
  this.connectionPromise = null;
5607
5660
  if (this.registerer && this.registerer.waiting) {
5608
5661
  this.registerer.waitingToggle(false);
@@ -5880,8 +5933,9 @@ class WebRTCClient extends Emitter {
5880
5933
  }
5881
5934
  }
5882
5935
 
5883
- async close() {
5884
- logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
5936
+ async close(force = false) {
5937
+ logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent, force });
5938
+ this.forceClosed = force;
5885
5939
  this._cleanupMedia();
5886
5940
  this.connectionPromise = null;
5887
5941
 
@@ -5900,7 +5954,7 @@ class WebRTCClient extends Emitter {
5900
5954
  this.userAgent.delegate = null;
5901
5955
  this.userAgent.stateChange.removeAllListeners();
5902
5956
 
5903
- await this._disconnectTransport();
5957
+ await this._disconnectTransport(force);
5904
5958
 
5905
5959
  this._cleanupRegister();
5906
5960
 
@@ -7336,7 +7390,15 @@ class WebRTCClient extends Emitter {
7336
7390
  return userAgent.UserAgent.makeURI(`sip:${target}@${this.config.host}`);
7337
7391
  }
7338
7392
 
7339
- async _disconnectTransport() {
7393
+ async _disconnectTransport(force = false) {
7394
+ if (force) {
7395
+ // Bypass sip.js state machine that prevent to close WS with the state `Connecting`
7396
+ this.userAgent.transport.disconnectResolve = () => {};
7397
+ // eslint-disable-next-line
7398
+ this.userAgent.transport._ws.close(1000);
7399
+ return;
7400
+ }
7401
+
7340
7402
  // Check if `disconnectPromise` is not present to avoid `Disconnect promise must not be defined` errors.
7341
7403
  if (this.userAgent && this.userAgent.transport && !this.userAgent.transport.disconnectPromise) {
7342
7404
  try {
@@ -2412,6 +2412,7 @@ var authMethods = (client , baseUrl ) => ({
2412
2412
 
2413
2413
 
2414
2414
 
2415
+
2415
2416
  ) {
2416
2417
  const body = {
2417
2418
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2431,6 +2432,10 @@ var authMethods = (client , baseUrl ) => ({
2431
2432
  headers['Wazo-Session-Type'] = 'mobile';
2432
2433
  }
2433
2434
 
2435
+ if (params.tenantId) {
2436
+ body.tenant_id = params.tenantId;
2437
+ }
2438
+
2434
2439
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2435
2440
  },
2436
2441
 
@@ -3290,11 +3295,13 @@ class Recording {
3290
3295
 
3291
3296
 
3292
3297
 
3298
+
3293
3299
 
3294
3300
 
3295
3301
 
3296
3302
 
3297
3303
 
3304
+
3298
3305
 
3299
3306
 
3300
3307
 
@@ -3315,10 +3322,12 @@ class Recording {
3315
3322
 
3316
3323
 
3317
3324
 
3325
+
3318
3326
 
3319
3327
 
3320
3328
 
3321
3329
 
3330
+
3322
3331
 
3323
3332
 
3324
3333
 
@@ -3380,10 +3389,12 @@ class CallLog {
3380
3389
  || plain.destination_extension
3381
3390
  || `meeting-${plain.requested_name || plain.destination_name || ''}`,
3382
3391
  name: plain.requested_name || plain.destination_name || '',
3392
+ uuid: plain.destination_user_uuid,
3383
3393
  },
3384
3394
  source: {
3385
3395
  extension: plain.source_extension,
3386
3396
  name: plain.source_name,
3397
+ uuid: plain.source_user_uuid,
3387
3398
  },
3388
3399
  id: plain.id,
3389
3400
  duration: (plain.duration || 0) * 1000, // duration is in seconds
@@ -4022,6 +4033,34 @@ var chatdMethods = (client , baseUrl ) => ({
4022
4033
  client.get(`${baseUrl}/users/me/rooms/messages`, options),
4023
4034
  });
4024
4035
 
4036
+ //
4037
+
4038
+
4039
+
4040
+
4041
+
4042
+ class MeetingStatus {
4043
+
4044
+
4045
+
4046
+
4047
+ constructor({
4048
+ full,
4049
+ } = {}) {
4050
+ this.full = full;
4051
+
4052
+ // Useful to compare instead of instanceof with minified code
4053
+ this.type = 'MeetingStatus';
4054
+ }
4055
+
4056
+ static parse(plain ) {
4057
+ return new MeetingStatus({
4058
+ full: plain.full,
4059
+ });
4060
+ }
4061
+
4062
+ }
4063
+
4025
4064
  /* */
4026
4065
 
4027
4066
 
@@ -4216,6 +4255,8 @@ var calldMethods = (client , baseUrl ) => ({
4216
4255
  client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
4217
4256
  ApiRequester.successResponseParser),
4218
4257
 
4258
+ guestGetMeetingStatus: (meetingUuid ) =>
4259
+ client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
4219
4260
  });
4220
4261
 
4221
4262
  //
@@ -93,11 +93,13 @@ class Recording {
93
93
 
94
94
 
95
95
 
96
+
96
97
 
97
98
 
98
99
 
99
100
 
100
101
 
102
+
101
103
 
102
104
 
103
105
 
@@ -118,10 +120,12 @@ class Recording {
118
120
 
119
121
 
120
122
 
123
+
121
124
 
122
125
 
123
126
 
124
127
 
128
+
125
129
 
126
130
 
127
131
 
@@ -183,10 +187,12 @@ class CallLog {
183
187
  || plain.destination_extension
184
188
  || `meeting-${plain.requested_name || plain.destination_name || ''}`,
185
189
  name: plain.requested_name || plain.destination_name || '',
190
+ uuid: plain.destination_user_uuid,
186
191
  },
187
192
  source: {
188
193
  extension: plain.source_extension,
189
194
  name: plain.source_name,
195
+ uuid: plain.source_user_uuid,
190
196
  },
191
197
  id: plain.id,
192
198
  duration: (plain.duration || 0) * 1000, // duration is in seconds
@@ -377,6 +377,14 @@ class CallSession {
377
377
  return !!this.answerTime;
378
378
  }
379
379
 
380
+ toJSON() {
381
+ const jsonObj = { ...this };
382
+ // $FlowFixMe
383
+ jsonObj.answered = this.answered;
384
+
385
+ return jsonObj;
386
+ }
387
+
380
388
  static parseCall(call ) {
381
389
  return new CallSession({
382
390
  callId: call.id,
@@ -2205,6 +2205,7 @@ var authMethods = (client , baseUrl ) => ({
2205
2205
 
2206
2206
 
2207
2207
 
2208
+
2208
2209
  ) {
2209
2210
  const body = {
2210
2211
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2224,6 +2225,10 @@ var authMethods = (client , baseUrl ) => ({
2224
2225
  headers['Wazo-Session-Type'] = 'mobile';
2225
2226
  }
2226
2227
 
2228
+ if (params.tenantId) {
2229
+ body.tenant_id = params.tenantId;
2230
+ }
2231
+
2227
2232
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2228
2233
  },
2229
2234
 
@@ -3292,11 +3297,13 @@ class Recording {
3292
3297
 
3293
3298
 
3294
3299
 
3300
+
3295
3301
 
3296
3302
 
3297
3303
 
3298
3304
 
3299
3305
 
3306
+
3300
3307
 
3301
3308
 
3302
3309
 
@@ -3317,10 +3324,12 @@ class Recording {
3317
3324
 
3318
3325
 
3319
3326
 
3327
+
3320
3328
 
3321
3329
 
3322
3330
 
3323
3331
 
3332
+
3324
3333
 
3325
3334
 
3326
3335
 
@@ -3382,10 +3391,12 @@ class CallLog {
3382
3391
  || plain.destination_extension
3383
3392
  || `meeting-${plain.requested_name || plain.destination_name || ''}`,
3384
3393
  name: plain.requested_name || plain.destination_name || '',
3394
+ uuid: plain.destination_user_uuid,
3385
3395
  },
3386
3396
  source: {
3387
3397
  extension: plain.source_extension,
3388
3398
  name: plain.source_name,
3399
+ uuid: plain.source_user_uuid,
3389
3400
  },
3390
3401
  id: plain.id,
3391
3402
  duration: (plain.duration || 0) * 1000, // duration is in seconds
@@ -4024,6 +4035,34 @@ var chatdMethods = (client , baseUrl ) => ({
4024
4035
  client.get(`${baseUrl}/users/me/rooms/messages`, options),
4025
4036
  });
4026
4037
 
4038
+ //
4039
+
4040
+
4041
+
4042
+
4043
+
4044
+ class MeetingStatus {
4045
+
4046
+
4047
+
4048
+
4049
+ constructor({
4050
+ full,
4051
+ } = {}) {
4052
+ this.full = full;
4053
+
4054
+ // Useful to compare instead of instanceof with minified code
4055
+ this.type = 'MeetingStatus';
4056
+ }
4057
+
4058
+ static parse(plain ) {
4059
+ return new MeetingStatus({
4060
+ full: plain.full,
4061
+ });
4062
+ }
4063
+
4064
+ }
4065
+
4027
4066
  /* */
4028
4067
 
4029
4068
 
@@ -4218,6 +4257,8 @@ var calldMethods = (client , baseUrl ) => ({
4218
4257
  client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
4219
4258
  ApiRequester.successResponseParser),
4220
4259
 
4260
+ guestGetMeetingStatus: (meetingUuid ) =>
4261
+ client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
4221
4262
  });
4222
4263
 
4223
4264
  //
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ //
4
+
5
+
6
+
7
+
8
+
9
+ class MeetingStatus {
10
+
11
+
12
+
13
+
14
+ constructor({
15
+ full,
16
+ } = {}) {
17
+ this.full = full;
18
+
19
+ // Useful to compare instead of instanceof with minified code
20
+ this.type = 'MeetingStatus';
21
+ }
22
+
23
+ static parse(plain ) {
24
+ return new MeetingStatus({
25
+ full: plain.full,
26
+ });
27
+ }
28
+
29
+ }
30
+
31
+ module.exports = MeetingStatus;