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

<say-as type="date">

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
jallard
Posts: 21
Joined: Mon Oct 03, 2011 7:20 am

<say-as type="date">

Post by jallard »

I'm trying to get the platform to say an entered date in the actual date format, not the digits that are entered.

Code: Select all

<form id="date">
		<field name="chkdate" type="date">
			<property name="timeout" value="10s"/>
			<property name="inputmodes" value="dtmf"/>
			<prompt>
				<voice name="mike">
					Please enter the date of the check. Please enter the date in this format: 4 digit year, 2 digit month, 2 digit day. For example, January 31st 2011 would be entered as two zero one one zero one three one.
				</voice>
			</prompt>
			<filled>
				<assign name="date" expr="chkdate"/>
			</filled>
<filled>
				<prompt>
					<voice name="mike">
						You entered <say-as type="vxml:date">
							<value expr="chkdate"/>
						</say-as>
					</voice>
				</prompt>
				<goto nextitem="chkdate2"/>
			</filled>
This is just the relevant portion of the code, obviously there are closing tags as well. I'm having trouble, first off, with the system accepting the date format. Sometimes when testing I'll type the date and it will only take a few of the numbers even though I've entered all 8 digits. Secondly, I can't get the system to play back what I've input in a date format. He just says the digits as they're one full number. I've tried using multiple date "types". I've also tried changing the field type to digits. Please help.

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

Re: <say-as type="date">

Post by support »

Regarding the nomatch events, what are you inputting to create these events?

Regarding the <say-as> tag, the date needs to be formatted in a certain way for <say-as> to work properly. For example, <say-as type="date:mdy"> needs the date to be in the format mm/dd/yyyy, with the slashes included. We've included code below that illustrates how to manipulate the string with some Javascript in the expr attribute.

Code: Select all

<form id="date">
  <field name="chkdate" type="date">
    <property name="timeout" value="10s"/>
    <property name="inputmodes" value="dtmf"/>
    <prompt>
       <voice name="mike">
          Please enter the date of the check. Please enter the date in this format: 4 digit year, 2 digit month, 2 digit day. For example, January 31st 2011 would be entered as two zero one one zero one three one.
       </voice>
    </prompt>

    <filled>
       <assign name="date" expr="chkdate"/>
       <prompt>
          <voice name="mike">
             You entered 
	     <say-as type="date:mdy">
		<value expr="chkdate.substr(4,2)+'/'+chkdate.substr(6,2)+'/'+chkdate.substr(0,4)"/>
	     </say-as>
          </voice>
       </prompt>
       <goto nextitem="chkdate2"/>
    </filled>

jallard
Posts: 21
Joined: Mon Oct 03, 2011 7:20 am

Re: <say-as type="date">

Post by jallard »

I'm inputting different things in, depending on what grammar I use. I've tried date:mdy, I've tried date. I've tried inputting 20110101, 01012011, just different things. It works when I type 20110101, but only if I type it slower it seems. I've tried switching the date and it won't take it sometimes. For example, I tried entering 20110331, and I get a nomatch. I will try the code you provided and see if that helps.

jallard
Posts: 21
Joined: Mon Oct 03, 2011 7:20 am

Re: <say-as type="date">

Post by jallard »

I implemented the example code you provided. It does say the date correctly now when it actually gets the correct input. I'm still having trouble with the input though. I can't pinpoint the problem, because sometimes it works and sometimes it doesn't. According to the log, when it doesn't work, it is only capturing a few numbers out of the 8 digits that I actually type. Here is the log:

Mon 24 Oct 2011 08:42:10 AM EDT:
dtmf input: 2
Found grammar match
hypothesis #0: 2 (0.9990)
VXI::queue_prompts()
bargein set to true
INPUTMODES set to "DTMF"
Audio segment added to prompt queue from TTS application/synthesis+ssml for:
---------
<?xml version='1.0'?><speak><voice name="mike"><speak>
Please enter the date of the check. Please enter the date in this format: 4 digit year, 2 digit month, 2 digit day. For example, January 31st 2011 would be entered as two zero one one zero one three one.
</speak></voice></speak>
---------

Mon 24 Oct 2011 08:42:11 AM EDT:
VXI::field_element - activating grammars for form = 'date' formitem = 'chkdate'
VXI::do_recognition()
PromptManager::Play()
starting playback: bargein=true, inputmodes="dtmf"
Newly queued prompts are now being played

