. Copyright (C) 2013 robi All rights reserved. originally part of m0n0wall (http://m0n0.ch/wall) Copyright (C) 2003-2005 Manuel Kasper . All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* pfSense_MODULE: asterisk */ ##|+PRIV ##|*IDENT=page-status-asterisk ##|*NAME=Status: Asterisk Calls page ##|*DESCR=Allow access to the 'Status: Asterisk Calls' page. ##|*MATCH=asterisk_calls.php* ##|-PRIV require_once("guiconfig.inc"); $pgtitle = array(gettext("Status"),gettext("Asterisk Calls")); include("head.inc"); /* Path to call log database */ $callog = "/var/log/asterisk/cdr-csv/Master.csv"; /* Data input processing */ $cmd = $_GET['cmd']; $file = $_SERVER["SCRIPT_NAME"]; $break = Explode('/', $file); $pfile = $break[count($break) - 1]; if (file_exists($callog)) switch ($cmd){ case "trim": $trimres=shell_exec("tail -50 '$callog' > /tmp/trimmed_asterisk.csv && rm '$callog' && mv /tmp/trimmed_asterisk.csv '$callog' && chown asterisk:asterisk '$callog' && chmod g+w '$callog'"); header( 'Location: asterisk_calls.php?savemsg=Calls+log+trimmed.') ; break; case "clear": $trimres=shell_exec("rm '$callog' && touch '$callog' && chown asterisk:asterisk '$callog' && chmod g+w '$callog'"); header( 'Location: asterisk_calls.php?savemsg=Calls+log+cleared.') ; break; case "download": // session_cache_limiter('none'); //*Use before session_start() // session_start(); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.basename($callog)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize($callog)); ob_clean(); flush(); readfile($callog); exit; break; } ?>
" . $out; $out = "" . $out; $out = "" . $out; } } fclose($file_handle); } echo $out; echo ""; ?>
Last 50 Asterisk calls
" . utf8_decode(str_replace('"', '', $lin[4])) . "" . $lin[2] . "" . $lin[9] . "" . $lin[11] . "" . gmdate("G:i:s", $lin[12]) . "" . $lin[14] . "
"; echo ""; echo "




This log may be lost when rebooting the system."; ?>