Agispeedy Be Part of Freeiris. 中文版
The Agispeedy is robust implemention of AGI in asterisk. Agispeedy is inconceivable faster than AGI. The result of test shows that by using Agispeedy in asterisk, the performance of system would be improved more than 10 times comparing with AGI.
Agispeedy Features:
Table of asterisk extend tech:
| name | speed | reliability | cluster |
|---|---|---|---|
| asterisk module | top faster | easy crash | no |
| agi | slowly | strong | no |
| fastagi | faster | maybe crash | yes |
| agispeedy | faster | strong | yes |
/agispeedy/bin/agispeedy --verbose [Fri May 21 19:24:15 2010] Agispeedy 2.0 services on... [Fri May 21 19:24:15 2010] Loading static : demo_static [Fri May 21 19:24:15 2010] 2010/05/21-19:24:15 main (type Net::Server::PreFork) starting! pid(32528) [Fri May 21 19:24:15 2010] Binding to TCP port 4573 on host * [Fri May 21 19:24:15 2010] Setting gid to "0 0" [Fri May 21 19:24:15 2010] Setting up serialization via flock [Fri May 21 19:24:15 2010] Beginning prefork (6 processes) [Fri May 21 19:24:15 2010] Starting "6" children
get source files from SVN: >svn export http://darwin.freeiris.org/svn/freeiris/addition/agispeedy/
Under the agispeedy, install agispeedy by run the script: ./install.pl You also can add -–prefix=path to other directory, for example, you can add agispeedy to system boot by copying contrib/agispeedy.init.centos to /etc/init.d/
please note: sudo as root
>cd agispeedy
>chmod +x install.pl
>./install.pl
[RESPONSE] Agispeedy Installer
[INPUT] continue to install agispeedy to /agispeedy (yes/no)?yes
......
[RESPONSE] set /etc/agispeedy
[RESPONSE] set agispeedy services
More parameters to run AGIspeedy:
./agispeedy –verbose
will output all messages from agispeedy services
./agispeedy –quiet
agispeedy will quiet and slience run in background and write messages to log_files.
/etc/init.d/agispeedy start
If you are not use redhat, you have to manually install init scripts.
>ps ax|grep agispeedy 32424 ? Ss 0:00 /usr/bin/perl /agispeedy/bin/agispeedy -q -c /etc/agispeedy 32425 ? S 0:00 /usr/bin/perl /agispeedy/bin/agispeedy -q -c /etc/agispeedy 32426 ? S 0:00 /usr/bin/perl /agispeedy/bin/agispeedy -q -c /etc/agispeedy 32427 ? S 0:00 /usr/bin/perl /agispeedy/bin/agispeedy -q -c /etc/agispeedy 32428 ? S 0:00 /usr/bin/perl /agispeedy/bin/agispeedy -q -c /etc/agispeedy 32430 ? S 0:00 /usr/bin/perl /agispeedy/bin/agispeedy -q -c /etc/agispeedy 32431 ? S 0:00 /usr/bin/perl /agispeedy/bin/agispeedy -q -c /etc/agispeedy
1) Please start agispeedy services.
edit extensions.conf in asterisk [default] add:
exten => 123456,1,NoOp('agispeedy demo')
exten => 123456,n,AGI(agi://127.0.0.1/demo_dynamic,number=7890,xxx=yyy)
exten => 123456,n,hangup
2) if the agispeedy does not be installed in the asterisk server, you have to change “127.0.0.1”.
3) Using a registered extension to dial 123456, you should hear the system play the digits “7890”.
open agispeedy.conf from etc folder.
# this is agispeedy simple config file [general] etc_path=/etc/agispeedy/ bin_path=/agispeedy/bin/ pid_path=/agispeedy/log/ lib_path=/agispeedy/lib/ log_path=/agispeedy/log/ var_path=/agispeedy/var/ # runtime settings hook for your special request [services] # * means bind all ip host=* # 4573 is asterisk fastagi port please don't change port=4573 # run agispeedy as user and group user= group= # if you have performace cpu and memory you can modify followed sets min_servers=6 min_spare_servers=2 max_spare_servers=12 max_servers=64 max_requests=512 [log] # log file default yes/no and log level enable=yes # Set log level, Default 2 : # 0 error,1 warnning,2 notice,3 info,4 debug level=2 [agispeedymodules] enable_dynamic=yes # enable static will auto load module in agispeedy initilization time enable_static=yes # dynamic agispeedy module file extname dynamic_ext=dam # static agispeedy module file extname static_ext=sam
Agispeedy Automatically responses user request from asterisk.
example : exten => 123456,n,AGI(agi://127.0.0.1/demo_dynamic,number=7890,xxx=yyy)
so if you need new function directly write your module in /agispeedy/var
Please note that name of entry function must be same with filename.
abc.sam's entry function named sub abc()
def.dam's entry function named sub def()
demo_dynamic.dam:
# write by somebody
use foo; # your can write use module outside entry
sub demo
{
my $self = shift;
my $server_prop = $self->{server};
my $agi = $server_prop->{agi};
my $params = $agi->{params};
my $number = $self->_demo_count($params->{'number'});
$agi->say_digits($number);
exit;
}
sub _demo_count
{
return($_[0]);
}
Agispeedy supports hooks, you can make database connection in child initial stage and it makes fast than request time.
edit /agispeedy/lib/agispeedy_hook.pm
sub child_init_hook()
{
you can write database connect here.
and register in to $self->{server}{dbh}.
and recall dbh from your modules
}
in /agispeedy/var/demo.dam
sub demo
{
my $self = shift;
my $dbh = $self->{server}{dbh};
}
Freeiris2 Chinese Opensource Telelphony used Agispeedy replace all of agis
Sun bing hoowa.sun@gmail.com
Copyright © 2009, Sun bing hoowa.sun@gmail.com.
Copyright © 2010, Fonoirs CO.,LTD.
You may distribute under the terms of either the GNU General Public License VERSION 2.
The Agispeedy is free Open Source software.
IT COMES WITHOUT WARRANTY OF ANY KIND.
Sun bing hoowa.sun@gmail.com
|
||||
| Freeiris爱好者QQ群 43185599 |