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

Validating variable against list

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

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

Re: Validating variable against list

Post by support »

Hi,

It tends to be difficult to deal with alphanumeric grammars within IVR applications. To get around this limitation we had split up the grammars. This code assumes that the last 2 numbers within the jcode were actual digits. There is one issue with separating the grammars in this fashion. The grammars require a pause between entering the first portion of the input and the second. To make sure the users correctly input the jcode, you may want to prompt them to enter the first portion followed by a pause and then the second portion.

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0">
  <form id="jcode">
    <property name="interdigittimeout" value="5s"/>
    <field name="myvar1">
      <grammar type="application/srgs+xml" root="start_voice" mode="voice">
	<rule id="start_voice">
	  <one-of>
	    <item> 920 </item>
	    <item> 992 </item>
	    <item> S06 </item>
	    <item> J12 </item>
	  </one-of>
	</rule>
      </grammar>
      <prompt bargein="true">
	<audio src="http://audio.plumgroup.com/root/cvc4.wav">
	  Please speak or key in the J-CODE for the service provided.
	</audio>
      </prompt>
    </field>
    <field name="myvar2" type="digits?length=2">
      <prompt/>
      <filled>
	<script>
	  total = myvar1 + myvar2
	</script>
	<assign name="jcode" expr="total"/>
      </filled>
      <noinput>
	<prompt bargein="false">
	  <audio src="http://audio.plumgroup.com/root/999999_163.wav">
	    I'm sorry, but I did not get your response.
	  </audio>
	</prompt>
	<reprompt/>
      </noinput>
    </field>
  </form>
</vxml>
Hope this help!

Regards,
Plum Support

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

Using IVR alphanum grammar

Post by support »

Hi,

We have an undocumented IVR grammar entitled alphanum. We can't guarantee that this would be best for your application but we hope that it will help. The alphanum grammar works only with voice commands and to limit the amount of mistakes that may occur while using it we've modified the confidence and sensitivity levels. The alphanum grammar also adds in spaces between each entry, for example, 9 2 3 6 5 7 8 A P.

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0">
  <form id="jcode">
    <property name="sensitivity" value="0.2"/>
    <property name="confidencelevel" value="0.75"/>
    <field name="myvar">
      <grammar version="1.0" type="application/srgs+xml" root="_root" mode="voice">
	<rule id="_root">
	  <item repeat="4-10">
	    <ruleref uri="builtin:grammar/alphanum?entries=http://www.plumvoice.com/example/a_thru_0.txt"/>
	  </item>
        </rule>
      </grammar>
      <prompt bargein="true">
	<audio src="http://audio.plumgroup.com/root/cvc4.wav">
	  Please speak or key in the J-CODE for the service provided.
	</audio>
      </prompt>
      <filled>
	<assign name="jcode" expr="myvar"/>
      </filled>
      <noinput>
	<prompt bargein="false">
	  <audio src="http://audio.plumgroup.com/root/999999_163.wav">
	    I'm sorry, but I did not get your response.
	  </audio>
	</prompt>
	<reprompt/>
      </noinput>
    </field>
  </form>
</vxml>
The text file 'a_thru_0.txt' should be a page with A-Z and 0-9 with each character on its own line and without any extra spaces.

Code: Select all

A
B
C
...
7
8
9
Hope this helps!

Regards,
Plum Support

Post Reply