@cognigy/rest-api-client 0.11.0 → 0.12.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.
- package/.snyk +1 -1
- package/build/GenericUploadFn.js +1 -1
- package/build/RestAPIClient.js +14 -0
- package/build/apigroups/AdministrationAPIGroup_2_0.js +25 -3
- package/build/apigroups/AnalyticsAPIGroup_2_0.js +12 -0
- package/build/apigroups/InsightsAPIGroup_2_0.js +53 -0
- package/build/apigroups/ResourcesAPIGroup_2_0.js +23 -2
- package/build/apigroups/index.js +5 -1
- package/build/authentication/BasicAuthentication/BasicAuthentication.js +8 -1
- package/build/authentication/OAuth2/ILoginByClientCredentialsParameters.js +3 -0
- package/build/authentication/OAuth2/IOAuth2ClientCredentialsGrantAccessTokenRequest.js +11 -0
- package/build/authentication/OAuth2/OAuth2Authentication.js +41 -15
- package/build/shared/charts/createNodeDescriptor.js +1 -1
- package/build/shared/charts/descriptors/apps/index.js +8 -0
- package/build/shared/charts/descriptors/apps/initAppSession.js +33 -0
- package/build/shared/charts/descriptors/apps/setAppState.js +46 -0
- package/build/shared/charts/descriptors/connectionNodes/smtp/emailNotification.js +6 -4
- package/build/shared/charts/descriptors/connectionNodes/smtp/sendEmail.js +2 -2
- package/build/shared/charts/descriptors/end.js +1 -0
- package/build/shared/charts/descriptors/index.js +86 -67
- package/build/shared/charts/descriptors/logic/goTo.js +1 -0
- package/build/shared/charts/descriptors/logic/if/else.js +2 -0
- package/build/shared/charts/descriptors/logic/if/if.js +2 -1
- package/build/shared/charts/descriptors/logic/if/then.js +2 -0
- package/build/shared/charts/descriptors/logic/index.js +5 -3
- package/build/shared/charts/descriptors/logic/interval/elseInterval.js +1 -0
- package/build/shared/charts/descriptors/logic/interval/onInterval.js +1 -0
- package/build/shared/charts/descriptors/logic/once/afterwards.js +1 -0
- package/build/shared/charts/descriptors/logic/once/onFirstExecution.js +1 -0
- package/build/shared/charts/descriptors/logic/setTranslation.js +88 -0
- package/build/shared/charts/descriptors/logic/switch/case.js +2 -0
- package/build/shared/charts/descriptors/logic/switch/default.js +2 -0
- package/build/shared/charts/descriptors/logic/switch/switch.js +52 -4
- package/build/shared/charts/descriptors/logic/switchLocale.js +30 -2
- package/build/shared/charts/descriptors/logic/think.js +7 -3
- package/build/shared/charts/descriptors/logic/thinkV2.js +104 -0
- package/build/shared/charts/descriptors/logic/wait.js +2 -9
- package/build/shared/charts/descriptors/message/checkChannelChange/checkChannelChange.js +1 -0
- package/build/shared/charts/descriptors/message/checkChannelChange/onNo.js +3 -1
- package/build/shared/charts/descriptors/message/checkChannelChange/onYes.js +3 -1
- package/build/shared/charts/descriptors/message/checkChannelChange/unchanged.js +3 -1
- package/build/shared/charts/descriptors/message/question/onAnswer.js +3 -1
- package/build/shared/charts/descriptors/message/question/onQuestion.js +3 -1
- package/build/shared/charts/descriptors/message/question/question.js +474 -56
- package/build/shared/charts/descriptors/message/question/utils/datepickerUtils.js +1 -0
- package/build/shared/charts/descriptors/message/question/utils/evaluateQuestionAnswer.js +9 -3
- package/build/shared/charts/descriptors/message/question/utils/generateAnswerShortForm.js +37 -0
- package/build/shared/charts/descriptors/message/question/utils/getQuestionText.js +36 -0
- package/build/shared/charts/descriptors/message/question/utils/resetNodeState.js +12 -0
- package/build/shared/charts/descriptors/message/question/utils/storeQuestionAnswer.js +30 -0
- package/build/shared/charts/descriptors/message/question/utils/validateQuestionAnswer.js +22 -0
- package/build/shared/charts/descriptors/microsoft/getToken.js +34 -0
- package/build/shared/charts/descriptors/microsoft/index.js +22 -0
- package/build/shared/charts/descriptors/microsoft/invalidateToken.js +29 -0
- package/build/shared/charts/descriptors/microsoft/tokenStatus/index.js +51 -0
- package/build/shared/charts/descriptors/microsoft/tokenStatus/tokenGranted.js +24 -0
- package/build/shared/charts/descriptors/microsoft/tokenStatus/tokenNotGranted.js +24 -0
- package/build/shared/charts/descriptors/microsoft/utils/design.js +5 -0
- package/build/shared/charts/descriptors/nlu/executeCognigyNLU.js +5 -0
- package/build/shared/charts/descriptors/nlu/extractAnswer.js +115 -0
- package/build/shared/charts/descriptors/nlu/fuzzySearch.js +270 -0
- package/build/shared/charts/descriptors/nlu/index.js +7 -1
- package/build/shared/charts/descriptors/nlu/matchPattern.js +104 -0
- package/build/shared/charts/descriptors/nlu/utils/patternMatcher.js +197 -0
- package/build/shared/charts/descriptors/profile/index.js +5 -1
- package/build/shared/charts/descriptors/profile/overwriteAnalytics.js +54 -2
- package/build/shared/charts/descriptors/profile/requestRating.js +57 -0
- package/build/shared/charts/descriptors/profile/setRating.js +39 -0
- package/build/shared/charts/descriptors/service/handover.js +29 -2
- package/build/shared/charts/descriptors/service/handoverV2.js +129 -0
- package/build/shared/charts/descriptors/service/httpRequest.js +26 -7
- package/build/shared/charts/descriptors/service/index.js +3 -1
- package/build/shared/charts/descriptors/service/triggerFunction/onScheduled.js +2 -0
- package/build/shared/charts/descriptors/service/triggerFunction/onSchedulingError.js +2 -0
- package/build/shared/charts/descriptors/start.js +1 -0
- package/build/shared/charts/descriptors/voicegateway/nodes/callRecording.js +36 -16
- package/build/shared/charts/descriptors/voicegateway/nodes/handover.js +2 -2
- package/build/shared/charts/descriptors/voicegateway/nodes/playURL.js +9 -0
- package/build/shared/charts/descriptors/voicegateway/nodes/sendMessage.js +1 -1
- package/build/shared/charts/descriptors/voicegateway/utils/paramUtils.js +9 -1
- package/build/shared/charts/descriptors/voicegateway2/index.js +21 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/dtmf.js +56 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/hangup.js +48 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/play.js +199 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/refer.js +44 -0
- package/build/shared/charts/descriptors/voicegateway2/nodes/setSessionConfig.js +584 -0
- package/build/shared/charts/descriptors/voicegateway2/utils/design.js +5 -0
- package/build/shared/charts/descriptors/voicegateway2/utils/strip-nulls.js +19 -0
- package/build/shared/constants.js +9 -1
- package/build/shared/errors/baseError.js +34 -1
- package/build/shared/helper/rest/array.js +19 -0
- package/build/shared/helper/rest/boolean.js +5 -1
- package/build/shared/helper/rest/index.js +4 -1
- package/build/shared/interfaces/IEndpointTranslationSettings.js +32 -0
- package/build/shared/interfaces/IHandoverRequestStatus.js +3 -0
- package/build/shared/interfaces/{restAPI/administration/user/v2.0/IDeleteUserMeRest_2_0.js → IHttpRequest.js} +1 -1
- package/build/shared/interfaces/IOrganisation.js +1 -1
- package/build/shared/interfaces/TEntrypointType.js +2 -0
- package/build/shared/interfaces/amqpInterface.js +3 -0
- package/build/shared/interfaces/analytics/IAnalyticsFlowHistoryData.js +3 -0
- package/build/shared/interfaces/analytics/IAnalyticsSourceData.js +196 -45
- package/build/shared/interfaces/analytics/IStepEvent.js +2 -1
- package/build/shared/interfaces/analytics/TAnalyticsMode.js +10 -0
- package/build/shared/interfaces/analytics/TAnalyticsType.js +5 -0
- package/build/shared/interfaces/debugEvents/IErrorEventPayload.js +3 -0
- package/build/shared/interfaces/debugEvents/TDebugEndpointEvent.js +1 -0
- package/build/shared/interfaces/debugEvents/TDebugEventType.js +2 -1
- package/build/shared/interfaces/debugEvents/TSessionStateEmitParams.js +3 -0
- package/build/shared/interfaces/handover.js +81 -3
- package/build/shared/interfaces/license.js +34 -0
- package/build/shared/interfaces/license.js.map +1 -0
- package/build/shared/interfaces/messageAPI/ai.js +15 -1
- package/build/shared/interfaces/messageAPI/endpoints.js +273 -9
- package/build/shared/interfaces/resources/IAuditEvent.js +15 -2
- package/build/shared/interfaces/resources/IChartNode.js +56 -10
- package/build/shared/interfaces/resources/IEndpoint.js +5 -2
- package/build/shared/interfaces/resources/IFlow.js +1 -1
- package/build/shared/interfaces/resources/ILexicon.js +8 -2
- package/build/shared/interfaces/resources/INLUConnector.js +15 -2
- package/build/shared/interfaces/resources/INodeDescriptorSet.js +164 -52
- package/build/shared/interfaces/resources/IOptionsResolverFunction.js +18 -0
- package/build/shared/interfaces/resources/IPlaybookRun.js +61 -0
- package/build/shared/interfaces/resources/IProject.js +7 -1
- package/build/shared/interfaces/resources/ISlotFiller.js +38 -21
- package/build/shared/interfaces/resources/ISnapshot.js +1 -1
- package/build/shared/interfaces/resources/ITrackAnalyticsStepsArguments.js +3 -0
- package/build/shared/interfaces/resources/TNLUConnectorType.js +2 -1
- package/build/shared/interfaces/resources/TResourceType.js +1 -0
- package/build/shared/interfaces/resources/TRestChannelType.js +5 -0
- package/build/shared/interfaces/resources/TSocketChannelType.js +5 -1
- package/build/shared/interfaces/resources/chart/IChartExecutable.js +3 -2
- package/build/shared/interfaces/resources/chart/IChartExecutableNode.js +1 -0
- package/build/shared/interfaces/resources/intent/IIntent.js +4 -2
- package/build/shared/interfaces/resources/intent/IIntentTrainGroup.js +3 -1
- package/build/shared/interfaces/resources/intent/ISentence.js +32 -8
- package/build/shared/interfaces/resources/settings/IAgentSettings.js +40 -2
- package/build/shared/interfaces/resources/settings/IFlowSettings.js +1 -1
- package/build/shared/interfaces/restAPI/administration/liveAgent/v2.0/IReadLiveAgentAccountRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/administration/liveAgent/v2.0/IReadProjectInboxRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/administration/liveAgent/v2.0/ISetupCognigyLiveAgentInboxRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/administration/liveAgent/v2.0/ISetupCognigyLiveAgentRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/administration/liveAgent/v2.0/index.js +3 -0
- package/build/shared/interfaces/restAPI/analytics/IDeleteAnalyticsRecordsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/analytics/IUpdateAnalyticsRecordProperties_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/analytics/IUpdateAnalyticsRecordsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/IAnalyticsQueryFilter_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/TAnalyticsQueryFilterOperator_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/messages/IGenerateMessagesRest_2_0.js +5 -0
- package/build/shared/interfaces/restAPI/insights/messages/ILoadMessagesReportByQueryHashResponse_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/messages/ILoadMessagesReportByQueryHashRestData_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/messages/ITopNMessages_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/reports/IGenerateReportResponse_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/reports/IGenerateReportRest_2_0.js +41 -0
- package/build/shared/interfaces/restAPI/insights/reports/ILoadReportByQueryHashResponse_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/reports/ILoadReportByQueryHashRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/steps/IGenerateStepReportRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/steps/IIndexStepsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/steps/ILoadStepReportByQueryHashResponse_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/steps/ILoadStepReportByQueryHashRestData_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/steps/IStepIndexItem_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/steps/IStepReport_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/steps/IStep_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/transcripts/IGenerateTranscriptsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/transcripts/ILoadTranscriptsReportByQueryHashResponse_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/transcripts/ILoadTranscriptsReportByQueryHashRestData_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/insights/transcripts/IStepPath_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/chart/v2.0/ISearchChartNodesRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/extension/v2.0/IUpdateExtensionPackageRest_2_0.js +4 -0
- package/build/shared/interfaces/restAPI/resources/flow/v2.0/ICreateFlowFromChildrenRest_2_0.js +4 -0
- package/build/shared/interfaces/restAPI/resources/flow/v2.0/intent/ITrainYesNoIntentsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/lexicon/v2.0/IComposeLexiconDownloadLinkRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/nluconnector/v2.0/TNLUConnectorType_2_0.js +3 -1
- package/build/shared/interfaces/restAPI/resources/nodedescriptorsets/v2.0/IOptionsResolverRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/playbook/v2.0/IDeletePlaybookRunRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/playbook/v2.0/IIndexPlaybookRunsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/playbook/v2.0/IPlaybookRunIndexItem_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/playbook/v2.0/IPlaybookRun_2_0.js +7 -0
- package/build/shared/interfaces/restAPI/resources/playbook/v2.0/IReadPlaybookRunRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/playbook/v2.0/ISchedulePlaybookRunRest_2_0.js +3 -0
- package/build/shared/interfaces/security/IACL.js +1 -1
- package/build/shared/interfaces/security/IPermission.js +6 -0
- package/build/shared/interfaces/security/IRole.js +8 -2
- package/build/shared/interfaces/sessionstate/ISessionState.js +3 -0
- package/build/shared/interfaces/sessionstate/index.js +3 -0
- package/build/shared/interfaces/trainer/ITrainerRecord.js +4 -0
- package/build/shared/interfaces/translation.js +11 -0
- package/package.json +5 -5
- package/types/index.d.ts +3905 -1178
- package/build/shared/charts/descriptors/logic/checkFrustration.js +0 -82
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cognigyVoiceGateway2Module = void 0;
|
|
4
|
+
/** Cognigy Modules */
|
|
5
|
+
const createNodeDescriptor_1 = require("../../createNodeDescriptor");
|
|
6
|
+
const dtmf_1 = require("./nodes/dtmf");
|
|
7
|
+
const hangup_1 = require("./nodes/hangup");
|
|
8
|
+
const play_1 = require("./nodes/play");
|
|
9
|
+
const refer_1 = require("./nodes/refer");
|
|
10
|
+
const setSessionConfig_1 = require("./nodes/setSessionConfig");
|
|
11
|
+
exports.cognigyVoiceGateway2Module = createNodeDescriptor_1.createExtension({
|
|
12
|
+
nodes: [
|
|
13
|
+
setSessionConfig_1.setSessionConfigNode,
|
|
14
|
+
dtmf_1.dtmfNode,
|
|
15
|
+
hangup_1.hangupNode,
|
|
16
|
+
play_1.playNode,
|
|
17
|
+
refer_1.referNode
|
|
18
|
+
],
|
|
19
|
+
connections: []
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dtmfNode = void 0;
|
|
4
|
+
/** Custom Modules */
|
|
5
|
+
const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
|
|
6
|
+
/** Helper Modules */
|
|
7
|
+
const design_1 = require("../utils/design");
|
|
8
|
+
exports.dtmfNode = createNodeDescriptor_1.createNodeDescriptor({
|
|
9
|
+
type: "dtmf",
|
|
10
|
+
defaultLabel: "DTMF",
|
|
11
|
+
appearance: {
|
|
12
|
+
color: design_1.nodeColor
|
|
13
|
+
},
|
|
14
|
+
fields: [
|
|
15
|
+
{
|
|
16
|
+
key: "dtmf",
|
|
17
|
+
label: "Digit sequence",
|
|
18
|
+
description: "Digit sequence to play to the caller",
|
|
19
|
+
type: "text",
|
|
20
|
+
params: {
|
|
21
|
+
required: true
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
key: "duration",
|
|
26
|
+
label: "Pause time",
|
|
27
|
+
description: "Pause time in ms between digits",
|
|
28
|
+
type: "slider",
|
|
29
|
+
defaultValue: 500,
|
|
30
|
+
params: {
|
|
31
|
+
min: 500,
|
|
32
|
+
max: 1000,
|
|
33
|
+
step: 50
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
summary: "Plays DTMF digits to the caller",
|
|
38
|
+
function: async ({ cognigy, config }) => {
|
|
39
|
+
const { api } = cognigy;
|
|
40
|
+
const { dtmf, duration } = config;
|
|
41
|
+
const voiceGateway2Payload = {
|
|
42
|
+
dtmf: {
|
|
43
|
+
dtmf,
|
|
44
|
+
duration
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
api.say(null, {
|
|
48
|
+
_cognigy: {
|
|
49
|
+
_voiceGateway2: {
|
|
50
|
+
json: voiceGateway2Payload
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=dtmf.js.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hangupNode = void 0;
|
|
4
|
+
/** Custom Modules */
|
|
5
|
+
const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
|
|
6
|
+
/** Helper Modules */
|
|
7
|
+
const design_1 = require("../utils/design");
|
|
8
|
+
exports.hangupNode = createNodeDescriptor_1.createNodeDescriptor({
|
|
9
|
+
type: "hangup",
|
|
10
|
+
defaultLabel: "Hang Up",
|
|
11
|
+
appearance: {
|
|
12
|
+
color: design_1.nodeColor
|
|
13
|
+
},
|
|
14
|
+
fields: [
|
|
15
|
+
{
|
|
16
|
+
key: "hangupReason",
|
|
17
|
+
label: "Reason for hang up",
|
|
18
|
+
type: "text",
|
|
19
|
+
defaultValue: "Bot ended the call",
|
|
20
|
+
params: {
|
|
21
|
+
required: true
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
summary: "Hangs up the call",
|
|
26
|
+
function: async ({ cognigy, config }) => {
|
|
27
|
+
const { api } = cognigy;
|
|
28
|
+
const { hangupReason } = config;
|
|
29
|
+
const voiceGateway2Payload = {
|
|
30
|
+
hangup: {}
|
|
31
|
+
};
|
|
32
|
+
if (hangupReason) {
|
|
33
|
+
voiceGateway2Payload.hangup = {
|
|
34
|
+
headers: {
|
|
35
|
+
"X-Reason": hangupReason
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
api.say(null, {
|
|
40
|
+
_cognigy: {
|
|
41
|
+
_voiceGateway2: {
|
|
42
|
+
json: voiceGateway2Payload
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=hangup.js.map
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.playNode = void 0;
|
|
4
|
+
/** Custom Modules */
|
|
5
|
+
const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
|
|
6
|
+
/** Helper Modules */
|
|
7
|
+
const design_1 = require("../utils/design");
|
|
8
|
+
const strip_nulls_1 = require("../utils/strip-nulls");
|
|
9
|
+
const setSessionConfig_1 = require("./setSessionConfig");
|
|
10
|
+
exports.playNode = createNodeDescriptor_1.createNodeDescriptor({
|
|
11
|
+
type: "play",
|
|
12
|
+
defaultLabel: "Play",
|
|
13
|
+
appearance: {
|
|
14
|
+
color: design_1.nodeColor
|
|
15
|
+
},
|
|
16
|
+
fields: [
|
|
17
|
+
{
|
|
18
|
+
key: "url",
|
|
19
|
+
label: "Media URL",
|
|
20
|
+
type: "text",
|
|
21
|
+
description: "You can use MP3 or WAV encoded files",
|
|
22
|
+
params: {
|
|
23
|
+
required: true
|
|
24
|
+
},
|
|
25
|
+
defaultValue: "https://www2.cs.uic.edu/~i101/SoundFiles/PinkPanther30.wav"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
key: "loop",
|
|
29
|
+
label: "Loop count",
|
|
30
|
+
description: "Number of times the media will be looped",
|
|
31
|
+
type: "number",
|
|
32
|
+
defaultValue: 1,
|
|
33
|
+
params: {
|
|
34
|
+
min: 1,
|
|
35
|
+
max: 10,
|
|
36
|
+
step: 1
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
key: "setActivityParams",
|
|
41
|
+
label: "Set Activity Parameters",
|
|
42
|
+
type: "toggle",
|
|
43
|
+
defaultValue: false
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
key: "activityParams",
|
|
47
|
+
label: "Other Activity Params",
|
|
48
|
+
type: "json",
|
|
49
|
+
defaultValue: "{}"
|
|
50
|
+
},
|
|
51
|
+
...setSessionConfig_1.voiceConfigFields
|
|
52
|
+
],
|
|
53
|
+
sections: [
|
|
54
|
+
{
|
|
55
|
+
key: "params_tts",
|
|
56
|
+
label: "Synthesizer (TTS)",
|
|
57
|
+
defaultCollapsed: true,
|
|
58
|
+
fields: ["ttsVoice", "ttsLanguage", "ttsVendor"],
|
|
59
|
+
condition: {
|
|
60
|
+
key: "setActivityParams",
|
|
61
|
+
value: true
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
key: "params_stt",
|
|
66
|
+
label: "Recognizer (STT)",
|
|
67
|
+
defaultCollapsed: true,
|
|
68
|
+
fields: ["sttLanguage", "sttVendor", "sttHints", "sttVadEnabled", "sttVadMode", "sttVadVoiceMs"],
|
|
69
|
+
condition: {
|
|
70
|
+
key: "setActivityParams",
|
|
71
|
+
value: true
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
key: "params_bargein",
|
|
76
|
+
label: "Barge In",
|
|
77
|
+
defaultCollapsed: true,
|
|
78
|
+
fields: ["bargeInOnSpeech", "bargeInOnDtmf", "bargeInMinWordCount"],
|
|
79
|
+
condition: {
|
|
80
|
+
key: "setActivityParams",
|
|
81
|
+
value: true
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
key: "params_user_timeouts",
|
|
86
|
+
label: "User Input Timeout",
|
|
87
|
+
defaultCollapsed: true,
|
|
88
|
+
fields: ["userNoInputMode", "userNoInputSpeech", "userNoInputUrl", "userNoInputTimeout", "userNoInputRetries"],
|
|
89
|
+
condition: {
|
|
90
|
+
key: "setActivityParams",
|
|
91
|
+
value: true
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
key: "params_dtmf",
|
|
96
|
+
label: "DTMF",
|
|
97
|
+
defaultCollapsed: true,
|
|
98
|
+
fields: ["dtmfEnable", "dtmfInterDigitTimeout", "dtmfMaxDigits", "dtmfMinDigits", "dtmfSubmitDigit"],
|
|
99
|
+
condition: {
|
|
100
|
+
key: "setActivityParams",
|
|
101
|
+
value: true
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
form: [
|
|
106
|
+
{ type: "field", key: "url" },
|
|
107
|
+
{ type: "field", key: "loop" },
|
|
108
|
+
{ type: "field", key: "setActivityParams" },
|
|
109
|
+
{ type: "section", key: "params_tts" },
|
|
110
|
+
{ type: "section", key: "params_stt" },
|
|
111
|
+
{ type: "section", key: "params_bargein" },
|
|
112
|
+
{ type: "section", key: "params_user_timeouts" },
|
|
113
|
+
{ type: "section", key: "params_dtmf" },
|
|
114
|
+
],
|
|
115
|
+
summary: "Streams a media file into the call with the ability to loop it",
|
|
116
|
+
function: async ({ cognigy, config }) => {
|
|
117
|
+
const { api } = cognigy;
|
|
118
|
+
const { url, loop, setActivityParams } = config;
|
|
119
|
+
const voiceGateway2Payload = {
|
|
120
|
+
play: {
|
|
121
|
+
url,
|
|
122
|
+
loop,
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
if (setActivityParams) {
|
|
126
|
+
const activityConfig = {};
|
|
127
|
+
const synthesizer = {
|
|
128
|
+
language: config.ttsLanguage,
|
|
129
|
+
voice: config.ttsVoice,
|
|
130
|
+
vendor: config.ttsVendor
|
|
131
|
+
};
|
|
132
|
+
activityConfig.synthesizer = synthesizer;
|
|
133
|
+
const recognizer = {
|
|
134
|
+
language: config.sttLanguage,
|
|
135
|
+
vendor: config.sttVendor || "default",
|
|
136
|
+
hints: config.sttHints,
|
|
137
|
+
vad: {
|
|
138
|
+
enable: config.sttVadEnabled,
|
|
139
|
+
mode: config.sttVadMode,
|
|
140
|
+
voiceMs: config.sttVadVoiceMs
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
activityConfig.recognizer = recognizer;
|
|
144
|
+
const bargein = {
|
|
145
|
+
enable: false,
|
|
146
|
+
minBargeinWordCount: config.bargeInMinWordCount,
|
|
147
|
+
input: [],
|
|
148
|
+
actionHook: "voice"
|
|
149
|
+
};
|
|
150
|
+
if (config.bargeInOnDtmf) {
|
|
151
|
+
bargein.dtmfBargein = true;
|
|
152
|
+
bargein.input.push("digits");
|
|
153
|
+
}
|
|
154
|
+
if (config.bargeInOnSpeech) {
|
|
155
|
+
bargein.input.push("speech");
|
|
156
|
+
}
|
|
157
|
+
if (bargein.input.length > 0) {
|
|
158
|
+
bargein.enable = true;
|
|
159
|
+
bargein.sticky = true;
|
|
160
|
+
}
|
|
161
|
+
activityConfig.bargeIn = bargein;
|
|
162
|
+
const user = {
|
|
163
|
+
noInputMode: config.userNoInputMode,
|
|
164
|
+
noInputTimeout: (config.userNoInputTimeout || 10000) / 1000,
|
|
165
|
+
noInputRetries: config.userNoInputRetries,
|
|
166
|
+
noInputSpeech: config.userNoInputSpeech,
|
|
167
|
+
noInputUrl: config.userNoInputUrl
|
|
168
|
+
};
|
|
169
|
+
activityConfig.user = user;
|
|
170
|
+
if (config.dtmfEnable) {
|
|
171
|
+
if (!activityConfig.bargeIn) {
|
|
172
|
+
activityConfig.bargeIn = {
|
|
173
|
+
enable: false
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
activityConfig.bargeIn.interDigitTimeout = (config.dtmfInterDigitTimeout || 500) / 1000;
|
|
177
|
+
activityConfig.bargeIn.maxDigits = config.dtmfMaxDigits;
|
|
178
|
+
activityConfig.bargeIn.minDigits = config.dtmfMinDigits;
|
|
179
|
+
activityConfig.bargeIn.finishOnKey = config.dtmfSubmitDigit;
|
|
180
|
+
if (!voiceGateway2Payload.play.activityConfig) {
|
|
181
|
+
voiceGateway2Payload.play.activityConfig = {};
|
|
182
|
+
}
|
|
183
|
+
voiceGateway2Payload.play.activityConfig.dtmf = true;
|
|
184
|
+
}
|
|
185
|
+
if (Object.keys(activityConfig).length > 0) {
|
|
186
|
+
voiceGateway2Payload.play.activityConfig = activityConfig;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
strip_nulls_1.stripNulls(voiceGateway2Payload);
|
|
190
|
+
api.say(null, {
|
|
191
|
+
_cognigy: {
|
|
192
|
+
_voiceGateway2: {
|
|
193
|
+
json: voiceGateway2Payload
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
//# sourceMappingURL=play.js.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.referNode = void 0;
|
|
4
|
+
/** Custom Modules */
|
|
5
|
+
const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
|
|
6
|
+
/** Helper Modules */
|
|
7
|
+
const design_1 = require("../utils/design");
|
|
8
|
+
exports.referNode = createNodeDescriptor_1.createNodeDescriptor({
|
|
9
|
+
type: "refer",
|
|
10
|
+
defaultLabel: "Refer",
|
|
11
|
+
appearance: {
|
|
12
|
+
color: design_1.nodeColor
|
|
13
|
+
},
|
|
14
|
+
fields: [
|
|
15
|
+
{
|
|
16
|
+
key: "referTo",
|
|
17
|
+
label: "Target",
|
|
18
|
+
type: "text",
|
|
19
|
+
params: {
|
|
20
|
+
required: true
|
|
21
|
+
},
|
|
22
|
+
description: "E.164 syntax or a SIP URI are supported",
|
|
23
|
+
defaultValue: "+49176123456789"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
summary: "Transfer the call to another target",
|
|
27
|
+
function: async ({ cognigy, config }) => {
|
|
28
|
+
const { api } = cognigy;
|
|
29
|
+
const { referTo } = config;
|
|
30
|
+
const voiceGateway2Payload = {
|
|
31
|
+
"sip:refer": {
|
|
32
|
+
referTo
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
api.say(null, {
|
|
36
|
+
_cognigy: {
|
|
37
|
+
_voiceGateway2: {
|
|
38
|
+
json: voiceGateway2Payload
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=refer.js.map
|