One-Touch Call Recording
One-Touch Call Recording
Let users start and stop call recording by pressing a DTMF key during an active call. This uses the automixmon feature map entry, which toggles MixMonitor on and off.
Features Configuration (features.conf)
[featuremap]
automixmon => *3 ; Press *3 to toggle recording on/off
[applicationmap]
; Optional: custom recording feature with specific filename
custom_record => *4,self,MixMonitor,${STRFTIME(${EPOCH},%Y%m%d-%H%M%S)}-${CALLERID(num)}.wav,b
Dialplan: Enabling Recording Features
[internal]
; Using built-in automixmon (X option enables it for callee, x for caller)
exten => _1XXX,1,NoOp(Call with one-touch recording enabled)
same => n,Dial(PJSIP/${EXTEN},30,xX)
same => n,Hangup()
; Using custom recording via DYNAMIC_FEATURES
exten => _2XXX,1,NoOp(Call with custom recording feature)
same => n,Set(__DYNAMIC_FEATURES=custom_record)
same => n,Dial(PJSIP/${EXTEN},30,Tt)
same => n,Hangup()
; Always-on recording (no DTMF toggle needed)
exten => _3XXX,1,NoOp(Auto-recorded call)
same => n,MixMonitor(${UNIQUEID}.wav,ab)
same => n,Dial(PJSIP/${EXTEN},30)
same => n,StopMixMonitor()
same => n,Hangup()
How it works
automixmon: A built-in feature map entry that toggles MixMonitor on the channel. The first press starts recording, the second press stops it. Audio from both sides is mixed into a single file.- Dial() options
xandX: Lowercasexallows the caller to trigger automixmon. UppercaseXallows the callee. Use both (xX) to let either party record. - MixMonitor vs Monitor:
MixMonitorrecords both sides into a single file. The olderMonitorapplication records each direction into separate files (-in.wavand-out.wav). MixMonitor is preferred. - Recording location: By default, recordings are saved to
/var/spool/asterisk/monitor/. The filename defaults to the channel name. UseMixMonitor(filename.wav)to set a custom name. - MixMonitor options:
aappends to an existing file,bbridges audio from both channels immediately. Withoutb, recording starts only when the call is answered.
Tips
- Name recordings meaningfully:
MixMonitor(${STRFTIME(${EPOCH},%Y%m%d-%H%M%S)}-${CALLERID(num)}-${EXTEN}.wav,b)produces filenames like20260214-143052-5551234-1001.wav. - Set
recordingfailsound = beeperrin[general]of features.conf to play an audible warning if recording fails to start. - Check active recordings:
mixmonitor list <channel>on the CLI. - For compliance recording (all calls), use
MixMonitor()in the dialplan beforeDial()instead of one-touch. One-touch is for on-demand recording. - Disk space: 8kHz ulaw WAV uses about 480 KB per minute. Set up a cron job to archive or purge old recordings.
- Recording requires
func_periodic_hook.soandapp_mixmonitor.somodules to be loaded.
User Notes
No notes yet. Be the first to contribute a tip or example.
Contribute a note
Share a tip, gotcha, or practical example. Keep it under 2000 characters. No questions (use the Asterisk community forums for support). Wrap code in backticks.