I had the attached AGI script which worked just fine on the latest trixbox, but when I installed a new server with FreePBX distro the script just gives a congestion signal.
Basically, it transferred a caller to extension 700. It seems like PHP agi scripts work, but none of my perl ones. Is there something you have to do to get these working?
#!/usr/bin/perl
use Asterisk::AGI;
use DBI;
my $AGI = new Asterisk::AGI;
my $dbh = DBI->connect(‘dbi:mysql:airport:localhost’,‘root’,‘passw0rd’);
Yes, I believe it is. I see it in /usr/bin/perl and when I run the yum it looks like it is already there.
[root@pbx ~]# yum install perl
Loaded plugins: fastestmirror, kmod
Loading mirror speeds from cached hostfile
Setting up Install Process
Package 4:perl-5.8.8-32.el5_5.2.i386 already installed and latest version
Nothing to do
[root@pbx ~]#
I bet your issue is you are hard coding the MySQL password and FreePBX Distro does not use a standard password for MySQL. You need to put your MySQL password in their.
No it needs to get into mysql. What I am saying is you have defined your password for the mysql root user as passw0rd. Is that the password for the mysql root user???
I don’t think MySQL is the problem, and I tested that connection screen in phpMyAdmin and that is correct (I changed the password to that so it would match my old trixbox stuff). And yes it is the password, but I don’t have the server externally accessible.
I am also not sure why it would need MySQL, the following AGI script I just tested on my old trixbox and it works perfectly but when I test on my freepbx distro I just get congestion:
When I try on FreePBX here is the log:
Connected to Asterisk 1.8.7.1 currently running on pbx (pid = 2948)
Verbosity is at least 3
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Executing [9004@from-internal:1] Answer(“SIP/2202-00000006”, “”) in new stack
– Executing [9004@from-internal:2] AGI(“SIP/2202-00000006”, “parkcyrus.agi,2202”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/parkcyrus.agi
– <SIP/2202-00000006>AGI Script parkcyrus.agi completed, returning 0
– Executing [9004@from-internal:3] Hangup(“SIP/2202-00000006”, “”) in new stack
== Spawn extension (from-internal, 9004, 3) exited non-zero on ‘SIP/2202-00000006’
– Executing [h@from-internal:1] Hangup(“SIP/2202-00000006”, “”) in new stack
== Spawn extension (from-internal, h, 1) exited non-zero on ‘SIP/2202-00000006’
Well we use asterisk 1.8 and Trixbox does not. I might be something different that has to change in your code. You can turn on agi debugging in asterisk and see if that helps. AGI’s can be fun to debug.
Thank you for your thoughts, I re-wrote a very simple AGI script that just plays back a file:
#!/usr/bin/perl
use Asterisk::AGI;
my $AGI = new Asterisk::AGI;
#$AGI->exec(‘Playback’, ‘/var/lib/asterisk/sounds/custom/reno_welcome’);
and here is the debug log (still just congestion) – is there something I have to do to enable perl AGI scripts or something, please help!! I don’t want to have to go back to trixbox
Actually, the problem is probably not the perl script but the way you are calling it.
You need to share your dialplan config.
Certainly you don’t want to go back to trixbox, the FreePBX is is 8 versions old and the project is abandoned.
You can use Asterisk 1.6 (the version trix 2.8 uses) with FreePBX 2.10.
You need to post a full excerpt of your dial plan that calls the script and all surrounding logic. Also a copy of the full log with both verbosity and debug cranked up.
I would not post the log in forum, post it at pastebin.ca and provide a link.
After much messing around I had the stroke of genius to try and execute the script from the shell (./parkcyrus.agi) and see what happened, on trixbox it did nothing and on FreePBX it gave a bunch of errors.
If anyone else has this problem here is what you do, try and run it and you will see files are in the wrong directory.
You need to move AGI.pm and Asterisk.pm to /usr/lib/perl5/5.8.8/Asterisk and /usr/lib/perl5/5.8.8 respectively from /root/asterisk-perl-1.03/lib/ and you will be in business!
So no problem with the dialplan or mysql or anything. Thank you very much Skyking and Tony for the help though, I do appreciate it.
No problem, this is a great example of how difficult it is to offer forum support on custom apps. We would have found it in a couple of minutes in front of the console.
On FreePBX (Latest) - installed Asterisk-Perl, but cannot get Asterisk::AGI to work. Working fine on an older Asterisk 1.6 installation. Not sure what I’ve done/am doing incorrectly. AGI debug not helping in this situation either…