Created
February 22, 2012 06:13
-
-
Save caseysoftware/1881959 to your computer and use it in GitHub Desktop.
This is a simple script using the Twilio PHP Helper library to retrieve Calls within a certain date range and the delete their associated recordings if they're particularly short.
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 | |
require 'Services/Twilio.php'; | |
include 'credentials.php'; | |
$toNumber = "{fill this in with your number}"; | |
$client = new Services_Twilio($accountsid, $authtoken); | |
$calls = $client->account->calls->getIterator(0, 50, array("To" => $toNumber, "StartTime<" => "2011-11-10")); | |
foreach ($calls as $call) { | |
if ($call->duration < 20) { | |
echo $call->sid . " -- " . $call->start_time . "\n"; | |
$recordings = $call->recordings; | |
foreach($recordings as $recording) { | |
echo $recording->sid."\n"; | |
$client->account->recordings->delete($recording->sid); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment