UNPKG

@cognigy/rest-api-client

Version:

Cognigy REST-Client

109 lines 3.73 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.recordNode = void 0; /** Custom Modules */ const createNodeDescriptor_1 = require("../../../createNodeDescriptor"); const design_1 = require("../utils/design"); const record_mapper_1 = require("../../voice/mappers/record.mapper"); const mapper = new record_mapper_1.RecordMapper("voiceGateway2"); exports.recordNode = (0, createNodeDescriptor_1.createNodeDescriptor)({ type: "record", defaultLabel: "Call Recording", summary: "UI__NODE_EDITOR__VOICEGATEWAY2__RECORD__SUMMARY", preview: { key: "action", type: "text" }, appearance: { color: design_1.nodeColor }, tags: ["voice"], constraints: { placement: {}, }, fields: [ { key: "action", label: "UI__NODE_EDITOR__VOICEGATEWAY2__FIELDS__ACTION__LABEL", type: "select", params: { options: [ { label: "UI__NODE_EDITOR__VOICEGATEWAY2__FIELDS__ACTION__OPTIONS__START_CALL_RECORDING__LABEL", value: "startCallRecording" }, { label: "UI__NODE_EDITOR__VOICEGATEWAY2__FIELDS__ACTION__OPTIONS__STOP_CALL_RECORDING__LABEL", value: "stopCallRecording" }, { label: "UI__NODE_EDITOR__VOICEGATEWAY2__FIELDS__ACTION__OPTIONS__PAUSE_CALL_RECORDING__LABEL", value: "pauseCallRecording" }, { label: "UI__NODE_EDITOR__VOICEGATEWAY2__FIELDS__ACTION__OPTIONS__RESUME_CALL_RECORDING__LABEL", value: "resumeCallRecording" } ] }, defaultValue: "startCallRecording", description: "UI__NODE_EDITOR__VOICEGATEWAY2__FIELDS__ACTION__DESCRIPTION" }, { key: "siprecServerURL", label: "UI__NODE_EDITOR__VOICEGATEWAY2__FIELDS__SIPREC_SERVER_URL__LABEL", type: "cognigyText", description: "UI__NODE_EDITOR__VOICEGATEWAY2__FIELDS__SIPREC_SERVER_URL__DESCRIPTION", defaultValue: "", condition: { key: "action", value: "startCallRecording" } }, { key: "recordingId", label: "UI__NODE_EDITOR__VOICEGATEWAY2__FIELDS__RECORDING_ID__LABEL", type: "cognigyText", description: "UI__NODE_EDITOR__VOICEGATEWAY2__FIELDS__RECORDING_ID__DESCRIPTION", defaultValue: "", condition: { key: "action", value: "startCallRecording" } }, ], sections: [], form: [ { type: "field", key: "action" }, { type: "field", key: "siprecServerURL" }, { type: "field", key: "recordingId" }, ], function: async ({ cognigy, config }) => { const { api } = cognigy; const { action, recordingId, siprecServerURL, } = config; const recordInput = { action, recordingId, siprecServerURL, }; try { const payload = mapper.handleInput(recordInput, api, false); await api.say(null, { _cognigy: payload }); } catch (error) { throw new Error(`Error on Record node. Error message: ${error.message}`); } } }); //# sourceMappingURL=record.js.map