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

How to define a grammar of numbers and asterisk for a field?

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
dking
Posts: 15
Joined: Thu Jun 10, 2004 1:44 pm

How to define a grammar of numbers and asterisk for a field?

Post by dking »

I want it to be defined in ABNF-XML (SRGS-XML) so my application is as platform independent as possible. I used the SRGS spec as a reference: http://www.w3.org/TR/speech-grammar/

The digits built-in grammar doesn't work for me since I need to support phone extensions (asterisk). Since PlumVoice does not support the phone or telephone built-in grammar, I have to create one myself that supports phone extensions. This is what I've been able to come up with, but the asterisk still isn't recogized:

Code: Select all

  <field name="callbackNumField">
    <grammar type="application/srgs+xml" root="phone">
      <rule id="values">
       <one-of>
         <item> 0 </item>
         <item> 1 </item>
         <item> 2 </item>
         <item> 3 </item>
         <item> 4 </item>
         <item> 5 </item>
         <item> 6 </item>
         <item> 7 </item>
         <item> 8 </item>
         <item> 9 </item>
         <item> "*" </item>
       </one-of>
      </rule>
      <rule id="phone" scope="public">
       <one-of>
         <item>
           <item repeat="0-"><ruleref uri="#values"/></item>
         </item>
       </one-of>
      </rule>
    </grammar>
    <prompt>
      Please enter the phone number, including area code,
      where you may be contacted.  Use * to specify an extension.
    </prompt>
    <noinput>
      <reprompt/>
    </noinput>
    <nomatch>
      I'm sorry, the value you entered is invalid.
      <reprompt/>
    </nomatch>
  </field>

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

IVR code fix for <item> tag

Post by support »

Hello dking!

The reason your vxml is not working is due to the way you are declaring your <item> tags. I have taken the liberty of fixing your IVR code and testing it. Try this:

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0">
<form>
<field name="callbackNumField">
    <grammar type="application/srgs+xml" root="phone">
      <rule id="values">
       <one-of>
         <item>0</item>
         <item>1</item>
         <item>2</item>
         <item>3</item>
         <item>4</item>
         <item>5</item>
         <item>6</item>
         <item>7</item>
         <item>8</item>
         <item>9</item>
         <item>"*"</item>
       </one-of>
      </rule>
      <rule id="phone" scope="public">
       <one-of>
         <item>
           <item repeat="0-"><ruleref uri="#values"/></item>
         </item>
       </one-of>
      </rule>
    </grammar>
    <prompt>
      Please enter the phone number, including area code,
      where you may be contacted.  Use * to specify an extension.
    </prompt>
    <noinput>
      <reprompt/>
    </noinput>
    <nomatch>
      I'm sorry, the value you entered is invalid.
      <reprompt/>
    </nomatch>
    <filled>
      you entered
      <value expr="callbackNumField"/>
      <clear namelist="callbackNumField"/>
      <reprompt/>
    </filled>
  </field> 
</form>
</vxml>
hope this helps! :)

kind regards,

Plum Support

Post Reply