PDA

View Full Version : problem with datetime !!!



Jeanaug
06-02-2008, 10:55 AM
Good morning
Sorry for my English translated by google!
I have a problem with the script I always falls on the form "close", why?
Sincerely yours!

<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.0">
<var name="working_hours" expr="'0'"/>
<form id="mainform">
<noinput count="3">
<prompt>
<audio src="messagefin.wav" />
</prompt>
<exit/>
</noinput>
<object name="field1" classid="datetime">
<filled>
<if cond="datetime_hour &gt; '08'">
<if cond="datetime_min &gt; '45'">
<if cond="datetime_hour &lt; '12'">
<if cond="datetime_min &lt; '10'">
<assign name="working_hours" expr="'1'"/>
</if>
</if>
</if>
</if>
<if cond="datetime_hour &gt; '13'">
<if cond="datetime_min &gt; '45'">
<if cond="datetime_hour &lt; '17'">
<if cond="datetime_min &lt; '50'">
<assign name="working_hours" expr="'1'"/>
</if>
</if>
</if>
</if>
<if cond="datetime_hour &gt; '20'">
<if cond="datetime_min &gt; '30'">
<if cond="datetime_hour &lt; '22'">
<if cond="datetime_min &lt; '00'">
<assign name="working_hours" expr="'1'"/>
</if>
</if>
</if>
</if>
<if cond="working_hours == '1'">
<prompt> <audio src="messbienvenue.wav" /> </prompt>
<goto nextitem="field2"/>
<else/>
<prompt> <audio src="messbienvenue.wav" /> </prompt>
<goto next="#fermer"/>
</if>
<exit/>
</filled>
</object>

<field name="field2" type="digits?length=2" modal="false">
<link dtmf="3" next="#curemenu"/>
<link dtmf="5" next="#freres"/>
<prompt timeout="5s">
<audio src="messjoindreg.wav" />
</prompt>
<option dtmf="1" value="31" />
<option dtmf="2" value="32" />
<option dtmf="4" value="33" />
<option dtmf="6" value="80" />
<option dtmf="70" value="20" />
<option dtmf="71" value="11" />
<option dtmf="72" value="12" />
<option dtmf="73" value="13" />
<option dtmf="74" value="14" />
<option dtmf="75" value="15" />
<option dtmf="76" value="16" />
<option dtmf="77" value="17" />
<option dtmf="78" value="18" />
<option dtmf="79" value="19" />
<option dtmf="80" value="80" />
<filled>
<goto nextitem="field3"/>
</filled>
</field>
<object name="field3" classid="connect">
<param name="extension" expr="field2"/>
<filled>
<prompt> <audio src="messagefin.wav" /> </prompt>
<exit/>
</filled>
<nomatch>
<prompt> <audio src="messnomatch.wav" /> </prompt>
<goto nextitem="field2"/>
</nomatch>
<nomatch count="3">
<prompt> <audio src="messagefin.wav" /> </prompt>
<exit/>
</nomatch>
</object>
</form>

<form id="curemenu">
<noinput count="3">
<assign name="sfield1" expr="'19'"/>
<goto nextitem="sfield2" />
</noinput>
<field name="sfield1" type="digits?length=2" modal="false">
<prompt timeout="5s">
<audio src="cure.wav"/>
</prompt>
<option dtmf="1" value="19"/>
<option dtmf="2" value="20"/>
<option dtmf="3" value="51" />
<option dtmf="70" value="20" />
<option dtmf="79" value="19" />
<filled>
<goto nextitem="sfield2"/>
</filled>
</field>
<object name="sfield2" classid="connect">
<param name="extension" expr="sfield1"/>
<filled>
<prompt> <audio src="messagefin.wav" /> </prompt>
<exit/>
</filled>
<nomatch>
<prompt> <audio src="messnomatch.wav" /> </prompt>
<goto nextitem="field1"/>
</nomatch>
<nomatch count="3">
<prompt> <audio src="messagefin.wav" /> </prompt>
<exit/>
</nomatch>
</object>
</form>

<form id="freres">
<noinput count="3">
<prompt>
<audio src="messagefin.wav" />
</prompt>
<exit/>
</noinput>
<field name="sfield1" type="digits?length=2" modal="false">
<prompt timeout="5s">
<audio src="freres.wav"/>
</prompt>
<option dtmf="1" value="13"/>
<option dtmf="2" value="20"/>
<option dtmf="3" value="14"/>
<option dtmf="4" value="19"/>
<option dtmf="5" value="12"/>
<option dtmf="6" value="15"/>
<option dtmf="70" value="20"/>
<option dtmf="72" value="12"/>
<option dtmf="73" value="13"/>
<option dtmf="74" value="14"/>
<option dtmf="75" value="15"/>
<option dtmf="79" value="19"/>
<filled>
<goto nextitem="sfield2"/>
</filled>
</field>
<object name="sfield2" classid="connect">
<param name="extension" expr="sfield1"/>
<filled>
<prompt> <audio src="messagefin.wav" /> </prompt>
<exit/>
</filled>
<nomatch>
<prompt> <audio src="messnomatch.wav" /> </prompt>
<goto nextitem="field1"/>
</nomatch>
<nomatch count="3">
<prompt> <audio src="messagefin.wav" /> </prompt>
<exit/>
</nomatch>
</object>
</form>
<form id="fermer">
<noinput count="3">
<prompt>
<audio src="messagefin.wav" />
</prompt>
<exit/>
</noinput>
<field name="sfield1" type="digits?length=2" modal="false">
<prompt timeout="5s">
<audio src="pasderanger.wav"/>
</prompt>
<option dtmf="1" value="11"/>
<option dtmf="70" value="20" />
<option dtmf="71" value="11" />
<option dtmf="72" value="12" />
<option dtmf="73" value="13" />
<option dtmf="74" value="14" />
<option dtmf="75" value="15" />
<option dtmf="76" value="16" />
<option dtmf="77" value="17" />
<option dtmf="78" value="18" />
<option dtmf="79" value="19" />
<option dtmf="80" value="80" />
<filled>
<goto nextitem="sfield2"/>
</filled>
</field>
<object name="sfield2" classid="connect">
<param name="extension" expr="sfield1"/>
<filled>
<prompt> <audio src="messagefin.wav" /> </prompt>
<exit/>
</filled>
<nomatch>
<prompt> <audio src="messnomatch.wav" /> </prompt>
<goto nextitem="field1"/>
</nomatch>
<nomatch count="3">
<prompt> <audio src="messagefin.wav" /> </prompt>
<exit/>
</nomatch>
</object>
</form>
</vxml>

