@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
@@ -11,7 +11,7 @@ const isMobile = () => typeof navigator !== 'undefined' && navigator.product ===
11
11
 
12
12
  /* */
13
13
 
14
- IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
14
+ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
15
15
 
16
16
  // Use a function here to be able to mock it in tests
17
17
  const realFetch = () => {
@@ -2462,7 +2462,7 @@ var IssueReporter$1 = new IssueReporter();
2462
2462
 
2463
2463
  const methods = ['head', 'get', 'post', 'put', 'delete'];
2464
2464
 
2465
- const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
2465
+ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
2466
2466
 
2467
2467
  // Use a function here to be able to mock it in tests
2468
2468
  const realFetch = () => {
@@ -2601,7 +2601,7 @@ class ApiRequester {
2601
2601
  };
2602
2602
 
2603
2603
  if (this.refreshTokenPromise) {
2604
- logger$1.info('A token is already refreshing, waiting ...', { url });
2604
+ logger.info('A token is already refreshing, waiting ...', { url });
2605
2605
  await this.refreshTokenPromise;
2606
2606
  }
2607
2607
 
@@ -2621,7 +2621,7 @@ class ApiRequester {
2621
2621
  return promise.then(async (err ) => {
2622
2622
  // Check if the token is still valid
2623
2623
  if (firstCall && this._checkTokenExpired(response, err)) {
2624
- logger$1.warn('token expired', { error: err.reason });
2624
+ logger.warn('token expired', { error: err.reason });
2625
2625
  // Replay the call after refreshing the token
2626
2626
  return this._replayWithNewToken(err, path, method, body, headers, parse);
2627
2627
  }
@@ -2631,7 +2631,7 @@ class ApiRequester {
2631
2631
  : exceptionClass.fromResponse(err, response.status);
2632
2632
 
2633
2633
  if (this.shouldLogErrors) {
2634
- logger$1.error('API error', error);
2634
+ logger.error('API error', error);
2635
2635
  }
2636
2636
 
2637
2637
  throw error;
@@ -2641,7 +2641,7 @@ class ApiRequester {
2641
2641
  return newParse(response, isJson);
2642
2642
  }).catch(error => {
2643
2643
  if (this.shouldLogErrors) {
2644
- logger$1.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
2644
+ logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
2645
2645
  }
2646
2646
 
2647
2647
  throw error;
@@ -2669,13 +2669,13 @@ class ApiRequester {
2669
2669
  ) {
2670
2670
  const isTokenNotFound = this._isTokenNotFound(err);
2671
2671
  let newPath = path;
2672
- logger$1.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
2672
+ logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
2673
2673
 
2674
2674
  this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
2675
2675
 
2676
2676
  return this.refreshTokenPromise.then(() => {
2677
2677
  this.refreshTokenPromise = null;
2678
- logger$1.info('token refreshed', { isTokenNotFound });
2678
+ logger.info('token refreshed', { isTokenNotFound });
2679
2679
  if (isTokenNotFound) {
2680
2680
  const pathParts = path.split('/');
2681
2681
  pathParts.pop();
@@ -3145,8 +3145,9 @@ class ExternalApp {
3145
3145
 
3146
3146
 
3147
3147
 
3148
-
3148
+
3149
3149
 
3150
+
3150
3151
 
3151
3152
 
3152
3153
  class Meeting {
@@ -3157,9 +3158,10 @@ class Meeting {
3157
3158
 
3158
3159
 
3159
3160
 
3160
-
3161
+
3161
3162
 
3162
3163
 
3164
+
3163
3165
 
3164
3166
  static parse(plain ) {
3165
3167
  return new Meeting({
@@ -3169,8 +3171,9 @@ class Meeting {
3169
3171
  ownerUuids: plain.owner_uuids,
3170
3172
  port: plain.port,
3171
3173
  uuid: plain.uuid,
3172
- number: plain.number,
3174
+ extension: plain.exten,
3173
3175
  persistent: plain.persistent,
3176
+ creationTime: moment(plain.creation_time).toDate(),
3174
3177
  });
3175
3178
  }
3176
3179
 
@@ -3192,8 +3195,9 @@ class Meeting {
3192
3195
  ownerUuids,
3193
3196
  port,
3194
3197
  uri,
3195
- number,
3198
+ extension,
3196
3199
  persistent,
3200
+ creationTime,
3197
3201
  } = {}) {
3198
3202
  this.guestSipAuthorization = guestSipAuthorization;
3199
3203
  this.uri = uri;
@@ -3201,8 +3205,9 @@ class Meeting {
3201
3205
  this.ownerUuids = ownerUuids;
3202
3206
  this.port = port;
3203
3207
  this.uuid = uuid;
3204
- this.number = number;
3208
+ this.extension = extension;
3205
3209
  this.persistent = persistent;
3210
+ this.creationTime = creationTime;
3206
3211
 
3207
3212
  // Useful to compare instead of instanceof with minified code
3208
3213
  this.type = 'Meeting';
@@ -3507,7 +3512,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
3507
3512
 
3508
3513
  // const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
3509
3514
 
3510
- IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
3515
+ const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
3511
3516
 
3512
3517
  /* */
3513
3518
 
@@ -4494,7 +4499,7 @@ const AGENTD_VERSION = '1.0';
4494
4499
  const WEBHOOKD_VERSION = '1.0';
4495
4500
  const AMID_VERSION = '1.0';
4496
4501
 
4497
- const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
4502
+ const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
4498
4503
 
4499
4504
  class ApiClient {
4500
4505
 
@@ -4546,12 +4551,12 @@ class ApiClient {
4546
4551
  }
4547
4552
 
4548
4553
  async forceRefreshToken() {
4549
- logger.info('forcing refresh token, calling callback');
4554
+ logger$2.info('forcing refresh token, calling callback');
4550
4555
  return this.refreshTokenCallback();
4551
4556
  }
4552
4557
 
4553
4558
  async refreshTokenCallback() {
4554
- logger.info('refresh token callback called', {
4559
+ logger$2.info('refresh token callback called', {
4555
4560
  refreshToken: this.refreshToken,
4556
4561
  refreshBackend: this.refreshBackend,
4557
4562
  refreshExpiration: this.refreshExpiration,
@@ -4569,7 +4574,7 @@ class ApiClient {
4569
4574
  this.isMobile,
4570
4575
  );
4571
4576
 
4572
- logger.info('token refreshed', { token: session.token });
4577
+ logger$2.info('token refreshed', { token: session.token });
4573
4578
 
4574
4579
  if (this.onRefreshToken) {
4575
4580
  this.onRefreshToken(session.token, session);
@@ -7,7 +7,7 @@ const isMobile = () => typeof navigator !== 'undefined' && navigator.product ===
7
7
 
8
8
  /* */
9
9
 
10
- IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
10
+ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
11
11
 
12
12
  // Use a function here to be able to mock it in tests
13
13
  const realFetch = () => {
@@ -7,7 +7,7 @@ const isMobile = () => typeof navigator !== 'undefined' && navigator.product ===
7
7
 
8
8
  /* */
9
9
 
10
- IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
10
+ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
11
11
 
12
12
  // Use a function here to be able to mock it in tests
13
13
  const realFetch = () => {
@@ -440,7 +440,7 @@ var IssueReporter$1 = new IssueReporter();
440
440
 
441
441
  const methods = ['head', 'get', 'post', 'put', 'delete'];
442
442
 
443
- const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
443
+ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
444
444
 
445
445
  // Use a function here to be able to mock it in tests
446
446
  const realFetch = () => {
@@ -579,7 +579,7 @@ class ApiRequester {
579
579
  };
580
580
 
581
581
  if (this.refreshTokenPromise) {
582
- logger$1.info('A token is already refreshing, waiting ...', { url });
582
+ logger.info('A token is already refreshing, waiting ...', { url });
583
583
  await this.refreshTokenPromise;
584
584
  }
585
585
 
@@ -599,7 +599,7 @@ class ApiRequester {
599
599
  return promise.then(async (err ) => {
600
600
  // Check if the token is still valid
601
601
  if (firstCall && this._checkTokenExpired(response, err)) {
602
- logger$1.warn('token expired', { error: err.reason });
602
+ logger.warn('token expired', { error: err.reason });
603
603
  // Replay the call after refreshing the token
604
604
  return this._replayWithNewToken(err, path, method, body, headers, parse);
605
605
  }
@@ -609,7 +609,7 @@ class ApiRequester {
609
609
  : exceptionClass.fromResponse(err, response.status);
610
610
 
611
611
  if (this.shouldLogErrors) {
612
- logger$1.error('API error', error);
612
+ logger.error('API error', error);
613
613
  }
614
614
 
615
615
  throw error;
@@ -619,7 +619,7 @@ class ApiRequester {
619
619
  return newParse(response, isJson);
620
620
  }).catch(error => {
621
621
  if (this.shouldLogErrors) {
622
- logger$1.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
622
+ logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
623
623
  }
624
624
 
625
625
  throw error;
@@ -647,13 +647,13 @@ class ApiRequester {
647
647
  ) {
648
648
  const isTokenNotFound = this._isTokenNotFound(err);
649
649
  let newPath = path;
650
- logger$1.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
650
+ logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
651
651
 
652
652
  this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
653
653
 
654
654
  return this.refreshTokenPromise.then(() => {
655
655
  this.refreshTokenPromise = null;
656
- logger$1.info('token refreshed', { isTokenNotFound });
656
+ logger.info('token refreshed', { isTokenNotFound });
657
657
  if (isTokenNotFound) {
658
658
  const pathParts = path.split('/');
659
659
  pathParts.pop();
@@ -2611,8 +2611,9 @@ class ExternalApp {
2611
2611
 
2612
2612
 
2613
2613
 
2614
-
2614
+
2615
2615
 
2616
+
2616
2617
 
2617
2618
 
2618
2619
  class Meeting {
@@ -2623,9 +2624,10 @@ class Meeting {
2623
2624
 
2624
2625
 
2625
2626
 
2626
-
2627
+
2627
2628
 
2628
2629
 
2630
+
2629
2631
 
2630
2632
  static parse(plain ) {
2631
2633
  return new Meeting({
@@ -2635,8 +2637,9 @@ class Meeting {
2635
2637
  ownerUuids: plain.owner_uuids,
2636
2638
  port: plain.port,
2637
2639
  uuid: plain.uuid,
2638
- number: plain.number,
2640
+ extension: plain.exten,
2639
2641
  persistent: plain.persistent,
2642
+ creationTime: moment(plain.creation_time).toDate(),
2640
2643
  });
2641
2644
  }
2642
2645
 
@@ -2658,8 +2661,9 @@ class Meeting {
2658
2661
  ownerUuids,
2659
2662
  port,
2660
2663
  uri,
2661
- number,
2664
+ extension,
2662
2665
  persistent,
2666
+ creationTime,
2663
2667
  } = {}) {
2664
2668
  this.guestSipAuthorization = guestSipAuthorization;
2665
2669
  this.uri = uri;
@@ -2667,8 +2671,9 @@ class Meeting {
2667
2671
  this.ownerUuids = ownerUuids;
2668
2672
  this.port = port;
2669
2673
  this.uuid = uuid;
2670
- this.number = number;
2674
+ this.extension = extension;
2671
2675
  this.persistent = persistent;
2676
+ this.creationTime = creationTime;
2672
2677
 
2673
2678
  // Useful to compare instead of instanceof with minified code
2674
2679
  this.type = 'Meeting';
@@ -3575,7 +3580,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
3575
3580
 
3576
3581
  // const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
3577
3582
 
3578
- IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
3583
+ const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
3579
3584
 
3580
3585
  /* */
3581
3586
 
@@ -4494,7 +4499,7 @@ const AGENTD_VERSION = '1.0';
4494
4499
  const WEBHOOKD_VERSION = '1.0';
4495
4500
  const AMID_VERSION = '1.0';
4496
4501
 
4497
- const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
4502
+ const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
4498
4503
 
4499
4504
  class ApiClient {
4500
4505
 
@@ -4546,12 +4551,12 @@ class ApiClient {
4546
4551
  }
4547
4552
 
4548
4553
  async forceRefreshToken() {
4549
- logger.info('forcing refresh token, calling callback');
4554
+ logger$2.info('forcing refresh token, calling callback');
4550
4555
  return this.refreshTokenCallback();
4551
4556
  }
4552
4557
 
4553
4558
  async refreshTokenCallback() {
4554
- logger.info('refresh token callback called', {
4559
+ logger$2.info('refresh token callback called', {
4555
4560
  refreshToken: this.refreshToken,
4556
4561
  refreshBackend: this.refreshBackend,
4557
4562
  refreshExpiration: this.refreshExpiration,
@@ -4569,7 +4574,7 @@ class ApiClient {
4569
4574
  this.isMobile,
4570
4575
  );
4571
4576
 
4572
- logger.info('token refreshed', { token: session.token });
4577
+ logger$2.info('token refreshed', { token: session.token });
4573
4578
 
4574
4579
  if (this.onRefreshToken) {
4575
4580
  this.onRefreshToken(session.token, session);