I have an Asterisk server working perfectly fine in a payment environment. Now, there is need for me to separate the business logics from the Asterisk Server for efficiency, and protecting the AGI scripts for obvious reasons.
The question is, how do I convert the existing working AGI scripts to FASTAGI scripts, or how do I call the existing AGI scripts from a FASTAGI server?
I have red some post with answers on this platform, but none have stated clearly how to do this from scratch. Will be glad to have clear understanding on how to achieve this using PHP.
You can use xinetd
for this. From your dialplan on each asterisk box, call agi with a fast agi parameter, substituting your IP address of the fastagi server:
AGI(agi://192.168.1.100/)
Make sure you have in /etc/services
something like:
agi 4573/tcp # FAST AGI entry
On the FastAGI server: In a file called /etc/xinetd.d/agi
(make sure /etc/xinetd.conf
is loading modules from /etc/xinetd.d/
) have a definition which calls your agi script.
# description: agi service for PHP fastagi interaction
service agi
{
socket_type = stream
user = root
group = nobody
server = /path/to/agiLaunch.sh
wait = no
protocol = tcp
bind = 127.0.0.1
disable = no
per_source = UNLIMITED
instances = UNLIMITED
cps = 1000 0
}
In your AGI script, you can now just do as you normally would, by reading STDIN or STDOUT.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.