Hello, im trying to create a script (using AGI Perl) and i would like to authenticate a user against a DB and while im doing that i would like for the user to hear a recording [color=red]while[/color] this happens.
Problem is that if i use AGI->Stream the program execution will continue [color=red]until[/color] the sound file has finished playing, so the query to the SQL db takes place AFTER the sound and not while it is playing.
Any ideas? I have looked in the forum and i did not find anything so far.
Thought some code of what im trying to do might clear my question so you guys can give me a hand. I want for the [color=orange]tt-weasels[/color] sound file to play [color=orange]WHILE[/color] the query is being executed.
As it is right now it plays the sound and [color=orange]THEN[/color] executes the query.
Any ideas? PLEASE HELP!!
[code]#!/usr/bin/perl
################NORMAL INIT STUFF##############
use Asterisk::AGI;
use DBI;
my $db = ‘DBI:mysql:example:localhost:3306’;
my $username = ‘test’;
my $pass = ‘hackme’;
my $dbh = DBI->connect($db, $username, $pass);
$AGI = new Asterisk::AGI;
my %input = $AGI->ReadParse(); #Read in the initial data
##########################################
#############WHILE DOING THIS#########
my $sql = “select count(*) from blacklist where phone=”$input{callerid}"";
my $sth = $dbh->prepare($sql);
$sth->execute();
while ( my @row = $sth->fetchrow_array( ) ) {
$banned=$row[0];
}
$sth->finish();[/code]