[asterisk-users] SayNumber while reading DTMF?

Alexander Lopez Alex.Lopez at OpSys.com
Tue Jun 10 14:34:30 CDT 2008


Run a script before the user gets to Background that cat the gsm files
together and then play that file.

IE

#!/bin/bash
BALANCE=$1
ACCOUNT=$2
SOUNDSDIR="/var/lib/asterisk/sounds"
ACCOUNTFILE="$SOUNDSDIR/accounts/$ACCOUNT.gsm"
#
#Some creative scripting will need to be done to be able to properly say
the #numbers. Ie One-Hundred Eighteen Dollars and Forty-Two Cents. This
script #will play One-One-Eight Dollars and Four-Two cents.
#
#       Get the Dollars and Cents...
#
DOLLARS=`echo $BALANCE | cut -f1 -d.`
CENTS=`echo $BALANCE | cut -f2 -d.`
#
#
ELEMENTS=`echo $DOLLARS | wc -m`
for (( i=0;i<$ELEMENTS;i++)); do
    cat $SOUNDSDIR/digits/${DOLLARS:$i:1}.gsm >> $ACCOUNTFILE
done

cat $$SOUNDSDIR/dollars.gsm >> $ACCOUNTFILE
cat $$SOUNDSDIR/and.gsm >> $ACCOUNTFILE

ELEMENTS=`echo $CENTS | wc -m`
for (( i=0;i<$ELEMENTS;i++)); do
    cat $SOUNDSDIR/digits/${CENTS:$i:1}.gsm >> $ACCOUNTFILE
done

cat $$SOUNDSDIR/cents.gsm >> $ACCOUNTFILE

----------------------

Then just call the script before the Background with the argumants need
and then play back the generated file...

Alex



> -----Original Message-----
> From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-
> bounces at lists.digium.com] On Behalf Of Russell Bryant
> Sent: Tuesday, June 10, 2008 1:29 PM
> To: Asterisk Users Mailing List - Non-Commercial Discussion
> Subject: Re: [asterisk-users] SayNumber while reading DTMF?
> 
> Douglas Garstang wrote:
> > I'm using the SayNumber() app to read out a users balance for an
IVR.
> > Is there a way I can do that while waiting for DTMF input?
> >
> > Obviously, read() and Background() don't correctly say a number in
> number format.
> 
> I do not know of a way to do that.  It would be an extremely useful
new
> feature to have, but as fair as I know, is not currently available.
> 
> --
> Russell Bryant
> Senior Software Engineer
> Open Source Team Lead
> Digium, Inc.
> 
> _______________________________________________
> -- 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



More information about the asterisk-users mailing list