Page 1 of 1
Taking time as user input
Posted: Tue Apr 07, 2009 7:25 am
by amitkhosla
How can i take the time as input from the user both as dtmf & voice mode.
Can you please tell me the write syntax for the below code and can you provide a code sample and the appropriate input value that it can take
<field name="appTime">
<prompt>
Please enter or say the time of your appointment.
Enter the hour and min followed by the pound sign.
</prompt>
<grammar src="builtin:grammar/time"/>
<grammar src="builtin:dtmf/time"/>
<filled>
<assign name="appointmentTime" expr="appTime"/>
</filled>
</field>
Re: Taking time as user input
Posted: Tue Apr 07, 2009 9:51 am
by amitkhosla
Please someone help me on this.
regards,
amit
amitkhosla wrote:How can i take the time as input from the user both as dtmf & voice mode.
Can you please tell me the write syntax for the below code and can you provide a code sample and the appropriate input value that it can take
<field name="appTime">
<prompt>
Please enter or say the time of your appointment.
Enter the hour and min followed by the pound sign.
</prompt>
<grammar src="builtin:grammar/time"/>
<grammar src="builtin:dtmf/time"/>
<filled>
<assign name="appointmentTime" expr="appTime"/>
</filled>
</field>
IVR grammar for time
Posted: Tue Apr 07, 2009 10:32 am
by support
Hi,
So, taking your IVR example, that is the correct way of using the
built-in IVR grammar for time.
Code: Select all
<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
<form>
<field name="appTime">
<grammar src="builtin:grammar/time"/>
<grammar src="builtin:dtmf/time"/>
<prompt>
Please enter or say the time of your appointment.
Enter the hour and min followed by the pound sign.
</prompt>
<filled>
<prompt>
You said <value expr="appTime"/>.
</prompt>
</filled>
</field>
</form>
</vxml>
As for the inputs that it can take, our IVR documentation explains:
Valid spoken inputs include phrases that specify a time, including hours and minutes. The result is a five character string in the format hhmmx, where x is one of "a" for AM, "p" for PM, "h" to indicate a time specified using 24 hour clock, or "?" to indicate an ambiguous time. Input can be via DTMF. Because there is no DTMF convention for specifying AM/PM, in the case of DTMF input, the result will always end with "h" or "?". If the field is subsequently used in <say-as> with the interpret-as value "vxml:time", it will be spoken as a time appropriate to the current language. Note: This works only for Nuance OSR engines.
So, you would be able to say times like "1:30PM" or enter times with DTMF keys such as "1600". From there, you would have to parse the results to however you would like.
Regards,
Plum Support