# <record>

Description

Collects a recording from the user. A reference to the recorded audio is stored in the form item variable, which can be played back or submitted to a server.

Syntax

    <record
        name="string"
        expr="ECMAScript_Expression"
        cond="ECMAScript_Expression"
        modal="boolean"
        beep="boolean"
        maxtime="time_interval"
        mintime="time_interval"
        beginsilence="time_interval"
        finalsilence="time_interval"
        dtmfterm="boolean"
        type="MIME_type"
        dest="URI"
        destexpr="ECMAScript_Expression">
      child elements
    </record>

Attributes

Attribute | Description
name | The name of this recording. This variable holds the result of the record, and can be referenced anywhere within the record's form. The result is actually the file location of the recorded audio on the IP Media Server platform. When referenced as `<audio expr="name"/>`, the recorded audio will be played back. When referenced as `<value expr="name"/>`, the recording will also be played, but only in contexts where audio playback is possible. The recording variable can also be used to submit the audio data. In other references (ex. in `<value>` within `<log>`; if modified by string functions in `<value>`; in `<script>`s, etc.), the `name` will be treated as a string, and will give the file location. Optional. (Defaults to an inaccessible internal variable.)
expr | An ECMAScript expression to be evaluated and used as the initial value of this record. This record will be visited only if the expression evaluates to `undefined`. Optional. (Defaults to undefined.)
cond | An ECMAScript expression to be evaluated and used as a boolean condition. This record will be visited only if the expression evaluates to `true`. Optional. (Defaults to true.)
modal | Set to true if only the record's (dtmf) grammars are enabled. Otherwise, all active (dtmf) grammars are enabled. Optional. (Defaults to true.)
beep | Specifies whether or not a beep should be emitted just prior to recording. Optional. (Defaults to false.)
maxtime | The maximum duration to record. Minimum value is 250ms (if defined as a shorter duration, it will be set to 250ms); maximum value is whatever the default is (if defined as a longer duration, it will be set to the default). Optional. (Defaults to 600000ms/10min or value of com.voicegenie.maxrecordtime property.)
mintime | If the duration of the recording is less than this attribute, then the recording is assumed to be empty and a `noinput` is thrown. Minimum value is 250ms (if defined as a shorter duration, it will be set to 250ms); maximum value is the value of the `maxtime` attribute (if defined as a longer duration, it will be set to 250ms). Optional. (Defaults to 250ms.)
beginsilence | The time to wait, if no speech occurs, before throwing a `noinput` event. Minimum value is 0ms; maximum value is the value of the `maxtime` attribute. Optional. (Defaults to `timeout` of the last prompt before the recording.)
finalsilence | The interval of silence that indicates end of speech. Maximum value is the value of the `maxtime` attribute. Optional. (Defaults to 4s.)
dtmfterm | Setting this to true is equivalent to defining a local DTMF grammar which matches any single DTMF key (to terminate recording). The DTMF tone will not be part of the recording. Optional. (Defaults to true.)
type | The media format of the resulting recording. Optional. (Defaults to audio/basic.). See Type Chart, below.
dest | The destination of the recording. Optional.
destexpr | An ECMAScript expression to be evaluated and used as the destination of the recording. Optional.

Attribute Notes

- An error event may be thrown if a reserved ECMAScript word is used as the name.

Type Chart

The following types are also supported for full-call recording.

