[asterisk-users] Asterisk 1.4 Call Recording

Mike Hammett asterisk-users at ics-il.net
Mon Jan 14 10:09:06 CST 2008


I am trying to record a call into a stereo mp3 in Asterisk 1.4, but I can't seem to get it to work correct.  Could someone point me to what I need to do?  I have attached what I believe are the relevant parts.

[globals]
; script to be executed when monitoring has been finished
MONITOR_EXEC=/usr/local/bin/2wav2mp3

; uncomment this line if you are using Ogg Vorbis
;MONITOR_EXEC=/usr/local/bin/2wav2ogg

[test]
exten => 555,1,SetVar(CALLFILENAME=outgoing/${TIMESTAMP:0:4}/${TIMESTAMP:4:2}/${TIMESTAMP}-${EXTEN})
exten => 555,2,Monitor(wav,${CALLFILENAME},m)
exten => 555,3,Dial(IAX2/ics.iax-trunk/${EXTEN})
exten => 555,4,Hangup()

exten => 815787XXXX,1,Set(CALLFILENAME=outgoing/1815739XXXX)
exten => 815787XXXX,2,Monitor(wav,${CALLFILENAME},m)
exten => 815787XXXX,3,Dial(IAX2/ics.iax-trunk/1815739XXXX)
exten => 815787XXXX,4,Hangup()


[root at Aiur asterisk]# cat /usr/local/bin/2wav2mp3
#!/bin/sh
# 2wav2mp3 - create stereo mp3 out of two mono wav-files
# source files will be deleted
#
# 2005 05 23 dietmar zlabinger http://www.zlabinger.at/asterisk
# 2006 03 24 modified for sox 12.17.9 as of Suse9.2 by Matthias
#
# usage: 2wav2mp3 <wave1> <wave2> <mp3>
# designed for Asterisk Monitor(file,format,option) where option is "e" and
# the variable
# MONITOR_EXEC/usr/local/bin/2wav2mp3


# location of SOX and SOXMIX
# (set according to your system settings, eg. /usr/bin)
SOX=/usr/bin/sox
SOXMIX=/usr/bin/soxmix
# lame is only required when sox does not support liblame
LAME=/usr/local/bin/lame


# command line variables
LEFT="$1"
RIGHT="$2"
OUT="$3"

LTMP="asename $1 .wavmp.wav"
RTMP="asename $2 .wavmp.wav"



#test if input files exist
test ! -r $LEFT && exit
test ! -r $RIGHT && exit

# convert mono to stereo, adjust balance to -1/1
# left channel
$SOX $LEFT -t wav -c 2 $LTMP pan -1
# right channel
$SOX $RIGHT -t wav -c 2 $RTMP pan 1

# combine and compress
# this requires sox to be built with mp3-support.
# To see if there is support for Mp3 run sox -h and
# look for it under the list of supported file formats as "mp3".
#$SOXMIX -v 1 $LTMP -v 1 $RTMP -t mp3 -v 1 $OUT.mp3

# in case an old version of sox is used, encoding
# can be done afterwards
$SOXMIX -v 1 $LTMP -v 1 $RTMP -v 1 $OUT
$LAME -S -V7 -B24 --tt $OUT --add-id3v2 $OUT $OUT.mp3


#remove temporary files
test -w $LTMP && rm $LTMP
test -w $RTMP && rm $RTMP
test -w $OUT && rm $OUT

#remove input files if successfull
test -r $OUT.mp3 && rm $LEFT $RIGHT
# eof





-----
Mike Hammett
Intelligent Computing Solutions
http://www.ics-il.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20080114/0574f7c8/attachment.htm 


More information about the asterisk-users mailing list