@wazo/sdk 0.37.28 → 0.37.32

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 (81) hide show
  1. package/README.md +2 -1
  2. package/dist/wazo-sdk.js +4 -4
  3. package/esm/__tests__/api-client.test.js +30 -0
  4. package/esm/__tests__/web-rtc-client.test.js +65 -6
  5. package/esm/api/calld.js +30 -0
  6. package/esm/api-client.js +30 -0
  7. package/esm/checker/Checker.js +65 -6
  8. package/esm/checker/checks/aor.js +30 -0
  9. package/esm/checker/checks/api.js +30 -0
  10. package/esm/checker/checks/index.js +65 -6
  11. package/esm/checker/checks/webrtc-transport.js +65 -6
  12. package/esm/checker/checks/webrtc.js +65 -6
  13. package/esm/domain/AdHocAPIConference.js +30 -0
  14. package/esm/domain/CallSession.js +15 -3
  15. package/esm/domain/Features.js +30 -0
  16. package/esm/domain/MeetingStatus.js +29 -0
  17. package/esm/domain/Phone/CTIPhone.js +45 -3
  18. package/esm/domain/Phone/WebRTCPhone.js +28 -6
  19. package/esm/domain/__tests__/CallSession.test.js +32 -3
  20. package/esm/domain/__tests__/IndirectTransfer.test.js +15 -3
  21. package/esm/domain/__tests__/Room.test.js +15 -3
  22. package/esm/index.js +93 -12
  23. package/esm/service/CallApi.js +30 -0
  24. package/esm/service/getApiClient.js +30 -0
  25. package/esm/simple/Auth.js +93 -12
  26. package/esm/simple/Configuration.js +93 -12
  27. package/esm/simple/Directory.js +30 -0
  28. package/esm/simple/Phone.js +93 -12
  29. package/esm/simple/index.js +93 -12
  30. package/esm/simple/room/LocalParticipant.js +93 -12
  31. package/esm/simple/room/Participant.js +93 -12
  32. package/esm/simple/room/RemoteParticipant.js +93 -12
  33. package/esm/simple/room/Room.js +93 -12
  34. package/esm/simple/room/SipRoom.js +93 -12
  35. package/esm/simple/room/Stream.js +93 -12
  36. package/esm/simple/room/__tests__/RemoteParticipant.test.js +93 -12
  37. package/esm/simple/utils.js +93 -12
  38. package/esm/web-rtc-client.js +65 -6
  39. package/lib/__tests__/api-client.test.js +30 -0
  40. package/lib/__tests__/web-rtc-client.test.js +65 -6
  41. package/lib/api/calld.js +30 -0
  42. package/lib/api-client.js +30 -0
  43. package/lib/checker/Checker.js +65 -6
  44. package/lib/checker/checks/aor.js +30 -0
  45. package/lib/checker/checks/api.js +30 -0
  46. package/lib/checker/checks/index.js +65 -6
  47. package/lib/checker/checks/webrtc-transport.js +65 -6
  48. package/lib/checker/checks/webrtc.js +65 -6
  49. package/lib/domain/AdHocAPIConference.js +30 -0
  50. package/lib/domain/CallSession.js +15 -3
  51. package/lib/domain/Features.js +30 -0
  52. package/lib/domain/MeetingStatus.js +31 -0
  53. package/lib/domain/Phone/CTIPhone.js +45 -3
  54. package/lib/domain/Phone/WebRTCPhone.js +28 -6
  55. package/lib/domain/__tests__/CallSession.test.js +32 -3
  56. package/lib/domain/__tests__/IndirectTransfer.test.js +15 -3
  57. package/lib/domain/__tests__/Room.test.js +15 -3
  58. package/lib/index.js +93 -12
  59. package/lib/service/CallApi.js +30 -0
  60. package/lib/service/getApiClient.js +30 -0
  61. package/lib/simple/Auth.js +93 -12
  62. package/lib/simple/Configuration.js +93 -12
  63. package/lib/simple/Directory.js +30 -0
  64. package/lib/simple/Phone.js +93 -12
  65. package/lib/simple/index.js +93 -12
  66. package/lib/simple/room/LocalParticipant.js +93 -12
  67. package/lib/simple/room/Participant.js +93 -12
  68. package/lib/simple/room/RemoteParticipant.js +93 -12
  69. package/lib/simple/room/Room.js +93 -12
  70. package/lib/simple/room/SipRoom.js +93 -12
  71. package/lib/simple/room/Stream.js +93 -12
  72. package/lib/simple/room/__tests__/RemoteParticipant.test.js +93 -12
  73. package/lib/simple/utils.js +93 -12
  74. package/lib/web-rtc-client.js +65 -6
  75. package/package.json +1 -1
  76. package/src/api/calld.js +3 -0
  77. package/src/domain/CallSession.js +16 -4
  78. package/src/domain/MeetingStatus.js +27 -0
  79. package/src/domain/Phone/WebRTCPhone.js +13 -3
  80. package/src/domain/__tests__/CallSession.test.js +17 -0
  81. package/src/web-rtc-client.js +35 -6
