Call RecordingStorageRetentionSIPRECAsteriskFreeSWITCH

Call Recording at Scale: Storage, Retention, Encryption and Compliance

Recording a call takes one line of dialplan. Recording tens of thousands of calls a day, keeping them safe, finding them later, deleting them on time and proving who listened is a different project. This guide covers capture methods, real storage maths, a recording pipeline, encryption, retention and legal holds, payment-card handling and the code to start.

Kaushik ParmarFounder & VoIP Architect · 12+ years in telecom and VoIP 16 min read
57.6 MB
Hourly, mono WAV (calculated)
28.8 MB
Hourly, G.711 as-is (calculated)
17.3 TB
1,000 ch, 10 h/day, 30 days, WAV
3
Policies: retain, hold, delete

Quick answer

How do you design call recording for thousands of channels?

Recording one call is easy; recording thousands is a storage, policy and security problem. Record on the media server to local disk, move finished files to encrypted object storage with a metadata row, and let a policy service apply retention and legal holds. Mono G.711 audio is about 28.8 MB for each hour recorded and mono 16-bit WAV about 57.6 MB for each hour recorded, so 1,000 channels recorded 10 hours a day for 30 days is roughly 8.6 to 17.3 TB before overhead. Get legal advice on consent, and keep card codes out of recordings.

Why recording is hard at scale

Call recording pipeline: media servers record to local disk, a mover service uploads finished files to encrypted object storage and writes a metadata row, a policy service applies retention and legal holds, a key management service supplies per-tenant keys, and a playback API serves recordings with an audit log. A SIPREC source can feed a recorder directly.
Record locally, move asynchronously, keep metadata separate from audio.

At small scale, recording is a feature: tick a box and files appear in a folder. At scale it becomes four separate problems that all have to work at once.

Capture

Recording must not damage live calls. Writing audio to a slow or remote disk during a call can add jitter or drop audio, so capture has to be local, fast and bounded.

Storage

Volume grows with channels, hours and retention. Without a plan, disks fill, backups fail and costs surprise finance.

Governance

Retention periods, legal holds, consent, encryption and access control are legal and commercial rules that need to be enforced by software, not memory.

Retrieval

Nobody wants a recording; they want the right recording. Search by number, agent, time and outcome, and play it back securely, with every access logged.

This guide takes them in order. It builds on our guides to PBX capacity planning, where recording appears as a media cost, and custom contact centre vs CCaaS, where recording storage is one of the cost lines.

Capture methods compared

MethodHow it worksStrengthsWeaknesses
On the media serverAsterisk MixMonitor or FreeSWITCH record_session writes the call to diskSimple, full control, works for any endpointAdds CPU and disk I/O to the media servers
Media relay or SBC forkA relay such as RTPengine copies the media to a recorderRemoves load from media servers, endpoint-independentMore components to run; recorder must keep up
SIPRECThe SBC sends media and metadata to a recording server per RFC 7866Standard, works with many recorders, carries call metadataNeeds SBC and recorder support; active recording only
Endpoint recordingThe phone or app records locally and uploadsOffloads the serverUnreliable, hard to control, easy to tamper with
Network tap or port mirrorPassive capture of packetsNo change to call pathCannot see encrypted media; out of scope of SIPREC; hard in the cloud

SIPREC, the SIP-based media recording standard, is defined in RFC 7866, with the metadata model in RFC 7865. It covers active recording, where the session recording client deliberately streams media to the session recording server and the call participants are told it is happening. Support varies by platform and version, so confirm that your session border controller and recorder support the features you need before you choose it.

For most custom platforms built on Asterisk or FreeSWITCH, recording on the media server is the starting point, and the pipeline below keeps it from becoming a bottleneck. Move to a relay-based or SIPREC design when recording load starts to compete with call handling.

Recording with Asterisk and FreeSWITCH

