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

digit length... 7 or 10 digits

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
brent.russell
Posts: 50
Joined: Wed Oct 04, 2006 1:34 pm
Location: SOCAL
Contact:

digit length... 7 or 10 digits

Post by brent.russell »

I am trying to force people to only enter in 7 digits or 10 digits but this does not work: type="digits?length=10|7"
If there is no way to do it in the field tag is there a way I can run it through an if statement and check the length of what they entered?

something like this:

Code: Select all

<property name="interdigittimeout" value="2s"/>
<field name="enterNumber" type="digits">
 <prompt timeout="8s">
  <audio expr="http://myfile.com/US2.1.mp3'">Please enter your cell phone number</audio>
 </prompt>

 <filled>
  <if cond="enterNumber.length = 10">
    <audio expr="http://myfile.com/US3_.mp3'">You have not entered a 7 or 10 digit number</audio>
    <goto next="#getNumber" />
  <elseif cond="enterNumber.length = 7"/>
    <assign name="document.tempPhoneNumber" expr="enterNumber"/>
    <goto next="#readmsisdn"/>
  </if>
 </filled>
Problem with that is I don't know how to get the length of what they entered I am sure it is not enterNumber.length.

Can someone give me an option that will work?

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

include any builtin grammar types the IVR platform supports

Post by support »

Hi Brent,

Rather than using <field type="digits">, you can use or "stack" two <grammar> tags with an explicit src attribute:

Code: Select all

<field name="enterNumber">
  <grammar src="builtin:dtmf/digits?length=7"/>
  <grammar src="builtin:dtmf/digits?length=10"/>
...
After the slash in the above IVR examples, you can include any of the builtin IVR grammar types the IVR platform supports (list found here)

Also, enterNumber.length is actually the correct way to get the length of a string, but your predicate is using a single equal sign (=, assign) instead of a double (==, check equality), so that might be why your IVR example wasn't working for you.

Regards,
Plum Support

Post Reply