@wazo/sdk 0.37.1 → 0.37.2
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 +5 -5
- package/esm/__tests__/api-client.test.js +7 -1
- package/esm/__tests__/web-rtc-client.test.js +13 -1
- package/esm/api/agentd.js +7 -1
- package/esm/api/amid.js +7 -1
- package/esm/api/application.js +7 -1
- package/esm/api/auth.js +7 -1
- package/esm/api/call-logd.js +7 -1
- package/esm/api/calld.js +7 -1
- package/esm/api/chatd.js +7 -1
- package/esm/api/confd.js +7 -1
- package/esm/api/ctid-ng.js +7 -1
- package/esm/api/dird.js +7 -1
- package/esm/api/webhookd.js +7 -1
- package/esm/api-client.js +7 -1
- package/esm/checker/Checker.js +13 -1
- package/esm/checker/checks/aor.js +7 -1
- package/esm/checker/checks/api.js +7 -1
- package/esm/checker/checks/index.js +13 -1
- package/esm/checker/checks/wazo-websocket.js +7 -1
- package/esm/checker/checks/webrtc-transport.js +13 -1
- package/esm/checker/checks/webrtc.js +13 -1
- package/esm/domain/AdHocAPIConference.js +7 -1
- package/esm/domain/Features.js +7 -1
- package/esm/domain/Phone/CTIPhone.js +11 -1
- package/esm/domain/Phone/WebRTCPhone.js +7 -1
- package/esm/index.js +5648 -5229
- package/esm/lib/WazoSessionDescriptionHandler.js +7 -1
- package/esm/service/CallApi.js +7 -1
- package/esm/service/IssueReporter.js +7 -1
- package/esm/service/__tests__/IssueReporter.test.js +9 -1
- package/esm/service/getApiClient.js +7 -1
- package/esm/simple/Auth.js +426 -9
- package/esm/simple/Configuration.js +426 -9
- package/esm/simple/Directory.js +7 -1
- package/esm/simple/Phone.js +426 -9
- package/esm/simple/Websocket.js +7 -1
- package/esm/simple/index.js +426 -9
- package/esm/simple/room/LocalParticipant.js +426 -9
- package/esm/simple/room/Participant.js +426 -9
- package/esm/simple/room/RemoteParticipant.js +426 -9
- package/esm/simple/room/Room.js +426 -9
- package/esm/simple/room/Stream.js +426 -9
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +426 -9
- package/esm/simple/utils.js +426 -9
- package/esm/utils/__tests__/api-requester.test.js +7 -1
- package/esm/utils/api-requester.js +7 -1
- package/esm/web-rtc-client.js +13 -1
- package/esm/websocket-client.js +7 -1
- package/lib/__tests__/api-client.test.js +7 -1
- package/lib/__tests__/web-rtc-client.test.js +13 -1
- package/lib/api/agentd.js +7 -1
- package/lib/api/amid.js +7 -1
- package/lib/api/application.js +7 -1
- package/lib/api/auth.js +7 -1
- package/lib/api/call-logd.js +7 -1
- package/lib/api/calld.js +7 -1
- package/lib/api/chatd.js +7 -1
- package/lib/api/confd.js +7 -1
- package/lib/api/ctid-ng.js +7 -1
- package/lib/api/dird.js +7 -1
- package/lib/api/webhookd.js +7 -1
- package/lib/api-client.js +7 -1
- package/lib/checker/Checker.js +13 -1
- package/lib/checker/checks/aor.js +7 -1
- package/lib/checker/checks/api.js +7 -1
- package/lib/checker/checks/index.js +13 -1
- package/lib/checker/checks/wazo-websocket.js +7 -1
- package/lib/checker/checks/webrtc-transport.js +13 -1
- package/lib/checker/checks/webrtc.js +13 -1
- package/lib/domain/AdHocAPIConference.js +7 -1
- package/lib/domain/Features.js +7 -1
- package/lib/domain/Phone/CTIPhone.js +11 -1
- package/lib/domain/Phone/WebRTCPhone.js +7 -1
- package/lib/index.js +5648 -5229
- package/lib/lib/WazoSessionDescriptionHandler.js +7 -1
- package/lib/service/CallApi.js +7 -1
- package/lib/service/IssueReporter.js +7 -1
- package/lib/service/__tests__/IssueReporter.test.js +9 -1
- package/lib/service/getApiClient.js +7 -1
- package/lib/simple/Auth.js +426 -9
- package/lib/simple/Configuration.js +426 -9
- package/lib/simple/Directory.js +7 -1
- package/lib/simple/Phone.js +426 -9
- package/lib/simple/Websocket.js +7 -1
- package/lib/simple/index.js +426 -9
- package/lib/simple/room/LocalParticipant.js +426 -9
- package/lib/simple/room/Participant.js +426 -9
- package/lib/simple/room/RemoteParticipant.js +426 -9
- package/lib/simple/room/Room.js +426 -9
- package/lib/simple/room/Stream.js +426 -9
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +426 -9
- package/lib/simple/utils.js +426 -9
- package/lib/utils/__tests__/api-requester.test.js +7 -1
- package/lib/utils/api-requester.js +7 -1
- package/lib/web-rtc-client.js +13 -1
- package/lib/websocket-client.js +7 -1
- package/package.json +1 -1
- package/src/domain/Phone/CTIPhone.js +4 -0
- package/src/domain/Phone/Phone.js +2 -0
- package/src/index.js +4 -0
- package/src/service/IssueReporter.js +7 -1
- package/src/service/__tests__/IssueReporter.test.js +2 -0
- package/src/simple/index.js +4 -0
- package/src/web-rtc-client.js +6 -0
|
@@ -286,7 +286,13 @@ class IssueReporter {
|
|
|
286
286
|
}
|
|
287
287
|
|
|
288
288
|
_isLevelAbove(level1 , level2 ) {
|
|
289
|
-
|
|
289
|
+
const index1 = LOG_LEVELS.indexOf(level1);
|
|
290
|
+
const index2 = LOG_LEVELS.indexOf(level2);
|
|
291
|
+
if (index1 === -1 || index2 === -1) {
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
return index1 > index2;
|
|
290
296
|
}
|
|
291
297
|
|
|
292
298
|
_makeCategory(category ) {
|
package/lib/service/CallApi.js
CHANGED
|
@@ -2324,7 +2324,13 @@ class IssueReporter {
|
|
|
2324
2324
|
}
|
|
2325
2325
|
|
|
2326
2326
|
_isLevelAbove(level1 , level2 ) {
|
|
2327
|
-
|
|
2327
|
+
const index1 = LOG_LEVELS.indexOf(level1);
|
|
2328
|
+
const index2 = LOG_LEVELS.indexOf(level2);
|
|
2329
|
+
if (index1 === -1 || index2 === -1) {
|
|
2330
|
+
return false;
|
|
2331
|
+
}
|
|
2332
|
+
|
|
2333
|
+
return index1 > index2;
|
|
2328
2334
|
}
|
|
2329
2335
|
|
|
2330
2336
|
_makeCategory(category ) {
|
|
@@ -278,7 +278,13 @@ class IssueReporter {
|
|
|
278
278
|
}
|
|
279
279
|
|
|
280
280
|
_isLevelAbove(level1 , level2 ) {
|
|
281
|
-
|
|
281
|
+
const index1 = LOG_LEVELS.indexOf(level1);
|
|
282
|
+
const index2 = LOG_LEVELS.indexOf(level2);
|
|
283
|
+
if (index1 === -1 || index2 === -1) {
|
|
284
|
+
return false;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
return index1 > index2;
|
|
282
288
|
}
|
|
283
289
|
|
|
284
290
|
_makeCategory(category ) {
|
|
@@ -278,7 +278,13 @@ class IssueReporter {
|
|
|
278
278
|
}
|
|
279
279
|
|
|
280
280
|
_isLevelAbove(level1 , level2 ) {
|
|
281
|
-
|
|
281
|
+
const index1 = LOG_LEVELS.indexOf(level1);
|
|
282
|
+
const index2 = LOG_LEVELS.indexOf(level2);
|
|
283
|
+
if (index1 === -1 || index2 === -1) {
|
|
284
|
+
return false;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
return index1 > index2;
|
|
282
288
|
}
|
|
283
289
|
|
|
284
290
|
_makeCategory(category ) {
|
|
@@ -327,6 +333,8 @@ describe('IssueReporter', () => {
|
|
|
327
333
|
expect(IssueReporter$1._isLevelAbove('error', 'warn')).toBeTruthy();
|
|
328
334
|
expect(IssueReporter$1._isLevelAbove('info', 'warn')).toBeFalsy();
|
|
329
335
|
expect(IssueReporter$1._isLevelAbove('trace', 'trace')).toBeFalsy();
|
|
336
|
+
expect(IssueReporter$1._isLevelAbove('trace', 'something')).toBeFalsy();
|
|
337
|
+
expect(IssueReporter$1._isLevelAbove('something', 'trace')).toBeFalsy();
|
|
330
338
|
});
|
|
331
339
|
|
|
332
340
|
it('should send if verbosity is higher than required', () => {
|
|
@@ -317,7 +317,13 @@ class IssueReporter {
|
|
|
317
317
|
}
|
|
318
318
|
|
|
319
319
|
_isLevelAbove(level1 , level2 ) {
|
|
320
|
-
|
|
320
|
+
const index1 = LOG_LEVELS.indexOf(level1);
|
|
321
|
+
const index2 = LOG_LEVELS.indexOf(level2);
|
|
322
|
+
if (index1 === -1 || index2 === -1) {
|
|
323
|
+
return false;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
return index1 > index2;
|
|
321
327
|
}
|
|
322
328
|
|
|
323
329
|
_makeCategory(category ) {
|
package/lib/simple/Auth.js
CHANGED
|
@@ -1821,7 +1821,13 @@ class IssueReporter {
|
|
|
1821
1821
|
}
|
|
1822
1822
|
|
|
1823
1823
|
_isLevelAbove(level1 , level2 ) {
|
|
1824
|
-
|
|
1824
|
+
const index1 = LOG_LEVELS.indexOf(level1);
|
|
1825
|
+
const index2 = LOG_LEVELS.indexOf(level2);
|
|
1826
|
+
if (index1 === -1 || index2 === -1) {
|
|
1827
|
+
return false;
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1830
|
+
return index1 > index2;
|
|
1825
1831
|
}
|
|
1826
1832
|
|
|
1827
1833
|
_makeCategory(category ) {
|
|
@@ -1844,7 +1850,7 @@ var IssueReporter$1 = new IssueReporter();
|
|
|
1844
1850
|
|
|
1845
1851
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
1846
1852
|
|
|
1847
|
-
const logger$
|
|
1853
|
+
const logger$b = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
1848
1854
|
|
|
1849
1855
|
// Use a function here to be able to mock it in tests
|
|
1850
1856
|
const realFetch = () => {
|
|
@@ -1983,7 +1989,7 @@ class ApiRequester {
|
|
|
1983
1989
|
};
|
|
1984
1990
|
|
|
1985
1991
|
if (this.refreshTokenPromise) {
|
|
1986
|
-
logger$
|
|
1992
|
+
logger$b.info('A token is already refreshing, waiting ...', { url });
|
|
1987
1993
|
await this.refreshTokenPromise;
|
|
1988
1994
|
}
|
|
1989
1995
|
|
|
@@ -2003,7 +2009,7 @@ class ApiRequester {
|
|
|
2003
2009
|
return promise.then(async (err ) => {
|
|
2004
2010
|
// Check if the token is still valid
|
|
2005
2011
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
2006
|
-
logger$
|
|
2012
|
+
logger$b.warn('token expired', { error: err.reason });
|
|
2007
2013
|
// Replay the call after refreshing the token
|
|
2008
2014
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
2009
2015
|
}
|
|
@@ -2013,7 +2019,7 @@ class ApiRequester {
|
|
|
2013
2019
|
: exceptionClass.fromResponse(err, response.status);
|
|
2014
2020
|
|
|
2015
2021
|
if (this.shouldLogErrors) {
|
|
2016
|
-
logger$
|
|
2022
|
+
logger$b.error('API error', error);
|
|
2017
2023
|
}
|
|
2018
2024
|
|
|
2019
2025
|
throw error;
|
|
@@ -2023,7 +2029,7 @@ class ApiRequester {
|
|
|
2023
2029
|
return newParse(response, isJson);
|
|
2024
2030
|
}).catch(error => {
|
|
2025
2031
|
if (this.shouldLogErrors) {
|
|
2026
|
-
logger$
|
|
2032
|
+
logger$b.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
2027
2033
|
}
|
|
2028
2034
|
|
|
2029
2035
|
throw error;
|
|
@@ -2051,13 +2057,13 @@ class ApiRequester {
|
|
|
2051
2057
|
) {
|
|
2052
2058
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
2053
2059
|
let newPath = path;
|
|
2054
|
-
logger$
|
|
2060
|
+
logger$b.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
2055
2061
|
|
|
2056
2062
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
2057
2063
|
|
|
2058
2064
|
return this.refreshTokenPromise.then(() => {
|
|
2059
2065
|
this.refreshTokenPromise = null;
|
|
2060
|
-
logger$
|
|
2066
|
+
logger$b.info('token refreshed', { isTokenNotFound });
|
|
2061
2067
|
if (isTokenNotFound) {
|
|
2062
2068
|
const pathParts = path.split('/');
|
|
2063
2069
|
pathParts.pop();
|
|
@@ -3738,11 +3744,414 @@ class IndirectTransfer {
|
|
|
3738
3744
|
}
|
|
3739
3745
|
|
|
3740
3746
|
//
|
|
3747
|
+
|
|
3748
|
+
class CallApi {
|
|
3749
|
+
static async fetchCallLogs(offset , limit ) {
|
|
3750
|
+
return getApiClient().callLogd.listCallLogs(offset, limit);
|
|
3751
|
+
}
|
|
3752
|
+
|
|
3753
|
+
static async fetchDistinctCallLogs(offset , limit , distinct = 'peer_exten') {
|
|
3754
|
+
return getApiClient().callLogd.listDistinctCallLogs(offset, limit, distinct);
|
|
3755
|
+
}
|
|
3756
|
+
|
|
3757
|
+
static async fetchActiveCalls() {
|
|
3758
|
+
return getApiClient().calld.listCalls();
|
|
3759
|
+
}
|
|
3760
|
+
|
|
3761
|
+
static async fetchCallLogsFromDate(from , number ) {
|
|
3762
|
+
return getApiClient().callLogd.listCallLogsFromDate(from, number);
|
|
3763
|
+
}
|
|
3764
|
+
|
|
3765
|
+
static async search(query , limit ) {
|
|
3766
|
+
return getApiClient().callLogd.search(query, limit);
|
|
3767
|
+
}
|
|
3768
|
+
|
|
3769
|
+
static async searchBy(field , value , limit ) {
|
|
3770
|
+
return getApiClient().callLogd.searchBy(field, value, limit);
|
|
3771
|
+
}
|
|
3772
|
+
|
|
3773
|
+
static async fetchSIP(session , line ) {
|
|
3774
|
+
const lineToUse = line || session.primaryLine();
|
|
3775
|
+
return getApiClient().confd.getUserLineSip(session.uuid, lineToUse ? lineToUse.id : null);
|
|
3776
|
+
}
|
|
3777
|
+
|
|
3778
|
+
static async cancelCall(callSession ) {
|
|
3779
|
+
return getApiClient().calld.cancelCall(callSession.callId);
|
|
3780
|
+
}
|
|
3781
|
+
|
|
3782
|
+
static async makeCall(callFromLine , extension , isMobile = false,
|
|
3783
|
+
callbackAllLines = false) {
|
|
3784
|
+
const lineId = callFromLine ? callFromLine.id : null;
|
|
3785
|
+
|
|
3786
|
+
const response = await getApiClient().calld.makeCall(extension, isMobile, lineId, callbackAllLines);
|
|
3787
|
+
return Call.parse(response);
|
|
3788
|
+
}
|
|
3789
|
+
|
|
3790
|
+
static async relocateCall(callId , line , contactIdentifier ) {
|
|
3791
|
+
return getApiClient().calld.relocateCall(callId, 'line', line, contactIdentifier);
|
|
3792
|
+
}
|
|
3793
|
+
|
|
3794
|
+
static async hold(callId ) {
|
|
3795
|
+
return getApiClient().calld.hold(callId);
|
|
3796
|
+
}
|
|
3797
|
+
|
|
3798
|
+
static async resume(callId ) {
|
|
3799
|
+
return getApiClient().calld.resume(callId);
|
|
3800
|
+
}
|
|
3801
|
+
|
|
3802
|
+
static async mute(callId ) {
|
|
3803
|
+
return getApiClient().calld.mute(callId);
|
|
3804
|
+
}
|
|
3805
|
+
|
|
3806
|
+
static async sendDTMF(callId , digits ) {
|
|
3807
|
+
return getApiClient().calld.sendDTMF(callId, digits);
|
|
3808
|
+
}
|
|
3809
|
+
|
|
3810
|
+
static async unmute(callId ) {
|
|
3811
|
+
return getApiClient().calld.unmute(callId);
|
|
3812
|
+
}
|
|
3813
|
+
|
|
3814
|
+
static async transferCall(callId , number , flow ) {
|
|
3815
|
+
return getApiClient().calld.transferCall(callId, number, flow);
|
|
3816
|
+
}
|
|
3817
|
+
|
|
3818
|
+
static async cancelCallTransfer(transferId ) {
|
|
3819
|
+
return getApiClient().calld.cancelCallTransfer(transferId);
|
|
3820
|
+
}
|
|
3821
|
+
|
|
3822
|
+
static async confirmCallTransfer(transferId ) {
|
|
3823
|
+
return getApiClient().calld.confirmCallTransfer(transferId);
|
|
3824
|
+
}
|
|
3825
|
+
}
|
|
3826
|
+
|
|
3827
|
+
//
|
|
3828
|
+
|
|
3829
|
+
const TRANSFER_FLOW_ATTENDED = 'attended';
|
|
3741
3830
|
const TRANSFER_FLOW_BLIND = 'blind';
|
|
3742
3831
|
|
|
3743
3832
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
3744
3833
|
|
|
3745
|
-
IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
3834
|
+
const logger$a = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
3835
|
+
|
|
3836
|
+
class CTIPhone extends Emitter {
|
|
3837
|
+
|
|
3838
|
+
|
|
3839
|
+
|
|
3840
|
+
|
|
3841
|
+
|
|
3842
|
+
|
|
3843
|
+
|
|
3844
|
+
|
|
3845
|
+
constructor(session , isMobile = false, callbackAllLines = false) {
|
|
3846
|
+
super();
|
|
3847
|
+
logger$a.info('CTI Phone created');
|
|
3848
|
+
this.session = session;
|
|
3849
|
+
this.isMobile = isMobile;
|
|
3850
|
+
this.callbackAllLines = callbackAllLines;
|
|
3851
|
+
}
|
|
3852
|
+
|
|
3853
|
+
getOptions() {
|
|
3854
|
+
// @FIXME: temporarily disabling this option
|
|
3855
|
+
// const hold = this.session.hasEngineVersionGte(MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD);
|
|
3856
|
+
|
|
3857
|
+
return {
|
|
3858
|
+
accept: false,
|
|
3859
|
+
decline: true,
|
|
3860
|
+
mute: true,
|
|
3861
|
+
hold: false,
|
|
3862
|
+
transfer: true,
|
|
3863
|
+
sendKey: true,
|
|
3864
|
+
addParticipant: false,
|
|
3865
|
+
record: true,
|
|
3866
|
+
merge: false,
|
|
3867
|
+
};
|
|
3868
|
+
}
|
|
3869
|
+
|
|
3870
|
+
hasAnActiveCall() {
|
|
3871
|
+
return !!this.currentCall;
|
|
3872
|
+
}
|
|
3873
|
+
|
|
3874
|
+
callCount() {
|
|
3875
|
+
return this.currentCall ? 1 : 0;
|
|
3876
|
+
}
|
|
3877
|
+
|
|
3878
|
+
isWebRTC() {
|
|
3879
|
+
return false;
|
|
3880
|
+
}
|
|
3881
|
+
|
|
3882
|
+
getUserAgent() {
|
|
3883
|
+
return 'cti-phone';
|
|
3884
|
+
}
|
|
3885
|
+
|
|
3886
|
+
startHeartbeat() {
|
|
3887
|
+
}
|
|
3888
|
+
|
|
3889
|
+
setOnHeartbeatTimeout() {
|
|
3890
|
+
}
|
|
3891
|
+
|
|
3892
|
+
setOnHeartbeatCallback() {
|
|
3893
|
+
}
|
|
3894
|
+
|
|
3895
|
+
stopHeartbeat() {
|
|
3896
|
+
}
|
|
3897
|
+
|
|
3898
|
+
bindClientEvents() {
|
|
3899
|
+
}
|
|
3900
|
+
|
|
3901
|
+
onConnect() {
|
|
3902
|
+
}
|
|
3903
|
+
|
|
3904
|
+
onDisconnect() {
|
|
3905
|
+
}
|
|
3906
|
+
|
|
3907
|
+
async makeCall(number , line ) {
|
|
3908
|
+
logger$a.info('make CTI call', { number });
|
|
3909
|
+
|
|
3910
|
+
if (!number) {
|
|
3911
|
+
return null;
|
|
3912
|
+
}
|
|
3913
|
+
try {
|
|
3914
|
+
this.currentCall = await CallApi.makeCall(line, number, this.isMobile, this.callbackAllLines);
|
|
3915
|
+
} catch (_) {
|
|
3916
|
+
// We have to deal with error like `User has no mobile phone number` error in the UI.
|
|
3917
|
+
}
|
|
3918
|
+
if (!this.currentCall) {
|
|
3919
|
+
return null;
|
|
3920
|
+
}
|
|
3921
|
+
const callSession = CallSession.parseCall(this.currentCall);
|
|
3922
|
+
this.eventEmitter.emit('onCallOutgoing', callSession);
|
|
3923
|
+
|
|
3924
|
+
return callSession;
|
|
3925
|
+
}
|
|
3926
|
+
|
|
3927
|
+
accept(callSession ) {
|
|
3928
|
+
if (!callSession) {
|
|
3929
|
+
return Promise.resolve(null);
|
|
3930
|
+
}
|
|
3931
|
+
logger$a.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
3932
|
+
|
|
3933
|
+
if (!this.currentCall) {
|
|
3934
|
+
this.currentCall = callSession.call;
|
|
3935
|
+
}
|
|
3936
|
+
|
|
3937
|
+
return Promise.resolve(callSession.getId());
|
|
3938
|
+
}
|
|
3939
|
+
|
|
3940
|
+
endCurrentCall(callSession ) {
|
|
3941
|
+
if (!callSession) {
|
|
3942
|
+
return;
|
|
3943
|
+
}
|
|
3944
|
+
logger$a.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
3945
|
+
|
|
3946
|
+
this.currentCall = undefined;
|
|
3947
|
+
this.eventEmitter.emit('onCallEnded', callSession);
|
|
3948
|
+
}
|
|
3949
|
+
|
|
3950
|
+
async hangup(callSession ) {
|
|
3951
|
+
if (!callSession) {
|
|
3952
|
+
return Promise.resolve(false);
|
|
3953
|
+
}
|
|
3954
|
+
logger$a.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
3955
|
+
|
|
3956
|
+
try {
|
|
3957
|
+
await CallApi.cancelCall(callSession);
|
|
3958
|
+
if (this.currentCall && callSession.callId === this.currentCall.id) {
|
|
3959
|
+
this.endCurrentCall(callSession);
|
|
3960
|
+
}
|
|
3961
|
+
|
|
3962
|
+
this.eventEmitter.emit('onCallEnded', callSession);
|
|
3963
|
+
return true;
|
|
3964
|
+
} catch (e) {
|
|
3965
|
+
logger$a.error('hangup CTI call, error', e);
|
|
3966
|
+
|
|
3967
|
+
this.eventEmitter.emit('onCallFailed', callSession);
|
|
3968
|
+
return false;
|
|
3969
|
+
}
|
|
3970
|
+
}
|
|
3971
|
+
|
|
3972
|
+
ignore() {}
|
|
3973
|
+
|
|
3974
|
+
async reject(callSession ) {
|
|
3975
|
+
if (!callSession) {
|
|
3976
|
+
return;
|
|
3977
|
+
}
|
|
3978
|
+
logger$a.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
3979
|
+
|
|
3980
|
+
await CallApi.cancelCall(callSession);
|
|
3981
|
+
this.eventEmitter.emit('onCallEnded', callSession);
|
|
3982
|
+
}
|
|
3983
|
+
|
|
3984
|
+
async transfer(callSession , number ) {
|
|
3985
|
+
if (!callSession) {
|
|
3986
|
+
return;
|
|
3987
|
+
}
|
|
3988
|
+
logger$a.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
3989
|
+
|
|
3990
|
+
await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
|
|
3991
|
+
}
|
|
3992
|
+
|
|
3993
|
+
indirectTransfer() {}
|
|
3994
|
+
|
|
3995
|
+
async initiateCTIIndirectTransfer(callSession , number ) {
|
|
3996
|
+
if (!callSession) {
|
|
3997
|
+
return;
|
|
3998
|
+
}
|
|
3999
|
+
logger$a.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4000
|
+
|
|
4001
|
+
return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
|
|
4002
|
+
}
|
|
4003
|
+
|
|
4004
|
+
async cancelCTIIndirectTransfer(transferId ) {
|
|
4005
|
+
logger$a.info('cancel CTI transfer', { transferId });
|
|
4006
|
+
|
|
4007
|
+
return CallApi.cancelCallTransfer(transferId);
|
|
4008
|
+
}
|
|
4009
|
+
|
|
4010
|
+
async confirmCTIIndirectTransfer(transferId ) {
|
|
4011
|
+
logger$a.info('confirm CTI transfer', { transferId });
|
|
4012
|
+
|
|
4013
|
+
return CallApi.confirmCallTransfer(transferId);
|
|
4014
|
+
}
|
|
4015
|
+
|
|
4016
|
+
sendKey(callSession , digits ) {
|
|
4017
|
+
if (!callSession) {
|
|
4018
|
+
return;
|
|
4019
|
+
}
|
|
4020
|
+
logger$a.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
|
|
4021
|
+
|
|
4022
|
+
return CallApi.sendDTMF(callSession.callId, digits);
|
|
4023
|
+
}
|
|
4024
|
+
|
|
4025
|
+
onConnectionMade() {
|
|
4026
|
+
logger$a.info('on CTI connection made');
|
|
4027
|
+
|
|
4028
|
+
this.eventEmitter.emit('onCallAccepted');
|
|
4029
|
+
}
|
|
4030
|
+
|
|
4031
|
+
async close() {
|
|
4032
|
+
logger$a.info('CTI close');
|
|
4033
|
+
|
|
4034
|
+
return Promise.resolve();
|
|
4035
|
+
}
|
|
4036
|
+
|
|
4037
|
+
async hold(callSession ) {
|
|
4038
|
+
if (!callSession) {
|
|
4039
|
+
return;
|
|
4040
|
+
}
|
|
4041
|
+
logger$a.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
|
|
4042
|
+
|
|
4043
|
+
return CallApi.hold(callSession.callId);
|
|
4044
|
+
}
|
|
4045
|
+
|
|
4046
|
+
async resume(callSession ) {
|
|
4047
|
+
if (!callSession) {
|
|
4048
|
+
return;
|
|
4049
|
+
}
|
|
4050
|
+
logger$a.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
|
|
4051
|
+
|
|
4052
|
+
return CallApi.resume(callSession.callId);
|
|
4053
|
+
}
|
|
4054
|
+
|
|
4055
|
+
async mute(callSession ) {
|
|
4056
|
+
if (!callSession) {
|
|
4057
|
+
return;
|
|
4058
|
+
}
|
|
4059
|
+
logger$a.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
|
|
4060
|
+
|
|
4061
|
+
return CallApi.mute(callSession.callId);
|
|
4062
|
+
}
|
|
4063
|
+
|
|
4064
|
+
async unmute(callSession ) {
|
|
4065
|
+
if (!callSession) {
|
|
4066
|
+
return;
|
|
4067
|
+
}
|
|
4068
|
+
logger$a.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
|
|
4069
|
+
|
|
4070
|
+
return CallApi.unmute(callSession.callId);
|
|
4071
|
+
}
|
|
4072
|
+
|
|
4073
|
+
putOnSpeaker() {}
|
|
4074
|
+
|
|
4075
|
+
putOffSpeaker() {}
|
|
4076
|
+
|
|
4077
|
+
turnCameraOff() {}
|
|
4078
|
+
|
|
4079
|
+
turnCameraOn() {}
|
|
4080
|
+
|
|
4081
|
+
changeAudioInputDevice() {}
|
|
4082
|
+
|
|
4083
|
+
changeVideoInputDevice() {}
|
|
4084
|
+
|
|
4085
|
+
changeAudioDevice() {}
|
|
4086
|
+
|
|
4087
|
+
changeRingDevice() {}
|
|
4088
|
+
|
|
4089
|
+
changeAudioVolume() {}
|
|
4090
|
+
|
|
4091
|
+
changeRingVolume() {}
|
|
4092
|
+
|
|
4093
|
+
hasVideo() {
|
|
4094
|
+
return false;
|
|
4095
|
+
}
|
|
4096
|
+
|
|
4097
|
+
getLocalStreamForCall() {
|
|
4098
|
+
return null;
|
|
4099
|
+
}
|
|
4100
|
+
|
|
4101
|
+
getRemoteStreamForCall() {
|
|
4102
|
+
return null;
|
|
4103
|
+
}
|
|
4104
|
+
|
|
4105
|
+
getLocalVideoStream() {
|
|
4106
|
+
return null;
|
|
4107
|
+
}
|
|
4108
|
+
|
|
4109
|
+
setActiveSipSession() {}
|
|
4110
|
+
|
|
4111
|
+
isRegistered() {
|
|
4112
|
+
return true;
|
|
4113
|
+
}
|
|
4114
|
+
|
|
4115
|
+
hasIncomingCallSession() {
|
|
4116
|
+
return true;
|
|
4117
|
+
}
|
|
4118
|
+
|
|
4119
|
+
hasActiveRemoteVideoStream() {
|
|
4120
|
+
return false;
|
|
4121
|
+
}
|
|
4122
|
+
|
|
4123
|
+
getCurrentCallSession() {
|
|
4124
|
+
return this.currentCall ? CallSession.parseCall(this.currentCall) : null;
|
|
4125
|
+
}
|
|
4126
|
+
|
|
4127
|
+
enableRinging() {}
|
|
4128
|
+
|
|
4129
|
+
sendMessage() {}
|
|
4130
|
+
|
|
4131
|
+
disableRinging() {}
|
|
4132
|
+
|
|
4133
|
+
getLocalStream() {
|
|
4134
|
+
return null;
|
|
4135
|
+
}
|
|
4136
|
+
|
|
4137
|
+
getRemoteStream() {
|
|
4138
|
+
return null;
|
|
4139
|
+
}
|
|
4140
|
+
|
|
4141
|
+
getRemoteVideoStream() {
|
|
4142
|
+
return null;
|
|
4143
|
+
}
|
|
4144
|
+
|
|
4145
|
+
getRemoteAudioStream() {
|
|
4146
|
+
return null;
|
|
4147
|
+
}
|
|
4148
|
+
|
|
4149
|
+
hasLocalVideo() {
|
|
4150
|
+
return false;
|
|
4151
|
+
}
|
|
4152
|
+
|
|
4153
|
+
useLocalVideoElement() {}
|
|
4154
|
+
}
|
|
3746
4155
|
|
|
3747
4156
|
/* */
|
|
3748
4157
|
|
|
@@ -6284,6 +6693,9 @@ class WebRTCClient extends Emitter {
|
|
|
6284
6693
|
if (!this._isWeb()) {
|
|
6285
6694
|
options.sessionDescriptionHandlerModifiers = [modifiers.holdModifier];
|
|
6286
6695
|
}
|
|
6696
|
+
options.sessionDescriptionHandlerOptions = {
|
|
6697
|
+
constraints: options.constraints,
|
|
6698
|
+
};
|
|
6287
6699
|
|
|
6288
6700
|
// Send re-INVITE
|
|
6289
6701
|
return session.invite(options);
|
|
@@ -6323,6 +6735,9 @@ class WebRTCClient extends Emitter {
|
|
|
6323
6735
|
// (eg: holdModifier)
|
|
6324
6736
|
options.sessionDescriptionHandlerModifiers = [];
|
|
6325
6737
|
}
|
|
6738
|
+
options.sessionDescriptionHandlerOptions = {
|
|
6739
|
+
constraints: options.constraints,
|
|
6740
|
+
};
|
|
6326
6741
|
|
|
6327
6742
|
// Send re-INVITE
|
|
6328
6743
|
return session.invite(options);
|
|
@@ -11934,6 +12349,7 @@ const Wazo = {
|
|
|
11934
12349
|
ServerError,
|
|
11935
12350
|
Call,
|
|
11936
12351
|
CallLog,
|
|
12352
|
+
CTIPhone,
|
|
11937
12353
|
Recording,
|
|
11938
12354
|
ChatMessage,
|
|
11939
12355
|
ChatRoom,
|
|
@@ -11949,6 +12365,7 @@ const Wazo = {
|
|
|
11949
12365
|
CallSession,
|
|
11950
12366
|
IndirectTransfer,
|
|
11951
12367
|
SwitchboardCall,
|
|
12368
|
+
WebRTCPhone,
|
|
11952
12369
|
},
|
|
11953
12370
|
|
|
11954
12371
|
// Api
|