[asterisk-users] How to play audio file in background in dialplan?
Steve Edwards
asterisk.org at sedwards.com
Fri Feb 3 16:20:52 CST 2012
On Fri, 3 Feb 2012, Yaroslav Panych wrote:
> 2012/2/3 Danny Nicholas <danny at debsinc.com>:
>> <start music>
>> Fork or shell task 1
>> Fork or shell task 2
>> <stop music>
>
> What exactly commands I should invoke in AGI instead of <start music>
> and <stop music> ? STREAM FILE returns only after file ends, this is not
> what I want.
Execute 'stream file' in a separate thread.
The only 'restriction' is that you cannot execute any other AGI commands
in the 'mainline' thread until either the 'background' thread finishes or
you 'join' it.
This makes sense if you think about how the AGI protocol is implemented --
write a request, read a response, rinse, lather, repeat. If you don't read
the response (which will block execution until 'stream file' finishes),
you violate the protocol.
This includes seemingly innocuous AGI commands like 'verbose.' Think of it
like 'all Asterisk interaction has to be done in the background thread' as
long as the background thread is executing.
--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000
More information about the asterisk-users
mailing list