Example #1
0
    print "Please make sure that it exists, and is writable by the web server.";
    return false;
}
$sql = "SELECT * FROM recordings where displayname = '__invalid'";
$results = $db->getRow($sql, DB_FETCHMODE_ASSOC);
if (!isset($results['filename'])) {
    sql("INSERT INTO recordings (displayname, filename, description) VALUES ( '__invalid', 'install done', '');");
    $dh = opendir($recordings_directory);
    while (false !== ($file = readdir($dh))) {
        // http://au3.php.net/readdir
        if ($file[0] != "." && $file != "CVS" && $file != "svn" && !is_dir("{$recordings_directory}/{$file}")) {
            // Ignore the suffix..
            $fname = ereg_replace('.wav', '', $file);
            $fname = ereg_replace('.gsm', '', $fname);
            if (recordings_get_id("custom/{$fname}") == null) {
                recordings_add($fname, "custom/{$file}");
            }
        }
    }
}
global $db;
// Upgrade to recordings 3.0
// Change filename from VARCHAR(80) to BLOB
// Upgrade to recordings 3.0
// Change filename from VARCHAR(80) to BLOB
// no need to add this if we are on sqlite, since the initial tables will
// include the correct columns already.
if ($amp_conf["AMPDBENGINE"] != "sqlite" && $amp_conf["AMPDBENGINE"] != "sqlite3") {
    $sql = 'ALTER TABLE recordings CHANGE filename filename BLOB';
    $result = $db->query($sql);
    if (DB::IsError($result)) {
Example #2
0
function recordings_get_or_create_id($fn, $module)
{
    $id = recordings_get_id($fn);
    if ($id != null) {
        return $id;
    } else {
        // Create the id, name it the file name or if multi-part ...
        //
        $dname = explode('&', $displayname);
        $displayname = 'auto-created: ';
        $displayname .= count($dname) == 1 ? $fn : $dname[0] . "&...";
        $description = sprintf(_("Missing Sound file auto-created from migration of %s module"), $module);
        recordings_add($displayname, $fn, $description = '');
        // get the id we just created
        //
        $id = recordings_get_id($fn);
        // Notify of issue
        //
        $nt =& notifications::create($db);
        $text = sprintf(_("Non-Existent Recording in module %s"), $module);
        $extext = sprintf(_("The %s referenced a recording file listed below that does not exists. An entry has been generated, named %s, with the referenced file(s) but you should confirm that it really works and the real files exist. The file(s) referenced: %s "), $module, $displayname, $fn);
        $nt->add_error('recordings', 'NEWREC-' . $id, $text, $extext, '', true, true);
        unset($nt);
        // return the id just created
        return $id;
    }
}
Example #3
0
 $suffix = escapeshellcmd(strtr($suffix, '/ ', '__'));
 if (!file_exists($astsnd . "custom")) {
     if (!mkdir($astsnd . "custom", 0775)) {
         echo '<div class="content"><h5>' . _("Failed to create") . ' ' . $astsnd . 'custom' . '</h5>';
     }
 } 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 "<hr><h5>" . _("[ERROR] The Recorded File Does Not exists:") . "</h5>";
         echo $recordings_save_path . "{$dest}ivrrecording.{$suffix}<br><br>";
         echo "make sure you uploaded or recorded a file with the entered extension<hr>";
     } 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 "<hr><h5>" . _("[ERROR] SAVING RECORDING:") . "</h5>";
             foreach ($outarray as $line) {
                 echo "{$line}<br>";
             }
             echo _("Make sure you have entered a proper name");
             echo "<hr>";
         }
         exec("rm " . $recordings_save_path . "{$dest}ivrrecording.{$suffix} ", $outarray, $ret);
         if ($ret) {
             echo "<hr><h5>" . _("[ERROR] REMOVING TEMPORARY RECORDING:") . "</h5>";
             foreach ($outarray as $line) {
                 echo "{$line}<br>";
             }
             echo _("Make sure Asterisk is not running as root ");