Home > linux > How to customize call recording location in asteriskNOW

How to customize call recording location in asteriskNOW

July 20th, 2010

Customize call recording location in asteriskNow.

By default AsteriskNOW saves call recordings under the directory /var/spool/asterisk/monitor. This way of call recording has got some disadvantages since number of files can grow beyond a limit . You will find it difficult to recognize call recordings related to a particular extension. A solution to this issue is to customize the call recording location. You need to override the dialplan for the context [macro-record-enable] present in /etc/asterisk/extensions_additional.conf. To override these dialplans you need to add new dialplan in a file called /etc/asterisk/extensions_override_freepbx.conf.  Following is the default dialplan for the context [macro-record-enable] present in /etc/asterisk/extensions_additional.conf.


[macro-record-enable]
include => macro-record-enable-custom
exten => s,1,GotoIf($["${BLINDTRANSFER}" = ""]?check)
exten => s,n,ResetCDR(w)
exten => s,n,StopMixMonitor()
exten => s,n(check),AGI(recordingcheck,${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},${UNIQUEID})
exten => s,n,MacroExit()
exten => s,1+998(record),MixMonitor(${MIXMON_DIR}${CALLFILENAME}.${MIXMON_FORMAT},,${MIXMON_POST})
; end of [macro-record-enable]

You need to add the following dialplan in /etc/asterisk/extensions_override_freepbx.conf, which will override the above dialplan to customize the call recording location.


[macro-record-enable]
include => macro-record-enable-custom
exten => s,1,GotoIf($["${BLINDTRANSFER}" = ""]?check)
exten => s,n,ResetCDR(w)
exten => s,n,StopMixMonitor()
exten => s,n(check),AGI(recordingcheck,${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)},${UNIQUEID})
exten => s,n,MacroExit()
exten => s,n(record),System(/bin/mkdir -p /var/spool/asterisk/monitor/freepbx/${STRFTIME(${EPOCH},,%Y)}/${STRFTIME(${EPOCH},
,%m)}/${STRFTIME(${EPOCH},,%d)}/${ARG1}/${UNIQUEID})
exten => s,n,MixMonitor(/var/spool/asterisk/monitor/freepbx/${STRFTIME(${EPOCH},,%Y)}/${STRFTIME(${EPOCH},,%m)}/${STRFTIME($
{EPOCH},,%d)}/${ARG1}/${UNIQUEID}/${CALLFILENAME}.${MIXMON_FORMAT},,${MIXMON_POST})

The changes made are

exten => s,n(record),System(/bin/mkdir -p /var/spool/asterisk/monitor/freepbx/${STRFTIME(${EPOCH},,%Y)}/${STRFTIME(${EPOCH},
,%m)}/${STRFTIME(${EPOCH},,%d)}/${ARG1}/${UNIQUEID})

Here we are using ‘System’ command to create directories during the call recording. Inside the system command we can execute the unix shell commands. Here we used ‘mkdir’ command to create directories followed by a number of variables in asterisk. Here ‘STRFTIME’ used to get the year, month & date . ${ARG1} used to get the asterisk user extension ,who is participating in that call ;${UNIQUEID} to get the unique id of that call. UNIQUEID is assigned by asterisk and it is the unix time of orgination of that call.

<pre>exten => s,n,MixMonitor(/var/spool/asterisk/monitor/freepbx/${STRFTIME(${EPOCH},,%Y)}/${STRFTIME(${EPOCH},,%m)}/${STRFTIME($
{EPOCH},,%d)}/${ARG1}/${UNIQUEID}/${CALLFILENAME}.${MIXMON_FORMAT},,${MIXMON_POST})</pre>

In succeeding priority we use MixMonitor command to record the conversations in that channel. The format of MixMonitor command is MixMonitor(<file>.<ext>[|<options>[|<command>]]). Here in the ‘filename’ field we will give path of created directory in the preceding line.

Once you made the above changes you need to reload the dialplan through either of the following two ways.

from shell

#asterisk -rx “dialplan reload”

from asterisk CLI

> dialplan reload

VN:F [1.9.6_1107]
Rating: 4.2/10 (5 votes cast)
VN:F [1.9.6_1107]
Rating: +2 (from 4 votes)
How to customize call recording location in asteriskNOW, 4.2 out of 10 based on 5 ratings
Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Live
  • StumbleUpon
  • Twitter
  • Yahoo! Buzz
  • Reddit
  • Technorati

Spam Protection by WP-SpamFree