@cognigy/rest-api-client
Version:
Cognigy REST-Client
127 lines • 4.85 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.callRecordingNode = void 0;
/** Custom Modules */
const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
/** Helper Modules */
const design_1 = require("../utils/design");
const utils_1 = require("./helper/utils");
exports.callRecordingNode = (0, createNodeDescriptor_1.createNodeDescriptor)({
type: "callRecording",
defaultLabel: "Call Recording",
summary: "UI__NODE_EDITOR__CALL_RECORDING__SUMMARY",
fields: [
{
key: "activity",
label: "UI__NODE_EDITOR__CALL_RECORDING__FIELDS__ACTIVITY__LABEL",
type: "select",
description: "UI__NODE_EDITOR__CALL_RECORDING__FIELDS__ACTIVITY__DESCRIPTION",
defaultValue: "startRecording",
params: {
options: [
{ value: "startCallRecording", label: "UI__NODE_EDITOR__CALL_RECORDING__FIELDS__ACTIVITY__OPTIONS__START_CALL_RECORDING" },
{ value: "stopCallRecording", label: "UI__NODE_EDITOR__CALL_RECORDING__FIELDS__ACTIVITY__OPTIONS__STOP_CALL_RECORDING" },
{ value: "pauseCallRecording", label: "UI__NODE_EDITOR__CALL_RECORDING__FIELDS__ACTIVITY__OPTIONS__PAUSE_CALL_RECORDING" },
{ value: "resumeCallRecording", label: "UI__NODE_EDITOR__CALL_RECORDING__FIELDS__ACTIVITY__OPTIONS__RESUME_CALL_RECORDING" },
],
},
},
{
key: "callRecordingServer",
label: "UI__NODE_EDITOR__CALL_RECORDING__FIELDS__CALL_RECORDING_SERVER__LABEL",
type: "cognigyText",
description: "UI__NODE_EDITOR__CALL_RECORDING__FIELDS__CALL_RECORDING_SERVER__DESCRIPTION",
defaultValue: "",
params: {
required: true,
},
condition: {
key: "activity",
value: "startCallRecording",
},
},
{
key: "callRecordingId",
label: "UI__NODE_EDITOR__CALL_RECORDING__FIELDS__CALL_RECORDING_ID__LABEL",
description: "UI__NODE_EDITOR__CALL_RECORDING__FIELDS__CALL_RECORDING_ID__DESCRIPTION",
type: "cognigyText",
defaultValue: "",
params: {
required: true,
},
condition: {
key: "activity",
value: "startCallRecording",
},
},
{
key: "callRecordingDestUsername",
label: "UI__NODE_EDITOR__CALL_RECORDING__FIELDS__CALL_RECORDING_DEST_USERNAME__LABEL",
description: "UI__NODE_EDITOR__CALL_RECORDING__FIELDS__CALL_RECORDING_DEST_USERNAME__DESCRIPTION",
type: "cognigyText",
defaultValue: "",
params: {
required: true,
},
condition: {
key: "activity",
value: "startCallRecording",
},
},
],
appearance: {
color: design_1.nodeColor,
},
preview: {
key: "activity",
type: "text",
},
function: async ({ cognigy, config, nodeId }) => {
const { api } = cognigy;
const { activity, callRecordingDestUsername, callRecordingId, callRecordingServer, } = config;
let activities = [];
switch (activity) {
case "startCallRecording":
if (callRecordingId &&
callRecordingServer &&
callRecordingDestUsername) {
activities.push({
type: "event",
name: activity,
activityParams: {
callRecordingId,
callRecordingDestUsername,
callRecordingServer,
},
});
}
break;
case "pauseCallRecording":
case "resumeCallRecording":
case "stopCallRecording":
activities.push({
type: "event",
name: activity,
});
break;
default:
api.log("error", "Invalid activity");
}
const { isFeatureAccmEnabled } = api.getEndpointSettings();
if (isFeatureAccmEnabled) {
return await api.say(null, {
_cognigy: (0, utils_1.buildPayloadAccm)("callRecording", config, nodeId)
});
}
await api.output(null, {
_cognigy: {
_voiceGateway: {
json: {
activities,
},
},
},
});
},
});
//# sourceMappingURL=callRecording.js.map