Last active
December 14, 2015 04:59
-
-
Save caseysoftware/5031949 to your computer and use it in GitHub Desktop.
You can view this file in context here: https://github.com/caseysoftware/upgrading-google-voice-to-Twilio
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 | |
| 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