Never forget to make a call with scheduled conferencing
Thursday, July 10th, 2008We all forget to make important calls from time-to-time. With this tutorial, you will be able to schedule a call ahead of time, so that Voxeo’s IVR system calls you at that time in the future, and then links you with the party you intended to call.
While you’re utilizing your free Voxeo developer account, you might as well keep the whole shabang free, right? Head on over to x10hosting.com or forwardhosting.com, and register for an account. These are two of the very few hosting companies that will allow you to run cron jobs for free. Now that you are all setup, let’s get into the design aspect, cron job first.
While cron web interfaces will certainly be different, the underlying principal is the same: cron will wait until the system time matches your job time, and then will execute an action. Most web portals to cron jobs will allow you specify minute, hour, day, month, and weekday.
Let’s assume you have to call your wife every Friday night at 5 pm to let her know that you’re coming straight home from work. We’ll set minute to “00″, the hour to “17″, the weekday to “4″, and the rest to “*”. This will make the cron job execute on Fridays at 1700. You may need to adjust the time on your cron job to account for differences between system time and your time. For example, the x10hosting box on which my cron job runs is set to US central time. For the cron job command, use the Unix command “curl” like so:
curl http://api.voxeo.net/SessionControl/CCXML10.start?tokenid=dd5a1d7f44e97f49856eb6e894c9c669d152e89a571f6201eb3b265045b7a1d2bb52ff8d9856fbbbbbbbbbba\&numdial=5551231234
This command sends an http request to api.voxeo.net for our CCXML 1.0 token. The request also contains the variable “numdial.”
( Please note that the backslash is used in cron to escape the ampersand. This request will not work properly from a browser window )
Now for the XML part:
<?xml version="1.0" encoding="UTF-8"?>
<ccxml version="1.0" xmlns:voxeo="http://community.voxeo.com/xmlns/ccxml">
<var name="state0" expr="'init'"/>
<var name="callid_out1"/>
<var name="callid_out2"/>
<var name="pin"/>
<var name="holdMusicDlg"/>
<eventprocessor statevariable="state0">
<transition state="init" event="ccxml.loaded">
<createcall dest="'tel:+15555555555'" connectionid="callid_out1" callerid="'1112223333'" timeout="'30s'"/>
</transition>
<transition state="init" event="connection.connected">
<assign name="callid_out1" expr="event$.connectionid"/>
<assign name="state0" expr="'enterpin'"/>
<dialogstart src="'null://?termdigits=#&text=Press 1 and then pound if you want to dial' + session.values.numdial"&
type="'application/x-fetchdigits'"/>
</transition>
<transition state="enterpin" event="dialog.exit">
<log expr="'PIN = [' + event$.values.digits + ']‘”/>
<if cond=”‘1′ != event$.values.digits”>
<exit/>
<else/>
<assign name=”pin” expr=”event$.values.digits”/>
</if>
<assign name=”state0″ expr=”‘calling’”/>
<dialogstart src=”‘holdingPattern.vxml’” type=”‘application/xml+vxml’” namelist=”pin” dialogid=”holdMusicDlg”/>
<createcall dest=”‘tel:+1′ + session.values.numdial” connectionid=”callid_out2″ callerid=”‘5555555555′”/>
</transition>
<transition state=”calling” event=”connection.failed”>
<assign name=”state0″ expr=”‘callfailed’”/>
<dialogterminate dialogid=”holdMusicDlg”/>
</transition>
<transition state=”callfailed” event=”dialog.exit”>
<assign name=”state0″ expr=”‘playingCallFailed’”/>
<dialogstart src=”‘callFailure.vxml’” type=”‘application/xml+vxml’” connectionid=”callid_out1″/>
</transition>
<transition state=”playingCallFailed” event=”dialog.exit”>
<disconnect/>
</transition>
<transition state=”calling” event=”connection.connected”>
<if cond=”event$.connectionid == callid_out1″>
<exit/>
<else/>
<assign name=”state0″ expr=”‘beforeBridging’”/>
<dialogterminate dialogid=”holdMusicDlg”/>
</if>
</transition>
<transition state=”beforeBridging” event=”dialog.exit”>
<send name=”‘pause’” target=”session.id” delay=”‘200ms’”/>
</transition>
<transition state=”beforeBridging” event=”pause”>
<assign name=”state0″ expr=”‘bridged’”/>
<join id1=”callid_out1″ id2=”callid_out2″/>
</transition>
<transition event=”error.conference.join”>
<log expr=”‘*** ERROR DURING JOIN ***’”/>
<exit/>
</transition>
<transition event=”error.*”>
<log expr=”‘an error has occured (’ + event$.reason + ‘)’”/>
<voxeo:sendemail to=”‘yourEmail@there.com’”
from=”‘myApp@here.com’”
type=”‘debug’”
body=” ‘generic error detected ! ‘ “/>
<exit/>
</transition>
</eventprocessor>
</ccxml>
This application has a fairly simple flow. It calls 1-555-555-5555, and then asks the callee to press 1 and then # to connect to whatever number was passed in via the http request (in this case numdial=5551231234).
That’s it. To make this work for you, you need to change four values:
1. token ID in http request
2. numdial variable in http request
3. “5555555555″ is found twice in the CCXML file - both instances should be changed to your number
4. sendemail “to” and “from” in CCXML file
Good luck with your development - mix in a little MySQL and PHP action to make adding more cron jobs easier.
Till next time,
Jeremy McCall
Voxeo Network Operations




RSS Feed