We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics
New to VXML--possible to set a grammar globally?
New to VXML--possible to set a grammar globally?
Hello I am extremely new to VXML. Writing a very basic IVR, with only DTMF being used. I wanted to know if there was a way to set the DTMF grammar in the xml file globally, so that I don't have to specify it on each form. I was reading the developer's documentation, and from my reading it looks like the grammar tag can only be a child tag of the form tag. So I can't specify it unless it's within a form. At least that's what I gather. I will probably be posting a lot of ignorant questions on here so please forgive me in advance.
Re: New to VXML--possible to set a grammar globally?
Hi jallard,
Unfortunately, there is no good way to properly create this global-level grammar. We recommend creating an external GRXML file that you could then reference within the field tags.
main.php:grammar.grxml:This will allow you to declare your grammar in one location while referencing it in multiple locations throughout your application.
Regards,
Plum Support
Unfortunately, there is no good way to properly create this global-level grammar. We recommend creating an external GRXML file that you could then reference within the field tags.
main.php:
Code: Select all
<?php
header("Content-type: text/xml");
echo "<?xml version=\"1.0\"?>\n";
?>
<vxml version="2.0">
<form>
<field name="number">
<grammar src="http://www.example.com/grammars/grammar.grxml" type="application/srgs+xml"/>
<prompt>
Enter a number between 1 and 4.
</prompt>
<filled>
<prompt>
You entered: <value expr="number"/>
</prompt>
</filled>
</field>
</form>
</vxml>
Code: Select all
<?xml version="1.0"?>
<grammar type="application/srgs+xml" root="ROOT" mode="dtmf">
<rule id="ROOT">
<one-of>
<item> 1 </item>
<item> 2 </item>
<item> 3 </item>
<item> 4 </item>
</one-of>
</rule>
</grammar>
Regards,
Plum Support
Plum Support
http://www.plumvoice.com
http://www.plumvoice.com