<Record>
<Record>
will record a message from the caller or calle.
Join our Discord community - we're here to help.
Description
The <Record>
verb records the caller's voice and submits the recording to the application.
Example
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>You are about to be recorded.</Say>
<Record recordingStatusCallback="https://example.com/recording-status" timeout="10">
<Say>You are now being recorded - say something.</Say>
</Record>
<Say>Recording is done.</Say>
</Response>
Attributes
The following attributes are supported:
Attribute Name | Allowed Values | Default Value |
---|---|---|
action | URL (relative or absolute) | current document URL |
method | GET , POST | POST |
timeout | positive integer | 5 |
finishOnKey | any digit, # , * | 1234567890*# |
maxLength | integer greater than 1 | 3600 (1 hour) |
playBeep | true , false | true |
recordingStatusCallback | relative or absolute URL | none |
recordingStatusCallbackMethod | GET , POST | POST |
recordingStatusCallbackEvent | in-progress , completed , absent | completed |
trim | trim-silence , do-not-trim | trim-silence |
Cloudonix supports nested playback verbs inside the <Record>
verb, so the application can start recording the caller while outputting instructions to the caller. If the caller starts speaking (or using DTMF to stop the recording) <Record>
will abort the playback. The timeout
starts counting only once nested playback (if any) ended or was aborted.
The only supported nested verbs are <Say>
, <Play>
and <Pause>
.
Note: If the recording was empty, the
action
URL would not be invoked and instead the application will run the next verb in the CXML document (or hangup the call if the<Record>
verb is the last in the document).
Attribute: action
The action
attribute takes an absolute or relative URL as a value. When the recording is finished Cloudonix will make a CXML request to this URL. That request will include the following parameters and CXML request headers:
Parameter | Description |
---|---|
RecordingUrl | The URL of the recorded audio. |
RecordingDuration | The duration of the recorded audio (in seconds). |
Digits | The key (if any) pressed to end the recording. |
If action
was given then after sending the request, Cloudonix will stop running the current CXML document and will start running the result from the action
URL. If an action
attribute was not specified, the CXML request with the recording result will be sent to the current document's URL, and the resulting CXML document run again - please note that this may lead to unwanted looping behavior so you should take care to specify an action
or otherwise handle the possibility of a loop in your application code.
As noted above, following verbs in the CMXL document will only be reached if the recording was empty.
Attribute: method
The method
attribute takes the value GET
or POST
. This sets the method Cloudonix will use in the CXML request to the action
URL.
Attribute: timeout
The timeout
sets the amount of silence after which the recording will be automatically stopped.attribute tells us to end the recording after a number of seconds of silence has passed. If you don't want to use timeout
, set it to 0. The default is 5 seconds.
Attribute: finishOnKey
The finishOnKey'
attribute lets you choose a set of digits that end the recording when entered.
For example, if you set finishOnKey
to #
and the caller presses #
, Cloudonix will immediately stop recording and submit RecordingUrl
, RecordingDuration
, and the #
as parameters in a request to the action
URL.
The allowed values are the digits 0
-9
, #
and *
and the default is 1234567890*#
(i.e. any key will end the recording). Unlike <Gather>
verb, you may specify more than one character as a finishOnKey
value.
Attribute: maxLength
The maxLength
attribute lets you set the maximum length for the recording in seconds.
If you set maxLength
to '30', the recording will automatically end after 30 seconds of recorded time has elapsed. This defaults to 3600 seconds (one hour) for a normal recording and 120 seconds (two minutes) for a transcribed recording.
Attribute: playBeep
The playBeep
attribute allows you to select if you want to play a 'beep' sound before the start of a recording. If you set the value to false
, no beep sound will be played.
Attribute: recordingStatusCallback
The recordingStatusCallback
attribute takes a relative or absolute URL as an argument. If a recordingStatusCallback
URL is given, Cloudonix will make a GET or POST request to the specified URL when the recording is available to access.
When sending the request, we will pass the following parameters with its request to the recordingStatusCallback
' URL:
Parameter | Description and/or values |
---|---|
AccountSid | A unique identifier of the Account responsible for this recording. |
CallSid | A unique identifier for the call associated with the recording. |
Session | The session token for the recorded call. |
RecordingSid | A unique identifier for the recording. |
RecordingUrl | The URL of the recorded audio. |
RecordingStatus | The status of the recording. Possible values are: completed , failed . |
RecordingDuration | The length of the recording, in seconds. |
RecordingChannels | 1 (because only one person was recorded). |
RecordingSource | Record (because this is the verb that asked to make the recording). |
Attribute: recordingStatusCallbackMethod
The recordingStatusCallbackMethod
attribute takes the value GET
or POST
. This sets the method Cloudonix will use in the recordingStatusCallback
request.
Attribute: recordingStatusCallbackEvent
Which events should cause the recordingStatusCallback
URL to be called. Can be any of:
in-progress
- the status call back URL will be called when recording starts.completed
- the status call back URL will be called when recording is completed, just before sending the CXML request to theaction
URL.absent
- the status call back URL will be called if there is no recording, possibly due to an error during recording.
Legal Notice
If you choose to record calls, you need to comply with certain laws and regulations, including those regarding obtaining consent to record (such as CIPA, GDPR and similar laws). We recommend that you consult with your legal counsel before using call Recording in your applications.