@cognigy/rest-api-client
Version:
Cognigy REST-Client
67 lines • 2.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MuteSpeechInputMapper = void 0;
/* Custom modules */
const base_mapper_1 = require("./base.mapper");
class MuteSpeechInputMapper extends base_mapper_1.BaseMapper {
handleInput(input, api, isGenericNode = false) {
try {
switch (this.endpointType) {
case "bandwidth": {
const output = this.handleBandwidthInput(input, api);
return this.buildPayload(output);
}
case "audioCodes": {
const output = this.handleAudioCodesInput(input, api);
return this.buildPayload(output);
}
case "voiceGateway2":
default: {
const output = this.handleVGInput(input, api);
return this.buildPayload(output);
}
}
}
catch (err) {
const errorMessage = `Error in MuteSpeechInputMapper handleInput: ${err.message}`;
if (typeof api.log === "function") {
api.log("error", errorMessage);
}
throw Error(errorMessage);
}
}
handleVGInput(input, api) {
const { muteSpeechInput = false, muteDtmfInput = false } = input;
const output = {
channelConfig: {
mute: {
muteSpeechInput,
muteDtmfInput
}
}
};
return output;
}
handleAudioCodesInput(input, api) {
const { muteSpeechInput = false } = input;
return {
type: "event",
name: "config",
sessionParams: {
enableSpeechInput: !muteSpeechInput
}
};
}
handleBandwidthInput(input, api) {
const { muteSpeechInput = false } = input;
return {
type: "event",
name: "config",
sessionParams: {
enableSpeechInput: !muteSpeechInput
}
};
}
}
exports.MuteSpeechInputMapper = MuteSpeechInputMapper;
//# sourceMappingURL=muteSpeechInput.mapper.js.map