AstRecipes » Compressing recorded calls to MP3
If you record a big chunk of traffic (or even all traffic, as some call-centers do) on your Asterisk box, you will see that it ends up taking a substantial amount of disk space. The problem is the following:The ideal would be saving those files in some very-compressed MP3 format, but this is not a very good idea as the hit on the CPU is quite dramatic.
Still, most systems do not operate on a 24/7 basis; if your call center gets a lot of traffic during office hours, it's just as well likely that it will be sitting idle all night. Therefore, it would be nice if we could:
+--------------+----------------+
| wav file | 1310764 bytes |
| gsm file | 135168 bytes |
| mp3 file 16k | 164520 bytes |
| mp3 file 12k | 120528 bytes |
| mp3 file 8k | 83808 bytes |
+--------------+----------------+
To encode wav files into mp3, we create a make file. Make is the right tool for the job, as it is built to transform one file into a different file, by name. So we edit a file called Makefile (yes, with the capital M) into our main storage directory, usually /var/spool/asterisk/monitor:
DIRWAV = $(shell dir *.wav)
ALLWAV = $(DIRWAV:.wav=.mp3)
DIRGSM = $(shell dir *.gsm)
ALLGSM = $(DIRGSM:.gsm=.mp3)
mp3: $(ALLWAV) $(ALLGSM)
%.mp3: %.wav
nice lame --quiet --preset phone $? $@
rm -f $?
%.wav: %.gsm
nice sox $? -r 8000 -c 1 -w -s $@
rm -f $?
clean:
rm -f *.mp3
rm -f *.wav
rm -f *.raw
rm -f *.gsm
cp /var/lib/asterisk/mohmp3/*.wav .
cp /var/lib/asterisk/sounds/a*.gsm .
cd /var/spool/asterisk/monitor; make mp3
In order to fine-tune the mp3 encoding to your preferred size, you can change the parameter after --preset to:
Softlinks:
Home Page - QueueMetrics - Installing QueueMetrics from scratch - Installing QueueMetrics - Compiling Asterisk 1.4 with TDM400 and H323 - AddQueueMember and the queue_log file - Upgrading QueueMetrics licences - QueueMetrics logs - Installing Queuemetrics on Debian - Avoiding queue_log file rotation - Using a HT-488 with Asterisk - Manually updating QueueMetrics - Listening to recorded calls using XC-AST - Installing QueueMetrics on Fonality PBXtra - Managing agents that dynamically log-on - Installing Queuemetrics on PBX-in-a-Flash - Installing QueueMetrics using Yum - Administering QueueMetrics using Tomcat - Rebuilding Fonality queue_log - Debugging Qloaderd installation
Home Page - QueueMetrics - Installing QueueMetrics from scratch - Installing QueueMetrics - Compiling Asterisk 1.4 with TDM400 and H323 - AddQueueMember and the queue_log file - Upgrading QueueMetrics licences - QueueMetrics logs - Installing Queuemetrics on Debian - Avoiding queue_log file rotation - Using a HT-488 with Asterisk - Manually updating QueueMetrics - Listening to recorded calls using XC-AST - Installing QueueMetrics on Fonality PBXtra - Managing agents that dynamically log-on - Installing Queuemetrics on PBX-in-a-Flash - Installing QueueMetrics using Yum - Administering QueueMetrics using Tomcat - Rebuilding Fonality queue_log - Debugging Qloaderd installation



