One-Touch Call Recording
One-Touch Call Recording
Let users start and stop call recording by pressing a DTMFDual-Tone Multi-Frequency, the touch-tone signals phones send for digit input during a call, used by IVRs and feature codes. 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 channelA single call leg passing through Asterisk. Channels represent connections to endpoints and are what dialplan applications act on.. 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 dialplanThe core call-routing configuration of Asterisk, written mostly in extensions.conf as contexts, extensions, and priorities that decide how every call is handled. Full definition → 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
Know a tip or gotcha for this topic? Share it below and help others.
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.