-
Notifications
You must be signed in to change notification settings - Fork 93
/
phonecall.py
28 lines (21 loc) · 1.09 KB
/
phonecall.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Twilio phone number goes here. Grab one at https://twilio.com/try-twilio
# and use the E.164 format, for example: "+12025551234"
TWILIO_PHONE_NUMBER = ""
# list of one or more phone numbers to dial, in "+19732644210" format
DIAL_NUMBERS = ["",]
# URL location of TwiML instructions for how to handle the phone call
TWIML_INSTRUCTIONS_URL = \
"http://static.fullstackpython.com/phone-calls-python.xml"
# replace the placeholder values with your Account SID and Auth Token
# found on the Twilio Console: https://www.twilio.com/console
client = TwilioRestClient("ACxxxxxxxxxx", "yyyyyyyyyy")
def dial_numbers(numbers_list):
"""Dials one or more phone numbers from a Twilio phone number."""
for number in numbers_list:
print("Dialing " + number)
# set the method to "GET" from default POST because Amazon S3 only
# serves GET requests on files. Typically POST would be used for apps
client.calls.create(to=number, from_=TWILIO_PHONE_NUMBER,
url=TWIML_INSTRUCTIONS_URL, method="GET")
if __name__ == "__main__":
dial_numbers(DIAL_NUMBERS)