The Call.playAndGetInput() method takes four 'attributes' objects as parameters. Each attributes object contains several attributes that specify such things as prompts for the caller, timeouts and error messages.
To obtain information such as a telephone number from the caller, use
Call.playAndGetInput(PlayAttributes playAttributes, InputAttributes inputAttributes, DTMFAttributes dtmfAttributes, RecoAttributes recoAttributes)
To get a caller to choose from a list of menu choices, use
Call.playAndGetInput (PlayAttributes playAttributes, MenuAttributes menuAttributes, DTMFAttributes dtmfAttributes, RecoAttributes recoAttributes)
Storing the various attributes in four separate attributes objects means that you can re-use them elsewhere in the application. For example, you may want all your prompts to be interruptible by DTMF key, but you might want to change the number of DTMF key presses the caller is allowed to use. In this case you could reuse your PlayAttributes object throughout the application, and either create different DTMFAttributes objects according to the requirements of each prompt, or create one DTMFAttributes object and alter it for each prompt.
The Call.playAndGetInput() method returns an InputResult object that represents the caller’s input. See The Caller’s response for more information about the InputResult class.
public class myVoiceApp extends WVRApplication { . . . // Create the attributes objects - use empty constructors so that attributes // have default values private PlayAttributes myPlayAtts = new PlayAttributes(); private InputAttributes myInputAtts = new InputAttributes(); private DTMFAttributes myDTMFAtts = new DTMFAttributes(); private RecoAttributes myRecoAtts = null; // Enter the main application method public void VoiceMain() throws WVRException { // Create the application properties ApplicationProperties appProperties = new ApplicationProperties(); appProperties.setApplicationName("myApplication"); applicationProperties.setLocale(Locale.US); // Create the WVR object, using the application properties WVR wvr = new wvr(this, appProperties); // Create the Call object, using the WVR object Call call = wvr.waitForCall(); // Get input from the caller, using the attribute objects created earlier InputResult result = call.playAndGetInput(myPlayAtts, myInputAtts, myDTMFAtts, myRecoAtts); . . . }//VoiceMain }
In the above example, null is used in place of a RecoAttributes object because speech recognition is not used with this prompt.