[asterisk-users] using Playback() to play a random sound file
dave cantera
david.cantera at iacnet.net
Wed May 2 16:09:21 MST 2007
here is a way that I solved a similar problem... have a shell script
that runs and indexes all the files in the directory into an ascii flat
file with a format of
#### filename
0001 directory/tt-weasels
0002 directory/tt-monkeys
in your dialplan use the rand() to pick a number, pass it to the shell
script as an arg[], then the shells script grep()'s and cut()'s the
filename puts it in a db varaible, the dialplan picks it up and plays
it... as you can see, I haven't done it yet :) but, in theory it
works... you could skip the dialplan rand() and just use linux rand
based on the minutes or seconds value for current time...
you don't have to zero fill the index either, I seem to like nicely
formated files, they are easier for humans to read.
daveC
Steve Edwards wrote:
> On Tue, 1 May 2007, Jay Austad wrote:
>
>> I've got a directory under /var/lib/asterisk/sounds which contains a
>> bunch of sound files. I would like to call the Playback command to
>> play the files, but I need it to select a file to play randomly. Is
>> there any way to do this?
>
> I do this with an AGI.
>
> Thanks in advance,
> ------------------------------------------------------------------------
> Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST
> Newline Fax: +1-760-731-3000
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
>
>
>
--
Building Strong Relationships w/ Intelligent Customer Service
--
Interlocking Business Solutions, LLC
856-380-0894 x5000
More information about the asterisk-users
mailing list