CallXML 3.0 Development Guide Home  |  Frameset Home

  Transfer Types  |  TOC  |  Token Initiated Calls  

Outbound Sample Code


As mentioned previously, there are two ways we can go about placing an outbound call. The first method, using the <call/conference>  elements, is demonstrated below:

Outbound Dialing via <call> - <conference>


Parent.xml

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

<callxml version="3.0">


<block>
    <assign var="ParentSessionID" value="$session.ID;"/>
    <assign var="NumToCall" value="4073181204"/>

    <run value="Call_Target.xml"
  submit="*"
  method="get"
  var="NewSessionID" />

    <do label="HoldMusic"
          repeat="25">

      <playaudio format="audio/wav"
          value="Pulse.wav"/>

    <on event="externalevent:success">
        <log>*** EVENT = SUCCESS ***</log>
            <conference value="$session.eventsenderID;"/>
        <hangup/>
    </on>

    <on event="externalevent:busy">
        <log>*** EVENT = BUSY ***</log>
      <prompt value="Sorry, but the number is busy"/>
    </on>

    <on event="externalevent:noanswer">
        <log>*** EVENT = NOANSWER ***</log>
      <prompt value="It looks like no one is home"/>
    </on>

    <on event="externalevent:unreachable">
        <log>*** EVENT = UNREACHABLE ***</log>
      <prompt value="Your called party is unreachable"/>
    </on>

    <on event="externalevent:rejected">
        <log>*** EVENT = REJECTED ***</log>
      <prompt value="Looks like your call recipient rejected the call"/>
    </on>

    <on event="externalevent:unknown">
        <log>*** EVENT = UNKNOWN ***</log>
      <prompt value="Received an unknown call failure. Panic at will"/>
    </on>

    <on event="externalevent:timedout">
        <log>*** EVENT = TIMED OUT ***</log>
      <prompt value="Max time for the call was reached, now disconnecting."/>
    </on>

    </do>

  </block>

</callxml>


Call_Target.xml

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

<callxml version="3.0">

<do label="B1">

<call value="$NumToCall;"
      maxtime="5s" callerID="6666666666"/>

  <on event="answer">
    <log> *** CALL ANSWERED IN CHILD SESSION*** works</log>
    <sendevent value="success"
              session="$ParentSessionID;"/>
            <conference value="$ParentSessionID;"/>
  </on>

    <on event="maxtime">
      <log>*** MAXTIME CALL EVENT CAUGHT IN CHILD SESSION *** </log>
      <sendevent value="timedout"
                session="$ParentSessionID;"/>
    </on>

    <on event="callfailure:unreachable">
      <log>*** UNREACHABLE EVENT CAUGHT IN CHILD SESSION ***</log>
      <sendevent value="unreachable"
                session="$ParentSessionID;"/>
    </on>

    <on event="callfailure:busy">
      <log>*** BUSY EVENT CAUGHT IN CHILD SESSION ***</log>
      <sendevent value="busy"
                session="$ParentSessionID;"/>
    </on>


<!-- note that an 'anonymous' callfailure handler will catch all call failure events -->
<!-- that do not have their own specific handler. if the developer employs this soultion, -->
<!-- note that this handler must reside below all other handlers -->

    <on event="callfailure">
      <log>*** RECEIVED AN ANONYMOUS CALLFAILURE EVENT ***</log>
    </on>

  </do>

</callxml>


Outbound Dialing via <transfer>

