The InputAttributes class

The InputAttributes class contains properties which determine how the caller is guided through giving input using the Call.playAndGetInput() method, and how their response is validated. The properties defined in the InputAttributes class are listed below; each property has set and get methods.

Message properties

Other properties

For the message properties, the message object to be played can be a MediaType object, an array of MediaType objects, or an instance of a class that implements the Playable interface.

The constructor methods for this class are:
InputAttributes()
Constructs an InputAttributes object with null for all messages and the validator, and default properties of timeout=-1, clearDTMFBuffer=false and numberOfRepeats=1.
InputAttributes(InputAttributes base)
Constructs an InputAttributes object with properties inherited from the specified InputAttributes.
InputAttributes(MediaType[] message, int timeout)
Constructs an InputAttributes object with specified main message as an array of MediaType objects, and specified timeout.
InputAttributes(MediaType message, int timeout)
Constructs an InputAttributes object with specified main message as a single MediaType, and specified timeout.
InputAttributes(Playable message, int timeout)
Constructs an InputAttributes object with specified main message as a Playable object, and specified timeout.
For example:
public class myVoiceApp extends WVRApplication {
  .
  .
  .
  // Create the voice segment objects that will be used for the prompt
  public VoiceSegment vs_card_number = new VoiceSegment("OrderSegments", "CardNumber");
  public VoiceSegment vs_not_enough_digits = new VoiceSegment("OrderSegments", "NotEnough");
  public VoiceSegment vs_invalid = new VoiceSegment("OrderSegments", "Invalid");
  // Create the attributes object - use empty constructors so that attributes have
  // default values
  public InputAttributes myInputAtts = new InputAttributes();
  // Then change the attributes you need.
  myInputAtts.setMessage(vs_card_number);
  myInputAtts.setTimeoutMessage(vs_not_enough_digits);
  myInputAtts.setInvalidInputMessage(vs_invalid);
  myInputAtts.setTimeout(5);
  myInputAtts.setNumberOfRepeats(3);
  .
  .
  .
  // Within the voiceMain() method, use the attributes object to get input from the caller
  InputResult input = call.playAndGetInput(myPlayAtts, myInputAtts, myDTMFAtts, myRecoAtts);
}	

Example interaction

You set the numberOfRepeats to 3. This gives the caller a total of four chances to enter data.

Iteration

Property used by object

Words spoken by application

Caller response

1

message

Enter your credit card number. The number must be 16 digits.

Does not press any keys, or presses fewer than 16.

2

timeoutMessage

You did not enter enough data.

Presses #12# *123 ###8 8888

(an invalid number).

 

message

Enter your credit card number. The number must be 16 digits.

3

invalidInputMessage

That is not a valid credit card number.

Does not press any keys, or presses fewer than 16.

 

message

Enter your credit card number. The number must be 16 digits.

4

timeoutMessage

You did not enter 16 digits.

Presses #12# *123 ###8 8888

(an invalid number).

 

oneMoreRepeatMessage

You have one more chance...

 

message

Enter your credit card number. The number must be 16 digits.

5

invalidInputMessage

That is not a valid credit card number.

 
 

noMoreRepeatsMessage

Sorry, we cannot continue with the transaction.