[Asterisk-Users] AGI MySql

Akpome Akpoguma akpome_a at hotmail.com
Wed May 31 01:52:51 MST 2006


thanks Billy. I replaced

print "STREAM FILE $filename \"\"\n";

with

print "EXEC PLAYBACK $filename \n";

and it worked fine. Interestingly when I did

print "STREAM FILE beep \"\"\n";

within the script, it worked.

If I wasnt a newbie to asterisk I wouldve thought this to be strange.

>From: "William Piper" <billy at kersting.com>
>Reply-To: Asterisk Users Mailing List - Non-Commercial 
>Discussion<asterisk-users at lists.digium.com>
>To: "'Asterisk Users Mailing List - Non-Commercial 
>Discussion'"<asterisk-users at lists.digium.com>
>Subject: RE: [Asterisk-Users] AGI MySql
>Date: Tue, 30 May 2006 11:06:11 -0400
>
>Why not do:
>exten => s,1,AGI(xyz.agi|${MACRO_EXTEN})
>
>bp
>
>-----Original Message-----
>From: asterisk-users-bounces at lists.digium.com
>[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Akpome
>Akpoguma
>Sent: Tuesday, May 30, 2006 2:55 AM
>To: asterisk-users at lists.digium.com
>Subject: RE: [Asterisk-Users] AGI MySql
>
>
>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" <akpome_a at hotmail.com>
> >Reply-To: Asterisk Users Mailing List - Non-Commercial
> >Discussion<asterisk-users at lists.digium.com>
> >To: asterisk-users at 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
>
>
>__________ NOD32 1.1443 (20060314) Information __________
>
>This message was checked by NOD32 antivirus system.
>http://www.eset.com
>
>
>_______________________________________________
>--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

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/




More information about the asterisk-users mailing list