我目前正在尝试将dialogflow与twilio集成。我希望能够解析我的客户给机器人的语音响应。如何获取语音应答;并根据特定的语音文本发回应答。
到目前为止,当有人呼叫电话时,它会回复Hello;然后,我希望能够获取客户回复的内容;然后适当地回复。到目前为止,我使用的是webhook "A call in“。这是否需要额外的库来将语音转换为文本?还是twilio提供了它。
import os
from twilio.rest import Client
from flask import Flask
from twilio.twiml.voice_response import VoiceResponse
app = Flask(__name__)
# using os.environ['account_sid']
@app.route('/voice', methods=["GET","POST"])
def voice():
resp = VoiceResponse()
resp.say("hello")
return str(resp)
if __name__ == "__main__":
app.run(debug=True)发布于 2018-04-13 01:02:25
您正在寻找的是语音收集命令。Twilio确实通过这个命令提供了语音识别功能。
from twilio.twiml.voice_response import Gather, VoiceResponse, Say
response = VoiceResponse()
gather = Gather(input='speech dtmf', timeout=3, num_digits=1)
gather.say('Hello!')
response.append(gather)
print(response)https://stackoverflow.com/questions/49802216
复制相似问题