|
Author
|
Topic: Interaction between VoiceXML and an application
|
Cois
Junior Member
Member # 3267
Rate Member
|
posted October 05, 2005 11:26 PM
Once a user has made a call, listened to the prompts and provided vocal answers how do I get his answers to influence the execution of an applicatin. In other words, is there a way (and what would be the format) for the answers given by a user to a web servers to be "returned" to a web app or stored somewhere?
Posts: 1 | From: Accra | Registered: Oct 2005
| IP: Logged
|
|
|
|
Mark
Junior Member
Member # 3315
Rate Member
|
posted December 03, 2005 10:53 PM
Hi all,
Any chance of an example to show us? I've read the W3.org doc and it's pretty confusing to me. I'd also like to have a end-users input (either by pressing a '1' or '2' update an entry in a database.
-------------------- ---------- Mark Walker
Posts: 1 | From: Toronto | Registered: Dec 2005
| IP: Logged
|
|
mheadd
Member
Member # 3181
Member Rated:
|
posted December 04, 2005 11:45 AM
Here is an excellent example that demonstrates how to use the <submit> element to POST information entered by a caller in a VoiceXML dialog to a back end web application for further processing.
In a nutshell, when you use the <submit> tag, you tell the VoiceXML interpreter to pass information to a designated URL. You should use <submit> when a field-level variable has been filled -- this is done, not surprisingly, with the <filled> element.
code:
<field name="pin" type="digits?length=4"> <noinput>I'm sorry, I didn't hear you. Please try again.<reprompt/></noinput> <prompt>Please enter or say your pin.</prompt> <filled> <submit next="http://someurl/get_passcode.php" method="post" namelist="pin"/> </filled> </field>
This example uses one of the "builtin" grammar types defined in the VoiceXML specification. When a caller inputs a value that matches the grammar, the field is then filled, and the <filled> element initiates the posting of information to the target URL. The �namelist� attribute specifies the name of the variable that you want to pass on to the designated URL for processing. So, in this example, if a caller entered a pin # of �1234� then this dialog would pass the variable �pin� with a value of "1234" to the URL "someurl/get_passcode.php" using the HTTP POST method.
There isn�t any requirement that the URL this example is POSTing to be a PHP file � it could just as easily be written in ASP, JSP, ColdFusion, Ruby or any other technology that works in conjunction with a web server. What this script will have to do is be able to process to POSTed variable. In this example, the file � get_passcode.php� uses one of the Superglobal arrays in PHP ($_POST) to process the submitted variable.
There is more on this approach at the PHP web site.
Hope this helps. [ December 04, 2005, 04:47 PM: Message edited by: mheadd ]
-------------------- Mark VoiceinGov.org http://www.voiceingov.org
Posts: 55 | Registered: Jun 2005
| IP: Logged
|
|
MrBaseball34
Junior Member
Member # 3303
Rate Member
|
posted December 16, 2005 10:18 AM
You can also use, depending on your platform, the VXML 2.1 <data> tag. It's is essentially the replacement for the <submit> tag.
Here is how I use it to return XML from my PHP script and then "parse" the XML into document scoped variables, the PHP script returns valid XML: {this is the Voxeo version of my VXML}
code:
<filled> <data name="domInfo" src="http://www.mysite.com/vxml/getdetails.php" namelist="id" /> <assign name="document.pin" expr="domTeam.documentElement.getElementsByTagName('pin').item(0).firstChild.data" /> <assign name="document.name" expr="domTeam.documentElement.getElementsByTagName('name').item(0).firstChild.data" /> <goto next="#get_pin" /> </filled>
[ December 16, 2005, 10:20 AM: Message edited by: MrBaseball34 ]
Posts: 5 | Registered: Nov 2005
| IP: Logged
|
|
|