我一直在尝试找出如何在检测到答录机时拨打外线电话以留下语音邮件。我仍处于探索的开始,并一直在尝试遵循this之类的Twilio示例。我想使用Python,所以我从下面的Twilio复制粘贴示例:
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client
# Your account Sid and Auth Token from twilio.com/console
# DANGER! This is insecure. See http://twil.io/secure
account_sid = 'your account sid'
auth_token = 'your_auth_token'
client = Client(account_sid,auth_token)
call = client.calls.create(
url='http://demo.twilio.com/docs/voice.xml',to='+1555123456',from_='+1501123456'
)
print(call.sid)
在上面的代码中,似乎Twilio的Python SDK始终期望url
(公开可用的XML文件/响应)作为ping的资源。我想知道是否可以构建有效的XML(TwiML)文件并在上述client.calls.create(...)
调用中引用它。换句话说,如何使Twilio“说”我在本地计算机上的XML文件中设计的内容(如果可能的话)?我只打算根据需要从我的个人计算机上运行Python脚本,而且我无法访问任何地方的服务器。
预先感谢您的回答/建议!