<Record>
The <Record>
verb creates an audio file with the caller's voice and returns the URL to you. Text transcriptions of these recorded calls can also be produced.
Recordings remain stored indefinitely. To delete a recording, use the appropriate API call from the Compatibility API.
Verb Attributes
Attribute | |
---|---|
action optional | The action attribute takes in an absolute or relative URL. SignalWire will make a GET or POST request to this URL when recording is completed. The current document's URL will be requested if no action is provided. There is no way to return to any instructions listed after the <Record> verb. See below for specified request parameters. |
method optional | The method attribute specifies whether the request to action is a GET or a POST . Valid values are GET or POST . Default value is POST . |
timeout optional | The timeout attribute specifies the number of seconds of silence that ends a recording. |
finishOnKey optional | The set of digits, (0-9, *, #), that can end a recording. |
maxLength optional | The maximum length, in seconds, of the recording. Particularly, a value of zero means 3600 seconds. |
playBeep optional | Whether or not a sound is played before the start of a recording. Default is true. |
trim optional | Whether or not silence in the beginning and end of recordings are removed. Allowed values are trim-silence and do-not-trim . Default value is trim-silence . |
recordingStatusCallback optional | The recordingStatusCallback attribute takes in an absolute or relative URL. SignalWire will make a GET or POST request to this URL when recording is accessible. See below for specified request parameters. |
recordingStatusCallbackEvent optional | The different recording statuses. Possible values are completed , in-progress , and absent . To specify multiple events, separate with a space. Defaults to completed . |
recordingStatusCallbackMethod optional | The type of HTTP request to use when requesting a recordingStatusCallback . Default is POST . |
storageUrl optional | The storageUrl attribute accepts an absolute URL as the destination to send a recording to, if you prefer to host your own recordings and bypass SignalWire storage. |
storageUrlMethod optional | Specifies which HTTP verb to use when sending the recording to the storageUrl . Available values are: POST and PUT. Defaults to POST. |
transcribe optional | The transcribe attribute identifies whether to produce a text transcription of the recording. There is an additional charge for this service, so is turned off by default. |
transcribeCallback optional | The ability to define a URL to which SignalWire will make a POST request to once the transcription is complete. See below for specified request parameters. |
Please note that if no audio data is received, a recording will not be saved, a request will not be made to any Action URL that is set, and the document will continue to be processed with the next verb after Record. This also applies when only silence is detected and 'trim-silence' is set, resulting in no actual audio content remaining to save. If you don't want this behavior, set trim="do-not-trim"
.
Request parameters for action
URL
The action
request contains the Standard Request Parameters as well as:
Parameter | |
---|---|
RecordingUrl string | The URL of the recorded audio file. |
RecordingDuration integer | The duration, in seconds, of the audio recording. |
Digits string | The buttons pressed to end a recording. |
Request parameters for recordingStatusCallback
The recordingStatusCallback
request contains the following parameters:
Parameter | |
---|---|
AccountSid string | The unique ID of the Account this call is associated with. |
CallSid string | A unique identifier for the call. May be used to later retrieve this message from the REST API. |
RecordingSid string | The unique identifier for the recording. |
RecordingUrl string | The URL for the audio recording. |
RecordingStatus string | The status of the recording. |
RecordingDuration integer | The duration, in seconds, of the recording. |
RecordingChannels integer | The number of channels in the recording. |
RecordingSource string | The type of call that initiated the recording. |
Request parameters for transcribeCallback
The transcribeCallback
request contains the Standard Request Parameters as well as:
Parameter | |
---|---|
TranscriptionSid string | The unique, 34 character ID of the transcription. |
TranscriptionText string | The text of the transcription. |
TranscriptionStatus string | The status of the transcription (completed or failed). |
TranscriptionUrl string | The URL for the transcription's REST API resource. |
RecordingSid string | The unique, 34 character identifier for the recording from which the transcription was generated from. |
RecordingUrl string | The URL for the audio recording from which the transcription was generated from. |
Nesting
No other verbs can be nested within <Record>
and you cannot nest <Record>
within any other verbs.
Examples
A Simple Recording
- XML
- JavaScript
- C#
- Python
- Ruby
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Record/>
</Response>
const { RestClient } = require("@signalwire/compatibility-api");
const response = new RestClient.LaML.VoiceResponse();
response.record();
console.log(response.toString());
using Twilio.TwiML;
using System;
class Example
{
static void Main()
{
var response = new VoiceResponse();
response.Record();
Console.WriteLine(response.ToString());;
}
}
from signalwire.voice_response import VoiceResponse, Record
response = VoiceResponse()
response.record()
print(response)
require 'signalwire/sdk'
response = Signalwire::Sdk::VoiceResponse.new do |response|
response.record
end
puts response.to_s
The caller will hear a 'beep' and the recording will begin.
Recording a Voicemail
- XML
- JavaScript
- C#
- Python
- Ruby
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>
Please leave a message at the beep.
Press the pound key when finished.
</Say>
<Record
action="http://your-application.com/handleRecording.php"
method="GET"
maxLength="15"
finishOnKey="#"
/>
</Response>
const { RestClient } = require("@signalwire/compatibility-api");
const response = new RestClient.LaML.VoiceResponse();
response.say("Please leave a message at the beep. Press the pound key when finished.");
response.record({
action: "http://your-application.com/handleRecording.php",
method: "GET",
maxLength: 15,
finishOnKey: "#",
});
console.log(response.toString());
using Twilio.TwiML;
using Twilio.Http;
using System;
class Example
{
static void Main()
{
var response = new VoiceResponse();
response.Say("Please leave a message at the beep. Press the pound key when finished.");
response.Record(action: new Uri("http://your-application.com/handleRecording.php"),
method: HttpMethod.Get, maxLength: 15, finishOnKey: "#");
Console.WriteLine(response.ToString());;
}
}
from signalwire.voice_response import VoiceResponse, Record, Say
response = VoiceResponse()
response.say('Please leave a message at the beep. Press the pound key when finished.')
response.record(action='http://your-application.com/handleRecording.php', method='GET', max_length=15, finish_on_key='#')
print(response)
require 'signalwire/sdk'
response = Signalwire::Sdk::VoiceResponse.new do |response|
response.say(message: 'Please leave a message at the beep. Press the pound key when finished.')
response.record(action: 'http://your-application.com/handleRecording.php', method: 'GET', max_length: 15, finish_on_key: '#')
end
puts response.to_s
This prompt will play before the 'beep', asking the caller to leave a message. The caller can only leave a message that is 15s long.
Transcribing a Recording
- XML
- JavaScript
- C#
- Python
- Ruby
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Record
transcribe="true"
transcribeCallback="http://your-application.com/handle_transcribe.php" />
</Response>
const { RestClient } = require("@signalwire/compatibility-api");
const response = new RestClient.LaML.VoiceResponse();
response.record({
transcribe: true,
transcribeCallback: "http://your-application.com/handle_transcribe.php",
});
console.log(response.toString());
using Twilio.TwiML;
using System;
class Example
{
static void Main()
{
var response = new VoiceResponse();
response.Record(transcribe: true,
transcribeCallback: new Uri("http://your-application.com/handle_transcribe.php"));
Console.WriteLine(response.ToString());;
}
}
from signalwire.voice_response import VoiceResponse, Record
response = VoiceResponse()
response.record(transcribe=True, transcribe_callback='http://your-application.com/handle_transcribe.php')
print(response)
require 'signalwire/sdk'
response = Signalwire::Sdk::VoiceResponse.new do |response|
response.record(transcribe: true, transcribe_callback: 'http://your-application.com/handle_transcribe.php')
end
puts response.to_s
SignalWire will record the caller and transcribe the recording once it is complete. Then, SignalWire will make a POST
request to the
transcribeCallback
URL with the transcription as a parameter.
Notes on Usage
- SignalWire will trim leading and trailing silence from your audio files, causing the duration of calls to be less than the time spent recording.