PDA

View Full Version : Time of Day queries



blackbirduk
06-02-2009, 09:42 AM
I am trying to set a ascript that during office hours transfers calls to a given extension and out of offie hours just plays a message saying the office is closed. I've worked from the example scripts but I have a problem... out of hours I get the closed message BUT during offie hours I just get 'unavaiable'

The script I am using is as follows... I suspect the problem is to do with how the dialing code is used but I can't see any examples that don't use input ...

Any help / suggestions gratefully received....

<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.0">
<var name="working_hours" expr="'0'"/>
<var name="working_days" expr="'0'"/>
<form id="datetimeform">
<object name="field1" classid="datetime">
<filled>
<if cond="datetime_wday &gt; '1'">
<if cond="datetime_wday &lt; '7'">
<assign name="working_days" expr="'1'"/>
</if>
</if>

<if cond="working_days == '1'">
<if cond="datetime_hour &lt; '9'">
<elseif cond="datetime_hour &lt; '17'"/>
<assign name="working_hours" expr="'1'"/>
<else/>
</if>
</if>

<if cond="working_hours == '1'">
<object name="field2" classid="connect">
<param name="extension" expr="'306'" />
</object>
<else/>
<prompt> <audio src="closed.wav" /> </prompt>
</if>
<exit/>
</filled>
</object>
</form>
</vxml>

davrays
06-03-2009, 01:30 PM
Your main mistake here is that you're trying to place one <object> into another <object>. I am not sure if this is allowed by general VXML rules, but it is not allowed in this parser.
I am also not a big VXML pro, but looking into "att.log" can see some useful tips on whats going on.

Your script should look like this:

<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.0">

<var name="working_hours" expr="'0'"/>
<var name="working_days" expr="'0'"/>

<form id="datetimeform">

<object name="field1" classid="datetime">
<filled>
<if cond="datetime_wday &gt; '1'">
<if cond="datetime_wday &lt; '7'">
<assign name="working_days" expr="'1'"/>
</if>
</if>
<if cond="working_days == '1'">
<if cond="datetime_hour &lt; '9'">
<elseif cond="datetime_hour &lt; '17'"/>
<assign name="working_hours" expr="'1'"/>
<else/>
</if>
</if>
<if cond="working_hours == '1'">
<goto nextitem="call_to_extension"/>
<else/>
<prompt> <audio src="closed.wav" /> </prompt>
</if>
<exit/>
</filled>
</object>

<object name="call_to_extension" classid="connect">
<param name="extension" expr="'306'" />
</object>
<nomatch>
<exit/>
</nomatch>

</form>

</vxml>

I tested this a bit - it seems to be working :)

Best regards,
David

blackbirduk
06-03-2009, 05:14 PM
Your main mistake here is that you're trying to place one <object> into another <object>. I am not sure if this is allowed by general VXML rules, but it is not allowed in this parser.
I am also not a big VXML pro, but looking into "att.log" can see some useful tips on whats going on.

Your script should look like this:

Ah brilliant will give that a try. Than you very much for the hints -- I will get there over time so sorry if these are really basic/silly errors :)

Thanks again!