That's exactly what I did.

It's just a humble little shell script, not much brains to it:

#!/bin/bash
#just handling all the stuff that Asterisk sends but not really doing
anything with it
while read -e ARG && [ "$ARG" ] ; do
        array=(` echo $ARG | sed -e 's/://'`)
        export ${array[0]}=${array[1]}
done
#here's the meat of the script
filecount=0
for i in `ls -1t /home/asterisk/ira/incidents/$1*.wav`
        do
                echo "EXEC PLAYBACK ${i}" | sed s:\.wav:\ \'\':
                echo "EXEC WAIT 1"
         ((filecount++))
done
echo "DATABASE PUT IRA $1/RECORDCOUNT $filecount"

So AGI seems to do the job for me. Not sure if this is optomized for speed
or whatever, but it's good enough for now.

Thanks,

Jim
 

> -----Original Message-----
> From: Simon P. Ditner [mailto:[EMAIL PROTECTED] 
> Sent: December 20, 2007 10:50 AM
> To: [email protected]
> Subject: Re: [on-asterisk] Playing back files from a folder 
> based on a filespec
> 
> If you're calling System(), you might as well call AGI(), and 
> write a small wrapper script that then calls the final 
> command, and then handles the input/output in a more 
> intelligent manner.
> 
> On Thu, 20 Dec 2007, Leif Madsen wrote:
> 
> > On Dec 15, 2007 4:01 PM, Jim Van Meggelen 
> <[EMAIL PROTECTED]> wrote:
> > > I would have thought that System() just passed whatever it got to 
> > > the shell, so I would have figured that as long as the 
> shell can handle it, no problem.
> > >
> > > The big limitation with System() is that it does not feed 
> stdout and 
> > > stderr back to asterisk.
> > >
> > > Hmm . . . that gives me an idea . . .
> >
> > That's right -- you need to use the SHELL() function to do 
> that. It's 
> > only available in trunk, but I just copied the func_shell.c 
> file into 
> > my funcs/ directory, did a ./configure && make install, and it 
> > compiled and was available for my use.
> >
> > --
> > Leif Madsen.
> > http://www.leifmadsen.com
> > http://www.oreilly.com/catalog/asterisk
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED] For additional 
> > commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED] For 
> additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to