473,396 Members | 2,102 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to write vxml in perl?

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2. # PERL MODULES WE WILL BE USING
  3. use DBI;
  4. use DBD::mysql;
  5.  
  6. use Asterisk::AGI;
  7. $AGI = new Asterisk::AGI;
  8.  
  9. # HTTP HEADER
  10.  
  11. # Print "Content-type:text/vxml \n\n";
  12.  
  13. #CONFIG VARIABLES
  14. $platform="mysql";
  15. $database="employeedet";
  16. $host="localhost";
  17. $port="3306";
  18. $tablename="employee";
  19. $user="";
  20. $pw="";
  21.  
  22. #DATA SOURCE NAME
  23. $dsn="dbi:mysql:$database:localhost:3306";
  24.  
  25. #PERL DBI CONNECT(RENAMED HANDLE)
  26. $dbstore = DBI->connect($dsn,$user,$pw);
  27.  
  28. #PREPARE THE QUERY
  29. $stmtA = "select * from employee where id='1';";
  30. $sthA = $dbstore->prepare($stmtA) or die "preparing:", $dbstore ->errstr;
  31. $sthA->execute or die "SQLERROR:$stmtA".$DBI->errstr;
  32. while(@row = $sthA->fetchrow_array())
  33. {
  34.  $count=$row[1];
  35. }
  36. print qq*
  37. <?xml version="1.0"?>
  38. <vxml>
  39. <form>
  40. <prompt>
  41. The employee name is "$count".
  42. </prmopt>
  43. </form>
  44. </vxml>
  45. *;
  46.  
can any one help me i am getting the output when i type in terminal ./employee.agi

this is my vxml file:
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0"?>
  2. <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
  3. <form id="employeeid">
  4. <field name="emp" type="number">
  5. <prompt>
  6. Enter your Employee ID
  7. </prompt>
  8. <grammar src="employeeinfo.vxml" type="application/srgs+xml"/>
  9. <filled>
  10. YOu have entered<value expr="emp"/>as employee id number
  11. </filled>
  12. </field>
  13. <block>
  14. <submit next="http://localhost/vxml/test/employee.agi" namelist="emp"/>
  15. </block>
  16. </form>
  17. </vxml>
i have kept employee.agi in /var/www/vxml/test folder


but when i call from a vxml file i am getting error:
Expand|Select|Wrap|Line Numbers
  1. 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
  2. Apr 19 13:23:13.21|-2028012656|94|EVENT|2|content=Error:  error.badfetch ,  http://localhost/vxml/test/employee.agi
  3.  
please help me its urgent
Apr 19 '09 #1
3 2683
Icecrack
174 Expert 100+
Try this i have take out your user and pass for SQL reinsert them

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2. # PERL MODULES WE WILL BE USING
  3. use DBI;
  4. use DBD::mysql;
  5.  
  6. use Asterisk::AGI;
  7. $AGI = new Asterisk::AGI;
  8.  
  9. # HTTP HEADER
  10.  
  11. Print "Content-type:text/vxml \n\n";
  12.  
  13. #CONFIG VARIABLES
  14. $platform="mysql";
  15. $database="employeedet";
  16. $host="localhost";
  17. $port="3306";
  18. $tablename="employee";
  19. $user="";
  20. $pw="";
  21.  
  22. #DATA SOURCE NAME
  23. $dsn="dbi:mysql:$database:localhost:3306";
  24.  
  25. #PERL DBI CONNECT(RENAMED HANDLE)
  26. $dbstore = DBI->connect($dsn,$user,$pw);
  27.  
  28. #PREPARE THE QUERY
  29. $stmtA = "select * from employee where id='1';";
  30. $sthA = $dbstore->prepare($stmtA) or die "preparing:", $dbstore ->errstr;
  31. $sthA->execute or die "SQLERROR:$stmtA".$DBI->errstr;
  32. while(@row = $sthA->fetchrow_array())
  33. {
  34. $count=$row[1];
  35. }
  36. print <<XMLPRINT;
  37. <?xml version="1.0"?>
  38. <vxml>
  39. <form>
  40. <prompt>
  41. The employee name is "$count".
  42. </prmopt>
  43. </form>
  44. </vxml>
  45.  
  46. XMLPRINT
  47.  
  48.  
  49.  
  50.  
Apr 21 '09 #2
Hi,
I have made the changes near print <<XMLPRINT; but i am getting error as:

Can't find string terminator "XMLPRINT" anywhere before EOF at ./employee.agi line 36.
Apr 21 '09 #3
Icecrack
174 Expert 100+
Make Sure you have a blank line no spaces Before and After XMLPRINT
Apr 22 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: rxl124 | last post by:
someone please please help w/ this one. As I been working on this on and off and it just does not want to work. 1 #!/usr/bin/perl -w 2 3 $file = "/home/user1/dothis"; 4 open(FILE, ">$file");...
0
by: Richard Kasperowski | last post by:
Boston Mobile is the Boston-area mobile software developers group. We are a community of people who build applications for mobile devices such as mobile phones, PDAs, and pocket PCs. We meet...
1
by: von | last post by:
I am trying to write a single piece of data (that is generated from a Javascript) to a text file on my server via a Perl script. The Javascript is setup so that I can display the required data on...
3
by: Blas Croche Solana | last post by:
Hello, I am trying to validate a VXML document against the new vxml 2.0 schema, and I am getting the following errors (and a lot more like these): Reference to undeclared substitution group...
0
by: stanna | last post by:
Hello, We are looking for XML/Soap/VxML experts to work in US as well as in India, If anybody is looking for job, send your resume to stanna at optonline dot net. Salaries are attractive. ...
0
by: polar086 | last post by:
Hi, For anyone that is familiar with vxml. Is there any way to recognize only part of a sentence, and disregard the rest? For example, I want to recognize "I grew up in *anything*", where...
0
by: V1RuZ | last post by:
Hi all, I'm having some trouble getting my php code to work properly. I'm submitting three different variables from a vxml form to my php. I then need the php to deposit the variables into files...
2
by: Navpreet Singh | last post by:
Hello Sir The code given below is the vxml code in which i can record my voice but when i want to try to save the recorded file using php script the error occours. The php code is also given below....
1
by: kumaragurur | last post by:
Hi, How to implement full call recording in vxml? Kindly suggest. Thanks, Kumaraguru
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.