CallXML 2.0 Development GuideHome  |  Frameset Home

  tutorial External Document Navigation  |  TOC  |  tutorial Answering machine Hello world  
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.

Recording Audio: A Primer

One of the arguably cooler features of CallXML is the ability to record a caller's speech, and easily send the resultant .WAV file to a destination of your choice, be it an FTP, or an email address. When recording audio, we have two options to choose from when coding the application. We can use the simple 'recordaudio' element, or we can use the 'inputaudio' element, which, if you remember from reading the element table, combines the 'recordaudio' and the 'playaudio' elements, allowing you to play a WAV file introduction preceding the recording session.

Regardless of which method you decide to use, the syntax is virtually identical. The key factor is deciding how you will store or transport the recorded audio from the callers. As mentioned, we can send it to an FTP address by entering the address in the 'value' attribute, as shown  below:


<recordaudio 
      value="ftp://MyUserName:MyPassword@MyServer.com/MyMsgTitle.wav"
      format="audio/wav" termdigits="all" maxtime="10s" maxsilence="2s"
      beep="true"/>


You will doubtlessly notice that we can specify the directory and the name of the resultant file that gets uploaded, which is a good thing; otherwise, you'd simply see some crazy alphanumeric string as a filename, which is hardly user-friendly. For the clever folks out there, you will probably figure out that using some dynamic programming will allow you to rename the file on a per-upload basis, thus negating any filename overwrites that will happen using the above methodology.

We can also send the file to an email address, and easily, too. All that is required is that we enter a valid email address is the 'value' attribute, as illustrated below:


<recordaudio value="mailto:Jesus@Heaven.org"/>


However, we might want a bit more control over the email itself, so we can specify a few parameters to add to this value. Adding certain variable-value pairs to the email address will allow us to do this. The pertinent values that we can tack on are:


And we add them in using the syntax demonstrated below:


<recordaudio value="mailto:Jesus@heaven.org
        ?subject=Shopping_List
        &fromname=Dad
        &fromaddress=God@heaven.org
        &body=Pick up some sinners on your way home"/>


Tres` cool, eh folks? Now let's put this knowledge into action, and move along to the next Lesson where we will write a simple answering machine application...




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

login
  tutorial External Document Navigation  |  TOC  |  tutorial Answering machine Hello world  

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