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.
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); }
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. |