Page 1 of 1

Grammar Question

Posted: Mon Oct 30, 2017 3:29 pm
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

Re: Grammar Question

Posted: Tue Oct 31, 2017 9:26 am
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>


Re: Grammar Question

Posted: Tue Oct 31, 2017 6:44 pm
by srmoser430
That worked. Thanks for your help!