I am having a weird issue with setting the recording file for the Page app. Here is some quick background info

I have a macro that pages all my phones:

[macro-pageall]
; Context for paging all devices.
;       This will search the sip table in the realtime database
;       for all phones that start with a number.  That number is
;       passed to this macro as ${ARG1}.
;
; ARG1 = The first digit of the phones to be paged (6=US Campus, 4=MS, 2=LS)
;       ARG2 = Device for the PA system.  If the user selected to
;               page the PA system.  That will be included.
;
exten => s,1,MYSQL(Connect connid ${realdb_host} ${realdb_user} $ {realdb_pass} ${realdb_db}) exten => s,2,MYSQL(Query resultid ${connid} SELECT\ name\ FROM\ sip\ WHERE\ name\ LIKE\ "'${ARG1}%'")
exten => s,3,MYSQL(Fetch fetchid ${resultid} number)
exten => s,4,GoToIf($["${fetchid}" = "1"]?5:7)
exten => s,5,Set(pagedevice=${pagedevice}&SIP/${number})
exten => s,6,GoToIf($["${fetchid}" = "1"]?3:7)
exten => s,7,Set(pagedevice=${pagedevice:1})
exten => s,8,MYSQL(Clear ${resultid})
exten => s,9,MYSQL(Disconnect ${connid})
exten => s,10,GoToIf($["${ARG2}" != ""]?11:12)
exten => s,11,Set(pagedevice=${pagedevice}&${ARG2})
;Add Call Info for GrandStream Phone on the PA system
exten => s,12,SIPAddHeader(Call-Info:answer-after=0)
;Add Alert-Info for all Polycom Phones
exten => s,13,SIPAddHeader(Alert-Info: Ring Answer)
exten => s,14,Set(MEETME_RECORDINGFILE=custom/paging/campuslastpage_$ {RAND(1|100)})
exten => s,15,NoOp(${MEETME_RECORDINGFILE})
exten => s,16,Set(CALLERID(all)=System Page <1010>)
exten => s,17,Page(${pagedevice},r)
exten => h,1,System(/var/lib/asterisk/scripts/mail_lastpage ${ARG1} $ {MEETME_RECORDINGFILE})
exten => h,2,Hangup()

I call the macro with:
;Page All Phones including the PA system.
exten => 1010,1,Authenticate(12345)
exten => 1010,2,Macro(pageall,2,SIP/ls-pa)

Basically the macro goes through my sip realtime database and finds all the phones that begin with the number 2 (my lower school campus). The generates a variable named pagedevice that looks like this:
SIP/2101&SIP/2102&SIP/2103

This part works great.

The issue I am having is setting the MEETME_RECORDINGFILE. It should be set to an audio file in the custom sounds directory with a random number at the end. I then use a hangup (h) extension to execute a script (at bottom of email) to email the audio file to a conference area in our email system (FirstClass).

What is weird is after I restart the asterisk process, this works fine for about a week. It does exactly as it is supposed to, creates the audio file with a random number, then the email script delivers it. After a week or so Asterisk will stop setting the variable MEETME_RECORDINGFILE and start placing the recordings in the sounds directory named meetme-conf-rec.######.wav. Which is the default is MEETME_RECORDINGFILE is not set.

Anyone seen this issue before?

Thanks!


Forrest Beck
[EMAIL PROTECTED]
www.shift8.biz


#!/bin/bash
#Set some variables
USFACULTY="[EMAIL PROTECTED]"
LSFACULTY="[EMAIL PROTECTED]"
USFACULTY="[EMAIL PROTECTED]"
MONTH=`date +%B`
DAY=`date +%d`
YEAR=`date +%Y`
HOUR=`date +%I`
MINUTE=`date +%M`
ZONE=`date +%Z`
AMPM=`date +%P`
PGSOUNDDIR="/var/lib/asterisk/sounds/"
LOGFILE="/var/log/mail_lastpage.log"

#Write Log
echo "`date` Running script for campus $1 with file $2" >> $LOGFILE

#Let give asterisk time to finish creating the recordng file. Just in Case.
sleep 10

#
#Create a temp file with our message body
#
echo "Repeat Last Page" > /tmp/repeatpage_$1
echo "" >> /tmp/repeatpage_$1
echo "The attached WAV file is a copy of the last broadcast over the phone system." >> /tmp/repeatpage_$1
echo "" >> /tmp/repeatpage_$1
echo "The page was broadcasted $MONTH $DAY, $YEAR at $HOUR:$MINUTE $AMPM. You may play this file back if you missed the page." >> /tmp/ repeatpage_$1
echo "" >> /tmp/repeatpage_$1
echo "" >> /tmp/repeatpage_$1
echo "If you wish to mark this email as "read" (Remove Red Flag) without opening the email, you may right-click (or control-click for Mac) and left-click "Mark
as Read" before opening the email." >> /tmp/repeatpage_$1
#
#Send the email with the recorded Page attached
#

# Was it Upper School?
if [ "$1" -eq "6" ]
        then
cat /tmp/repeatpage_$1 | mutt -a $PGSOUNDDIR$2.wav - s "Recording of Last Page for Upper School" $USFACULTY
fi

# Was it Middle School?
if [ "$1" -eq "4" ]
        then
cat /tmp/repeatpage_$1 | mutt -a $PGSOUNDDIR$2.wav - s "Recording of Last Page for Middle School" $MSFACULTY
fi

# How about Lower?
if [ "$1" -eq "2" ]
        then
cat /tmp/repeatpage_$1 | mutt -a $PGSOUNDDIR$2.wav - s "Recording of Last Page for Lower School" $LSFACULTY
fi

rm -rf /tmp/repeatpage_$1
rm -f $PGSOUNDDIR$2.wav
exit

_______________________________________________

Sign up now for AstriCon 2007!  September 25-28th.  http://www.astricon.net/ 

--Bandwidth and Colocation Provided by http://www.api-digital.com--

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to