Hello,
current implementation of viewing call records is terribly inefficient in a large PBX installation:
- ARI search engine lacks fieldset that is implemented in Recordings menu
- It tries to get listing of directory, containing recording files, and then match them with uniqueid or even calldate. This approach will heavily load system, when there are quite many recording files ( 1 mln and above)
So, had to find a solution. It was:
- Store recording filename in CDR database in userfield field
- Display link to recording files right in Reports menu
- Make call recordings to be stored in MP3 format (strange that this feature is still missing, it's so convenient!)
Yesterday I ported all my changes to the latest 2.6 release of FreePBX and I hope you will add it in the FreePBX ( may be after some rework :)
So:
cd /var/www/freepbx/admin
patch -p1 < cdr.patch
set "userfield=1" in /etc/asterisk/cdr_mysql.conf
FreePBX -> General Settings: (it must me explicitly set to something, even default value)
- Recording Location: /var/spool/asterisk/monitor/
- Run after record: /etc/asterisk/scripts/wav2mp3.sh
cat /etc/asterisk/extensions_override_freepbx.conf
[macro-record-enable]
exten => s,1+998(record),MixMonitor(${MIXMON_DIR}${CALLFILENAME}.${MIXMON_FORMAT},,${MIXMON_POST} ${MIXMON_DIR}${CALLFILENAME}.${MIXMON_FORMAT})
[macro-hangupcall]
exten => s,9(theend),ExecIf(${STAT(e,${MIXMON_DIR}${CALLFILENAME}.${MIXMON_FORMAT})}|Set|CDR(userfield)=${CALLFILENAME})
exten => s,n,Hangup()
cat /etc/asterisk/scripts/wav2mp3.sh
#!/bin/sh
OUT=`echo $1| sed s/.wav/.mp3/`
nice -n 10 /usr/bin/sox $1 ${OUT} rate 12k
test -r $OUT && rm $1
chmod +x /etc/asterisk/scripts/wav2mp3.sh
Example Apache section:
Alias /recordings/ "/var/spool/asterisk/monitor/"
<Directory "/var/spool/asterisk/monitor/">
Order allow,deny
Allow from all
AuthType basic
AuthName "Protected CDR Report"
AuthUserFile /etc/apache2/passwd
require valid-user
</Directory>
htpasswd /etc/apache2/passwd callsmanager
Setting a separate password for callsmanager allows to have more restricted access to recording files.