Skip to content

Instantly share code, notes, and snippets.

@TMcManus
Last active December 11, 2015 14:09
Show Gist options
  • Select an option

  • Save TMcManus/4612652 to your computer and use it in GitHub Desktop.

Select an option

Save TMcManus/4612652 to your computer and use it in GitHub Desktop.
This script is meant to be placed at the target of Twilio's <Dial action="" record="true"> parameter. It will email you the recording of the call. It's the voice version of this script: http://www.twilio.com/help/faq/sms/how-can-i-forward-sms-to-my-email-inbox
<?php
/**
* This section ensures that Twilio gets a response.
*/
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<Response></Response>'; //Place the desired response (if any) here
/**
* This section actually sends the email.
*/
$to = "your-email@example.com"; // Your email address
$subject = "Call from {$_REQUEST['From']} at {$_REQUEST['To']}";
$message = "You have received a message from {$_REQUEST['From']}.
Recording: {$_REQUEST['RecordingUrl']}";
$headers = "From: webmaster@example.com"; // Who should it come from?
mail($to, $subject, $message, $headers);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment