Video link:
To download individual recordings, click on the conversation you'd like to download. The details of the call will appear in the new pop-up window. There will be a download button in this window, check for the three dots. Click on it to download the recording.
To download recordings in bulk, read further:
First, download the report of your choice. If you are on a *nix machine and if you have access to a shell, then you could run the following command:
for i in `cat Exotel_exotel_incoming_reports_dec_09.csv | cut -d , -f 14 | grep -v recording-file-does-not-exist | grep -v RecordingUrl` ; do wget --no-check-certificate $i ; done
You will need to download any call report containing the voicemail links you want to download on your Linux Terminal, filter it according to the agents/groups numbers, etc, and store it.
You need to replace "Exotel_exotel_incoming_reports_dec_09.csv" with the file name you have, run the command on your terminal and the call recordings will get downloaded.
Or, if you like it the PHP way, you could try this:
<?php
$helptext = <<<END_OF_HELP
USAGE: php getrecording.php -f <inputfile> -o <output directory>
Downloading the recordings for the given Call records file.
-f Exotel Call reports file
-o Directory to store the downloaded recordings
END_OF_HELP;
$shortopts = "f:"; // Required value
$shortopts .= "o:"; // Required value
$options = getopt($shortopts);
$file = $options["f"];
$outputdir= $options["o"];
if (empty($file)){ print "Must provide a input file.\n"; print $helptext; exit(1);}if (empty($outputdir)){
print "Must provide a outputdir.\n";
print $helptext;
exit(1);
}$recordingfield = 11;if (($handle = fopen($file, "r")) !== FALSE) { while (($data = fgetcsv($handle, 0 , ",")) !== FALSE) { //Picking up the recording url (12th field) and downloading into the outputdir if(!empty($data[$recordingfield]) && ($data[$recordingfield]!="RecordingUrl")){ $recordingurl = $data[$recordingfield]; echo $recordingurl."\n"; echo "Fetching recording ...\n"; $content = file_get_contents($recordingurl); //Checking if Call Sid, Direction and Status are present -(1) if(!empty($data[0]) && !empty($data[1]) && !empty($data[6])){ if(!is_dir($outputdir)){ if (!mkdir($outputdir, 0777, true)) { die('Failed to create output folders...'); exit(1); }
} //File is named according to (1) file_put_contents($outputdir."/".$data[0]."_".$data[1]."_".$data[6].".wav", $content); echo "Done\n"; }
else{
echo "Using default file name for the recording...".$recordingurl."\n";
file_put_contents($recordingurl.".wav", $content);
echo "Done\n";
} }
} fclose($handle);}
?>
Yes, we have one more code for you to try:
<?php
/*
USAGE : php bulk.php report.csv(The Call Report should be the input) output_dir(Eg: /Desktop)
The first argument is for the Report file from which the recordingUrl is extracted
The second argument is the path of the directory/folder in which you need your recordings to be present
*/
$file = $argv[1];
$outputdir = $argv[2];
if (empty($file))
{
print "Must provide a input file.\n";
print $helptext;
exit(1);
}
if (empty($outputdir)){
print "Must provide a outputdir.\n";
print $helptext;
exit(1);
}
//Provide the row number of recordingurl in the csv file
$recordingfield = 1;
if (($handle = fopen($file, "r")) !== FALSE)
{
while (($data = fgetcsv($handle, 0 , ",")) !== FALSE)
{
//Picking up the recording url and downloading into the outputdir
if(!empty($data[$recordingfield]) && ($data[$recordingfield]!="RecordingUrl"))
{
$recordingurl = $data[$recordingfield];
echo $recordingurl."\n";
echo "Fetching recording ...\n";
$path = pathinfo($recordingurl);
$filename = $path['basename'];
$ch = curl_init($recordingurl);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_NOBODY, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
$output = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status == 200) {
file_put_contents($outputdir."/".$filename, $output);
}
echo "Done\n";
}
}
}
else {
echo "Function is not working";
}
fclose($handle);
Contact us:
If you have any questions or concerns, please connect with us using the chat widget on your Exotel Dashboard or Whatsapp us on 08088919888