CallXML 3.0 Development Guide Home  |  Frameset Home

  tutorial Document Navigation  |  TOC  |  tutorial Answering machine Hello world  

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
tanderson
9/6/2007 1:43 PM (EDT)
Having some trouble with this above example:

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

When I add it to my app, I get this when I open it in the browser:

A semi colon character was expected. Error processing resource 'https://evolution.voxeo.com/hosting/FTPServlet?cmd=get&dir=...

        &fromname=Dad
-----------------^

When I call the application, I get errors as well.

Thanks,

Thomas
MattHenry
9/6/2007 5:24 PM (EDT)


Hi there,

it is difficult to say for sure without being able to view the source code, but I suspect that you may be running into a case where the Evolution documentation is de-encoding the delimiters for the 'value' string. As a further catch-22, I can't reprint it verbatim here, so bear in mind that I am adding spaces that you will want to remove:

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

Also note that if you are hosting this on the webhosting server, you will *not* want to edit this in the scratchpad, as this too, will de-encode things and cause the app to fail. Instead, edit the file in Notepad, and upload it to webhosting via FTP:

ftp://username:password@ftp.voxeo.net


Hope this helps,

~Matthew Henry
haz
2/15/2011 11:42 PM (EST)
The record audio example is hilarious (picking the sinner part). The guy who does the documentation does a good job (he hyperlinks interesting non technical content too) :)
haz
2/15/2011 11:44 PM (EST)
Forgot the reason i came here. Can i record audio as MP3 ? format="audio/mp3" ?
voxeoJeffK
2/16/2011 10:59 AM (EST)
Hello,

Yes that is correct, but note that MP3 capability is available on Prophecy version 10 only, not version 8.

Regards,
Jeff Kustermann
Voxeo Support

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

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