Ticket #3955 (new Feature Requests)

Opened 3 months ago

Last modified 2 months ago

adding mp3 call recording format and link do download it from 'Reports' menu

Reported by: litnialex Assigned to:
Priority: minor Milestone: 2.7
Component: Reports Version: 2.6-branch
Keywords: mp3 format recordings search records Cc:
Confirmation: Unreviewed SVN Revision (if applicable):
Backend Engine: All Backend Engine Version:

Description

Hello, current implementation of viewing call records is terribly inefficient in a large PBX installation:

  1. ARI search engine lacks fieldset that is implemented in Recordings menu
  2. 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:

  1. Store recording filename in CDR database in userfield field
  2. Display link to recording files right in Reports menu
  3. 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.

Attachments

cdr.patch (1.7 kB) - added by litnialex on 11/22/09 02:00:16.
Patch to Reports menu
defnes.patch (0.7 kB) - added by litnialex on 11/22/09 02:02:50.

Change History

11/22/09 02:00:16 changed by litnialex

  • attachment cdr.patch added.

Patch to Reports menu

11/22/09 02:02:50 changed by litnialex

  • attachment defnes.patch added.

11/22/09 03:03:56 changed by mickecarlsson

  • type changed from Module Submissions to Feature Requests.

I will set this to a Feature request as that is what it is. I can see a couple of issues here, one is that FreePBX don't include apache specific settings, that is up to the distribution or the installer to do.

11/24/09 08:14:38 changed by litnialex

Yes, it will need corresponding update to the installation doc. But it's worth that IMHO :)

How about adding only support for mp3 format calls recording?

11/25/09 09:28:54 changed by mickecarlsson

I have talked with one of the developers about this and we both can see that a link to the recording in reports is quite useful. However, we think that it should be based on a setting in amportal.conf. For example, SHOWRECORDINGSINCDR = true (or false). If you can code that based on your previous work it will be included in FreePBX.

For the MP3 part, recording to MP3 is not supported natively in Asterisk, that is why it is not selectable as a recording format in General Settings.

(follow-up: ↓ 6 ) 11/25/09 10:02:54 changed by lazytt

To clarify: the we need two variables: one to set the column name where the filename will be saved (we cannot assume 'userfield'), and another to turn on the links in the cdr. We should NOT add another filed for the filename - just a link on one of the current fields.

Also, the filename as stored in the db needs to be a full path, in case of archiving, storing by date/ext, etc.

I would recommend that you have a look at the current cdr code, as there should be more code that isnt showing already in place

12/03/09 04:10:27 changed by litnialex

Hello lazytt!

Creating a new one database field will need more complicated changes to filename saving mechanism, but 'userfield' is currently not used at all.

Please suggest where we can store filename if not 'userfield'...

(in reply to: ↑ 4 ) 12/03/09 06:08:55 changed by lazytt

Replying to lazytt:

To clarify: the we need two variables: one to set the column name where the filename will be saved (we cannot assume 'userfield')

The variable will dictate the name of the field. The user will need to set this to whatever they want. Something like MONITORFILEFIELD= and the user can set it to whatever they want.