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

Taking time as user input

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
amitkhosla
Posts: 53
Joined: Sun Feb 15, 2009 11:42 pm
Contact:

Taking time as user input

Post 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>

amitkhosla
Posts: 53
Joined: Sun Feb 15, 2009 11:42 pm
Contact:

Re: Taking time as user input

Post 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>

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

IVR grammar for time

Post 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

Post Reply