@wazo/sdk 0.37.23 → 0.37.24

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 (103) hide show
  1. package/dist/wazo-sdk.js +6 -6
  2. package/esm/__tests__/api-client.test.js +22 -17
  3. package/esm/__tests__/web-rtc-client.test.js +105 -100
  4. package/esm/api/amid.js +1 -1
  5. package/esm/api/call-logd.js +2 -2
  6. package/esm/api/confd.js +10 -5
  7. package/esm/api/ctid-ng.js +3 -3
  8. package/esm/api/dird.js +1 -1
  9. package/esm/api/webhookd.js +1 -1
  10. package/esm/api-client.js +22 -17
  11. package/esm/checker/Checker.js +130 -125
  12. package/esm/checker/checks/aor.js +22 -17
  13. package/esm/checker/checks/api.js +22 -17
  14. package/esm/checker/checks/index.js +120 -115
  15. package/esm/checker/checks/wazo-websocket.js +15 -15
  16. package/esm/checker/checks/webrtc-transport.js +105 -100
  17. package/esm/checker/checks/webrtc.js +105 -100
  18. package/esm/domain/AdHocAPIConference.js +22 -17
  19. package/esm/domain/CallLog.js +1 -1
  20. package/esm/domain/Contact.js +1 -1
  21. package/esm/domain/Features.js +22 -17
  22. package/esm/domain/Meeting.js +12 -5
  23. package/esm/domain/Phone/CTIPhone.js +36 -31
  24. package/esm/domain/Phone/WebRTCPhone.js +110 -87
  25. package/esm/domain/__tests__/CallLog.test.js +1 -1
  26. package/esm/domain/__tests__/Contact.test.js +1 -1
  27. package/esm/domain/__tests__/Meeting.test.js +144 -0
  28. package/esm/index.js +365 -337
  29. package/esm/lib/WazoSessionDescriptionHandler.js +1 -1
  30. package/esm/service/CallApi.js +22 -17
  31. package/esm/service/IssueReporter.js +1 -1
  32. package/esm/service/__tests__/IssueReporter.test.js +1 -1
  33. package/esm/service/getApiClient.js +22 -17
  34. package/esm/simple/Auth.js +355 -327
  35. package/esm/simple/Configuration.js +355 -327
  36. package/esm/simple/Directory.js +22 -17
  37. package/esm/simple/Phone.js +355 -327
  38. package/esm/simple/Websocket.js +17 -17
  39. package/esm/simple/index.js +359 -331
  40. package/esm/simple/room/LocalParticipant.js +359 -331
  41. package/esm/simple/room/Participant.js +359 -331
  42. package/esm/simple/room/RemoteParticipant.js +359 -331
  43. package/esm/simple/room/Room.js +360 -332
  44. package/esm/simple/room/SipRoom.js +359 -331
  45. package/esm/simple/room/Stream.js +359 -331
  46. package/esm/simple/room/__tests__/RemoteParticipant.test.js +359 -331
  47. package/esm/simple/utils.js +359 -331
  48. package/esm/types/WebSocketMessage.js +1 -1
  49. package/esm/web-rtc-client.js +105 -100
  50. package/esm/websocket-client.js +15 -15
  51. package/lib/__tests__/api-client.test.js +22 -17
  52. package/lib/__tests__/web-rtc-client.test.js +105 -100
  53. package/lib/api/amid.js +1 -1
  54. package/lib/api/call-logd.js +2 -2
  55. package/lib/api/confd.js +10 -5
  56. package/lib/api/ctid-ng.js +3 -3
  57. package/lib/api/dird.js +1 -1
  58. package/lib/api/webhookd.js +1 -1
  59. package/lib/api-client.js +22 -17
  60. package/lib/checker/Checker.js +130 -125
  61. package/lib/checker/checks/aor.js +22 -17
  62. package/lib/checker/checks/api.js +22 -17
  63. package/lib/checker/checks/index.js +120 -115
  64. package/lib/checker/checks/wazo-websocket.js +15 -15
  65. package/lib/checker/checks/webrtc-transport.js +105 -100
  66. package/lib/checker/checks/webrtc.js +105 -100
  67. package/lib/domain/AdHocAPIConference.js +22 -17
  68. package/lib/domain/CallLog.js +1 -1
  69. package/lib/domain/Contact.js +1 -1
  70. package/lib/domain/Features.js +22 -17
  71. package/lib/domain/Meeting.js +16 -5
  72. package/lib/domain/Phone/CTIPhone.js +36 -31
  73. package/lib/domain/Phone/WebRTCPhone.js +110 -87
  74. package/lib/domain/__tests__/CallLog.test.js +1 -1
  75. package/lib/domain/__tests__/Contact.test.js +1 -1
  76. package/lib/domain/__tests__/Meeting.test.js +150 -0
  77. package/lib/index.js +365 -337
  78. package/lib/lib/WazoSessionDescriptionHandler.js +1 -1
  79. package/lib/service/CallApi.js +22 -17
  80. package/lib/service/IssueReporter.js +1 -1
  81. package/lib/service/__tests__/IssueReporter.test.js +1 -1
  82. package/lib/service/getApiClient.js +22 -17
  83. package/lib/simple/Auth.js +355 -327
  84. package/lib/simple/Configuration.js +355 -327
  85. package/lib/simple/Directory.js +22 -17
  86. package/lib/simple/Phone.js +355 -327
  87. package/lib/simple/Websocket.js +17 -17
  88. package/lib/simple/index.js +359 -331
  89. package/lib/simple/room/LocalParticipant.js +359 -331
  90. package/lib/simple/room/Participant.js +359 -331
  91. package/lib/simple/room/RemoteParticipant.js +359 -331
  92. package/lib/simple/room/Room.js +360 -332
  93. package/lib/simple/room/SipRoom.js +359 -331
  94. package/lib/simple/room/Stream.js +359 -331
  95. package/lib/simple/room/__tests__/RemoteParticipant.test.js +359 -331
  96. package/lib/simple/utils.js +359 -331
  97. package/lib/types/WebSocketMessage.js +2 -0
  98. package/lib/web-rtc-client.js +105 -100
  99. package/lib/websocket-client.js +15 -15
  100. package/package.json +1 -1
  101. package/src/domain/Meeting.js +12 -5
  102. package/src/domain/Phone/WebRTCPhone.js +24 -1
  103. package/src/domain/__tests__/Meeting.test.js +50 -0
