[Asterisk-Dev] Perl AGI + MySql Audio

Adam Goryachev mailinglists at websitemanagers.com.au
Tue Nov 23 17:29:07 MST 2004


On Wed, 2004-11-24 at 07:56, Steven Critchfield wrote:
> 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 network 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.

If you don't like that (good advice) then try mine:

Throw money at the problem....
ie, get better/faster disks, use raid to divide the disk usage over more
spindles, or, ultimately, use a RAM drive. Buy another 1GB of RAM, and
create a RAM drive, mount it, and use this for all your 'scratch'
files...

Also, for those people storing large numbers of files which are indexed
via DB, you might look at reiserfs which is meant to be quite good for a
large number of files in a single directory case... (with 69000 files
(emails) in a single dir, it took 1.17s to do a ls|wc -l)

Regards,
Adam

Regards,
Adam





More information about the asterisk-dev mailing list