CallXML 2.0 Development Guide Home  |  Frameset Home

  Transfer Types  |  TOC  |  Token Initiated Calls  
This documentation is for CallXML 2, which has been superceded by CallXML 3. The CallXML 2 language is not being updated any longer. CallXML 3, however, has many new features and is actively being enhanced. If you're writing a new CallXML application, you should use CallXML 3. Click here for the CallXML 3.0 documentation.

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="2.0">

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

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

    <block label="HoldMusic"
          repeat="3">

      <playaudio format="audio/wav"
          value="HoldMusic.wav"
          termdigits=""/>

      <onexternalevent value="Success">
        <conference targetsessions="$session.EventsenderID;"/>
        <hangup/>
      </onexternalevent>

      <onexternalevent value="Busy">
        <text>
          All lines are currently busy.
          Please hang up and try your call again later.
        </text>
        <hangup/>
      </onexternalevent>

      <onexternalevent value="TimedOut">
        <text>
          There is no answer.
          Please hang up and try your call again later.
        </text>
        <hangup/>
      </onexternalevent>

      <onexternalevent value="Error">
        <text>
          A connection can not be made at this time.
          Please hang up and try your call again later.
        </text>
        <hangup/>
      </onexternalevent>

    </block>

  </block>

</callxml>


Call_Target.xml

<?xml version="1.0" encoding="UTF-8" ?>
<callxml version="2.0">
  <block>
    <call value="$NumToCall;"
          maxtime="30s"/>

    <onanswer>
      <sendevent value="Success"
                session="$ParentSessionID;"/>
      <wait value="unlimited"/>
    </onanswer>

    <oncallfailure>
      <sendevent value="Busy"
                session="$ParentSessionID;"/>
    </oncallfailure>

    <onmaxtime>
      <sendevent value="TimedOut"
                session="$ParentSessionID;"/>
    </onmaxtime>

    <onerror>
      <sendevent value="Error"
                session="$ParentSessionID;"/>
    </onerror>
  </block>
</callxml>


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.



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

<callxml version="2.0">

  <block>

    <text>
      Preparing to place your call, fruitcake.
    </text>

    <transfer method="bridged" value="tel:1112223333"
      termdigits="*" maxtime="30s" answeronmedia="false"/>


    <onhangup>
      <text>
        Those guys just hung up on you.
      </text>
      <log value="---- terminated by disconnect ----"/>
      <goto value="SomeOtherPage.xml"/>
    </onhangup>

    <onmaxtime>
      <text>
        Sorry there, holmes.
        You hit max time for the call, and were disconnected.
      </text>
    </onmaxtime>

    <ontermdigit value="*">
      <text>
        You must have terminated the conference by pressing the star key.
      </text>
    </ontermdigit>

  </block>
</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.





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

login
  Transfer Types  |  TOC  |  Token Initiated Calls  

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