@cognigy/rest-api-client 0.13.1 → 0.14.0

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.
Files changed (110) hide show
  1. package/.eslintConfig.json +117 -0
  2. package/.eslintrc.json +2 -2
  3. package/CHANGELOG.md +12 -1
  4. package/build/apigroups/ResourcesAPIGroup_2_0.js +25 -4
  5. package/build/shared/charts/descriptors/allFields.js +8 -0
  6. package/build/shared/charts/descriptors/apps/getAppSessionPin.js +9 -9
  7. package/build/shared/charts/descriptors/apps/initAppSession.js +36 -53
  8. package/build/shared/charts/descriptors/apps/setAdaptiveCardAppState.js +5 -18
  9. package/build/shared/charts/descriptors/apps/setAppState.js +6 -6
  10. package/build/shared/charts/descriptors/apps/setHtmlAppState.js +85 -15
  11. package/build/shared/charts/descriptors/apps/utils/buildAppUrl.js +12 -0
  12. package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/azureOpenAIProviderConnection.js +14 -0
  13. package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/index.js +19 -0
  14. package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/openAIProviderConnection.js +11 -0
  15. package/build/shared/charts/descriptors/index.js +9 -6
  16. package/build/shared/charts/descriptors/logic/switch/switch.js +3 -2
  17. package/build/shared/charts/descriptors/message/question/optionalQuestion.js +30 -7
  18. package/build/shared/charts/descriptors/message/question/question.js +200 -28
  19. package/build/shared/charts/descriptors/message/question/utils/evaluateQuestionAnswer.js +6 -0
  20. package/build/shared/charts/descriptors/message/say.js +33 -2
  21. package/build/shared/charts/descriptors/service/completeText.js +316 -0
  22. package/build/shared/charts/descriptors/service/handoverV2.js +48 -2
  23. package/build/shared/charts/descriptors/service/index.js +3 -1
  24. package/build/shared/charts/descriptors/voice/mappers/setSessionConfig.mapper.js +62 -26
  25. package/build/shared/charts/descriptors/voice/mappers/transfer.mapper.js +93 -32
  26. package/build/shared/charts/descriptors/voice/nodes/bargeIn.js +53 -0
  27. package/build/shared/charts/descriptors/voice/nodes/dtmf.js +5 -3
  28. package/build/shared/charts/descriptors/voice/nodes/play.js +14 -5
  29. package/build/shared/charts/descriptors/voice/nodes/sessionSpeechParameters.js +90 -8
  30. package/build/shared/charts/descriptors/voice/nodes/transfer.js +6 -2
  31. package/build/shared/charts/descriptors/voice/utils/helper.js +11 -1
  32. package/build/shared/charts/descriptors/voicegateway/nodes/agentAssist.js +2 -2
  33. package/build/shared/charts/descriptors/voicegateway/nodes/handover.js +5 -1
  34. package/build/shared/charts/descriptors/voicegateway2/nodes/play.js +20 -5
  35. package/build/shared/charts/descriptors/voicegateway2/nodes/refer.js +3 -3
  36. package/build/shared/charts/descriptors/voicegateway2/nodes/setSessionConfig.js +150 -33
  37. package/build/shared/charts/descriptors/voicegateway2/nodes/transfer.js +95 -7
  38. package/build/shared/charts/descriptors/voicegateway2/utils/helper.js +18 -11
  39. package/build/shared/charts/descriptors/voicegateway2/utils/strip-nulls.js +4 -1
  40. package/build/shared/charts/helpers/generativeAI/getRephraseWithAIFields.js +100 -0
  41. package/build/shared/charts/helpers/generativeAI/rephraseSentenceWithAi.js +44 -0
  42. package/build/shared/constants.js +2 -1
  43. package/build/shared/errors/BadGatewayError.js +2 -1
  44. package/build/shared/errors/BadRequestError.js +2 -1
  45. package/build/shared/errors/ForbiddenError.js +2 -1
  46. package/build/shared/errors/GatewayTimeoutError.js +2 -1
  47. package/build/shared/errors/MethodNotAllowedError.js +2 -1
  48. package/build/shared/errors/NetworkError.js +2 -1
  49. package/build/shared/errors/PayloadTooLargeError.js +2 -1
  50. package/build/shared/errors/PaymentRequiredError.js +2 -1
  51. package/build/shared/errors/ServiceUnavailableError.js +2 -1
  52. package/build/shared/errors/UnauthorizedError.js +2 -1
  53. package/build/shared/errors/baseError.js +27 -4
  54. package/build/shared/errors/conflict.js +2 -1
  55. package/build/shared/errors/databaseConnectError.js +2 -2
  56. package/build/shared/errors/databaseQueryError.js +2 -2
  57. package/build/shared/errors/databaseRead.js +2 -2
  58. package/build/shared/errors/databaseWrite.js +2 -2
  59. package/build/shared/errors/exportError.js +2 -2
  60. package/build/shared/errors/fileRead.js +2 -2
  61. package/build/shared/errors/fileWrite.js +2 -2
  62. package/build/shared/errors/importError.js +1 -1
  63. package/build/shared/errors/inputOutputError.js +2 -2
  64. package/build/shared/errors/internalServerError.js +2 -1
  65. package/build/shared/errors/invalidArgument.js +2 -2
  66. package/build/shared/errors/missingArgument.js +2 -2
  67. package/build/shared/errors/notImplementedError.js +2 -1
  68. package/build/shared/errors/process.js +2 -2
  69. package/build/shared/errors/resourceNotFound.js +5 -1
  70. package/build/shared/errors/smtpConnectError.js +2 -2
  71. package/build/shared/errors/timeoutError.js +2 -2
  72. package/build/shared/interfaces/ai.js +16 -0
  73. package/build/shared/interfaces/analytics/IAnalyticsDataGoals.js +3 -0
  74. package/build/shared/interfaces/endpointInterface.js +1 -0
  75. package/build/shared/interfaces/filemanager/IRuntimeFile.js +30 -0
  76. package/build/shared/interfaces/filemanager/index.js +1 -0
  77. package/build/shared/interfaces/handover.js +40 -3
  78. package/build/shared/interfaces/messageAPI/endpoints.js +2 -0
  79. package/build/shared/interfaces/messageAPI/handover.js +6 -0
  80. package/build/shared/interfaces/resources/IAgentAssistConfig.js +56 -0
  81. package/build/shared/interfaces/resources/IConnectionSchema.js +2 -1
  82. package/build/shared/interfaces/resources/IExtension.js +2 -1
  83. package/build/shared/interfaces/resources/IFlow.js +2 -1
  84. package/build/shared/interfaces/resources/ILexicon.js +15 -2
  85. package/build/shared/interfaces/resources/ILocale.js +25 -3
  86. package/build/shared/interfaces/resources/INodeDescriptorSet.js +2 -1
  87. package/build/shared/interfaces/resources/TResourceType.js +3 -0
  88. package/build/shared/interfaces/resources/intent/IIntent.js +5 -2
  89. package/build/shared/interfaces/resources/intent/IIntentRelation.js +3 -1
  90. package/build/shared/interfaces/resources/settings/IAgentSettings.js +9 -4
  91. package/build/shared/interfaces/resources/settings/IGenerativeAISettings.js +136 -0
  92. package/build/shared/interfaces/resources/settings/ISharedSettings.js +1 -1
  93. package/build/shared/interfaces/resources/settings/index.js +7 -1
  94. package/build/shared/interfaces/resources/yesNoIntent/IYesNoItem.js +5 -5
  95. package/build/shared/interfaces/restAPI/administration/liveAgent/v2.0/ICognigyLiveAgentMiddleware_2_0.js +3 -0
  96. package/build/shared/interfaces/restAPI/resources/agentAssist/v2.0/IAgentAssistConfig_2_0.js +3 -0
  97. package/build/shared/interfaces/restAPI/resources/agentAssist/v2.0/ICreateAgentAssistConfigRest_2_0.js +3 -0
  98. package/build/shared/interfaces/restAPI/resources/agentAssist/v2.0/IDeleteAgentAssistConfigRest_2_0.js +3 -0
  99. package/build/shared/interfaces/restAPI/resources/agentAssist/v2.0/IIndexAgentAssistConfigsRest_2_0.js +3 -0
  100. package/build/shared/interfaces/restAPI/resources/agentAssist/v2.0/IReadAgentAssistConfigRest_2_0.js +3 -0
  101. package/build/shared/interfaces/restAPI/resources/agentAssist/v2.0/IUpdateAgentAssistConfigRest_2_0.js +3 -0
  102. package/build/shared/interfaces/restAPI/resources/agentAssist/v2.0/index.js +3 -0
  103. package/build/shared/interfaces/restAPI/resources/flow/v2.0/sentence/IGenerateSentencesRest_2_0.js +3 -0
  104. package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoIntents/ITrainYesNoIntentsProjectRest_2_0.js +3 -0
  105. package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoIntents/IYesNoIntents_2_0.js +4 -4
  106. package/build/shared/interfaces/security/IACL.js +1 -1
  107. package/build/shared/interfaces/security/IPermission.js +2 -0
  108. package/build/shared/interfaces/security/IRole.js +4 -0
  109. package/package.json +2 -2
  110. package/types/index.d.ts +925 -388
