CallXML 2.0 Development Guide Home  |  Frameset Home

  External Document Navigation  |  TOC  |  Recording Audio  
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.

Tutorial: External Document Navigation

This tutorial is based on the things you accomplished in Lessons 1, 2, and 3. If you haven't yet done those Lessons, you'll need to go through them first.

In this tutorial, we will:

Step 1: creating external goto elements

In the previous Lesson, we ended up with a callxml file that looked like this...

<?xml version="1.0" encoding="UTF-8" ?>
<callxml version="2.0">
  <block>
    <playaudio value="helloworld.wav"
              termdigits="*#"/>

      <ontermdigit value="*">
        <goto label="#one"/>
      </ontermdigit>

      <ontermdigit value="#">
        <goto label="#two"/>
      </ontermdigit>
  </block>

  <block label="one">
    <text>you pressed the star key.</text>
  </block>

  <block label="two">
    <text>you pressed the pound key.</text>
  </block>

</callxml>

This was our first step in learning to use the goto element but there is much more that we can accomplish using goto.

Using the goto element we can link Callxml files together in much the same way that you can link HTML files using the anchor (<a>) element. In order to do that we will need to first modify our existing goto elements and modify our file as follows:


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

  <block>
    <playaudio value="helloworld.wav"
              termdigits="*#"/>

      <ontermdigit value="*">
        <goto value="helloworld-star.xml"
                  submit="*"
                  method="get"/>
      </ontermdigit>

      <ontermdigit value="#">
        <goto value="helloworld-pound.xml"
                        submit="*"
    method="get"/>

      </ontermdigit>

  </block>

  <onerror>
  <sendemail from="MyApp@here.com"
    to="YourEmail@there.net" type="debug">
    We caught an error in our application.  Details follow...
  </sendemail>
  </onerror>

</callxml>


We now have two goto elements that link to other callxml documents. Notice that we have added two attributes to each goto element. The submit attribute controls what session variables will be passed to the other document (in our case all of them) and the method attribute controls how those variables will be sent. We will talk more about passing session variables and the different methods in a future tutorial. We have also modified the value attribute to be a URL. We could link to any other callxml file, even one on a different web server, but for this example we are linking to callxml files located at the same place as our "helloworld.xml" file.

Also note that since we are linking to external files we no longer need blocks "one" and "two" in this file, but we will need to create two additional files.


Step 2: Creating our first additional file

With the modifications we made to our "helloworld.xml" file above we need to create the files to which we are linking or else we will encounter an error. The first file that we need to create should be named "helloworld-star.xml" and should be located in the same place as your "helloworld.xml" file (refer back to Lesson 1 if you need some help here). "Helloworld-star.xml" should look like this:


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

  <block label="star">
    <text>you pressed the star key.</text>
  </block>

  <onerror>
  <sendemail from="MyApp@here.com"
    to="YourEmail@there.net" type="debug">
    We caught an error in our application.  Details follow...
  </sendemail>
  </onerror>

</callxml>


Step 3: Creating our second additional file

All that remains now is to create our second additional file. It should be named "helloworld-pound.xml" and should be located at the same place as your other two files. "Helloworld-pound.xml" should read as follows:


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

  <block label="pound">
    <text>you pressed the pound key.</text>
  </block>

  <onerror>
  <sendemail from="MyApp@here.com"
    to="YourEmail@there.net" type="debug">
    We caught an error in our application.  Details follow...
  </sendemail>
  </onerror>

</callxml>


This new file behaves identical block "two" in our previous example.


Step 4: upload, and try it out

Your updated hello world callxml application is now done. Call the number associated with your callxml application, and you'll find that the results of this tutorial work just like the previous one -- except now we know how to use goto's to link to other callxml files!


  CallXML 2.0 source code.




  ANNOTATIONS: EXISTING POSTS
hkondeth
1/23/2006 4:30 PM (EST)
A one line explanation could be given on why Submit="*" is used. Does this mean the value '*' is passed or all session variables are passed.
Things confused me becasue in the previous page you had given the variable name at that place.
Michael.Book
1/23/2006 5:16 PM (EST)
Hey hkondeth,

Good question...  For the edification all of you out there wondering what in the world that crazy "*" is all about, it is indeed a wild-card value indicating that all variable name/value pairs should be passed to the destination application document.  If you do not want all vars to be included in the request, you can build a comma delimited list of those you want passed.

For more information about <goto> and the 'submit' attribute, see:
- http://docs.voxeo.com/callxml/2.0/frame.jsp?page=t_5cxml.htm&bm=1


Have Fun,

~ Michael

login
  External Document Navigation  |  TOC  |  Recording Audio  

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