Code:
#!/usr/bin/perl
# PERL MODULES WE WILL BE USING
use DBI;
use DBD::mysql;
use Asterisk::AGI;
$AGI = new Asterisk::AGI;
# HTTP HEADER
# Print "Content-type:text/vxml \n\n";
#CONFIG VARIABLES
$platform="mysql";
$database="employeedet";
$host="localhost";
$port="3306";
$tablename="employee";
$user="";
$pw="";
#DATA SOURCE NAME
$dsn="dbi:mysql:$database:localhost:3306";
#PERL DBI CONNECT(RENAMED HANDLE)
$dbstore = DBI->connect($dsn,$user,$pw);
#PREPARE THE QUERY
$stmtA = "select * from employee where id='1';";
$sthA = $dbstore->prepare($stmtA) or die "preparing:", $dbstore ->errstr;
$sthA->execute or die "SQLERROR:$stmtA".$DBI->errstr;
while(@row = $sthA->fetchrow_array())
{
$count=$row[1];
}
print qq*
<?xml version="1.0"?>
<vxml>
<form>
<prompt>
The employee name is "$count".
</prmopt>
</form>
</vxml>
*;
this is my vxml file:
Code:
<?xml version="1.0"?> <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml"> <form id="employeeid"> <field name="emp" type="number"> <prompt> Enter your Employee ID </prompt> <grammar src="employeeinfo.vxml" type="application/srgs+xml"/> <filled> YOu have entered<value expr="emp"/>as employee id number </filled> </field> <block> <submit next="http://localhost/vxml/test/employee.agi" namelist="emp"/> </block> </form> </vxml>
but when i call from a vxml file i am getting error:
Code:
Apr 19 13:23:13.21|-2028012656|94|CRITICAL|com.speechworks.vxi|205|VXIinterpreterRun: Failed to parse the URI's content. Make sure that this document consists of valid VXML.|URL=http://localhost/vxml/test/employee.agi Apr 19 13:23:13.21|-2028012656|94|EVENT|2|content=Error: error.badfetch , [url]http://localhost/vxml/test/employee.agi[/url]
Comment