I like to include an external jsgf grammar file but it always failed. What's the sample format of the grammar file?
I have following sample to test but failed
In VXML
<form id="test">
<field name="answer">
<grammar srcexpr="grammar_url' + '/menu/navigations2.gram'" type="application/x-jsgf"/>
</field>
</form>
In grammar file
#JSGF V1.0;
<![CDATA[
grammar navigations1;
public <navigations1> = [puppy|kitten|turtle];
]]>
We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics
jsgf file format
Re: jsgf file format
Hi xzhang,
Here is a sample IVR application on how to include an external JSGF grammar file and how you can format your JSGF file:
xzhangexternalgrammar.php:
remotegrammar.grxml:
From this example, the IVR application points to a remote grammar using the "srcexpr" attribute from the <grammar>. Within the remote grammar, note that the grammar type is set to a JSGF grammar that accepts a voice input match for either puppy, kitten, or turtle.
For more information on grammars, you can view our hosting documentation here:
http://www.plumvoice.com/docs/dev/devel ... ce:grammar
http://www.plumvoice.com/docs/dev/voicexml:tags:grammar
Hope this helps.
Regards,
Plum Support
Here is a sample IVR application on how to include an external JSGF grammar file and how you can format your JSGF file:
xzhangexternalgrammar.php:
Code: Select all
<?php
header("Content-type: text/xml");
echo "<?xml version=\"1.0\"?>\n";
?>
<vxml version="2.0">
<form id="test">
<var name="grammar_url" expr="'http://your.server.com/~xzhang/'"/>
<field name="answer">
<grammar srcexpr="grammar_url + 'remotegrammar.grxml'" type="application/x-jsgf"/>
<prompt>
Pick an animal: puppy, kitten, or turtle?
</prompt>
<filled>
<prompt>
You said <value expr="answer"/>.
</prompt>
</filled>
</field>
</form>
</vxml>
Code: Select all
<?xml version="1.0"?>
<grammar type="application/x-jsgf" mode="voice">
puppy | kitten | turtle
</grammar>
For more information on grammars, you can view our hosting documentation here:
http://www.plumvoice.com/docs/dev/devel ... ce:grammar
http://www.plumvoice.com/docs/dev/voicexml:tags:grammar
Hope this helps.
Regards,
Plum Support
Plum Support
http://www.plumvoice.com
http://www.plumvoice.com
Re: jsgf file format
I have copied your sample code but I still got "missing ; in first line ...." javascript error
Re: jsgf file format
Hi xzhang,
Are you still having this error? We have tested this example again and haven't come across any issues with it.
Also, where are you copying this sample code into?
Regards,
Plum Support
Are you still having this error? We have tested this example again and haven't come across any issues with it.
Also, where are you copying this sample code into?
Regards,
Plum Support
Plum Support
http://www.plumvoice.com
http://www.plumvoice.com