Skip to content

Instantly share code, notes, and snippets.

@twohlix
Created February 23, 2012 04:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twohlix/1890379 to your computer and use it in GitHub Desktop.
Save twohlix/1890379 to your computer and use it in GitHub Desktop.
Apartment Door Unlocker - twilio style
<?php
header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
function randomResponseString(){
$responses = array( 'Sup wid it?', 'Helloooooooooooooo',
'Noob Noob Noob Noob', 'Let the Base Cannon Kick It: wub wub wub wub',
'A horse passes behind you', 'Help I am stuck in an apartment buzzer factory. Please send help!',
'Skynet became self aware at '.date('g h A').' today.', 'Access Denied',
'I will grant you access if you spin around 3 times! Go on. Do it. Hooray',
);
return $responses[rand(0, sizeof($responses)-1)];
//return $responses[sizeof($responses)-1]; //for testing
}
?>
<Response>
<Say><?php echo randomResponseString(); ?></Say>
<Pause length="1"/>
<Play>http://example.com/twilio/dtmf-9.mp3</Play>
<Pause length="1"/>
<Hangup/>
</Response>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment