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

Grammar Question

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
srmoser430
Posts: 20
Joined: Thu Oct 19, 2017 3:40 pm

Grammar Question

Post by srmoser430 »

Hi Team,

I’m trying to define a field grammar that allows for entry of values 1-99 or *

I’ve tried two approaches: (1) type=“digits?maxlength=2” and (2) setting a field-level jsgf grammar (with mode=“dtmf”) that looks like this: ( 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | “*” )+

Approach 1 gets me the right value but doesn’t recognize “*” input

Approach 2 only yields the 1st digit of input (e.g. I enter 11 but only receive 1 in the field variable) but allows for the entry of “*”

Your help is very much appreciated.

Thanks...Scott

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

Re: Grammar Question

Post by support »

Hi Scott,

This is the approach you should be using:

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0">
<property name="inputmodes" value="dtmf"/>
<form id="form1">
  <field name="field1" type="digits?maxlength=2">
    <grammar type="application/x-jsgf" mode="dtmf">"*"</grammar>
    <prompt>Please enter 1-2 digits or star.</prompt>
    <filled>
      <prompt bargein="false">
        You entered: <value expr="field1"/>
      </prompt>
      <goto next="#form1"/>
    </filled>
  </field>
</form>
</vxml>


srmoser430
Posts: 20
Joined: Thu Oct 19, 2017 3:40 pm

Re: Grammar Question

Post by srmoser430 »

That worked. Thanks for your help!

Post Reply