Recording the caller’s voice input

The Call.record() method provides an opportunity for the caller to record some spoken input. Think of it as a voice input field, or even a voice text area. The recorded voice is stored in a voice segment that you specify. The method takes two required parameters and optionally, two additional parameters:

  • voiceSegment: the name of the VoiceSegment object to be used for the recording. The VoiceSegment object must be defined before you use it.
  • duration: the duration of the recording in seconds. This is the maximum time, in seconds, allowed for the voice input. Specify -1 for a period limited only by the base Blueworx Voice Response system limit on recording time. Your application can later obtain the actual duration of the recording by using the RecordingInfo.getLengthRecorded() method (see Obtaining information about the recording).
  • beep: whether or not a beep is to be played before recording. (Optional)
  • stopOnKey: whether or not to stop recording when a DTMF key is pressed. (Optional).
For example, to define a voice segment with the label CallerMsg in the RECORDING category:
public class InApp extends WVRApplication {
  .
  .
  .
  // Create the segment object for recording a message to a voice segment in the
  // Recordings category
  VoiceSegment vs_caller_message  = new VoiceSegment("Recordings", "CallerMessage");
  .
  .
  .
}
To record, after a beep, a message of up to 180 seconds in duration from a caller to the vs_caller_message voice segment, and enable the caller to stop the recording by pressing a DTMF key, you would invoke the Call.record() method within voiceMain() in the following way:
call.record(vs_caller_message, 180, true, true);
To record without a starting beep, a message of maximum duration to the same voice segment, that could be stopped by pressing a DTMF key, you would invoke the Call.record() method in the following way:
call.record(vs_caller_message, -1, false, true);

Once recorded, the VoiceSegment can be used in the same way as any other VoiceSegment object.