Change call recording location

I am trying to find a way to change the storage location for recorded calls. The currently record on my root partition to /var/spool/asterisk/monitor and then by year, month and date. I would like to direct them to record in a special directory on my home partition since it has a lot more room. Does anyone know if this can be done?

I already tried changing the line in /etc/asterisk/asterisk.conf

astspooldir => /var/spool/asterisk

to

astspooldir => /home/justin/asterisk-recordings (I made that directory prior to this)

But that didnā€™t work.

1 Like
  • Settings
    • Advanced Setings
      • Override Call Recording Location

I donā€™t have that option. Iā€™m using Asterisk Ver. 11.11.0 Freepbx Ver. 2.11.0.38

You have the option. You just need to turn on display read only settings and hidden settings

keep in mind some things are hidden for your safetyā€¦ Use with care.

That worked! Thanks guys!

Quick follow up to this. Now the option to listen to or download my recordings in my user portal doesnā€™t show up. Do I need to change something to tell the user panel to look in this other directory?

//if $amp_conf['MIXMON_DIR'] is set use it, else use the spool dir ('/var/log/asterisk') +  /spool

$monitor_base = $amp_conf['MIXMON_DIR'] ? $amp_conf['MIXMON_DIR'] : $amp_conf['ASTSPOOLDIR'] . '/monitor'; 
//Path above + /year + /month + /day + /recording file name
$recordingfile = "$monitor_base/$fyear/$fmonth/$fday/" . $value['recordingfile'];

The setting you changed sets MIXMON_DIR

So this should be good for new recordings.

You need to rsync the old recordings over to the new location.

So your old (pre change) recordings are in /var/spool/asterisk/monitor

It simply gets the file name from the CDR so it is looking for /my/new/dir/filename.ext

I think that makes sense. So I probably just have the new location named wrong.

It is currently:

/home/asterisk-recordings/[YEAR]/[MONTH]/[DAY]

So should I change it to:

/home/asterisk-recordings/spool/monitor/[YEAR]/[MONTH]/[DAY]

Iā€™m not worried about the old recordings showing up, just the new recordings from now on.

Try again

/home/asterisk-recordings/monitor

Well, Iā€™m still not getting it to show up.

I have the recordings saving to /home/asterisk-recordings/monitor/

I have given both asterisk-recordings and monitor directories 777 permissions and asterisk ownership.

The recordings are definitely saving in that directory. Technically saving at /home/asterisk-recordings/monitor/[YEAR]/[MONTH]/[DAY]

I still canā€™t get it to show up on the user portal.

Do I need to change any other setting?

[root@localhost /]# cd /home/asterisk-recordings/monitor/2014/08/06/
[root@localhost 06]# ls
force-5152982333-353-20140806-145053-1407354653.4.wav force-5159789010-unknown-20140806-145002-1407354602.0.wav
force-5159789010-unknown-20140806-144657-1407354417.74.wav force-8556392046-unknown-20140806-145144-1407354704.6.wav

Actually I read what james wrote is completely wrong and I also misread it because of a newline break on the forums. The path is actually just going to be: ā€œ/home/asterisk-recordingsā€ that is it. No monitor, no var, no spool.

In the format of:

/home/asterisk-recordings/[YEAR]/[MONTH]/[DAY]

Thatā€™s what I started with but the recordings didnā€™t show up in the user portal.

Looking at the code says it will work. You can do this yourself. locate callmonitor.module go to line 233, after that line type: dbug($recordingfile);

run: amportal a dbug

refresh the webpage.

I updated my postā€¦ killed my misread and added comments in the code blockā€¦ clarified in the post ( I hope)

I canā€™t find that file anywhere

[root@localhost asterisk]# find -name callmonitor.module
[root@localhost asterisk]#

Iā€™m thinking about just leaving it as it is and see if it starts working. In the past I have had problems with stuff showing up in the monitor column in the user panel. Then the next day they would be there. Hoping thatā€™s my problem.

If that file doesnā€™t exist then you wouldnā€™t see anything, like the page wouldnā€™t load. Just running ā€œfindā€ at the root level directory doesnā€™t work, especially if you are in /home or some other place. Use a better command for finding files, a faster command!

updatedb
locate callmmonitor.module

Actually, without ā€˜-printā€™, it will just return true or false if the file is foundā€¦ You probably want something like

find /var/www/html -name callmonitor* -print
1 Like

Found the file. It is located at:

/var/www/html/recordings/modules/callmonitor.module

I placed the code on line 233, this is what it looks like

                            $monitor_base = $amp_conf['MIXMON_DIR'] ? $amp_conf['MIXMON_DIR'] : $amp_conf['ASTSPOOLDIR'] . '/monitor';
                            $recordingfile = "$monitor_base/$fyear/$fmonth/$fday/" . $value['recordingfile'];

dbug($recordingfile)
if (!file_exists($recordingfile)) {
$recordingfile = ā€˜ā€™;

Assuming maybe I need to place it on line 235 below $recordingfile="; ?
Ran ā€œamportal a dbugā€ and refrshed the page. It broke.

==> /var/log/asterisk/freepbx_dbug <==
2014-Aug-06 16:16:28 /var/www/html/admin/modules/cxpanel/brand.php:3
[WARNING]: file_get_contents(/etc/schmooze/operator-panel-brand): failed to open stream: No such file or directory

==> /var/log/httpd/error_log <==
[Wed Aug 06 16:16:28 2014] [error] [client 192.168.1.106] PHP Parse error: syntax error, unexpected T_IF in /var/www/html/recordings/modules/callmonitor.module on line 235

Youā€™re killing me here. Notice the semicolon at the end of my string, you need to use it.