Hi
I have a requirement something like this.
User should be prompted with a message to input how many days before he wants to get an alert? Means like if he "SAYS" 23 days that means that 23 days before a schedule meeting time will update the user that he has an appointment 23 days from today.
Now I want to know if we can define range while defining voice mode grammer... I actually want the field to store value like 23 days when user says "twenty three days"
<grammar type="application/x-jsgf" mode="voice">
(one{1} | two{2} .. onehundred{100})+(years|year|months|month|days|day|weeks|week)
</grammar>
Here is the code
------------------------------------
<?xml version="1.0"?>
<vxml version="2.0">
<form id="date_frm">
<field name="alertBefore">
<grammar type="application/x-jsgf" mode="voice">
(one{1} | two{2} .. onehundred{100})+(years|year|months|month|days|day|weeks|week)
</grammar>
<prompt>
Enter how many days before you want the alert?
</prompt>
<filled>
you entered <value expr="alertBefore"/>
<reprompt/>
</filled>
</field>
</form>
</vxml>
We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics
Can Range be defined in Grammer
-
- Posts: 53
- Joined: Sun Feb 15, 2009 11:42 pm
- Contact:
Defining a range within IVR code
Hi,
The following example of IVR code should help you get started (at least with defining a range). Please note the IVR tags, <ruleref>, and how to <grammar> were implemented:
Then, once you have the string, you can use javascript to check the string. For IVR example, if the user said "2 weeks", you could use javascript to check for the string, "week", in it, and then multiply the value, 2, by 7 to get the number of days.
Hope this helps.
Regards,
Plum Support
The following example of IVR code should help you get started (at least with defining a range). Please note the IVR tags, <ruleref>, and how to <grammar> were implemented:
Code: Select all
<?xml version="1.0"?>
<vxml version="2.0">
<form id="start">
<field name="dt">
<grammar root="main" type="application/srgs+xml" mode="voice">
<rule id="main" scope="public">
<ruleref uri="builtin:grammar/number?minallowed=1;maxallowed=100;maxdecimal=0"/>
<item>
<one-of>
<item>day</item>
<item>days</item>
<item>week</item>
<item>weeks</item>
<item>month</item>
<item>months</item>
<item>year</item>
<item>years</item>
</one-of>
</item>
</rule>
</grammar>
<prompt>Enter how many days before you want the alert?</prompt>
<filled>
<prompt bargein="false">
I think you said <value expr="dt"/>.
</prompt>
</filled>
<nomatch>
I'm sorry, I didn't catch that.
<reprompt/>
</nomatch>
</field>
</form>
</vxml>
Hope this helps.
Regards,
Plum Support
Last edited by support on Wed Feb 24, 2010 2:18 pm, edited 8 times in total.
Plum Support
http://www.plumvoice.com
http://www.plumvoice.com
-
- Posts: 53
- Joined: Sun Feb 15, 2009 11:42 pm
- Contact: