< record >
Description
The <record> element collects a recording from the user. A reference to the recorded audio is stored in the field item variable which can be played back or submitted to a server.
Syntax
<record name="String" expr="ECMAScript_Expression" cond="ECMAScript_Expression" modal="true" | "false" beep="true" | "false" maxtime="time_interval" finalsilence="time_interval" dtmfterm="true" | "false" type="MIME_type"> child elements dest="URI" destexpr="ECMAScript_Expression" </record>
Attributes
name | The name attribute defines the field item variable that holds the recording. This attribute is required. |
expr | The expr attribute indicates the initial value of the field item variable. The <record> element will not be executed if the value is not undefined. This attribute is optional and defaults to undefined. |
cond | The cond attribute is a Boolean expression that must evaluate to true in order for <record> to execute. This attribute is optional and defaults to true. |
modal | If the modal attribute is true, all higher-level speech and DTMF grammars are turned off while making the recording. If this attribute is false, speech and DTMF grammars scoped to the form, document, application, and calling documents are listened to. This attribute is optional and defaults to true. |
beep | The beep attribute, if set to true, is the tone emitted just prior to recording. This attribute is optional and defaults to false. |
maxtime | The maxtime is the maximum duration to record. Minimum value is 100ms. This attribute is optional. |
dtmfterm | The dtmfterm attribute, if set to true, will enable a DTMF key press to terminate a recording. The DTMF tone is not part of the recording. This attribute is optional and defaults to true. |
type | The type attribute is the media format of the resulting recording. This attribute is optional and defaults to “audio/x-wav”. Supported values are : “audio/x-gsm”, “audio/x-wav”, “video/mp4” (Iso Files, not mpeg3 files) and “video/3gpp”. You can set the Asterisk formats with “format/x”, where 'x' is the extension format. Example : “format/gsm” |
dest (not standard) | The dest attribute is a URI of the destination local file name. With the option 'mark' this parameter only can define the file name. This attribute is not standard and have been created to extend the functionalities of the VoiceXML interpreter. This attribute is optional – use dest or destexpr. |
Destexpr (not standard) | The destexpr attribute is an expression that yields the destination. This attribute is optional – use dest or destexpr. |
Shadow Variables
The following shadow variables are available in the same scope of the field item variable called name$:
- name$.duration – the duration of the recording in milliseconds.
- name$.size – the size of the recording in bytes.
- 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 null. - name$.maxtime – true if the recording was terminated because the maxtime duration was reached.
Parents
<form>
Children
<audio>, <catch>, <enumerate>, <error>, <filled>, <help>, <nomatch>, <noinput>, <grammar>, <prompt>, <property>, <value>
Extensions
I6NET can provide video tools to manage the recorded files (ex : generate thumbnail, convert the video files to FLV/Flash, or make audio extractions).
Limitations/Restrictions
The attribute mintime is not supported. The following shadow variables are not set: name$.size, name$.maxtime.
Example Code
<?xml version="1.0"?> <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml"> <form> <record name="awaymessage" beep="true" maxtime="10s" finalsilence="4s" dtmfterm="true"> <prompt> At the tone, please record your message </prompt> </record> <field name="confirm" type="boolean"> <prompt> The message is <value expr="awaymessage"/> </prompt> <prompt> To keep it, please say yes. To discard it, say no </prompt> <filled> <if cond="comfirm"> <submit next="save.php" method="post" namelist="awaymessage" /> </if> </filled> </field> </form> </vxml>