Both engines can record a bridged call to a file. The key rules are the same: write to local disk, name files by a unique call ID, record only when the call is bridged, and never block call flow waiting for storage.

; Asterisk dialplan (extensions.conf): record a call only while it is bridged
exten => _X.,1,NoOp(Inbound call ${UNIQUEID})
 same => n,Set(__REC_DIR=/var/spool/asterisk/rec/${STRFTIME(${EPOCH},,%Y/%m/%d)})
 same => n,System(mkdir -p ${REC_DIR})
 same => n,MixMonitor(${REC_DIR}/${UNIQUEID}.wav,b)
 same => n,Dial(PJSIP/${EXTEN},30)
 same => n,Hangup()

; Separate files per direction (merge to stereo later with sox or ffmpeg):
;   MixMonitor(/path/call.wav,br(/path/call-in.wav)t(/path/call-out.wav))
; Option reference: https://docs.asterisk.org (MixMonitor application)

The b option makes MixMonitor save audio only while the channel is bridged, which keeps ringing and early media out of the file. The r and t options write each direction to its own file, which is the usual way to get two-channel audio for analytics. Do not pass caller ID or other untrusted strings into the command argument, because the Asterisk documentation warns of command injection through them.

<!-- FreeSWITCH dialplan: record both legs in stereo once the call is answered -->
<extension name="record-inbound">
  <condition field="destination_number" expression="^(\d+)$">
    <action application="set" data="RECORD_STEREO=true"/>
    <action application="set" data="RECORD_MIN_SEC=3"/>
    <action application="set" data="RECORD_ANSWER_REQ=true"/>
    <action application="set" data="rec_dir=/var/recordings/${strftime(%Y/%m/%d)}"/>
    <action application="record_session" data="${rec_dir}/${uuid}.wav"/>
    <action application="bridge" data="user/$1@${domain_name}"/>
  </condition>
</extension>

<!-- Masking and pausing are available for sensitive moments:
     record_session_mask, record_session_pause, record_session_resume -->

Variable names such as RECORD_STEREO and RECORD_MIN_SEC are documented FreeSWITCH recording options, but behaviour can differ between versions, so check the documentation for the version you run and test with real calls. The point of RECORD_MIN_SEC is to discard very short recordings, such as calls that never connect, which saves storage and noise.

Storage maths

Storage per recorded hour by format: 16-bit 8 kHz mono WAV is 16 KB per second or 57.6 MB for each hour recorded, stereo WAV is 115.2 MB for each hour recorded, G.711 stored as-is is 28.8 MB for each hour recorded, and Opus at about 16 kbps is about 7.2 MB for each hour recorded. For 1,000 channels recorded 10 hours a day for 30 days the totals are about 17.3 TB for mono WAV, 8.6 TB for G.711 and 2.2 TB for Opus at 16 kbps.
Calculated from sample rate and bit depth; real files add small container overhead.

Storage is easy to calculate and easy to get wrong by ignoring the multiplier. The raw rate is the sample rate times the bytes per sample times the number of channels. Narrowband telephony samples at 8 kHz, and 16-bit samples are 2 bytes each, so mono WAV is 8,000 × 2 = 16,000 bytes per second, which is 57.6 MB for each hour recorded. Stereo doubles it. G.711 is already compressed to 8 bits per sample, so keeping the audio in that form is half the size of linear WAV. Compressing to a speech codec such as Opus at about 16 kbps brings it down to roughly 7.2 MB for each hour recorded.

Format (8 kHz speech)RateEach hour1,000 channels × 10 h/day × 30 days
WAV, 16-bit mono16 KB/s57.6 MBAbout 17.3 TB
WAV, 16-bit stereo32 KB/s115.2 MBAbout 34.6 TB
G.711 stored as-is (mono)8 KB/s28.8 MBAbout 8.6 TB
Opus voice at about 16 kbps2 KB/s7.2 MBAbout 2.2 TB

