[英]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创建动态服务。
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.