Page 1 of 1

ruleref to external URIs supported?

Posted: Fri Jun 26, 2015 12:57 pm
by sightplan
Hey guys,

Just wanted to check with you and confirm whether or not you support a ruleref to an external grammar file: My testing so far shows that this isn't working, and the documentation hints that this might only be supported for a local rule within the same grammar file.

So far I have tried the following from Scratchpad with no luck:

Code: Select all

 <rule id="ISSUEDETAIL_RULE">
    <one-of>
     <item>
      <ruleref uri="http://myServer.com/apps/ivr/testRuleRef.xml#MYRULE"/>
     </item>
    ...
 </rule>
Note that the fragment above has been added to a confirmed-to-be working grammar, and the ruleref uri also points to a grammar known to be working. The log output isn't very specific as to what the problem might be in this case.

As an additional question, is specifying a relative value accepted when both grammar files are on the same host server?

Code: Select all

<ruleref uri="testRuleRef.xml#MYRULE"/>
Thanks!

Re: ruleref to external URIs supported?

Posted: Fri Jun 26, 2015 3:43 pm
by support
Hi,

It is possible to load a rule from an external grammar file. We've modified the basic example from the ruleref documentation itself as a sample. If this example does not help you determine what might be the issue in your case, please post what you can of your specific grammar file and we'll try and give you some insight as to what might be the issue.

test.vxml

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0">
  <form id="start">
    <field name="test_field">
      <grammar root="main" type="application/srgs+xml" version="1.0" mode="voice">
        <rule id="main" scope="public">
          <item>
            <ruleref uri="http://example.com/test_grammar.grxml#month"/>
          </item>
          <tag> month = month.SWI_literal; </tag>
        </rule>
      </grammar>

      <prompt>Please say a month.</prompt>
      
      <filled>
        <prompt bargein="false">
          I think you said <value expr="test_field.month"/>.
        </prompt>
      </filled>
    </field>
  </form>
</vxml>
And then the external grammar file (test_grammar.grxml):

Code: Select all

<?xml version="1.0"?>
<grammar root="month" version="1.0" xml:lang="en-US">
  <rule id="month" scope="public">
    <one-of>
      <item>May</item>
      <item>June</item>
      <item>October</item>
    </one-of>
  </rule>
</grammar>
If you were to call and say June, May, or October, this will work as expected.

We have found that attempting to use a relative path (when the file is in the same directory), such as:

Code: Select all

<ruleref uri="test_grammar.grxml#month"/>
does not work, and it needs to be a valid URI (or just #item, if the rule is in the same file).

Please let us know if you have any questions.

Regards,
Plum Support