Delete Recording under 100 seconds Cronjob

All installation and configuration problems and questions

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

Delete Recording under 100 seconds Cronjob

Postby chasejordan1 » Wed Nov 29, 2017 9:10 pm

I am trying to set up a cronjob to delete ALL recording that are under 100 seconds, but for some reason google is not helping me?


Any suggestions?

VERSION: 2.14-643a
BUILD: 171126-1413
Single Server.
chasejordan1
 
Posts: 182
Joined: Fri Mar 07, 2008 11:57 am

Re: Delete Recording under 100 seconds Cronjob

Postby pargat » Fri Dec 01, 2017 12:21 am

Hi,

For this you can schedule a cron job to execute a script that will run through the list of files and delete the files that are below the duration you require.

You will have to use command line tools like sox or mediainfo.

hope this helps.
pargat
 
Posts: 54
Joined: Mon Jun 20, 2011 4:25 am

Re: Delete Recording under 100 seconds Cronjob

Postby blackbird2306 » Fri Dec 01, 2017 11:44 am

This is the script you are looking for (usually in directory "/usr/share/astguiclient"):
AST_CRON_purge_recordings.pl


Then you should make a few adjustments in this script, because it looks only for recordings with certain save statuses which are predefined:
# runs every day, goes through recordings older than a certain number of days
# and deletes those recordings that are not of a certain status
# default is 30 days old to remove non-sales
#
# put an entry into the cron of of your asterisk machine to run this script
# every day or however often you desire


Here is the place for save states:
Line23: $save_statuses = '|SALE|UPSALE|UPSELL|XFER|DNC|DROP|A1|A2|A3|A4|A5|A6|A7|A8|A9|';

Next the trick for your purpose at line 113 with an adjustment to only delete recordings that are less than 100 seconds:
Code: Select all
##### Get the lead_ids of all recordings that are not DELETED or NULL #####
$stmtA = "SELECT lead_id,recording_id,start_time,filename,location FROM recording_log where start_time < '$TDSQLdate' and start_time > '$FDSQLdate' and location IS NOT NULL and location NOT IN('','NOT_FOUND','NOT_FOUND_2','DELETED') and length_in_sec <= 100 LIMIT 5000;";


Very important: This will delete all recordings (30 days / LIMIT 5000 recordings) where the statuses are not defined in "$save_statuses" and where recording length is under 100 seconds. But if it's defined (e.g. SALE) then it will not be deleted even when it's under 100 seconds!
But you can also change $save_statuses to delete all of them:
$save_statuses = '||';

Vicibox 6.0.2 from Vicibox_v.6.0.x86_64-6.0.2.iso | Vicidial 2.12-560a build: 160617-1427 | Asterisk 1.8.32.3
blackbird2306
 
Posts: 409
Joined: Mon Jun 23, 2014 5:31 pm


Return to Support

Who is online

Users browsing this forum: Bing [Bot] and 95 guests