Skip to content

Instantly share code, notes, and snippets.

@caseysoftware
Last active December 14, 2015 04:59
Show Gist options
  • Select an option

  • Save caseysoftware/5031949 to your computer and use it in GitHub Desktop.

Select an option

Save caseysoftware/5031949 to your computer and use it in GitHub Desktop.
<?php
include 'functions.php';
header("Content-type: text/xml");
$whitelist = array('17035551212', '12025551212');
$from = preg_replace("/[^0-9]/", "", $_POST['From']);
$allowed = is_allowed($from, $whitelist, 7, 15);
$response = new Services_Twilio_Twiml();
if ($allowed) {
$response->dial($toPhone);
} else {
$response->say("I'm sorry, $name is not available at this time. Please leave a message after the tone.");
$response->record(array(
'transcribeCallback' => 'rev2-transcribed.php?From=' . $from,
// Note: since we used transcribeCallback, 'transcribe' => 'true' is assumed
));
}
print $response;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment