@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.
- package/dist/wazo-sdk.js +6 -6
- package/esm/__tests__/api-client.test.js +22 -17
- package/esm/__tests__/web-rtc-client.test.js +105 -100
- package/esm/api/amid.js +1 -1
- package/esm/api/call-logd.js +2 -2
- package/esm/api/confd.js +10 -5
- package/esm/api/ctid-ng.js +3 -3
- package/esm/api/dird.js +1 -1
- package/esm/api/webhookd.js +1 -1
- package/esm/api-client.js +22 -17
- package/esm/checker/Checker.js +130 -125
- package/esm/checker/checks/aor.js +22 -17
- package/esm/checker/checks/api.js +22 -17
- package/esm/checker/checks/index.js +120 -115
- package/esm/checker/checks/wazo-websocket.js +15 -15
- package/esm/checker/checks/webrtc-transport.js +105 -100
- package/esm/checker/checks/webrtc.js +105 -100
- package/esm/domain/AdHocAPIConference.js +22 -17
- package/esm/domain/CallLog.js +1 -1
- package/esm/domain/Contact.js +1 -1
- package/esm/domain/Features.js +22 -17
- package/esm/domain/Meeting.js +12 -5
- package/esm/domain/Phone/CTIPhone.js +36 -31
- package/esm/domain/Phone/WebRTCPhone.js +110 -87
- package/esm/domain/__tests__/CallLog.test.js +1 -1
- package/esm/domain/__tests__/Contact.test.js +1 -1
- package/esm/domain/__tests__/Meeting.test.js +144 -0
- package/esm/index.js +365 -337
- package/esm/lib/WazoSessionDescriptionHandler.js +1 -1
- package/esm/service/CallApi.js +22 -17
- package/esm/service/IssueReporter.js +1 -1
- package/esm/service/__tests__/IssueReporter.test.js +1 -1
- package/esm/service/getApiClient.js +22 -17
- package/esm/simple/Auth.js +355 -327
- package/esm/simple/Configuration.js +355 -327
- package/esm/simple/Directory.js +22 -17
- package/esm/simple/Phone.js +355 -327
- package/esm/simple/Websocket.js +17 -17
- package/esm/simple/index.js +359 -331
- package/esm/simple/room/LocalParticipant.js +359 -331
- package/esm/simple/room/Participant.js +359 -331
- package/esm/simple/room/RemoteParticipant.js +359 -331
- package/esm/simple/room/Room.js +360 -332
- package/esm/simple/room/SipRoom.js +359 -331
- package/esm/simple/room/Stream.js +359 -331
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +359 -331
- package/esm/simple/utils.js +359 -331
- package/esm/types/WebSocketMessage.js +1 -1
- package/esm/web-rtc-client.js +105 -100
- package/esm/websocket-client.js +15 -15
- package/lib/__tests__/api-client.test.js +22 -17
- package/lib/__tests__/web-rtc-client.test.js +105 -100
- package/lib/api/amid.js +1 -1
- package/lib/api/call-logd.js +2 -2
- package/lib/api/confd.js +10 -5
- package/lib/api/ctid-ng.js +3 -3
- package/lib/api/dird.js +1 -1
- package/lib/api/webhookd.js +1 -1
- package/lib/api-client.js +22 -17
- package/lib/checker/Checker.js +130 -125
- package/lib/checker/checks/aor.js +22 -17
- package/lib/checker/checks/api.js +22 -17
- package/lib/checker/checks/index.js +120 -115
- package/lib/checker/checks/wazo-websocket.js +15 -15
- package/lib/checker/checks/webrtc-transport.js +105 -100
- package/lib/checker/checks/webrtc.js +105 -100
- package/lib/domain/AdHocAPIConference.js +22 -17
- package/lib/domain/CallLog.js +1 -1
- package/lib/domain/Contact.js +1 -1
- package/lib/domain/Features.js +22 -17
- package/lib/domain/Meeting.js +16 -5
- package/lib/domain/Phone/CTIPhone.js +36 -31
- package/lib/domain/Phone/WebRTCPhone.js +110 -87
- package/lib/domain/__tests__/CallLog.test.js +1 -1
- package/lib/domain/__tests__/Contact.test.js +1 -1
- package/lib/domain/__tests__/Meeting.test.js +150 -0
- package/lib/index.js +365 -337
- package/lib/lib/WazoSessionDescriptionHandler.js +1 -1
- package/lib/service/CallApi.js +22 -17
- package/lib/service/IssueReporter.js +1 -1
- package/lib/service/__tests__/IssueReporter.test.js +1 -1
- package/lib/service/getApiClient.js +22 -17
- package/lib/simple/Auth.js +355 -327
- package/lib/simple/Configuration.js +355 -327
- package/lib/simple/Directory.js +22 -17
- package/lib/simple/Phone.js +355 -327
- package/lib/simple/Websocket.js +17 -17
- package/lib/simple/index.js +359 -331
- package/lib/simple/room/LocalParticipant.js +359 -331
- package/lib/simple/room/Participant.js +359 -331
- package/lib/simple/room/RemoteParticipant.js +359 -331
- package/lib/simple/room/Room.js +360 -332
- package/lib/simple/room/SipRoom.js +359 -331
- package/lib/simple/room/Stream.js +359 -331
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +359 -331
- package/lib/simple/utils.js +359 -331
- package/lib/types/WebSocketMessage.js +2 -0
- package/lib/web-rtc-client.js +105 -100
- package/lib/websocket-client.js +15 -15
- package/package.json +1 -1
- package/src/domain/Meeting.js +12 -5
- package/src/domain/Phone/WebRTCPhone.js +24 -1
- package/src/domain/__tests__/Meeting.test.js +50 -0
package/lib/simple/Directory.js
CHANGED
|
@@ -446,7 +446,7 @@ var IssueReporter$1 = new IssueReporter();
|
|
|
446
446
|
|
|
447
447
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
448
448
|
|
|
449
|
-
const logger
|
|
449
|
+
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
450
450
|
|
|
451
451
|
// Use a function here to be able to mock it in tests
|
|
452
452
|
const realFetch = () => {
|
|
@@ -585,7 +585,7 @@ class ApiRequester {
|
|
|
585
585
|
};
|
|
586
586
|
|
|
587
587
|
if (this.refreshTokenPromise) {
|
|
588
|
-
logger
|
|
588
|
+
logger.info('A token is already refreshing, waiting ...', { url });
|
|
589
589
|
await this.refreshTokenPromise;
|
|
590
590
|
}
|
|
591
591
|
|
|
@@ -605,7 +605,7 @@ class ApiRequester {
|
|
|
605
605
|
return promise.then(async (err ) => {
|
|
606
606
|
// Check if the token is still valid
|
|
607
607
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
608
|
-
logger
|
|
608
|
+
logger.warn('token expired', { error: err.reason });
|
|
609
609
|
// Replay the call after refreshing the token
|
|
610
610
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
611
611
|
}
|
|
@@ -615,7 +615,7 @@ class ApiRequester {
|
|
|
615
615
|
: exceptionClass.fromResponse(err, response.status);
|
|
616
616
|
|
|
617
617
|
if (this.shouldLogErrors) {
|
|
618
|
-
logger
|
|
618
|
+
logger.error('API error', error);
|
|
619
619
|
}
|
|
620
620
|
|
|
621
621
|
throw error;
|
|
@@ -625,7 +625,7 @@ class ApiRequester {
|
|
|
625
625
|
return newParse(response, isJson);
|
|
626
626
|
}).catch(error => {
|
|
627
627
|
if (this.shouldLogErrors) {
|
|
628
|
-
logger
|
|
628
|
+
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
629
629
|
}
|
|
630
630
|
|
|
631
631
|
throw error;
|
|
@@ -653,13 +653,13 @@ class ApiRequester {
|
|
|
653
653
|
) {
|
|
654
654
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
655
655
|
let newPath = path;
|
|
656
|
-
logger
|
|
656
|
+
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
657
657
|
|
|
658
658
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
659
659
|
|
|
660
660
|
return this.refreshTokenPromise.then(() => {
|
|
661
661
|
this.refreshTokenPromise = null;
|
|
662
|
-
logger
|
|
662
|
+
logger.info('token refreshed', { isTokenNotFound });
|
|
663
663
|
if (isTokenNotFound) {
|
|
664
664
|
const pathParts = path.split('/');
|
|
665
665
|
pathParts.pop();
|
|
@@ -2617,8 +2617,9 @@ class ExternalApp {
|
|
|
2617
2617
|
|
|
2618
2618
|
|
|
2619
2619
|
|
|
2620
|
-
|
|
2620
|
+
|
|
2621
2621
|
|
|
2622
|
+
|
|
2622
2623
|
|
|
2623
2624
|
|
|
2624
2625
|
class Meeting {
|
|
@@ -2629,9 +2630,10 @@ class Meeting {
|
|
|
2629
2630
|
|
|
2630
2631
|
|
|
2631
2632
|
|
|
2632
|
-
|
|
2633
|
+
|
|
2633
2634
|
|
|
2634
2635
|
|
|
2636
|
+
|
|
2635
2637
|
|
|
2636
2638
|
static parse(plain ) {
|
|
2637
2639
|
return new Meeting({
|
|
@@ -2641,8 +2643,9 @@ class Meeting {
|
|
|
2641
2643
|
ownerUuids: plain.owner_uuids,
|
|
2642
2644
|
port: plain.port,
|
|
2643
2645
|
uuid: plain.uuid,
|
|
2644
|
-
|
|
2646
|
+
extension: plain.exten,
|
|
2645
2647
|
persistent: plain.persistent,
|
|
2648
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
2646
2649
|
});
|
|
2647
2650
|
}
|
|
2648
2651
|
|
|
@@ -2664,8 +2667,9 @@ class Meeting {
|
|
|
2664
2667
|
ownerUuids,
|
|
2665
2668
|
port,
|
|
2666
2669
|
uri,
|
|
2667
|
-
|
|
2670
|
+
extension,
|
|
2668
2671
|
persistent,
|
|
2672
|
+
creationTime,
|
|
2669
2673
|
} = {}) {
|
|
2670
2674
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2671
2675
|
this.uri = uri;
|
|
@@ -2673,8 +2677,9 @@ class Meeting {
|
|
|
2673
2677
|
this.ownerUuids = ownerUuids;
|
|
2674
2678
|
this.port = port;
|
|
2675
2679
|
this.uuid = uuid;
|
|
2676
|
-
this.
|
|
2680
|
+
this.extension = extension;
|
|
2677
2681
|
this.persistent = persistent;
|
|
2682
|
+
this.creationTime = creationTime;
|
|
2678
2683
|
|
|
2679
2684
|
// Useful to compare instead of instanceof with minified code
|
|
2680
2685
|
this.type = 'Meeting';
|
|
@@ -3581,7 +3586,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
|
|
|
3581
3586
|
|
|
3582
3587
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
3583
3588
|
|
|
3584
|
-
IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
3589
|
+
const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
3585
3590
|
|
|
3586
3591
|
/* */
|
|
3587
3592
|
|
|
@@ -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);
|