Created
February 27, 2011 00:21
-
-
Save tjlytle/845769 to your computer and use it in GitHub Desktop.
Sample script to go directly to voicemail.
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
<?php | |
require_once 'client.php'; //setup the Twilio rest client and assorted vars | |
$number = '1235556789'; //the number you're calling | |
$data = array('From' => $callerID, | |
'To' => $number, | |
'Url' => "http://twimlets.com/message?Message%5B0%5D=Voicemail&"); | |
//place both calls | |
$call1 = $client->request("$version/Accounts/$accountSid/Calls", 'POST', $data); | |
$call2 = $client->request("$version/Accounts/$accountSid/Calls", 'POST', $data); | |
sleep(2); //allow the calls to actually start | |
//assuming the first call got through, the second was sent to voicemail | |
//so hangup the first call | |
$client->request("$version/Accounts/$accountSid/Calls/{$call1->ResponseXml->Call->Sid}", POST, array('Status' => 'completed')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment