【问题标题】:Twilio, how do I get the voice response from phoneTwilio,我如何从电话中获得语音响应
【发布时间】:2018-04-12 16:59:45
【问题描述】:

我目前正在尝试将 dialogflow 与 twilio 集成。我希望能够解析我的客户给机器人的语音响应。如何获得语音响应;并根据某些语音文本发回响应。

截至目前;当有人拨打电话时,它会回复 Hello;然后我希望能够获取客户的回复;然后适当地回复它。到目前为止,我正在使用网络钩子“来电”。 这是否需要将语音转换为文本的额外库?或者 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)

【问题讨论】:

  • 你让它工作了吗?

标签: python twilio-api twilio-programmable-voice


【解决方案1】:

您正在寻找的是语音收集命令。 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://www.twilio.com/docs/voice/twiml/gather

【讨论】:

    猜你喜欢
    • 2016-12-16
    • 2014-04-24
    • 2017-02-01
    • 2021-12-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多