Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save caseysoftware/5026167 to your computer and use it in GitHub Desktop.
<?php
include 'functions.php';
header("Content-type: text/xml");
$filter = "!@#$^&%*()+=-[]\/{}|:<>?,.";
$recording = preg_replace("/[$filter]/", "", $_POST['RecordingUrl']);
$duration = (int) $_POST['RecordingDuration'];
$from = preg_replace("/[^0-9]/", "", $_GET['From']);
$subject = "You have a new voicemail from " . $from;
$body = "You received a $duration second voicemail." .
"\n\nHere is the recording: " . $recording;
mail($toEmail, $subject, $body);
$response = new Services_Twilio_Twiml();
$response->hangup();
print $response;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment