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

format for date input

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
jverweij
Posts: 79
Joined: Thu Apr 27, 2017 11:29 am

format for date input

Post by jverweij »

Hi
We would like to ask a user to provide us a full birth date as mmddyyyy by either speaking it or entering it on the keypad. It seems though that we cannot do this using the same prompt: "Please say or enter on your phone's keypad, your full date of birth." If we ask separately for the member to speak their date they can say it mmddyyyy. If we ask separately for the member to enter it DTMF they can enter it mmddyyyy. But if we do it as one prompt the member can say it mmddyyyy but has to enter it as yyyymmdd. Is there a way to use the same format and accept speech or DTMF in one prompt?

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

Re: format for date input

Post by support »

Can you please provide us with a little more detail regarding both your expectations of what the caller can say or type and what format you wish the date to be reported back in a variable? For instance, is your intent to have the user either say 'January twenty-sixth two thousand eighteen' or type in via DTMF '01262018' with the IVR filling in the variable with '20180126'?


Regards,
Plum Support

jverweij
Posts: 79
Joined: Thu Apr 27, 2017 11:29 am

Re: format for date input

Post by jverweij »

Yes. We would like the user to be able to ask the user to provide us a date by either saying it or entering on the phone's keypad as mmddyyyy. So, the user can say "january twelfth two thousand eighteen" or enter 01122018 on the keypad and have the IVR save it as mmddyyyy.

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

Re: format for date input

Post by support »

The built-in date grammar will always expect dates to be entered via keypad/DTMF with the format YYYYMMDD. So one workaround would be to set explicit grammars within your field to simply accept 8 digits (see where it says "type='digits length=8'") and to simultaneously listen for the date grammar. Once the input is collected, the script checks the shadow variable and if it determines that it was speech entry, then you know the returned variable will need to be rewritten as MMDDYYYY.

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0">
  <form>
    <field name="thedate">

      <!-- Setting the mode to voice restricts the official date grammar to speech -->
      <grammar src="builtin:grammar/date" mode="voice"/>
      <!-- Setting the mode to dtmf restricts the digits grammar to dtmf -->
      <grammar src="builtin:dtmf/digits?length=8" mode="dtmf"/>

      <!-- Please note that the DTMF input is an 8-digit unvalidated string. -->
      <prompt>
        Say the day, month, and year or enter the date as month month day day year year
        year year followed by the pound sign on your telephone keypad.
      </prompt>

      <filled>
        <!-- If speech, rather than DTMF, was detected, we have to re-arrange the results. -->
        <if cond="application.lastresult$[0].inputmode == 'voice'">
          <assign name="thedate" expr="thedate.substr(4,2)+thedate.substr(6,2)+thedate.substr(0,4)"/>
        </if>
        <prompt>
          You entered <say-as type="digits"><value expr="thedate"/></say-as>
        </prompt>
      </filled>

    </field>
  </form>
</vxml>
Hope this proves helpful.

Regards,
Plum Support

jverweij
Posts: 79
Joined: Thu Apr 27, 2017 11:29 am

Re: format for date input

Post by jverweij »

Thank you. We are able to get this to work generally, but have been unable to get it to end digit input promptly.

This means, after entering 8 digits, the system waits until the 5 second timeout before sending the digits and proceeding. Since we are limiting it to 8 digit input how we get it to end promptly when those 8 digits are provided instead of waiting for the 5 second time out?

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

Re: format for date input

Post by support »

Hi,

You can add "<property name="termmaxdigits" value="true"/>" to your <field> block. This tells the platform to immediately timeout upon receiving a number of DTMF digits equal to the set length. Please note that this property only works in unambiguous situations; in other words, it will not work if there are any other DTMF grammars active within the <field>.

Regards,
Plum Support

jverweij
Posts: 79
Joined: Thu Apr 27, 2017 11:29 am

Re: format for date input

Post by jverweij »

Thanks. We tried that and are still getting a 5 second pause after entering 8 digits. Here's the complete VXML I'm using as a POC (minus our credentials)

<vxml version="2.1">
<var expr="'1'" name="call_id"/>
<property name="termmaxdigits" value="true"/>
<property name="interdigittimeout" value="10ms"/>
<property name="timeout" value="5s"/>
<property name="completetimeout" value="1s"/>
<property name="bargein" value="false"/>
<property name="sensitivity" value="0.2"/>
<catch event="connection.disconnect.hangup error.disconnect.hangup">
<var expr="'disconnect'" name="key"/>
<var expr="'true'" name="value"/>
<data accept="application/json" method="post" name="record_response" namelist="call_id key value" src="http://novu:15005/api/ivr/v2/call_responses"/>
<exit/>
</catch>
<form>
<block>
<goto next="#app_builder_main_form_id"/>
</block>
</form>
<form id="app_builder_main_form_id">
<property name="interdigittimeout" value="5s"/>
<field name="dbdebfafead">
<property name="termmaxdigits" value="true"/>
<grammar mode="voice" src="builtin:grammar/date"/>
<grammar mode="dtmf" src="builtin:dtmf/digits?length=8"/>
<prompt>
<prosody rate="100%">Please enter or say a date</prosody>
</prompt>
<filled>
<var expr="'after_first_prompt'" name="goto_next"/>
<var expr="dbdebfafead" name="submitted"/>
<var expr="'date'" name="submitted_type"/>
<submit method="post" namelist="call_id goto_next submitted submitted_type" next="http://novu:15005/api/ivr/v2/ivr_applications/submitted"/>
</filled>
</field>
</form>
</vxml>

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

Re: format for date input

Post by support »

Hi,

It looks like you've uncovered a strange behavior in our platform that we failed to catch when we sent back the sample code snippet. When the termmaxdigits property is set to true and there is only the DTMF grammar declared in the field, everything works exactly as expected -- once 8 digits are entered, the input is immediately accepted by the VoiceXML platform. However, when a builtin grammar that has DTMF capability -- even if its mode is set only to voice -- is mixed in, the termmaxdigits property is set back to false.

This has been escalated to platform engineering for further investigation. Thank you for discovering this strange behavior! We try to be thorough in our testing, but sometimes customers find things unexpected in our platform and we love having the opportunity to directly address those issues and, consequently, improve our product.

In the meantime, we'd recommend setting the timeout property to 5 seconds while reducing interdigittimeout to no more than 3 seconds as a best practice. You want to give your callers a chance to get access to their phone keypad but, in our experience, once the caller starts tapping out a date, the data collection proceeds quite quickly.

Regards,
Plum Support

jverweij
Posts: 79
Joined: Thu Apr 27, 2017 11:29 am

Re: format for date input

Post by jverweij »

Thanks for the update. Glad we could it! Do you have an ETA? It could be that we will wait for the fix.
Thanks!

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

Re: format for date input

Post by support »

Hi,

The request has gone to engineering and has to enter a platform dev cycle. We currently don't have an ETA for this, but we will let you know when we do.

Thanks,
Plum Support

jverweij
Posts: 79
Joined: Thu Apr 27, 2017 11:29 am

Re: format for date input

Post by jverweij »

checking in on this fix. Has this been updated yet? thanks!

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

Re: format for date input

Post by support »

Hi,

At this moment we do not have an update for the ETA - as soon was we do have one we will readily let you know. Fortunately in the meantime you can try setting the timeout property to 5 seconds while reducing interdigittimeout to no more than 3 seconds as a workaround to the issue in place.

Regards,
Plum Support

Post Reply