The Caller’s response

The Call.playAndGetInput() method returns an InputResult object that represents the caller’s input. To process the input, use the InputResult.getValue() method to extract the input information as a String.

For example:
public class MyVoiceApp extends WVRApplication {
  .
  .
  .
  // Get the caller's input, using some previously defined attributes objects (not shown)
  InputResult result = call.playAndGetInput(myPlayAtts, myInputAtts, myDTMFAtts, myRecoAtts);
  // Extract the input information
  String cardNumber = result.getValue();
  .
  .
  .
  }
}
When used with a simple input field (Call.playAndGetInput() using an InputAttributes object, as in the above example), the InputResult.getValue() method returns a String containing the DTMF keys pressed by the caller, the recognized words spoken by them, or the annotations associated with the recognized words if the grammar uses annotations. When used with a menu (Call.playAndGetInput() using a MenuAttributes object), this method returns the value of the label corresponding to the selected menu item. Your application can then process the input accordingly.
The InputResult class also has the following properties, mostly to do with speech recognition results. To extract the value of the property from the InputResults object use the relevant get method:
  • annotation: the annotation that corresponds to the word or words of recognized input.
  • nBestAnnotations: an array of the annotations returned by the speech recognizer. The annotations correspond to the nBestValues of words spoken. A single annotation may be obtained by calling the getAnnotation() method with the words spoken.
  • nBestScores: an array of the confidence scores returned by the speech recognizer. The scores in are in the range 0 to 100, with 100 being the best score and 0 the worst.
  • nBestValues: an array of the results from the speech recognizer. This array and the nbestScores array vary in length depending on the number of results returned: they may be smaller than the number of results requested if the recognizer returns fewer results. The results are ordered from most likely to least likely. The first value in this list (the most likely response) is also placed in the value property. You can set the number of results required in the nbest property of the RecoAtrributes class. Recognizers can return various pieces of information in a recognition result, including the actual utterance recognized and tag words that are added based on the provided grammar. To a large extent the information returned is determined by the grammar used. See the documentation that comes with your plug-in for more details. If annotations are returned, as well as the actual words spoken, they are set in the annotations property.
  • nthBestAnnotation: the annotation at the specified index.
  • nthBestScore: the score of the specified nthBest value.
  • nthBestValue: the specified nBest value.
  • terminationKey: the actual key that was interpreted as the end of input (the "enter" or "delimiter" key).
  • type: the input type of the return value. Either InputResult.KEY_INPUT_RECEIVED or InputResult.VOICE_INPUT_RECEIVED.
  • numberOfValues: the number of results returned by the speech recognizer.