Skip to main content

Call Recording

Recording calls is useful for quality, training, and dispute resolution — but it carries consent and compliance obligations. This guide covers enabling recording, capturing consent, storage, and retrieval.

🚀 Quick Start​

curl -X POST https://api.afriroute.ai/api/v1/voice/calls \
-H "Authorization: Bearer $AFRIROUTE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "+254712345678",
"from": "+254700000000",
"record": true,
"recording_callback_url": "https://example.com/recordings"
}'

🎙️ Enabling Recording​

Set record: true when creating a call, or start recording mid-call once consent is captured.

await fetch('https://api.afriroute.ai/api/v1/voice/calls', {
method: 'POST',
headers: { 'Authorization': 'Bearer $AFRIROUTE_API_KEY', 'Content-Type': 'application/json' },
body: JSON.stringify({
to: '+234803000000',
from: '+234700000000',
record: true,
recording_channels: 'dual' // separate caller/agent tracks
})
});
OptionValuesNotes
recordtrue / falseMaster switch
recording_channelsmono / dualDual keeps speakers on separate tracks
recording_callback_urlURLNotified when the file is ready

Many African jurisdictions require notifying or obtaining consent from the caller before recording.

  • Play a disclosure at call start: "This call may be recorded for quality."
  • Capture explicit consent for sensitive flows ("Press 1 to consent to recording").
  • Stop on opt-out — don't record if the caller declines.
  • Keep a consent log tied to the recording ID.
{
"say": "This call may be recorded for quality and training. Press 1 to continue.",
"gather": { "input": "dtmf", "num_digits": 1 }
}

💾 Storage & Retrieval​

Recordings are stored securely and referenced by a recording ID delivered to your callback.

import requests

def fetch_recording(recording_id):
r = requests.get(
f'https://api.afriroute.ai/api/v1/voice/recordings/{recording_id}',
headers={'Authorization': 'Bearer $AFRIROUTE_API_KEY'}
)
return r.json()['download_url'] # short-lived signed URL

The webhook payload when a recording is ready:

{
"recording_id": "rec_9F2K",
"call_id": "call_abc123",
"duration": 184,
"format": "mp3",
"status": "completed"
}

💡 Best Practices​

  • Disclose recording at the start of every recorded call.
  • Set a retention policy and delete recordings past it.
  • Restrict access to recordings via scoped API keys.
  • Use dual-channel when you need speaker separation for analytics.
  • Download promptly — signed URLs expire.
  • Encrypt at rest and in transit (handled by the platform).

Last Updated: May 2026