Skip to content

Instantly share code, notes, and snippets.

@twilio
Created April 13, 2010 20:30
Show Gist options
  • Save twilio/365049 to your computer and use it in GitHub Desktop.
Save twilio/365049 to your computer and use it in GitHub Desktop.
<%
' replace with your account's settings
' available in the Dashboard
accountSid = "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
authToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
' setup the URL
baseUrl = "https://api.twilio.com"
callUrl = baseUrl & "/2008-08-01/Accounts/" & accountSid & "/Calls"
' setup the request and authorization
Set http = Server.CreateObject("MSXML2.ServerXMLHTTP")
http.open "POST", callUrl, False, accountSid, authToken
http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
' call parameters
caller = "your-number-here" ' the number to call from
called = "recipient-number-here" ' the number to dial
url = "call-handler-url-here" ' URL handler for the call, should return TwiML
postData = "Caller=" & Server.URLEncode(caller)
postData = postData & "&Called=" & Server.URLEncode(called)
postData = postData & "&Url=" & Server.URLEncode(url)
' send the POST data
http.send postData
' optionally write out the response if you need to check if it worked
' Response.Write http.responseText
' clean up
Set http = Nothing
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment