<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.0">
<form id="form1">
<field name="field1">
<grammar
root="grammar1"
type="application/srgs+xml"
mode="voice"
>
<rule id='grammar1'>
<one-of>
<item>
One
<tag>
english='One';integer='1'
</tag>
</item>
<item>
Two
<tag>
english='Two';integer='2'
</tag>
</item>
</one-of>
</rule>
</grammar>
<prompt>
One or two.
</prompt>
<filled>
<prompt>
You said.
<value expr="field1.english" />
</prompt>
</filled>
</field>
</form>
</vxml>
"field1.english" is empty but doesn't cause an error when I run this script. "field1" holds a string which is the contents of the tag with the semi colons removed. That's difficult to parse. What am I missing here?
The contents of the tag tag should end with a one, assuming it's evaluated as ecma script. However, making that change doesn't give me a different result.
Thanks for your response. I think we're getting closer.
I would like the grammar to give back several pieces of information based on the grammar match. I don't think your solution quite allows me to do that. Here's an example form:
<form id="state_province">
<field name="state_province">
<grammar
src="http://pleusdev.plum.imi.ca/assets/grammars/state_province.xml"
root="state_province"
type="application/srgs+xml"
mode="voice"
/>
<prompt>
Say your state or province.
</prompt>
<filled>
<prompt>
You are in <value expr="state_province.country" />.
</prompt>
</filled>
</field>
</form>
We've found that the following IVR code works well on our IVR hosting site, which runs version 3.0 of the IVR platform. Again, note the use of SRGS+XML for the IVR <grammar> below:
<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.0">
<form>
<field name="stateprovince">
<grammar type="application/srgs+xml" mode="voice" root="ROOT" xml:lang="en_us">
<rule id="ROOT">
<one-of>
<item>
Alberta
<tag>
state_province='Alberta';state_province_abbr='AB';country='Canada';country_abbr='CA'
</tag>
</item>
<item>
British Columbia
<tag>
state_province='British Columbia';state_province_abbr='BC';country='Canada';country_abbr='CA'
</tag>
</item>
</one-of>
</rule>
</grammar>
<prompt>
Say your state or province.
</prompt>
<filled>
<prompt>
You are in <value expr="stateprovince.state_province" />.
Your country is <value expr="stateprovince.country" />.
</prompt>
</filled>
</field>
</form>
</vxml>
If you have an onsite system, you should consider upgrading to the latest version of the IVR platform.