@@ -1,52 +1,108 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transfer = void 0;
3
+ exports.prepareTransferParams = exports.transfer = void 0;
4
+ /* Node modules */
5
+ const path_1 = require("path");
6
+ /* Custom modules */
4
7
  const constants_1 = require("../utils/constants");
8
+ const helper_1 = require("../../../descriptors/voicegateway2/utils/helper");
9
+ const helper_2 = require("../utils/helper");
5
10
  exports.transfer = {
6
11
  handleInput(endpointType, params, isGenericNode) {
7
12
  try {
8
- if (endpointType === constants_1.ENDPOINTS.AUDIO_CODES && isGenericNode && params.transferSipHeaders) {
9
- const { transferReason, transferTarget, useTransferSipHeaders, transferSipHeaders } = params;
10
- let headers = [];
11
- for (const [key, value] of Object.entries(transferSipHeaders)) {
12
- const entry = { "name": key, "value": value };
13
- headers.push(entry);
14
- }
15
- ;
16
- const target = transferTarget.includes("@")
17
- ? transferTarget
18
- : `tel:${transferTarget}`;
19
- return this.handleAudioCodesInput({ transferReason, transferTarget: target, useTransferSipHeaders, transferSipHeaders: headers });
20
- }
21
- if (endpointType === constants_1.ENDPOINTS.VOICE_GATEWAY) {
22
- return this.handleVGInput(params);
23
- }
24
- else if (endpointType === constants_1.ENDPOINTS.AUDIO_CODES) {
25
- return this.handleAudioCodesInput(params);
26
- }
27
- else {
28
- return this.handleVGInput(params);
13
+ switch (endpointType) {
14
+ case constants_1.ENDPOINTS.AUDIO_CODES:
15
+ if (isGenericNode && params.transferSipHeaders) {
16
+ let headers = [];
17
+ for (const [key, value] of Object.entries(params.transferSipHeaders)) {
18
+ headers.push({
19
+ name: key,
20
+ value
21
+ });
22
+ }
23
+ ;
24
+ params.transferSipHeaders = headers;
25
+ }
26
+ return this.handleAudioCodesInput((0, exports.prepareTransferParams)(params));
27
+ case constants_1.ENDPOINTS.VOICE_GATEWAY:
28
+ default:
29
+ return this.handleVGInput((0, exports.prepareTransferParams)(params));
29
30
  }
30
- ;
31
31
  }
32
32
  catch (error) {
33
33
  throw Error(error.message);
34
34
  }
35
35
  },
36
36
  handleVGInput(transferParam) {
37
- const { transferTarget, useTransferSipHeaders, transferSipHeaders } = transferParam;
37
+ const { transferType, transferTarget, transferReason, useTransferSipHeaders, transferSipHeaders, dialMusic, dialTranscriptionWebhook, dialCallerId } = transferParam;
38
38
  const payload = {
39
39
  _voiceGateway2: {
40
- json: {
41
- "sip:refer": {
42
- "referTo": transferTarget,
43
- "actionHook": 'refer'
44
- }
45
- }
40
+ json: {}
46
41
  }
47
42
  };
43
+ let headers = {
44
+ "X-Reason": transferReason,
45
+ };
48
46
  if (useTransferSipHeaders && typeof transferSipHeaders === "object") {
49
- payload._voiceGateway2.json["sip:refer"]["headers"] = transferSipHeaders;
47
+ headers = Object.assign(Object.assign({}, headers), transferSipHeaders);
48
+ }
49
+ switch (transferType) {
50
+ case "dial":
51
+ const dialVerb = {
52
+ actionHook: "dial",
53
+ headers,
54
+ target: [],
55
+ };
56
+ const phoneTarget = {
57
+ type: "phone",
58
+ number: (0, helper_1.cleanTarget)(transferTarget, false),
59
+ };
60
+ const sipTarget = {
61
+ type: "sip",
62
+ sipUri: (0, helper_1.cleanTarget)(transferTarget, false),
63
+ };
64
+ /* By default we set the target to phone */
65
+ dialVerb.target = [phoneTarget];
66
+ /* If targets includes an @ we set the target to sip */
67
+ if (transferTarget === null || transferTarget === void 0 ? void 0 : transferTarget.includes("@")) {
68
+ dialVerb.target = [sipTarget];
69
+ }
70
+ if (dialTranscriptionWebhook === null || dialTranscriptionWebhook === void 0 ? void 0 : dialTranscriptionWebhook.length) {
71
+ if (!(0, helper_2.isValidUrl)(dialTranscriptionWebhook)) {
72
+ throw new Error(`Transcription webhook URL is invalid ${dialTranscriptionWebhook}`);
73
+ }
74
+ const transcribeVerb = {
75
+ transcriptionHook: dialTranscriptionWebhook,
76
+ };
77
+ dialVerb.transcribe = transcribeVerb;
78
+ }
79
+ if (dialMusic === null || dialMusic === void 0 ? void 0 : dialMusic.length) {
80
+ if (!(0, helper_2.isValidUrl)(dialMusic)) {
81
+ throw new Error(`Audio file URL is invalid ${dialMusic}`);
82
+ }
83
+ const extension = (0, path_1.extname)(dialMusic);
84
+ if (extension !== (".mp3" || ".wav")) {
85
+ throw new Error(`Audio file must be from type .mp3 or .wav. Extension was: ${extension}`);
86
+ }
87
+ dialVerb.dialMusic = dialMusic;
88
+ }
89
+ if (dialCallerId === null || dialCallerId === void 0 ? void 0 : dialCallerId.length) {
90
+ if (!(0, helper_2.isValidPhoneNumber)(dialCallerId)) {
91
+ throw new Error(`Caller ID must be a valid phone number ${dialCallerId}`);
92
+ }
93
+ dialVerb.callerId = dialCallerId;
94
+ }
95
+ payload._voiceGateway2.json["dial"] = dialVerb;
96
+ break;
97
+ case "refer":
98
+ default:
99
+ const referVerb = {
100
+ "referTo": (0, helper_1.cleanTarget)(transferTarget, false),
101
+ "actionHook": 'refer',
102
+ headers
103
+ };
104
+ payload._voiceGateway2.json["sip:refer"] = referVerb;
105
+ break;
50
106
  }
51
107
  return payload;
52
108
  },
@@ -56,7 +112,7 @@ exports.transfer = {
56
112
  "type": "event",
57
113
  "name": "transfer",
58
114
  "activityParams": {
59
- "transferTarget": transferTarget,
115
+ "transferTarget": (0, helper_1.cleanTarget)(transferTarget, true),
60
116
  "handoverReason": transferReason,
61
117
  }
62
118
  };
@@ -83,4 +139,9 @@ exports.transfer = {
83
139
  return payload;
84
140
  }
85
141
  };
142
+ const prepareTransferParams = (transferParam) => {
143
+ const { transferReason, dialMusic, dialTranscriptionWebhook } = transferParam;
144
+ return Object.assign(Object.assign({}, transferParam), { transferReason: transferReason === null || transferReason === void 0 ? void 0 : transferReason.trim(), dialMusic: dialMusic === null || dialMusic === void 0 ? void 0 : dialMusic.trim(), dialTranscriptionWebhook: dialTranscriptionWebhook === null || dialTranscriptionWebhook === void 0 ? void 0 : dialTranscriptionWebhook.trim() });
145
+ };
146
+ exports.prepareTransferParams = prepareTransferParams;
86
147
  //# sourceMappingURL=transfer.mapper.js.map
@@ -42,12 +42,65 @@ exports.BARGE_IN = (0, createNodeDescriptor_1.createNodeDescriptor)({
42
42
  step: 1,
43
43
  },
44
44
  },
45
+ {
46
+ key: "dtmfInterDigitTimeout",
47
+ type: "number",
48
+ label: "DTMF Inter Digit Timeout",
49
+ description: "Defines the timeout in between collected DTMF digits",
50
+ defaultValue: 2000,
51
+ params: {
52
+ min: 0,
53
+ },
54
+ },
55
+ {
56
+ key: "dtmfMaxDigits",
57
+ type: "number",
58
+ label: "DTMF Max Digits",
59
+ description: "Defines the maximum number of digits which can be entered by the user, the digits are being submitted automatically once this limit is reached",
60
+ defaultValue: 1,
61
+ params: {
62
+ min: 1,
63
+ },
64
+ },
65
+ {
66
+ key: "dtmfSubmitDigit",
67
+ type: "cognigyText",
68
+ label: "DTMF Submit Digit",
69
+ description: "Defines the DTMF submit digit which will be used for submitting the previously entered digits.",
70
+ defaultValue: "#",
71
+ },
72
+ ],
73
+ sections: [
74
+ {
75
+ key: "paramsDtmf",
76
+ label: "DTMF",
77
+ defaultCollapsed: false,
78
+ fields: ["dtmfInterDigitTimeout", "dtmfMaxDigits", "dtmfSubmitDigit"],
79
+ condition: {
80
+ key: "bargeInOnDtmf",
81
+ value: true
82
+ }
83
+ }
84
+ ],
85
+ form: [
86
+ { type: "field", key: "bargeInOnSpeech" },
87
+ { type: "field", key: "bargeInOnDtmf" },
88
+ { type: "field", key: "bargeInMinWordCount" },
89
+ { type: "section", key: "paramsDtmf" }
45
90
  ],
