I
I
Igor2017-12-21 16:55:02
Asterisk
Igor, 2017-12-21 16:55:02

Asterisk Playback?

Hello. How to set up in Asterisk, so that, say, 20 different audio files are played for 20 simultaneous calls?
I will say right away the RAND function is not suitable, it repeats audio recordings. I want them not to repeat.
Thanks in advance .

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Soslan Aldatov, 2017-12-21
@Igor2208

This can be done using the standard means of a dilplan:
there are 20 files - 1.wav, 2.wav, 3.wav, ... , 19.wav, 20.wav. And something like this dilplan:

TOTALSOUNDS = 20
CURRENTSOUND = 1

[context]
exten => _X.,1,GotoIf($[${CURRENTSOUND} <= ${TOTALSOUNDS}]?sound-plus)
exten => _X.,n,Set(GLOBAL(CURRENTSOUND)=1)
exten => _X.,n(sound-plus),Set(GLOBAL(CURRENTSOUND)=$[${CURRENTSOUND}+1])
exten => _X.,n,Playback(${CURRENTSOUND})
exten => _X.,n,Hangup()

And it can also be implemented in a similar simple way in a more convenient PL using AGI or even ARI.

G
Gansterito, 2017-12-21
@Gansterito

I can offer two options:
1) A hash function from the UniqueueID variable. The function should return a value between 1 and 20 (or whatever you have there). How to write this function is another task, but collisions are possible here, when one file can be repeated more than once.
2) Setting each call to SET(GROUP()=mygroup) and then playing the ${GROUP_COUNT(mygroup)}.wav file. This is almost the same option as from the previous commentator, but without a global variable, but through a group. Guarantees the uniqueness of the file being played at the same time.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question