updates to outbound routing optimization and testing
git-svn-id: svn://192.168.202.10@2639 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -115,12 +115,13 @@
|
||||
# 150928-1822 - Added dnc logging
|
||||
# 160101-1528 - Added routing_initiated_recordings
|
||||
# 161102-1037 - Fixed QM partition problem
|
||||
# 161201-1003 - Fixed LRERR logging issue
|
||||
#
|
||||
|
||||
$script = 'agi-VDAD_ALL_outbound.agi';
|
||||
$AGILOG = '0';
|
||||
$mel=1; # Mysql Error Log enabled = 1
|
||||
$mysql_log_count=119;
|
||||
$mysql_log_count=136;
|
||||
$one_mysql_log=0;
|
||||
|
||||
use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second
|
||||
@@ -398,7 +399,7 @@ if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) )
|
||||
|
||||
$xCLlist_id=0;
|
||||
$called_count=0;
|
||||
$stmtA = "SELECT list_id,security_phrase,called_count from vicidial_list where lead_id='$CIDlead_id' limit 1;";
|
||||
$stmtA = "SELECT list_id,security_phrase,called_count,phone_number,phone_code from vicidial_list where lead_id='$CIDlead_id' limit 1;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArowsLI=$sthA->rows;
|
||||
@@ -409,6 +410,8 @@ if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) )
|
||||
$xCLlist_id = $aryA[0];
|
||||
$security_phrase = $aryA[1];
|
||||
$called_count = $aryA[2];
|
||||
$VDADphone = $aryA[3];
|
||||
$VDADphone_code = $aryA[4];
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
@@ -429,6 +432,20 @@ if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) )
|
||||
$VDADqueue_priority = $aryA[6];
|
||||
}
|
||||
$sthA->finish();
|
||||
if ($sthArows < 1)
|
||||
{
|
||||
$stmtA = "SELECT campaign_id FROM vicidial_lists where list_id='$xCLlist_id' limit 1;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$dbhP=$dbhA; $mysql_count='01120'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VDADcampaign = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
}
|
||||
|
||||
$stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed,alt_dial,list_id,called_count) values('$uniqueid','$CIDlead_id','$VDADcampaign','$SQLdate','$now_date_epoch','LRERR','$VDADphone_code','$VDADphone','VDAD','N','$VDADalt_dial','$xCLlist_id','$called_count')";
|
||||
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
|
||||
@@ -2592,7 +2609,7 @@ while ($drop_timer <= $DROP_TIME)
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArowsVUrec=$sthA->rows;
|
||||
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$sthArowsVUrec; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='01121'; $MEL_aff_rows=$sthArowsVUrec; &mysql_error_logging;
|
||||
if ($sthArowsVUrec > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
@@ -2611,7 +2628,7 @@ while ($drop_timer <= $DROP_TIME)
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='01122'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
@@ -2652,12 +2669,12 @@ while ($drop_timer <= $DROP_TIME)
|
||||
### insert a record into the recording_log table
|
||||
$stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channelrec','$VDADserver_ip','$campaign_rec_exten','$now_date','$now_date_epoch','$campaign_rec_filename','$CIDlead_id','$VDADuser','$uniqueid')";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='02123'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;";
|
||||
$sthA = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$dbhP=$dbhA; $stmtA=$stmtB; $mysql_count='02XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $stmtA=$stmtB; $mysql_count='02124'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
@@ -2671,20 +2688,20 @@ while ($drop_timer <= $DROP_TIME)
|
||||
|
||||
$stmtA = "UPDATE recording_log SET filename='$campaign_rec_filename' where recording_id='$recording_id';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='02125'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
}
|
||||
|
||||
$stmtA="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','Originate','$campaign_rec_filename','Channel: $channelrec','Context: $ext_context','Exten: $campaign_rec_exten','Priority: 1','Callerid: $campaign_rec_filename','','','','','');";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='02126'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
|
||||
$stmtB = "INSERT INTO routing_initiated_recordings (recording_id,filename,launch_time,lead_id,vicidial_id,user,processed) values('$recording_id','$campaign_rec_filename','$now_date','$CIDlead_id','$uniqueid','$VDADuser','0')";
|
||||
$affected_rowsB = $dbhA->do($stmtB);
|
||||
$dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rowsB; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='02127'; $MEL_aff_rows=$affected_rowsB; &mysql_error_logging;
|
||||
|
||||
$stmtC = "UPDATE vicidial_live_agents SET external_recording='$recording_id' where user='$VDADuser';";
|
||||
$affected_rowsC = $dbhA->do($stmtC);
|
||||
$dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rowsC; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='02128'; $MEL_aff_rows=$affected_rowsC; &mysql_error_logging;
|
||||
|
||||
if ($AGILOG) {$agi_string = "-- ROUTING INITIATED RECORDING STARTED : |$affected_rows|$recording_id|$campaign_rec_filename|$stmtA| |$affected_rowsB|$stmtB| |$affected_rowsC|$stmtC|"; &agi_output;}
|
||||
}
|
||||
@@ -3306,7 +3323,7 @@ while ($drop_timer <= $DROP_TIME)
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArowsVUrec=$sthA->rows;
|
||||
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$sthArowsVUrec; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='01129'; $MEL_aff_rows=$sthArowsVUrec; &mysql_error_logging;
|
||||
if ($sthArowsVUrec > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
@@ -3325,7 +3342,7 @@ while ($drop_timer <= $DROP_TIME)
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='01130'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
@@ -3366,12 +3383,12 @@ while ($drop_timer <= $DROP_TIME)
|
||||
### insert a record into the recording_log table
|
||||
$stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channelrec','$VDADserver_ip','$campaign_rec_exten','$now_date','$now_date_epoch','$campaign_rec_filename','$CIDlead_id','$VDADuser','$uniqueid')";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='02131'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;";
|
||||
$sthA = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$dbhP=$dbhA; $stmtA=$stmtB; $mysql_count='02XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $stmtA=$stmtB; $mysql_count='02132'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
@@ -3385,20 +3402,20 @@ while ($drop_timer <= $DROP_TIME)
|
||||
|
||||
$stmtA = "UPDATE recording_log SET filename='$campaign_rec_filename' where recording_id='$recording_id';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='02133'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
}
|
||||
|
||||
$stmtA="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','Originate','$campaign_rec_filename','Channel: $channelrec','Context: $ext_context','Exten: $campaign_rec_exten','Priority: 1','Callerid: $campaign_rec_filename','','','','','');";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='02134'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
|
||||
$stmtB = "INSERT INTO routing_initiated_recordings (recording_id,filename,launch_time,lead_id,vicidial_id,user,processed) values('$recording_id','$campaign_rec_filename','$now_date','$CIDlead_id','$uniqueid','$VDADuser','0')";
|
||||
$affected_rowsB = $dbhA->do($stmtB);
|
||||
$dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rowsB; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='02135'; $MEL_aff_rows=$affected_rowsB; &mysql_error_logging;
|
||||
|
||||
$stmtC = "UPDATE vicidial_live_agents SET external_recording='$recording_id' where user='$VDADuser';";
|
||||
$affected_rowsC = $dbhA->do($stmtC);
|
||||
$dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rowsC; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='02136'; $MEL_aff_rows=$affected_rowsC; &mysql_error_logging;
|
||||
|
||||
if ($AGILOG) {$agi_string = "-- ROUTING INITIATED RECORDING STARTED : |$affected_rows|$recording_id|$campaign_rec_filename|$stmtA| |$affected_rowsB|$stmtB| |$affected_rowsC|$stmtC|"; &agi_output;}
|
||||
}
|
||||
|
||||
@@ -116,12 +116,13 @@
|
||||
# 160101-1528 - Added routing_initiated_recordings
|
||||
# 161102-1037 - Fixed QM partition problem
|
||||
# 161115-1359 - Forked to BETA script, added vdad_debug_logging option
|
||||
# 161201-1003 - Fixed LRERR logging issue
|
||||
#
|
||||
|
||||
$script = 'agi-VDAD_ALL_outboundBETA.agi';
|
||||
$AGILOG = '0';
|
||||
$mel=1; # Mysql Error Log enabled = 1
|
||||
$mysql_log_count=119;
|
||||
$mysql_log_count=151;
|
||||
$one_mysql_log=0;
|
||||
|
||||
use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second
|
||||
@@ -269,7 +270,7 @@ $stmtA = "SELECT vdad_debug_logging FROM system_settings;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='01151'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
@@ -391,7 +392,7 @@ if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) )
|
||||
&duration_calc;
|
||||
$stmtA = "INSERT INTO vicidial_vdad_log set caller_code='$callerid',server_ip='$VARserver_ip',call_date='$SQLdate',epoch_micro='$ORIG_time',db_time=NOW(),run_time='$net_duration',vdad_script='$script',stage='LocalEXIT-$priority',lead_id='$CIDlead_id',step='$LRct';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='01120'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$ORIG_time = $START_s_hires.'.'.sprintf("%06d", $START_usec);
|
||||
}
|
||||
|
||||
@@ -426,7 +427,7 @@ if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) )
|
||||
|
||||
$xCLlist_id=0;
|
||||
$called_count=0;
|
||||
$stmtA = "SELECT list_id,security_phrase,called_count from vicidial_list where lead_id='$CIDlead_id' limit 1;";
|
||||
$stmtA = "SELECT list_id,security_phrase,called_count,phone_number,phone_code from vicidial_list where lead_id='$CIDlead_id' limit 1;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArowsLI=$sthA->rows;
|
||||
@@ -437,6 +438,8 @@ if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) )
|
||||
$xCLlist_id = $aryA[0];
|
||||
$security_phrase = $aryA[1];
|
||||
$called_count = $aryA[2];
|
||||
$VDADphone = $aryA[3];
|
||||
$VDADphone_code = $aryA[4];
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
@@ -457,6 +460,20 @@ if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) )
|
||||
$VDADqueue_priority = $aryA[6];
|
||||
}
|
||||
$sthA->finish();
|
||||
if ($sthArows < 1)
|
||||
{
|
||||
$stmtA = "SELECT campaign_id FROM vicidial_lists where list_id='$xCLlist_id' limit 1;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$dbhP=$dbhA; $mysql_count='01121'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VDADcampaign = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
}
|
||||
|
||||
$stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed,alt_dial,list_id,called_count) values('$uniqueid','$CIDlead_id','$VDADcampaign','$SQLdate','$now_date_epoch','LRERR','$VDADphone_code','$VDADphone','VDAD','N','$VDADalt_dial','$xCLlist_id','$called_count')";
|
||||
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
|
||||
@@ -1060,7 +1077,7 @@ if ($VDACaffected_rows > 0)
|
||||
|
||||
$stmtA = "INSERT INTO vicidial_vdad_log set caller_code='$callerid',server_ip='$VARserver_ip',call_date='$SQLdate',epoch_micro='$ORIG_time',db_time=NOW(),run_time='$net_duration',vdad_script='$script',stage='preroute',lead_id='$CIDlead_id';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='01122'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$ORIG_time = $START_s_hires.'.'.sprintf("%06d", $START_usec);
|
||||
|
||||
|
||||
@@ -1141,7 +1158,7 @@ if ($VDACaffected_rows > 0)
|
||||
&duration_calc;
|
||||
$stmtA = "INSERT INTO vicidial_vdad_log set caller_code='$callerid',server_ip='$VARserver_ip',call_date='$SQLdate',epoch_micro='$ORIG_time',db_time=NOW(),run_time='$net_duration',vdad_script='$script',stage='prerouteQM',lead_id='$CIDlead_id';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='01123'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$ORIG_time = $START_s_hires.'.'.sprintf("%06d", $START_usec);
|
||||
}
|
||||
}
|
||||
@@ -1456,7 +1473,7 @@ if ($call_handle_method =~ /SURVEY/)
|
||||
&duration_calc;
|
||||
$stmtA = "INSERT INTO vicidial_vdad_log set caller_code='$callerid',server_ip='$VARserver_ip',call_date='$SQLdate',epoch_micro='$ORIG_time',db_time=NOW(),run_time='$net_duration',vdad_script='$script',stage='post-route-SURVEY-NI',lead_id='$CIDlead_id';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='01124'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$ORIG_time = $START_s_hires.'.'.sprintf("%06d", $START_usec);
|
||||
}
|
||||
$AGI->hangup();
|
||||
@@ -1572,7 +1589,7 @@ if ($call_handle_method =~ /SURVEY/)
|
||||
&duration_calc;
|
||||
$stmtA = "INSERT INTO vicidial_vdad_log set caller_code='$callerid',server_ip='$VARserver_ip',call_date='$SQLdate',epoch_micro='$ORIG_time',db_time=NOW(),run_time='$net_duration',vdad_script='$script',stage='post-route-SURVEY-3rd',lead_id='$CIDlead_id';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='01125'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$ORIG_time = $START_s_hires.'.'.sprintf("%06d", $START_usec);
|
||||
}
|
||||
|
||||
@@ -1704,7 +1721,7 @@ if ($call_handle_method =~ /SURVEY/)
|
||||
&duration_calc;
|
||||
$stmtA = "INSERT INTO vicidial_vdad_log set caller_code='$callerid',server_ip='$VARserver_ip',call_date='$SQLdate',epoch_micro='$ORIG_time',db_time=NOW(),run_time='$net_duration',vdad_script='$script',stage='post-route-SURVEY-4th',lead_id='$CIDlead_id';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='01126'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$ORIG_time = $START_s_hires.'.'.sprintf("%06d", $START_usec);
|
||||
}
|
||||
if (length($survey_fourth_exten) > 0)
|
||||
@@ -1982,7 +1999,7 @@ if ($call_handle_method =~ /SURVEY/)
|
||||
&duration_calc;
|
||||
$stmtA = "INSERT INTO vicidial_vdad_log set caller_code='$callerid',server_ip='$VARserver_ip',call_date='$SQLdate',epoch_micro='$ORIG_time',db_time=NOW(),run_time='$net_duration',vdad_script='$script',stage='post-route-SURVEY-exten',lead_id='$CIDlead_id';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='01127'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$ORIG_time = $START_s_hires.'.'.sprintf("%06d", $START_usec);
|
||||
}
|
||||
|
||||
@@ -2016,7 +2033,7 @@ if ($call_handle_method =~ /SURVEY/)
|
||||
&duration_calc;
|
||||
$stmtA = "INSERT INTO vicidial_vdad_log set caller_code='$callerid',server_ip='$VARserver_ip',call_date='$SQLdate',epoch_micro='$ORIG_time',db_time=NOW(),run_time='$net_duration',vdad_script='$script',stage='post-route-SURVEY-Hangup',lead_id='$CIDlead_id';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='01128'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$ORIG_time = $START_s_hires.'.'.sprintf("%06d", $START_usec);
|
||||
}
|
||||
$AGI->hangup();
|
||||
@@ -2100,7 +2117,7 @@ if ($call_handle_method =~ /SURVEY/)
|
||||
&duration_calc;
|
||||
$stmtA = "INSERT INTO vicidial_vdad_log set caller_code='$callerid',server_ip='$VARserver_ip',call_date='$SQLdate',epoch_micro='$ORIG_time',db_time=NOW(),run_time='$net_duration',vdad_script='$script',stage='post-route-SURVEY-REC',lead_id='$CIDlead_id';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='01129'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$ORIG_time = $START_s_hires.'.'.sprintf("%06d", $START_usec);
|
||||
}
|
||||
|
||||
@@ -2141,7 +2158,7 @@ if ($call_handle_method =~ /SURVEY/)
|
||||
&duration_calc;
|
||||
$stmtA = "INSERT INTO vicidial_vdad_log set caller_code='$callerid',server_ip='$VARserver_ip',call_date='$SQLdate',epoch_micro='$ORIG_time',db_time=NOW(),run_time='$net_duration',vdad_script='$script',stage='post-route-SURVEY-DROP',lead_id='$CIDlead_id';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='01130'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$ORIG_time = $START_s_hires.'.'.sprintf("%06d", $START_usec);
|
||||
}
|
||||
$AGI->hangup();
|
||||
@@ -2700,7 +2717,7 @@ while ($drop_timer <= $DROP_TIME)
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArowsVUrec=$sthA->rows;
|
||||
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$sthArowsVUrec; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='01131'; $MEL_aff_rows=$sthArowsVUrec; &mysql_error_logging;
|
||||
if ($sthArowsVUrec > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
@@ -2719,7 +2736,7 @@ while ($drop_timer <= $DROP_TIME)
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='01132'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
@@ -2760,12 +2777,12 @@ while ($drop_timer <= $DROP_TIME)
|
||||
### insert a record into the recording_log table
|
||||
$stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channelrec','$VDADserver_ip','$campaign_rec_exten','$now_date','$now_date_epoch','$campaign_rec_filename','$CIDlead_id','$VDADuser','$uniqueid')";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='02133'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;";
|
||||
$sthA = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$dbhP=$dbhA; $stmtA=$stmtB; $mysql_count='02XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $stmtA=$stmtB; $mysql_count='02134'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
@@ -2779,20 +2796,20 @@ while ($drop_timer <= $DROP_TIME)
|
||||
|
||||
$stmtA = "UPDATE recording_log SET filename='$campaign_rec_filename' where recording_id='$recording_id';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='02135'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
}
|
||||
|
||||
$stmtA="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','Originate','$campaign_rec_filename','Channel: $channelrec','Context: $ext_context','Exten: $campaign_rec_exten','Priority: 1','Callerid: $campaign_rec_filename','','','','','');";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='02136'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
|
||||
$stmtB = "INSERT INTO routing_initiated_recordings (recording_id,filename,launch_time,lead_id,vicidial_id,user,processed) values('$recording_id','$campaign_rec_filename','$now_date','$CIDlead_id','$uniqueid','$VDADuser','0')";
|
||||
$affected_rowsB = $dbhA->do($stmtB);
|
||||
$dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rowsB; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='02137'; $MEL_aff_rows=$affected_rowsB; &mysql_error_logging;
|
||||
|
||||
$stmtC = "UPDATE vicidial_live_agents SET external_recording='$recording_id' where user='$VDADuser';";
|
||||
$affected_rowsC = $dbhA->do($stmtC);
|
||||
$dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rowsC; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='02138'; $MEL_aff_rows=$affected_rowsC; &mysql_error_logging;
|
||||
|
||||
if ($AGILOG) {$agi_string = "-- ROUTING INITIATED RECORDING STARTED : |$affected_rows|$recording_id|$campaign_rec_filename|$stmtA| |$affected_rowsB|$stmtB| |$affected_rowsC|$stmtC|"; &agi_output;}
|
||||
}
|
||||
@@ -2924,7 +2941,7 @@ while ($drop_timer <= $DROP_TIME)
|
||||
&duration_calc;
|
||||
$stmtA = "INSERT INTO vicidial_vdad_log set caller_code='$callerid',server_ip='$VARserver_ip',call_date='$SQLdate',epoch_micro='$ORIG_time',db_time=NOW(),run_time='$net_duration',vdad_script='$script',stage='post-route-AGENT-1',lead_id='$CIDlead_id';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='01139'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$ORIG_time = $START_s_hires.'.'.sprintf("%06d", $START_usec);
|
||||
}
|
||||
|
||||
@@ -3423,7 +3440,7 @@ while ($drop_timer <= $DROP_TIME)
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArowsVUrec=$sthA->rows;
|
||||
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$sthArowsVUrec; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='01140'; $MEL_aff_rows=$sthArowsVUrec; &mysql_error_logging;
|
||||
if ($sthArowsVUrec > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
@@ -3442,7 +3459,7 @@ while ($drop_timer <= $DROP_TIME)
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='01141'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
@@ -3483,12 +3500,12 @@ while ($drop_timer <= $DROP_TIME)
|
||||
### insert a record into the recording_log table
|
||||
$stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channelrec','$VDADserver_ip','$campaign_rec_exten','$now_date','$now_date_epoch','$campaign_rec_filename','$CIDlead_id','$VDADuser','$uniqueid')";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='02142'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;";
|
||||
$sthA = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$dbhP=$dbhA; $stmtA=$stmtB; $mysql_count='02XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $stmtA=$stmtB; $mysql_count='02143'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
@@ -3502,20 +3519,20 @@ while ($drop_timer <= $DROP_TIME)
|
||||
|
||||
$stmtA = "UPDATE recording_log SET filename='$campaign_rec_filename' where recording_id='$recording_id';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='02144'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
}
|
||||
|
||||
$stmtA="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','Originate','$campaign_rec_filename','Channel: $channelrec','Context: $ext_context','Exten: $campaign_rec_exten','Priority: 1','Callerid: $campaign_rec_filename','','','','','');";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='02145'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
|
||||
$stmtB = "INSERT INTO routing_initiated_recordings (recording_id,filename,launch_time,lead_id,vicidial_id,user,processed) values('$recording_id','$campaign_rec_filename','$now_date','$CIDlead_id','$uniqueid','$VDADuser','0')";
|
||||
$affected_rowsB = $dbhA->do($stmtB);
|
||||
$dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rowsB; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='02146'; $MEL_aff_rows=$affected_rowsB; &mysql_error_logging;
|
||||
|
||||
$stmtC = "UPDATE vicidial_live_agents SET external_recording='$recording_id' where user='$VDADuser';";
|
||||
$affected_rowsC = $dbhA->do($stmtC);
|
||||
$dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rowsC; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='02147'; $MEL_aff_rows=$affected_rowsC; &mysql_error_logging;
|
||||
|
||||
if ($AGILOG) {$agi_string = "-- ROUTING INITIATED RECORDING STARTED : |$affected_rows|$recording_id|$campaign_rec_filename|$stmtA| |$affected_rowsB|$stmtB| |$affected_rowsC|$stmtC|"; &agi_output;}
|
||||
}
|
||||
@@ -3650,7 +3667,7 @@ while ($drop_timer <= $DROP_TIME)
|
||||
&duration_calc;
|
||||
$stmtA = "INSERT INTO vicidial_vdad_log set caller_code='$callerid',server_ip='$VARserver_ip',call_date='$SQLdate',epoch_micro='$ORIG_time',db_time=NOW(),run_time='$net_duration',vdad_script='$script',stage='post-route-AGENT-2',lead_id='$CIDlead_id';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='01148'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$ORIG_time = $START_s_hires.'.'.sprintf("%06d", $START_usec);
|
||||
}
|
||||
|
||||
@@ -3726,7 +3743,7 @@ while ($drop_timer <= $DROP_TIME)
|
||||
&duration_calc;
|
||||
$stmtA = "INSERT INTO vicidial_vdad_log set caller_code='$callerid',server_ip='$VARserver_ip',call_date='$SQLdate',epoch_micro='$ORIG_time',db_time=NOW(),run_time='$net_duration',vdad_script='$script',stage='waiting-for-agent-$drop_timer',lead_id='$CIDlead_id';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='01149'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$ORIG_time = $START_s_hires.'.'.sprintf("%06d", $START_usec);
|
||||
}
|
||||
|
||||
@@ -3944,7 +3961,7 @@ if ($drop_timer > $DROP_TIME)
|
||||
&duration_calc;
|
||||
$stmtA = "INSERT INTO vicidial_vdad_log set caller_code='$callerid',server_ip='$VARserver_ip',call_date='$SQLdate',epoch_micro='$ORIG_time',db_time=NOW(),run_time='$net_duration',vdad_script='$script',stage='end-drop-$drop_timer',lead_id='$CIDlead_id';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhA; $mysql_count='01150'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
$ORIG_time = $START_s_hires.'.'.sprintf("%06d", $START_usec);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
OUTBOUND DIALING OPTIMIZATIONS DOC Started: 2016-11-15 Updated: 2016-11-15
|
||||
OUTBOUND DIALING OPTIMIZATIONS DOC Started: 2016-11-15 Updated: 2016-12-01
|
||||
|
||||
|
||||
This document is a work in progress and is meant for reference only, to go over approaches to optimizing and speeding up the outbound auto-dialing processes
|
||||
@@ -16,10 +16,23 @@ Places to look at for speeding up outbound auto-dialing call routing speed:
|
||||
|
||||
SECTION 1. LOCAL/ CHANNEL RESOLUTION
|
||||
|
||||
First, and explanation of what exatly the "Local/ channel resolution" issue is. Auto-dial calls are placed from VICIdial to Asterisk using a Local/ channel, which goes to the dialplan and places the calls out through a carrier. When the call is placed, there is no audio stream yet, only signalling, and it stays that way until after the Answer signal is received from the carrier. At that point, the Local/ channel will resolve to it's proper channel pointer(usually SIP/... if using a sip carrier). Where the issues come in, is how long it takes for the audio to begin being received so that the channel pointer can resolve. This is extremely variable, and depends on the end customer carrier, as well as all of the carrier equipment in-between. We ahve seen Local/ channels resolve anywhere from 0.1 seconds up to 2 seconds, and in a small percentage of cases, the channel never resolves because no audio stream is received.
|
||||
First, and explanation of what exatly the "Local/ channel resolution" issue is. Auto-dial calls are placed from VICIdial to Asterisk using a Local/ channel, which goes to the dialplan and places the calls out through a carrier. When the call is placed, there is no audio stream yet, only signalling, and it stays that way until after the Answer signal is received from the carrier. At that point, the Local/ channel will resolve to it's proper channel pointer(usually SIP/... if using a sip carrier) and the pseudo channels that were created go away. Where the issues come in, is how long it takes for the audio to begin being received so that the channel pointer can resolve. This is extremely variable, and depends on the end customer carrier, as well as all of the carrier equipment in-between. We have seen Local/ channels resolve anywhere from 0.01 seconds up to 2 seconds, and in a small percentage of cases, the channel never resolves because no audio stream is ever received, even after 30 seconds of waiting post-Answer-signal. Another thing to remember related to this, Asterisk isn't perfect, and sometimes those pseudo channels will register as Answered for a split second before disappearing, which is another reason why it is important for the AGI routing script to not run on Local/ channels.
|
||||
|
||||
Currently, the outbound call agent routing process will immediately attempt to route the call if the Local/ channel has been resolved, and if it isn't, it will wait 1 second before trying again, then if it is still not resolved, giving up and logging the call as LRERR status. The optimization we are trying in the BETA script is to try multiple attempts at much faster intervals to check for Local/ channel resolution. The compilation of the AGI script can take anywhere from 0.1 to 0.3 seconds, depending on the server hardware and system load, then if the AGI script detects a Local/ channel, it quits and is tried again immediately. This also allows for a longer amount of time to wait for the channel to resolve because the number of loops is adjustable.
|
||||
|
||||
The AST_vdad_debug_log_report.php report was created to help evaluate the log entries from the BETA AGI scripts.
|
||||
|
||||
In our first round of live testing, we have seen the following results:
|
||||
- Calls that had no resolution delay routed in 0.1 seconds on average post-Answer-signal (85% of Answered calls)
|
||||
- Calls that had a resolution delay routed in 1.5 seconds on average post-Answer-signal (5% of Answered calls)
|
||||
- Calls that never resolved in over 30 seconds made up less than 10% of total Answered calls
|
||||
- The Asterisk 11 server had a lower rate of LRERR calls, and faster overall routing compared to 1.4 and 1.8 servers
|
||||
|
||||
Some conclusions based upon the first round of live testing:
|
||||
- Allowing more than 1 second for channel resolution increased delayed resolution calls being routed by about 30%, although this is still only 2% of total Answered calls
|
||||
- If a call does not resolve within 3 seconds post-Answer, there is very little chance it will ever resolve, although we did have a few calls resolve at 25+ seconds
|
||||
- Asterisk 11 appears to be more successful at forcing resolutions, and routing calls faster, when compared to earlier branches of Asterisk
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -28,8 +41,11 @@ Currently, the outbound call agent routing process will immediately attempt to r
|
||||
|
||||
SECTION 2. DATABASE LOAD AND QUERY SPEED
|
||||
|
||||
Basic my.cnf and proper hardware optimizations. Nothing further yet.
|
||||
Basic my.cnf and proper hardware optimizations.
|
||||
|
||||
Faster DB = Faster call routing
|
||||
|
||||
Use LSI Logic MegaRAID controllers in RAID-10 configuration with fast SSD drives with database data on separate partition from the OS and applications.
|
||||
|
||||
|
||||
|
||||
@@ -125,6 +141,18 @@ exten => 8377,n,AGI(agi-VDAD_ALL_outboundBETA.agi,NORMAL-----LB)
|
||||
exten => 8377,n,Hangup()
|
||||
|
||||
|
||||
; BETA VICIDIAL_auto_dialer transfer script Load Balanced:
|
||||
exten => 8387,1,Playback(sip-silence)
|
||||
exten => 8387,n,AGI(agi://127.0.0.1:4577/call_log)
|
||||
exten => 8387,n,Set(LRct=1)
|
||||
exten => 8387,n,While($[${LRct} < 100])
|
||||
exten => 8387,n,AGI(agi-VDAD_ALL_outboundBETA2.agi,NORMAL-----LB)
|
||||
exten => 8387,n,Set(LRct=$[${LRct} + 1])
|
||||
exten => 8387,n,EndWhile()
|
||||
exten => 8387,n,AGI(agi-VDAD_ALL_outboundBETA2.agi,NORMAL-----LB)
|
||||
exten => 8387,n,Hangup()
|
||||
|
||||
|
||||
|
||||
Added vicidial_vdad_log table to store debug and timestamp data(examples below). To enabled this level of logging in the BETA script, you must run the following SQL statement:
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#
|
||||
# CHANGES
|
||||
# 161124-0737 - First build
|
||||
# 161201-0815 - Added more statistics and options
|
||||
#
|
||||
|
||||
$startMS = microtime();
|
||||
@@ -37,11 +38,16 @@ if (isset($_GET["DBX"])) {$DBX=$_GET["DBX"];}
|
||||
elseif (isset($_POST["DBX"])) {$DBX=$_POST["DBX"];}
|
||||
if (isset($_GET["archive"])) {$archive=$_GET["archive"];}
|
||||
elseif (isset($_POST["archive"])) {$archive=$_POST["archive"];}
|
||||
if (isset($_GET["lrerr_statuses"])) {$lrerr_statuses=$_GET["lrerr_statuses"];}
|
||||
elseif (isset($_POST["lrerr_statuses"])) {$lrerr_statuses=$_POST["lrerr_statuses"];}
|
||||
if (isset($_GET["uncounted_statuses"])) {$uncounted_statuses=$_GET["uncounted_statuses"];}
|
||||
elseif (isset($_POST["uncounted_statuses"])) {$uncounted_statuses=$_POST["uncounted_statuses"];}
|
||||
if (isset($_GET["submit"])) {$submit=$_GET["submit"];}
|
||||
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
|
||||
if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
|
||||
elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];}
|
||||
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,enable_languages,language_method FROM system_settings;";
|
||||
@@ -194,8 +200,11 @@ if (strlen($query_date_D) < 6) {$query_date_D = "00:00:00";}
|
||||
if (strlen($query_date_T) < 6) {$query_date_T = "23:59:59";}
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
if (strlen($stage) < 2) {$stage = 'SUMMARY';}
|
||||
if (strlen($lrerr_statuses) < 1) {$lrerr_statuses = 0;}
|
||||
if (strlen($uncounted_statuses) < 1) {$uncounted_statuses = 0;}
|
||||
$vicidial_vdad_log = 'vicidial_vdad_log';
|
||||
if ($archive > 0) {$vicidial_vdad_log = 'vicidial_vdad_log_archive';}
|
||||
$vicidial_log = 'vicidial_log';
|
||||
|
||||
/*
|
||||
$server_ip_string='|';
|
||||
@@ -384,12 +393,26 @@ if ($SUBMIT) {
|
||||
##### BEGIN SUMMARY SECTION #####
|
||||
if ($stage == 'SUMMARY')
|
||||
{
|
||||
$uncounted=0;
|
||||
$server_ct=0;
|
||||
$server_array[0]='';
|
||||
$server_calls[0]=0;
|
||||
$server_LRERR[0]=0;
|
||||
$server_LRERR_total[0]=0;
|
||||
$server_preroute[0]=0;
|
||||
$server_preroute_time[0]=0;
|
||||
$server_LRcount[0]=0;
|
||||
$server_LRcount_total[0]=0;
|
||||
$server_LRpreroute[0]=0;
|
||||
$server_LRpreroute_time[0]=0;
|
||||
$server_nLRpreroute[0]=0;
|
||||
$server_nLRpreroute_time[0]=0;
|
||||
$status_ct=0;
|
||||
$status_array[0]='';
|
||||
$status_calls[0]=0;
|
||||
$ucstatus_ct=0;
|
||||
$ucstatus_array[0]='';
|
||||
$ucstatus_calls[0]=0;
|
||||
$MAIN.="<PRE><font size=2>\n";
|
||||
|
||||
$stmt = "SELECT caller_code,server_ip,count(*) FROM $vicidial_vdad_log where db_time >= '$query_date $query_date_D' and db_time <= '$query_date $query_date_T' group by caller_code,server_ip order by caller_code limit 100000;";
|
||||
@@ -443,9 +466,17 @@ if ($SUBMIT) {
|
||||
}
|
||||
|
||||
$i=0;
|
||||
$m=0;
|
||||
$LRERR=0;
|
||||
$LRERR_total=0;
|
||||
$preroute=0;
|
||||
$preroute_total=0;
|
||||
$LRcount=0;
|
||||
$LRcount_total=0;
|
||||
$LRpreroute=0;
|
||||
$LRpreroute_total=0;
|
||||
$nLRpreroute=0;
|
||||
$nLRpreroute_total=0;
|
||||
while ($cc_ct > $i)
|
||||
{
|
||||
if ($DBX > 0)
|
||||
@@ -456,6 +487,8 @@ if ($SUBMIT) {
|
||||
$last_runtime=0;
|
||||
$preroute_time=0;
|
||||
$found_preroute=0;
|
||||
$this_call_LR=0;
|
||||
$call_counted=0;
|
||||
|
||||
$stmt = "SELECT stage,step,epoch_micro,run_time FROM $vicidial_vdad_log where caller_code='$Acaller_code[$i]' and db_time >= '$query_date $query_date_D' and db_time <= '$query_date $query_date_T' order by epoch_micro;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
@@ -469,24 +502,85 @@ if ($SUBMIT) {
|
||||
$Astep[$j] = $row[1];
|
||||
$Aepoch_micro[$j] = $row[2];
|
||||
$Arun_time[$j] = $row[3];
|
||||
$j++;
|
||||
}
|
||||
$j=0;
|
||||
while ($cd_ct > $j)
|
||||
{
|
||||
if ($j < 1) {$start_epoch=$Aepoch_micro[$j];}
|
||||
$last_epoch=$Aepoch_micro[$j];
|
||||
$last_runtime=$Arun_time[$j];
|
||||
if ($Astage[$j] == 'LocalEXIT-5')
|
||||
{
|
||||
$this_call_LR++;
|
||||
}
|
||||
if ($Astage[$j] == 'LocalEXIT-8')
|
||||
{
|
||||
$call_counted++;
|
||||
$LRERR++;
|
||||
$LRERR_time = ( ($last_epoch - $start_epoch) + $last_runtime);
|
||||
$LRERR_total = ($LRERR_total + $LRERR_time);
|
||||
$k=0;
|
||||
while ($k < $server_ct)
|
||||
{
|
||||
if ($Aserver_ip[$i] == $server_array[$k])
|
||||
{
|
||||
$server_LRERR[$k]++;
|
||||
$server_LRERR_time[$k] = ($server_LRERR_time[$k] + $LRERR_time);
|
||||
}
|
||||
$k++;
|
||||
}
|
||||
|
||||
if ($lrerr_statuses > 0)
|
||||
{
|
||||
$start_epoch = $Aepoch_micro[$j];
|
||||
$start_epochA = explode('.',$start_epoch);
|
||||
$start_epoch = ($start_epochA[0] - 240);
|
||||
$start_date = date("Y-m-d H:i:s",$start_epoch);
|
||||
$CIDlead_id = $Acaller_code[$i];
|
||||
$CIDlead_id = substr($CIDlead_id, 10, 10);
|
||||
$CIDlead_id = ($CIDlead_id + 0);
|
||||
$stmt = "SELECT status,uniqueid FROM $vicidial_log where lead_id='$CIDlead_id' and call_date > \"$start_date\" order by call_date limit 1;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {$MAIN.="$stmt\n";}
|
||||
$status_row_ct = mysqli_num_rows($rslt);
|
||||
if ($status_row_ct > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
|
||||
if ($m==0)
|
||||
{
|
||||
$status_ct++;
|
||||
$status_array[0]=$row[0];
|
||||
$status_calls[0]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$k=0;
|
||||
$status_found=0;
|
||||
while ($k < $status_ct)
|
||||
{
|
||||
if ($row[0] == $status_array[$k])
|
||||
{
|
||||
$status_calls[$k]++;
|
||||
$status_found=1;
|
||||
}
|
||||
$k++;
|
||||
}
|
||||
if ($status_found < 1)
|
||||
{
|
||||
$status_array[$status_ct]=$row[0];
|
||||
$status_calls[$status_ct]++;
|
||||
$status_ct++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$m++;
|
||||
}
|
||||
if ($j < 1) {$start_epoch=$row[2];}
|
||||
$last_epoch=$row[2];
|
||||
$last_runtime=$row[3];
|
||||
if ($Astage[$j] == 'preroute')
|
||||
{
|
||||
$call_counted++;
|
||||
$found_preroute=1;
|
||||
$preroute++;
|
||||
$preroute_time = ( ($last_epoch - $start_epoch) + $last_runtime);
|
||||
@@ -501,11 +595,97 @@ if ($SUBMIT) {
|
||||
}
|
||||
$k++;
|
||||
}
|
||||
if ($this_call_LR > 0)
|
||||
{
|
||||
$LRcount++;
|
||||
$LRcount_total = ($LRcount_total + $this_call_LR);
|
||||
|
||||
$LRpreroute++;
|
||||
$LRpreroute_time = ( ($last_epoch - $start_epoch) + $last_runtime);
|
||||
$LRpreroute_total = ($LRpreroute_total + $LRpreroute_time);
|
||||
|
||||
$k=0;
|
||||
while ($k < $server_ct)
|
||||
{
|
||||
if ($Aserver_ip[$i] == $server_array[$k])
|
||||
{
|
||||
$server_LRpreroute[$k]++;
|
||||
$server_LRpreroute_time[$k] = ($server_LRpreroute_time[$k] + $LRpreroute_time);
|
||||
}
|
||||
$k++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$nLRpreroute++;
|
||||
$nLRpreroute_time = ( ($last_epoch - $start_epoch) + $last_runtime);
|
||||
$nLRpreroute_total = ($nLRpreroute_total + $nLRpreroute_time);
|
||||
|
||||
$k=0;
|
||||
while ($k < $server_ct)
|
||||
{
|
||||
if ($Aserver_ip[$i] == $server_array[$k])
|
||||
{
|
||||
$server_nLRpreroute[$k]++;
|
||||
$server_nLRpreroute_time[$k] = ($server_nLRpreroute_time[$k] + $nLRpreroute_time);
|
||||
}
|
||||
$k++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($DBX > 0)
|
||||
{$MAIN.= " $j $Aepoch_micro[$j] $Arun_time[$j] $Astep[$j] $Astage[$j]\n";}
|
||||
$j++;
|
||||
}
|
||||
if ($call_counted < 1)
|
||||
{
|
||||
$uncounted++;
|
||||
if ($uncounted_statuses > 0)
|
||||
{
|
||||
$start_epoch = $Aepoch_micro[$j];
|
||||
$start_epochA = explode('.',$start_epoch);
|
||||
$start_epoch = ($start_epochA[0] - 240);
|
||||
$start_date = date("Y-m-d H:i:s",$start_epoch);
|
||||
$CIDlead_id = $Acaller_code[$i];
|
||||
$CIDlead_id = substr($CIDlead_id, 10, 10);
|
||||
$CIDlead_id = ($CIDlead_id + 0);
|
||||
$stmt = "SELECT status,uniqueid FROM $vicidial_log where lead_id='$CIDlead_id' and call_date > \"$start_date\" order by call_date limit 1;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {$MAIN.="$stmt\n";}
|
||||
$ucstatus_row_ct = mysqli_num_rows($rslt);
|
||||
if ($ucstatus_row_ct > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
|
||||
if ($m==0)
|
||||
{
|
||||
$ucstatus_ct++;
|
||||
$ucstatus_array[0]=$row[0];
|
||||
$ucstatus_calls[0]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$k=0;
|
||||
$ucstatus_found=0;
|
||||
while ($k < $ucstatus_ct)
|
||||
{
|
||||
if ($row[0] == $ucstatus_array[$k])
|
||||
{
|
||||
$ucstatus_calls[$k]++;
|
||||
$ucstatus_found=1;
|
||||
}
|
||||
$k++;
|
||||
}
|
||||
if ($ucstatus_found < 1)
|
||||
{
|
||||
$ucstatus_array[$ucstatus_ct]=$row[0];
|
||||
$ucstatus_calls[$ucstatus_ct]++;
|
||||
$ucstatus_ct++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$processing_time = ($last_epoch - $start_epoch);
|
||||
$routing_time = ($processing_time + $last_runtime);
|
||||
if ($DBX > 0)
|
||||
@@ -516,14 +696,48 @@ if ($SUBMIT) {
|
||||
|
||||
$LRERR_pct=( ($LRERR / $i) * 100);
|
||||
$LRERR_pct = sprintf("%01.2f", $LRERR_pct);
|
||||
$LRERR_avg = ($LRERR_total / $LRERR);
|
||||
$LRERR_avg = sprintf("%01.6f", $LRERR_avg);
|
||||
|
||||
$preroute_avg = ($preroute_total / $preroute);
|
||||
$preroute_avg = sprintf("%01.6f", $preroute_avg);
|
||||
$LRpreroute_avg = ($LRpreroute_total / $LRpreroute);
|
||||
$LRpreroute_avg = sprintf("%01.6f", $LRpreroute_avg);
|
||||
$nLRpreroute_avg = ($nLRpreroute_total / $nLRpreroute);
|
||||
$nLRpreroute_avg = sprintf("%01.6f", $nLRpreroute_avg);
|
||||
|
||||
$MAIN.= "\nFINISHED - \n";
|
||||
$MAIN.= "TOTAL ANSWERED CALLS: $i\n";
|
||||
$MAIN.= "LRERR: $LRERR ($LRERR_pct%)\n";
|
||||
$MAIN.= "LRERR: $LRERR ($LRERR_pct%) average $LRERR_avg sec\n";
|
||||
$MAIN.= "preroute: $preroute (average $preroute_avg sec)\n";
|
||||
$MAIN.= "LRpreroute: $LRpreroute (average $LRpreroute_avg sec)\n";
|
||||
$MAIN.= "nLRpreroute: $nLRpreroute (average $nLRpreroute_avg sec)\n";
|
||||
$MAIN.= "uncounted: $uncounted\n";
|
||||
|
||||
if ($uncounted_statuses > 0)
|
||||
{
|
||||
$MAIN.= "UNCOUNTED STATUS SUMMARY - \n";
|
||||
$k=0;
|
||||
while ($k < $ucstatus_ct)
|
||||
{
|
||||
$ucstatus_array[$k] = sprintf("%6s", $ucstatus_array[$k]);
|
||||
$ucstatus_calls[$k] = sprintf("%6s", $ucstatus_calls[$k]);
|
||||
$MAIN.= " $ucstatus_array[$k]: $ucstatus_calls[$k]\n";
|
||||
$k++;
|
||||
}
|
||||
}
|
||||
if ($lrerr_statuses > 0)
|
||||
{
|
||||
$MAIN.= "LRERR STATUS SUMMARY - \n";
|
||||
$k=0;
|
||||
while ($k < $status_ct)
|
||||
{
|
||||
$status_array[$k] = sprintf("%6s", $status_array[$k]);
|
||||
$status_calls[$k] = sprintf("%6s", $status_calls[$k]);
|
||||
$MAIN.= " $status_array[$k]: $status_calls[$k]\n";
|
||||
$k++;
|
||||
}
|
||||
}
|
||||
$MAIN.= "SERVER SUMMARY - \n";
|
||||
|
||||
$k=0;
|
||||
@@ -544,14 +758,22 @@ if ($SUBMIT) {
|
||||
|
||||
$LRERR_pct=( ($server_LRERR[$k] / $server_calls[$k]) * 100);
|
||||
$LRERR_pct = sprintf("%01.2f", $LRERR_pct);
|
||||
$LRERR_avg = ($server_LRERR_time[$k] / $server_LRERR[$k]);
|
||||
$LRERR_avg = sprintf("%01.6f", $LRERR_avg);
|
||||
|
||||
$preroute_avg = ($server_preroute_time[$k] / $server_preroute[$k]);
|
||||
$preroute_avg = sprintf("%01.6f", $preroute_avg);
|
||||
$LRpreroute_avg = ($server_LRpreroute_time[$k] / $server_LRpreroute[$k]);
|
||||
$LRpreroute_avg = sprintf("%01.6f", $LRpreroute_avg);
|
||||
$nLRpreroute_avg = ($server_nLRpreroute_time[$k] / $server_nLRpreroute[$k]);
|
||||
$nLRpreroute_avg = sprintf("%01.6f", $nLRpreroute_avg);
|
||||
|
||||
$MAIN.= " $server_array[$k] - $server_description - $asterisk_version\n";
|
||||
$MAIN.= " TOTAL: $server_calls[$k]\n";
|
||||
$MAIN.= " LRERR: $server_LRERR[$k] ($LRERR_pct%)\n";
|
||||
$MAIN.= " preroute: $server_preroute[$k] (average $preroute_avg sec)\n";
|
||||
$MAIN.= " TOTAL: $server_calls[$k]\n";
|
||||
$MAIN.= " LRERR: $server_LRERR[$k] ($LRERR_pct%) average $LRERR_avg sec\n";
|
||||
$MAIN.= " preroute: $server_preroute[$k] (average $preroute_avg sec)\n";
|
||||
$MAIN.= " LRpreroute: $server_LRpreroute[$k] (average $LRpreroute_avg sec)\n";
|
||||
$MAIN.= " nLRpreroute: $server_nLRpreroute[$k] (average $nLRpreroute_avg sec)\n";
|
||||
$k++;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user