[asterisk-dev] Streaming audio to asterisk
russell at digium.com
Tue Jul 15 16:26:12 CDT 2008
Darren Sessions wrote:
> Basically, the app I'm writing uses the Asterisk ODBC code to pull in
> binary audio data from the database using a custom query, and then I
> need to write that audio data to the channel. I've got the database
> stuff nailed already along with the core of the application itself,
> just getting it to the channel now is what I'm interested in doing.
> My inexperience with the asterisk audio code here is going to shine
> through; basically, I'm still not 100% sure how to get set all the
> frame parameters via the frame struct and then getting that to
> ast_write. Like I said, still a bit fuzzy on the asterisk audio code,
> but it's slowly starting to make more sense. Most of my reference
> material has been looking over the app_swift code.
You should use a "generator" for this. By implementing your code as a
generator, Asterisk will handle figuring out the proper time to get the
next frame of audio.
ast_generator is the interface that you must implement. If you search
around, you will see other uses of generators. Music on Hold and file
playback use generators, for example. There may be simpler examples
Senior Software Engineer
Open Source Team Lead
More information about the asterisk-dev