Tag Archives: CDR

Modify FreePBX call reports to show destination channel

FreePBX‘s Reports module does not show the destination channel–for example, the outbound trunk, or the device that received an incoming call–by default. But you can customize the call log display without editing the module itself. The Reports module looks for a file at /etc/asterisk/call-log-table.php, and if it finds the file, uses the declarations within to redefine the column layout. I took the default and modified it to include the Destination Channel column.

Just create a new file at /etc/asterisk/call-log-table.php with the following contents:

<?php   $FG_TABLE_COL[]=array ("Timestamp", "calldate", "12%", "center", "SORT", "19");
        $FG_TABLE_COL[]=array ("Src Chan", "channel", "14%", "center", "", "30", "",
"", "", "", "", "display_acronym");
        $FG_TABLE_COL[]=array ("Source", "src", "10%", "center", "", "30");
        $FG_TABLE_COL[]=array ("CLID", "clid", "25%", "center", "", "80",'','','','',
'','filter_html');
        $FG_TABLE_COL[]=array ("Dest", "dst", "10%", "center", "SORT", "30");
        $FG_TABLE_COL[]=array ("Dst Chan", "dstchannel", "14%", "center", "", "30",
"", "", "", "", "", "display_acronym");
        $FG_TABLE_COL[]=array ("Disposition", "disposition", "9%", "center", "", "30");
        if ((!isset($resulttype)) || ($resulttype=="min"))
$minute_function= "display_minute";
        $FG_TABLE_COL[]=array ("Duration", "duration", "6%", "center", "SORT", "30",
"", "", "", "", "", "$minute_function");

        $FG_TABLE_DEFAULT_ORDER = "calldate";
        $FG_TABLE_DEFAULT_SENS = "DESC";

        // This Variable stores the argument for the SQL query
        $FG_COL_QUERY='calldate, channel, src, clid, dst, dstchannel, disposition,
duration';
        $FG_COL_QUERY_GRAPH='calldate, duration';

        // The variable LIMITE_DISPLAY define the limit of record to display by page
        $FG_LIMITE_DISPLAY=25;

        // Number of column in the html table
        $FG_NB_TABLE_COL=count($FG_TABLE_COL);

        // The variable $FG_EDITION define if you want process to the edition of the
// database record
        $FG_EDITION=true;

        //This variable will store the total number of columns
        $FG_TOTAL_TABLE_COL = $FG_NB_TABLE_COL;
        if ((isset($FG_DELETION) && $FG_DELETION) || $FG_EDITION)
$FG_TOTAL_TABLE_COL++;

        //This variable define the Title of the HTML table
        $FG_HTML_TABLE_TITLE=" - Call Logs - ";

        //This variable define the width of the HTML table
        $FG_HTML_TABLE_WIDTH="100%";
?>