Thank you!
That was a good fix. I never would have figured that one out myself.
Now I'm running into some errors which I just don't understand, because variables that are defined are coming back as undefined.
Go figure?
When selecting 12 Noon the following error is returned:
Thu 14 Aug 2008 10:30:25 AM EDT:
Found grammar match
hypothesis #0: noon (0.7350)
hypothesis #1: midnight (0.2360)
VXI::assign_element(name="call_hour" expr = "12")
VXI::var_element(name=
"SayH" expr = "'12 Noon'")
ReferenceError:
SayH is not defined line 1
received event: error.semantic.ecmascript:
How can it return such an error if "SayH" expr = "'12 Noon'"?
When selecting 12 Midnight the following error is returned:
Thu 14 Aug 2008 10:40:15 AM EDT:
Found grammar match
hypothesis #0: midnight (0.9850)
hypothesis #1: noon (0.0110)
VXI::assign_element(name="call_hour" expr = "00")
VXI::var_element(name=
"SayH" expr = "'12 Midnight'")
ReferenceError:
SayH is not defined line 1
received event: error.semantic.ecmascript:
How can it return such an error if "SayH" expr = "'12 Midnight'"?
When selecting 2AM the following error is returned:
Thu 14 Aug 2008 10:41:48 AM EDT:
Found grammar match
hypothesis #0: 02 (0.9740)
VXI::var_element(name="H" expr = "02")
ReferenceError: AM_PM is not defined line 1
received event: error.semantic.ecmascript:
How can it return such an error if "AM_PM" was returned correctly in <prompt> You chose <value expr="AM_PM"/></prompt>?
Here's the full code:
Code: Select all
<!-- /////////////////////// GET CALL Hour /////////////////////// -->
<form id="Hour_To_CallGreeting">
<block >During which hour of the day would you like to receive your reminder phone call. Let's begin by choosing an AM or PM call.
<goto next="#Choose_AM_PM"/></block>
</form>
<form id="Choose_AM_PM">
<field name="AM_or_PM">
<grammar type="application/x-jsgf" mode="voice">
( ((A M | morning) {AM}) |
((P M | afternoon | evening | night) {PM} ) )
</grammar>
<grammar type="application/x-jsgf" mode="dtmf">
(1 {AM} | 2 {PM} )
</grammar>
<prompt bargein="true" timeout="2s">
For
A.M. - Press 1, or say "A.M.".
P.M. - Press 2, or say "P.M.".
</prompt>
<catch event="nomatch noinput">
<reprompt />
</catch>
<filled>
<if cond = "AM_or_PM == 'AM'">
<var name="AM_PM" expr="'AM'"/>
<else/>
<var name="AM_PM" expr="'PM'"/>
<var name="PM" expr="12"/>
</if>
<prompt>
Thank you. You chose <value expr="AM_PM"/>
</prompt>
<goto next="#VerifyAM_PM"/>
</filled>
</field>
</form>
<menu id="VerifyAM_PM">
<prompt bargein="true" timeout="2s">
Is that correct? Yes or no? press 1 for yes or 2 for no.
</prompt>
<choice dtmf="1" next="#Hour_To_Call" accept="approximate">yes yeah yep yup sure correct right</choice>
<choice dtmf="2" next="#Choose_AM_PM" accept="approximate">wrong no nope not na nadda</choice>/>
</menu>
<catch event="noinput">
<!-- Sorry, I did not hear anything. Press 1 for yes or 2 for no. -->
<reprompt />
</catch>
<!-- /////////////////////// call_hour ///////////////////////////// -->
<form id="Hour_To_Call">
<field name="hour">
<grammar type="application/x-jsgf" mode="voice">
(
((1 | one ) {01}) |
((2 | two) {02}) |
((3 | three) {03}) |
((4 | four) {04}) |
((5 | five ) {05}) |
((6 | six) {06}) |
((7 | seven) {07}) |
((8 | eight) {08}) |
((9 | nine) {09}) |
((10 | ten) {10}) |
((11 | eleven) {11}) |
((12 | twelve) {12})
)
</grammar>
<grammar type="application/x-jsgf" mode="dtmf">
(1 {01} | 2 {02} | 3 {03} | 4 {04} | 5 {05} | 6 {06} | 7 {07} | 8 {08} | 9 {09} | 10 {10} | 11 {11} | 12 {12} )
</grammar>
<prompt bargein="true" timeout="3s">
Using your keypad enter the hour you would like to receive your reminder phone call, or just say it.
</prompt>
<filled>
<if cond = "hour == 1"> <var name="H" expr="01"/>
<elseif cond = "hour == 2"/> <var name="H" expr="02"/>
<elseif cond = "hour == 3"/> <var name="H" expr="03"/>
<elseif cond = "hour == 4"/> <var name="H" expr="04"/>
<elseif cond = "hour == 5"/> <var name="H" expr="05"/>
<elseif cond = "hour == 6"/> <var name="H" expr="06"/>
<elseif cond = "hour == 7"/> <var name="H" expr="07"/>
<elseif cond = "hour == 8"/> <var name="H" expr="08"/>
<elseif cond = "hour == 9"/> <var name="H" expr="09"/>
<elseif cond = "hour == 10"/> <var name="H" expr="10"/>
<elseif cond = "hour == 11"/> <var name="H" expr="11"/>
<else/>
<var name="H" expr="12"/>
</if>
<if cond="H == 12">
<goto next="#NoonOrMidnight"/>
<elseif cond ="AM_PM == PM"/>
<assign name="call_hour" expr="H + 12"/>
<var name="SayH" expr="H + 'AM_PM'"/>
<else/>
<assign name="call_hour" expr="H"/>
<var name="SayH" expr="H + 'AM_PM'"/>
</if>
<prompt>
Thank you. You entered <value expr="SayH"/>
</prompt>
<goto next="#Verifyhour"/>
</filled>
<catch event="noinput">
Sorry, I did not hear anything.
<reprompt />
</catch>
</field>
</form>
<menu id="NoonOrMidnight">
<prompt bargein="true" timeout="2s">Just to be sure I have it right. Did you mean noon, or midnight?
If you meant 12 noon, say noon, or press 1.
If you meant 12 midnight, say midnight, or press 2.
</prompt>
<choice dtmf="1" next="#Noon" accept="approximate">noon</choice>
<choice dtmf="2" next="#Midnight" accept="approximate">midnight</choice>
</menu>
<catch event="noinput">
Sorry, I did not hear anything.
<reprompt />
</catch>
<form id="Noon">
<block>
<assign name="call_hour" expr="12"/>
<var name="SayH" expr="'12 Noon'"/>
<goto next="#PostVerifyHour"/>
</block>
</form>
<form id="Midnight">
<block>
<assign name="call_hour" expr="00"/>
<var name="SayH" expr="'12 Midnight'"/>
<goto next="#PostVerifyHour"/>
</block>
</form>
<menu id="Verifyhour">
<prompt bargein="true" timeout="2s">
Is that correct? Yes, or no? Press 1 for yes or 2 for no.
</prompt>
<choice dtmf="1" next="#PostVerifyHour" accept="approximate">yes yeah yep yup sure correct right</choice>
<choice dtmf="2" next="#Hour_To_Call" accept="approximate">wrong no nope not na nadda</choice>
</menu>
<catch event="noinput">
Sorry, I did not hear anything.
<reprompt />
</catch>
<form id="PostVerifyHour">
<block>
<prompt>
Okay, I'll be calling you between <value expr="SayH"/> and <value expr="SayH + 1"/>.
</prompt>
<goto next="#SubmitPatientDATA"/>
</block>
</form>
<!-- /////////////////////////// SUBMIT ALL DATA ///////////////////////// -->
PS: At one point I had Noon working but not Midnight, and both would fail at "PostVerifyHour" returning the same error as above "ReferenceError: SayH is not defined line 1". How could it pass all the earlier "SayH" variables and save the error for the last one???