We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

ruleref to external URIs supported?

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
sightplan
Posts: 17
Joined: Wed Feb 25, 2015 3:47 pm

ruleref to external URIs supported?

Post 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!

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

Re: ruleref to external URIs supported?

Post 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

Post Reply