The second method of placing an outbound call is by using the <transfer> element, which is available on all CallXML versions including 2.0 and 3.0, (but not 1.0!)


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

  <do label="B1">

    <say>
      Preparing to place your call.
    </say>

    <transfer method="bridged" value="tel:4072223333"
      maxtime="50s" playvalue="ringtone.wav" termdigits="1"/>

    <on event="maxtime">
    <log> *** MAXTIME EVENT DETECTED ***</log>
      <say>
        You hit max time for the call, and were disconnected.
      </say>
    </on>

    <on event="callfailure:hangup">
    <log> *** HANGUP EVENT DETECTED ***</log>
    </on>

    <on event="termdigit:1">
    <log> *** TERMDIGIT PRESSED BY USER ***</log>
      <say>
        you must have pressed 1 to end the call.
      </say>
    </on>

    <on event="callfailure:unreachable">
      <log>*** UNREACHABLE EVENT DETECTED ***</log>
      <say>
        the called number returned an un reachable event.
      </say>
    </on>

    <on event="callfailure:busy">
      <log>*** BUSY EVENT DETECTED ***</log>
      <say>
        the number that you dialed is busy.
      </say>
    </on>

<!-- note that an 'anonymous' callfailure handler -->
<!-- will catch all call failure events -->
<!-- that do not have their own specific handler. -->
<!-- if the developer employs this soultion, -->
<!-- note that this handler *must* reside below all other handlers -->

    <on event="callfailure">
      <log>*** RECEIVED AN ANONYMOUS CALLFAILURE EVENT ***</log>
    </on>

  </do>

</callxml>



Reminder: Outbound dialing requires the use of outbound dialing priveleges, which must be provisioned by voxeo support. If you have not contacted us to get these permissions, click here to learn how you can get hooked up with this feature. Also, if you would like a list of the available web services, go to B: Outbound Dialing.





  ANNOTATIONS: EXISTING POSTS
grevs
9/14/2006 3:49 PM (EDT)
"Outbound Dialing via <transfer>
The second method of placing an outbound call is by using the <transfer> element, which is new to CallXML2.0. Note that unless you explicitly specify 'callxml version=2.0', the code sample shown below will not work."

I think this should read 'which is new to CallXML3.0.  & 'callxml version=3.0'
jbassett
9/14/2006 5:34 PM (EDT)
Hello,

Thanks for the catch. I will forward this to the appropriate party and make sure this gets fixed in the next round of doc updates.

Thanks,
Jesse Bassett
Voxeo Support
tishrey
12/31/2009 9:30 AM (EST)
Hi,
There is a small error on Outbound Dialing via <call> - <conference>.

On maxtime It sends a 'timedout' event... but there is no externalevent for 'timedout' since it's spelled 'externalevent:TimedOut' in parent :)
   

    <on event="externalevent:TimedOut">
        <log>*** EVENT = TIMED OUT ***</log>
      <prompt value="Max time for the call was reached, now disconnecting."/>
    </on>


    <on event="maxtime">
      <log>*** MAXTIME CALL EVENT CAUGHT IN CHILD SESSION *** </log>
      <sendevent value="timedout"
                session="$ParentSessionID;"/>
    </on>

VoxeoBrian
12/31/2009 9:45 AM (EST)
Hello,

Thanks for the correction, we will see to it that the documentation is corrected.

Regards,

Brian F.
benwhalley
5/7/2010 1:25 PM (EDT)
Are the status codes returned by the callxml token app the same as for voicexml/designer?

These are documented as:

No answer The call was not answered
Busy The line is busy
Call number is bad The number provided was not a validly formatted number (stop that!)
Invalid token The token provided was not a valid token.
Internal error There was an error in the token initiation
Not specified An error occurred with no specific reason given

voxeoblehn
5/7/2010 3:36 PM (EDT)
Hello,

The status codes returned by VoiceXML differ from that of CallXML, they are as follows:

failure: No answer  - The call was not answered
failure: Busy - The line is busy
Call number is bad - The number provided was not a validly formatted number (stop that!)
Invalid Token. - The token provided was not a valid token.
Internal error - There was an error in the token initiation
Not specified - An error occurred with no specific reason given
success - The call was initiated successfully

Regards,

Brian Lehnen
Voxeo Support

login
  Transfer Types  |  TOC  |  Token Initiated Calls  

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