[asterisk-users] How to stop a background music

Steve Edwards asterisk.org at sedwards.com
Mon May 25 12:46:00 CDT 2009


Un-top-posting...

> On Fri, May 22, 2009 at 7:37 PM, Steve Edwards 
> <asterisk.org at sedwards.com>wrote:
>
>> On Fri, 22 May 2009, Noel R. Morais wrote:
>>
>>> But I need a way to actively stop it. Without waiting for user hit a 
>>> DTMF or the background timeout.
>>
>> What event would trigger your desire to stop the background()?

On Mon, 25 May 2009, Noel R. Morais wrote:

> I'm planning to play a background music, make some background process 
> and after that I will play another music or "transfer" the call to 
> another end point.
>
> I'm gonna see how difficult is to write a function like "StopBackground" 
> to do that. Any hints?

I think you are "barking up the wrong tree."

The purpose of background() is to play a file until a key is pressed or 
until the file is finished playing.

You will not execute the next step in your dialplan until the file is 
finished* so how will you create a background process?

What you described sounds more like an AGI, "music on hold," "parking," or 
dumping the caller into a conference and then transferring to the other 
end point.

Based on what you have described, I would write an AGI that played the 
file while waiting for whatever your triggering event is, set a channel 
variable (the name of the end point?) and returned to the dialplan -- but 
I tend to see AGIs as the solution to most non-trivial dial plan problems 
:)

*or the exten is entered or a timeout.

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