-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmake_call.py
39 lines (27 loc) · 1.14 KB
/
make_call.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
29
30
31
32
33
34
35
36
37
38
39
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client
import twilio_credentials
import argparse
# Your Account Sid and Auth Token from twilio.com/console
#account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
playbooks={
# this will send DTMF '1'
'playbook_2': 'https://handler.twilio.com/twiml/EH21752ca7833091a46f2afc74eb05cac3',
}
def make_call(callee_number, playbook_url=playbooks['playbook_2']):
client = Client(twilio_credentials.account_sid, twilio_credentials.auth_token)
call = client.calls.create(
#url='https://gist.githubusercontent.com/sli-cs/452c15d2dfa4dfe871af0f9604a6edc8/raw/3e842f717510e7560a13ec4055a8d09e2a8bcc14/test_twml.xml',
url=playbook_url,
to=callee_number,
from_=twilio_credentials.from_number
)
return
pass
def main():
parser = argparse.ArgumentParser(description='call someone!')
parser.add_argument('callee_number', help='the number to call')
args = parser.parse_args() # returns data from the options specified (echo)
make_call(args.callee_number)
if __name__ == '__main__':
main()