Accessing the Asterisk DB


#1

Is there a way to access the DB from an external application?

I would like to keep a DB of active extensions (updated in real-time) and then be able to access that data to visualize it using, for example, a web page.

Thanks in advance.


#2

You should be able to. Not sure if there’s anything out there to currently do it. This maybe of some interest to you though:

search.cpan.org/~pmqs/DB_File-1.814/DB_File.pm


#3

Thanks, I’ll check it out.

I was thinking about using the System() command to call a program that quickly writes a record to a file (when an extension becomes active) and another System() call to a program that deletes a record from the file (when an extension becomes inactive).

My concerns with doing it this way would be: 1) CPU/efficiency cost, and 2) race conditions resulting in corruption. Any suggestions would be appreciated.

Another idea would be to create a file (extension.dat) each time an extension becomes active, and delete the file each time the extension becomes inactive.


#4

this may be totally different from what you need, but if you are looking to perform an action each time an extension is called (or makes a call) you might look at using an AGI script.

you could create a macro that calls an AGI script at the beginning and end of a call that could write a file, to a database, play a sound…AGI lets you do just about anything, in just about any language.

i rebuilt our copia IVR in about 15 minutes using AGI and PHP - and it works better and runs faster than the solution we paid thousands of dollars for.

i would strongly suggest looking at AGI versus using the system call, for the same reasons you are hesitatant…