46
91
  function: async ({ cognigy, config }) => {
47
92
  const { api, input } = cognigy;
48
93
  const { endpointType } = input;
49
94
  try {
95
+ if (config.bargeInOnDtmf) {
96
+ config.dtmfEnable = true;
97
+ }
98
+ if (config.bargeInOnSpeech || config.bargeInOnDtmf) {
99
+ config.bargeInEnable = true;
100
+ }
50
101
  const payload = setSessionConfig_mapper_1.setSessionConfig.handleInput(endpointType, (0, setSessionConfig_mapper_2.voiceConfigParamsToVoiceSettings)(config, api));
102
+ /* we need to store this for the DTMF Collect - Config node */
103
+ api.setSystemContext("vgSettings", { bargeInOnDtmf: config.bargeInOnDtmf });
51
104
  api.say(null, {
52
105
  _cognigy: payload,
53
106
  });
@@ -64,16 +64,18 @@ exports.DTMF = (0, createNodeDescriptor_1.createNodeDescriptor)({
64
64
  },
65
65
  ],
66
66
  function: async ({ cognigy, config }) => {
67
+ var _a, _b;
67
68
  const { api, input } = cognigy;
68
69
  const { endpointType } = input;
69
- const dtmfConfig = {
70
+ const voiceConfig = {
70
71
  dtmfEnable: config.dtmfEnable,
71
72
  dtmfInterDigitTimeout: config.dtmfInterDigitTimeout,
72
73
  dtmfMaxDigits: config.dtmfMaxDigits,
73
- dtmfSubmitDigit: config.dtmfSubmitDigit
74
+ dtmfSubmitDigit: config.dtmfSubmitDigit,
75
+ bargeInOnDtmf: (_b = (_a = api.getSystemContext("vgSettings")) === null || _a === void 0 ? void 0 : _a.bargeInOnDtmf) !== null && _b !== void 0 ? _b : false,
74
76
  };
75
77
  try {
76
- const payload = setSessionConfig_mapper_1.setSessionConfig.handleInput(endpointType, (0, setSessionConfig_mapper_2.voiceConfigParamsToVoiceSettings)(dtmfConfig, api));
78
+ const payload = setSessionConfig_mapper_1.setSessionConfig.handleInput(endpointType, (0, setSessionConfig_mapper_2.voiceConfigParamsToVoiceSettings)(voiceConfig, api));
77
79
  api.say(null, {
78
80
  _cognigy: payload,
79
81
  });
@@ -7,9 +7,18 @@ const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
7
7
  const play_mapper_1 = require("../mappers/play.mapper");
8
8
  const design_1 = require("../utils/design");
9
9
  const setSessionConfig_1 = require("../../voicegateway2/nodes/setSessionConfig");
10
+ const fields = (setSessionConfig_1.voiceConfigFields.map(field => {
11
+ if (field.key !== "sttDisablePunctuation" &&
12
+ field.key !== "sttVadEnabled" &&
13
+ field.key !== "sttVadMode" &&
14
+ field.key !== "sttVadVoiceMs") {
15
+ return field;
16
+ }
17
+ return null;
18
+ })).filter(f => !!f);
10
19
  exports.PLAY = (0, createNodeDescriptor_1.createNodeDescriptor)({
11
20
  type: "play",
12
- defaultLabel: "Play",
21
+ defaultLabel: "Play URL",
13
22
  tags: ['voice'],
14
23
  preview: {
15
24
  key: "url",
@@ -35,14 +44,14 @@ exports.PLAY = (0, createNodeDescriptor_1.createNodeDescriptor)({
35
44
  type: "toggle",
36
45
  defaultValue: false
37
46
  },
38
- ...setSessionConfig_1.voiceConfigFields
47
+ ...fields
39
48
  ],
40
49
  sections: [
41
50
  {
42
51
  key: "params_stt",
43
52
  label: "Recognizer (STT)",
44
53
  defaultCollapsed: true,
45
- fields: ["sttLanguage", "sttVendor", "sttHints"],
54
+ fields: ["sttVendor", "sttHints", "enableAdvancedSTTConfig", "azureSttContextId", "azureEnableAudioLogging"],
46
55
  condition: {
47
56
  key: "setActivityParams",
48
57
  value: true
@@ -67,14 +76,14 @@ exports.PLAY = (0, createNodeDescriptor_1.createNodeDescriptor)({
67
76
  key: "setActivityParams",
68
77
  value: true
69
78
  }
70
- }
79
+ },
71
80
  ],
72
81
  form: [
73
82
  { type: "field", key: "url" },
74
83
  { type: "field", key: "setActivityParams" },
75
84
  { type: "section", key: "params_stt" },
76
85
  { type: "section", key: "params_bargein" },
77
- { type: "section", key: "params_dtmf" }
86
+ { type: "section", key: "params_dtmf" },
78
87
  ],
79
88
  summary: "Streams a media file into the call",
80
89
  function: async ({ cognigy, config }) => {
@@ -37,6 +37,81 @@ exports.voiceConfigFields = [
37
37
  description: "Prevents the STT response from the bot to include punctuation marks",
38
38
  defaultValue: false
39
39
  },
40
+ {
41
+ key: "enableAdvancedSTTConfig",
42
+ type: "toggle",
43
+ label: "Enable Advanced STT Config",
44
+ description: "Advanced STT Configuration",
45
+ defaultValue: false
46
+ },
47
+ {
48
+ key: "azureSttContextId",
49
+ type: "cognigyText",
50
+ label: "Azure STT Context ID",
51
+ description: "Azure's Custom Speech model deployment ID",
52
+ defaultValue: "",
53
+ condition: {
54
+ and: [
55
+ {
56
+ key: "enableAdvancedSTTConfig",
57
+ value: true
58
+ },
59
+ {
60
+ key: "sttVendor",
61
+ value: "microsoft"
62
+ }
63
+ ]
64
+ }
65
+ },
66
+ {
67
+ key: "azureEnableAudioLogging",
68
+ type: "toggle",
69
+ label: "Enable Audio Logging",
70
+ description: "Enables recording and logging of audio from the user on Azure.",
71
+ defaultValue: false,
72
+ condition: {
73
+ and: [
74
+ {
75
+ key: "enableAdvancedSTTConfig",
76
+ value: true
77
+ },
78
+ {
79
+ key: "sttVendor",
80
+ value: "microsoft"
81
+ }
82
+ ]
83
+ }
84
+ },
85
+ {
86
+ key: "enableAdvancedTTSConfig",
87
+ type: "toggle",
88
+ label: "Enable Advanced TTS Config",
89
+ description: "Enable Advanced TTS Configuration",
90
+ defaultValue: false,
91
+ condition: {
92
+ key: "ttsVendor",
93
+ value: "microsoft"
94
+ }
95
+ },
96
+ {
97
+ key: "azureTtsDeploymentId",
98
+ type: "cognigyText",
99
+ label: "Azure Custom Voice Endpoint",
100
+ description: "Azure's Custom Speech model deployment ID",
101
+ defaultValue: "",
102
+ condition: {
103
+ and: [
104
+ {
105
+ key: "enableAdvancedTTSConfig",
106
+ value: true
107
+ },
108
+ {
109
+ key: "ttsVendor",
110
+ value: "microsoft"
111
+ }
112
+ ]
113
+ }
114
+ },
40
115
  {
41
116
  key: "ttsVendor",
42
117
  defaultValue: "",
@@ -66,27 +141,34 @@ exports.SESSION_SPEECH_PARAMETERS = (0, createNodeDescriptor_1.createNodeDescrip
66
141
  defaultLabel: "Session Speech Parameters - Config",
67
142
  summary: "Change configuration settings for the call session",
68
143
  appearance: {
69
- color: design_1.nodeColor
144
+ color: design_1.nodeColor,
70
145
  },
71
- tags: ['voice'],
146
+ tags: ["voice"],
72
147
  fields: exports.voiceConfigFields,
73
148
  sections: [
74
149
  {
75
150
  key: "params_stt",
76
151
  label: "Recognizer (STT)",
77
152
  defaultCollapsed: true,
78
- fields: ["sttVendor", "sttHints", "sttDisablePunctuation"]
153
+ fields: [
154
+ "sttVendor",
155
+ "sttHints",
156
+ "sttDisablePunctuation",
157
+ "enableAdvancedSTTConfig",
158
+ "azureSttContextId",
159
+ "azureEnableAudioLogging",
160
+ ],
79
161
  },
80
162
  {
81
163
  key: "params_tts",
82
164
  label: "Synthesizer (TTS)",
83
165
  defaultCollapsed: true,
84
- fields: ["ttsVendor"]
85
- }
166
+ fields: ["ttsVendor", "enableAdvancedTTSConfig", "azureTtsDeploymentId"],
167
+ },
86
168
  ],
87
169
  form: [
88
170
  { type: "section", key: "params_tts" },
89
- { type: "section", key: "params_stt" }
171
+ { type: "section", key: "params_stt" },
90
172
  ],
91
173
  function: async ({ cognigy, config }) => {
92
174
  const { api, input } = cognigy;
@@ -94,12 +176,12 @@ exports.SESSION_SPEECH_PARAMETERS = (0, createNodeDescriptor_1.createNodeDescrip
94
176
  try {
95
177
  const payload = setSessionConfig_mapper_1.setSessionConfig.handleInput(endpointType, (0, setSessionConfig_mapper_1.voiceConfigParamsToVoiceSettings)(config, api));
96
178
  api.say(null, {
97
- _cognigy: payload
179
+ _cognigy: payload,
98
180
  });
99
181
  }
100
182
  catch (error) {
101
183
  throw new Error(`Error on Session Speech Parameters node. Error message: ${error.message}`);
102
184
  }
103
- }
185
+ },
104
186
  });
105
187
  //# sourceMappingURL=sessionSpeechParameters.js.map
@@ -88,9 +88,13 @@ exports.TRANSFER_VOICE = (0, createNodeDescriptor_1.createNodeDescriptor)({
88
88
  const { referTo, useTransferSipHeaders, transferSipHeaders, transferReason, } = config;
89
89
  const { endpointType } = input;
90
90
  try {
91
+ if (input.channel === "adminconsole") {
92
+ api.say("Transferring a call is not supported in the Interaction Panel.", null);
93
+ return;
94
+ }
91
95
  const transferParams = {
92
- transferReason: transferReason,
93
- transferTarget: (0, helper_1.cleanTarget)(referTo),
96
+ transferReason,
97
+ transferTarget: referTo,
94
98
  useTransferSipHeaders: useTransferSipHeaders,
95
99
  transferSipHeaders: transferSipHeaders,
96
100
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isValidDTMF = void 0;
3
+ exports.isValidPhoneNumber = exports.isValidUrl = exports.isValidDTMF = void 0;
4
4
  function isValidDTMF(dtmf) {
5
5
  if (dtmf.length !== 1)
6
6
  return false;
@@ -8,4 +8,14 @@ function isValidDTMF(dtmf) {
8
8
  return regex.test(dtmf);
9
9
  }
10
10
  exports.isValidDTMF = isValidDTMF;
11
+ const isValidUrl = (url) => {
12
+ const regex = new RegExp("^(http|https)://");
13
+ return regex.test(url);
14
+ };
15
+ exports.isValidUrl = isValidUrl;
16
+ const isValidPhoneNumber = (number) => {
17
+ const regex = /^\+{0,2}([\-\. ])?(\(?\d{0,3}\))?([\-\. ])?\(?\d{0,3}\)?([\-\. ])?\d{3}([\-\. ])?\d{4}/;
18
+ return regex.test(number);
19
+ };
20
+ exports.isValidPhoneNumber = isValidPhoneNumber;
11
21
  //# sourceMappingURL=helper.js.map
@@ -40,14 +40,14 @@ exports.agentAssistNode = (0, createNodeDescriptor_1.createNodeDescriptor)({
40
40
  { value: "callee", label: "Callee (Agent) only" },
41
41
  ]
42
42
  }
43
- }
43
+ },
44
44
  ],
45
45
  appearance: {
46
46
  color: design_1.nodeColor
47
47
  },
48
48
  form: [
49
49
  { type: "field", key: "activity" },
50
- { type: "field", key: "targetParticipant" }
50
+ { type: "field", key: "targetParticipant" },
51
51
  ],
52
52
  function: async ({ cognigy, config }) => {
53
53
  const { api } = cognigy;
@@ -117,7 +117,7 @@ exports.handoverNode = (0, createNodeDescriptor_1.createNodeDescriptor)({
117
117
  }
118
118
  ],
119
119
  function: async ({ cognigy, config }) => {
120
- const { api } = cognigy;
120
+ const { api, input } = cognigy;
121
121
  const { handoverReason, transferTarget, transferReferredByURL, useTransferSipHeaders, transferSipHeaders, transferNotifications, transferNotificationsHangupMS } = config;
122
122
  const transferParams = {
123
123
  transferReason: handoverReason,
@@ -129,6 +129,10 @@ exports.handoverNode = (0, createNodeDescriptor_1.createNodeDescriptor)({
129
129
  transferReferredByURL
130
130
  };
131
131
  try {
132
+ if (input.channel === "adminconsole") {
133
+ api.say("Transferring a call is not supported in the Interaction Panel, please use the AudioCodes endpoint.", null);
134
+ return;
135
+ }
132
136
  const payload = transfer_mapper_1.transfer.handleInput("audioCodes", transferParams, false);
133
137
  api.say(null, {
134
138
  _cognigy: payload
@@ -61,7 +61,17 @@ exports.playNode = (0, createNodeDescriptor_1.createNodeDescriptor)({
61
61
  key: "params_stt",
62
62
  label: "Recognizer (STT)",
63
63
  defaultCollapsed: true,
64
- fields: ["sttLanguage", "sttVendor", "sttHints", "sttVadEnabled", "sttVadMode", "sttVadVoiceMs"],
64
+ fields: [
65
+ "sttVendor",
66
+ "sttHints",
67
+ "sttDisablePunctuation",
68
+ "sttVadEnabled",
69
+ "sttVadMode",
70
+ "sttVadVoiceMs",
71
+ "enableAdvancedSTTConfig",
72
+ "azureSttContextId",
73
+ "azureEnableAudioLogging"
74
+ ],
65
75
  condition: {
66
76
  key: "setActivityParams",
67
77
  value: true
@@ -81,12 +91,18 @@ exports.playNode = (0, createNodeDescriptor_1.createNodeDescriptor)({
81
91
  key: "params_dtmf",
82
92
  label: "DTMF",
83
93
  defaultCollapsed: true,
84
- fields: ["dtmfEnable", "dtmfInterDigitTimeout", "dtmfMaxDigits", "dtmfMinDigits", "dtmfSubmitDigit"],
94
+ fields: [
95
+ "dtmfEnable",
96
+ "dtmfInterDigitTimeout",
97
+ "dtmfMaxDigits",
98
+ "dtmfMinDigits",
99
+ "dtmfSubmitDigit"
100
+ ],
85
101
  condition: {
86
102
  key: "setActivityParams",
87
103
  value: true
88
104
  }
89
- },
105
+ }
90
106
  ],
91
107
  form: [
92
108
  { type: "field", key: "url" },
@@ -94,7 +110,7 @@ exports.playNode = (0, createNodeDescriptor_1.createNodeDescriptor)({
94
110
  { type: "field", key: "setActivityParams" },
95
111
  { type: "section", key: "params_stt" },
96
112
  { type: "section", key: "params_bargein" },
97
- { type: "section", key: "params_dtmf" },
113
+ { type: "section", key: "params_dtmf" }
98
114
  ],
99
115
  function: async ({ cognigy, config }) => {
100
116
  const { api } = cognigy;
@@ -107,7 +123,6 @@ exports.playNode = (0, createNodeDescriptor_1.createNodeDescriptor)({
107
123
  catch (error) {
108
124
  throw new Error(`Error on play node. Error message: ${error.message}`);
109
125
  }
110
- ;
111
126
  }
112
127
  });
113
128
  //# sourceMappingURL=play.js.map
@@ -7,7 +7,6 @@ const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
7
7
  const transfer_mapper_1 = require("../../voice/mappers/transfer.mapper");
8
8
  const constants_1 = require("../utils/constants");
9
9
  const design_1 = require("../utils/design");
10
- const helper_1 = require("../utils/helper");
11
10
  exports.referNode = (0, createNodeDescriptor_1.createNodeDescriptor)({
12
11
  type: "refer",
13
12
  defaultLabel: "Refer",
@@ -81,9 +80,10 @@ exports.referNode = (0, createNodeDescriptor_1.createNodeDescriptor)({
81
80
  const { referTo, useTransferSipHeaders, transferSipHeaders } = config;
82
81
  const transferParams = {
83
82
  transferReason: '',
84
- transferTarget: (0, helper_1.cleanTarget)(referTo),
83
+ transferTarget: referTo,
85
84
  useTransferSipHeaders,
86
- transferSipHeaders
85
+ transferSipHeaders,
86
+ transferType: "refer",
87
87
  };
88
88
  try {
89
89
  const payload = transfer_mapper_1.transfer.handleInput(constants_1.ENDPOINTS.VOICE_GATEWAY, transferParams, false);