[Asterisk-Dev] Perl AGI + MySql Audio

Steven Critchfield critch at basesys.com
Tue Nov 23 13:56:17 MST 2004


On Tue, 2004-11-23 at 14:49 -0500, Darren Sessions wrote:
> I know there is a patch you can get for MPG123 that lets it query a MySQL
> database for audio files to play.
> 
> Is there a way to have Asterisks internal WAV49 player grab the binary data
> (of an audio file) from a blog field and play it without writing the audio
> file to disk?
> 
> Right now the way I do it, is once an audio file is created (lets say by
> using record), an AGI script reads the contents of the wav49 file into a
> variable and then dumps the contents of that variable into an blob field via
> an sql insert.
> 
> While this makes the AGI audio dynamic, it hammers the local hard drive.
> 
> Any ideas? I think the concept is very sound (no pun intended), but my
> experience with C is very limited and Perl AGI only lets you do so much.
> 
> I realize you can't "stream" wav files, so it'd need to load the audio bin
> contents into memory, then spit it out to whatever caller.
> 
> Ideally, I think it would be nice to have something like this:

All that message shows is that you don't understand the proper usage of
a database. You really should do something like store the filename
reference to the audio file in the database. Then your perl script can
tell asterisk where the file is and tell it to stream it in place and
not hammer your drive or your netork if the mysql DB is properly placed
off of the asterisk machine. 

More of the example of why your DB skills aren't yet ready for the task
is that mysql will get stupid slow as you store those blobs. Don't use a
DB in place of a filesystem.
-- 
Steven Critchfield <critch at basesys.com>




More information about the asterisk-dev mailing list