Jeanaug
06-02-2008, 03:27 PM
forgiveness, this is not the form "close" but the form "fermer" !!!

arsen
06-04-2008, 05:05 AM
The following example plays match.wav if current time is in 13:15 to 14:45 range, otherwise - nomatch.wav.
I put comments inside to help you out to understand the routine.
Hope it helps.


<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.0">
<noinput count="3">
<prompt> <audio src="timeover.wav" /> </prompt>
<exit/>
</noinput>
<var name="match" expr="'0'"/>
<form id="datetimeform">
<object name="field1" classid="datetime">
<filled>
<!-- MATCH HOURS FIRST -->
<if cond="datetime_hour &gt; '12'">
<if cond="datetime_hour &lt; '15'">
<assign name="match" expr="'1'"/>
</if>
</if>
<if cond="match == '1'">
<!-- HOURS ARE MATCHED, NOW MATCH MINUTES -->
<if cond="datetime_hour == '13'">
<if cond="datetime_min &lt; '15'">
<assign name="match" expr="'0'"/>
</if>
</if>
<if cond="datetime_hour == '14'">
<if cond="datetime_min &gt; '45'">
<assign name="match" expr="'0'"/>
</if>
</if>
</if>


<!-- FINALLY, IF MATCH PLAY MATCH.WAV, OTHERWISE - NOMATCH.WAV -->
<if cond="match == '1'">
<prompt> <audio src="match.wav" /> </prompt>
<else/>
<prompt> <audio src="nomatch.wav" /> </prompt>
</if>
<exit/>
</filled>
</object>
</form>
</vxml>
________
Suzuki gsx series (http://www.suzuki-tech.com/wiki/Suzuki_GSX_series)
________
Prilosec Death (http://www.classactionsettlements.org/lawsuit/prilosec/)

Jeanaug
06-04-2008, 12:31 PM
Thank you very much for your answer, it works!
But I would add 2 slices of schedule more: 8:45 to 12:10 and 20:30 to 22:00!
How we do?
Sincerely yours!

davrays
06-05-2008, 01:43 PM
Well, I am far from being VXML guru, but please try the following terrible piece of code (I don't know if VXML allows to write the same logic more beautifully...) :

<var name="match" expr="'0'"/>
<form id="datetimeform">
<object name="field1" classid="datetime">
<filled>

<!-- from 08:45 to 08:59 -->
<if cond="datetime_hour == '8'">
<if cond="datetime_min &gt; '45'">
<assign name="working_hours" expr="'1'"/>
</if>
</if>
<!-- from 09:00 to 11:59 -->
<if cond="datetime_hour &gt; '8'">
<if cond="datetime_hour &lt; '12'">
<assign name="working_hours" expr="'1'"/>
</if>
</if>
<!-- from 12:00 to 12:09 -->
<if cond="datetime_hour == '12'">
<if cond="datetime_min &lt; '10'">
<assign name="working_hours" expr="'1'"/>
</if>
</if>

<!-- from 13:45 to 13:59 -->
<if cond="datetime_hour == '13'">
<if cond="datetime_min &gt; '45'">
<assign name="working_hours" expr="'1'"/>
</if>
</if>
<!-- from 14:00 to 16:59 -->
<if cond="datetime_hour &gt; '13'">
<if cond="datetime_hour &lt; '17'">
<assign name="working_hours" expr="'1'"/>
</if>
</if>
<!-- from 17:00 to 17:49 -->
<if cond="datetime_hour == '17'">
<if cond="datetime_min &lt; '50'">
<assign name="working_hours" expr="'1'"/>
</if>
</if>

<!-- from 20:30 to 20:59 -->
<if cond="datetime_hour == '20'">
<if cond="datetime_min &gt; '30'">
<assign name="working_hours" expr="'1'"/>
</if>
</if>
<!-- from 21:00 to 21:59 -->
<if cond="datetime_hour &gt; '20'">
<if cond="datetime_hour &lt; '22'">
<assign name="working_hours" expr="'1'"/>
</if>
</if>

I didn't test this code at all, just wrote it :), so it may have typos or anything else. This is just to show you one possible way to program that.
Cheers,
David