In array like support

I have a list of files that I play in a loop. For instance I have files name 1-100 and I start by playing 100,99,98 etc. There are some files that maybe sensitive and we don’t want the caller to hear them. I know I can create a variable with comma delimited values of the files not to play. Is there any function that would act like an ‘in array’ so if the file I am about to play is in this list I would skip it?

in_array appears to be specific to PHP (I had to look it up).

You can achieve indexing in Asterisk by using a variable as part of another variable name, or using the secondary key in AstDB. You can also do a substring search of a delimited string (if you include the delimiter in the pattern). However, the last method is subject to any overall limits on string lengths.

AstDB wont work for me as I am using a cluster of Asterisk boxes. I guess in theory I can use REGEXP.

If you’re running a cluster of boxes how would this said list exist on each box to begin with?

Create a TXT file with the list of file name, use Asterisk shell function and Linux grep variant for saving the search result as channel variable, then apply a goto or execif

Write an AGI in a language you are comfortable. Store the file names in a MySQL table.

Really does sound like a job for AGI. Perhaps play the files with stream file?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.