diff --git a/extensions/vier-cognitive-voice-gateway/src/helpers/util.ts b/extensions/vier-cognitive-voice-gateway/src/helpers/util.ts index 50c69011..998f52ff 100644 --- a/extensions/vier-cognitive-voice-gateway/src/helpers/util.ts +++ b/extensions/vier-cognitive-voice-gateway/src/helpers/util.ts @@ -110,7 +110,11 @@ function toNumberOrUndefined(numeric: number | string | undefined | null): numbe return undefined; } if (typeof numeric === 'string') { - const parsedNumber = Number(numeric); + const trimmed = numeric.trim() + if (trimmed === '') { + return undefined + } + const parsedNumber = Number(trimmed); return isNaN(parsedNumber) ? undefined : parsedNumber; } if (typeof numeric !== 'number') { diff --git a/extensions/vier-cognitive-voice-gateway/src/nodes/promptForNumber.ts b/extensions/vier-cognitive-voice-gateway/src/nodes/promptForNumber.ts index bda4a5d3..ee4b7d95 100644 --- a/extensions/vier-cognitive-voice-gateway/src/nodes/promptForNumber.ts +++ b/extensions/vier-cognitive-voice-gateway/src/nodes/promptForNumber.ts @@ -123,6 +123,7 @@ export const promptForNumberNode = createNodeDescriptor({ }); } + const maxDigits = normalizeInteger(config.maxDigits, 1, undefined); const payload = { status: 'prompt', timeout: convertDurationFromSecondsToMillis(config.timeout), @@ -132,8 +133,8 @@ export const promptForNumberNode = createNodeDescriptor({ type: { name: 'Number', submitInputs: submitInputs, - minDigits: normalizeInteger(config.minDigits, undefined, undefined), - maxDigits: normalizeInteger(config.maxDigits, undefined, undefined), + minDigits: normalizeInteger(config.minDigits, undefined, maxDigits), + maxDigits: maxDigits, }, }; api.say(config.text, payload);