Last active
April 6, 2022 03:02
-
-
Save jmadden/562d50eb0c9a427ac141f9e8da6e57b5 to your computer and use it in GitHub Desktop.
Sequentially dial phone numbers using Twilio and Twilio's PHP helper library
This file contains 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 the bundled autoload file - the path may need to change | |
// based on where you downloaded and unzipped the SDK | |
require __DIR__ . '/twilio-php-master/Twilio/autoload.php'; | |
// Use Twilio\TwiML to build TwiML instructions through PHP | |
use Twilio\Twiml; | |
// Instantiate a TwiML object. | |
$response = new Twiml(); | |
// Fill this array with phone numbers to be called. List them in order of importance. | |
// The included phone numbers are fake example numbers so be sure to change them. | |
$callToArr = (1 => '+15554441212', 2 => '+16667778989'); | |
if (isset($_REQUEST['index'])) { | |
$index = $_REQUEST['index']; | |
} else { | |
$index = 1; | |
} | |
if ($index <= count($callToArr)){ | |
$next = $index + 1; | |
$dial = $response->dial(['timeout' => 15,'action' => '/sequential_dialing.php?index='.$next], ); | |
$dial->number($callToArr[$index]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment