We put together this solution a while ago (thanks Brother Miles!), but never documented it, thought it would a good idea to put it here for anyone else who might need this (and anyone who uses Elastix for high call volume, probably does.
The challenge.
Elastix/Freepbx has good call recording abilities, but very strangely just dumps everything into a single directory. This can get REALLY bad if you have tens of thousands of calls per day, I have run accross a few scripts to convert and mode call recordings after they are saved, but that is a waste of resources, and makes it hard to integrate call recording UI's.
So we figured out the 2 places that need to be changed so that all recorded calls are saved in a Year/Month/day file structure.
Just 2 files
- For regular calls, we need to alter the included and symlinked extensions.conf, this is found at
- /etc/asterisk/extensions.conf
- we just need to add the macro-dialout-trunk-predial-hook, which already exists as a section, but is empty. Add the following lines there...
exten => s,1(record),MixMonitor(${MIXMON_DIR}${STRFTIME(${EPOCH},GMT+2,%G)}"/"${STRFTIME(${EPOCH},GMT+2,%m)}"/"${STRFTIME(${EPOCH},GMT+2,%d)}"/"${UNIQUEID}."wav",,${MIXMON_POST})
exten => s,n,Macro(record-enable,${EXTTOCALL},OUT)
- For Queue calls, we need to change the queue generation code found here:
We need to change a single line here, find the line that includes the following:
And replace it with...
$ext->add('ext-queues', $exten, '', new ext_setvar('MONITOR_FILENAME','/var/spool/asterisk/monitor/q${EXTEN}-${STRFTIME(${EPO$ ....
//CUSTOMIZATION FOR RECORDING TO SUBDIRECTORIES
$ext->add('ext-queues', $exten, '', new ext_setvar('MONITOR_FILENAME','/var/spool/asterisk/monitor/${STRFTIME(${EPOCH},GMT+2,%G)}/${STRFTIME(${EPOCH},GMT+2,%m)}/${STRFTIME(${EPOCH},GMT+2,%d)}/${UNIQUEID}'));
That does it! you are ready to roll. You need to "apply changed" in the WebUI in order to generate new configuration.....
Hello,
ReplyDeleteThis was very useful for me. I need help with something else, though. I would like to add a new line of code just below the one that sets the MONITOR_FILENAME variable. Where in the ELASTIX templates do I make the change to be able to insert this new line of code in the CONF file?
Should be this file....
ReplyDelete/var/www/html/admin/modules/queues/functions.inc.php
What are you trying to add?
awesome tip thanks - I did this on elastix 2.3 which worked a treat - now I have tried the same on a new 2.4 box and it is doing strange things. internal calls (ext -> ext) aren't getting recorded at all and the external calls are getting recorded both in the recording root and the date folders.
ReplyDeleteI have made the changes in extensions_custom.conf - not sure if this is the problem, but I did the same on the other box..
thanks