简体   繁体   English

如果呼叫者提前输入号码,星号会挂断

[英]Asterisk hangs up if caller inputs number early

We have an Asterisk IVR system setup that prompts the user for input 我们有一个Asterisk IVR系统设置,提示用户输入

In our extensions file, we have the following: 在扩展文件中,我们具有以下内容:

[englishprocess]
exten => s,1,Answer()
exten => s,n,Wait(1)
exten => s,n,Set(TIMEOUT(digit)=2)
exten => s,n,agi(mstts.agi,"Please enter your ID number followed by pound.",en-US)
exten => s,n,Read(APCODE,,666)
exten => s,n,agi(mstts.agi,"Your ID Number is",en)
exten => s,n,SayDigits(${APCODE})
exten => s,n,agi(mstts.agi,"If this is correct press, 1, otherwise, press, 3",en-US)
exten => s,n,Read(CHECK,,1)
exten => s,n,GotoIf($["${CHECK}" = "3"]?englishprocess,s,1)
exten => s,n,Set(MYADDR=${CURL(webserviceaddress.php?idnum=${APCODE})})
exten => s,n,agi(mstts.agi,${MYADDR},en-US)
exten => s,n,Hangup()

The problem is that if the user inputs their ID before the text to speech prompt finishes, or if they hit 1 before it finishes saying 问题是,如果用户在文本语音提示完成之前输入了其ID,或者如果用户在完成语音提示之前打了1

"If this is correct press, 1, otherwise, press, 3" “如果正确,请按1,否则请按3”

The service hangs up. 服务挂断。

How can we keep the process the same and accept early user input? 我们如何保持流程相同并接受用户的早期输入?

If accepting user input early is not possible is there a way to prevent hangup and prompt again? 如果无法及早接受用户输入,是否可以防止挂断并再次提示?

We switched to Amazon's Polly service to generate the sound files and used the asterisk method Playback(filename) instead of agi() inside of extensions_custom.conf in order to stop the call from hanging up if the user inputs text prematurely. 我们切换到Amazon的Polly服务来生成声音文件,并使用星号方法Playback(filename)而不是extensions_custom.conf内部的agi()来阻止如果用户过早输入文本而导致电话挂断。

Granted the service ignores the inputs that are put in early, but at least it does not hang up. 授予服务将忽略早期输入的内容,但至少不会挂断。 A better solution would accept early input. 更好的解决方案是接受早期输入。 I'll update this if I find an alternative. 如果有其他选择,我将进行更新。

Edit: Found an alternative Read() which lets us play soundbites that can be interrupted, so we now have a mix of Read() and playback() calls and can control which sound files can be skipped by the user in this way. 编辑:找到了一个替代的Read() ,它使我们能够播放可被中断的声音,因此我们现在有了Read()playback()调用的混合,并且可以控制用户可以通过这种方式跳过哪些声音文件。 The service no longer hangs up on users and we no longer use agi() calls. 该服务不再挂断用户,并且我们不再使用agi()调用。

agi(mstts.agi,"text",[language],[intkey],[speed]) : agi(mstts.agi,"text",[language],[intkey],[speed])

intkey is used if the user enters anything the script will stop and go to that extension. 如果用户输入任何内容,则使用intkey脚本将停止并转到该扩展名。 I don't know if it will work in your case but worth a try. 我不知道它是否适合您的情况,但值得尝试。

exten => _X,1,agi(mstts.agi,"You just pressed ${EXTEN}. Try another one please.",en,any) Try using the ,any after the language and see if that works. exten => _X,1,agi(mstts.agi,"You just pressed ${EXTEN}. Try another one please.",en,any)尝试使用,any的语言后,看看是否可行。 I got that example from https://github.com/zaf/asterisk-mstts 我从https://github.com/zaf/asterisk-mstts获得了该示例

Asterisk Dialplan cannot by use seriously to create dynamic services with intensive TextToSpeech. Asterisk Dialplan不能认真地使用密集的TextToSpeech创建动态服务。

  • First because the latency could be an issue if you don't use a cache, or if you don't use an MRCP connector. 首先,因为如果您不使用缓存或不使用MRCP连接器,则延迟可能是一个问题。
  • Secondly because by this way you not support the bargein ( https://www.w3.org/TR/voicexml20/#dml4.1.5 ) and you lost the way to interact with DTMF (or voice) at any moment. 其次,因为通过这种方式您不支持插入( https://www.w3.org/TR/voicexml20/#dml4.1.5 ),并且您在任何时候都无法与DTMF(或语音)进行交互。

To create a Voice Portal, you probably need a VoiceXML interpreter. 要创建语音门户,您可能需要一个VoiceXML解释器。 You have 2 ways to create this service in an Asterisk : Voximal a commercial application running over and Asterisk, or VoiceGlue a free GPL dead project (you can run it over old Asterisk). 您可以通过两种方法在Asterisk中创建此服务:Voximal是运行在Asterisk之上的商业应用程序,或VoiceGlue是免费的GPL无效项目(您可以在旧的Asterisk上运行它)。

Look into this line: 查看此行:

print "STREAM FILE $file \"$keys\"\n";

https://www.voip-info.org/wiki/view/stream+file https://www.voip-info.org/wiki/view/stream+file

 Usage: STREAM FILE <filename> <escape digits> [sample offset]

Send the given file, allowing playback to be interrupted by the given digits, if any.

Use double quotes for the digits if you wish none to be permitted.

If sample offset is provided then the audio will seek to sample offset before play starts.

Remember, the file extension must not be included in the filename.

After that it for some reason work like waitexten and change extension. 之后,由于某种原因,它会像waitexten和更改扩展名那样工作。 I have no idea who and why added that to code, you can ask maintainer. 我不知道谁和为什么将其添加到代码中,您可以询问维护者。

So just read files you use, not spam questions. 因此,只读取您使用的文件,而不是垃圾邮件问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何读取未知数量的输入? - How to read unknown number of inputs? 用户输入一组特定的数字,并输出该组中的随机数 - User inputs specific set of number and random number from the set is outputted 将用户输入传递给方法未正确添加 - passing user inputs to methods are not being added up correctly 禁用切换按钮取决于角度中的所有数字类型输入 - Disable toggle buttons depends on all number type inputs in angular Haskell输入 - 如何从stdin读取x个输入 - Haskell input - how to read x number of inputs from stdin 如何根据用户输入的数量更新全局变量? - How to update a global variable based on number of user inputs? 访问、DateSerial 函数导致结果不准确(用户输入 2 位月份数字) - Access, DateSerial function causing inaccurate results (user inputs 2 digit month number) 如何从 2 个用户输入中获取天数,然后将其与另一个用户输入相乘,即 JavaScript 中的金额? - How do I get the number of days from 2 user inputs and then multiply it with another user input which is amount in JavaScript? bash:如何总结读取命令中的间隔数? - bash: how to sum up spaced number from read command? 如果用户输入“五百个”,“输入类型=数字”如何显示错误消息 - How does “input type=number” show an error message if the user inputs “five hundreds”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM