<record>
Records audio samples. The audio samples can be used for playback within a VoiceXML document (using the expr attribute of the <audio> element), or submitted back to the server for storage (using the <submit> element).
Attributes
This section describes the attributes you can set for this element.
Name |
Data type |
Default |
---|---|---|
(true | false) |
false |
|
CDATA |
optional |
|
captureonspeech (Nuance extension) |
(true | false) |
false |
dest (Nuance extension) |
CDATA |
optional |
destexpr (Nuance extension) |
CDATA |
optional |
(true | false) |
true |
|
CDATA |
optional |
|
CDATA |
optional |
|
CDATA |
optional |
|
(true | false) |
true |
|
NMTOKEN |
optional |
|
CDATA |
no default, required |
beep
The beep attribute allows you to specify whether or not you want a tone to be played before a recording. If you want a tone to be played, you must set the beep attribute to true. The default setting of the beep attribute is false. Note that you can configure the prompt used for the beep by setting the voicexml.recordBeepPrompt to the URL of the prompt you wish to use in your browser configuration.
captureonspeech
Specifies whether to start the recording immediately or wait for the end-pointing functionality to detect speech.
Valid values are:
- false: Start recording immediately (default)
- true: Wait until speech is detected
dest
The dest attribute is a Nuance extension that specifies the destination URL for recordings. If the destination URL is not accessible for audio playback and/or HTTP post submit, an error.semantic event is thrown when the recording field variable is referenced.
destexpr
The destexpr is a Nuance extension similar to the dest attribute. The destexpr attribute is an ECMAScript expression that evaluates to the destination URL. Note that only one of the dest or destexpr attributes may be specified.
dtmfterm
The dtmfterm attribute allows users to terminate a recording using a Dual Tone Multi Frequency (DTMF) key. By default, the dtmfterm attribute is set to true.
finalsilence
The finalsilence attribute specifies the duration of end of speech silence (in milliseconds).
maxtime
The maxtime attribute specifies the maximum duration of a recording. You can specify either seconds (for example, "10s") or milliseconds (for example, "10ms"). If you just specify a numeric value (for example, "10") the value defaults to milliseconds.
If the maxtime interval is exceeded before recording ends, then the recording is terminated and the maxtime shadow variable is set to true.
modal
Ignored.
type
The type attribute specifies the MIME type of the recorded file. Valid values are:
- audio/basic
- audio/x-alaw-basic
- audio/L16
- audio/x-wav
- audio/x-nist
Form item attributes
Being a form item, the <record> element also supports the common form item attributes described in this section.
cond
The cond attribute specifies a Boolean expression. This Boolean expression must evaluate to true before the form item is available for selection within the Form Interpretation Algorithm (FIA).
expr
The expr attribute specifies the initial value of the form item variable. The default value of the expr attribute is undefined. If you set the expr attribute to a value other than the default, you will need to clear this value before the content of the form item element can be executed.
name
The name attribute specifies the name of the form item's shadow variable. The Form Interpretation Algorithm (FIA) initializes this variable with the value specified by the expr attribute. If the form item comes up for selection at a later time, it will be populated by the pre-defined type for that element. Note that the resulting value is an ECMAScript representation of the recording.
Children
- Parsed character data
- <audio>
- <catch>
- <enumerate>
- <error>
- <filled>
- <grammar>
- <help>
- <noinput>
- <nomatch>
- <prompt>
- <property>
- <value>
Parents
Sample code
<vxml>
<form>
<record name="greeting" beep="true" maxtime="10s"
finalsilence="4000ms" type="audio/x-wav">
<prompt> At the tone, please say your greeting.</prompt>
<noinput> I didn't hear anything, please try again</noinput>
</record>
<field name="confirm" type="boolean">
<prompt> Your greeting is <value expr="greeting"/>. To
keep it, say yes.To discard it, say no.</prompt>
<filled>
<if cond="confirm">
<submit next="save_greeting.pl"
enctype="multipart/form-data" method="post"
namelist="greeting"/>
</if>
<clear/>
</filled>
</field>
</form>
</vxml>