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

Takes any answer?

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
goochalba
Posts: 18
Joined: Wed Jun 13, 2012 9:01 pm

Takes any answer?

Post by goochalba »

Hi,

I am trying to set up a simple pin number authentication. And I have the following code

Code: Select all

<vxml version="2.0">
  <form id="getpin">
    <field name="pinnumber" type="digits">
      <grammar type="application/x-jsgf" mode="voice">
        8210
      </grammar>
      <prompt>
        Please say your login code.
      </prompt>
      <filled>
        <assign name="UserID" expr="'2'"/>
        <submit next="menu.jsp" namelist="UserID"/>
      </filled>
      <nomatch>
          You have entered an invalid pin. Try again.
          <reprompt/>
      </nomatch>
    </field>
  </form>
</vxml>

But it seems to take any answer and not just my pin. Any idea what I might be doing wrong?

Thanks!

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

Re: Takes any answer?

Post by support »

Hi,

You are using two grammars: the built in "digits" grammar and your own x-jsgf grammar. The "digits" grammar will accept all digits. To fix this, use only your own x-jsgf grammar.

Regards,
Plum Support

goochalba
Posts: 18
Joined: Wed Jun 13, 2012 9:01 pm

Re: Takes any answer?

Post by goochalba »

Ah ok I see. I was thinking that I had to make my grammar of a specific type. But I guess it doesnt matter it is smart enough to take input as digits. But lets say I had a custom grammar and I wanted them to say
"Eight thousand two hundred and ten"
versus
"Eight"
"Two"
"One"
"Zero"
?

And thanks so much for helping me resolve this!

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

Re: Takes any answer?

Post by support »

Hi,

The current code that you have, once you remove the built-in digits grammar (type="digits"), that'll take care of the case where you want the user to say, "Eight thousand two hundred and ten".

The following code example can be used for the case where you want the user to say, "eight two one zero":

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>

<vxml version="2.0">
  <form id="getpin">
    <field name="pinnumber" type="digits?length=4">
      <prompt>
        Please say your login code.
      </prompt>
      <filled>
        <if cond="pinnumber==8210">
          <prompt>
            That's the correct pin.
          </prompt>
        <else/>
          <prompt>
            That pin is incorrect.
          </prompt>
          <clear namelist="pinnumber"/>
          </if>
      </filled>
      <nomatch>
          You have entered an invalid number of digits. Try again.
          <reprompt/>
      </nomatch>
    </field>
  </form>
</vxml>
Hope this helps.

Regards,
Plum Support

Post Reply