Skip to main content

<Record>

Records the caller's audio. At the end of recording, Exotel POSTs the recording URL to your action endpoint.

Syntax​

<Record action="https://your-app.example.com/recording-done" maxLength="60"/>

Attributes​

AttributeRequiredDefaultDescription
actionNoCurrent URLURL to POST the recording URL to when done
methodNoPOSTHTTP method for action
maxLengthNo3600Maximum recording duration in seconds
timeoutNo5Seconds of silence before stopping recording
finishOnKeyNo1234567890*#Key that stops recording
playBeepNotruePlay a beep before recording starts

Example — voicemail recording​

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>Our team is unavailable. Please leave a message after the beep.</Say>
<Record
action="https://your-app.example.com/voicemail"
maxLength="60"
finishOnKey="#"
playBeep="true"
/>
<Say>Thank you for your message. Goodbye.</Say>
<Hangup/>
</Response>

Action URL parameters​

When recording finishes, Exotel POSTs to action:

ParameterDescription
RecordingUrlURL of the recording file
RecordingDurationDuration in seconds
RecordingSidUnique recording identifier
CallSidCall identifier

Legs API — StartRecording / StopRecording​

For mid-call recording on an active leg:

# Start recording
curl -u '<api_key>:<api_token>' -X POST \
'https://cpaas-api.in.exotel.com/v2/accounts/<account_sid>/legs/<leg_sid>/actions/start_recording' \
-H 'Content-Type: application/json' \
-d '{}'

# Stop recording
curl -u '<api_key>:<api_token>' -X POST \
'https://cpaas-api.in.exotel.com/v2/accounts/<account_sid>/legs/<leg_sid>/actions/stop_recording' \
-H 'Content-Type: application/json' \
-d '{}'

Using ExoML in a Legs API action:

# Start recording with silence detection
curl -u '<api_key>:<api_token>' -X POST \
'https://cpaas-api.in.exotel.com/v2/accounts/<account_sid>/legs/<leg_sid>/actions' \
-H 'Content-Type: application/json' \
-d '{
"exoml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Flow><StartRecording silenceInSec=\"5\" maxDuration=\"300\"/></Flow>"
}'

StartRecording XML attributes​

AttributeRequiredDefaultDescription
silenceInSecNo—Stop recording after N seconds of silence
maxDurationNo—Maximum recording duration in seconds
storageTypeNoexotelStorage backend: exotel or https (custom URL)
storageUrlNo—Custom storage URL when storageType="https"

Events emitted​

EventDescription
recording_startedRecording has begun
recording_completedRecording finished; URL in event payload
recording_stoppedRecording stopped early via stop_recording