@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/Phone.js
CHANGED
|
@@ -887,7 +887,13 @@ class IssueReporter {
|
|
|
887
887
|
}
|
|
888
888
|
|
|
889
889
|
_isLevelAbove(level1 , level2 ) {
|
|
890
|
-
|
|
890
|
+
const index1 = LOG_LEVELS.indexOf(level1);
|
|
891
|
+
const index2 = LOG_LEVELS.indexOf(level2);
|
|
892
|
+
if (index1 === -1 || index2 === -1) {
|
|
893
|
+
return false;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
return index1 > index2;
|
|
891
897
|
}
|
|
892
898
|
|
|
893
899
|
_makeCategory(category ) {
|
|
@@ -910,7 +916,7 @@ var IssueReporter$1 = new IssueReporter();
|
|
|
910
916
|
|
|
911
917
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
912
918
|
|
|
913
|
-
const logger$
|
|
919
|
+
const logger$b = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
914
920
|
|
|
915
921
|
// Use a function here to be able to mock it in tests
|
|
916
922
|
const realFetch = () => {
|
|
@@ -1049,7 +1055,7 @@ class ApiRequester {
|
|
|
1049
1055
|
};
|
|
1050
1056
|
|
|
1051
1057
|
if (this.refreshTokenPromise) {
|
|
1052
|
-
logger$
|
|
1058
|
+
logger$b.info('A token is already refreshing, waiting ...', { url });
|
|
1053
1059
|
await this.refreshTokenPromise;
|
|
1054
1060
|
}
|
|
1055
1061
|
|
|
@@ -1069,7 +1075,7 @@ class ApiRequester {
|
|
|
1069
1075
|
return promise.then(async (err ) => {
|
|
1070
1076
|
// Check if the token is still valid
|
|
1071
1077
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
1072
|
-
logger$
|
|
1078
|
+
logger$b.warn('token expired', { error: err.reason });
|
|
1073
1079
|
// Replay the call after refreshing the token
|
|
1074
1080
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
1075
1081
|
}
|
|
@@ -1079,7 +1085,7 @@ class ApiRequester {
|
|
|
1079
1085
|
: exceptionClass.fromResponse(err, response.status);
|
|
1080
1086
|
|
|
1081
1087
|
if (this.shouldLogErrors) {
|
|
1082
|
-
logger$
|
|
1088
|
+
logger$b.error('API error', error);
|
|
1083
1089
|
}
|
|
1084
1090
|
|
|
1085
1091
|
throw error;
|
|
@@ -1089,7 +1095,7 @@ class ApiRequester {
|
|
|
1089
1095
|
return newParse(response, isJson);
|
|
1090
1096
|
}).catch(error => {
|
|
1091
1097
|
if (this.shouldLogErrors) {
|
|
1092
|
-
logger$
|
|
1098
|
+
logger$b.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
1093
1099
|
}
|
|
1094
1100
|
|
|
1095
1101
|
throw error;
|
|
@@ -1117,13 +1123,13 @@ class ApiRequester {
|
|
|
1117
1123
|
) {
|
|
1118
1124
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
1119
1125
|
let newPath = path;
|
|
1120
|
-
logger$
|
|
1126
|
+
logger$b.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
1121
1127
|
|
|
1122
1128
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
1123
1129
|
|
|
1124
1130
|
return this.refreshTokenPromise.then(() => {
|
|
1125
1131
|
this.refreshTokenPromise = null;
|
|
1126
|
-
logger$
|
|
1132
|
+
logger$b.info('token refreshed', { isTokenNotFound });
|
|
1127
1133
|
if (isTokenNotFound) {
|
|
1128
1134
|
const pathParts = path.split('/');
|
|
1129
1135
|
pathParts.pop();
|
|
@@ -3736,11 +3742,414 @@ class IndirectTransfer {
|
|
|
3736
3742
|
}
|
|
3737
3743
|
|
|
3738
3744
|
//
|
|
3745
|
+
|
|
3746
|
+
class CallApi {
|
|
3747
|
+
static async fetchCallLogs(offset , limit ) {
|
|
3748
|
+
return getApiClient().callLogd.listCallLogs(offset, limit);
|
|
3749
|
+
}
|
|
3750
|
+
|
|
3751
|
+
static async fetchDistinctCallLogs(offset , limit , distinct = 'peer_exten') {
|
|
3752
|
+
return getApiClient().callLogd.listDistinctCallLogs(offset, limit, distinct);
|
|
3753
|
+
}
|
|
3754
|
+
|
|
3755
|
+
static async fetchActiveCalls() {
|
|
3756
|
+
return getApiClient().calld.listCalls();
|
|
3757
|
+
}
|
|
3758
|
+
|
|
3759
|
+
static async fetchCallLogsFromDate(from , number ) {
|
|
3760
|
+
return getApiClient().callLogd.listCallLogsFromDate(from, number);
|
|
3761
|
+
}
|
|
3762
|
+
|
|
3763
|
+
static async search(query , limit ) {
|
|
3764
|
+
return getApiClient().callLogd.search(query, limit);
|
|
3765
|
+
}
|
|
3766
|
+
|
|
3767
|
+
static async searchBy(field , value , limit ) {
|
|
3768
|
+
return getApiClient().callLogd.searchBy(field, value, limit);
|
|
3769
|
+
}
|
|
3770
|
+
|
|
3771
|
+
static async fetchSIP(session , line ) {
|
|
3772
|
+
const lineToUse = line || session.primaryLine();
|
|
3773
|
+
return getApiClient().confd.getUserLineSip(session.uuid, lineToUse ? lineToUse.id : null);
|
|
3774
|
+
}
|
|
3775
|
+
|
|
3776
|
+
static async cancelCall(callSession ) {
|
|
3777
|
+
return getApiClient().calld.cancelCall(callSession.callId);
|
|
3778
|
+
}
|
|
3779
|
+
|
|
3780
|
+
static async makeCall(callFromLine , extension , isMobile = false,
|
|
3781
|
+
callbackAllLines = false) {
|
|
3782
|
+
const lineId = callFromLine ? callFromLine.id : null;
|
|
3783
|
+
|
|
3784
|
+
const response = await getApiClient().calld.makeCall(extension, isMobile, lineId, callbackAllLines);
|
|
3785
|
+
return Call.parse(response);
|
|
3786
|
+
}
|
|
3787
|
+
|
|
3788
|
+
static async relocateCall(callId , line , contactIdentifier ) {
|
|
3789
|
+
return getApiClient().calld.relocateCall(callId, 'line', line, contactIdentifier);
|
|
3790
|
+
}
|
|
3791
|
+
|
|
3792
|
+
static async hold(callId ) {
|
|
3793
|
+
return getApiClient().calld.hold(callId);
|
|
3794
|
+
}
|
|
3795
|
+
|
|
3796
|
+
static async resume(callId ) {
|
|
3797
|
+
return getApiClient().calld.resume(callId);
|
|
3798
|
+
}
|
|
3799
|
+
|
|
3800
|
+
static async mute(callId ) {
|
|
3801
|
+
return getApiClient().calld.mute(callId);
|
|
3802
|
+
}
|
|
3803
|
+
|
|
3804
|
+
static async sendDTMF(callId , digits ) {
|
|
3805
|
+
return getApiClient().calld.sendDTMF(callId, digits);
|
|
3806
|
+
}
|
|
3807
|
+
|
|
3808
|
+
static async unmute(callId ) {
|
|
3809
|
+
return getApiClient().calld.unmute(callId);
|
|
3810
|
+
}
|
|
3811
|
+
|
|
3812
|
+
static async transferCall(callId , number , flow ) {
|
|
3813
|
+
return getApiClient().calld.transferCall(callId, number, flow);
|
|
3814
|
+
}
|
|
3815
|
+
|
|
3816
|
+
static async cancelCallTransfer(transferId ) {
|
|
3817
|
+
return getApiClient().calld.cancelCallTransfer(transferId);
|
|
3818
|
+
}
|
|
3819
|
+
|
|
3820
|
+
static async confirmCallTransfer(transferId ) {
|
|
3821
|
+
return getApiClient().calld.confirmCallTransfer(transferId);
|
|
3822
|
+
}
|
|
3823
|
+
}
|
|
3824
|
+
|
|
3825
|
+
//
|
|
3826
|
+
|
|
3827
|
+
const TRANSFER_FLOW_ATTENDED = 'attended';
|
|
3739
3828
|
const TRANSFER_FLOW_BLIND = 'blind';
|
|
3740
3829
|
|
|
3741
3830
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
3742
3831
|
|
|
3743
|
-
IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
3832
|
+
const logger$a = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
3833
|
+
|
|
3834
|
+
class CTIPhone extends Emitter {
|
|
3835
|
+
|
|
3836
|
+
|
|
3837
|
+
|
|
3838
|
+
|
|
3839
|
+
|
|
3840
|
+
|
|
3841
|
+
|
|
3842
|
+
|
|
3843
|
+
constructor(session , isMobile = false, callbackAllLines = false) {
|
|
3844
|
+
super();
|
|
3845
|
+
logger$a.info('CTI Phone created');
|
|
3846
|
+
this.session = session;
|
|
3847
|
+
this.isMobile = isMobile;
|
|
3848
|
+
this.callbackAllLines = callbackAllLines;
|
|
3849
|
+
}
|
|
3850
|
+
|
|
3851
|
+
getOptions() {
|
|
3852
|
+
// @FIXME: temporarily disabling this option
|
|
3853
|
+
// const hold = this.session.hasEngineVersionGte(MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD);
|
|
3854
|
+
|
|
3855
|
+
return {
|
|
3856
|
+
accept: false,
|
|
3857
|
+
decline: true,
|
|
3858
|
+
mute: true,
|
|
3859
|
+
hold: false,
|
|
3860
|
+
transfer: true,
|
|
3861
|
+
sendKey: true,
|
|
3862
|
+
addParticipant: false,
|
|
3863
|
+
record: true,
|
|
3864
|
+
merge: false,
|
|
3865
|
+
};
|
|
3866
|
+
}
|
|
3867
|
+
|
|
3868
|
+
hasAnActiveCall() {
|
|
3869
|
+
return !!this.currentCall;
|
|
3870
|
+
}
|
|
3871
|
+
|
|
3872
|
+
callCount() {
|
|
3873
|
+
return this.currentCall ? 1 : 0;
|
|
3874
|
+
}
|
|
3875
|
+
|
|
3876
|
+
isWebRTC() {
|
|
3877
|
+
return false;
|
|
3878
|
+
}
|
|
3879
|
+
|
|
3880
|
+
getUserAgent() {
|
|
3881
|
+
return 'cti-phone';
|
|
3882
|
+
}
|
|
3883
|
+
|
|
3884
|
+
startHeartbeat() {
|
|
3885
|
+
}
|
|
3886
|
+
|
|
3887
|
+
setOnHeartbeatTimeout() {
|
|
3888
|
+
}
|
|
3889
|
+
|
|
3890
|
+
setOnHeartbeatCallback() {
|
|
3891
|
+
}
|
|
3892
|
+
|
|
3893
|
+
stopHeartbeat() {
|
|
3894
|
+
}
|
|
3895
|
+
|
|
3896
|
+
bindClientEvents() {
|
|
3897
|
+
}
|
|
3898
|
+
|
|
3899
|
+
onConnect() {
|
|
3900
|
+
}
|
|
3901
|
+
|
|
3902
|
+
onDisconnect() {
|
|
3903
|
+
}
|
|
3904
|
+
|
|
3905
|
+
async makeCall(number , line ) {
|
|
3906
|
+
logger$a.info('make CTI call', { number });
|
|
3907
|
+
|
|
3908
|
+
if (!number) {
|
|
3909
|
+
return null;
|
|
3910
|
+
}
|
|
3911
|
+
try {
|
|
3912
|
+
this.currentCall = await CallApi.makeCall(line, number, this.isMobile, this.callbackAllLines);
|
|
3913
|
+
} catch (_) {
|
|
3914
|
+
// We have to deal with error like `User has no mobile phone number` error in the UI.
|
|
3915
|
+
}
|
|
3916
|
+
if (!this.currentCall) {
|
|
3917
|
+
return null;
|
|
3918
|
+
}
|
|
3919
|
+
const callSession = CallSession.parseCall(this.currentCall);
|
|
3920
|
+
this.eventEmitter.emit('onCallOutgoing', callSession);
|
|
3921
|
+
|
|
3922
|
+
return callSession;
|
|
3923
|
+
}
|
|
3924
|
+
|
|
3925
|
+
accept(callSession ) {
|
|
3926
|
+
if (!callSession) {
|
|
3927
|
+
return Promise.resolve(null);
|
|
3928
|
+
}
|
|
3929
|
+
logger$a.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
3930
|
+
|
|
3931
|
+
if (!this.currentCall) {
|
|
3932
|
+
this.currentCall = callSession.call;
|
|
3933
|
+
}
|
|
3934
|
+
|
|
3935
|
+
return Promise.resolve(callSession.getId());
|
|
3936
|
+
}
|
|
3937
|
+
|
|
3938
|
+
endCurrentCall(callSession ) {
|
|
3939
|
+
if (!callSession) {
|
|
3940
|
+
return;
|
|
3941
|
+
}
|
|
3942
|
+
logger$a.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
3943
|
+
|
|
3944
|
+
this.currentCall = undefined;
|
|
3945
|
+
this.eventEmitter.emit('onCallEnded', callSession);
|
|
3946
|
+
}
|
|
3947
|
+
|
|
3948
|
+
async hangup(callSession ) {
|
|
3949
|
+
if (!callSession) {
|
|
3950
|
+
return Promise.resolve(false);
|
|
3951
|
+
}
|
|
3952
|
+
logger$a.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
3953
|
+
|
|
3954
|
+
try {
|
|
3955
|
+
await CallApi.cancelCall(callSession);
|
|
3956
|
+
if (this.currentCall && callSession.callId === this.currentCall.id) {
|
|
3957
|
+
this.endCurrentCall(callSession);
|
|
3958
|
+
}
|
|
3959
|
+
|
|
3960
|
+
this.eventEmitter.emit('onCallEnded', callSession);
|
|
3961
|
+
return true;
|
|
3962
|
+
} catch (e) {
|
|
3963
|
+
logger$a.error('hangup CTI call, error', e);
|
|
3964
|
+
|
|
3965
|
+
this.eventEmitter.emit('onCallFailed', callSession);
|
|
3966
|
+
return false;
|
|
3967
|
+
}
|
|
3968
|
+
}
|
|
3969
|
+
|
|
3970
|
+
ignore() {}
|
|
3971
|
+
|
|
3972
|
+
async reject(callSession ) {
|
|
3973
|
+
if (!callSession) {
|
|
3974
|
+
return;
|
|
3975
|
+
}
|
|
3976
|
+
logger$a.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
3977
|
+
|
|
3978
|
+
await CallApi.cancelCall(callSession);
|
|
3979
|
+
this.eventEmitter.emit('onCallEnded', callSession);
|
|
3980
|
+
}
|
|
3981
|
+
|
|
3982
|
+
async transfer(callSession , number ) {
|
|
3983
|
+
if (!callSession) {
|
|
3984
|
+
return;
|
|
3985
|
+
}
|
|
3986
|
+
logger$a.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
3987
|
+
|
|
3988
|
+
await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
|
|
3989
|
+
}
|
|
3990
|
+
|
|
3991
|
+
indirectTransfer() {}
|
|
3992
|
+
|
|
3993
|
+
async initiateCTIIndirectTransfer(callSession , number ) {
|
|
3994
|
+
if (!callSession) {
|
|
3995
|
+
return;
|
|
3996
|
+
}
|
|
3997
|
+
logger$a.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
3998
|
+
|
|
3999
|
+
return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
|
|
4000
|
+
}
|
|
4001
|
+
|
|
4002
|
+
async cancelCTIIndirectTransfer(transferId ) {
|
|
4003
|
+
logger$a.info('cancel CTI transfer', { transferId });
|
|
4004
|
+
|
|
4005
|
+
return CallApi.cancelCallTransfer(transferId);
|
|
4006
|
+
}
|
|
4007
|
+
|
|
4008
|
+
async confirmCTIIndirectTransfer(transferId ) {
|
|
4009
|
+
logger$a.info('confirm CTI transfer', { transferId });
|
|
4010
|
+
|
|
4011
|
+
return CallApi.confirmCallTransfer(transferId);
|
|
4012
|
+
}
|
|
4013
|
+
|
|
4014
|
+
sendKey(callSession , digits ) {
|
|
4015
|
+
if (!callSession) {
|
|
4016
|
+
return;
|
|
4017
|
+
}
|
|
4018
|
+
logger$a.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
|
|
4019
|
+
|
|
4020
|
+
return CallApi.sendDTMF(callSession.callId, digits);
|
|
4021
|
+
}
|
|
4022
|
+
|
|
4023
|
+
onConnectionMade() {
|
|
4024
|
+
logger$a.info('on CTI connection made');
|
|
4025
|
+
|
|
4026
|
+
this.eventEmitter.emit('onCallAccepted');
|
|
4027
|
+
}
|
|
4028
|
+
|
|
4029
|
+
async close() {
|
|
4030
|
+
logger$a.info('CTI close');
|
|
4031
|
+
|
|
4032
|
+
return Promise.resolve();
|
|
4033
|
+
}
|
|
4034
|
+
|
|
4035
|
+
async hold(callSession ) {
|
|
4036
|
+
if (!callSession) {
|
|
4037
|
+
return;
|
|
4038
|
+
}
|
|
4039
|
+
logger$a.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
|
|
4040
|
+
|
|
4041
|
+
return CallApi.hold(callSession.callId);
|
|
4042
|
+
}
|
|
4043
|
+
|
|
4044
|
+
async resume(callSession ) {
|
|
4045
|
+
if (!callSession) {
|
|
4046
|
+
return;
|
|
4047
|
+
}
|
|
4048
|
+
logger$a.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
|
|
4049
|
+
|
|
4050
|
+
return CallApi.resume(callSession.callId);
|
|
4051
|
+
}
|
|
4052
|
+
|
|
4053
|
+
async mute(callSession ) {
|
|
4054
|
+
if (!callSession) {
|
|
4055
|
+
return;
|
|
4056
|
+
}
|
|
4057
|
+
logger$a.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
|
|
4058
|
+
|
|
4059
|
+
return CallApi.mute(callSession.callId);
|
|
4060
|
+
}
|
|
4061
|
+
|
|
4062
|
+
async unmute(callSession ) {
|
|
4063
|
+
if (!callSession) {
|
|
4064
|
+
return;
|
|
4065
|
+
}
|
|
4066
|
+
logger$a.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
|
|
4067
|
+
|
|
4068
|
+
return CallApi.unmute(callSession.callId);
|
|
4069
|
+
}
|
|
4070
|
+
|
|
4071
|
+
putOnSpeaker() {}
|
|
4072
|
+
|
|
4073
|
+
putOffSpeaker() {}
|
|
4074
|
+
|
|
4075
|
+
turnCameraOff() {}
|
|
4076
|
+
|
|
4077
|
+
turnCameraOn() {}
|
|
4078
|
+
|
|
4079
|
+
changeAudioInputDevice() {}
|
|
4080
|
+
|
|
4081
|
+
changeVideoInputDevice() {}
|
|
4082
|
+
|
|
4083
|
+
changeAudioDevice() {}
|
|
4084
|
+
|
|
4085
|
+
changeRingDevice() {}
|
|
4086
|
+
|
|
4087
|
+
changeAudioVolume() {}
|
|
4088
|
+
|
|
4089
|
+
changeRingVolume() {}
|
|
4090
|
+
|
|
4091
|
+
hasVideo() {
|
|
4092
|
+
return false;
|
|
4093
|
+
}
|
|
4094
|
+
|
|
4095
|
+
getLocalStreamForCall() {
|
|
4096
|
+
return null;
|
|
4097
|
+
}
|
|
4098
|
+
|
|
4099
|
+
getRemoteStreamForCall() {
|
|
4100
|
+
return null;
|
|
4101
|
+
}
|
|
4102
|
+
|
|
4103
|
+
getLocalVideoStream() {
|
|
4104
|
+
return null;
|
|
4105
|
+
}
|
|
4106
|
+
|
|
4107
|
+
setActiveSipSession() {}
|
|
4108
|
+
|
|
4109
|
+
isRegistered() {
|
|
4110
|
+
return true;
|
|
4111
|
+
}
|
|
4112
|
+
|
|
4113
|
+
hasIncomingCallSession() {
|
|
4114
|
+
return true;
|
|
4115
|
+
}
|
|
4116
|
+
|
|
4117
|
+
hasActiveRemoteVideoStream() {
|
|
4118
|
+
return false;
|
|
4119
|
+
}
|
|
4120
|
+
|
|
4121
|
+
getCurrentCallSession() {
|
|
4122
|
+
return this.currentCall ? CallSession.parseCall(this.currentCall) : null;
|
|
4123
|
+
}
|
|
4124
|
+
|
|
4125
|
+
enableRinging() {}
|
|
4126
|
+
|
|
4127
|
+
sendMessage() {}
|
|
4128
|
+
|
|
4129
|
+
disableRinging() {}
|
|
4130
|
+
|
|
4131
|
+
getLocalStream() {
|
|
4132
|
+
return null;
|
|
4133
|
+
}
|
|
4134
|
+
|
|
4135
|
+
getRemoteStream() {
|
|
4136
|
+
return null;
|
|
4137
|
+
}
|
|
4138
|
+
|
|
4139
|
+
getRemoteVideoStream() {
|
|
4140
|
+
return null;
|
|
4141
|
+
}
|
|
4142
|
+
|
|
4143
|
+
getRemoteAudioStream() {
|
|
4144
|
+
return null;
|
|
4145
|
+
}
|
|
4146
|
+
|
|
4147
|
+
hasLocalVideo() {
|
|
4148
|
+
return false;
|
|
4149
|
+
}
|
|
4150
|
+
|
|
4151
|
+
useLocalVideoElement() {}
|
|
4152
|
+
}
|
|
3744
4153
|
|
|
3745
4154
|
/* */
|
|
3746
4155
|
|
|
@@ -6282,6 +6691,9 @@ class WebRTCClient extends Emitter {
|
|
|
6282
6691
|
if (!this._isWeb()) {
|
|
6283
6692
|
options.sessionDescriptionHandlerModifiers = [modifiers.holdModifier];
|
|
6284
6693
|
}
|
|
6694
|
+
options.sessionDescriptionHandlerOptions = {
|
|
6695
|
+
constraints: options.constraints,
|
|
6696
|
+
};
|
|
6285
6697
|
|
|
6286
6698
|
// Send re-INVITE
|
|
6287
6699
|
return session.invite(options);
|
|
@@ -6321,6 +6733,9 @@ class WebRTCClient extends Emitter {
|
|
|
6321
6733
|
// (eg: holdModifier)
|
|
6322
6734
|
options.sessionDescriptionHandlerModifiers = [];
|
|
6323
6735
|
}
|
|
6736
|
+
options.sessionDescriptionHandlerOptions = {
|
|
6737
|
+
constraints: options.constraints,
|
|
6738
|
+
};
|
|
6324
6739
|
|
|
6325
6740
|
// Send re-INVITE
|
|
6326
6741
|
return session.invite(options);
|
|
@@ -11814,6 +12229,7 @@ const Wazo = {
|
|
|
11814
12229
|
ServerError,
|
|
11815
12230
|
Call,
|
|
11816
12231
|
CallLog,
|
|
12232
|
+
CTIPhone,
|
|
11817
12233
|
Recording,
|
|
11818
12234
|
ChatMessage,
|
|
11819
12235
|
ChatRoom,
|
|
@@ -11829,6 +12245,7 @@ const Wazo = {
|
|
|
11829
12245
|
CallSession,
|
|
11830
12246
|
IndirectTransfer,
|
|
11831
12247
|
SwitchboardCall,
|
|
12248
|
+
WebRTCPhone,
|
|
11832
12249
|
},
|
|
11833
12250
|
|
|
11834
12251
|
// Api
|
package/lib/simple/Websocket.js
CHANGED
|
@@ -308,7 +308,13 @@ class IssueReporter {
|
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
_isLevelAbove(level1 , level2 ) {
|
|
311
|
-
|
|
311
|
+
const index1 = LOG_LEVELS.indexOf(level1);
|
|
312
|
+
const index2 = LOG_LEVELS.indexOf(level2);
|
|
313
|
+
if (index1 === -1 || index2 === -1) {
|
|
314
|
+
return false;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
return index1 > index2;
|
|
312
318
|
}
|
|
313
319
|
|
|
314
320
|
_makeCategory(category ) {
|