呼叫客户端以mp3语音消息开头

时间:2019-09-19 20:46:56

标签: python twilio twilio-click-to-call

我对Twilio和Python非常陌生。 我正在尝试通过Twilio拨打电话,并且该电话以预先录制的MP3 / YouTube语音消息开头。我知道我可以自定义TwiML并使用操作。但是,我需要从免费试用帐户升级我的帐户吗?

1 个答案:

答案 0 :(得分:1)

假设您已经有一个Twilio帐户,则应该有一个account_sid和一个auth_token。这是来自The Twilio Python Documentation的示例。更改值以适合您的环境。

# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client

account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

call = client.calls.create(
                    url='http://demo.twilio.com/docs/voice.xml',
                    to='+14155551212',
                    from_='+15017122661'
                )

print(call.sid)

在这种情况下,以http://demo.twilio.com/docs/voice.xml TwiML 文件为例。从您的Twilio帐户,您应该能够创建自己的 TwiML 文件并根据需要自定义交互。