Added campaign feature to automatically adjust the hopper level to the dialing rate and the number of active agents, also added a trim feature to make sure the hopper is not filled too much

Added source field to the vicidial_hopper table

git-svn-id: svn://192.168.202.10@1546 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2010-11-12 21:18:56 +00:00
parent 2662cd79f1
commit 5afa4b038a
12 changed files with 260 additions and 51 deletions
+4
View File
@@ -387,6 +387,10 @@ OTHER CHANGES:
87. Added option for cross-server phone dialplan extensions in System Settings.
88. Added campaign feature to automatically adjust the hopper level to the
dialing rate and the number of active agents, also added a trim feature
to make sure the hopper is not filled too much
+5 -4
View File
@@ -91,6 +91,7 @@
# 100309-0551 - Added queuemetrics_loginout option
# 100327-1359 - Fixed LAGGED issues
# 100903-0041 - Changed lead_id max length to 10 digits
# 101111-1556 - Added source to vicidial_hopper inserts
#
@@ -1549,7 +1550,7 @@ while($one_day_interval > 0)
}
if ($VD_alt_dnc_count < 1)
{
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$CLlead_id',campaign_id='$CLcampaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ALT',user='',priority='25';";
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$CLlead_id',campaign_id='$CLcampaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ALT',user='',priority='25',source='A';";
$affected_rows = $dbhA->do($stmtA);
$event_string = "-- VDH record inserted: |$affected_rows| |$stmtA|"; &event_logger;
}
@@ -1627,7 +1628,7 @@ while($one_day_interval > 0)
}
if ($VD_alt_dnc_count < 1)
{
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$CLlead_id',campaign_id='$CLcampaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ADDR3',user='',priority='20';";
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$CLlead_id',campaign_id='$CLcampaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ADDR3',user='',priority='20',source='A';";
$affected_rows = $dbhA->do($stmtA);
$event_string = "-- VDH record inserted: |$affected_rows| |$stmtA|"; &event_logger;
}
@@ -1745,7 +1746,7 @@ while($one_day_interval > 0)
{
if ($alt_dial_phones_count == $Xlast)
{$Xlast = 'LAST';}
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$CLlead_id',campaign_id='$CLcampaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='X$Xlast',user='',priority='15';";
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$CLlead_id',campaign_id='$CLcampaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='X$Xlast',user='',priority='15',source='A';";
$affected_rows = $dbhA->do($stmtA);
$event_string = "-- VDH record inserted: |$affected_rows| |$stmtA|X$Xlast|$VD_altdial_id|"; &event_logger;
$Xlast=9999999999;
@@ -1756,7 +1757,7 @@ while($one_day_interval > 0)
{
if ($alt_dial_phones_count == $Xlast)
{$Xlast = 'LAST';}
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$CLlead_id',campaign_id='$CLcampaign_id',status='DNC',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='X$Xlast',user='',priority='15';";
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$CLlead_id',campaign_id='$CLcampaign_id',status='DNC',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='X$Xlast',user='',priority='15',source='A';";
$affected_rows = $dbhA->do($stmtA);
$event_string = "-- VDH record DNC inserted: |$affected_rows| |$stmtA|X$Xlast|$VD_altdial_id|"; &event_logger;
$Xlast=9999999999;
+137 -8
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# AST_VDhopper.pl version 2.2.0
# AST_VDhopper.pl version 2.4
#
# DESCRIPTION:
# Updates the VICIDIAL leads hopper for the streamlined
@@ -12,6 +12,15 @@
#
# It is recommended that you run this program on the local Asterisk machine
#
# hopper sources:
# - A = Auto-alt-dial
# - C = Scheduled Callbacks
# - N = Xth New lead order
# - P = Non-Agent API hopper load
# - Q = No-hopper queue insert
# - R = Recycled leads
# - S = Standard hopper load
#
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGELOG
@@ -54,6 +63,7 @@
# 100427-0429 - Fix for list mix no-status-selected issue
# 100529-0843 - Changed dialable leads to calculate every run for active campaigns
# 100706-2332 - Added ability to purge only one campaign's leads in the hopper
# 101108-1451 - Added ability for the hopper level to be set automatically and remove excess leads from the hopper (MikeC)
#
# constants
@@ -118,6 +128,15 @@ if ($Vmon < 10) {$Vmon = "0$Vmon";}
if ($Vmday < 10) {$Vmday = "0$Vmday";}
$VDL_one = "$Vyear-$Vmon-$Vmday $Vhour:$Vmin:$Vsec";
### get date-time of 10 seconds ago ###
$VDL_tensec = ($secX - 10);
($Vsec,$Vmin,$Vhour,$Vmday,$Vmon,$Vyear,$Vwday,$Vyday,$Visdst) = localtime($VDL_one);
$Vyear = ($Vyear + 1900);
$Vmon++;
if ($Vmon < 10) {$Vmon = "0$Vmon";}
if ($Vmday < 10) {$Vmday = "0$Vmday";}
$VDL_tensec = "$Vyear-$Vmon-$Vmday $Vhour:$Vmin:$Vsec";
### begin parsing run-time options ###
if (length($ARGV[0])>1)
{
@@ -401,7 +420,7 @@ if ($CBHOLD_count > 0)
$event_string = "|CALLBACKS LISTACT|$affected_rows|";
&event_logger;
$stmtA = "INSERT INTO $vicidial_hopper SET lead_id='$CA_lead_id[$CAu]',campaign_id='$CA_campaign_id[$CAu]',list_id='$CA_list_id[$CAu]',gmt_offset_now='$CA_gmt_offset_now[$CAu]',user='',state='$CA_state[$CAu]',priority='50';";
$stmtA = "INSERT INTO $vicidial_hopper SET lead_id='$CA_lead_id[$CAu]',campaign_id='$CA_campaign_id[$CAu]',list_id='$CA_list_id[$CAu]',gmt_offset_now='$CA_gmt_offset_now[$CAu]',user='',state='$CA_state[$CAu]',priority='50',source='C';";
$affected_rows = $dbhA->do($stmtA);
if ($DB) {print "ANYONE Scheduled Callback Inserted into hopper: $affected_rows|$CA_lead_id[$CAu]\n";}
$CAu++;
@@ -778,11 +797,11 @@ if ($hopper_dnc_count > 0)
if ($CLIcampaign)
{
$stmtA = "SELECT campaign_id,lead_order,hopper_level,auto_dial_level,local_call_time,lead_filter_id,use_internal_dnc,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,dial_statuses,list_order_mix,use_campaign_dnc,drop_lockout_time,no_hopper_dialing,auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$CLIcampaign';";
$stmtA = "SELECT campaign_id,lead_order,hopper_level,auto_dial_level,local_call_time,lead_filter_id,use_internal_dnc,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,dial_statuses,list_order_mix,use_campaign_dnc,drop_lockout_time,no_hopper_dialing,auto_alt_dial_statuses,dial_timeout,auto_hopper_multi,use_auto_hopper,auto_trim_hopper from vicidial_campaigns where campaign_id='$CLIcampaign';";
}
else
{
$stmtA = "SELECT campaign_id,lead_order,hopper_level,auto_dial_level,local_call_time,lead_filter_id,use_internal_dnc,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,dial_statuses,list_order_mix,use_campaign_dnc,drop_lockout_time,no_hopper_dialing,auto_alt_dial_statuses from vicidial_campaigns where active='Y';";
$stmtA = "SELECT campaign_id,lead_order,hopper_level,auto_dial_level,local_call_time,lead_filter_id,use_internal_dnc,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,dial_statuses,list_order_mix,use_campaign_dnc,drop_lockout_time,no_hopper_dialing,auto_alt_dial_statuses,dial_timeout,auto_hopper_multi,use_auto_hopper,auto_trim_hopper from vicidial_campaigns where active='Y';";
}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -811,7 +830,100 @@ while ($sthArows > $rec_count)
$drop_lockout_time[$rec_count] = $aryA[14];
$no_hopper_dialing[$rec_count] = $aryA[15];
$auto_alt_dial_statuses[$rec_count] = $aryA[16];
$dial_timeout[$rec_count] = $aryA[17];
$auto_hopper_multi[$rec_count] = $aryA[18];
$use_auto_hopper[$rec_count] = $aryA[19];
$auto_trim_hopper[$rec_count] = $aryA[20];
### Auto Hopper Level
if ( $use_auto_hopper[$rec_count] =~ /Y/)
{
### Find the number of agents
$stmtB = "SELECT COUNT(*) FROM vicidial_live_agents WHERE campaign_id='$campaign_id[$rec_count]' and status IN ('READY','QUEUE','INCALL','CLOSER') and last_update_time >= '$VDL_tensec'";
$sthB = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr;
$sthB->execute or die "executing: $stmtB ", $dbhA->errstr;
@aryAgent = $sthB->fetchrow_array;
$num_agents = $aryAgent[0];
$sthB->finish();
$stmtB = "SELECT COUNT(*) FROM vicidial_live_agents WHERE campaign_id='$campaign_id[$rec_count]' and status IN ('PAUSED') and last_update_time >= '$VDL_tensec' and last_state_change >= '$VDL_one'";
$sthB = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr;
$sthB->execute or die "executing: $stmtB ", $dbhA->errstr;
@aryAgent = $sthB->fetchrow_array;
$num_paused_agents = $aryAgent[0];
$sthB->finish();
### Make sure the auto hopper multiplier is not set to something stupid
if ( $auto_hopper_multi[$rec_count] <= 0 ) { $auto_hopper_multi[$rec_count] = 0.1; }
### Save for debug info
$minimum_hopper_level = $hopper_level[$rec_count];
### Number of calls per minute
$dial_timeout_mult = 60 / $dial_timeout[$rec_count];
$auto_hopper_level = roundup( $auto_hopper_multi[$rec_count] * ( $num_agents + $num_paused_agents ) * $auto_dial_level[$rec_count] * $dial_timeout_mult );
### Make sure we are greater than the minimum hopper level
if ( $auto_hopper_level >= $minimum_hopper_level )
{
$hopper_level[$rec_count] = $auto_hopper_level
}
else
{
$hopper_level[$rec_count] = $minimum_hopper_level;
}
if ($DB)
{
print "---------------Auto Hopper Level Enabled For $campaign_id[$rec_count]---------------------\n";
print "Number of Agents = $num_agents\n";
print "Number of Paused Agents = $num_paused_agents\n";
print "Auto Dial Level = $auto_dial_level[$rec_count]\n";
print "Dial Timeout = $dial_timeout[$rec_count]\n";
print "Dial Timeout Multiplier = $dial_timeout_mult\n";
print "Auto Hopper Multipier = $auto_hopper_multi[$rec_count]\n";
print "Minimum Hopper Level = $minimum_hopper_level\n";
print "Auto Hopper Level Adjustment = $auto_hopper_level\n";
print "Final Hopper Level = $hopper_level[$rec_count]\n\n";
}
$stmtB = "UPDATE vicidial_campaigns set auto_hopper_level = '$auto_hopper_level' where campaign_id='$campaign_id[$rec_count]'";
$affected_rows = $dbhA->do($stmtB);
}
### Auto Trim Hopper code
if ( $auto_trim_hopper[$rec_count] =~ /Y/)
{
if ($DB) { print "---------------Auto Trim Hopper Enabled For $campaign_id[$rec_count]---------------------\n"; }
$stmtB = "SELECT COUNT(*) FROM vicidial_hopper WHERE campaign_id='$campaign_id[$rec_count]' and status IN ('READY') and source IN('S','N');";
$sthB = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr;
$sthB->execute or die "executing: $stmtB ", $dbhA->errstr;
@aryLead = $sthB->fetchrow_array;
$camp_leads = $aryLead[0];
$sthB->finish();
if ($DB)
{
print "Leads in Hopper for this Campaign = $camp_leads\n";
print "Hopper Level for this Campaign = $hopper_level[$rec_count]\n";
}
if ( $camp_leads > ( 2 * $hopper_level[$rec_count] ) )
{
$num_to_delete = $camp_leads - 2 * $hopper_level[$rec_count];
$stmtB = "DELETE FROM vicidial_hopper WHERE campaign_id='$campaign_id[$rec_count]' AND source='S' AND status IN ('READY') LIMIT $num_to_delete";
$affected_rows = $dbhA->do($stmtB);
if ($DB)
{
print "TOO MANY LEADS IN THE HOPPER ( $camp_leads > 2 * $hopper_level[$rec_count] ). \n";
print "DELETING $num_to_delete LEADS FROM THE HOPPER. |$affected_rows|\n";
}
}
if ($DB) { print "\n"; }
}
$rec_count++;
}
$sthA->finish();
@@ -1751,6 +1863,7 @@ foreach(@campaign_id)
@REC_status_to_hopper=@MT;
@REC_modify_to_hopper=@MT;
@REC_user_to_hopper=@MT;
@REC_source_to_hopper=@MT;
if ($rec_ct[$i] > 0)
{
if ($DB) {print " looking for RECYCLE leads, maximum of $hopper_level[$i]\n";}
@@ -1773,6 +1886,7 @@ foreach(@campaign_id)
$REC_status_to_hopper[$REC_rec_countLEADS] = $aryA[5];
$REC_modify_to_hopper[$REC_rec_countLEADS] = $aryA[6];
$REC_user_to_hopper[$REC_rec_countLEADS] = $aryA[7];
$REC_source_to_hopper[$REC_rec_countLEADS] = 'R';
if ($DB_show_offset) {print "LEAD_ADD: $aryA[2] $aryA[3] $aryA[4]\n";}
$REC_rec_countLEADS++;
}
@@ -1795,6 +1909,7 @@ foreach(@campaign_id)
@NEW_status_to_hopper=@MT;
@NEW_modify_to_hopper=@MT;
@NEW_user_to_hopper=@MT;
@NEW_source_to_hopper=@MT;
if ( ($NEW_count > 0) && ($list_order_mix[$i] =~ /DISABLED/) )
{
$NEW_level = int($hopper_level[$i] / $NEW_count);
@@ -1817,6 +1932,7 @@ foreach(@campaign_id)
$NEW_status_to_hopper[$NEW_rec_countLEADS] = $aryA[5];
$NEW_modify_to_hopper[$NEW_rec_countLEADS] = $aryA[6];
$NEW_user_to_hopper[$NEW_rec_countLEADS] = $aryA[7];
$NEW_source_to_hopper[$NEW_rec_countLEADS] = 'N';
if ($DB_show_offset) {print "LEAD_ADD: $aryA[2] $aryA[3] $aryA[4]\n";}
$NEW_rec_countLEADS++;
}
@@ -1838,6 +1954,7 @@ foreach(@campaign_id)
@status_to_hopper=@MT;
@modify_to_hopper=@MT;
@user_to_hopper=@MT;
@source_to_hopper=@MT;
if ($campaign_leads_to_call[$i] > 0)
{
if ($DB) {print " lead call order: $order_stmt\n";}
@@ -1869,6 +1986,7 @@ foreach(@campaign_id)
$status_to_hopper[$rec_countLEADS] = $NEW_status_to_hopper[$NEW_in];
$modify_to_hopper[$rec_countLEADS] = $NEW_modify_to_hopper[$NEW_in];
$user_to_hopper[$rec_countLEADS] = $NEW_user_to_hopper[$NEW_in];
$source_to_hopper[$rec_countLEADS] = $NEW_source_to_hopper[$NEW_in];
if ($DB_show_offset) {print "LEAD_ADD: $NEW_leads_to_hopper[$NEW_in] $NEW_phone_to_hopper[$NEW_in]\n";}
$rec_countLEADS++;
$NEW_in++;
@@ -1885,6 +2003,7 @@ foreach(@campaign_id)
$status_to_hopper[$rec_countLEADS] = $REC_status_to_hopper[$REC_insert_count];
$modify_to_hopper[$rec_countLEADS] = $REC_modify_to_hopper[$REC_insert_count];
$user_to_hopper[$rec_countLEADS] = $REC_user_to_hopper[$REC_insert_count];
$source_to_hopper[$rec_countLEADS] = $REC_source_to_hopper[$REC_insert_count];
$rec_countLEADS++;
$REC_insert_count++;
}
@@ -1896,6 +2015,7 @@ foreach(@campaign_id)
$status_to_hopper[$rec_countLEADS] = $aryA[5];
$modify_to_hopper[$rec_countLEADS] = $aryA[6];
$user_to_hopper[$rec_countLEADS] = $aryA[7];
$source_to_hopper[$rec_countLEADS] = 'S';
if ($DB_show_offset) {print "LEAD_ADD: $aryA[2] $aryA[3] $aryA[4]\n";}
$rec_countLEADS++;
$rec_count++;
@@ -1983,6 +2103,7 @@ foreach(@campaign_id)
$status_to_hopper[$rec_countLEADS] = $REC_status_to_hopper[$REC_insert_count];
$modify_to_hopper[$rec_countLEADS] = $REC_modify_to_hopper[$REC_insert_count];
$user_to_hopper[$rec_countLEADS] = $REC_user_to_hopper[$REC_insert_count];
$source_to_hopper[$rec_countLEADS] = $REC_source_to_hopper[$REC_insert_count];
$rec_countLEADS++;
$REC_insert_count++;
}
@@ -1994,6 +2115,7 @@ foreach(@campaign_id)
$status_to_hopper[$rec_countLEADS] = $aryA[6];
$modify_to_hopper[$rec_countLEADS] = $aryA[7];
$user_to_hopper[$rec_countLEADS] = $aryA[8];
$source_to_hopper[$rec_countLEADS] = 'S';
if ($DB_show_offset) {print "LEAD_ADD: $aryA[3] $aryA[4] $aryA[5]\n";}
if ($DBX) {print " $w|$LM_results[$w]\n";}
$rec_countLEADS++;
@@ -2012,6 +2134,7 @@ foreach(@campaign_id)
$status_to_hopper[$rec_countLEADS] = $REC_status_to_hopper[$REC_insert_count];
$modify_to_hopper[$rec_countLEADS] = $REC_modify_to_hopper[$REC_insert_count];
$user_to_hopper[$rec_countLEADS] = $REC_user_to_hopper[$REC_insert_count];
$source_to_hopper[$rec_countLEADS] = $REC_source_to_hopper[$REC_insert_count];
$rec_countLEADS++;
$REC_insert_count++;
}
@@ -2118,12 +2241,12 @@ foreach(@campaign_id)
{
if ($DNClead == '0')
{
$stmtA = "INSERT INTO $vicidial_hopper (lead_id,campaign_id,status,user,list_id,gmt_offset_now,state,priority) values('$leads_to_hopper[$h]','$campaign_id[$i]','READY','','$lists_to_hopper[$h]','$gmt_to_hopper[$h]','$state_to_hopper[$h]','0');";
$stmtA = "INSERT INTO $vicidial_hopper (lead_id,campaign_id,status,user,list_id,gmt_offset_now,state,priority,source) values('$leads_to_hopper[$h]','$campaign_id[$i]','READY','','$lists_to_hopper[$h]','$gmt_to_hopper[$h]','$state_to_hopper[$h]','0','$source_to_hopper[$h]');";
$affected_rows = $dbhA->do($stmtA);
if ($DBX) {print "LEAD INSERTED: $affected_rows|$leads_to_hopper[$h]|\n";}
if ($DB_detail)
{
$detail_string = "|$campaign_id[$i]|$leads_to_hopper[$h]|$phone_to_hopper[$h]|$state_to_hopper[$h]|$gmt_to_hopper[$h]|$status_to_hopper[$h]|$modify_to_hopper[$h]|$user_to_hopper[$h]|";
$detail_string = "|$campaign_id[$i]|$leads_to_hopper[$h]|$phone_to_hopper[$h]|$state_to_hopper[$h]|$gmt_to_hopper[$h]|$status_to_hopper[$h]|$modify_to_hopper[$h]|$user_to_hopper[$h]|$source_to_hopper[$h]|";
&detail_logger;
}
}
@@ -2132,12 +2255,12 @@ foreach(@campaign_id)
##### Auto-Alt-Dial if DNCC or DNCL are set to campaign auto-alt-dial statuses, insert lead into hopper as DNC status
if ( ( ($auto_alt_dial_statuses[$i] =~ / DNCC /) && ($DNCC > 0) ) || ( ($auto_alt_dial_statuses[$i] =~ / DNCL /) && ($DNCL > 0) ) )
{
$stmtA = "INSERT INTO $vicidial_hopper (lead_id,campaign_id,status,user,list_id,gmt_offset_now,state,priority) values('$leads_to_hopper[$h]','$campaign_id[$i]','DNC','','$lists_to_hopper[$h]','$gmt_to_hopper[$h]','$state_to_hopper[$h]','0');";
$stmtA = "INSERT INTO $vicidial_hopper (lead_id,campaign_id,status,user,list_id,gmt_offset_now,state,priority,source) values('$leads_to_hopper[$h]','$campaign_id[$i]','DNC','','$lists_to_hopper[$h]','$gmt_to_hopper[$h]','$state_to_hopper[$h]','0','$source_to_hopper[$h]');";
$affected_rows = $dbhA->do($stmtA);
if ($DBX) {print "LEAD INSERTED AS DNC: $affected_rows|$leads_to_hopper[$h]|\n";}
if ($DB_detail)
{
$detail_string = "|$campaign_id[$i]|$leads_to_hopper[$h]|$phone_to_hopper[$h]|$state_to_hopper[$h]|$gmt_to_hopper[$h]|$status_to_hopper[$h]|$modify_to_hopper[$h]|$user_to_hopper[$h]|";
$detail_string = "|$campaign_id[$i]|$leads_to_hopper[$h]|$phone_to_hopper[$h]|$state_to_hopper[$h]|$gmt_to_hopper[$h]|$status_to_hopper[$h]|$modify_to_hopper[$h]|$user_to_hopper[$h]|$source_to_hopper[$h]|";
&detail_logger;
}
}
@@ -2200,3 +2323,9 @@ sub detail_logger
}
$detail_string='';
}
sub roundup
{
my $n = shift;
return(($n == int($n)) ? $n : int($n + 1))
}
+5 -4
View File
@@ -56,6 +56,7 @@
# 100123-1449 - Added double-log end logging
# 100224-1229 - Fixed manual dial park call bug
# 100903-0041 - Changed lead_id max length to 10 digits
# 101111-1556 - Added source to vicidial_hopper inserts
#
# defaults for PreFork
@@ -1267,7 +1268,7 @@ sub process_request
}
if ($VD_alt_dnc_count < 1)
{
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$VD_lead_id',campaign_id='$VD_campaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ALT',user='',priority='25';";
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$VD_lead_id',campaign_id='$VD_campaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ALT',user='',priority='25',source='A';";
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDH record inserted: |$affected_rows| |$stmtA|"; &agi_output;}
}
@@ -1347,7 +1348,7 @@ sub process_request
}
if ($VD_alt_dnc_count < 1)
{
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$VD_lead_id',campaign_id='$VD_campaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ADDR3',user='',priority='20';";
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$VD_lead_id',campaign_id='$VD_campaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ADDR3',user='',priority='20',source='A';";
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDH record inserted: |$affected_rows| |$stmtA|"; &agi_output;}
}
@@ -1468,7 +1469,7 @@ sub process_request
{
if ($alt_dial_phones_count eq '$Xlast')
{$Xlast = 'LAST';}
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$VD_lead_id',campaign_id='$VD_campaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='X$Xlast',user='',priority='15';";
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$VD_lead_id',campaign_id='$VD_campaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='X$Xlast',user='',priority='15',source='A';";
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDH record inserted: |$affected_rows| |$stmtA|X$Xlast|$VD_altdial_id|"; &agi_output;}
$Xlast=9999999999;
@@ -1479,7 +1480,7 @@ sub process_request
{
if ($alt_dial_phones_count eq '$Xlast')
{$Xlast = 'LAST';}
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$VD_lead_id',campaign_id='$VD_campaign_id',status='DNC',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='X$Xlast',user='',priority='15';";
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$VD_lead_id',campaign_id='$VD_campaign_id',status='DNC',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='X$Xlast',user='',priority='15',source='A';";
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDH record DNC inserted: |$affected_rows| |$stmtA|X$Xlast|$VD_altdial_id|"; &agi_output;}
$Xlast=9999999999;
+7 -2
View File
@@ -335,6 +335,7 @@ gmt_offset_now DECIMAL(4,2) DEFAULT '0.00',
state VARCHAR(2) default '',
alt_dial VARCHAR(6) default 'NONE',
priority TINYINT(2) default '0',
source VARCHAR(1) default '',
index (lead_id)
);
@@ -773,7 +774,11 @@ customer_3way_hangup_action ENUM('NONE','DISPO') default 'NONE',
ivr_park_call ENUM('DISABLED','ENABLED','ENABLED_PARK_ONLY','ENABLED_BUTTON_HIDDEN') default 'DISABLED',
ivr_park_call_agi TEXT,
manual_preview_dial ENUM('DISABLED','PREVIEW_AND_SKIP','PREVIEW_ONLY') default 'PREVIEW_AND_SKIP',
realtime_agent_time_stats ENUM('DISABLED','WAIT_CUST_ACW','WAIT_CUST_ACW_PAUSE','CALLS_WAIT_CUST_ACW_PAUSE') default 'CALLS_WAIT_CUST_ACW_PAUSE'
realtime_agent_time_stats ENUM('DISABLED','WAIT_CUST_ACW','WAIT_CUST_ACW_PAUSE','CALLS_WAIT_CUST_ACW_PAUSE') default 'CALLS_WAIT_CUST_ACW_PAUSE',
use_auto_hopper ENUM('Y','N') default 'Y',
auto_hopper_multi VARCHAR(6) default '1',
auto_hopper_level MEDIUMINT(8) UNSIGNED default '0',
auto_trim_hopper ENUM('Y','N') default 'Y'
);
CREATE TABLE vicidial_lists (
@@ -2390,7 +2395,7 @@ ALTER TABLE vicidial_agent_log_archive MODIFY agent_log_id INT(9) UNSIGNED NOT N
CREATE TABLE vicidial_carrier_log_archive LIKE vicidial_carrier_log;
UPDATE system_settings SET db_schema_version='1251',db_schema_update_date=NOW();
UPDATE system_settings SET db_schema_version='1252',db_schema_update_date=NOW();
GRANT RELOAD ON *.* TO cron@'%';
GRANT RELOAD ON *.* TO cron@localhost;
+9
View File
@@ -596,3 +596,12 @@ ALTER TABLE system_settings ADD generate_cross_server_exten ENUM('0','1') defaul
ALTER TABLE system_settings ADD queuemetrics_addmember_enabled ENUM('0','1') default '0';
UPDATE system_settings SET db_schema_version='1251',db_schema_update_date=NOW();
ALTER TABLE vicidial_campaigns ADD use_auto_hopper ENUM('Y','N') default 'N';
ALTER TABLE vicidial_campaigns ADD auto_hopper_multi VARCHAR(6) default '1';
ALTER TABLE vicidial_campaigns ADD auto_hopper_level MEDIUMINT(8) UNSIGNED default '0';
ALTER TABLE vicidial_campaigns ADD auto_trim_hopper ENUM('Y','N') default 'N';
ALTER TABLE vicidial_hopper ADD source VARCHAR(1) default '';
UPDATE system_settings SET db_schema_version='1252',db_schema_update_date=NOW();
@@ -472,6 +472,14 @@ Generate Cross-Server Phone Extensions||
This option if set to 1 will generate dialplan entries for every phone on a multi-server system. Default is 0 for inactive||
QueueMetrics Addmember Enabled||
This option if set to 1 will generate ADDMEMBER2 and REMOVEMEMBER entries in queue_log. Default is 0 for disabled||
Minimum Hopper Level||
This is the minimum number of leads the VDhopper script tries to keep in the vicidial_hopper table for this campaign. If running VDhopper script every minute, make this slightly greater than the number of leads you go through in a minute||
Automatic Hopper Level||
Setting thing to Y will allow Vicidial to automatically adjust the hopper based off the settings you have in your campaign. The formula it uses to do this is||
Automatic Hopper Multiplier||
This is multiplier for the Auto Hopper. Setting this less than 1 will cause the Auto Hopper algorithm to load less leads than it normally would. Setting this greater than 1 will cause the Auto Hopper algorithm to load more leads than it normally would. Default is 1||
Auto Trim Hopper||
Setting thing to Y will allow Vicidial to automatically remove excess leads from the hopper. Default is Y||
AST_LISTS_campaign_stats.php
+7 -6
View File
@@ -261,10 +261,11 @@
# 101001-1451 - Added full name display to Call Log functionality
# 101022-1243 - Fixed missing variables from start and dispo call urls
# 101108-0115 - Added ADDMEMBER option for queue_log
# 101111-1556 - Added source to vicidial_hopper inserts
#
$version = '2.4-167';
$build = '101108-0115';
$version = '2.4-168';
$build = '101111-1556';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=352;
$one_mysql_log=0;
@@ -1750,7 +1751,7 @@ if ($ACTION == 'manDiaLnextCaLL')
$state = $row[3];
$entry_list_id = $row[4];
$stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='QUEUE',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='MAIN',user='$user',priority='0';";
$stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='QUEUE',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='MAIN',user='$user',priority='0',source='Q';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00244',$user,$server_ip,$session_name,$one_mysql_log);}
@@ -3198,7 +3199,7 @@ if ($stage == "end")
if ($VD_alt_dnc_count < 1)
{
### insert record into vicidial_hopper for alt_phone call attempt
$stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ALT',user='',priority='25';";
$stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ALT',user='',priority='25',source='A';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00068',$user,$server_ip,$session_name,$one_mysql_log);}
@@ -3275,7 +3276,7 @@ if ($stage == "end")
if ($VD_alt_dnc_count < 1)
{
### insert record into vicidial_hopper for address3 call attempt
$stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ADDR3',user='',priority='20';";
$stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ADDR3',user='',priority='20',source='A';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00072',$user,$server_ip,$session_name,$one_mysql_log);}
@@ -3391,7 +3392,7 @@ if ($stage == "end")
{
if ($alt_dial_phones_count == $Xlast)
{$Xlast = 'LAST';}
$stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$EA_list_id',gmt_offset_now='$EA_gmt_offset_now',state='$EA_state',alt_dial='X$Xlast',user='',priority='15';";
$stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$EA_list_id',gmt_offset_now='$EA_gmt_offset_now',state='$EA_state',alt_dial='X$Xlast',user='',priority='15',source='A';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00078',$user,$server_ip,$session_name,$one_mysql_log);}
+19 -7
View File
@@ -1,7 +1,7 @@
<?php
# AST_VICIDIAL_hopperlist.php
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
#
@@ -12,6 +12,7 @@
# 71030-2118 - Added priority to display
# 90508-0644 - Changed to PHP long tags
# 91023-1540 - Changed to only show hopper status of READY
# 101111-1253 - Added source field
#
require("dbconnect.php");
@@ -131,11 +132,11 @@ else
echo "\n";
echo "---------- LEADS IN HOPPER\n";
echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+\n";
echo "|ORDER |PRIORITY| LEAD ID | LIST ID | PHONE NUM | STATE | STATUS | COUNT | GMT | ALT |\n";
echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+\n";
echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+-------+\n";
echo "|ORDER |PRIORITY| LEAD ID | LIST ID | PHONE NUM | STATE | STATUS | COUNT | GMT | ALT | SOURCE|\n";
echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+-------+\n";
$stmt="select vicidial_hopper.lead_id,phone_number,vicidial_hopper.state,vicidial_list.status,called_count,vicidial_hopper.gmt_offset_now,hopper_id,alt_dial,vicidial_hopper.list_id,vicidial_hopper.priority from vicidial_hopper,vicidial_list where vicidial_hopper.campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_hopper.status='READY' and vicidial_hopper.lead_id=vicidial_list.lead_id order by priority desc,hopper_id limit 5000;";
$stmt="select vicidial_hopper.lead_id,phone_number,vicidial_hopper.state,vicidial_list.status,called_count,vicidial_hopper.gmt_offset_now,hopper_id,alt_dial,vicidial_hopper.list_id,vicidial_hopper.priority,vicidial_hopper.source from vicidial_hopper,vicidial_list where vicidial_hopper.campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_hopper.status='READY' and vicidial_hopper.lead_id=vicidial_list.lead_id order by priority desc,hopper_id limit 5000;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$users_to_print = mysql_num_rows($rslt);
@@ -155,19 +156,30 @@ else
$alt_dial = sprintf("%-5s", $row[7]);
$list_id = sprintf("%-10s", $row[8]);
$priority = sprintf("%-6s", $row[9]);
$source = sprintf("%-5s", $row[10]);
if ($DB) {echo "| $FMT_i | $priority | $lead_id | $list_id | $phone_number | $state | $status | $count | $gmt | $hopper_id |\n";}
else {echo "| $FMT_i | $priority | $lead_id | $list_id | $phone_number | $state | $status | $count | $gmt | $alt_dial |\n";}
else {echo "| $FMT_i | $priority | $lead_id | $list_id | $phone_number | $state | $status | $count | $gmt | $alt_dial | $source |\n";}
$i++;
}
echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+\n";
echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+-------+\n";
}
?>
Sources:
A = Auto-alt-dial
C = Scheduled Callbacks
N = Xth New lead order
P = Non-Agent API hopper load
Q = No-hopper queue insert
R = Recycled leads
S = Standard hopper load
</PRE>
</TD></TR></TABLE>
+8 -6
View File
@@ -69,10 +69,11 @@
# 100912-0839 - Changed several stats to limit to 2 or 3 decimal spaces
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
# 101024-0832 - Added Agent time stats option and agents-in-dispo counter
# 101109-1448 - Added Auto Hopper Level display (MikeC)
#
$version = '2.4-60';
$build = '101024-0832';
$version = '2.4-61';
$build = '101109-1448';
header ("Content-type: text/html; charset=utf-8");
@@ -1435,7 +1436,7 @@ else
else
{$non_inboundSQL = "and campaign_id IN($group_SQL,$closer_campaignsSQL)";}
$multi_drop++;
$stmt="select avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout),min(dial_statuses),max(agent_pause_codes_active),max(list_order_mix) from vicidial_campaigns where active='Y' $group_SQLand;";
$stmt="select avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout),min(dial_statuses),max(agent_pause_codes_active),max(list_order_mix),max(auto_hopper_level) from vicidial_campaigns where active='Y' $group_SQLand;";
$stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4),sum(agent_calls_today),sum(agent_wait_today),sum(agent_custtalk_today),sum(agent_acw_today),sum(agent_pause_today) from vicidial_campaign_stats where calls_today > -1 $non_inboundSQL;";
}
@@ -1448,13 +1449,13 @@ else
$multi_drop++;
if ($DB) {echo "with_inbound|$with_inbound|$campaign_allow_inbound\n";}
$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses,agent_pause_codes_active,list_order_mix from vicidial_campaigns where campaign_id IN ($group_SQL,$closer_campaignsSQL);";
$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses,agent_pause_codes_active,list_order_mix,auto_hopper_level from vicidial_campaigns where campaign_id IN ($group_SQL,$closer_campaignsSQL);";
$stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4),sum(agent_calls_today),sum(agent_wait_today),sum(agent_custtalk_today),sum(agent_acw_today),sum(agent_pause_today) from vicidial_campaign_stats where campaign_id IN ($group_SQL,$closer_campaignsSQL);";
}
else
{
$stmt="select avg(auto_dial_level),max(dial_status_a),max(dial_status_b),max(dial_status_c),max(dial_status_d),max(dial_status_e),max(lead_order),max(lead_filter_id),max(hopper_level),max(dial_method),max(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),max(available_only_ratio_tally),max(adaptive_latest_server_time),max(local_call_time),max(dial_timeout),max(dial_statuses),max(agent_pause_codes_active),max(list_order_mix) from vicidial_campaigns where campaign_id IN($group_SQL);";
$stmt="select avg(auto_dial_level),max(dial_status_a),max(dial_status_b),max(dial_status_c),max(dial_status_d),max(dial_status_e),max(lead_order),max(lead_filter_id),max(hopper_level),max(dial_method),max(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),max(available_only_ratio_tally),max(adaptive_latest_server_time),max(local_call_time),max(dial_timeout),max(dial_statuses),max(agent_pause_codes_active),max(list_order_mix),max(auto_hopper_level) from vicidial_campaigns where campaign_id IN($group_SQL);";
$stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4),sum(agent_calls_today),sum(agent_wait_today),sum(agent_custtalk_today),sum(agent_acw_today),sum(agent_pause_today) from vicidial_campaign_stats where campaign_id IN($group_SQL);";
}
@@ -1484,6 +1485,7 @@ else
$DIALstatuses = $row[18];
$agent_pause_codes_active = $row[19];
$DIALmix = $row[20];
$AHOPlev = $row[21];
$stmt="select count(*) from vicidial_hopper $group_SQLwhere;";
@@ -1593,7 +1595,7 @@ else
echo "</TR>";
echo "<TR>";
echo "<TD ALIGN=RIGHT><font size=2><B>HOPPER LEVEL:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $HOPlev &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>HOPPER <font size=1>( min/auto )</font>:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $HOPlev / $AHOPlev &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>DROPPED / ANSWERED:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $dropsTODAY / $answersTODAY &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>DL DIFF:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $diffONEMIN &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>STATUSES:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DIALstatuses &nbsp; &nbsp; </TD>";
+47 -11
View File
File diff suppressed because one or more lines are too long
+4 -3
View File
@@ -37,10 +37,11 @@
# 100723-1333 - Added no_update option to the update_lead function
# 100728-1952 - Added delete_lead option to the update_lead function
# 100924-1403 - Added called_count as an update_lead option
# 101111-1536 - Added vicidial_hopper.source to vicidial_hopper inserts
#
$version = '2.4-23';
$build = '100924-1403';
$version = '2.4-24';
$build = '101111-1536';
require("dbconnect.php");
@@ -1653,7 +1654,7 @@ if ($function == 'add_lead')
### code to insert into hopper goes here
### insert record into vicidial_hopper for alt_phone call attempt
$stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$VD_campaign_id',status='READY',list_id='$list_id',gmt_offset_now='$gmt_offset',state='$state',user='',priority='$hopper_priority';";
$stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$VD_campaign_id',status='READY',list_id='$list_id',gmt_offset_now='$gmt_offset',state='$state',user='',priority='$hopper_priority',source='P';";
if ($DB>0) {echo "DEBUG: add_lead query - $stmt\n";}
$rslt=mysql_query($stmt, $link);
$Haffected_rows = mysql_affected_rows($link);