[Asterisk-Users] FastAgi Help

Steven Critchfield critch at basesys.com
Thu Feb 3 13:00:47 MST 2005


On Thu, 2005-02-03 at 20:37 +0100, reseaux wrote:
> Dear List
> 	after a lot googling and watching source example of FastAGI i cant find a 
> simple way to convert a very simple perl AGI script... perhaps im not a 
> developer..

Not being derogatory here, but you appear far short of a developer in
missing the relatively low hanging fruit here.

> Why i have need to use FastAGI?...Very load CPU usage on my box... with only 
> 100 calls..
> So i have two way res_perl or FastAGI on some other box..
> I cant test res_perl becasue when i try to compile it i have this error:
> ----------
> gcc -Wall -fPIC -shared -Xlinker -x -o res_perl.so perlxsi.o res_perl.o 
> apihelp /usr/lib/perl5/5.8.1/i386-linux-thread-multi/auto/DynaLoader/DynaLoader.a 
> -L/uead -lc -lnsl -lndbm -lgdbm -ldl -lm -lcrypt -lutil -lpthread -lc  
> AstAPIBase.o
> /usr/bin/ld: cannot find -lndbm
> collect2: ld returned 1 exit status
> make: *** [res_perl.so] Error 1
> ----------

-l flags to gcc are to include libraries. So take the -lndbm error
message and go look for libndbm. Google has a lot of results for it.

> So i try to go on using the FastAGI that i think is great idea because i can 
> balance the CPU load using more Box, but how I can translate my simple perl 
> script and use it on FastAGI?

If your script was truly simple, I doubt you would have a high load
average. Could it be that you are really just memory starved and your
load average is skyrocketing due to swap thrashing? I could see 100 perl
interpreters causing a large memory usage problem, but not necessarily a
high cpu usage unless they are doing something very busy.

> Usually i used the Asterisk::perl library and i put some AGI script on my 
> dialplan like this:
> exten => 100,103,DeadAGI(prepaid_.agi,lcr,${called},${destid},${tgroup},
> ${lcrorder})
> 
> in this mode i also send some parameter to the perl script.
> Looking inside the fastagi-test example i cant understand how i can simple 
> pass some value to the script.. Some help is welcome..
> Also i have see that eoj have made some modification to the FastAGI:
> > send script parameter with FastAGI (bug #3270)
> But what i can we do with it? I know im very monkey... :-) 

Why not put those values into a variable that can be queried by the app.
Well actually, they are already in variables, why don't you just go use
the functions to look at the named variables?

As far as perl and fast-agi, it is modeled after the fastcgi interfaces.
You might do well to go learn how fastcgi works with perl and determine
if you feel like continuing that route. I'm sure there is decent
documentation on fastcgi and perl available to either move you forward
or scare you away from it.
-- 
Steven Critchfield <critch at basesys.com>




More information about the asterisk-users mailing list