Two conclusions follow. The codec and channel layout decide your bill far more than the file container does. And the retention period is a multiplier on everything, so it is the first place to look when storage costs rise. Keep an eye on how recordings are used, because storing recordings nobody will ever play is the commonest waste.

The recording pipeline

The architecture in the diagram has five jobs, each owned by one component, so a failure in one cannot take down live calls.

StageJobDesign rule
CaptureWrite the call to local disk on the media serverLocal SSD only; never write directly to remote storage during a call
MoverUpload finished files, verify them, delete the local copyRetry safely; delete only after verification
MetadataStore call ID, tenant, times, agents, length, key ID and hold flagSeparate from audio; searchable
StorageKeep audio in encrypted, tiered object storageLifecycle tiers for ageing data; per-tenant prefixes
PolicyApply retention, legal holds and deletionPolicy as data; deletion logged
PlaybackAuthorise, decrypt and stream recordingsEvery access written to an audit log

Separating the mover from the media server matters. If object storage is slow or briefly unavailable, files simply queue on local disk and are uploaded when it returns. The only thing to monitor is local disk usage, and an alert on it gives you hours of warning.

Moving files safely

The mover is small but critical. Its rules: only touch files that are finished, verify the upload, record the metadata and only then remove the local copy. The sketch below shows the idea in Python with an S3-compatible store; adapt it to your object storage, and drive it from a hangup event rather than a directory scan if you can.

# Python: upload finished recordings, verify, record metadata, then delete locally
import os, time, hashlib, pathlib, boto3, psycopg2

BUCKET, SRC = "acme-recordings", pathlib.Path("/var/recordings")
s3 = boto3.client("s3")
db = psycopg2.connect("dbname=recordings")

def sha256(path: pathlib.Path) -> str:
    h = hashlib.sha256()
    with path.open("rb") as f:
        for chunk in iter(lambda: f.read(1 << 20), b""):
            h.update(chunk)
    return h.hexdigest()

for f in SRC.rglob("*.wav"):
    if time.time() - f.stat().st_mtime < 120:      # likely still being written
        continue
    call_id, size = f.stem, f.stat().st_size
    key = f"recordings/{f.parent.relative_to(SRC)}/{f.name}"
    digest = sha256(f)
    s3.upload_file(str(f), BUCKET, key, ExtraArgs={
        "ServerSideEncryption": "aws:kms",         # or your store's equivalent
        "Metadata": {"sha256": digest, "call-id": call_id}})
    head = s3.head_object(Bucket=BUCKET, Key=key)
    if head["ContentLength"] != size:               # verify before deleting anything
        continue
    with db, db.cursor() as cur:
        cur.execute("""INSERT INTO recordings (call_id, object_key, bytes, sha256, hold)
                       VALUES (%s, %s, %s, %s, false)
                       ON CONFLICT (call_id) DO NOTHING""", (call_id, key, size, digest))
    f.unlink()                                      # safe: stored, verified, indexed

Because every step is idempotent, you can run the script repeatedly and after any crash without losing or duplicating recordings. In production you would add concurrency, metrics, dead-letter handling for files that repeatedly fail and the tenant lookup that fills the metadata row, but the safety order stays the same.

Encryption and access control

Recordings are among the most sensitive data you hold: they contain names, account details and sometimes health or financial information. Protect them at every stage.

  • Encrypt in transit between media servers, mover, storage and playback
  • Encrypt at rest, ideally with per-tenant keys from a key management service, so one tenant's key can be rotated or revoked on its own
  • Keep the playback API as the only way to reach audio; never hand out raw storage URLs that do not expire
  • Authorise by role and tenant, and log every play, download and export with the user and time
  • Limit who can download a copy, and consider watermarking exports
  • Separate the keys and the storage in different accounts or services so one breach does not expose both

Do not claim compliance you cannot evidence. Whether your recordings meet a given standard depends on your whole environment and organisation, and your compliance team or auditor decides that, not the recording software.

