If you want to do call recording in Asterisk, Mix(Monitor() is your friend that you can use in dialplan.

For example you want to record the calls coming on DID 1949 555 55555
exten => 19495555555,1,MixMonitor(${UNIQUEID}.ulaw)
same => n,Dial(SIP/101)

In another example if you want to record call on user extension 101
exten => 101,1,MixMonitor(${UNIQUEID}.ulaw)
same => n,Dial(SIP/101)

MixMonitor() records the audio from both directions of the phone call and writes it to a file on disk in one of the audio formats that Asterisk supports. You can see a list of the file formats that your version of Asterisk supports at the Asterisk CLI. The Extensions column identifies which file format extensions can be used in the recording filename:

*CLI> core show file formats
Format Name Extensions
—— —- ———-
gsm wav49 WAV|wav49
slin16 wav16 wav16
slin wav wav
adpcm vox vox
slin16 sln16 sln16
slin sln sln|raw
siren7 siren7 siren7
siren14 siren14 siren14
g722 g722 g722
ulaw au au
alaw alaw alaw|al|alw
ulaw pcm pcm|ulaw|ul|mu|ulw
ilbc iLBC ilbc
h264 h264 h264
h263 h263 h263
gsm gsm gsm
g729 g729 g729
g726 g726-16 g726-16
g726 g726-24 g726-24
g726 g726-32 g726-32
g726 g726-40 g726-40
g723 g723sf g723|g723sf
g719 g719 g719
23 file formats registered.

The syntax for MixMonitor() in the dialplan is as follows: