The first step to creating
a voice application using the Blueworx Voice Response Java
API is to create a class which extends the WVRApplication class.
The
WVRApplication class contains the
following methods:
- getApplicationProperties()
- Retrieves environment properties required to run the application.
If you are running your application unmanaged, this method
will return null. (See Managed and unmanaged applications for more information about managed
and unmanaged applications). If you are running your application managed,
the application properties are returned in the form of an ApplicationProperties object.
See Setting the application environment for more information
about the ApplicationProperties class.
- setApplicationProperties()
- Defines environment properties required to run the application.
Your application only needs to use this method if you are running
it as an unmanaged application. (See Managed and unmanaged applications for more information about managed
and unmanaged applications.) The only parameter is an ApplicationProperties object.
See Setting the application environment for more information
about the ApplicationProperties class, and
the use of the WVR.setApplicationProperties() method.
- voiceMain()
- This is the main entry point for the application. The main implementation
code for your application will be in this method.
- run()
- Starts an instance of the application. This method is invoked
automatically by Blueworx Voice Response when
a managed application is started. If you are testing your application
it is likely that you will be running it unmanaged, in which
case you will have to write a main() method
which creates an instance of your application and invokes its run() method.
For example:
public static void main(String[] args) {
// Create an instance of the MyVoiceApp class and invoke its run method
MyVoiceApp aVoiceApp = new MyVoiceApp();
aVoiceApp.run();
}
Also see Example 1: Caller calls an application for
an example of this code.
This method
also provides error handling of uncaught exceptions and returns a
call when the caller hangs up (when the application receives a WVRHungUpException).
- voiceAppStop()
- This method is invoked automatically when a node shuts down. Use
it to prepare your application for shut down, for example by stopping
pending methods such as Call.waitForCall().