The Record Element

The <Record> element is used to record a call and returns the URL of the recording file.

Element Attributes

The attributes supported by the <Record> element are listed below. The default behavior of each attribute can be modified using the allowed values.

Attribute Name Description Allowed Values Default Value
action Submit the result of the record to this URL. See the action Request Parameters table below for more information. absolute URL (mandatory) no default action for Record
method Submit to action url using GET or POST GET, POST POST
fileFormat The format of the recording. Valid formats: mp3,wav. Defaults to mp3. mp3, wav mp3
redirect If false, don’t redirect to action url, only request the url and continue to next element. true, false true
timeout Seconds of silence before considering the recording complete (default 500). Only used when recordSession and startOnDialAnswer are ‘false’. positive integer 15
maxLength Maximum number of seconds to record (default 60). integer greater than 1 60 (1 min)
playBeep Play a beep before recording (true/false, default true). Only used when bothLegs is ‘false’. true, false true
finishOnKey Stop recording on this key. Only used when recordSession and startOnDialAnswer are false. any digit, #, * 1234567890*#
recordSession Record current call session in background (true/false, default false). No beep will be played. true, false false
startOnDialAnswer Record call when called party answers in a Dial (true/false, default false). No beep will be played. true, false false
transcriptionType The type of transcription required.
  • auto - Transcription is completely automated; turnaround time is about 5 minutes.
  • hybrid - Transcription is a combination of automated and human verification processes; turnaround time is about 10-15 minutes.
  • *Our transcription service is primarily for the voicemail use case (limited to recorded files lasting for up to 2 minutes). Currently the service is available only in English and you will be charged for the usage. Please check out the price details.
auto
transcriptionUrl The URL where the transcription is available. absolute URL none
transcriptionMethod The method used to invoke transcriptionUrl. GET, POST GET
callbackUrl If set, this URL is fired in background when the recorded file is ready to be used. See the callbackUrl Request Parameters table below for more information. absolute URL None
callbackMethod Method used to notify the callbackUrl. GET, POST POST

Note the following points regarding the Record element attributes:

  1. If recordSession is set to true, recording will start in the background and will continue until the call has hung up or maxLength has been reached.
  2. If startOnDialAnswer is set to true, it will record the complete conversation between both the parties during the next Dial and will end when Dial is done or maxLength reached. This may not be legal in some countries.
  3. timeout, finishOnKey, playBeep attributes have no effect when recordSession or startOnDialAnswer is set to true.

action Request Parameters

The following parameters are sent to the action URL after recording is complete.

Parameter Description
RecordUrl Complete path to the recorded file URL.
Digits If set, the digits pressed to stop the record.
RecordingDuration Duration of recording in seconds.
RecordingDurationMs Duration of recording in milliseconds.
RecordingStartMs When the recording started (epoch time UTC) in milliseconds.
RecordingEndMs When the recording ended (epoch time UTC) in milliseconds.
RecordingID Recording ID of the file.

callbackUrl Request Parameters

The following parameters are sent to the callback URL if callbackUrl is specified.

Parameter Description
RecordUrl Complete path to the recorded file URL.
RecordingDuration Duration of recording in seconds.
RecordingDurationMs Duration of recording in milliseconds.
RecordingStartMs When the recording started (epoch time UTC) in milliseconds.
RecordingEndMs When the recording ended (epoch time UTC) in milliseconds.
RecordingID Recording ID of the file.

Example 1: Record a voicemail

This is an example of a simple voicemail recording. The caller is asked to leave a message after the beep. The <Record> element beeps and begins recording up to 30 seconds of audio.

If the caller remains silent, the <Record> element exits after 15 seconds, falling through to the next element. In this case, it would fall through to the <Speak> element.

  <Response>
    <Speak>Please leave a message after the beep. Press the star key when done.</Speak>
    <Record action="http://www.example.com/get_recording/" maxLength="30" finishOnKey="*" />
    <Speak>Recording not received</Speak>
  </Response>

Example 2: Record a complete call session

  <Response>
    <Record action="http://www.example.com/get_recording/" startOnDialAnswer="true" redirect="false"/>
    <Dial>
      <Number sendDigits="wwww2410">15551234567</Number>
    </Dial>
  </Response>