twilio - Twilio Studio 说/收集提示
问题描述
我们正在使用 Twilio Studio 来管理我们的 IVR 流,并且在识别特定数字时遇到了问题。
示例:其中包含 22 的验证码被 Twilio 识别为“tutu”
除了更改“识别语言”之类的设置之外,我想让 Twilio 比其他输入更能识别数字。有一个“语音识别提示”选项,它是一个逗号分隔的值列表——但你应该在里面放什么?该文档仅讨论逗号分隔的列表,仅此而已!
感激地收到任何帮助。
提前致谢
解决方案
您可以查看进入$OOV_CLASS_DIGIT_SEQUENCE
提示部分是否对捕获的SpeechResult
.
另一种选择是通过将 tutu 转换为 22 的标准化 Twilio 函数运行结果。
我会在捕获数字时推荐 DTMF,以避免这种情况。
// converts number words to integers (e.g. "one two three" => 123)
function convertStringToInteger( str ) {
let resultValue = "";
let arrInput = [];
let valuesToConvert = {
"one": "1",
"two": "2",
"to": "2",
"three": "3",
"four": "4",
"five": "5",
"six": "6",
"seven": "7",
"eight": "8",
"nine": "9",
"zero": "0"
};
str = str.replace(/[.,-]/g," "); // sanitize string for punctuation
arrInput = str.split(" "); // split input into an array
// iterate through array and convert values
arrInput.forEach( thisValue => {
if( ! isNaN(parseInt(thisValue)) ) { // value is already an integer
resultValue += `${parseInt(thisValue)}`;
} else { // non-integer
if( valuesToConvert[thisValue] !== undefined) {
resultValue += valuesToConvert[thisValue];
} else {
// we don't know how to interpret this number..
return false;
}
}
});
console.log('value converted!', str, ' ====> ', resultValue);
return resultValue;
}
推荐阅读
- javascript - appendchild 后无法将表格行与标题对齐
- ios - iOS中具有多个表格视图的屏幕的容器视图?
- npm - 如何在 Visual Studio Code 中获取 Live Server 的外部 URL?
- php - 使用 PHP 按键和值取消设置数组
- c# - C# 打印 PDF 和移动文件失败。文件正被另一个进程使用
- reactjs - 如何在既不是子元素也不是父元素的两个组件上使用 ref
- java - 在 java eclipse 中,我从数据库中检索数据并粘贴到已经存在的 excel 中。已经存在的数据将被删除
- c++ - C++ 从文件中读取 fstream 数据不会返回正确的值。inputFile.tellg 返回 -1
- javascript - 如何在 JavaScript 中连接两个结构相同的 JSON 数据集?
- pine-script - 谁能检查一下为什么我没有收到信号并收到“未声明的标识符”错误