Expected File Extension | Mime-type | Sample Rate | File Format/Sample Size/Encoding
.vox | audio/x-vox | 8000 Hz | Raw audio 8-bit mono u-law, a-law (depends on Media Server configuration)
.au | audio/basic | 8000 Hz | Audio with .au header 8-bit mono u-law, a-law, PCM, ADPCM (depends on file header information)
.vox | audio/basic | 8000 Hz | Raw audio 8-bit mono u-law, a-law (depends on Media Server configuration)
.alaw | audio/x-alaw-basic | 8000 Hz | Raw audio 8-bit mono a-law
.adpcm16 | audio/x-g726-16 | 8000 Hz | Raw audio 16kbit/sec ADPCM (g726)
.adpcm24 | audio/x-g726-24 | 8000 Hz | Raw audio 24kbit/sec ADPCM (g726)
.adpcm | audio/x-g726 audio/x-adpcm audio/adpcm audio/x-adpcm8 | 8000 Hz | Raw audio 32kbit/sec ADPCM (g726)
.adpcm40 | audio/x-g726-40 | 8000 Hz | Raw audio 40kbit/sec ADPCM (g726)
.pcm8 | audio/L8 | 8000 Hz | Raw audio 8-bit unsigned mono Linear PCM
.pcm16 | audio/L16 | 8000 Hz | Raw audio 16-bit signed mono Linear PCM
.wav | audio/x-wav | 8000 Hz | Audio with .wav header 8-bit mono u-law, a-law, PCM, ADPCM (depends on file header information)
.nist | audio/x-wav | 8000 Hz | Audio with NIST header 8-bit mono u-law, a-law (depends on file header information)
.wav | video/x-wav |  | Audio/Video with .wav header
audio/3GPP | .3gp, .3gpp |  | Audio with .wav header
video/3GPP | .3gp, .3gpp |  | Video with .wav header

Notes AU and NIST file recording is not currently supported. Only g726 ADPCM files are supported. Currently, the platform supports 24, 32, and 40 kbit/sec. 16 kbit/sec g726 will be supported in the future. Only 8000 Hz sampling rate is supported. The above types are also supported for full-call recording. Shadow Variables For each `<record>` whose `name` attribute is set to `<name>`, there is a shadow variable `<name>$` (in the same scope as the record name variable), containing the following properties:
Property | Description
name$.duration | The duration of the recording in seconds. It is an ECMAScript number.
name$.size | The size of the recording in bytes. It is an ECMAScript number.
name$.termchar | If the dtmfterm attribute is true, and the user terminates the recording by pressing a DTMF key, then this shadow variable is the key pressed (e.g. "#"). Otherwise it is ECMAScript `undefined`.
name$.maxtime | Set to true if the recording was terminated because the maxtime duration was reached. It is an ECMAScript boolean.
name$.dest | (extension) The URI referencing the recording. If the destination redirects the original request, for instance in the case of RTSP or HTTP servers, this variable holds the redirected URI.
name$.filetype | (extension) The media format of the recorded audio file.
name$.markname | (VoiceXML 2.1 feature) The name of the mark last executed by the SSML processor before barge-in occurred or the end of audio playback occurred. If no mark was executed, this variable is `undefined`. This is only meaningful when the `<record>`'s prompts contain `<mark>`s.
name$.marktime | (VoiceXML 2.1 feature) The number of milliseconds that elapsed since the last mark was executed by the SSML processor, until barge-in occurred or the end of audio playback occurred. If no mark was executed, this variable is `undefined`. This is only meaningful when the `<record>`'s prompts contain `<mark>`s.
Shadow Variable Notes When any shadow variable is not set, its value will be ECMAScript `undefined`. In standards compliance mode, the shadow variables are not set after a `noinput`. If the `com.voicegenie.STRICTCONFORMANCE` property is set to `FALSE`, the shadow variables are set after a `noinput`. Parents <form> Children <audio>, <catch>, <dtmf>, <error>, <filled>, <grammar>, <help>, <noinput>, <nomatch>, <prompt>, <property>, <value>, #PCDATA Extensions Added `mintime` attribute. Added `beginsilence` attribute. Added `dest` attribute. Added `destexpr` attribute. Added `dest` and `filetype` shadow variables. Added `<dtmf>` as a child, to be used like `<grammar>`. Limitations/Restrictions Currently, speech grammars are not supported within a recording in any version. DTMF support is as follows: DTMF grammars are supported within a recording. Note that to make use of DTMF grammars, you must set `dtmfterm="false"` (the default value is "true"). Otherwise, the first digit entered will always terminate the recording, and explicit grammars will never be matched. When recording very short phrases, it may be necessary to set the `beginsilence` and `finalsilence` attributes, to avoid a `noinput` event being thrown. Example
    <?xml version="1.0"?>
    <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
      <form>
        <record name="message" beep="true" maxtime="10s">
          <prompt>
            At the tone, please record your message.
          </prompt>
          <filled>
            You recorded <value expr="message"/>.
          </filled>
        </record>
      </form>
    </vxml>