Mon 24 Oct 2011 08:42:15 AM EDT:
dtmf input: 2009

Mon 24 Oct 2011 08:42:16 AM EDT:
received event: nomatch:
bargein set to true
INPUTMODES set to "DTMF"
Audio segment added to prompt queue from TTS application/synthesis+ssml for:
---------
<?xml version='1.0'?><speak><voice name="mike"><speak>
I'm sorry, but I didn't recognize your response.
</speak></voice></speak>
---------
VXI::queue_prompts()
bargein set to true
INPUTMODES set to "DTMF"
Audio segment added to prompt queue from TTS application/synthesis+ssml for:
---------
<?xml version='1.0'?><speak><voice name="mike"><speak>
Please enter the date of the check. Please enter the date in this format: 4 digit year, 2 digit month, 2 digit day. For example, January 31st 2011 would be entered as two zero one one zero one three one.
</speak></voice></speak>
---------
VXI::field_element - activating grammars for form = 'date' formitem = 'chkdate'
VXI::do_recognition()
PromptManager::Play()
starting playback: bargein=true, inputmodes="dtmf"
Newly queued prompts are now being played

Mon 24 Oct 2011 08:42:18 AM EDT:
dtmf input: 231
received event: nomatch:
bargein set to true
INPUTMODES set to "DTMF"
Audio segment added to prompt queue from TTS application/synthesis+ssml for:
---------
<?xml version='1.0'?><speak><voice name="mike"><speak>
I'm sorry, but I still didn't recognize your response.
</speak></voice></speak>
---------
VXI::queue_prompts()
bargein set to true
INPUTMODES set to "DTMF"
Audio segment added to prompt queue from TTS application/synthesis+ssml for:
---------
<?xml version='1.0'?><speak><voice name="mike"><speak>
Please enter the date of the check. Please enter the date in this format: 4 digit year, 2 digit month, 2 digit day. For example, January 31st 2011 would be entered as two zero one one zero one three one.
</speak></voice></speak>
---------
VXI::field_element - activating grammars for form = 'date' formitem = 'chkdate'
VXI::do_recognition()
PromptManager::Play()
starting playback: bargein=true, inputmodes="dtmf"
Newly queued prompts are now being played

Mon 24 Oct 2011 08:42:30 AM EDT:
dtmf input: 20091231
Found grammar match
hypothesis #0: 20091231 (0.9990)
VXI::assign_element(name="date" expr = "chkdate")
bargein set to true
INPUTMODES set to "DTMF"
Audio segment added to prompt queue from TTS application/synthesis+ssml for:
---------
<?xml version='1.0'?><speak><voice name="mike"><speak>
You entered <say-as type="date:mdy"> 12/31/2009</say-as></speak></voice></speak>
---------
VXI::queue_prompts()
bargein set to true
INPUTMODES set to "DTMF"
Audio segment added to prompt queue from TTS application/synthesis+ssml for:
---------
<?xml version='1.0'?><speak><voice name="mike"><speak>
Please press 1 if this is correct.
Please press 2 to try again.
</speak></voice></speak>
---------
VXI::field_element - activating grammars for form = 'date' formitem = 'chkdate2'
VXI::do_recognition()
PromptManager::Play()
starting playback: bargein=true, inputmodes="dtmf"
Newly queued prompts are now being played

Mon 24 Oct 2011 08:42:40 AM EDT:
dtmf input: 2
Found grammar match
hypothesis #0: 2 (0.9990)
VXI::queue_prompts()
bargein set to true
INPUTMODES set to "DTMF"
Audio segment added to prompt queue from TTS application/synthesis+ssml for:
---------
<?xml version='1.0'?><speak><voice name="mike"><speak>
Please enter the date of the check. Please enter the date in this format: 4 digit year, 2 digit month, 2 digit day. For example, January 31st 2011 would be entered as two zero one one zero one three one.
</speak></voice></speak>
---------

Mon 24 Oct 2011 08:42:41 AM EDT:
VXI::field_element - activating grammars for form = 'date' formitem = 'chkdate'
VXI::do_recognition()
PromptManager::Play()
starting playback: bargein=true, inputmodes="dtmf"
Newly queued prompts are now being played

