CCXML Voxeo 1.0 Development GuideHome  |  Frameset Home

  Postdial How-To  |  TOC  |  Duplex Conferencing  
This documentation is for CCXML 1.0-Voxeo, which has been superceded by CCXML 1.0-W3C. The CCXML-Voxeo platform is not being updated any longer. The CCXML 1.0-W3C version, however, has many new features and is actively being enhanced. If you're writing a new CCXML application, you should use CCXML 1.0-W3C. Click here for the CCXML 1.0-W3C documentation.

Limiting Call Length

So, we have mastered how we can use a CCXML token to make an outbound call and join a caller to our nifty VoiceXML application, but what if we want to cap the length of the call? SInce there aren't any obvious provisions for this, we have to wax creative and use the <send delay> element/attribute pairing.

Note: This example application requires the enabling of outdial priveleges on the Voxeo network, and the provisioning of a alphanumeric token string to your application. In order to get hooked up with all these neat features, check our Support Guide for all the juicy details.

Again, for this example, we are looking at three components, all told:


The first and last documents are pretty inconseqential: We've seen the HTML page that triggers a CCXML token several times in the course of this documentation set, and don't need to revisit it here. And the VXML application itself isn't that important, either. Any VXML dialog that will run for an indefinite amount of time will fit the bill. So, let's instead focus on 'Start.asp', below. You'll notice that there really isn't anything all that fancy going on. The only wrinkles that make this code different from our CCXML Token Lesson is the fact that when the call is picked up, we will send an delayed event, (5 minutes), that, when trapped by our eventhandler, will end the call:

Start.asp


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

<%
'*******************************************************
' Grab the variables from the querystring using ASP.
'*******************************************************
phoneNum      = request.querystring("phoneNum")

'*******************************************************
' Now we must assign those values to CCXML variables.
'*******************************************************
response.write "<var name=""phoneNum""  expr=""'" & phoneNum & "'""/>"
%>
  <var name="state0" expr="'init'"/>

  <eventhandler statevariable="state0">

<!-- *** CCXML front-end loaded / Making outbound call *** -->
    <transition state="'init'" event="ccxml.loaded">
      <log expr="'-- Application Starting --'"/>
      <log expr="'-- Making Outbound Call --'"/>
      <assign name="state0" expr="'calling'"/>           
      <createcall dest="phoneNum"
                  timeout="'30000'"/>
    </transition>   

<!-- *** If outbound call fails *** -->
    <transition state="'calling'" event="connection.CONNECTION_FAILED">
      <log expr="'-- Outbound Call Failed / Exiting App --'"/>
      <exit/>
    </transition>

<!-- *** If outbound call is successful *** -->
    <transition state="'calling'" event="connection.CONNECTION_CONNECTED" name="evt">
      <log expr="'-- Call Answered --'"/>
      <var name="myCallID" expr="evt.callid"/>
      <assign name="state0" expr="'call_answered'"/>
<!-- *** Creating "timer-like" effect *** -->
      <send event="'callMaxTimeReached'" target="session.id" delay="'300000'"/>

<!-- *** Starting your actual VXML application *** -->
      <dialogstart src="'your_app.vxml'"/>
    </transition>

    <transition state="'call_answered'" event="dialog.exit" name="evt">
      <log expr="'-- VXML App Complete / Exiting App --'"/>
      <exit/>
    </transition>

<!-- *** If call time reaches 5 minutes *** -->
    <transition event="user.callMaxTimeReached">
      <log expr="'-- Max Call Time Reached / Disconnecting Call --'"/>
      <assign name="state0" expr="'forced_disconnect'"/>
      <disconnect callid="myCallID"/>
    </transition>


<!-- *** Clean-up when call is disconnected *** -->
    <transition event="connection.CONNECTION_DISCONNECTED" name="evt">
      <log expr="'-- Call Leg: ' + evt.callid + 'Has Been Disconnected / Exiting App --'"/>
      <exit/>
    </transition>

<!-- *** If we just generally mess things up *** -->
    <transition event="call.CALL_INVALID" name="evt">
      <if cond="myCallID == evt.callid">
        <exit/>
      </if>
    </transition>

    <transition event="error.*" name="evt">
      <log expr="'CRIKEY AN ERROR HAS OCCURED: (' + evt.error + ')'"/>
      <exit/>
    </transition>
  </eventhandler>   

</ccxml>


Sample Code, Anyone?

You wanted it, you got it right HERE!




  ANNOTATIONS: EXISTING POSTS
0 posts - click the button below to add a note to this page

login
  Postdial How-To  |  TOC  |  Duplex Conferencing  

© 2008 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site