@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
@@ -2197,6 +2197,7 @@ var authMethods = (client , baseUrl ) => ({
2197
2197
 
2198
2198
 
2199
2199
 
2200
+
2200
2201
  ) {
2201
2202
  const body = {
2202
2203
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2216,6 +2217,10 @@ var authMethods = (client , baseUrl ) => ({
2216
2217
  headers['Wazo-Session-Type'] = 'mobile';
2217
2218
  }
2218
2219
 
2220
+ if (params.tenantId) {
2221
+ body.tenant_id = params.tenantId;
2222
+ }
2223
+
2219
2224
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2220
2225
  },
2221
2226
 
@@ -3284,11 +3289,13 @@ class Recording {
3284
3289
 
3285
3290
 
3286
3291
 
3292
+
3287
3293
 
3288
3294
 
3289
3295
 
3290
3296
 
3291
3297
 
3298
+
3292
3299
 
3293
3300
 
3294
3301
 
@@ -3309,10 +3316,12 @@ class Recording {
3309
3316
 
3310
3317
 
3311
3318
 
3319
+
3312
3320
 
3313
3321
 
3314
3322
 
3315
3323
 
3324
+
3316
3325
 
3317
3326
 
3318
3327
 
@@ -3374,10 +3383,12 @@ class CallLog {
3374
3383
  || plain.destination_extension
3375
3384
  || `meeting-${plain.requested_name || plain.destination_name || ''}`,
3376
3385
  name: plain.requested_name || plain.destination_name || '',
3386
+ uuid: plain.destination_user_uuid,
3377
3387
  },
3378
3388
  source: {
3379
3389
  extension: plain.source_extension,
3380
3390
  name: plain.source_name,
3391
+ uuid: plain.source_user_uuid,
3381
3392
  },
3382
3393
  id: plain.id,
3383
3394
  duration: (plain.duration || 0) * 1000, // duration is in seconds
@@ -4031,6 +4042,34 @@ var chatdMethods = (client , baseUrl ) => ({
4031
4042
  client.get(`${baseUrl}/users/me/rooms/messages`, options),
4032
4043
  });
4033
4044
 
4045
+ //
4046
+
4047
+
4048
+
4049
+
4050
+
4051
+ class MeetingStatus {
4052
+
4053
+
4054
+
4055
+
4056
+ constructor({
4057
+ full,
4058
+ } = {}) {
4059
+ this.full = full;
4060
+
4061
+ // Useful to compare instead of instanceof with minified code
4062
+ this.type = 'MeetingStatus';
4063
+ }
4064
+
4065
+ static parse(plain ) {
4066
+ return new MeetingStatus({
4067
+ full: plain.full,
4068
+ });
4069
+ }
4070
+
4071
+ }
4072
+
4034
4073
  /* */
4035
4074
 
4036
4075
 
@@ -4225,6 +4264,8 @@ var calldMethods = (client , baseUrl ) => ({
4225
4264
  client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
4226
4265
  ApiRequester.successResponseParser),
4227
4266
 
4267
+ guestGetMeetingStatus: (meetingUuid ) =>
4268
+ client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
4228
4269
  });
4229
4270
 
4230
4271
  //
@@ -2745,6 +2745,7 @@ var authMethods = (client , baseUrl ) => ({
2745
2745
 
2746
2746
 
2747
2747
 
2748
+
2748
2749
  ) {
2749
2750
  const body = {
2750
2751
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2764,6 +2765,10 @@ var authMethods = (client , baseUrl ) => ({
2764
2765
  headers['Wazo-Session-Type'] = 'mobile';
2765
2766
  }
2766
2767
 
2768
+ if (params.tenantId) {
2769
+ body.tenant_id = params.tenantId;
2770
+ }
2771
+
2767
2772
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2768
2773
  },
2769
2774
 
@@ -3832,11 +3837,13 @@ class Recording {
3832
3837
 
3833
3838
 
3834
3839
 
3840
+
3835
3841
 
3836
3842
 
3837
3843
 
3838
3844
 
3839
3845
 
3846
+
3840
3847
 
3841
3848
 
3842
3849
 
@@ -3857,10 +3864,12 @@ class Recording {
3857
3864
 
3858
3865
 
3859
3866
 
3867
+
3860
3868
 
3861
3869
 
3862
3870
 
3863
3871
 
3872
+
3864
3873
 
3865
3874
 
3866
3875
 
@@ -3922,10 +3931,12 @@ class CallLog {
3922
3931
  || plain.destination_extension
3923
3932
  || `meeting-${plain.requested_name || plain.destination_name || ''}`,
3924
3933
  name: plain.requested_name || plain.destination_name || '',
3934
+ uuid: plain.destination_user_uuid,
3925
3935
  },
3926
3936
  source: {
3927
3937
  extension: plain.source_extension,
3928
3938
  name: plain.source_name,
3939
+ uuid: plain.source_user_uuid,
3929
3940
  },
3930
3941
  id: plain.id,
3931
3942
  duration: (plain.duration || 0) * 1000, // duration is in seconds
@@ -4579,6 +4590,34 @@ var chatdMethods = (client , baseUrl ) => ({
4579
4590
  client.get(`${baseUrl}/users/me/rooms/messages`, options),
4580
4591
  });
4581
4592
 
4593
+ //
4594
+
4595
+
4596
+
4597
+
4598
+
4599
+ class MeetingStatus {
4600
+
4601
+
4602
+
4603
+
4604
+ constructor({
4605
+ full,
4606
+ } = {}) {
4607
+ this.full = full;
4608
+
4609
+ // Useful to compare instead of instanceof with minified code
4610
+ this.type = 'MeetingStatus';
4611
+ }
4612
+
4613
+ static parse(plain ) {
4614
+ return new MeetingStatus({
4615
+ full: plain.full,
4616
+ });
4617
+ }
4618
+
4619
+ }
4620
+
4582
4621
  /* */
4583
4622
 
4584
4623
 
@@ -4773,6 +4812,8 @@ var calldMethods = (client , baseUrl ) => ({
4773
4812
  client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
4774
4813
  ApiRequester.successResponseParser),
4775
4814
 
4815
+ guestGetMeetingStatus: (meetingUuid ) =>
4816
+ client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
4776
4817
  });
4777
4818
 
4778
4819
  //
@@ -5332,7 +5373,7 @@ const ON_NETWORK_STATS = 'onNetworkStats';
5332
5373
  const ON_DISCONNECTED = 'onDisconnected';
5333
5374
  class CanceledCallError extends Error {}
5334
5375
 
5335
- const MAX_REGISTER_TRIES = 10;
5376
+ const MAX_REGISTER_TRIES = 5;
5336
5377
 
5337
5378
 
5338
5379
 
@@ -5386,6 +5427,7 @@ class WebRTCClient extends Emitter {
5386
5427
 
5387
5428
 
5388
5429
 
5430
+
5389
5431
 
5390
5432
  // sugar
5391
5433
 
@@ -5448,6 +5490,7 @@ class WebRTCClient extends Emitter {
5448
5490
  this.conferences = {};
5449
5491
  this.networkMonitoringInterval = {};
5450
5492
  this.sessionNetworkStats = {};
5493
+ this.forceClosed = false;
5451
5494
 
5452
5495
  this._boundOnHeartbeat = this._onHeartbeat.bind(this);
5453
5496
  this.heartbeat = new Heartbeat(config.heartbeatDelay, config.heartbeatTimeout, config.maxHeartbeats);
@@ -5569,6 +5612,8 @@ class WebRTCClient extends Emitter {
5569
5612
  skipRegister: this.skipRegister,
5570
5613
  };
5571
5614
 
5615
+ this.forceClosed = false;
5616
+
5572
5617
  if (this.skipRegister) {
5573
5618
  logger.info('sdk webrtc skip register...', logInfo);
5574
5619
  return Promise.resolve();
@@ -5593,7 +5638,15 @@ class WebRTCClient extends Emitter {
5593
5638
  const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
5594
5639
 
5595
5640
  const onRegisterFailed = () => {
5596
- logger.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
5641
+ logger.info('sdk webrtc registering failed', {
5642
+ tries,
5643
+ registerer: !!this.registerer,
5644
+ forceClosed: this.forceClosed,
5645
+ });
5646
+ if (this.forceClosed) {
5647
+ return;
5648
+ }
5649
+
5597
5650
  this.connectionPromise = null;
5598
5651
  if (this.registerer && this.registerer.waiting) {
5599
5652
  this.registerer.waitingToggle(false);
@@ -5871,8 +5924,9 @@ class WebRTCClient extends Emitter {
5871
5924
  }
5872
5925
  }
5873
5926
 
5874
- async close() {
5875
- logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
5927
+ async close(force = false) {
5928
+ logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent, force });
5929
+ this.forceClosed = force;
5876
5930
  this._cleanupMedia();
5877
5931
  this.connectionPromise = null;
5878
5932
 
@@ -5891,7 +5945,7 @@ class WebRTCClient extends Emitter {
5891
5945
  this.userAgent.delegate = null;
5892
5946
  this.userAgent.stateChange.removeAllListeners();
5893
5947
 
5894
- await this._disconnectTransport();
5948
+ await this._disconnectTransport(force);
5895
5949
 
5896
5950
  this._cleanupRegister();
5897
5951
 
@@ -7327,7 +7381,15 @@ class WebRTCClient extends Emitter {
7327
7381
  return UserAgent.makeURI(`sip:${target}@${this.config.host}`);
7328
7382
  }
7329
7383
 
7330
- async _disconnectTransport() {
7384
+ async _disconnectTransport(force = false) {
7385
+ if (force) {
7386
+ // Bypass sip.js state machine that prevent to close WS with the state `Connecting`
7387
+ this.userAgent.transport.disconnectResolve = () => {};
7388
+ // eslint-disable-next-line
7389
+ this.userAgent.transport._ws.close(1000);
7390
+ return;
7391
+ }
7392
+
7331
7393
  // Check if `disconnectPromise` is not present to avoid `Disconnect promise must not be defined` errors.
7332
7394
  if (this.userAgent && this.userAgent.transport && !this.userAgent.transport.disconnectPromise) {
7333
7395
  try {
package/esm/api/auth.js CHANGED
@@ -960,6 +960,7 @@ var auth = (client , baseUrl ) => ({
960
960
 
961
961
 
962
962
 
963
+
963
964
  ) {
964
965
  const body = {
965
966
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -979,6 +980,10 @@ var auth = (client , baseUrl ) => ({
979
980
  headers['Wazo-Session-Type'] = 'mobile';
980
981
  }
981
982
 
983
+ if (params.tenantId) {
984
+ body.tenant_id = params.tenantId;
985
+ }
986
+
982
987
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
983
988
  },
984
989
 
@@ -477,11 +477,13 @@ class Recording {
477
477
 
478
478
 
479
479
 
480
+
480
481
 
481
482
 
482
483
 
483
484
 
484
485
 
486
+
485
487
 
486
488
 
487
489
 
@@ -502,10 +504,12 @@ class Recording {
502
504
 
503
505
 
504
506
 
507
+
505
508
 
506
509
 
507
510
 
508
511
 
512
+
509
513
 
510
514
 
511
515
 
@@ -567,10 +571,12 @@ class CallLog {
567
571
  || plain.destination_extension
568
572
  || `meeting-${plain.requested_name || plain.destination_name || ''}`,
569
573
  name: plain.requested_name || plain.destination_name || '',
574
+ uuid: plain.destination_user_uuid,
570
575
  },
571
576
  source: {
572
577
  extension: plain.source_extension,
573
578
  name: plain.source_name,
579
+ uuid: plain.source_user_uuid,
574
580
  },
575
581
  id: plain.id,
576
582
  duration: (plain.duration || 0) * 1000, // duration is in seconds
package/esm/api/calld.js CHANGED
@@ -1226,6 +1226,34 @@ class IndirectTransfer {
1226
1226
  }
1227
1227
  }
1228
1228
 
1229
+ //
1230
+
1231
+
1232
+
1233
+
1234
+
1235
+ class MeetingStatus {
1236
+
1237
+
1238
+
1239
+
1240
+ constructor({
1241
+ full,
1242
+ } = {}) {
1243
+ this.full = full;
1244
+
1245
+ // Useful to compare instead of instanceof with minified code
1246
+ this.type = 'MeetingStatus';
1247
+ }
1248
+
1249
+ static parse(plain ) {
1250
+ return new MeetingStatus({
1251
+ full: plain.full,
1252
+ });
1253
+ }
1254
+
1255
+ }
1256
+
1229
1257
  /* */
1230
1258
 
1231
1259
 
@@ -1420,6 +1448,8 @@ var calld = (client , baseUrl ) => ({
1420
1448
  client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
1421
1449
  ApiRequester.successResponseParser),
1422
1450
 
1451
+ guestGetMeetingStatus: (meetingUuid ) =>
1452
+ client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
1423
1453
  });
1424
1454
 
1425
1455
  export default calld;
package/esm/api-client.js CHANGED
@@ -2197,6 +2197,7 @@ var authMethods = (client , baseUrl ) => ({
2197
2197
 
2198
2198
 
2199
2199
 
2200
+
2200
2201
  ) {
2201
2202
  const body = {
2202
2203
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2216,6 +2217,10 @@ var authMethods = (client , baseUrl ) => ({
2216
2217
  headers['Wazo-Session-Type'] = 'mobile';
2217
2218
  }
2218
2219
 
2220
+ if (params.tenantId) {
2221
+ body.tenant_id = params.tenantId;
2222
+ }
2223
+
2219
2224
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2220
2225
  },
2221
2226
 
@@ -3284,11 +3289,13 @@ class Recording {
3284
3289
 
3285
3290
 
3286
3291
 
3292
+
3287
3293
 
3288
3294
 
3289
3295
 
3290
3296
 
3291
3297
 
3298
+
3292
3299
 
3293
3300
 
3294
3301
 
@@ -3309,10 +3316,12 @@ class Recording {
3309
3316
 
3310
3317
 
3311
3318
 
3319
+
3312
3320
 
3313
3321
 
3314
3322
 
3315
3323
 
3324
+
3316
3325
 
3317
3326
 
3318
3327
 
@@ -3374,10 +3383,12 @@ class CallLog {
3374
3383
  || plain.destination_extension
3375
3384
  || `meeting-${plain.requested_name || plain.destination_name || ''}`,
3376
3385
  name: plain.requested_name || plain.destination_name || '',
3386
+ uuid: plain.destination_user_uuid,
3377
3387
  },
3378
3388
  source: {
3379
3389
  extension: plain.source_extension,
3380
3390
  name: plain.source_name,
3391
+ uuid: plain.source_user_uuid,
3381
3392
  },
3382
3393
  id: plain.id,
3383
3394
  duration: (plain.duration || 0) * 1000, // duration is in seconds
@@ -4031,6 +4042,34 @@ var chatdMethods = (client , baseUrl ) => ({
4031
4042
  client.get(`${baseUrl}/users/me/rooms/messages`, options),
4032
4043
  });
4033
4044
 
4045
+ //
4046
+
4047
+
4048
+
4049
+
4050
+
4051
+ class MeetingStatus {
4052
+
4053
+
4054
+
4055
+
4056
+ constructor({
4057
+ full,
4058
+ } = {}) {
4059
+ this.full = full;
4060
+
4061
+ // Useful to compare instead of instanceof with minified code
4062
+ this.type = 'MeetingStatus';
4063
+ }
4064
+
4065
+ static parse(plain ) {
4066
+ return new MeetingStatus({
4067
+ full: plain.full,
4068
+ });
4069
+ }
4070
+
4071
+ }
4072
+
4034
4073
  /* */
4035
4074
 
4036
4075
 
@@ -4225,6 +4264,8 @@ var calldMethods = (client , baseUrl ) => ({
4225
4264
  client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
4226
4265
  ApiRequester.successResponseParser),
4227
4266
 
4267
+ guestGetMeetingStatus: (meetingUuid ) =>
4268
+ client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
4228
4269
  });
4229
4270
 
4230
4271
  //
@@ -2215,6 +2215,7 @@ var authMethods = (client , baseUrl ) => ({
2215
2215
 
2216
2216
 
2217
2217
 
2218
+
2218
2219
  ) {
2219
2220
  const body = {
2220
2221
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2234,6 +2235,10 @@ var authMethods = (client , baseUrl ) => ({
2234
2235
  headers['Wazo-Session-Type'] = 'mobile';
2235
2236
  }
2236
2237
 
2238
+ if (params.tenantId) {
2239
+ body.tenant_id = params.tenantId;
2240
+ }
2241
+
2237
2242
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2238
2243
  },
2239
2244
 
@@ -3328,11 +3333,13 @@ class Recording {
3328
3333
 
3329
3334
 
3330
3335
 
3336
+
3331
3337
 
3332
3338
 
3333
3339
 
3334
3340
 
3335
3341
 
3342
+
3336
3343
 
3337
3344
 
3338
3345
 
@@ -3353,10 +3360,12 @@ class Recording {
3353
3360
 
3354
3361
 
3355
3362
 
3363
+
3356
3364
 
3357
3365
 
3358
3366
 
3359
3367
 
3368
+
3360
3369
 
3361
3370
 
3362
3371
 
@@ -3418,10 +3427,12 @@ class CallLog {
3418
3427
  || plain.destination_extension
3419
3428
  || `meeting-${plain.requested_name || plain.destination_name || ''}`,
3420
3429
  name: plain.requested_name || plain.destination_name || '',
3430
+ uuid: plain.destination_user_uuid,
3421
3431
  },
3422
3432
  source: {
3423
3433
  extension: plain.source_extension,
3424
3434
  name: plain.source_name,
3435
+ uuid: plain.source_user_uuid,
3425
3436
  },
3426
3437
  id: plain.id,
3427
3438
  duration: (plain.duration || 0) * 1000, // duration is in seconds
@@ -4075,6 +4086,34 @@ var chatdMethods = (client , baseUrl ) => ({
4075
4086
  client.get(`${baseUrl}/users/me/rooms/messages`, options),
4076
4087
  });
4077
4088
 
4089
+ //
4090
+
4091
+
4092
+
4093
+
4094
+
4095
+ class MeetingStatus {
4096
+
4097
+
4098
+
4099
+
4100
+ constructor({
4101
+ full,
4102
+ } = {}) {
4103
+ this.full = full;
4104
+
4105
+ // Useful to compare instead of instanceof with minified code
4106
+ this.type = 'MeetingStatus';
4107
+ }
4108
+
4109
+ static parse(plain ) {
4110
+ return new MeetingStatus({
4111
+ full: plain.full,
4112
+ });
4113
+ }
4114
+
4115
+ }
4116
+
4078
4117
  /* */
4079
4118
 
4080
4119
 
@@ -4269,6 +4308,8 @@ var calldMethods = (client , baseUrl ) => ({
4269
4308
  client.put(`${baseUrl}/users/me/calls/${callId}/record/resume`, null, null,
4270
4309
  ApiRequester.successResponseParser),
4271
4310
 
4311
+ guestGetMeetingStatus: (meetingUuid ) =>
4312
+ client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}/status`).then(MeetingStatus.parse),
4272
4313
  });
4273
4314
 
4274
4315
  //
@@ -5917,7 +5958,7 @@ const ON_NETWORK_STATS = 'onNetworkStats';
5917
5958
  const ON_DISCONNECTED = 'onDisconnected';
5918
5959
  class CanceledCallError extends Error {}
5919
5960
 
5920
- const MAX_REGISTER_TRIES = 10;
5961
+ const MAX_REGISTER_TRIES = 5;
5921
5962
 
5922
5963
 
5923
5964
 
@@ -5971,6 +6012,7 @@ class WebRTCClient extends Emitter {
5971
6012
 
5972
6013
 
5973
6014
 
6015
+
5974
6016
 
5975
6017
  // sugar
5976
6018
 
@@ -6033,6 +6075,7 @@ class WebRTCClient extends Emitter {
6033
6075
  this.conferences = {};
6034
6076
  this.networkMonitoringInterval = {};
6035
6077
  this.sessionNetworkStats = {};
6078
+ this.forceClosed = false;
6036
6079
 
6037
6080
  this._boundOnHeartbeat = this._onHeartbeat.bind(this);
6038
6081
  this.heartbeat = new Heartbeat(config.heartbeatDelay, config.heartbeatTimeout, config.maxHeartbeats);
@@ -6154,6 +6197,8 @@ class WebRTCClient extends Emitter {
6154
6197
  skipRegister: this.skipRegister,
6155
6198
  };
6156
6199
 
6200
+ this.forceClosed = false;
6201
+
6157
6202
  if (this.skipRegister) {
6158
6203
  logger$1.info('sdk webrtc skip register...', logInfo);
6159
6204
  return Promise.resolve();
@@ -6178,7 +6223,15 @@ class WebRTCClient extends Emitter {
6178
6223
  const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
6179
6224
 
6180
6225
  const onRegisterFailed = () => {
6181
- logger$1.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
6226
+ logger$1.info('sdk webrtc registering failed', {
6227
+ tries,
6228
+ registerer: !!this.registerer,
6229
+ forceClosed: this.forceClosed,
6230
+ });
6231
+ if (this.forceClosed) {
6232
+ return;
6233
+ }
6234
+
6182
6235
  this.connectionPromise = null;
6183
6236
  if (this.registerer && this.registerer.waiting) {
6184
6237
  this.registerer.waitingToggle(false);
@@ -6456,8 +6509,9 @@ class WebRTCClient extends Emitter {
6456
6509
  }
6457
6510
  }
6458
6511
 
6459
- async close() {
6460
- logger$1.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
6512
+ async close(force = false) {
6513
+ logger$1.info('sdk webrtc closing client', { userAgent: !!this.userAgent, force });
6514
+ this.forceClosed = force;
6461
6515
  this._cleanupMedia();
6462
6516
  this.connectionPromise = null;
6463
6517
 
@@ -6476,7 +6530,7 @@ class WebRTCClient extends Emitter {
6476
6530
  this.userAgent.delegate = null;
6477
6531
  this.userAgent.stateChange.removeAllListeners();
6478
6532
 
6479
- await this._disconnectTransport();
6533
+ await this._disconnectTransport(force);
6480
6534
 
6481
6535
  this._cleanupRegister();
6482
6536
 
@@ -7912,7 +7966,15 @@ class WebRTCClient extends Emitter {
7912
7966
  return UserAgent.makeURI(`sip:${target}@${this.config.host}`);
7913
7967
  }
7914
7968
 
7915
- async _disconnectTransport() {
7969
+ async _disconnectTransport(force = false) {
7970
+ if (force) {
7971
+ // Bypass sip.js state machine that prevent to close WS with the state `Connecting`
7972
+ this.userAgent.transport.disconnectResolve = () => {};
7973
+ // eslint-disable-next-line
7974
+ this.userAgent.transport._ws.close(1000);
7975
+ return;
7976
+ }
7977
+
7916
7978
  // Check if `disconnectPromise` is not present to avoid `Disconnect promise must not be defined` errors.
7917
7979
  if (this.userAgent && this.userAgent.transport && !this.userAgent.transport.disconnectPromise) {
7918
7980
  try {