I am trying to give my recordings in /var/spool/asterisk/monitor a “from” and “to” identifier.
I have a script running called /var/lib/asterisk/bin/sortcalls.sh It is this:
#!/bin/sh
//
DATE=date -r $2$1 +'%Y/%m-%b/%d-%a'
//
mkdir -p $2$DATE
//
UNIQUEID=echo $1 |sed "s/.*\-\([.0-9]*\)\.[a-zA-Z]*$/\1/"
//
FILETYPE=echo $1 |sed "s/.*\-[.0-9]*\(\.[a-zA-Z]*$\)/\1/"
//
NEWFILE=/usr/bin/mysql -u root -peLaStIx.2oo7 -N -B -D asteriskcdrdb -e "SELECT calldate,'From:',clid,'To:',dst,'' FROM cdr WHERE uniqueid = $UNIQUEID LIMIT 1"|sed -e 's/\s/_/g' -e "s/_$/$FILETYPE/" -e "s/["<>]//g"
//
if [ ! -f $2$DATE/$NEWFILE ] ;then ln $2$1 $2$DATE/$NEWFILE ;fi
#There appears to be something missing from this last line, as it stops after “fi”. The script is not mine.
Then I have in my General Settings Recording Location: /var/spool/asterisk/monitor/
And in the Run after record:
/var/lib/asterisk/bin/sortcalls.sh ^${MIXMON_DIR}/^{CALLFILENAME}.^{MIXMON_FORMAT} ^{MIXMON_DIR}//usr/bin/mysql -u root -peLaStIx.2oo7 -N -B -D asteriskcdrdb -e "SELECT calldate,'From:',src,'To:',dst,'' FROM cdr WHERE uniqueid = ^{UNIQUEID}"|sed -s s'/\s/_/ g'
.^{MIX
#The problem is that the box chops off the last part of the Run after record command. It is supposed to end with .^{MIXMON_FORMAT}, but it is chopping off the last part after “MIX”.
If someone knows of a easier way to do this I would appreciate the help. Need to name the recordings with something a user can understand, and then upload them to an FTP site.
Something like this posts to /var/spool/asterisk/monitor:
drwx------ 2 asterisk asterisk 4096 Apr 1 13:39 2011-04-01_13:38:46_From:callingnumber_To:outnumber.
drwx------ 2 asterisk asterisk 4096 Apr 1 13:39 2011-04-01_13:39:05_From:To:.
drwx------ 2 asterisk asterisk 4096 Apr 1 13:40 2011-04-01_13:40:19_From:To:.
drwx------ 2 asterisk asterisk 4096 Apr 1 13:40 2011-04-01_13:40:35_From:To:_.
-rw------- 1 asterisk asterisk 220204 Apr 1 13:39 OUT1000-20110401-133846-1301690326.32.wav
-rw------- 1 asterisk asterisk 144044 Apr 1 13:39 OUT1000-20110401-133905-1301690345.34.wav
-rw------- 1 asterisk asterisk 166124 Apr 1 13:40 OUT1000-20110401-134020-1301690419.36.wav
-rw------- 1 asterisk asterisk 165484 Apr 1 13:40 OUT1000-20110401-134035-1301690435.38.wav
It creates a folder with the “From” and “To” that has nothing it it, and the call record with the unique ID. I am assuming it is doing this because the Run after record command is incomplete.
Thanks.