Grammar Question

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

  • Author
  • Message
Offline

srmoser430

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

Grammar Question

PostMon Oct 30, 2017 3:29 pm

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
Offline

support

  • Posts: 3544
  • Joined: Mon Jun 02, 2003 3:47 pm
  • Location: Boston, MA

Re: Grammar Question

PostTue Oct 31, 2017 9:26 am

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>

Offline

srmoser430

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

Re: Grammar Question

PostTue Oct 31, 2017 6:44 pm

That worked. Thanks for your help!

Return to Plum DEV Q&A

Who is online

Users browsing this forum: No registered users and 1 guest

cron