diff --git a/app/fax/fax_outbox.php b/app/fax/fax_outbox.php index ef82c092f0..d20a296c52 100644 --- a/app/fax/fax_outbox.php +++ b/app/fax/fax_outbox.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2021 + Portions created by the Initial Developer are Copyright (C) 2021 the Initial Developer. All Rights Reserved. Contributor(s): @@ -47,38 +47,7 @@ $object = new token; $token = $object->create($_SERVER['PHP_SELF']); -//additional includes - $document['title'] = 'Fax Outbox'; - require_once "resources/header.php"; - -//show the content - echo "
\n"; - echo "
Fax Outbox
\n"; - echo "
\n"; - echo "
\n"; - - echo "This is the Fax Outbox\n"; - echo "

\n"; - - //echo "
\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo ""; - - echo "\n"; - echo "\n"; - - echo " "; - echo " "; - echo " "; - echo " "; - - echo "\n"; - - - //get fax extension +//get fax extensions if (is_uuid($_REQUEST["id"])) { $fax_uuid = $_REQUEST["id"]; if (permission_exists('fax_extension_view_domain')) { @@ -104,8 +73,8 @@ $row = $database->select($sql, $parameters, 'row'); if (is_array($row) && @sizeof($row) != 0) { //set database fields as variables - $fax_name = $row["fax_name"]; - $faxext = $row["fax_extension"]; + $fax_name = $row["fax_name"]; + $fax_extension = $row["fax_extension"]; } else { if (!permission_exists('fax_extension_view_domain')) { @@ -115,10 +84,6 @@ } unset($sql, $parameters, $row); } - - - - $myId = $_SESSION['/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$faxext.'/temp']; $sql = "select * from v_fax_files "; $sql .= "where fax_uuid = :fax_uuid "; @@ -129,10 +94,8 @@ $database = new database; $fax_files = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); - -//Test if currently sending: -//set the command +//check if currently sending a fax $switch_cmd = 'show channels as json'; //create the event socket connection @@ -141,61 +104,79 @@ //send the event socket command and get the array if ($fp) { $json = trim(event_socket_request($fp, 'api '.$switch_cmd)); - $results = json_decode($json, "true"); } -if (isset($results["rows"])) { - - if (is_array($results["rows"]) && @sizeof($results["rows"]) != 0) { - $x = 0; - foreach ($results["rows"] as $row) { - - $file = basename($row['application_data']); - if (strtolower(substr($file, -3)) == "tif" || strtolower(substr($file, -3)) == "pdf") { - $file_name = substr($file, 0, (strlen($file) -4)); - } - - - if (strlen($row['fax_base64']) <= 0) { - echo "\n"; +//additional includes + $document['title'] = 'Fax Outbox'; + require_once "resources/header.php"; - echo ""; - echo ""; - echo ""; - echo ""; - echo "\n"; +//show the content + echo "
\n"; + echo "
Fax Outbox
\n"; + echo "
\n"; + echo "
\n"; + + echo "Show active faxes that are currently sending.\n"; + echo "

\n"; + + //echo "\n"; + echo "\n"; + echo " \n"; + echo " \n"; + //echo " "; + + echo "
DestinationStatusPreviewPath
".$row['dest']."Sending...Fax PDF - ".$file_name."".$row['application_data']."
\n"; + echo " \n"; + echo " "; + echo " "; + echo " "; + echo " "; + echo " \n"; + +//loop through the faxes + if (isset($results["rows"])) { + if (is_array($results["rows"]) && @sizeof($results["rows"]) != 0) { + $x = 0; + foreach ($results["rows"] as $row) { + $file = basename($row['application_data']); + if (strtolower(substr($file, -3)) == "tif" || strtolower(substr($file, -3)) == "pdf") { + $file_name = substr($file, 0, (strlen($file) -4)); + } + + if (strlen($row['fax_base64']) <= 0) { + echo " \n"; + echo " "; + echo " "; + echo " \n"; + echo " "; + echo " \n"; + } + $x++; } - $x++; } } -} - - echo "
DestinationStatusPreviewPath
".escape($row['dest'])."Sending...\n"; + echo " Fax PDF - ".urlencode($file_name)."\n"; + echo " ".escape($row['application_data'])."
\n"; - echo "
\n"; - - echo "\n"; - + echo " \n"; + echo "
\n"; + echo " \n"; echo "
\n"; - echo "\n"; - echo "\n"; + //$my_id = $_SESSION['/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$fax_extension.'/temp']; + //if (file_exists('/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$fax_extension.'/temp/'.$my_id.'.tif')) { + // rename('/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$fax_extension.'/temp/'.$my_id.'.tif', '/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$fax_extension.'/sent/'.$my_id.'.tif'); + //} - if (file_exists('/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$faxext.'/temp/'.$myId.'.tif')) { - rename('/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$faxext.'/temp/'.$myId.'.tif', '/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$faxext.'/sent/'.$myId.'.tif'); - } - - if (file_exists('/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$faxext.'/temp/'.$myId.'.pdf')) { - rename('/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$faxext.'/temp/'.$myId.'.pdf', '/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$faxext.'/sent/'.$myId.'.pdf'); - } - - + //if (file_exists('/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$fax_extension.'/temp/'.$my_id.'.pdf')) { + // rename('/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$fax_extension.'/temp/'.$my_id.'.pdf', '/var/lib/freeswitch/storage/fax/'.$_SESSION['domain_name'].'/'.$fax_extension.'/sent/'.$my_id.'.pdf'); + //} //include the footer require_once "resources/footer.php";