Portions created by the Initial Developer are Copyright (C) 2021 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane */ //includes include "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/paging.php"; //check permissions if (permission_exists('fax_extension_view')) { //access granted } else { echo "access denied"; exit; } //add multi-lingual support $language = new text; $text = $language->get(); //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); //get fax extensions if (is_uuid($_REQUEST["id"])) { $fax_uuid = $_REQUEST["id"]; if (permission_exists('fax_extension_view_domain')) { //show all fax extensions $sql = "select fax_name, fax_extension from v_fax "; $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and fax_uuid = :fax_uuid "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['fax_uuid'] = $fax_uuid; } else { //show only assigned fax extensions $sql = "select fax_name, fax_extension from v_fax as f, v_fax_users as u "; $sql .= "where f.fax_uuid = u.fax_uuid "; $sql .= "and f.domain_uuid = :domain_uuid "; $sql .= "and f.fax_uuid = :fax_uuid "; $sql .= "and u.user_uuid = :user_uuid "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['fax_uuid'] = $fax_uuid; $parameters['user_uuid'] = $_SESSION['user_uuid']; } $database = new database; $row = $database->select($sql, $parameters, 'row'); if (is_array($row) && @sizeof($row) != 0) { //set database fields as variables $fax_name = $row["fax_name"]; $fax_extension = $row["fax_extension"]; } else { if (!permission_exists('fax_extension_view_domain')) { echo "access denied"; exit; } } unset($sql, $parameters, $row); } $sql = "select * from v_fax_files "; $sql .= "where fax_uuid = :fax_uuid "; $sql .= "and domain_uuid = :domain_uuid "; $sql .= "and fax_mode = 'tx' "; $parameters['fax_uuid'] = $_REQUEST["id"]; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $fax_files = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); //check if currently sending a fax $switch_cmd = 'show channels as json'; //create the event socket connection $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); //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"); } //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 "Show active faxes that are currently sending.\n"; echo "

\n"; //echo "
\n"; echo "\n"; echo " \n"; echo " \n"; //echo " "; echo " \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++; } } } 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"; //$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'].'/'.$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"; ?>