<Record>

The <Record> element is used to record audio during a call. It can occur anywhere within an InboundXML document but will only begin recording once it has been reached. This means it should be the first element for the entire call to be recorded.

When the recording is complete, a URL of the recorded audio is created and submitted as a GET or POST to the action URL. Similar to the element, a timeout value sets how much silence to allow before the recording ends, maxLength sets how long the recording may be, and the finishOnKey is used to set which keys will end the recording.

By default, the action and method specify that should make a POST to the URL of the current InboundXML document.

Element Attributes

Attribute

Description

action optional

URL where some parameters specific to will be sent for further processing.

method optional

Method used to request the action URL.

  • Valid values: POST and GET
  • Default value: POST

timeout optional

The number of seconds should wait during silence before ending.

  • Valid value: integer greater than or equal to 1
  • Default value: 5

finishOnKey optional

The key a caller can press to end the recording. Valid values: digits from 0 to 9, #, or *

  • Default value: #

maxLength optional

The maximum length in seconds a recording should be.

  • Valid value: integer greater than or equal to 1
  • Default value: 3600

playBeep optional

Boolean value specifying if a beep should be played when the recording begins.

  • Valid value: true, false
  • Default value: false

fileFormat optional

The recording file format. Can be mp3 or wav.

  • Valid value: mp3, wav
  • Default value: mp3

background optional

Begin recording the call while continuing the execution of any other present InboundXML in the background (true) or block the execution of subsequent InboundXML until the record element finishes (via finishOnKey or timeout). Note that the timeout, finishOnKey, and playBeep attributes have no effect when the background is set to true.

  • Valid value: true, false
  • Default value: true

trimSilence optional

Trims all silence from the beginning of the recording. Any other value will default to "false".

  • Valid value: true, false

Action Attribute Properties

The following is a set of properties that are sent along with the action URL.

AttributeDescription
RecordingSidA unique id that will be created when recording is started for each call.
RecordUrlA valid mp3 or wav audio file URL which contains the recording.
RecordStartTimeThe time when recording is started.
RecorddurationThe duration of the recording in seconds.
RecorddirectionThe direction of the recording, either inbound or outbound.
CallSidThe unique id that will be created for each call.
AccountSidA valid Ytel API AccountSid
FromA valid 10-digit number (E.164 format) that will be initiating the phone call.
ToA valid 10-digit number (E.164 format) that will receive the phone call.

Nesting

The <Record> element cannot be nested within any other verbs besides the default <Response> element. The element cannot nest any other elements within itself.

<Response>
  <Say>Please state your name.</Say>
  <Record background="false" action="http://your-url.com/" timeout="100" method="POST" finishOnKey="#"></Record>
</Response>