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

grammer question

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
jcooper
Posts: 45
Joined: Tue Jul 22, 2008 5:22 pm

grammer question

Post by jcooper »

Hi,
I am trying to implement a grammar that allows the user to select more than 10 options. Below is the grammar I am using but it isn't working, i think, because there is no "11" key on the phone. How would i implement something like this?
Thanks,
JC

<grammar type="application/srgs+xml" root="ReadConfirm" mode="dtmf" version = "1.0">
<rule id="ReadConfirm" scope="private">
<one-of>
<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>10</item>
<item>11</item>
<item>*</item>
</one-of>
</rule>
</grammar>

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

IVR code example to test grammar

Post by support »

Hi,

Actually, your IVR grammar does "work" where if the user enters "11" on the touch tone keypad, it gets matched to "11" in the IVR <grammar>. You can use the following IVR code example to test this:

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0">
<form>
  <field name="num">
    <grammar type="application/srgs+xml" root="ReadConfirm" mode="dtmf">
      <rule id="ReadConfirm" scope="private">
        <one-of>
          <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>10</item>
          <item>11</item>
          <item>*</item>
        </one-of>
      </rule>
    </grammar>

    <prompt>
      Please enter a number greater than 10.
    </prompt>

    <filled>
      <prompt>
        You entered <value expr="num"/>.
      </prompt>
    </filled>

  </field>
</form>
</vxml>
If this is not what you want your IVR grammar to do, could you please further clarify what you would like your grammar to do?

Regards,
Plum Support
Last edited by support on Wed Feb 17, 2010 1:01 pm, edited 4 times in total.

jcooper
Posts: 45
Joined: Tue Jul 22, 2008 5:22 pm

Post by jcooper »

if you add the below to the filled tag it does not work.

<filled>
<if cond="num=='1'">
<prompt>this will work</prompt>
<elseif cond="num='11'"/>
<prompt>this will not work...</prompt>
<else/>
<prompt>...instead this will be read.</prompt>
</if>
</filled>

I've tried it with and without single quotes with no success. Please be advised I am using the Nuance OSR... and no, AT&T is not an option.

jcooper
Posts: 45
Joined: Tue Jul 22, 2008 5:22 pm

grammar ?

Post by jcooper »

OK, I found the issue. It was putting a space between the 1.. so i entered: '11' and it came back with '1 1'.. cheeky. I've added a script tag:

Code: Select all

<script>
<![CDATA[
num = num.replace(/ /g,'');
]]></script>
which seems to work fine.

Post Reply