Cdr viewer for asterisk 1.2.9

Hi does anyone know of a gui that will display the master.csv file for asterisk ver 1.2.9

If its the flat file you want to view then the following was a hack from some years ago that lets you filter the file and display the results, also lets you pass cdr files created by account codes.


Asterisk CDR

Asterisk CDR parser

The CDR records will be serched for the supplied pattern. To display all the records leave the pattern field blank. To search the main CDR record enter Master to search a specific account code enter the account code.

For Example to search fo all calls around 16:00 an account code 2200 enter 16: in the pattern and 2200 in the filter value.

Master / Account code:
Filter Value:


<BODY BGCOLOR="FFFFFF" align="center">
 Copyright (C) 2006 Ian Plain / Derived from previous scripts
  Email contact:

   Name : cdr-disp.php
    Usage: PHP script to list the asterisk CDR records found in
             "/var/log/asterisk/cdr-csv/Master.csv" and other files

                 This file is part of The Asterisk Interface.

                     These files are free software; you can redistribute them and/or modify
                         them under the terms of the GNU General Public License as published by
                             the Free Software Foundation; either version 2 of the License, or
                                 (at your option) any later version.

                                     These programs are distributed in the hope that they will be useful,
                                         but WITHOUT ANY WARRANTY; without even the implied warranty of
                                             MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                                                 GNU General Public License for more details.

                                                     You should have received a copy of the GNU General Public License
                                                         along with these files (see COPYING); if not, write to the:

                                                                  Free Software Foundation, Inc.
                                                                           59 Temple Place
                                                                                    Suite 330
                                                                                             Boston, MA  02111-1307
                                                                                                      //Fields of the CDR in Asterisk
                                                                                                      //   1. accountcode: What account number to use, (string, 20 characters)
                                                                                                      //   2. src: Caller*ID number (string, 80 characters)
                                                                                                      //   3. dst: Destination extension (string, 80 characters)
                                                                                                      //   4. dcontext: Destination context (string, 80 characters)
                                                                                                      //   5. clid: Caller*ID with text (80 characters)
                                                                                                      //   6. channel: Channel used (80 characters)
                                                                                                      //   7. dstchannel: Destination channel if appropriate (80 characters)
                                                                                                      //   8. lastapp: Last application if appropriate (80 characters)
                                                                                                      //   9. lastdata: Last application data (arguments) (80 characters)
                                                                                                      //  10. start: Start of call (date/time)
                                                                                                      //  11. answer: :Answer of call (date/time)
                                                                                                      //  12. end: End of call (date/time)
                                                                                                      //  13. duration: Total time in system, in seconds (integer), from dial to hangup
                                                                                                      //  14. billsec: Total time call is up, in seconds (integer), from answer to hangup
                                                                                                      //  15. disposition: What happened to the call: ANSWERED, NO ANSWER, BUSY
                                                                                                      //  16. amaflags: What flags to use: DOCUMENTATION, BILL, IGNORE etc,
                                                                                                      //      specified on a per channel basis like accountcode.
                                                                                                      //  17. user field: A user-defined field, maximum 255 characters

                                                                                                      if (isset($_POST["grep"]) && isset($_POST["number"])) $pattern = $_POST["grep"] ;
                                                                                                      else $pattern = "";

                                                                                                      $fname = ("/var/log/asterisk/cdr-csv/$_POST[number].csv");
                                                                                                      $fd = fopen ($fname, "r");
                                                                                                      if (!$fd) {
                                                                                                       echo "Error opening $fname";
echo "CDR records search results";
echo "<p></P>";
echo "<table border=1 BGCOLOR=F5F5F5 align=center>";
echo "<tr>";
echo "<td>Account</td>";
echo "<td>Src</td>";
echo "<td>Dst</td>";
echo "<td>Dst Context</td>";
echo "<td>Caller ID</td>";
echo "<td>Channel</td>";
echo "<td>Dst Channel</td>";
echo "<td>Last App</td>";
echo "<td>Last Data</td>";
echo "<td>Start</td>";
echo "<td>Answer</td>";
echo "<td>End</td>";
echo "<td>Duration</td>";
echo "<td>Bill Secs</td>";
echo "<td>Disposition</td>";
echo "<td>AMA flags</td>";
echo "<td>User Field</td>";
echo "</tr><tr></tr>";
$limit  = 0;
$d = 0;
while (!feof ($fd)) {
$buffer = fgets($fd, 4096);
$l = trim($buffer);
if ($pattern != "") {
if (!strstr($l,$pattern)) continue;
$badcommapat = '/\"[^\"]+,[^\",]+\"/';
if (preg_match($badcommapat,$l,$matches)) {
$fixcomma = str_replace(",","-",$matches[0]);
$l = str_replace($matches[0],$fixcomma,$l);
$e = explode(",",$l);
$len = sizeof($e);
echo "<tr>";
for ($c=0;$c<$len;++$c) {
echo "<td>";
$e[$c] = trim($e[$c],"\r\n \"");
if ($c == 4) $e[$c] = str_replace ("\"", "", $e[$c]);
if ($e[$c] == "") echo "&nbsp;";
else echo htmlspecialchars($e[$c]);
echo "</td>";
while ($c < 17) { echo "<td>&nbsp;</td>"; ++$c; }
echo "</tr>\n";
if ($limit != 0) {
if ($d >= $limit) break;
echo "</table>";
fclose ($fd);

Problem with parsing file with php is it’s not secure as the goal files must be linked to web and have poor rights
Best way is using real-time or create cronjob to parse files and put data in DB
Then just call your CDR with secure mysql query