In Code Behind, I evaluate a value and assign a grammar such as
Code: Select all
If(questionDataType ==1) //boolean
{
IVRSession.gExpression = “builtin:grammar/boolean”;
}
else if(questionDataType==2) //number greater than 9
{
IVRSession.gExpression = “builtin:grammar/number”;
}
else if(questionDataType==3) //number between 0 and 9
{
IVRSession.gExpression = “builtin:grammar/digits”;
}
Code: Select all
<var name ="qGrammar" expr="<%=IVRSession.gExpression%>" />
//some other code that works....
<field name=qAnswer>
<grammar srcexpr="qGrammar" />
<prompt>
<value expr="questionOptions"/> (THIS IS A VARIABLE ESTABLISHED EARLIER THRU ANOTHER SUBDIALOG AND WORKS)
</prompt>
</field>
(This initial line is correctly spoken--it is the vxml that is returned via the variable "questionOptions" above)
<?xml version='1.0'?><speak>Press or say a number between 0 and 120.</speak>
---------
VXI::field_element - activating grammars for form = 'questionForm' formitem = 'qAnswer'
Cache Miss: http://MYSERVER/playGreeting.aspx
Attempting to fetch http://MYSERVER/playGreeting.aspx
HTTP/1.1 500 Internal Server Error - http://MYSERVER/playGreeting.aspx
Failure in inetptr->Open call in OSBrecLoadGrammarFromURI constructor
received event: error.badfetch.http.500:
Is it possible to dynamically create/present grammars? I'm not trying to use any "special" grammars--just the typical built-in grammars, but do need the ability to switch them depending on the type of question being asked--which isn't known until into the application.
Thanks for any assistance!