VoiceXML Explained: Structure Voice-Driven Dialogs
Learn how forms and grammars structure voice dialogs and recover from silence or unmatched input.
VoiceXML Explained: Structure Voice-Driven Dialogs
VoiceXML is XML markup used by voice browsers for dialogs with synthesized or recorded audio, speech or DTMF input, recording, and telephony. W3C VoiceXML 2.0 defines the core language; 2.1 adds backward-compatible features.
A form collects input and a menu presents choices. A field uses a prompt and grammar; filled runs after input. Handle silence with noinput and out-of-grammar responses with nomatch. Check the platform and separately test valid input, silence, and unmatched input. VoiceXML describes dialog flow; the browser performs recognition and synthesis. Services and privacy need separate design.
<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">
<form id="simple-menu">
<field name="choice">
<prompt>Choose 1 or 2.</prompt>
<grammar type="application/srgs+xml" mode="dtmf" root="choice">
<rule id="choice" scope="public">
<one-of><item>1</item><item>2</item></one-of>
</rule>
</grammar>
<noinput>I did not hear you. Choose 1 or 2.</noinput>
<nomatch>I did not hear you. Choose 1 or 2.</nomatch>
<filled><assign name="done" expr="true"/></filled>
</field>
</form>
</vxml>References
[VoiceXML 2.0 — W3C Recommendation (2004)](https://www.w3.org/TR/voicexml20/)
[VoiceXML 2.1 — W3C Recommendation (2007)](https://www.w3.org/TR/voicexml21/)