@@ -4085,6 +4085,34 @@ var chatdMethods = (client , baseUrl ) => ({
4085
4085
  client.get(`${baseUrl}/users/me/rooms/messages`, options),
4086
4086
  });
4087
4087
 
4088
+ //
4089
+
4090
+
4091
+
4092
+
4093
+
4094
+ class MeetingStatus {
4095
+
4096
+
4097
+
4098
+
4099
+ constructor({
4100
+ full,
4101
+ } = {}) {
4102
+ this.full = full;
4103
+
4104
+ // Useful to compare instead of instanceof with minified code
4105
+ this.type = 'MeetingStatus';
4106
+ }
4107
+
4108
+ static parse(plain ) {
4109
+ return new MeetingStatus({
4110
+ full: plain.full,
4111
+ });
4112
+ }
4113
+
4114
+ }
4115
+
4088
4116
  /* */
4089
4117
 
4090
4118
 
@@ -4279,6 +4307,8 @@ var calldMethods = (client , baseUrl ) => ({
4279
4307
  client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
4280
4308
  ApiRequester.successResponseParser),
4281
4309
 
4310
+ guestGetMeetingStatus: (meetingUuid ) =>
4311
+ client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
4282
4312
  });
4283
4313
 
4284
4314
  //
@@ -5939,6 +5969,7 @@ const MAX_REGISTER_TRIES = 10;
5939
5969
 
5940
5970
 
5941
5971
 
5972
+
5942
5973
 
5943
5974
 
5944
5975
 
