In working with Vici, one of the features I could not find (but needed) was the ability to set a disposition to a record once it reached it's call count limit.
I wrote a script to do this and I have seen other inquire about this, so I thought I would share. Hopefully it could be helpful to some.
The script will look for all list_ids associated with a campaign and then find that campaigns call count limit. The query only picks up on campaigns where this is actually set (Other than 0) Any record that it matches that has a callable status, will be updated to the MAX status.
To make this work, you should set a system status for MAX (Maximum Attempts). I set this in my cron to run at night after calling is done.
It could probably be edited to lookup system variable such as DB Server IP and login to be streamlined for any Vici install, but those will need to be edited to fit your installation as well.
Run as PHP Shell:
- Code: Select all
<?php
//Connect to DB Server
mysql_connect("localhost", "dbusername", "dbpassword")or die("cannot connect");
mysql_select_db("asterisk")or die("cannot select DB");
//Find list_id's and their associated call count limits.
$result=mysql_query("SELECT vicidial_campaigns.campaign_id, vicidial_campaigns.call_count_limit, vicidial_lists.list_id FROM vicidial_campaigns,vicidial_lists WHERE vicidial_lists.campaign_id = vicidial_campaigns.campaign_id AND call_count_limit > 0");
while($query_data = mysql_fetch_row($result)){
//Disposition off max attempts.
$update=mysql_query("UPDATE vicidial_list SET status = 'MAX' WHERE status IN ('NA', 'ERI', 'DROP', 'IVRXFR', 'B', 'AB', 'AA', 'A', 'CALLBK', 'NEW', 'PDROP', 'LRERR', 'PU', 'CBHOLD', 'CPDREJ', 'CPDUK', 'CPDNA', 'CPDERR', 'CPDB', 'CPDATB', 'CPDSUA') and called_count >='$query_data[1]' and list_id = '$query_data[2]'");
}
?>
Questions / comments welcome!
Karl Babcock