From: Steve Edwards <[EMAIL PROTECTED]>
Date: Tue, 1 May 2007 22:08:10 -0700 (PDT)

On Tue, 1 May 2007, Yuan LIU wrote:

From: Steve Edwards <[EMAIL PROTECTED]>
Date: Tue, 1 May 2007 21:10:40 -0700 (PDT)

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.

In 1.4, there's also a dial plan function RAND().

Doesn't RAND return a random number?

How will that help to play back a random file in a directory?

Well, any randomness algorithm starts with a random number. In Asterisk extension language, though, translating number to a file name takes a bit lifting - meaning lifting by you, not by a system command or by a well published procedure. One way to do this is in dial plan is to use a static AstDB table. (AEL may have better ways but I don't know.)

Yuan Liu

Thanks in advance,
------------------------------------------------------------------------
Steve Edwards      [EMAIL PROTECTED]      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

Reply via email to