20060318. // //This program is free software; you can redistribute it and/or //modify it under the terms of the GNU General Public License //as published by the Free Software Foundation; either version 2 //of the License, or (at your option) any later version. // //This program is distributed in the hope that it will be useful, //but WITHOUT ANY WARRANTY; without even the implied warranty of //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //GNU General Public License for more details. $action = isset($_REQUEST['action'])?$_REQUEST['action']:''; $id = isset($_REQUEST['id'])?$_REQUEST['id']:''; $notes = isset($_REQUEST['notes'])?$_REQUEST['notes']:''; $rname = isset($_REQUEST['rname'])?$_REQUEST['rname']:''; $usersnum = isset($_REQUEST['usersnum'])?$_REQUEST['usersnum']:''; $sysrec = isset($_REQUEST['sysrec'])?$_REQUEST['sysrec']:''; $suffix = isset($_REQUEST['suffix']) && trim($_REQUEST['suffix'] != "") ? $_REQUEST['suffix'] : 'wav'; $astsnd = isset($asterisk_conf['astvarlibdir'])?$asterisk_conf['astvarlibdir']:'/var/lib/asterisk'; $astsnd .= "/sounds/"; // check ctype_digit() to avoid very obscure vulnerability that can be made if certain proxy's are used // with the PBX system if (empty($usersnum) || !ctype_digit($usersnum)) { $dest = "unnumbered-"; } else { $dest = "{$usersnum}-"; } // get feature codes for diplay purposes $fcc = new featurecode('recordings', 'record_save'); $fc_save = $fcc->getCodeActive(); unset($fcc); $fcc = new featurecode('recordings', 'record_check'); $fc_check = $fcc->getCodeActive(); unset($fcc); $fc_save = ($fc_save != '' ? $fc_save : _('** MISSING FEATURE CODE **')); $fc_check = ($fc_check != '' ? $fc_check : _('** MISSING FEATURE CODE **')); switch ($action) { case "system": recording_sidebar(-1, null); recording_sysfiles(); break; case "newsysrec": $sysrecs = recordings_readdir($astsnd, strlen($astsnd)+1); if (recordings_add($sysrecs[$sysrec], $sysrecs[$sysrec])) { $id = recordings_get_id($sysrecs[$sysrec]); } else { $id = 0; } recording_sidebar($id, null); recording_editpage($id, null); needreload(); break; case "recorded": // Clean up the filename,suffix, take out any nasty characters $filename = escapeshellcmd(strtr($rname, '/ ', '__')); $suffix = escapeshellcmd(strtr($suffix, '/ ', '__')); if (!file_exists($astsnd."custom")) { if (!mkdir($astsnd."custom", 0775)) { echo '
'._("Failed to create").' '.$astsnd.'custom'.'
'; } } else { // can't rename a file from one partition to another, must use mv or cp // rename($recordings_save_path."{$dest}ivrrecording.wav",$recordings_astsnd_path."custom/{$filename}.wav"); if (!file_exists($recordings_save_path."{$dest}ivrrecording.$suffix")) { echo "
"._("[ERROR] The Recorded File Does Not exists:")."
"; echo $recordings_save_path."{$dest}ivrrecording.$suffix

"; echo "make sure you uploaded or recorded a file with the entered extension
"; } else { exec("cp " . $recordings_save_path . "{$dest}ivrrecording.$suffix " . $astsnd."custom/{$filename}.$suffix 2>&1", $outarray, $ret); if (!$ret) { $isok = recordings_add($rname, "custom/{$filename}.$suffix"); } else { echo "
"._("[ERROR] SAVING RECORDING:")."
"; foreach ($outarray as $line) { echo "$line
"; } echo _("Make sure you have entered a proper name"); echo "
"; } exec("rm " . $recordings_save_path . "{$dest}ivrrecording.$suffix ", $outarray, $ret); if ($ret) { echo "
"._("[ERROR] REMOVING TEMPORARY RECORDING:")."
"; foreach ($outarray as $line) { echo "$line
"; } echo _("Make sure Asterisk is not running as root "); echo "
"; } } recording_sidebar(null, $usersnum); recording_addpage($usersnum); if ($isok) echo '
'._("System Recording").' "'.$rname.'" '._("Saved").'!
'; } break; case "edit": $arr = recordings_get($id); $filename=$arr['filename']; // Check all possibilities of uploaded file types. $valid = Array("au","g723","g723sf","g729","gsm","h263","ilbc","mp3","ogg","pcm","alaw","ulaw","al","ul","mu","sln","raw","vox","WAV","wav","wav49"); $fileexists = false; if (strpos($filename, '&') === false) { foreach ($valid as $xtn) { $checkfile = $recordings_astsnd_path.$filename.".".$xtn; if (file_exists($checkfile)) { $suffix = substr(strrchr($filename, "."), 1); copy($checkfile, $recordings_save_path."{$dest}ivrrecording.".$suffix); $fileexists = true; } } if ($fileexists === false) { echo '
'._("Unable to locate").' '.$recordings_astsnd_path.$filename.' '._("with a a valid suffix").'
'; } } recording_sidebar($id, $usersnum); recording_editpage($id, $usersnum); break; case "edited": recordings_update($id, $rname, $notes, $_REQUEST); recording_sidebar($id, $usersnum); recording_editpage($id, $usersnum); echo '
'._("System Recording").' "'.$rname.'" '._("Updated").'!
'; needreload(); break; case "delete"; recordings_del($id); needreload(); default: recording_sidebar($id, $usersnum); recording_addpage($usersnum); break; } function recording_addpage($usersnum) { global $fc_save; global $fc_check; global $recordings_save_path; ?>

"._("dial")." ".$fc_save." "; echo _("Start speaking at the tone. Hangup when finished.").""; echo _("and speak the message you wish to record.")."\n"; } else { ?>

">

must be PCM Encoded, 16 Bits, at 8000Hz")?>:
" onclick="document.upload.submit(upload);alert('');"/>
"._("Successfully uploaded")." ".$_FILES['ivrfile']['name'].""; $rname = rtrim(basename($_FILES['ivrfile']['name'], $suffix), '.'); } ?>

"._("dial")." ".$fc_check." "._("to listen to your recording.")?>

"._("Step 2: Name").""; } ?>
:
\n"; ?> ">

Error reading Recording ID $id - Aborting

"; return; }?> "; echo _("Remove Recording"); echo " ("; echo _("Note, does not delete file from computer"); echo ")"; ?>

 

:
">
\n"; } function recordings_popup_jscript() { ?>

">

definition around it. $astsnd = isset($asterisk_conf['astvarlibdir'])?$asterisk_conf['astvarlibdir']:'/var/lib/asterisk'; $astsnd .= "/sounds/"; $sysrecs = recordings_readdir($astsnd, strlen($astsnd)+1); print "\n"; echo ""; $audio=$astpath; $REC_CRYPT_PASSWORD = urlencode((isset($amp_conf['AMPPLAYKEY']) && trim($amp_conf['AMPPLAYKEY']) != "")?trim($amp_conf['AMPPLAYKEY']):'moufdsuu3nma0'); $recurl="modules/recordings/popup.php?cryptpass=$REC_CRYPT_PASSWORD&recording=$audio"; echo ""; echo ""; echo ""; if ($count==0) { print "\n"; } else { echo ""; echo ''; print "\n"; } if ($count > $max) { print "\n"; } else { echo ""; echo '\n"; echo ""; print "\n"; } echo '\n"; echo ""; echo ""; print "\n"; print "\n"; } ?>