Retention policy and legal holds

Retention is the rule that decides how long a recording lives. It is set by law, contract and business need, and it often differs by tenant, queue or call type. Encode it as data so it can be audited.

ConceptWhat it doesImplementation hint
Retention periodDelete after a set timePer tenant and call type in a policy table; a daily job selects expired rows
Legal holdSuspends deletion for specific callsA hold flag on the metadata row; the policy job skips held rows
Storage tieringMove older audio to cheaper storageLifecycle rules by prefix; keep metadata online
Deletion proofShow that a recording was deleted on timeWrite a deletion log row; keep it after the audio is gone
Minimum retentionPrevent early deletionObject lock or a policy check before any delete
# Object-store lifecycle (S3 syntax) for tiering a default prefix
{
  "Rules": [{
    "ID": "tier-then-expire",
    "Status": "Enabled",
    "Filter": { "Prefix": "recordings/default/" },
    "Transitions": [{ "Days": 90, "StorageClass": "GLACIER_IR" }],
    "Expiration": { "Days": 365 }
  }]
}
# Per-tenant periods and legal holds belong in your policy service, not only in
# lifecycle rules, because a lifecycle rule cannot know about a legal hold unless
# you also use object-lock legal holds on the held objects.

The mistake to avoid is relying on a single blanket lifecycle rule. It works until one tenant needs seven years, another needs ninety days and a third is under investigation. A policy service that reads per-tenant rules and a hold flag handles all three, and the storage lifecycle only handles cost tiering.

Payment card data in recordings

Agents who take card payments by phone create a specific risk. The PCI Security Standards Council states that card verification codes (CAV2, CVC2, CVV2 or CID) must not be retained after the transaction is authorised, and that this applies to digital audio recordings such as WAV or MP3 files, even when the data is encrypted. The Council's information supplement on telephone-based payment card data describes ways to handle it, and you should read it for current guidance.

ApproachHow it worksTrade-off
Pause or mask on demandThe agent or system pauses the recording while card data is spokenRelies on agent behaviour unless automated
Automatic masking by screen stateThe recording pauses when the payment screen opensNeeds integration with the agent desktop
DTMF-masked payment IVRThe caller keys in the card on their keypad; tones are maskedAgent stays on the call but never hears or sees the data
Separate payment channelTransfer the caller to a dedicated, unrecorded payment flowExtra step for the caller

FreeSWITCH offers masking and pause controls for session recording, and Asterisk offers a way to mute a MixMonitor recording from the manager interface. Whichever you use, test it: record a call, trigger the pause, speak a test number and listen to the file. If the number is audible, the control has failed. Whether your overall setup meets PCI DSS is for your assessor to decide.

Failure modes and how to design for them

FailureEffectPrevention
Local disk fillsRecording fails or the media server degradesAlert at 70% disk; mover health checks; size disks for several hours of backlog
Object storage unavailableBacklog builds on local diskQueue locally; retry with backoff; alert on backlog age
Mover deletes before verifyingLost recordingsVerify size and checksum before deleting; keep a short grace period
Metadata and audio disagreeAudio with no index, or an index with no audioWrite metadata in the same step as the verified upload; run a reconciliation job
Recording starts late or ends earlyMissing the first or last secondsStart on answer; flush on hangup; test with short and long calls
Wrong tenant on a fileData exposureTenant ID set from the call context, not from the file name; test cross-tenant access
Key lost or deletedRecordings unreadableKey backup and rotation procedures tested in advance

Monitor the pipeline as a product: the age of the oldest unuploaded file, uploads per minute, failed verifications, storage growth per tenant and the share of calls that have a recording when they should. The last metric catches silent failures, where calls run fine but nothing is recorded.

Search, transcription and analytics

