select($sql, $parameters, 'all'); //view_array($message_queue, false); unset($parameters); //process the messages if (is_array($message_queue) && @sizeof($message_queue) != 0) { foreach($message_queue as $row) { //direction inbound, send SIP messages to registered phones if ($row['message_direction'] == 'inbound') { $command = "/usr/bin/php /var/www/fusionpbx/app/messages/resources/service/message_send_inbound.php "; $command .= "'message_queue_uuid=".$row['message_queue_uuid']."&hostname=".$row['hostname']."'"; } //direction outbound, send message to the provider if ($row['message_direction'] == 'outbound') { // /usr/bin/php /var/www/fusionpbx/app/messages/resources/service/message_send_outbound.php action=send&message_queue_uuid=&hostname=voip.fusionpbx.com $command = "/usr/bin/php /var/www/fusionpbx/app/messages/resources/service/message_send_outbound.php "; $command .= "'message_queue_uuid=".$row['message_queue_uuid']."&hostname=".$row['hostname']."'"; } //send the command if (isset($command)) { 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) $handle = popen($command." > /dev/null &", 'r'); echo "'$handle'; " . gettype($handle) . "\n"; $read = fread($handle, 2096); echo $read; pclose($handle); } } unset($command); } } //pause to prevent excessive database queries sleep(1); } //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/messages/resources/service/message_queue.php ?>