[asterisk-users] How to run a remote PHP script and still have access to audio stream?

Ben Dinnerville ben at voicelogic.com.au
Sun Feb 7 21:13:20 CST 2010


Leo Burd wrote:
> Hello there,
> 
> I'm trying to figure out how to run a PHP script on a remote machine and 
> still have access to the audio stream associated with the call. 
> 
> Ideally, I'd love to play/record audio files directly from/to the remote 
> server without having to copy them back and forth to the Asterisk 
> server.  What is the best way to do this?
> 
> Is it possible to combine EAGI with FastAGI in PHP?
> 
> Thanks in advance,
> 
> Leo
> 
> 

There is the EAGI protocol that will allow this but the easiest way I 
find to do this sort of thing is to have a shared file system between 
the app / web server and the asterisk server(s). We run a clustered 
setup with 12 asterisk systems and a clustered jboss environment with a 
NFS mount shared between all the systems. For applications such as call 
recording asterisk does the monitor into the NSF mounted share / 
directory which is also visible on the jboss servers (mainly for 
permission checks / security etc) and the web server (for download etc). 
As long as you have a scheme that ensures you do not have duplicate file 
names (which can be controlled by a central database and via your php 
script) then you will not have any issues. There are a number of other 
file system alternatives out there that will achieve the same thing but 
NFS seems to be proven and stable and we have not any issues with it to 
date. Your php script can then be a simple AGI / FastAGI that simply 
executes a Playback(path/to/nfs/directory/file) - you can also 
incorporate things like checking if the file exists in your PHP script 
and implementing access restrictions etc.

We also share our sounds directory between systems this way so that all 
our sounds only have to reside in one place but are visible across all 
the systems.

Cheers,

Ben




More information about the asterisk-users mailing list