@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
|
@@ -660,7 +660,7 @@ var IssueReporter$1 = new IssueReporter();
|
|
|
660
660
|
|
|
661
661
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
662
662
|
|
|
663
|
-
const logger
|
|
663
|
+
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
664
664
|
|
|
665
665
|
// Use a function here to be able to mock it in tests
|
|
666
666
|
const realFetch = () => {
|
|
@@ -799,7 +799,7 @@ class ApiRequester {
|
|
|
799
799
|
};
|
|
800
800
|
|
|
801
801
|
if (this.refreshTokenPromise) {
|
|
802
|
-
logger
|
|
802
|
+
logger.info('A token is already refreshing, waiting ...', { url });
|
|
803
803
|
await this.refreshTokenPromise;
|
|
804
804
|
}
|
|
805
805
|
|
|
@@ -819,7 +819,7 @@ class ApiRequester {
|
|
|
819
819
|
return promise.then(async (err ) => {
|
|
820
820
|
// Check if the token is still valid
|
|
821
821
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
822
|
-
logger
|
|
822
|
+
logger.warn('token expired', { error: err.reason });
|
|
823
823
|
// Replay the call after refreshing the token
|
|
824
824
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
825
825
|
}
|
|
@@ -829,7 +829,7 @@ class ApiRequester {
|
|
|
829
829
|
: exceptionClass.fromResponse(err, response.status);
|
|
830
830
|
|
|
831
831
|
if (this.shouldLogErrors) {
|
|
832
|
-
logger
|
|
832
|
+
logger.error('API error', error);
|
|
833
833
|
}
|
|
834
834
|
|
|
835
835
|
throw error;
|
|
@@ -839,7 +839,7 @@ class ApiRequester {
|
|
|
839
839
|
return newParse(response, isJson);
|
|
840
840
|
}).catch(error => {
|
|
841
841
|
if (this.shouldLogErrors) {
|
|
842
|
-
logger
|
|
842
|
+
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
843
843
|
}
|
|
844
844
|
|
|
845
845
|
throw error;
|
|
@@ -867,13 +867,13 @@ class ApiRequester {
|
|
|
867
867
|
) {
|
|
868
868
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
869
869
|
let newPath = path;
|
|
870
|
-
logger
|
|
870
|
+
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
871
871
|
|
|
872
872
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
873
873
|
|
|
874
874
|
return this.refreshTokenPromise.then(() => {
|
|
875
875
|
this.refreshTokenPromise = null;
|
|
876
|
-
logger
|
|
876
|
+
logger.info('token refreshed', { isTokenNotFound });
|
|
877
877
|
if (isTokenNotFound) {
|
|
878
878
|
const pathParts = path.split('/');
|
|
879
879
|
pathParts.pop();
|
|
@@ -2820,8 +2820,9 @@ class ExternalApp {
|
|
|
2820
2820
|
|
|
2821
2821
|
|
|
2822
2822
|
|
|
2823
|
-
|
|
2823
|
+
|
|
2824
2824
|
|
|
2825
|
+
|
|
2825
2826
|
|
|
2826
2827
|
|
|
2827
2828
|
class Meeting {
|
|
@@ -2832,9 +2833,10 @@ class Meeting {
|
|
|
2832
2833
|
|
|
2833
2834
|
|
|
2834
2835
|
|
|
2835
|
-
|
|
2836
|
+
|
|
2836
2837
|
|
|
2837
2838
|
|
|
2839
|
+
|
|
2838
2840
|
|
|
2839
2841
|
static parse(plain ) {
|
|
2840
2842
|
return new Meeting({
|
|
@@ -2844,8 +2846,9 @@ class Meeting {
|
|
|
2844
2846
|
ownerUuids: plain.owner_uuids,
|
|
2845
2847
|
port: plain.port,
|
|
2846
2848
|
uuid: plain.uuid,
|
|
2847
|
-
|
|
2849
|
+
extension: plain.exten,
|
|
2848
2850
|
persistent: plain.persistent,
|
|
2851
|
+
creationTime: moment(plain.creation_time).toDate(),
|
|
2849
2852
|
});
|
|
2850
2853
|
}
|
|
2851
2854
|
|
|
@@ -2867,8 +2870,9 @@ class Meeting {
|
|
|
2867
2870
|
ownerUuids,
|
|
2868
2871
|
port,
|
|
2869
2872
|
uri,
|
|
2870
|
-
|
|
2873
|
+
extension,
|
|
2871
2874
|
persistent,
|
|
2875
|
+
creationTime,
|
|
2872
2876
|
} = {}) {
|
|
2873
2877
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2874
2878
|
this.uri = uri;
|
|
@@ -2876,8 +2880,9 @@ class Meeting {
|
|
|
2876
2880
|
this.ownerUuids = ownerUuids;
|
|
2877
2881
|
this.port = port;
|
|
2878
2882
|
this.uuid = uuid;
|
|
2879
|
-
this.
|
|
2883
|
+
this.extension = extension;
|
|
2880
2884
|
this.persistent = persistent;
|
|
2885
|
+
this.creationTime = creationTime;
|
|
2881
2886
|
|
|
2882
2887
|
// Useful to compare instead of instanceof with minified code
|
|
2883
2888
|
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);
|
package/esm/domain/CallLog.js
CHANGED
package/esm/domain/Contact.js
CHANGED
package/esm/domain/Features.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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);
|
package/esm/domain/Meeting.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import moment from 'moment';
|
|
2
|
+
|
|
1
3
|
//
|
|
2
4
|
|
|
3
5
|
var newFrom = (instance , ToClass ) => {
|
|
@@ -18,8 +20,9 @@ var newFrom = (instance , ToClass ) => {
|
|
|
18
20
|
|
|
19
21
|
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
|
|
22
24
|
|
|
25
|
+
|
|
23
26
|
|
|
24
27
|
|
|
25
28
|
class Meeting {
|
|
@@ -30,9 +33,10 @@ class Meeting {
|
|
|
30
33
|
|
|
31
34
|
|
|
32
35
|
|
|
33
|
-
|
|
36
|
+
|
|
34
37
|
|
|
35
38
|
|
|
39
|
+
|
|
36
40
|
|
|
37
41
|
static parse(plain ) {
|
|
38
42
|
return new Meeting({
|
|
@@ -42,8 +46,9 @@ class Meeting {
|
|
|
42
46
|
ownerUuids: plain.owner_uuids,
|
|
43
47
|
port: plain.port,
|
|
44
48
|
uuid: plain.uuid,
|
|
45
|
-
|
|
49
|
+
extension: plain.exten,
|
|
46
50
|
persistent: plain.persistent,
|
|
51
|
+
creationTime: moment(plain.creation_time).toDate(),
|
|
47
52
|
});
|
|
48
53
|
}
|
|
49
54
|
|
|
@@ -65,8 +70,9 @@ class Meeting {
|
|
|
65
70
|
ownerUuids,
|
|
66
71
|
port,
|
|
67
72
|
uri,
|
|
68
|
-
|
|
73
|
+
extension,
|
|
69
74
|
persistent,
|
|
75
|
+
creationTime,
|
|
70
76
|
} = {}) {
|
|
71
77
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
72
78
|
this.uri = uri;
|
|
@@ -74,8 +80,9 @@ class Meeting {
|
|
|
74
80
|
this.ownerUuids = ownerUuids;
|
|
75
81
|
this.port = port;
|
|
76
82
|
this.uuid = uuid;
|
|
77
|
-
this.
|
|
83
|
+
this.extension = extension;
|
|
78
84
|
this.persistent = persistent;
|
|
85
|
+
this.creationTime = creationTime;
|
|
79
86
|
|
|
80
87
|
// Useful to compare instead of instanceof with minified code
|
|
81
88
|
this.type = 'Meeting';
|
|
@@ -2833,7 +2833,7 @@ var IssueReporter$1 = new IssueReporter();
|
|
|
2833
2833
|
|
|
2834
2834
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
2835
2835
|
|
|
2836
|
-
const logger
|
|
2836
|
+
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
2837
2837
|
|
|
2838
2838
|
// Use a function here to be able to mock it in tests
|
|
2839
2839
|
const realFetch = () => {
|
|
@@ -2972,7 +2972,7 @@ class ApiRequester {
|
|
|
2972
2972
|
};
|
|
2973
2973
|
|
|
2974
2974
|
if (this.refreshTokenPromise) {
|
|
2975
|
-
logger
|
|
2975
|
+
logger.info('A token is already refreshing, waiting ...', { url });
|
|
2976
2976
|
await this.refreshTokenPromise;
|
|
2977
2977
|
}
|
|
2978
2978
|
|
|
@@ -2992,7 +2992,7 @@ class ApiRequester {
|
|
|
2992
2992
|
return promise.then(async (err ) => {
|
|
2993
2993
|
// Check if the token is still valid
|
|
2994
2994
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
2995
|
-
logger
|
|
2995
|
+
logger.warn('token expired', { error: err.reason });
|
|
2996
2996
|
// Replay the call after refreshing the token
|
|
2997
2997
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
2998
2998
|
}
|
|
@@ -3002,7 +3002,7 @@ class ApiRequester {
|
|
|
3002
3002
|
: exceptionClass.fromResponse(err, response.status);
|
|
3003
3003
|
|
|
3004
3004
|
if (this.shouldLogErrors) {
|
|
3005
|
-
logger
|
|
3005
|
+
logger.error('API error', error);
|
|
3006
3006
|
}
|
|
3007
3007
|
|
|
3008
3008
|
throw error;
|
|
@@ -3012,7 +3012,7 @@ class ApiRequester {
|
|
|
3012
3012
|
return newParse(response, isJson);
|
|
3013
3013
|
}).catch(error => {
|
|
3014
3014
|
if (this.shouldLogErrors) {
|
|
3015
|
-
logger
|
|
3015
|
+
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
3016
3016
|
}
|
|
3017
3017
|
|
|
3018
3018
|
throw error;
|
|
@@ -3040,13 +3040,13 @@ class ApiRequester {
|
|
|
3040
3040
|
) {
|
|
3041
3041
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
3042
3042
|
let newPath = path;
|
|
3043
|
-
logger
|
|
3043
|
+
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
3044
3044
|
|
|
3045
3045
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
3046
3046
|
|
|
3047
3047
|
return this.refreshTokenPromise.then(() => {
|
|
3048
3048
|
this.refreshTokenPromise = null;
|
|
3049
|
-
logger
|
|
3049
|
+
logger.info('token refreshed', { isTokenNotFound });
|
|
3050
3050
|
if (isTokenNotFound) {
|
|
3051
3051
|
const pathParts = path.split('/');
|
|
3052
3052
|
pathParts.pop();
|
|
@@ -3516,8 +3516,9 @@ class ExternalApp {
|
|
|
3516
3516
|
|
|
3517
3517
|
|
|
3518
3518
|
|
|
3519
|
-
|
|
3519
|
+
|
|
3520
3520
|
|
|
3521
|
+
|
|
3521
3522
|
|
|
3522
3523
|
|
|
3523
3524
|
class Meeting {
|
|
@@ -3528,9 +3529,10 @@ class Meeting {
|
|
|
3528
3529
|
|
|
3529
3530
|
|
|
3530
3531
|
|
|
3531
|
-
|
|
3532
|
+
|
|
3532
3533
|
|
|
3533
3534
|
|
|
3535
|
+
|
|
3534
3536
|
|
|
3535
3537
|
static parse(plain ) {
|
|
3536
3538
|
return new Meeting({
|
|
@@ -3540,8 +3542,9 @@ class Meeting {
|
|
|
3540
3542
|
ownerUuids: plain.owner_uuids,
|
|
3541
3543
|
port: plain.port,
|
|
3542
3544
|
uuid: plain.uuid,
|
|
3543
|
-
|
|
3545
|
+
extension: plain.exten,
|
|
3544
3546
|
persistent: plain.persistent,
|
|
3547
|
+
creationTime: moment(plain.creation_time).toDate(),
|
|
3545
3548
|
});
|
|
3546
3549
|
}
|
|
3547
3550
|
|
|
@@ -3563,8 +3566,9 @@ class Meeting {
|
|
|
3563
3566
|
ownerUuids,
|
|
3564
3567
|
port,
|
|
3565
3568
|
uri,
|
|
3566
|
-
|
|
3569
|
+
extension,
|
|
3567
3570
|
persistent,
|
|
3571
|
+
creationTime,
|
|
3568
3572
|
} = {}) {
|
|
3569
3573
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
3570
3574
|
this.uri = uri;
|
|
@@ -3572,8 +3576,9 @@ class Meeting {
|
|
|
3572
3576
|
this.ownerUuids = ownerUuids;
|
|
3573
3577
|
this.port = port;
|
|
3574
3578
|
this.uuid = uuid;
|
|
3575
|
-
this.
|
|
3579
|
+
this.extension = extension;
|
|
3576
3580
|
this.persistent = persistent;
|
|
3581
|
+
this.creationTime = creationTime;
|
|
3577
3582
|
|
|
3578
3583
|
// Useful to compare instead of instanceof with minified code
|
|
3579
3584
|
this.type = 'Meeting';
|
|
@@ -5129,7 +5134,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
|
|
|
5129
5134
|
|
|
5130
5135
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
5131
5136
|
|
|
5132
|
-
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
5137
|
+
const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
5133
5138
|
|
|
5134
5139
|
class CTIPhone extends Emitter {
|
|
5135
5140
|
|
|
@@ -5142,7 +5147,7 @@ class CTIPhone extends Emitter {
|
|
|
5142
5147
|
|
|
5143
5148
|
constructor(session , isMobile = false, callbackAllLines = false) {
|
|
5144
5149
|
super();
|
|
5145
|
-
logger.info('CTI Phone created');
|
|
5150
|
+
logger$2.info('CTI Phone created');
|
|
5146
5151
|
this.session = session;
|
|
5147
5152
|
this.isMobile = isMobile;
|
|
5148
5153
|
this.callbackAllLines = callbackAllLines;
|
|
@@ -5203,7 +5208,7 @@ class CTIPhone extends Emitter {
|
|
|
5203
5208
|
}
|
|
5204
5209
|
|
|
5205
5210
|
async makeCall(number , line ) {
|
|
5206
|
-
logger.info('make CTI call', { number });
|
|
5211
|
+
logger$2.info('make CTI call', { number });
|
|
5207
5212
|
|
|
5208
5213
|
if (!number) {
|
|
5209
5214
|
return null;
|
|
@@ -5226,7 +5231,7 @@ class CTIPhone extends Emitter {
|
|
|
5226
5231
|
if (!callSession) {
|
|
5227
5232
|
return Promise.resolve(null);
|
|
5228
5233
|
}
|
|
5229
|
-
logger.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
5234
|
+
logger$2.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
5230
5235
|
|
|
5231
5236
|
if (!this.currentCall) {
|
|
5232
5237
|
this.currentCall = callSession.call;
|
|
@@ -5239,7 +5244,7 @@ class CTIPhone extends Emitter {
|
|
|
5239
5244
|
if (!callSession) {
|
|
5240
5245
|
return;
|
|
5241
5246
|
}
|
|
5242
|
-
logger.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
5247
|
+
logger$2.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
5243
5248
|
|
|
5244
5249
|
this.currentCall = undefined;
|
|
5245
5250
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -5249,7 +5254,7 @@ class CTIPhone extends Emitter {
|
|
|
5249
5254
|
if (!callSession) {
|
|
5250
5255
|
return Promise.resolve(false);
|
|
5251
5256
|
}
|
|
5252
|
-
logger.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
5257
|
+
logger$2.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
5253
5258
|
|
|
5254
5259
|
try {
|
|
5255
5260
|
await CallApi.cancelCall(callSession);
|
|
@@ -5260,7 +5265,7 @@ class CTIPhone extends Emitter {
|
|
|
5260
5265
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
5261
5266
|
return true;
|
|
5262
5267
|
} catch (e) {
|
|
5263
|
-
logger.error('hangup CTI call, error', e);
|
|
5268
|
+
logger$2.error('hangup CTI call, error', e);
|
|
5264
5269
|
|
|
5265
5270
|
this.eventEmitter.emit('onCallFailed', callSession);
|
|
5266
5271
|
return false;
|
|
@@ -5273,7 +5278,7 @@ class CTIPhone extends Emitter {
|
|
|
5273
5278
|
if (!callSession) {
|
|
5274
5279
|
return;
|
|
5275
5280
|
}
|
|
5276
|
-
logger.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
5281
|
+
logger$2.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
5277
5282
|
|
|
5278
5283
|
await CallApi.cancelCall(callSession);
|
|
5279
5284
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -5283,7 +5288,7 @@ class CTIPhone extends Emitter {
|
|
|
5283
5288
|
if (!callSession) {
|
|
5284
5289
|
return;
|
|
5285
5290
|
}
|
|
5286
|
-
logger.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
5291
|
+
logger$2.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
5287
5292
|
|
|
5288
5293
|
await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
|
|
5289
5294
|
}
|
|
@@ -5296,19 +5301,19 @@ class CTIPhone extends Emitter {
|
|
|
5296
5301
|
if (!callSession) {
|
|
5297
5302
|
return;
|
|
5298
5303
|
}
|
|
5299
|
-
logger.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
5304
|
+
logger$2.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
5300
5305
|
|
|
5301
5306
|
return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
|
|
5302
5307
|
}
|
|
5303
5308
|
|
|
5304
5309
|
async cancelCTIIndirectTransfer(transferId ) {
|
|
5305
|
-
logger.info('cancel CTI transfer', { transferId });
|
|
5310
|
+
logger$2.info('cancel CTI transfer', { transferId });
|
|
5306
5311
|
|
|
5307
5312
|
return CallApi.cancelCallTransfer(transferId);
|
|
5308
5313
|
}
|
|
5309
5314
|
|
|
5310
5315
|
async confirmCTIIndirectTransfer(transferId ) {
|
|
5311
|
-
logger.info('confirm CTI transfer', { transferId });
|
|
5316
|
+
logger$2.info('confirm CTI transfer', { transferId });
|
|
5312
5317
|
|
|
5313
5318
|
return CallApi.confirmCallTransfer(transferId);
|
|
5314
5319
|
}
|
|
@@ -5317,19 +5322,19 @@ class CTIPhone extends Emitter {
|
|
|
5317
5322
|
if (!callSession) {
|
|
5318
5323
|
return;
|
|
5319
5324
|
}
|
|
5320
|
-
logger.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
|
|
5325
|
+
logger$2.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
|
|
5321
5326
|
|
|
5322
5327
|
return CallApi.sendDTMF(callSession.callId, digits);
|
|
5323
5328
|
}
|
|
5324
5329
|
|
|
5325
5330
|
onConnectionMade() {
|
|
5326
|
-
logger.info('on CTI connection made');
|
|
5331
|
+
logger$2.info('on CTI connection made');
|
|
5327
5332
|
|
|
5328
5333
|
this.eventEmitter.emit('onCallAccepted');
|
|
5329
5334
|
}
|
|
5330
5335
|
|
|
5331
5336
|
async close() {
|
|
5332
|
-
logger.info('CTI close');
|
|
5337
|
+
logger$2.info('CTI close');
|
|
5333
5338
|
|
|
5334
5339
|
return Promise.resolve();
|
|
5335
5340
|
}
|
|
@@ -5338,7 +5343,7 @@ class CTIPhone extends Emitter {
|
|
|
5338
5343
|
if (!callSession) {
|
|
5339
5344
|
return;
|
|
5340
5345
|
}
|
|
5341
|
-
logger.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
|
|
5346
|
+
logger$2.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
|
|
5342
5347
|
|
|
5343
5348
|
return CallApi.hold(callSession.callId);
|
|
5344
5349
|
}
|
|
@@ -5347,7 +5352,7 @@ class CTIPhone extends Emitter {
|
|
|
5347
5352
|
if (!callSession) {
|
|
5348
5353
|
return;
|
|
5349
5354
|
}
|
|
5350
|
-
logger.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
|
|
5355
|
+
logger$2.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
|
|
5351
5356
|
|
|
5352
5357
|
return CallApi.resume(callSession.callId);
|
|
5353
5358
|
}
|
|
@@ -5356,7 +5361,7 @@ class CTIPhone extends Emitter {
|
|
|
5356
5361
|
if (!callSession) {
|
|
5357
5362
|
return;
|
|
5358
5363
|
}
|
|
5359
|
-
logger.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
|
|
5364
|
+
logger$2.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
|
|
5360
5365
|
|
|
5361
5366
|
return CallApi.mute(callSession.callId);
|
|
5362
5367
|
}
|
|
@@ -5365,7 +5370,7 @@ class CTIPhone extends Emitter {
|
|
|
5365
5370
|
if (!callSession) {
|
|
5366
5371
|
return;
|
|
5367
5372
|
}
|
|
5368
|
-
logger.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
|
|
5373
|
+
logger$2.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
|
|
5369
5374
|
|
|
5370
5375
|
return CallApi.unmute(callSession.callId);
|
|
5371
5376
|
}
|