:retry_interval) "; $sql .= " ) "; $sql .= " or ( "; $sql .= " fax_status = 'sent' "; $sql .= " and fax_email_address is not null "; $sql .= " and fax_notify_date is null "; $sql .= " ) "; $sql .= ") "; $sql .= "order by domain_uuid asc "; $sql .= "limit :limit "; if (isset($hostname)) { $parameters['hostname'] = $hostname; } else { $parameters['hostname'] = gethostname(); } $parameters['limit'] = $fax_queue_limit; $parameters['retry_interval'] = $fax_retry_interval; if (isset($debug_sql)) { echo $sql."\n"; print_r($parameters); } $database = new database; $fax_queue = $database->select($sql, $parameters, 'all'); unset($parameters); //show results from the database if (isset($debug_sql)) { echo $sql."\n"; print_r($parameters); } //process the messages if (is_array($fax_queue) && @sizeof($fax_queue) != 0) { foreach($fax_queue as $row) { $command = exec('which php')." ".$_SERVER['DOCUMENT_ROOT']."/app/fax_queue/resources/job/fax_send.php "; $command .= "'action=send&fax_queue_uuid=".$row["fax_queue_uuid"]."&hostname=".$hostname."'"; if (isset($debug)) { //run process inline to see debug info echo $command."\n"; $result = system($command); echo $result."\n"; } else { //starts process rapidly doesn't wait for previous process to finish (used for production) echo $command."\n"; $handle = popen($command." > /dev/null &", 'r'); echo "'$handle'; " . gettype($handle) . "\n"; $read = fread($handle, 2096); echo $read; pclose($handle); } } } //pause to prevent excessive database queries sleep($fax_queue_interval); } //remove the old pid file if (file_exists($pid_file)) { unlink($pid_file); } //save output to //$fp = fopen(sys_get_temp_dir()."/mailer-app.log", "a"); //prepare the output buffers //ob_end_clean(); //ob_start(); //message divider for log file //echo "\n\n=============================================================================================================================================\n\n"; //get and save the output from the buffer //$content = ob_get_contents(); //get the output from the buffer //$content = str_replace("
", "", $content); //ob_end_clean(); //clean the buffer //fwrite($fp, $content); //fclose($fp); //notes //echo __line__."\n"; // if not keeping the email then need to delete it after the voicemail is emailed //how to use this feature // cd /var/www/fusionpbx; /usr/bin/php /var/www/fusionpbx/app/fax_queue/resources/send.php ?>