<Record> verb records the caller's voice and returns to you the URL of a file containing the audio recording. You can optionally generate text transcriptions of recorded calls by setting the 'transcribe' attribute of the
<Record> verb to "true."
<Record> verb supports the following attributes that modify its behavior:
|Attribute Name||Allowed Values||Default Value|
|action||relative or absolute URL||current document url|
|timeout||positive integer||5 seconds|
|finishOnKey||any digit, #, *||1234567890*#|
|maxLength||integer greater than 1||3600 (1 hour)|
|transcribeCallback||relative or absolute URL||none|
The action attribute takes an absolute or relative URL as a value. When recording is finished Twilio will make a GET or POST request to this URL with the form parameters "RecordingUrl", "Duration" and "Digits". If no action is provided,
<Record> will default to requesting the current document's URL.
|RecordingUrl||the URL of the recorded audio|
|Duration||the time duration of the recorded audio|
|Digits||the key (if any) pressed to end the recording|
The method attribute takes the value GET or POST. This tells Twilio whether to submit the action URL as a GET or POST method. This attribute is modeled after the HTML form method attribute. POST is the default value.
The timeout attribute tells Twilio to end the recording after this many seconds of silence have passed. The default is 5 seconds.
The finishOnKey attribute lets you choose a set of digits that end the recording. For example, if you set finishOnKey="#", and the user presses #, Twilio will immediately stop recording and submit the RecordingUrl, Duration, and the '#' to the action URL. The allowed values are the numbers 0-9, # and *. The default is '1234567890*#' (any key will end the recording). Unlike
<Gather>, you may specify more than one character as a finishOnKey value.
The maxLength attribute lets you set the maximum length of the recording in seconds. If you set maxLength="30", the recording will automatically end and submit after 30 seconds of recording. Defaults to 3600 seconds (1 hour) for a normal recording and 120 seconds (2 minutes) for a transcribed recording.
The transcribe attribute tells Twilio that you would like a text representation of the audio of the recording. Twilio will pass this recording to our speech-to-text engine and attempt to convert the audio to human readable text. The transcribe option is off by default. If you do not wish to perform transcription, do not include the transcribe attribute.
The transcribeCallback attribute is used in conjunction with the "transcribe" attribute. It allows you to specify a URL to which Twilio will make a POST request when the transcription is complete. The request Twilio sends will contain the standard Twilio parameters (AccountSid, CallSid, Caller, etc.) as well as "TranscriptionStatus", "TranscriptionText", "TranscriptionUrl" and "RecordingUrl". If transcribeCallback is not specified, the completed transcription will be stored for you to retrieve later (see the REST API Transcriptions section), but Twilio will not asynchronously notify your application.
|TranscriptionText||contains the text of the transcription|
|TranscriptionStatus||status of the transcription attempt: "completed" or "failed"|
|TranscriptionUrl||a URL representing the transcription REST resource|
|RecordingUrl||a URL representing the transcription's source recording resource|
The playBeep attribute allows you to toggle between playing a sound before the start of a recording. If you set the value to false, no beep sound will be played.
<Record> verb has no "noun". It does not act on anything.
<Record> verb can be nested in the following elements:
The following verbs can be nested within
<?xml version="1.0" encoding="UTF-8"?> <Response> <Record/> </Response>
Twilio will execute the
<Record> verb causing the caller to hear a beep and the recording to start. If the caller is silent for more than 5 seconds, hits the # key, or the recording maxlength time is hit, Twilio will make an HTTP POST request to the default action (the current document URL) with the parameters RecordingUrl and Duration.
<?xml version="1.0" encoding="UTF-8"?> <Response> <Say> Please leave a message at the beep. Press the star key when finished. </Say> <Record action="http://foo.edu/handleRecording.php" method="GET" maxLength="20" finishOnKey="*" /> <Say>I did not receive a recording</Say> </Response>
This is example shows a simple voicemail prompt. The caller is asked to leave a message at the beep. The
<Record> verb beeps and begins recording up to 20 seconds of audio.
<?xml version="1.0" encoding="UTF-8"?> <Response> <Record transcribe="true" transcribeCallback="/handle_transcribe.php"/> </Response>
Twilio will record the caller. When the recording is complete, Twilio will transcribe the recording and make an HTTP POST request to the transcribeCallback URL containing a transcription of the recording.