[Asterisk-Dev] Perl AGI + MySql Audio

Darren Sessions dsessions at ionosphere.net
Wed Nov 24 07:42:59 MST 2004


Steve - Is it your goal in life to be a jerk? - it's all I've ever seen come
out of your mouth. Just wondering. Maybe it's that big "I think I know it
all" head of yours.

In any case...

Here is the situation. I have a 4 asterisk servers and one database/storage
server. When a call comes in (forwarded from one of my SER servers) to one
of the servers, no matter which one, it has to be able to pull unique
customer information (audio files etc.).

Now my first instinct was to cluster the asterisk servers, but that doesn't
make sense because I've got 4 of them and will want to add more in the
future as my load increases.

The individual * servers don't have more than 32GB of storage - so that's
not feasible.

All the servers have 1000BaseT network connectivity.

NFS is problematic because if the server dies, it seems to lock up the
clients until it starts responding again.

The "Database/Storage" server has over 4GB of ram, 14x146GB 10k hard drives,
and a high end RAID controller - so speed really isn't an issue just yet.

The logical choice was to use a database to store the audio files - that's
all that server would be doing essentially. We've got a quad processor box
to do real DB stuff. But... It makes sense to have the ability to pull the
audio data in a variable. With the WAV49 format, the byte count is much
lower (obviously) than standard wav files and it still retains compatibility
if I mail an audio file to a customer.

Having said all that. If anyone has a good idea on how to have * playback
audio from a variable - let me know.

I appreciate it,

 - Darren


On 11/24/04 5:46 AM, "asterisk-dev-request at lists.digium.com"
<asterisk-dev-request at lists.digium.com> wrote:

> Message: 1
> Date: Tue, 23 Nov 2004 14:56:17 -0600
> From: Steven Critchfield <critch at basesys.com>
> Subject: Re: [Asterisk-Dev] Perl AGI + MySql Audio
> To: Asterisk Developers Mailing List <asterisk-dev at lists.digium.com>
> Message-ID: <1101243377.23163.28.camel at steven>
> Content-Type: text/plain
> 
> 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