Mon 24 Oct 2011 08:42:46 AM EDT:
dtmf input: 2011
received event: nomatch:
bargein set to true
INPUTMODES set to "DTMF"
Audio segment added to prompt queue from TTS application/synthesis+ssml for:
---------
<?xml version='1.0'?><speak><voice name="mike"><speak>
I'm sorry, but I didn't recognize your response.
</speak></voice></speak>
---------
VXI::queue_prompts()
bargein set to true
INPUTMODES set to "DTMF"
Audio segment added to prompt queue from TTS application/synthesis+ssml for:
---------
<?xml version='1.0'?><speak><voice name="mike"><speak>
Please enter the date of the check. Please enter the date in this format: 4 digit year, 2 digit month, 2 digit day. For example, January 31st 2011 would be entered as two zero one one zero one three one.
</speak></voice></speak>
---------

Mon 24 Oct 2011 08:42:47 AM EDT:
VXI::field_element - activating grammars for form = 'date' formitem = 'chkdate'
VXI::do_recognition()
PromptManager::Play()
starting playback: bargein=true, inputmodes="dtmf"
Newly queued prompts are now being played

Mon 24 Oct 2011 08:42:49 AM EDT:
dtmf input: 531
received event: nomatch:
bargein set to true
INPUTMODES set to "DTMF"
Audio segment added to prompt queue from TTS application/synthesis+ssml for:
---------
<?xml version='1.0'?><speak><voice name="mike"><speak>
I'm sorry, but I still didn't recognize your response.
</speak></voice></speak>
---------
VXI::queue_prompts()
bargein set to true
INPUTMODES set to "DTMF"
Audio segment added to prompt queue from TTS application/synthesis+ssml for:
---------
<?xml version='1.0'?><speak><voice name="mike"><speak>
Please enter the date of the check. Please enter the date in this format: 4 digit year, 2 digit month, 2 digit day. For example, January 31st 2011 would be entered as two zero one one zero one three one.
</speak></voice></speak>
---------
VXI::field_element - activating grammars for form = 'date' formitem = 'chkdate'
VXI::do_recognition()
PromptManager::Play()
starting playback: bargein=true, inputmodes="dtmf"
Newly queued prompts are now being played

Mon 24 Oct 2011 08:42:58 AM EDT:
dtmf input: 2011

Mon 24 Oct 2011 08:42:59 AM EDT:
received event: nomatch:
bargein set to true
INPUTMODES set to "DTMF"
Audio segment added to prompt queue from TTS application/synthesis+ssml for:
---------
<?xml version='1.0'?><speak><voice name="mike"><speak>
I'm sorry, but I still didn't recognize your response. Goodbye.
</speak></voice></speak>
---------
VXI::exit_element()
starting playback: bargein=true, inputmodes="dtmf"
Newly queued prompts are now being played
Call End Event
Ending session
Ending Session On Channel 11

Like I said, sometimes it works and sometimes it doesn't. I also run into the problem where on the last nomatch count, it will hang up the call instead of playing the prompt. The log, however, acts as though the prompt was played. Any help would be appreciated.

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

Re: <say-as type="date">

Post by support »

We suspect this issue is being caused by the timeout properties. Currently "timeout" is set to "10s", which means you must type in the entire date within 10 seconds. This should be sufficient though you may want to extend it to be on the safe side.

There is another property called "interdigittimeout" which is the maximum time allowed in between entering digits. By default it is set to 1 second, which means if you pause for more than 1 second between numbers, you will get a nomatch event. Here is more information on the interdigittimeout property: http://www.plumvoice.com/docs/dev/voice ... gittimeout

So at the top of your chkdate field, I recommend setting these properties:

Code: Select all

<property name="timeout" value="10s"/>
<property name="interdigittimeout" value="3s"/>
<property name="inputmodes" value="dtmf"/>
You can set the timeout values to be longer if you'd like as well.

Regard the nomatch issue, could you please post the part of your code where you define your nomatch/noinput behavior?

jallard
Posts: 21
Joined: Mon Oct 03, 2011 7:20 am

Re: <say-as type="date">

Post by jallard »

I will use the interdigittimeout as you suggested, although I have tested this so much that I just fly through the actual call, so I know I'm typing the date quicker than 10 seconds. As far as the nomatch, noinput events here is the code:

Code: Select all

