Page 1 of 1

Validated grammar fails

Posted: Mon Sep 24, 2007 1:47 pm
by moshe
Perhaps I'm overlooking something obvious, but the grammar validator says this is valid code, while the grammar fails at runtime:

Code: Select all

<grammar version="1.0" root="mainmenu">

	<!-- does user want main menu? -->
	
	<rule id="mainmenu" scope="public">
		<item>main menu</item>
	</rule>

</grammar>
I don't think it gets much simpler than this. Although this validates, I get an error at runtime:

Code: Select all

Attempting to fetch http://(removed for privacy)
Error creating grammar
received event: error.grammar
comments welcome

IVR fix for Validated grammar fails

Posted: Mon Sep 24, 2007 3:34 pm
by support
Hi,

You have to specify the IVR grammar type to be SRGS+XML inside of your <grammar> tag. Otherwise, it defaults to JSGF.

Basically, you have to change this line of IVR code:

Code: Select all

<grammar version="1.0" root="mainmenu"> 
to this:

Code: Select all

<grammar type="application/srgs+xml" version="1.0" root="mainmenu">
Hope this helps.

Regards,
Plum Support

Posted: Mon Sep 24, 2007 3:42 pm
by moshe
Unfortunately, that doesn't work... and why would it validate if it's not valid?

In any case, the grammar is online here; suggestions welcome. I'm modifying it as we speak, but nothing seems to work at the moment; not adding "mode", not taking off "version," etc.

Test Script

Posted: Mon Sep 24, 2007 4:14 pm
by moshe
I've placed a test script here.

Test Script for IVR application

Posted: Mon Sep 24, 2007 5:02 pm
by support
Hi,

In your .grxml file, you are missing the following:

Code: Select all

<?xml version="1.0"?>
This line has to be placed at the beginning of your .grxml file because the file has to return XML.

Also, in your .grxml file, you specify the attribute "version" twice in your .grxml application, as shown here:

Code: Select all

<grammar version="1.0" root="mainmenu" type="application/srgs+xml" mode="voice"  version="1.0" >
This IVR code should be changed to:

Code: Select all

<grammar version="1.0" root="mainmenu" type="application/srgs+xml" mode="voice">
This explains why the IVR application is having problems creating the IVR grammar.

Regards,
Plum Support

Posted: Mon Sep 24, 2007 5:36 pm
by moshe
When I put the <?xml> into the script, it failed, complaining that <?xml> wasn't acceptable. That's why it's not in there now.

Posted: Mon Sep 24, 2007 5:43 pm
by moshe
I should be more specific: when I had both the <?xml> construct and the DOCTYPE, I had error messages complaining about the <?xml> construct.

I've placed the <?xml> back into the script, and fixed the duplicate version that crept into it when I was fiddling around, and it still fails to run.

Validator explicitly rejects xml element

Posted: Tue Sep 25, 2007 5:58 am
by moshe
I thought I might be even more explicit, since I still can't get this grammar to work. If I use your recommendation and put the xml element back into the top of the document,

Code: Select all

<?xml version="1.0"?> 
<grammar root="mainmenu" type="application/srgs+xml" mode="voice" version="1.0" >

	<!-- does user want main menu? -->
	
	<rule id="mainmenu" scope="public">
		<token>main menu</token>
	</rule>

</grammar>
I've also tried the item element and no element whatsoever to delineate the spoken text. All fail.

I get the following output from your XML validator with the xml element in place:

Code: Select all

ERROR: 
Fatal Error at  line 0, char 6
  Message: No processing instruction starts with 'xml'
Using the full xml and DOCTYPE, as is my normal practice, gives the same error message. In other words, these lines at the top are also rejected by the validator:

Code: Select all

<?xml version="1.0" encoding ="UTF-8"?>
<!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN" "http://www.w3.org/TR/speech-grammar/grammar.dtd">
If I disregard the validator's assessment and attempt to use this grammar anyway, it still doesn't work. I call this grammar using

Code: Select all

		<grammar src="http://assassin.homeip.net:15338/~moshe/devel/freewill/trunk/vxml/grammars/dailyupdate.grxml" type="application/srgs+xml" mode="voice" root="mainmenu"/>
[/code]

Validator explicity rejects xml element in IVR system

Posted: Tue Sep 25, 2007 10:01 am
by support
Hi,

As for the validator rejecting the xml prologue in your remote IVR grammar, the validator was meant for inline IVR grammars within your vxml document. This is why the validator rejects the xml prologue.

However, have you tried calling into your IVR application to see if it works? We have been able to test this remote IVR grammar just fine on our side:

Code: Select all

<?xml version="1.0"?>
<grammar root="mainmenu" type="application/srgs+xml" mode="voice" version="1.0" >

	<!-- does user want main menu? -->
	
	<rule id="mainmenu" scope="public">
		<item>main menu</item>
	</rule>

</grammar>
You should leave out the DOCTYPE and the encoding though since this will cause an IVR error.

Regards,
Plum Support

include global property "grammarmaxage" in IVR scr

Posted: Tue Sep 25, 2007 2:11 pm
by support
Hi,

In your IVR script, you also might want to include the IVR global property, "grammarmaxage" to ensure that a fresh copy of the IVR grammar file will always be fetched by the IVR server.

To do this, you would type:

Code: Select all

<property name="grammarmaxage" value="0s"/>
Regards,
Plum Support

Posted: Tue Sep 25, 2007 2:13 pm
by moshe
Ah. The validator explicitly invites me to input a URL, so I of course assumed it meant the URL of a grammar file.

I tried the grammar multiple times in live calls. I have just re-vamped (again) the grammar file again, as seen in this grammar.

At present this works, to my great surprise. I sincerely have no idea why it failed in the past, under essentially the same circumstances and with the same grammar element attributes. I am fairly certain it's not a caching issue; I went so far as to test the order in which the different attributes appear in the element.

Thank you for your assistance.