This is an old revision of the document!
The <record> element is an input item that collects a recording from the user. A reference to the recorded audio is stored in the input item variable, which can be played back (using the expr attribute on <value>) or submitted to a server to be saved/processed.
|name||The input item variable that will hold the recording. This is also the name that will be associated with the uploaded recording if it is submitted to a server.|
|cond||(defaults to true) An expression that must evaluate to true after conversion to Boolean in order for the form item to be visited.|
|expr||The initial value of the form item variable; default is ECMAScript undefined. If initialized to a value, then the form item will not be visited unless the form item variable is cleared.|
|type||The media format of the resulting recording. Defaults to “audio/basic”. Can also be set to “audio/x-alaw-basic” and “audio/x-wav”.|
|beep||(defaults to false) If true, a tone is emitted just prior to recording.|
|maxtime||(defaults to 60 seconds) The maximum duration to record. The maximum record time is 1 hour.|
|modal||(defaults to true) If this is false, all active dtmf grammars are turned on while recording, if the recording is terminated by dtmf and it has a match with an active grammar, then the appropiate filled action is taken. If this is true, then any dtmf input is stored in the shadow variable name$.termchar. In the event of a grammar match the last recording is stored in the application.lastrecord variable.|
|finalsilence||(defaults to 3 seconds) The interval of silence that indicates end of speech. The maximum finalsilence time is 5 minutes.|
|dtmfterm||(defaults to true) If dtmfterm = false, the input is ignored; if dtmfterm = true, input immediately interrupts the recoding, and the name$.termchar shadow variable is set to the terminating digit.|
The current VoiceXML 2.0 Last Call specification is unclear as to the proper handling of DTMF keypresses that terminate a recording. Until further clarification is available, Plum DEV will handle terminating DTMF by writing the keypress into the shadow variable name$.termchar. Other shadow variables available for <record> are name$.duration, name$.size, and name$.maxtime. The name$.utterance, and name$.confidence shadow variables are not supported.
<?xml version="1.0"?> <vxml version="2.0"> <form> <record name="myrecording" beep="true"> <prompt> Please record a message after the beep. </prompt> <filled> <prompt> You just recorded the following message: <value expr="myrecording"/> </prompt> </filled> </record> </form> </vxml>
The output of the above script would be:
Computer: Please record a message after the beep. *BEEP*
Human: My dog has fleas.
Computer: You just recorded the following message:
Computer: (Plays back the recording) “My dog has fleas.”