[asterisk-dev] Application timeouts, Periodic and Scheduled Announcements

Russell Bryant russell at digium.com
Wed Aug 29 18:22:58 CDT 2007


Kevin P. Fleming wrote:
> Heh.... uh, well... yeah. In fact applications that manipulate the media
> stream in any way in my mind are in fact 'channels' and should be
> bridged to the incoming channel and not talk to it directly, but that's
> a much larger change and maybe not even a welcome one :-)

I hear heard you mention this before, and I think it makes perfect sense.  It
two channels talking to each other used the same interface as a channel to an
application that involves media, a lot of things would be much easier to
implement.  I think this deserves a more in depth discussion in another thread
at some point.

> If this is going to require a background thread anyway to implement this
> functionality, I'd rather that be a thread servicing a single-channel
> bridge than just a channel-attached thread, because if the the channel
> does end up being bridged everything will already be setup for it.

Interesting idea.  This really sort of goes along with your idea above.

Regarding the code I have been writing, I pulled out the channel attached thread
and starting going another direction.  I'll go ahead and get into the fun
details.  :)

I changed the ast_waitfor() core to watch  the scheduler context on the channel,
and am going to have ast_read() execute scheduled callbacks when it comes time.
   This will actually be useful for other things as well, such as scheduling the
generation of the end of an emulated DTMF digit, instead of having to time it
off frames that are passing through, reducing the amount of necessary
computation, and simplifying the code.

The announcement would get scheduled to start by adding a scheduled callback to
the channel's scheduler context.  Then, when started, I was going to have it
create an audiohook and attach it to the channel.  I changed the whisper mode
audiohook to issue a callback when it wanted frames.  When it issued the
callback, I was going to feed it frames from the specified sound file.

For a periodic announcement, it would just schedule the next callback on the
channel for when the announcement will start again.

-- 
Russell Bryant
Software Engineer
Digium, Inc.



More information about the asterisk-dev mailing list