*** id: d4233f2c-adfc-4eed-bbc2-62bd6619e91e title: Record sidebar-title: Record slug: /cxml/reference/voice/record position: 1 max-toc-depth: 3 ---------------- The `` 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](/docs/compatibility-api/rest/recordings/delete-recording). Any instructions placed after the `` verb will not be executed. To ensure additional instructions are processed, use the `action` attribute to specify a URL that SignalWire will request once the recording is complete. ## Verb attributes 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 which can lead to unwanted looping behavior if you're not careful. See [below](#record_action) for specified request parameters. The set of digits, (0-9, \*, #), that can end a recording. The maximum length, in seconds, of the recording. A value of zero means 3600 seconds. The `method` attribute specifies whether the request to action is a `GET` or a `POST`. Valid values are `GET` or `POST`. Whether or not a sound is played before the start of a recording. 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](#record_recordingStatusCallback) for specified request parameters. The different recording statuses. Possible values are `completed`, `in-progress`, and `absent`. To specify multiple events, separate with a space. The type of HTTP request to use when requesting a `recordingStatusCallback`. 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. Specifies which HTTP verb to use when sending the recording to the `storageUrl`. Available values are: **POST** and **PUT**. The `timeout` attribute specifies the number of seconds of silence that ends a recording. 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. The ability to define a URL to which SignalWire will make a `POST` request to once the transcription is complete. See [below](#record_transcribeCallback) for specified request parameters. Whether or not silence in the beginning and end of recordings are removed. Allowed values are `trim-silence` and `do-not-trim`. If no audio data is received, including when a caller is silent and `trim-silence` is enabled, SignalWire will not save a recording. If you wish to save silence, be sure to set `trim="do-not-trim"`. Note also that SignalWire will trim leading and trailing silence from your audio files, causing the duration of calls to be less than the time spent recording. When recording finishes, including when no audio data is received, `` will always request its `action` URL and process the cXML instructions that are returned. If no `action` URL is set, SignalWire will re-request the current cXML document's URL by default. **This can lead to unwanted looping behavior**, so make sure to end the call using `action` as seen in the [Recording a Voicemail example](#recording-a-voicemail). #### Request parameters for `action` URL \[#record\_action] The `action` request contains the [Standard Request Parameters](/docs/compatibility-api/cxml/reference/voice#request-parameters) as well as: The buttons pressed to end a recording. The duration, in seconds, of the audio recording. The URL of the recorded audio file. #### Request parameters for `recordingStatusCallback` \[#record\_recordingStatusCallback] #### Request parameters for `transcribeCallback` \[#record\_transcribeCallback] ## Nesting No other verbs can be nested within `` and you cannot nest `` within any other verbs. ## Examples ### Recording a voicemail ```xml Please leave a message at the beep. Press the pound key when finished. ``` ```javascript title="Node.js" 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()); ``` ```csharp 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());; } } ``` ```python 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) ``` ```ruby 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 title="Node.js" 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()); ``` ```csharp 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());; } } ``` ```python from signalwire.voice_response import VoiceResponse, Record response = VoiceResponse() response.record(transcribe=True, transcribe_callback='http://your-application.com/handle_transcribe.php') print(response) ``` ```ruby 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.