@@ -5980,6 +6011,7 @@ class WebRTCClient extends Emitter {
5980
6011
 
5981
6012
 
5982
6013
 
6014
+
5983
6015
 
5984
6016
  // sugar
5985
6017
 
@@ -6042,6 +6074,7 @@ class WebRTCClient extends Emitter {
6042
6074
  this.conferences = {};
6043
6075
  this.networkMonitoringInterval = {};
6044
6076
  this.sessionNetworkStats = {};
6077
+ this.forceClosed = false;
6045
6078
 
6046
6079
  this._boundOnHeartbeat = this._onHeartbeat.bind(this);
6047
6080
  this.heartbeat = new Heartbeat(config.heartbeatDelay, config.heartbeatTimeout, config.maxHeartbeats);
@@ -6163,6 +6196,8 @@ class WebRTCClient extends Emitter {
6163
6196
  skipRegister: this.skipRegister,
6164
6197
  };
6165
6198
 
6199
+ this.forceClosed = false;
6200
+
6166
6201
  if (this.skipRegister) {
6167
6202
  logger.info('sdk webrtc skip register...', logInfo);
6168
6203
  return Promise.resolve();
@@ -6187,7 +6222,15 @@ class WebRTCClient extends Emitter {
6187
6222
  const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
6188
6223
 
6189
6224
  const onRegisterFailed = () => {
6190
- logger.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
6225
+ logger.info('sdk webrtc registering failed', {
6226
+ tries,
6227
+ registerer: !!this.registerer,
6228
+ forceClosed: this.forceClosed,
6229
+ });
6230
+ if (this.forceClosed) {
6231
+ return;
6232
+ }
6233
+
6191
6234
  this.connectionPromise = null;
6192
6235
  if (this.registerer && this.registerer.waiting) {
6193
6236
  this.registerer.waitingToggle(false);
@@ -6465,8 +6508,9 @@ class WebRTCClient extends Emitter {
6465
6508
  }
6466
6509
  }
6467
6510
 
6468
- async close() {
6469
- logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
6511
+ async close(force = false) {
6512
+ logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent, force });
6513
+ this.forceClosed = force;
6470
6514
  this._cleanupMedia();
6471
6515
  this.connectionPromise = null;
6472
6516
 
@@ -6485,7 +6529,7 @@ class WebRTCClient extends Emitter {
6485
6529
  this.userAgent.delegate = null;
6486
6530
  this.userAgent.stateChange.removeAllListeners();
6487
6531
 
6488
- await this._disconnectTransport();
6532
+ await this._disconnectTransport(force);
6489
6533
 
6490
6534
  this._cleanupRegister();
6491
6535
 
@@ -7555,6 +7599,13 @@ class WebRTCClient extends Emitter {
7555
7599
  }
7556
7600
 
7557
7601
  _createWebRTCConfiguration(configOverrides = {}) {
7602
+ let { host } = this.config;
7603
+ let port = this.config.port || 443;
7604
+
7605
+ if (this.config.websocketSip) {
7606
+ [host, port = 443] = this.config.websocketSip.split(':');
7607
+ }
7608
+
7558
7609
  const config = {
7559
7610
  authorizationUsername: this.config.authorizationUser,
7560
7611
  authorizationPassword: this.config.password,
@@ -7590,7 +7641,7 @@ class WebRTCClient extends Emitter {
7590
7641
  },
7591
7642
  transportOptions: {
7592
7643
  traceSip: configOverrides.traceSip || false,
7593
- wsServers: `wss://${this.config.host}:${this.config.port || 443}/api/asterisk/ws`,
7644
+ wsServers: `wss://${host}:${port}/api/asterisk/ws`,
7594
7645
  },
7595
7646
  sessionDescriptionHandlerFactoryOptions: {
7596
7647
  modifiers: [replaceLocalIpModifier],
@@ -7914,7 +7965,15 @@ class WebRTCClient extends Emitter {
7914
7965
  return userAgent.UserAgent.makeURI(`sip:${target}@${this.config.host}`);
7915
7966
  }
7916
7967
 
7917
- async _disconnectTransport() {
7968
+ async _disconnectTransport(force = false) {
7969
+ if (force) {
7970
+ // Bypass sip.js state machine that prevent to close WS with the state `Connecting`
7971
+ this.userAgent.transport.disconnectResolve = () => {};
7972
+ // eslint-disable-next-line
7973
+ this.userAgent.transport._ws.close(1000);
7974
+ return;
7975
+ }
7976
+
7918
7977
  // Check if `disconnectPromise` is not present to avoid `Disconnect promise must not be defined` errors.
7919
7978
  if (this.userAgent && this.userAgent.transport && !this.userAgent.transport.disconnectPromise) {
7920
7979
  try {
@@ -4588,6 +4588,34 @@ var chatdMethods = (client , baseUrl ) => ({
4588
4588
  client.get(`${baseUrl}/users/me/rooms/messages`, options),
4589
4589
  });
4590
4590
 
4591
+ //
4592
+
4593
+
4594
+
4595
+
4596
+
4597
+ class MeetingStatus {
4598
+
4599
+
4600
+
4601
+
4602
+ constructor({
4603
+ full,
4604
+ } = {}) {
4605
+ this.full = full;
4606
+
4607
+ // Useful to compare instead of instanceof with minified code
4608
+ this.type = 'MeetingStatus';
4609
+ }
4610
+
4611
+ static parse(plain ) {
4612
+ return new MeetingStatus({
4613
+ full: plain.full,
4614
+ });
4615
+ }
4616
+
4617
+ }
4618
+
4591
4619
  /* */
4592
4620
 
4593
4621
 
@@ -4782,6 +4810,8 @@ var calldMethods = (client , baseUrl ) => ({
4782
4810
  client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
4783
4811
  ApiRequester.successResponseParser),
4784
4812
 
4813
+ guestGetMeetingStatus: (meetingUuid ) =>
4814
+ client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
4785
4815
  });
4786
4816
 
4787
4817
  //
@@ -5353,6 +5383,7 @@ const MAX_REGISTER_TRIES = 10;
5353
5383
 
5354
5384
 
5355
5385
 
5386
+
5356
5387
 
5357
5388
 
5358
5389
 
@@ -5394,6 +5425,7 @@ class WebRTCClient extends Emitter {
5394
5425
 
5395
5426
 
5396
5427
 
5428
+
5397
5429
 
5398
5430
  // sugar
5399
5431
 
@@ -5456,6 +5488,7 @@ class WebRTCClient extends Emitter {
5456
5488
  this.conferences = {};
5457
5489
  this.networkMonitoringInterval = {};
5458
5490
  this.sessionNetworkStats = {};
5491
+ this.forceClosed = false;
5459
5492
 
5460
5493
  this._boundOnHeartbeat = this._onHeartbeat.bind(this);
5461
5494
  this.heartbeat = new Heartbeat(config.heartbeatDelay, config.heartbeatTimeout, config.maxHeartbeats);
@@ -5577,6 +5610,8 @@ class WebRTCClient extends Emitter {
5577
5610
  skipRegister: this.skipRegister,
5578
5611
  };
5579
5612
 
5613
+ this.forceClosed = false;
5614
+
5580
5615
  if (this.skipRegister) {
5581
5616
  logger.info('sdk webrtc skip register...', logInfo);
5582
5617
  return Promise.resolve();
@@ -5601,7 +5636,15 @@ class WebRTCClient extends Emitter {
5601
5636
  const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
5602
5637
 
5603
5638
  const onRegisterFailed = () => {
5604
- logger.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
5639
+ logger.info('sdk webrtc registering failed', {
5640
+ tries,
5641
+ registerer: !!this.registerer,
5642
+ forceClosed: this.forceClosed,
5643
+ });
5644
+ if (this.forceClosed) {
5645
+ return;
5646
+ }
5647
+
5605
5648
  this.connectionPromise = null;
5606
5649
  if (this.registerer && this.registerer.waiting) {
5607
5650
  this.registerer.waitingToggle(false);
@@ -5879,8 +5922,9 @@ class WebRTCClient extends Emitter {
5879
5922
  }
5880
5923
  }
5881
5924
 
5882
- async close() {
5883
- logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
5925
+ async close(force = false) {
5926
+ logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent, force });
5927
+ this.forceClosed = force;
5884
5928
  this._cleanupMedia();
5885
5929
  this.connectionPromise = null;
5886
5930
 
@@ -5899,7 +5943,7 @@ class WebRTCClient extends Emitter {
5899
5943
  this.userAgent.delegate = null;
5900
5944
  this.userAgent.stateChange.removeAllListeners();
5901
5945
 
5902
- await this._disconnectTransport();
5946
+ await this._disconnectTransport(force);
5903
5947
 
5904
5948
  this._cleanupRegister();
5905
5949
 
@@ -6969,6 +7013,13 @@ class WebRTCClient extends Emitter {
6969
7013
  }
6970
7014
 
6971
7015
  _createWebRTCConfiguration(configOverrides = {}) {
7016
+ let { host } = this.config;
7017
+ let port = this.config.port || 443;
7018
+
7019
+ if (this.config.websocketSip) {
7020
+ [host, port = 443] = this.config.websocketSip.split(':');
7021
+ }
7022
+
6972
7023
  const config = {
6973
7024
  authorizationUsername: this.config.authorizationUser,
6974
7025
  authorizationPassword: this.config.password,
@@ -7004,7 +7055,7 @@ class WebRTCClient extends Emitter {
7004
7055
  },
7005
7056
  transportOptions: {
7006
7057
  traceSip: configOverrides.traceSip || false,
7007
- wsServers: `wss://${this.config.host}:${this.config.port || 443}/api/asterisk/ws`,
7058
+ wsServers: `wss://${host}:${port}/api/asterisk/ws`,
7008
7059
  },
7009
7060
  sessionDescriptionHandlerFactoryOptions: {
7010
7061
  modifiers: [replaceLocalIpModifier],
@@ -7328,7 +7379,15 @@ class WebRTCClient extends Emitter {
7328
7379
  return userAgent.UserAgent.makeURI(`sip:${target}@${this.config.host}`);
7329
7380
  }
7330
7381
 
7331
- async _disconnectTransport() {
7382
+ async _disconnectTransport(force = false) {
7383
+ if (force) {
7384
+ // Bypass sip.js state machine that prevent to close WS with the state `Connecting`
7385
+ this.userAgent.transport.disconnectResolve = () => {};
7386
+ // eslint-disable-next-line
7387
+ this.userAgent.transport._ws.close(1000);
7388
+ return;
7389
+ }
7390
+
7332
7391
  // Check if `disconnectPromise` is not present to avoid `Disconnect promise must not be defined` errors.
7333
7392
  if (this.userAgent && this.userAgent.transport && !this.userAgent.transport.disconnectPromise) {
7334
7393
  try {
@@ -4588,6 +4588,34 @@ var chatdMethods = (client , baseUrl ) => ({
4588
4588
  client.get(`${baseUrl}/users/me/rooms/messages`, options),
4589
4589
  });
4590
4590
 
4591
+ //
4592
+
4593
+
4594
+
4595
+
4596
+
4597
+ class MeetingStatus {
4598
+
4599
+
4600
+
4601
+
4602
+ constructor({
4603
+ full,
4604
+ } = {}) {
4605
+ this.full = full;
4606
+
4607
+ // Useful to compare instead of instanceof with minified code
4608
+ this.type = 'MeetingStatus';
4609
+ }
4610
+
4611
+ static parse(plain ) {
4612
+ return new MeetingStatus({
4613
+ full: plain.full,
4614
+ });
4615
+ }
4616
+
4617
+ }
4618
+
4591
4619
  /* */
4592
4620
 
4593
4621
 
@@ -4782,6 +4810,8 @@ var calldMethods = (client , baseUrl ) => ({
4782
4810
  client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
4783
4811
  ApiRequester.successResponseParser),
4784
4812
 
4813
+ guestGetMeetingStatus: (meetingUuid ) =>
4814
+ client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
4785
4815
  });
4786
4816
 
4787
4817
  //
@@ -5353,6 +5383,7 @@ const MAX_REGISTER_TRIES = 10;
5353
5383
 
5354
5384
 
5355
5385
 
5386
+
5356
5387
 
5357
5388
 
5358
5389
 
@@ -5394,6 +5425,7 @@ class WebRTCClient extends Emitter {
5394
5425
 
5395
5426
 
5396
5427
 
5428
+
5397
5429
 
5398
5430
  // sugar
5399
5431
 
@@ -5456,6 +5488,7 @@ class WebRTCClient extends Emitter {
5456
5488
  this.conferences = {};
5457
5489
  this.networkMonitoringInterval = {};
5458
5490
  this.sessionNetworkStats = {};
5491
+ this.forceClosed = false;
5459
5492
 
5460
5493
  this._boundOnHeartbeat = this._onHeartbeat.bind(this);
5461
5494
  this.heartbeat = new Heartbeat(config.heartbeatDelay, config.heartbeatTimeout, config.maxHeartbeats);
@@ -5577,6 +5610,8 @@ class WebRTCClient extends Emitter {
5577
5610
  skipRegister: this.skipRegister,
5578
5611
  };
5579
5612
 
5613
+ this.forceClosed = false;
5614
+
5580
5615
  if (this.skipRegister) {
5581
5616
  logger.info('sdk webrtc skip register...', logInfo);
5582
5617
  return Promise.resolve();
@@ -5601,7 +5636,15 @@ class WebRTCClient extends Emitter {
5601
5636
  const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
5602
5637
 
5603
5638
  const onRegisterFailed = () => {
5604
- logger.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
5639
+ logger.info('sdk webrtc registering failed', {
5640
+ tries,
5641
+ registerer: !!this.registerer,
5642
+ forceClosed: this.forceClosed,
5643
+ });
5644
+ if (this.forceClosed) {
5645
+ return;
5646
+ }
5647
+
5605
5648
  this.connectionPromise = null;
5606
5649
  if (this.registerer && this.registerer.waiting) {
5607
5650
  this.registerer.waitingToggle(false);
@@ -5879,8 +5922,9 @@ class WebRTCClient extends Emitter {
5879
5922
  }
5880
5923
  }
5881
5924
 
5882
- async close() {
5883
- logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
5925
+ async close(force = false) {
5926
+ logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent, force });
5927
+ this.forceClosed = force;
5884
5928
  this._cleanupMedia();
5885
5929
  this.connectionPromise = null;
5886
5930
 
@@ -5899,7 +5943,7 @@ class WebRTCClient extends Emitter {
5899
5943
  this.userAgent.delegate = null;
5900
5944
  this.userAgent.stateChange.removeAllListeners();
5901
5945
 
5902
- await this._disconnectTransport();
5946
+ await this._disconnectTransport(force);
5903
5947
 
5904
5948
  this._cleanupRegister();
5905
5949
 
@@ -6969,6 +7013,13 @@ class WebRTCClient extends Emitter {
6969
7013
  }
6970
7014
 
6971
7015
  _createWebRTCConfiguration(configOverrides = {}) {
7016
+ let { host } = this.config;
7017
+ let port = this.config.port || 443;
7018
+
7019
+ if (this.config.websocketSip) {
7020
+ [host, port = 443] = this.config.websocketSip.split(':');
7021
+ }
7022
+
6972
7023
  const config = {
6973
7024
  authorizationUsername: this.config.authorizationUser,
6974
7025
  authorizationPassword: this.config.password,
@@ -7004,7 +7055,7 @@ class WebRTCClient extends Emitter {
7004
7055
  },
7005
7056
  transportOptions: {
7006
7057
  traceSip: configOverrides.traceSip || false,
7007
- wsServers: `wss://${this.config.host}:${this.config.port || 443}/api/asterisk/ws`,
7058
+ wsServers: `wss://${host}:${port}/api/asterisk/ws`,
7008
7059
  },
7009
7060
  sessionDescriptionHandlerFactoryOptions: {
7010
7061
  modifiers: [replaceLocalIpModifier],
@@ -7328,7 +7379,15 @@ class WebRTCClient extends Emitter {
7328
7379
  return userAgent.UserAgent.makeURI(`sip:${target}@${this.config.host}`);
7329
7380
  }
7330
7381
 
7331
- async _disconnectTransport() {
7382
+ async _disconnectTransport(force = false) {
7383
+ if (force) {
7384
+ // Bypass sip.js state machine that prevent to close WS with the state `Connecting`
7385
+ this.userAgent.transport.disconnectResolve = () => {};
7386
+ // eslint-disable-next-line
7387
+ this.userAgent.transport._ws.close(1000);
7388
+ return;
7389
+ }
7390
+
7332
7391
  // Check if `disconnectPromise` is not present to avoid `Disconnect promise must not be defined` errors.
7333
7392
  if (this.userAgent && this.userAgent.transport && !this.userAgent.transport.disconnectPromise) {
7334
7393
  try {
@@ -4022,6 +4022,34 @@ var chatdMethods = (client , baseUrl ) => ({
4022
4022
  client.get(`${baseUrl}/users/me/rooms/messages`, options),
4023
4023
  });
4024
4024
 
4025
+ //
4026
+
4027
+
4028
+
4029
+
4030
+
4031
+ class MeetingStatus {
4032
+
4033
+
4034
+
4035
+
4036
+ constructor({
4037
+ full,
4038
+ } = {}) {
4039
+ this.full = full;
4040
+
4041
+ // Useful to compare instead of instanceof with minified code
4042
+ this.type = 'MeetingStatus';
4043
+ }
4044
+
4045
+ static parse(plain ) {
4046
+ return new MeetingStatus({
4047
+ full: plain.full,
4048
+ });
4049
+ }
4050
+
4051
+ }
4052
+
4025
4053
  /* */
4026
4054
 
4027
4055
 
@@ -4216,6 +4244,8 @@ var calldMethods = (client , baseUrl ) => ({
4216
4244
  client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
4217
4245
  ApiRequester.successResponseParser),
4218
4246
 
4247
+ guestGetMeetingStatus: (meetingUuid ) =>
4248
+ client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
4219
4249
  });
4220
4250
 
4221
4251
  //
@@ -34,6 +34,7 @@ var updateFrom = (instance , from ) => {
34
34
 
35
35
 
36
36
 
37
+
37
38
 
38
39
 
39
40
 
@@ -81,14 +82,14 @@ class CallSession {
81
82
 
82
83
 
83
84
 
85
+ // = creationTime
86
+
84
87
 
85
88
 
86
89
 
87
90
 
88
91
 
89
92
 
90
-
91
-
92
93
 
93
94
 
94
95
 
@@ -152,6 +153,7 @@ class CallSession {
152
153
  recordingPaused,
153
154
  videoRemotelyDowngraded,
154
155
  sipSession,
156
+ answerTime,
155
157
  } ) {
156
158
  this.callId = callId;
157
159
  this.sipCallId = sipCallId;
@@ -179,6 +181,7 @@ class CallSession {
179
181
  this.recordingPaused = recordingPaused || false;
180
182
  this.videoRemotelyDowngraded = videoRemotelyDowngraded;
181
183
  this.sipSession = sipSession;
184
+ this.answerTime = answerTime || this.answerTime;
182
185
 
183
186
  // Useful to compare instead of instanceof with minified code
184
187
  this.type = 'CallSession';
@@ -209,7 +212,7 @@ class CallSession {
209
212
  }
210
213
 
211
214
  answer() {
212
- this.answered = true;
215
+ this.answerTime = new Date();
213
216
  }
214
217
 
215
218
  systemAnswer() {
@@ -365,6 +368,15 @@ class CallSession {
365
368
  return newFrom(callSession, CallSession);
366
369
  }
367
370
 
371
+ // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
372
+ set answered(value ) {
373
+ this.answerTime = value ? this.answerTime || new Date() : null;
374
+ }
375
+
376
+ get answered() {
377
+ return !!this.answerTime;
378
+ }
379
+
368
380
  static parseCall(call ) {
369
381
  return new CallSession({
370
382
  callId: call.id,
@@ -4024,6 +4024,34 @@ var chatdMethods = (client , baseUrl ) => ({
4024
4024
  client.get(`${baseUrl}/users/me/rooms/messages`, options),
4025
4025
  });
4026
4026
 
4027
+ //
4028
+
4029
+
4030
+
4031
+
4032
+
4033
+ class MeetingStatus {
4034
+
4035
+
4036
+
4037
+
4038
+ constructor({
4039
+ full,
4040
+ } = {}) {
4041
+ this.full = full;
4042
+
4043
+ // Useful to compare instead of instanceof with minified code
4044
+ this.type = 'MeetingStatus';
4045
+ }
4046
+
4047
+ static parse(plain ) {
4048
+ return new MeetingStatus({
4049
+ full: plain.full,
4050
+ });
4051
+ }
4052
+
4053
+ }
4054
+
4027
4055
  /* */
4028
4056
 
4029
4057
 
@@ -4218,6 +4246,8 @@ var calldMethods = (client , baseUrl ) => ({
4218
4246
  client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
4219
4247
  ApiRequester.successResponseParser),
4220
4248
 
4249
+ guestGetMeetingStatus: (meetingUuid ) =>
4250
+ client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
4221
4251
  });
4222
4252
 
4223
4253
  //
@@ -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;