Many businesses need to record calls for quality assurance, dispute resolution, or regulatory compliance. This guide covers setting up call recording in Asterisk/FreePBX along with responsible handling of the resulting data.
Important: Legal Considerations First
Call recording laws vary significantly by jurisdiction — some require all-party consent, others only one-party consent, and rules differ for business vs personal calls. This article covers only the technical setup; consult with legal counsel regarding your specific recording obligations and disclosure requirements before enabling call recording.
Enabling Call Recording in FreePBX
Under Applications → Extensions, for each extension needing recording, set Call Recording to "Always," "On Demand," or "Never" depending on your policy.
Enabling Recording in Raw Asterisk Dialplan
exten => 1001,1,MixMonitor(${UNIQUEID}.wav,b)
exten => 1001,n,Dial(PJSIP/1001,20)
MixMonitor records both sides of the conversation into a single audio file.
Configuring Storage Location
exten => 1001,1,Set(RECFILE=/var/spool/asterisk/monitor/${STRFTIME(${EPOCH},,%Y%m%d)}/${UNIQUEID}.wav)
exten => 1001,n,MixMonitor(${RECFILE},b)
Organizing recordings into date-based subdirectories keeps a growing recording archive manageable.
Playing an Announcement Before Recording (For Consent)
exten => 1001,1,Playback(custom/call-may-be-recorded)
exten => 1001,n,MixMonitor(${RECFILE},b)
exten => 1001,n,Dial(PJSIP/1001,20)
If your legal requirements include announced consent, ensure this plays reliably before recording actually begins — verify the announcement itself isn't accidentally captured as part of the recorded call in a way that violates your specific compliance needs.
Securing Recorded Call Data
Call recordings often contain sensitive information (personal details, sometimes payment information if not properly excluded) — restrict file system access to recordings, and encrypt at rest if storing genuinely sensitive content. See Backup Encryption: Protecting Your Backups from Unauthorized Access for the underlying encryption approach.
Setting a Retention Policy
sudo find /var/spool/asterisk/monitor -name "*.wav" -mtime +90 -delete
Automatically delete recordings beyond your required/appropriate retention period — retaining data longer than necessary increases both storage cost and potential liability exposure.
Excluding Payment Card Data from Recordings (PCI DSS Relevance)
If calls might involve customers reading payment card numbers aloud, consider pause/resume recording functionality during that specific portion of the call — a common PCI DSS compliance requirement for phone-based payment collection; consult current PCI guidance and your specific payment processor's requirements.
Accessing and Reviewing Recordings
FreePBX provides a web-based interface for browsing, playing, and downloading recordings under its reporting modules — restrict access to this interface to authorized personnel only.
Common Errors
Recordings are silent or one-sided — verify MixMonitor's b flag (both channels) is included, and check for codec-related issues affecting the recording specifically.
Continue Reading
- Backup Encryption: Protecting Your Backups from Unauthorized Access
- How to Set Up SRTP and TLS Encryption for Secure VoIP
- How to Set Up Audit Logging for Compliance Requirements
Browse more articles in VoIP & Communication Servers.