Asterisk Call Recording

I will describe an example of setting up recording telephone conversations in Asterisk, first of all, make sure that the necessary modules are loaded.

Connect to the Asterisk console and see/load the modules with the following commands:

sudo asterisk -r
module show like MODULE_NAME
module load MODULE_NAME

For startup, the modules are specified in the /etc/asterisk/modules.conf file, you can open it for example with the nano text editor (in it Ctrl+X keys to exit, y/x and Enter to save or cancel changes):

sudo nano /etc/asterisk/modules.conf

The following lines are needed to load the necessary modules:

load => res_monitor.so
load => func_strings.so
load => func_callerid.so
load => app_dial.so
load => func_periodic_hook.so
load => format_wav.so

Open the extensions.conf configuration file for example with the same nano editor:

sudo nano /etc/asterisk/extensions.conf

Add two lines to the desired dialplan, in the first we indicate with what name to save the file, and in the second where to save, your third standard, etc. (instead of wav, you can specify a different codec, for example gsm so that the files are smaller, by the way gsm can be played using QuickTime player):

[sip-dialout]
exten => 6000,1,Set(fname=${STRFTIME(${EPOCH},,%Y-%m-%d-%H%M)}-${CALLERID(number)}-${EXTEN})
exten => 6000,2,Monitor(wav,/home/ixnfo/monitor/${fname},mb)
exten => 6000,3,Dial(SIP/6000)

Connect to Asterisk and reload the dialplan configuration:

sudo asterisk -r
dialplan reload

Now, when making calls to number 6000, a conversation will be recorded in the specified directory, for example, with names in the form 201610281731-6001-6000.wav (date-calling_number-where_call_number).

See also my article:
Installing Asterisk on Ubuntu Server

Join the Conversation

1 Comment

Leave a Reply to Keith IrwinCancel reply

  1. > module show like res_monitor
    Module Description Use Count Status Support Level
    res_monitor.so Call Monitoring Resource 2 Running deprecated
    1 modules loaded

    “deprecated”, but what’s the alternative?