Voice-XML sub-dialog
Issue
How To Voice-XML sub-dialog
Solution
This article is built up out of 2 parts.
The first part gives a short explanation while the second part contains a couple of examples.
Explanation:
As defined in the VoiceXML 2.0 documentation, prompts are collected and queued by the VoiceXML interpreter and played either
- when the interpreter reaches the waiting state, at which point the prompts are played and the interpreter listens for input that matches one of the active grammars, or
- when the interpreter begins fetching a resource (such as a document) for which fetchaudio was specified. In this case the prompts queued before the fetchaudio are played to completion, and then, if the resource actually needs to be fetched (i.e. it is not unexpired in the cache), the fetchaudio is played until the fetch completes. The interpreter remains in the transitioning state and no input is accepted during the fetch.
In Example02-bad.vxml the prompts are only queued and never played because no form has a waiting state (waiting for input)
- the sub-dialog element has no fetchaudio property set there is an endless loop (<goto next="#form1"/>)
- Example03.vxml has a waiting state (the menu between the prompt and sub-dialog) and therefore it works.
Examples
Bad example: ‘Example02-bad.vxml’
<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/vxml http://www.w3.org/TR/voicexml20/vxml.xsd">
<form id="form1">
<!-- x="134" -->
<!-- y="62" -->
<block name="prompt1">
<prompt>
Welcome to Example 2
</prompt>
</block>
<block>
<goto next="#form2"/>
</block>
</form>
<form id="form2">
<!-- x="301" -->
<!-- y="180" -->
<subdialog name="subdialog1" src="http://10.18.146.11:8080/VXML/Clock.jsp" method="get">
</subdialog>
<block>
<goto next="#form1"/>
</block>
</form>
</vxml>
Good example: ‘Example03.vxml’ (insert a menu between the prompt and the sub-dialog)
<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/vxml http://www.w3.org/TR/voicexml20/vxml.xsd">
<form id="form1">
<!-- x="134" -->
<!-- y="62" -->
<block name="prompt1">
<prompt>
Welcome to Example 2
</prompt>
</block>
<block>
<goto next="#menu1"/>
</block>
</form>
<menu id="menu1" dtmf="false" accept="exact">
<!-- x="290" -->
<!-- y="151" -->
<prompt count="1">
bluuuuuurb
</prompt>
<choice dtmf="1" next="#form3">
1
</choice>
<choice dtmf="2" next="#form2">
2
</choice>
</menu>
<form id="form2">
<!-- x="477" -->
<!-- y="226" -->
<subdialog name="subdialog1" src="http://10.18.146.11:8080/VXML/Clock.jsp" method="get">
</subdialog>
<block>
<goto next="#menu1"/>
</block>
</form>
<form id="form3">
<!-- x="150" -->
<!-- y="232" -->
<block name="prompt1">
<prompt>
Hello
</prompt>
</block>
<block>
<goto next="#menu1"/>
</block>
</form>
</vxml>
For reference attached also the Clock.jsp used in the Examples above:
<?xml version="1.0"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
<form>
<block>
<prompt>
<!-- JSP expression to insert date/time -->
<%= new java.util.Date() %>
</prompt>
<return />
</block>
</form>
</vxml>
Which returns e.g. following result:
<?xml version="1.0"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
<form>
<block>
<prompt>
<!-- JSP expression to insert date/time --> Tue Jan 24 13:41:08 CET 2006
</prompt>
<return />
</block>
</form>
</vxml>
Level of Complexity
High
Applies to
Product | Version | Build | Environment | Hardware |
---|---|---|---|---|
TC/SP | 7.68.00 | Microsoft Windows Server 2003 Microsoft Windows Server 2008 |
References
Keywords: subdialog, sub, dialog, xml, voicehint: 12483, kcs, topcall, communication server,