How do I resolve issues with grammar types that are reported to be unsupported?
Symptoms
I get error messages saying that the grammar type I am using is not supported by the media platform. I have already checked the media platform documentation and according to this my grammar type is supported.
Resolution
Grammars are typically delivered to the media platform via HTTP. They are either directly delivered by VoiceObjects Server (e.g.embedded grammars) or by external resource servers.
When an HTTP server delivers content to a client (in this case to the media platform) it is expected to inform the client what kind of content is being returned by means of the HTTP content type header. Sometimes the content type is also called MIME type. The client usually interprets the content type and processes the content accordingly. If no value is given for the content type the client may attempt to guess the content type.
Besides the HTTP level setting of content types, types for grammars can also be set in the VoiceXML code in the type attribute of the <grammar> tag.
If the content type for the grammar files is set to the wrong value or is not set at all the media platform can misinterpret the grammar, which leads to different kinds of errors.
Check the content type setting of the HTTP server
When using the Web application server that is running VoiceObjects Server to deliver the grammars (e.g. Jetty or Tomcat), make sure the content types are set correctly in the file web.xml.VOServer.
To set the content types, add the following lines to the file web.xml.VOServer after the <session-config> block:
<mime-mapping>
<extension>gsl</extension>
<mime-type>application/x-gsl</mime-type>
</mime-mapping>
<mime-mapping>
<extension>jsgf</extension>
<mime-type>application/x-jsgf</mime-type>
</mime-mapping>
<mime-mapping>
<extension>grxml</extension>
<mime-type>application/srgs+xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>gram</extension>
<mime-type>application/srgs</mime-type>
</mime-mapping>
Make sure that you take the corresponding types for the platform you are using. There are a couple of proprietary formats that can cause problems. One example is the Nuance OSR SpeechWorks system, that expects the content type of .gram files to be application/x-swi-grammar for compiled grammars.
If you use a chain of Web servers and/or proxies to pass the grammar file from the resource server to the media platform, make sure the content types are properly configured for all servers involved.
Check the type setting in the Grammar object
The second configuration setting to be checked is the type setting of the respective Grammar objects. For each Grammar object the value of the type parameter must match the actual type of the grammar.