Skip to content

Instantly share code, notes, and snippets.

@jaboutboul
Created November 21, 2011 18:11
Show Gist options
  • Save jaboutboul/1383401 to your computer and use it in GitHub Desktop.
Save jaboutboul/1383401 to your computer and use it in GitHub Desktop.
Hello Monkey 1.4 - (718) 701-8722
<?php
if($_REQUEST['Digits'] != '1' and $_REQUEST['Digits'] != '2')
{
header("Location: hello-monkey-1.4.php");
die;
}
header("content-type: text/xml");
?>
<Response>
<?php
if ($_REQUEST['Digits'] == '1') { ?>
<Dial>+13105551212</Dial>
<Say>The call failed or the remote party hung up. Goodbye.</Say>
<?php
}
elseif ($_REQUEST['Digits'] == '2') { ?>
<Say>Record your monkey howl after the tone. Press pound to end.</Say>
<Record maxLength="30" finishOnKey="#" action="hello-monkey-handle-recording.php"/>
<?php } ?>
</Response>
<?php
header("content-type: text/xml");
?>
<Response>
<Say>Thank you for recording your howl. Here is what you recorded.</Say>
<Play><?php echo $_REQUEST['RecordingUrl'];?></Play>
<Say>Goodbye.</Say>
</Response>
<?php
$people = array(
"+17182493243"=>"Jack"
);
if(!$name = $people[$_REQUEST['From']])
$name = "Monkey";
header("content-type: text/xml");
?>
<Response>
<Say>Hello <?php echo $name?></Say>
<Play>http://demo.twilio.com/hellomonkey/monkey.mp3</Play>
<Gather numDigits="1" action="hello-monkey-1.4-handle-key.php" method="Post">
<Say>To speak to a real monkey, press 1. To record your own howl, press 2. Press any other key to start over.</Say>
</Gather>
</Response>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment