Call Recordings delete after 2 days

Status
Not open for further replies.

Andrew Byrd

Member
Feb 16, 2018
309
10
18
54
My call recordings auto delete after 2 days. In the cron job I have it set for 90 days.
This started when I moved to a different server
I am now using servers at slicie.com
Any ideas on why the call recordings delete after 2 days despite the fact that I have it set at 90 days in the maintenance file?

See attached

This is my maintenance file

Code:
                                                                      fusionpbx-maintenance *
        if [ .$switch_package = .true ]; then
                echo ".";
                find /var/lib/freeswitch/storage/voicemail/default/*  -name 'msg_*.wav' -mtime +$days_keep_voicemail -exec rm {} \;
                find /var/lib/freeswitch/storage/voicemail/default/*  -name 'msg_*.mp3' -mtime +$days_keep_voicemail -exec rm {} \;
        else
                echo ".";
                find /usr/local/freeswitch/storage/voicemail/*  -name 'msg_*.wav' -mtime +$days_keep_voicemail -exec rm {} \;
                find /usr/local/freeswitch/storage/voicemail/*  -name 'msg_*.mp3' -mtime +$days_keep_voicemail -exec rm {} \;
        fi
        psql --host=127.0.0.1 --username=fusionpbx -c "delete from v_voicemail_messages WHERE to_timestamp(created_epoch) < NOW() - INTERVAL '$days_keep_voicemail days'"
else
        echo "not purging voicemails."
fi

if [ .$purge_cdrs = .true ]; then
        #delete call detail records older 90 days
        psql --host=127.0.0.1 --username=fusionpbx -c "delete from v_xml_cdr WHERE start_stamp < NOW() - INTERVAL '$days_keep_cdrs days'"
else
        echo "not purging CDRs."
fi

#delete php sessions
if [ .$purge_php_sessions = .true ]; then
        find /var/lib/php/sessions/*  -name 'sess_*' -mtime +$days_keep_php_sessions -exec rm {} \;
else
        echo "not purging PHP Sessions."
fi

#delete database_transactions older 90 days
if [ .$purge_database_transactions = .true ]; then
        psql --host=127.0.0.1 --username=fusionpbx -c "delete from v_database_transactions where transaction_date < NOW() - INTERVAL '$days_keep_database_transactions days'"
else
        echo "not purging database_transactions."
fi

#delete email_queue older 30 days
if [ .$purge_email_queue = .true ]; then
        psql --host=127.0.0.1 --username=fusionpbx -c "delete from v_email_queue where email_status = 'sent' and email_date < NOW() - INTERVAL '$days_keep_email_queue days'"
else
        echo "not purging email_queue."
fi

#delete fax_queue older 30 days
if [ .$purge_fax_queue = .true ]; then
        psql --host=127.0.0.1 --username=fusionpbx -c "delete from v_fax_queue where fax_status = 'sent' and fax_date < NOW() - INTERVAL '$days_keep_fax_queue days'"
else
        echo "not purging fax_queue."
fi

#completed message
 

Attachments

  • Web capture_14-9-2023_143729_bes.abnorange.us.jpeg
    Web capture_14-9-2023_143729_bes.abnorange.us.jpeg
    256.8 KB · Views: 17
  • Web capture_14-9-2023_14413_bes.abnorange.us.jpeg
    Web capture_14-9-2023_14413_bes.abnorange.us.jpeg
    181.4 KB · Views: 16
Last edited:

Andrew Byrd

Member
Feb 16, 2018
309
10
18
54
I have made a few adjustments and it is automatically erasing all call recordings older than 48 hours. Any insight on this would be greatly appreciated.
 

whut

Member
Dec 23, 2022
228
22
18
It look like only pieces of your maintenance script are uploaded and they do not include the call recordings code within. Example.pdf states purge_call_recordings=false which is disabled and days_keep_call_recordings=180 if it was enabled. I would expect something similar to

Code:
if [ .$purge_call_recordings = .true ]; then
        #delete call recordings older than 90 days
        if [ .$switch_package = .true ]; then
                find /var/lib/freeswitch/recordings/*/archive/*  -name '*.wav' -mtime +$days_keep_call_recordings -exec rm {} \;
                find /var/lib/freeswitch/recordings/*/archive/*  -name '*.mp3' -mtime +$days_keep_call_recordings -exec rm {} \;
        else
                find /usr/local/freeswitch/recordings/*/archive/*  -name '*.wav' -mtime +$days_keep_call_recordings -exec rm {} \;
                find /usr/local/freeswitch/recordings/*/archive/*  -name '*.mp3' -mtime +$days_keep_call_recordings -exec rm {} \;
        fi
        psql --host=127.0.0.1 --username=fusionpbx -c "delete from v_call_recordings WHERE call_recording_date < NOW() - INTERVAL '90 days'"
else
        echo "not purging Recordings."
fi


I would start by listing cronjob `crontab -l` and editing `crontab -e`. I would also look through all of the cron directories for any cronjob scripts. Make sure you only have fusionpbx-maintenance and do not have fusionpbx-maintenance.sh (and references to) the .sh. You may have multiple cronjobs running.
 
Status
Not open for further replies.