@@ -21,7 +21,7 @@ const isMobile = () => typeof navigator !== 'undefined' && navigator.product ===
21
21
 
22
22
  /* */
23
23
 
24
- IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
24
+ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
25
25
 
26
26
  // Use a function here to be able to mock it in tests
27
27
  const realFetch = () => {
@@ -2468,7 +2468,7 @@ var IssueReporter$1 = new IssueReporter();
2468
2468
 
2469
2469
  const methods = ['head', 'get', 'post', 'put', 'delete'];
2470
2470
 
2471
- const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
2471
+ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
2472
2472
 
2473
2473
  // Use a function here to be able to mock it in tests
2474
2474
  const realFetch = () => {
@@ -2607,7 +2607,7 @@ class ApiRequester {
2607
2607
  };
2608
2608
 
2609
2609
  if (this.refreshTokenPromise) {
2610
- logger$1.info('A token is already refreshing, waiting ...', { url });
2610
+ logger.info('A token is already refreshing, waiting ...', { url });
2611
2611
  await this.refreshTokenPromise;
2612
2612
  }
2613
2613
 
@@ -2627,7 +2627,7 @@ class ApiRequester {
2627
2627
  return promise.then(async (err ) => {
2628
2628
  // Check if the token is still valid
2629
2629
  if (firstCall && this._checkTokenExpired(response, err)) {
2630
- logger$1.warn('token expired', { error: err.reason });
2630
+ logger.warn('token expired', { error: err.reason });
2631
2631
  // Replay the call after refreshing the token
2632
2632
  return this._replayWithNewToken(err, path, method, body, headers, parse);
2633
2633
  }
@@ -2637,7 +2637,7 @@ class ApiRequester {
2637
2637
  : exceptionClass.fromResponse(err, response.status);
2638
2638
 
2639
2639
  if (this.shouldLogErrors) {
2640
- logger$1.error('API error', error);
2640
+ logger.error('API error', error);
2641
2641
  }
2642
2642
 
2643
2643
  throw error;
@@ -2647,7 +2647,7 @@ class ApiRequester {
2647
2647
  return newParse(response, isJson);
2648
2648
  }).catch(error => {
2649
2649
  if (this.shouldLogErrors) {
2650
- logger$1.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
2650
+ logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
2651
2651
  }
2652
2652
 
2653
2653
  throw error;
@@ -2675,13 +2675,13 @@ class ApiRequester {
2675
2675
  ) {
2676
2676
  const isTokenNotFound = this._isTokenNotFound(err);
2677
2677
  let newPath = path;
2678
- logger$1.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
2678
+ logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
2679
2679
 
2680
2680
  this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
2681
2681
 
2682
2682
  return this.refreshTokenPromise.then(() => {
2683
2683
  this.refreshTokenPromise = null;
2684
- logger$1.info('token refreshed', { isTokenNotFound });
2684
+ logger.info('token refreshed', { isTokenNotFound });
2685
2685
  if (isTokenNotFound) {
2686
2686
  const pathParts = path.split('/');
2687
2687
  pathParts.pop();
@@ -3151,8 +3151,9 @@ class ExternalApp {
3151
3151
 
3152
3152
 
3153
3153
 
3154
-
3154
+
3155
3155
 
3156
+
3156
3157
 
3157
3158
 
3158
3159
  class Meeting {
@@ -3163,9 +3164,10 @@ class Meeting {
3163
3164
 
3164
3165
 
3165
3166
 
3166
-
3167
+
3167
3168
 
3168
3169
 
3170
+
3169
3171
 
3170
3172
  static parse(plain ) {
3171
3173
  return new Meeting({
@@ -3175,8 +3177,9 @@ class Meeting {
3175
3177
  ownerUuids: plain.owner_uuids,
3176
3178
  port: plain.port,
3177
3179
  uuid: plain.uuid,
3178
- number: plain.number,
3180
+ extension: plain.exten,
3179
3181
  persistent: plain.persistent,
3182
+ creationTime: moment__default['default'](plain.creation_time).toDate(),
3180
3183
  });
3181
3184
  }
3182
3185
 
@@ -3198,8 +3201,9 @@ class Meeting {
3198
3201
  ownerUuids,
3199
3202
  port,
3200
3203
  uri,
3201
- number,
3204
+ extension,
3202
3205
  persistent,
3206
+ creationTime,
3203
3207
  } = {}) {
3204
3208
  this.guestSipAuthorization = guestSipAuthorization;
3205
3209
  this.uri = uri;
@@ -3207,8 +3211,9 @@ class Meeting {
3207
3211
  this.ownerUuids = ownerUuids;
3208
3212
  this.port = port;
3209
3213
  this.uuid = uuid;
3210
- this.number = number;
3214
+ this.extension = extension;
3211
3215
  this.persistent = persistent;
3216
+ this.creationTime = creationTime;
3212
3217
 
3213
3218
  // Useful to compare instead of instanceof with minified code
3214
3219
  this.type = 'Meeting';
@@ -3513,7 +3518,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
3513
3518
 
3514
3519
  // const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
3515
3520
 
3516
- IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
3521
+ const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
3517
3522
 
3518
3523
  /* */
3519
3524
 
@@ -4500,7 +4505,7 @@ const AGENTD_VERSION = '1.0';
4500
4505
  const WEBHOOKD_VERSION = '1.0';
4501
4506
  const AMID_VERSION = '1.0';
4502
4507
 
4503
- const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
4508
+ const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
4504
4509
 
4505
4510
  class ApiClient {
4506
4511
 
@@ -4552,12 +4557,12 @@ class ApiClient {
4552
4557
  }
4553
4558
 
4554
4559
  async forceRefreshToken() {
4555
- logger.info('forcing refresh token, calling callback');
4560
+ logger$2.info('forcing refresh token, calling callback');
4556
4561
  return this.refreshTokenCallback();
4557
4562
  }
4558
4563
 
4559
4564
  async refreshTokenCallback() {
4560
- logger.info('refresh token callback called', {
4565
+ logger$2.info('refresh token callback called', {
4561
4566
  refreshToken: this.refreshToken,
4562
4567
  refreshBackend: this.refreshBackend,
4563
4568
  refreshExpiration: this.refreshExpiration,
@@ -4575,7 +4580,7 @@ class ApiClient {
4575
4580
  this.isMobile,
4576
4581
  );
4577
4582
 
4578
- logger.info('token refreshed', { token: session.token });
4583
+ logger$2.info('token refreshed', { token: session.token });
4579
4584
 
4580
4585
  if (this.onRefreshToken) {
4581
4586
  this.onRefreshToken(session.token, session);
@@ -13,7 +13,7 @@ const isMobile = () => typeof navigator !== 'undefined' && navigator.product ===
13
13
 
14
14
  /* */
15
15
 
16
- IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
16
+ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
17
17
 
18
18
  // Use a function here to be able to mock it in tests
19
19
  const realFetch = () => {
@@ -13,7 +13,7 @@ const isMobile = () => typeof navigator !== 'undefined' && navigator.product ===
13
13
 
14
14
  /* */
15
15
 
16
- IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
16
+ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
17
17
 
18
18
  // Use a function here to be able to mock it in tests
19
19
  const realFetch = () => {
@@ -448,7 +448,7 @@ var IssueReporter$1 = new IssueReporter();
448
448
 
449
449
  const methods = ['head', 'get', 'post', 'put', 'delete'];
450
450
 
451
- const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
451
+ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
452
452
 
453
453
  // Use a function here to be able to mock it in tests
454
454
  const realFetch = () => {
@@ -587,7 +587,7 @@ class ApiRequester {
587
587
  };
588
588
 
589
589
  if (this.refreshTokenPromise) {
590
- logger$1.info('A token is already refreshing, waiting ...', { url });
590
+ logger.info('A token is already refreshing, waiting ...', { url });
591
591
  await this.refreshTokenPromise;
592
592
  }
593
593
 
@@ -607,7 +607,7 @@ class ApiRequester {
607
607
  return promise.then(async (err ) => {
608
608
  // Check if the token is still valid
609
609
  if (firstCall && this._checkTokenExpired(response, err)) {
610
- logger$1.warn('token expired', { error: err.reason });
610
+ logger.warn('token expired', { error: err.reason });
611
611
  // Replay the call after refreshing the token
612
612
  return this._replayWithNewToken(err, path, method, body, headers, parse);
613
613
  }
@@ -617,7 +617,7 @@ class ApiRequester {
617
617
  : exceptionClass.fromResponse(err, response.status);
618
618
 
619
619
  if (this.shouldLogErrors) {
620
- logger$1.error('API error', error);
620
+ logger.error('API error', error);
621
621
  }
622
622
 
623
623
  throw error;
@@ -627,7 +627,7 @@ class ApiRequester {
627
627
  return newParse(response, isJson);
628
628
  }).catch(error => {
629
629
  if (this.shouldLogErrors) {
630
- logger$1.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
630
+ logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
631
631
  }
632
632
 
633
633
  throw error;
@@ -655,13 +655,13 @@ class ApiRequester {
655
655
  ) {
656
656
  const isTokenNotFound = this._isTokenNotFound(err);
657
657
  let newPath = path;
658
- logger$1.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
658
+ logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
659
659
 
660
660
  this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
661
661
 
662
662
  return this.refreshTokenPromise.then(() => {
663
663
  this.refreshTokenPromise = null;
664
- logger$1.info('token refreshed', { isTokenNotFound });
664
+ logger.info('token refreshed', { isTokenNotFound });
665
665
  if (isTokenNotFound) {
666
666
  const pathParts = path.split('/');
667
667
  pathParts.pop();
@@ -2619,8 +2619,9 @@ class ExternalApp {
2619
2619
 
2620
2620
 
2621
2621
 
2622
-
2622
+
2623
2623
 
2624
+
2624
2625
 
2625
2626
 
2626
2627
  class Meeting {
@@ -2631,9 +2632,10 @@ class Meeting {
2631
2632
 
2632
2633
 
2633
2634
 
2634
-
2635
+
2635
2636
 
2636
2637
 
2638
+
2637
2639
 
2638
2640
  static parse(plain ) {
2639
2641
  return new Meeting({
@@ -2643,8 +2645,9 @@ class Meeting {
2643
2645
  ownerUuids: plain.owner_uuids,
2644
2646
  port: plain.port,
2645
2647
  uuid: plain.uuid,
2646
- number: plain.number,
2648
+ extension: plain.exten,
2647
2649
  persistent: plain.persistent,
2650
+ creationTime: moment__default['default'](plain.creation_time).toDate(),
2648
2651
  });
2649
2652
  }
2650
2653
 
@@ -2666,8 +2669,9 @@ class Meeting {
2666
2669
  ownerUuids,
2667
2670
  port,
2668
2671
  uri,
2669
- number,
2672
+ extension,
2670
2673
  persistent,
2674
+ creationTime,
2671
2675
  } = {}) {
2672
2676
  this.guestSipAuthorization = guestSipAuthorization;
2673
2677
  this.uri = uri;
@@ -2675,8 +2679,9 @@ class Meeting {
2675
2679
  this.ownerUuids = ownerUuids;
2676
2680
  this.port = port;
2677
2681
  this.uuid = uuid;
2678
- this.number = number;
2682
+ this.extension = extension;
2679
2683
  this.persistent = persistent;
2684
+ this.creationTime = creationTime;
2680
2685
 
2681
2686
  // Useful to compare instead of instanceof with minified code
2682
2687
  this.type = 'Meeting';
@@ -3583,7 +3588,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
3583
3588
 
3584
3589
  // const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
3585
3590
 
3586
- IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
3591
+ const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
3587
3592
 
3588
3593
  /* */
3589
3594
 
@@ -4502,7 +4507,7 @@ const AGENTD_VERSION = '1.0';
4502
4507
  const WEBHOOKD_VERSION = '1.0';
4503
4508
  const AMID_VERSION = '1.0';
4504
4509
 
4505
- const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
4510
+ const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
4506
4511
 
4507
4512
  class ApiClient {
4508
4513
 
@@ -4554,12 +4559,12 @@ class ApiClient {
4554
4559
  }
4555
4560
 
4556
4561
  async forceRefreshToken() {
4557
- logger.info('forcing refresh token, calling callback');
4562
+ logger$2.info('forcing refresh token, calling callback');
4558
4563
  return this.refreshTokenCallback();
4559
4564
  }
4560
4565
 
4561
4566
  async refreshTokenCallback() {
4562
- logger.info('refresh token callback called', {
4567
+ logger$2.info('refresh token callback called', {
4563
4568
  refreshToken: this.refreshToken,
4564
4569
  refreshBackend: this.refreshBackend,
4565
4570
  refreshExpiration: this.refreshExpiration,
@@ -4577,7 +4582,7 @@ class ApiClient {
4577
4582
  this.isMobile,
4578
4583
  );
4579
4584
 
4580
- logger.info('token refreshed', { token: session.token });
4585
+ logger$2.info('token refreshed', { token: session.token });
4581
4586
 
4582
4587
  if (this.onRefreshToken) {
4583
4588
  this.onRefreshToken(session.token, session);