Code Example: Hello World
Date Posted: 1/15/2008 7:04:06 PM
Example Type: Other

Introduction
Every language or API needs a Hello World: that simplest-of-applications that lets you see the very most basic elements needed to get something going. Here's ours.

Documentaion:
Hello World is a great place to get started learning about MyVox. We boiled it down to the simplest MyVox application you can build that nevertheless shows you all the critical pieces of the application, and that all fits onto one page.
You can see Hello World in action here.
Here's how it works:
- In our developer account, before writing any code, we set up a VoiceRecorder application for Hello World. Every application you create needs its own VoiceRecorder.
- Hello World first issues a "CreateRecordingList" command to MyVox. This sets up a RecordingList, which is a container for Recordings. We put the key to our VoiceRecorder into the command parameters, so MyVox knows that it's talking to our Hello World app.
- Next, Hello World issues a "CreateRecording" command. This sets up a single Recording, which is a container for an audio recording made by a caller. Right now, it's empty - nobody's recorded anything yet! We associate it with the RecordingList, by including that RecordingList's key as a parameter. All Recordings need to be in a RecordingList. Now we're done with our setup.
- We've given the user a button to begin the recording process. When it gets pressed, we issue a "StartRecordingSession" command. A RecordingSession is a phone call where one or more recordings will get made. When we issue it, we pass in the key to the Recording we want recorded on that session, so MyVox knows what to do with the recorded audio. MyVox passes back a phone number and a passcode for the user.
- We display the number and passcode to the user. He or she calls, enters the code, and is welcomed to the phone system. The phone system then asks her to make her recording. Once this happens, and the user is satisfied enough with the recording to save it, he or she is thanked, and the phone system hangs up.
- During this time, we issue periodic "GetSessionStatus" commands to MyVox. These ask MyVox where the user is at in the process of making a recording. We display the results for the user, so he or she can see the connection between the Web interface and the phone system.
- Once the recording is saved, GetSessionStatus shows us the URL of the audio file. Because we set up the Hello World VoiceRecorder to save the audio on the MyVox servers, instead of uploading it to some other location, we just refer to the audio file's URL from within the application. We show the URL to the user as a link, so she can click on it to hear the recording. And we're done!

Example Code:
Coming soon! (just view the source of the Hello World demo to see everything - it's all on one page.)