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;}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user