Once you have recordings, people will want to search and analyse them. Keep the audio store simple and build these features on top: a metadata index for finding calls, a transcription step that runs on a copy of the audio, and quality-review and analytics tools that read from the playback API. Transcription and AI analysis add their own privacy questions: transcripts are personal data, can contain card numbers or health details and need the same retention and access rules as the audio.

For related design questions, see our guides to contact centre CRM integration, where recordings link back to customer records, and AI in the contact centre, where transcripts feed summaries and quality scoring.

A real example: recordings per tenant

CelloIP has built recording into multi-tenant platforms where each tenant has its own recordings and call records. In our multi-tenant hosted PBX platform, FreeSWITCH handles IVR, queues and recording for 100+ tenants, and tenant administrators see only their own data. In our omnichannel contact centre platform, voice with IVR, skills routing, recording and four dialer modes run on FreeSWITCH for 100 to 500 agent seats, with each customer as a separate tenant.

CelloIP project outcome (client kept private)

Recordings, call records and reports are separated per tenant on platforms serving 100+ tenants and 100 to 500 agent seats.

Frequently asked questions

How much storage does call recording need?

Calculate it from the audio format. Mono 8 kHz 16-bit WAV is 16 KB per second, or 57.6 MB for each hour recorded. G.711 stored as it travels is 8 KB per second, or 28.8 MB for each hour recorded. Stereo doubles the figure. For 1,000 channels recorded 10 hours a day for 30 days, that is about 17.3 TB for mono WAV and 8.6 TB for G.711, before backups, replicas and metadata.

Should I record in stereo or mono?

Stereo, with one speaker per channel, is better for speech analytics, transcription and quality review because you can tell who said what and handle crosstalk. It doubles the storage compared with mono. Mono is fine when recordings are kept only for dispute resolution. Many platforms record stereo and compress after the call.

What is SIPREC?

SIPREC is the IETF standard for session recording, defined in RFC 7866. A session recording client, usually your session border controller, sends a copy of the call media and metadata to a session recording server over SIP and RTP. It lets you record without putting recording load on the media servers or the phones, and is common with carrier and enterprise recorders.

How long should I keep call recordings?

It depends on law, contract and business need, and there is no single answer. Financial services, healthcare, public sector and consumer protection rules may set minimum or maximum periods. Define retention per tenant or per call type, apply it automatically, and suspend deletion with a legal hold when a dispute or investigation requires it. Ask your legal advisers for the periods that apply to you.

Do I need consent to record calls?

Often yes, and the rules differ by country and, in the United States, by state: federal law generally needs one party's consent, while a number of states require all parties to agree. Rules on notices, lawful bases and retention also vary. Many operators play an announcement at the start of the call. Treat this as a legal question and confirm with counsel for every market you serve.

How do I keep card details out of recordings?

The PCI Security Standards Council states that card verification codes must not be stored after authorisation, including in audio recordings such as WAV or MP3 files. Common approaches are to pause or mask the recording while the caller reads out card data, or to take the payment through a DTMF-masked IVR so the agent never hears it. Check the PCI SSC guidance for telephone-based payments for current requirements.

Can I record calls on Asterisk and FreeSWITCH?

Yes. Asterisk uses the MixMonitor application, and FreeSWITCH uses record_session. Both can record the whole call to a file and run a script at the end. For high volume, record to local disk, then move files asynchronously to object storage so that storage latency can never affect live calls.

What does a recording platform cost to build?

Recording is usually one component of a larger platform. As a guide from our service pages, a voice contact centre typically costs $20,000 to $50,000 and an omnichannel contact centre $50,000 to $150,000, and a multi-tenant PBX platform $30,000 to $80,000. Storage, hosting and any licensed analytics are separate running costs.

Work with CelloIP

Need call recording that scales?

CelloIP builds contact centre and PBX platforms with recording pipelines, per-tenant policies, secure playback and analytics on FreeSWITCH, Asterisk and Kamailio. We reply within one business day, and you own the code.