PDA

View Full Version : XML Newbie Help Needed Urgently.



Leeinsa
04-25-2010, 12:02 PM
Folks,

This is my first trip into the world of XML so naturally i thought changing some existing scripts would be the easiest way to go until i'm more familiar. So i created the script below from some others i found posted her. My needs are extremely simple, all calls come into virtual extension 200, here the time of day and the day of the week is checked, if it is Monday to Friday, between 8am and 5pm, then this is classed as working hours and the call is routed to extension 201 as normal. If the time and day is outside the above parameters then the call is forwarded to extension 202 for further processing (this processing is working). However when i dial extension 200, it rings once and disconnects.

So to summarise:

call comes in to virtual extension 200
if working hours, call sent to extension 201
if not working hours, call sent to extension 202

That's it, but my hacked script does not work, anybody that could take a look and see what i've cocked up, i would be very appreciative. Maybe this script could also be shortened or cleaned up quite a bit? Script below


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

<!-- determine if call is received during business hours: M-F:8-5, Sat:Closed, Sun:closed -->
<form id="datetimeform">
<var name="business_hours" expr="'0'"/>
<object name="field1" classid="datetime">
<filled>

<!-- M-F:8-5 -->
<if cond="datetime_wday &gt; '1'">
<if cond="datetime_wday &lt; '7'">
<if cond="datetime_hour &gt; '8'">
<if cond="datetime_hour &lt; '17'">
<assign name="business_hours" expr="'1'"/>
</if>
</if>
</if>
</if>

<!-- during business hours, route to Ext 201 (reception) -->
<if cond="business_hours == '1'">
<goto next="#businesshoursform" />
<else/>
<!-- not during business hours, route to Ext 202 (night reception) -->
<goto next="#afterhoursform" />
</if>

</filled>
</object>
</form>

<!-- business hours attendant -->
<form id="businesshoursform">

<block>
<object name="field2" classid="connect">
<param name="extension" value="201"/> </object>
</block>
</form>

<!-- after hours attendant -->
<form id="afterhoursform">
<block>
<object name="field2" classid="connect">
<param name="extension" value="202"/> </object>
</block>
</form>
</vxml>


Regards,

Oloff
05-26-2010, 06:42 AM
Why not use the standard call routing schedule to accomplish the same thing. Much easier.
mail me on oloff@xone.co.za

Regards

KSComs
05-26-2010, 09:17 AM
Lee I think your VAR ( Variable commands ) might be a little out of sorts..

According to my white paper ... it should look like and start with

<?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">

Notice the VARiable commands are outside of the form and also Working days is missing ...

So it might need to look like something like the following :


<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.0">
<!-- determine if call is received during business hours: M-F:8-5, Sat:Closed, Sun:closed -->
<form id="datetimeform">
<var name="business_hours" expr="'0'" />
<var name="working_days" expr="'0'" />
<object name="field1" classid="datetime">
<filled>
<!-- M-F:8-5 --><if cond="datetime_wday &gt; '1'">
<if cond="datetime_wday &lt; '7'">
<if cond="datetime_hour &gt; '8'">
<if cond="datetime_hour &lt; '17'">
<assign name="business_hours" expr="'1'" />
</if>
</if>
</if>
</if>
<!-- during business hours, route to Ext 201 (reception) -->
<if cond="business_hours == '1'">
<goto next="#businesshoursform" />
<else />
<!-- not during business hours, route to Ext 202 (night reception) -->
<goto next="#afterhoursform" />
</if>
</filled>
</object>
</form>
<!-- business hours attendant -->
<form id="businesshoursform">
<noinput count="1">
<goto nextitem="businesshoursform" />
</noinput>
<block>
<prompt bargein="true">
<audio src="daygreeting.wav" />
</prompt>
</block>
<goto nextitem="businesshoursform" />
<object name="businesshoursform" classid="connect">
<param name="extension" expr="'201'" />
</object>
<exit />
</form>
<!-- after hours attendant -->
<form id="afterhoursform">
<noinput count="1">
<goto nextitem="afterhoursform" />
</noinput>
<block>
<prompt bargein="true">
<audio src="nightmessage.wav" />
</prompt>
</block>
<goto nextitem="afterhoursform" />
<object name="afterhoursform" classid="connect">
<param name="extension" expr="'202'" />
</object>
<exit />
</form>
</vxml>


Dont forget to record 2 x messages - 1 = daygreeting.wav and the 2nd nightmessage.wav

I have made a clean copy of the xml for you lee.. see attached.

Hopefully that will resolve it.

Kev

Leeinsa
05-26-2010, 02:59 PM
Thanks Kev, Will give this some time over the weekend and try to learn the correct way of doing things for a change.

Regards,

KSComs
05-26-2010, 07:16 PM
You could also remove the audio by just changing it to blank.wav
That way it will just divert to your extensions as required

Re = <prompt bargein="true">

This means the user can dial digits through the message, if you just want them to listen and not interact with your attendant then change <prompt bargein="true"> to <prompt bargein="false">

I was going to write some fancy dial mechanism as well.. but you have seen enough to wet your appetite .. and I have tested the above

Regards

Kev