Home > Articles > Web Services > XML

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

3.43 record

Element type

record

Attributes

beep | cond | dest | dtmfterm | expr | finalsilence | maxtime | modal | name | type

Parents

form

Children

PCDATA | audio | catch | enumerate | error | filled | grammar | help | noinput | nomatch | prompt | property | value

Description

The record element is a form item that asks the caller a question in a fashion similar to a field element, but instead of interpreting this response with a grammar it simply records the caller's response to to some resource (e.g. a file, RAM, etc.) associated with the value of the record element's name attribute. This recording can be passed to a server by including the record's form item variable in the namelist attribute of a submit or subdialog element. After the interpreter visits the record element it will also set several shadow variables associated with this element's form item variable:

  • name.duration : integer

    The duration of the recording in milliseconds.

  • name.size : integer

    The size of the recording in bytes.

  • name.termchar : char

    The DTMF key pressed to terminate the recording (or null if the dtmf attribute is set to false).

  • name.maxtime : boolean (2.0)

    Indicates whether the recording was terminated due to the maxtime duration being reached.

DTD

<!ELEMENT record (%audio; | %event.handler; | filled | grammar 
                                           | prompt | property)* >
<!ATTLIST record
  %item.attrs;
  type         CDATA      #IMPLIED
  beep         %boolean;  'false'
  dest         %uri;      #IMPLIED
  maxtime      %duration; #IMPLIED 
  modal        %boolean;  'true'
  finalsilence %duration; #IMPLIED
  dtmfterm     %boolean;  'true'  >

Language model

Attributes

  • beep : boolean = false

    Indicates whether the interpreter should play a beep before recording.

  • cond : expression = true

    A guard condition associated with this form item, written as an ECMAScript expression. This expression must evaluate to true for the Form Interpretation Algorithm to visit this form item.

  • dest : uri

    Indicates a remote location for storing the recorded audio. The destination URI must be able to receive an audio stream. It must also allow for the retrieval of that audio in case this record element's form item variable is used in a submit or subdialog element's namelist attribute. If the latter capability fails, the interpreter will throw an error.semantic event.

  • dtmfterm : boolean = true

    Indicates whether a DTMF tone would terminate the recording.

  • expr : expression = undefined

    An ECMAScript expression defining an initial value for this form item. The Form Interpretation Algorithm will visit record only if the expression evaluates to undefined.

  • finalsilence: duration

    Indicates the duration of silence to be interpreted as the end of the recording.

  • maxtime : duration

    The maximum duration to record (e.g. 10s, 7500ms, etc.).

  • modal : boolean = true

    Indicates whether other grammars are active while recording. If false, other grammars will be active. If true, no recognition capabilities will be activated during recording.

  • name : field.name

    The name associated with this form item. When the caller fills this form-item, by producing an utterance that matches that item's grammar, the value will be stored in a variable of this name visible from within the containing form element.

  • type : CDATA

    The MIME type of the resulting audio file. While the supported values for type are platform-specific, the types shown inTable 3-3 must be supported by all Voice XML platforms.

Table 3-3. VoiceXML 2.0 supported audio MIME types

MIME type

Description

audio/basic

Raw (headerless) 8 kHz 8-bit mono mu-law [PCM] single channel (G.711).

audio/x-alaw-basic

Raw (headerless) 8 kHz 8-bit mono A-law [PCM] single channel (G.711).

audio/wav

WAV (RIFF header) 8 kHz 8-bit mono mu-law [PCM] single channel.

Children

  • audible elements

    Indicate the audio to be played before starting the recording.

  • event.handler elements

    Provide event handlers active only during the record element's invocation.

  • filled

    Contains executable content invoked when the recording has completed.

  • grammar

    Specifies a grammar to be active during the prompt and recording phase (if supported).

  • prompt

    Specifies a prompt to be played to the caller before the recording begins.

  • property

    Specifies a property setting local to this record element's invocation.

Examples

Example 3-54 A dialog that records and plays back a message

<?xml version="1.0" encoding="iso-8859-1"?>
<vxml version="2.0">
  <form id="callback">
    <record name="msg" beep="true" finalsilence="3000ms" 
            dtmfterm="true">
      <prompt>Please start your message after the beep. 
        When you are finished press star for more options.</prompt>
    </record>
    <field name="confirm" type="boolean">
      <prompt>
        Here is the message you recorded <break/> 
        <value expr="msg"/> Do you want to keep this message?
      </prompt>
      <filled>
        <if cond="confirm=='false'">
          <prompt>Deleting your message.</prompt>
          <clear namelist="msg confirm"/>
          <reprompt/>
        </if>
      </filled>
    </field>
    <filled>
      <prompt>Thank you.</prompt>
      <submit next="http://example.com/processMsg.jsp" 
                                         amelist="msg"/>
    </filled>
  </form>
</vxml>
  • + Share This
  • 🔖 Save To Your Account