因此,接受来电和收集语音。下面是我使用Python和Flask编写的代码示例
# more code above
resp.gather(input='speech dtmf', timeout=3, speech_timeout=4, action='/gather', method='POST')
resp.redirect('/gather')
# more code in between
@app.route("/gather", methods=['GET', 'POST'])
def gather():
#print("gather: Entry ")
resp = VoiceResponse()
sid = request.form['CallSid']
SpeechResult = request.values.get("SpeechResult", "")
params = urllib.parse.urlencode({"SpeechResult": SpeechResult})
print("0 gather: " + str(params).lower())
但是,调用此函数会导致:
0 gather: speechresult=
当我自己调用这个应用程序时,我注意到它等待了5秒钟才开始提示。我怎样才能告诉聚集在聚集前5秒开始
我尝试在resp.gather
之前添加time.slpeep(5)
。。。但没用
Twilio开发者福音传道者
我不知道你在说什么
我缺少的是,您的初始^{} 似乎没有请求用户的输入。当
<Gather>
等待输入时,这将导致~5秒的静默,然后放弃并转到/gather
端点,而SpeechResult
中没有任何内容如果您想对用户说些什么让他们回答,您应该在} ,如下所示:
<Gather>
中使用^{也可以在} 和^{}
<Gather>
中使用^{如果有帮助,请告诉我
相关问题 更多 >
编程相关推荐