Fax Not Deleting after emailing

I have been doing a bit of checking on my primary server as some backups I was doing seemed to be growing

I found the culprit to be the fax folder in /var/spool/asterisk/fax

It’s full of thousands of PDF’s - All incoming fax’s that have been emailed off to their correct destination

I didn’t realise it was keeping a copy on the server as well.

On checking todays I found this line and assummed the delete “true” meant it deleted the temp copy but this does not seem to be the case.

Am I missing something or is this the correct operation?

Executing [h@ext-fax:4] System(“DAHDI/i1/-3218”, “/var/lib/asterisk/bin/fax2mail.php --to "[email protected]” --dest “3084” --callerid ‘"" <>’ --file /var/spool/asterisk/fax/1422450215.52323.tif --exten “My Fax” --delete “true” --attachformat “pdf”") in new stack
[2015-01-28 13:04:17] VERBOSE[22229][C-0000521c] pbx.c: –

I might be looking in the wrong place but looking at the fax2mail.php there is a section for deleting the file if set to ‘true’ however the line implies it only deletes the TIF and not the PDF

FreePBX 2.11 64-bit Asterisk 11

I had this same problem. As a workaround I added a file called “asteriskcleanup” to the /etc/cron.daily folder with the following:

#!/bin/sh
find /var/spool/asterisk/fax -type f -name "*.pdf" -exec rm -f {} \;
find /var/spool/asterisk/fax -type f -name "*.tif" -exec rm -f {} \;

This will at least cleanup the fax folder once a day.

Another method which you could use would remove the .tif files, but leave the .pdf’s intact for x number of days would be -

#!/bin/bash
find /var/spool/asterisk/fax -type f -name "*.tif" -exec rm -f {} \;
find /var/spool/asterisk/fax -mtime +7 -type f -name "*.pdf" -exec rm -f {} \;

I don’t know if there’s any reason for you to keep them around, just thought I’d mention that variation just in case :smile:

-Andy

Andrew Miffleton
Managed Datacomm
Haltom City, TX
Office : 817.719.8000
http://www.manageddatacomm.com

Thanks for all of the replies.

The TIF’s are deleting fine, it’s the PDF’s that are accumulating.

I’ll try out the scripts above as a workaround.

I have, however, raised this as a bug so will see what the outcome of it is.