<form id="date">
		<field name="chkdate" type="date">
			<property name="timeout" value="10s"/>
			<property name="inputmodes" value="dtmf"/>
			<prompt>
				<voice name="mike">
					Please enter the date of the check. Please enter the date in this format: 4 digit year, 2 digit month, 2 digit day. For example, January 31st 2011 would be entered as two zero one one zero one three one.
				</voice>
			</prompt>
			<filled>
				<assign name="date" expr="chkdate"/>
			</filled>
			<noinput count="1">
				<prompt>
					<voice name="mike">
						I'm sorry, but I didn't understand you.
					</voice>
				</prompt>
				<reprompt/>
			</noinput>
			<noinput count="2">
				<prompt>
					<voice name="mike">
						I'm sorry, but I still didn't understand you.
					</voice>
				</prompt>
				<reprompt/>
			</noinput>
			<noinput count="3">
				<prompt>
					<voice name="mike">
						I'm sorry, but I still didn't understand you. Goodbye.
					</voice>
				</prompt>
				<exit/>
			</noinput>
			<nomatch count="1">
				<prompt>
					<voice name="mike">
						I'm sorry, but I didn't recognize your response.
					</voice>
				</prompt>
				<reprompt/>
			</nomatch>
			<nomatch count="2">
				<prompt>
					<voice name="mike">
						I'm sorry, but I still didn't recognize your response.
					</voice>
				</prompt>
				<reprompt/>
			</nomatch>
			<nomatch count="3">
				<prompt>
					<voice name="mike">
						I'm sorry, but I still didn't recognize your response. Goodbye.
					</voice>
				</prompt>
				<exit/>
			</nomatch>
			<filled>
				<prompt>
					<voice name="mike">
						You entered <say-as type="date:mdy">
							<value expr="chkdate.substr(4,2)+'/'+chkdate.substr(6,2)+'/'+chkdate.substr(0,4)"/>
						</say-as>
					</voice>
				</prompt>
				<goto nextitem="chkdate2"/>
			</filled>
		</field>

jallard
Posts: 21
Joined: Mon Oct 03, 2011 7:20 am

Re: <say-as type="date">

Post by jallard »

I think that interdigittimeout solution worked by the way. I haven't had any further issues with that.

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

Re: <say-as type="date">

Post by support »

You should combine the two <filled> tags as a single <filled> tag. The noinput and nomatch tags should come after the filled tag, like this:

Code: Select all

<form id="date">
  <field name="chkdate" type="date">
    <property name="timeout" value="10s"/>
    <property name="interdigittimeout" value="3s"/>
    <property name="inputmodes" value="dtmf"/>

    <prompt>
      <voice name="mike">
	Please enter the date of the check. Please enter the date in this format: 4 digit year, 2 digit month, 2 digit day. For example, January 31st 2011 would be entered as two zero one one zero one three one.
      </voice>
    </prompt>

    <filled>
       <assign name="date" expr="chkdate"/>
       <prompt>
          <voice name="mike">
             You entered 
	     <say-as type="date:mdy">
		<value expr="chkdate.substr(4,2)+'/'+chkdate.substr(6,2)+'/'+chkdate.substr(0,4)"/>
	     </say-as>
          </voice>
       </prompt>
       <goto nextitem="chkdate2"/>
    </filled>
 
    <noinput count="1">
      <prompt>
        <voice name="mike">
          I'm sorry, but I didn't understand you.
        </voice>
      </prompt>
      <reprompt/>
    </noinput>
    <noinput count="2">
      <prompt>
        <voice name="mike">
          I'm sorry, but I still didn't understand you.
        </voice>
      </prompt>
      <reprompt/>
    </noinput>
    <noinput count="3">
      <prompt>
        <voice name="mike">
          I'm sorry, but I still didn't understand you. Goodbye.
        </voice>
      </prompt>
      <exit/>
    </noinput>

    <nomatch count="1">
      <prompt>
        <voice name="mike">
          I'm sorry, but I didn't recognize your response.
        </voice>
      </prompt>
      <reprompt/>
    </nomatch>
    <nomatch count="2">
      <prompt>
        <voice name="mike">
          I'm sorry, but I still didn't recognize your response.
        </voice>
      </prompt>
      <reprompt/>
    </nomatch>
    <nomatch count="3">
      <prompt>
        <voice name="mike">
          I'm sorry, but I still didn't recognize your response. Goodbye.
        </voice>
      </prompt>
      <exit/>
    </nomatch>
  </field>

Post Reply