Update Recording info/links in CDR?

Well, thanks to the developers’ changes in 2.10 and help from Tony, I have finally been able to get my recordings sorted and stored by year, month, and day. This has been a longtime desire of mine, and the speed of recording retrievals has increased my multiple orders of magnitude. Thank you!!!

It figures that the one release of FreePBX I didn’t adopt early is the one that fixes a major problem of mine…

Anyhow, this brings me to another nice new feature, and a new question. Specifically, for call recordings made since the upgrade to 2.10, the CDR report contains a nice link directly to the recording (another long time request of mine). It is excellent, and looks like this (note the speaker icons in the ‘Recording’ column):

Another nice touch is that, the developers also included filename information in the CDR report for recordings made prior to the 2.10 upgrade. It looks like this (note the text in the “Userfield” column):

Digging into the CDR table in MySQL, it appears that the pre-2.10 recording information is stored in the ‘userfield’ column, and the post 2.10 recording information is stored in the ‘recordingfile’ column.

Since I have moved all of my old recordings into the same directory structure as the new recordings, my guess is that the recording links would show up and work for the old recordings if I were to populate the ‘recordingfile’ column with the filename (based on the ‘userfield’ data).

Before I start building something on my own, can anyone confirm that my assumptions are correct?

Has anyone built a tool to do this, or perhaps there is a built-in method?

Tom

I fiddled with MySQL a bit and found that simply adding a filename to the row for that call did not result in a link to the recording appearing.

specifically, I executed this UPDATE query:

And viewed that call in the CDR report, and no link was present.

Can anyone explain what I need to update to have the older calls function like the newer calls?

Tom

EDIT: Just to confirm, the file is in the right place:

[root@vox ~]# ls /var/spool/asterisk/monitor/2012/11/28/q400-20121128-080958-1354108198.262084.WAV /var/spool/asterisk/monitor/2012/11/28/q400-20121128-080958-1354108198.262084.WAV

Given the significant changes to the 2.10 recording structure, I would have thought that this would be a reasonably common question.

Does nobody have an answer?

Tom

You can not update the older information. Because it is missing things we have no way of getting that we only know about at the time of the call. Sorry

Tony,

Can you provide details about what the CDR report uses to determine if it should include a recording link?

I understand that the automated update scripts cannot do what I am suggesting, but I am looking to do this on my own, in the background, in MySQL (or wherever).

Thank you,

Tom

It looks like this little snippet in /var/www/html/admin/modules/cdr/functions.inc.php is responsible for creating the link, but I am still scratching my head about why it does not create a link for a CDR record that I update to include the recordingfile information.

[code]function cdr_formatRecordingFile($recordingfile, $basename, $id) {

    global $REC_CRYPT_PASSWORD;

    if ($recordingfile) {
            $crypt = new Crypt();
            // Encrypt the complete file
            $audio = urlencode($crypt->encrypt($recordingfile, $REC_CRYPT_PASSWORD));
            $recurl=$_SERVER['PHP_SELF']."?display=cdr&action=cdr_play&recordingpath=$audio";
            $playbackRow = $id +1;
            //
            echo "<td title=\"$basename\"><a href=\"#\" onClick=\"javascript:cdr_play($playbackRow,'$recurl'); return false;\"><

img src=“assets/cdr/images/cdr_sound.png” alt=“Call recording” />";
} else {
echo “

”;
}
}[/code]

/var/www/html/admin/modules/cdr/page.cdr.php includes this little bit, which seems to me to indicate that, if the cdr table is properly updated and the file actually exists, it should create a link.

Perhaps a permissions inssue, then?

Tom

/* If CDR claims there is a call recording we make sure there is and the file is there, or we set it blank. In some cases * a recording may have been planned but not done so this assures there are no dead links. */ if ($row['recordingfile']) { $rec_parts = explode('-',$row['recordingfile']); $fyear = substr($rec_parts[3],0,4); $fmonth = substr($rec_parts[3],4,2); $fday = substr($rec_parts[3],6,2); $monitor_base = $amp_conf['MIXMON_DIR'] ? $amp_conf['MIXMON_DIR'] : $amp_conf['ASTSPOOLDIR'] . '/monitor'; $recordingfile = "$monitor_base/$fyear/$fmonth/$fday/" . $row['recordingfile']; if (!file_exists($recordingfile)) { $recordingfile = ''; } } else { $recordingfile = ''; }