AGI scripting and call files
We’ve started working with AGI scripting, which allows you to interface with Asterisk from an external file. And we’ve got the handy phpAGI library installed, so we can perform most Asterisk functions from a PHP script, plus have access to MySQL and all the advanced functions of PHP, which certainly seems the route to go for any sort of web integration. To start experimenting with AGI, I built a wakeup call service which allows you to enter a time at which to be called back (the sound files are placeholders at the moment). It uses a function which I adapted from Shawn’s script to generate a call file, which is then moved to the outgoing directory and then has its modified time set to the call time. That’s Asterisk’s somewhat janky way of scheduling outgoing calls. When the time comes, Asterisk calls you back and drops you into the ajs292_wake context, which just plays an audio file.
There’s also a web implementation (which seems like a more likely use case, to me) here.
my extensions file:
[redial_ajs292]
exten => s,1,Answer()
exten => s,n,AGI(/home/ajs292/asterisk_agi/ajs292_wake.php)
[ajs292_wake]
exten => s,1,Background(/home/ajs292/asterisk_sounds/intro)
and Wakeup Call PHP file (sorry for the link, wordpress seems to hate posting PHP, even within )
Activity