I’m currently making successful MixMonitor() recordings using Asterisk 1.6.2 and am wondering how I would go about listening to the recordings by dialling into asterisk?
I thought about using Playback() but the file name is dynamically created so how would I reference the file(s)? I also wondered if there is a way to send the recordings into the voicemail system so they can be listened to via VoiceMailMain()?
Any advice on either method would be greatly appreciated.
Thank you
Robert
I found the following relevant discussion but the example doesn’t seem to work:
viewtopic.php?p=67614
Anyone have any ideas?
This shell script will create a voicemail in the correct format
you will need to run it after you have finished recording the call.
[code]#!/bin/sh
PATH=/var/spool/asterisk/voicemail/default/
callerchan=$1
callerid=$2
origdate=$3
origtime=$4
origmailbox=$5
origdir=$6
duration=$7
FILENUM=$(/bin/ls ${PATH}${origmailbox}/INBOX |/bin/grep txt | /usr/bin/wc -l)
##if (( $FILENUM <= 9 ));
##then
##FILENAME=msg000${FILENUM}
##else
##FILENAME=msg00${FILENUM}
##fi
##Added to allow 999 messages
if (( $FILENUM <= 9 ));
then
FILENAME=msg000${FILENUM}
elif (( $FILENUM <= 99 ));
then
FILENAME=msg00${FILENUM}
else
FILENAME=msg0${FILENUM}
fi
/bin/echo “[message]” >> ${PATH}${origmailbox}/INBOX/${FILENAME}.txt
/bin/echo origmailbox=${origmailbox} >> ${PATH}${origmailbox}/INBOX/${FILENAME}.txt
/bin/echo “context=demo” >> ${PATH}${origmailbox}/INBOX/${FILENAME}.txt
/bin/echo “macrocontext=” >> ${PATH}${origmailbox}/INBOX/${FILENAME}.txt
/bin/echo “exten=s” >> ${PATH}${origmailbox}/INBOX/${FILENAME}.txt
/bin/echo “priority=11” >> ${PATH}${origmailbox}/INBOX/${FILENAME}.txt
/bin/echo callerchan=${callerchan} >> ${PATH}${origmailbox}/INBOX/${FILENAME}.txt
/bin/echo callerid=${callerid} >> ${PATH}${origmailbox}/INBOX/${FILENAME}.txt
/bin/echo origdate=${origdate} >> ${PATH}${origmailbox}/INBOX/${FILENAME}.txt
/bin/echo origtime=${origtime} >> ${PATH}${origmailbox}/INBOX/${FILENAME}.txt
/bin/echo “category=” >> ${PATH}${origmailbox}/INBOX/${FILENAME}.txt
/bin/echo “duration=${duration}” >> ${PATH}${origmailbox}/INBOX/${FILENAME}.txt
/bin/cp /var/lib/asterisk/sounds/whatever/${origdir}.wav ${PATH}${origmailbox}/INBOX/${FILENAME}.wav
/bin/mv /var/lib/asterisk/sounds/whatever/${origdir}.wav /tmp/${origdir}.wav
[/code]
Ian… you’re a star! Thanks for posting this.
I’m currently working through populating the variables needed in the script via arguments posted after the MixMonitor command completes.
I’ve got stuck on where to find or generate the ‘duration’ and ‘origdate’ string variables ($7 and $3). Duration seems to be in seconds and date string format as so: ‘Tue May 24 05:48:08 PM UTC 2011’
Any ideas?
Any ideas?
of course 
exten => s,n,Set(origdate=${STRFTIME(${EPOCH},,%a %b %d %r %Z %G)})
exten => s,n,Set(origtime=${EPOCH})
exten => s,n,Set(callerchan=${CHANNEL})
exten => s,n,Set(callerid=${CALLERID(num)})
exten => s,n,Set(start=${EPOCH})
exten => s,n,Hangup()
exten => h,1,Set(end=${EPOCH})
exten => h,n,Set(duration=${MATH(${end}-${start},int)})
exten => h,n,System(/usr/local/sbin/makevmal.sh ${callerchan} ${callerid} "${origdate}" ${origtime} ${origmailbox} ${UNIQUEID} ${duration})
Ian
www.cyber-cottage.co.uk
Thanks again Ian!
Variables are now populating nicely 
2 things that I’m currently trying to work out:
-
How does one access the DIAL application variables? (was thinking of using ${DIALEDTIME} ) but couldn’t work where/how to get to it’s data?
-
I have a desktop sip phone that lights up a voicemail message icon when a voicemail is left by the conventional asterisk voicemail system. Is there a way to trigger that process with the shell script?