Created
April 9, 2011 11:20
-
-
Save bevenky/911316 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import helpers | |
#Sid and AuthToken | |
SID = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' | |
AUTH_TOKEN = 'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY' | |
originate_dial_string = "bridge_early_media=true,hangup_after_bridge=true" | |
# Create a REST object | |
rest = helpers.REST(SID, AUTH_TOKEN) | |
# Initiate a new outbound call to user/1000 using a HTTP POST | |
call_params = { | |
'From': '919191919191' #Caller Id | |
'To' : '1000', #User Number to Call | |
'Gateways' : "user/", #Gateway string to try dialing our separated by comma. First in list will be tried first | |
'GatewayCodecs' : "'PCMA,PCMU'", #Codec string as needed by FS for each gateway separated by comma | |
'GatewayTimeouts' : "60", #Seconds to timeout in string for each gateway separated by comma | |
'GatewayRetries' : "2", # Retry String for Gateways separated by comma, on how many times each gateway should be retried | |
'OriginateDialString' : originate_dial_string, | |
'AnswerUrl' : "http://demo.com/welcome/", | |
'HangUpUrl' : "http://demo.com/welcome/", | |
'RingingUrl' : "http://demo.com/welcome/" | |
} | |
try: | |
print rest.call(call_params) | |
except Exception, e: | |
print e | |
print e.read() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment