@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
package/lib/simple/utils.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
|
|
|
@@ -6546,6 +6955,9 @@ class WebRTCClient extends Emitter {
|
|
|
6546
6955
|
if (!this._isWeb()) {
|
|
6547
6956
|
options.sessionDescriptionHandlerModifiers = [modifiers.holdModifier];
|
|
6548
6957
|
}
|
|
6958
|
+
options.sessionDescriptionHandlerOptions = {
|
|
6959
|
+
constraints: options.constraints,
|
|
6960
|
+
};
|
|
6549
6961
|
|
|
6550
6962
|
// Send re-INVITE
|
|
6551
6963
|
return session.invite(options);
|
|
@@ -6585,6 +6997,9 @@ class WebRTCClient extends Emitter {
|
|
|
6585
6997
|
// (eg: holdModifier)
|
|
6586
6998
|
options.sessionDescriptionHandlerModifiers = [];
|
|
6587
6999
|
}
|
|
7000
|
+
options.sessionDescriptionHandlerOptions = {
|
|
7001
|
+
constraints: options.constraints,
|
|
7002
|
+
};
|
|
6588
7003
|
|
|
6589
7004
|
// Send re-INVITE
|
|
6590
7005
|
return session.invite(options);
|
|
@@ -12180,6 +12595,7 @@ const Wazo = {
|
|
|
12180
12595
|
ServerError,
|
|
12181
12596
|
Call,
|
|
12182
12597
|
CallLog,
|
|
12598
|
+
CTIPhone,
|
|
12183
12599
|
Recording,
|
|
12184
12600
|
ChatMessage,
|
|
12185
12601
|
ChatRoom,
|
|
@@ -12195,6 +12611,7 @@ const Wazo = {
|
|
|
12195
12611
|
CallSession,
|
|
12196
12612
|
IndirectTransfer,
|
|
12197
12613
|
SwitchboardCall,
|
|
12614
|
+
WebRTCPhone,
|
|
12198
12615
|
},
|
|
12199
12616
|
|
|
12200
12617
|
// Api
|
|
@@ -311,7 +311,13 @@ class IssueReporter {
|
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
_isLevelAbove(level1 , level2 ) {
|
|
314
|
-
|
|
314
|
+
const index1 = LOG_LEVELS.indexOf(level1);
|
|
315
|
+
const index2 = LOG_LEVELS.indexOf(level2);
|
|
316
|
+
if (index1 === -1 || index2 === -1) {
|
|
317
|
+
return false;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
return index1 > index2;
|
|
315
321
|
}
|
|
316
322
|
|
|
317
323
|
_makeCategory(category ) {
|
|
@@ -313,7 +313,13 @@ class IssueReporter {
|
|
|
313
313
|
}
|
|
314
314
|
|
|
315
315
|
_isLevelAbove(level1 , level2 ) {
|
|
316
|
-
|
|
316
|
+
const index1 = LOG_LEVELS.indexOf(level1);
|
|
317
|
+
const index2 = LOG_LEVELS.indexOf(level2);
|
|
318
|
+
if (index1 === -1 || index2 === -1) {
|
|
319
|
+
return false;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
return index1 > index2;
|
|
317
323
|
}
|
|
318
324
|
|
|
319
325
|
_makeCategory(category ) {
|
package/lib/web-rtc-client.js
CHANGED
|
@@ -602,7 +602,13 @@ class IssueReporter {
|
|
|
602
602
|
}
|
|
603
603
|
|
|
604
604
|
_isLevelAbove(level1 , level2 ) {
|
|
605
|
-
|
|
605
|
+
const index1 = LOG_LEVELS.indexOf(level1);
|
|
606
|
+
const index2 = LOG_LEVELS.indexOf(level2);
|
|
607
|
+
if (index1 === -1 || index2 === -1) {
|
|
608
|
+
return false;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
return index1 > index2;
|
|
606
612
|
}
|
|
607
613
|
|
|
608
614
|
_makeCategory(category ) {
|
|
@@ -5706,6 +5712,9 @@ class WebRTCClient extends Emitter {
|
|
|
5706
5712
|
if (!this._isWeb()) {
|
|
5707
5713
|
options.sessionDescriptionHandlerModifiers = [modifiers.holdModifier];
|
|
5708
5714
|
}
|
|
5715
|
+
options.sessionDescriptionHandlerOptions = {
|
|
5716
|
+
constraints: options.constraints,
|
|
5717
|
+
};
|
|
5709
5718
|
|
|
5710
5719
|
// Send re-INVITE
|
|
5711
5720
|
return session.invite(options);
|
|
@@ -5745,6 +5754,9 @@ class WebRTCClient extends Emitter {
|
|
|
5745
5754
|
// (eg: holdModifier)
|
|
5746
5755
|
options.sessionDescriptionHandlerModifiers = [];
|
|
5747
5756
|
}
|
|
5757
|
+
options.sessionDescriptionHandlerOptions = {
|
|
5758
|
+
constraints: options.constraints,
|
|
5759
|
+
};
|
|
5748
5760
|
|
|
5749
5761
|
// Send re-INVITE
|
|
5750
5762
|
return session.invite(options);
|
package/lib/websocket-client.js
CHANGED
|
@@ -310,7 +310,13 @@ class IssueReporter {
|
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
_isLevelAbove(level1 , level2 ) {
|
|
313
|
-
|
|
313
|
+
const index1 = LOG_LEVELS.indexOf(level1);
|
|
314
|
+
const index2 = LOG_LEVELS.indexOf(level2);
|
|
315
|
+
if (index1 === -1 || index2 === -1) {
|
|
316
|
+
return false;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
return index1 > index2;
|
|
314
320
|
}
|
|
315
321
|
|
|
316
322
|
_makeCategory(category ) {
|
package/package.json
CHANGED
|
@@ -56,6 +56,8 @@ export interface Phone {
|
|
|
56
56
|
|
|
57
57
|
getLocalStreamForCall(callSession: CallSession): ?MediaStream;
|
|
58
58
|
|
|
59
|
+
getLocalVideoStream(callSession: CallSession): ?MediaStream;
|
|
60
|
+
|
|
59
61
|
getOptions(): AvailablePhoneOptions;
|
|
60
62
|
|
|
61
63
|
getRemoteStreamForCall(callSession: CallSession): ?MediaStream;
|
package/src/index.js
CHANGED
|
@@ -28,6 +28,8 @@ import Room from './domain/Room';
|
|
|
28
28
|
import CallSession from './domain/CallSession';
|
|
29
29
|
import IndirectTransfer from './domain/IndirectTransfer';
|
|
30
30
|
import SwitchboardCall from './domain/SwitchboardCall';
|
|
31
|
+
import WebRTCPhone from './domain/Phone/WebRTCPhone';
|
|
32
|
+
import CTIPhone from './domain/Phone/CTIPhone';
|
|
31
33
|
import type {
|
|
32
34
|
NewContact as NewContactType,
|
|
33
35
|
ContactResponse as ContactResponseType,
|
|
@@ -94,6 +96,7 @@ export default {
|
|
|
94
96
|
ServerError,
|
|
95
97
|
Call,
|
|
96
98
|
CallSession,
|
|
99
|
+
CTIPhone,
|
|
97
100
|
Features,
|
|
98
101
|
IndirectTransfer,
|
|
99
102
|
SwitchboardCall,
|
|
@@ -118,4 +121,5 @@ export default {
|
|
|
118
121
|
LINE_STATE,
|
|
119
122
|
SOCKET_EVENTS,
|
|
120
123
|
Wazo,
|
|
124
|
+
WebRTCPhone,
|
|
121
125
|
};
|
|
@@ -243,7 +243,13 @@ class IssueReporter {
|
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
_isLevelAbove(level1: string, level2: string) {
|
|
246
|
-
|
|
246
|
+
const index1 = LOG_LEVELS.indexOf(level1);
|
|
247
|
+
const index2 = LOG_LEVELS.indexOf(level2);
|
|
248
|
+
if (index1 === -1 || index2 === -1) {
|
|
249
|
+
return false;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return index1 > index2;
|
|
247
253
|
}
|
|
248
254
|
|
|
249
255
|
_makeCategory(category: string) {
|
|
@@ -41,6 +41,8 @@ describe('IssueReporter', () => {
|
|
|
41
41
|
expect(IssueReporter._isLevelAbove('error', 'warn')).toBeTruthy();
|
|
42
42
|
expect(IssueReporter._isLevelAbove('info', 'warn')).toBeFalsy();
|
|
43
43
|
expect(IssueReporter._isLevelAbove('trace', 'trace')).toBeFalsy();
|
|
44
|
+
expect(IssueReporter._isLevelAbove('trace', 'something')).toBeFalsy();
|
|
45
|
+
expect(IssueReporter._isLevelAbove('something', 'trace')).toBeFalsy();
|
|
44
46
|
});
|
|
45
47
|
|
|
46
48
|
it('should send if verbosity is higher than required', () => {
|