I have been able to figure out the first part of my problem.
I wrote my scripts based on wrong assumptions. one of which was that the
line
exten => s,1,AGI(xyz.agi)
sends an undefined extension value to the script. This is definitely wrong.
This line actually sends an extension value of "s". Therefore AGI{extension}
in my script can never be undefined as long as the script is being called
from a dialplan.
This leaves me with the second problem.
thanks for this trouble
From: "Akpome Akpoguma" <[EMAIL PROTECTED]>
Reply-To: Asterisk Users Mailing List - Non-Commercial
Discussion<asterisk-users@lists.digium.com>
To: asterisk-users@lists.digium.com
Subject: [Asterisk-Users] AGI MySql
Date: Mon, 29 May 2006 07:58:40 +0000
The following is my AGI script done in perl
#!/usr/bin/perl
use strict;
use DBI;
$|=1;
my %AGI;
while(<STDIN>) {
chop;
last unless length($_);
if (/^agi_(\w+)\:\s+(.*)$/) {
$AGI{$1} = $2;
}
}
my $ext = $AGI{extension};
if (!($ext)) { $ext = 10; }
my $dbh = DBI->connect('dbi:mysql:voiceDb', 'test', 'test', {PrintError=>0,
RaiseError=>1});
my $sql = "select filename from contentTable where ext='$ext'" or die
$dbh->errstr;
my $filename = $dbh->selectrow_array($sql);
$dbh->disconnect;
$filename =~ s/\.wav//i;
print "STREAM FILE $filename \"\"\n";
exit;
The return value of $filename from the database is supposed to be
/var/sounds/scoobie.wav.
There are 2 Problems
1. When I execute this script manually it works well but when I call this
script from dialplan I get no return value.
2. I did print "STREAM FILE /var/sounds/scoobie \"\"\n" and the phone was
as silent even though I see no error on the console.
Am clueless as to how to fix this. I need someone's
assistance.......resposes would be appreciated.
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --
Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --
Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users