Replaced all SELECT * MySQL queries with proper field lists. this altered scripts in bin/agi/agc/vicidial

git-svn-id: svn://192.168.202.10@1268 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2009-11-30 04:25:17 +00:00
parent 8b0546a421
commit 86202b04cf
27 changed files with 565 additions and 543 deletions
+3
View File
@@ -296,6 +296,9 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom
'EXAMPLEcustom_report_links.html' file included in that directory that
can just be copied and customized for your needs.
72. Replaced all "SELECT *" MySQL queries with proper field lists. This makes
database table field order less important, allowing for more
customizations by the user without causing problems.
+38 -36
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# agi-LCR-Route.agi version 2.0.5
# agi-LCR-Route.agi version 2.2.0
#
# This script looks up the NPANXX in the lcr table and sets
# the LCRTRUNK dialplan variable to the carrier string
@@ -29,7 +29,7 @@
#
# A typical npanxx from this table should look like:
#
# mysql> select * from lcr where npanxx='734223';
# mysql> select npanxx,rate,carrier_string from lcr where npanxx='734223';
# +--------+--------+----------------+
# | npanxx | rate | carrier_string |
# +--------+--------+----------------+
@@ -47,23 +47,24 @@
#
# changes:
# 90717-1554 - First Build
# 91129-2209 - formatting fixes
#
sub agi_output
{
if ($AGILOG >=2)
{
### open the log file for writing ###
open(Lout, ">>$AGILOGfile")
|| die "Can't open $AGILOGfile: $!\n";
print Lout "$now_date|$script|$agi_string\n";
close(Lout);
}
### send to STDERR writing ###
if ( ($AGILOG == '1') || ($AGILOG == '3') )
{print STDERR "$now_date|$script|$agi_string\n";}
$agi_string='';
}
{
if ($AGILOG >=2)
{
### open the log file for writing ###
open(Lout, ">>$AGILOGfile")
|| die "Can't open $AGILOGfile: $!\n";
print Lout "$now_date|$script|$agi_string\n";
close(Lout);
}
### send to STDERR writing ###
if ( ($AGILOG == '1') || ($AGILOG == '3') )
{print STDERR "$now_date|$script|$agi_string\n";}
$agi_string='';
}
$script = 'agi-LCR-Route.agi';
$AGILOG = '0';
@@ -131,44 +132,43 @@ $stmtA = "SELECT agi_output FROM servers where server_ip = '$VARserver_ip';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_count=0;
while ($sthArows > $rec_count)
{
@aryA = $sthA->fetchrow_array;
$DBagi_output = "$aryA[0]";
if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';}
if ($DBagi_output =~ /FILE/) {$AGILOG = '2';}
if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';}
$rec_count++;
}
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$DBagi_output = "$aryA[0]";
if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';}
if ($DBagi_output =~ /FILE/) {$AGILOG = '2';}
if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';}
}
$sthA->finish();
### begin parsing run-time options ###
if (length($ARGV[0])>1)
{
{
if ($AGILOG) {$agi_string = "Perl Environment Dump:"; &agi_output;}
$i=0;
while ($#ARGV >= $i)
{
$args = "$args $ARGV[$i]";
if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;}
$i++;
}
{
$args = "$args $ARGV[$i]";
if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;}
$i++;
}
### list of command-line array arguments:
@ARGV_vars = split(/-----/, $ARGV[0]);
$npanxx = $ARGV_vars[0];
if ($AGILOG) {$agi_string = "Searching for NPANXX = $npanxx"; &agi_output;}
}
}
# get the cheapest carrier
$stmtA = "SELECT carrier_string, rate FROM lcr WHERE npanxx='$npanxx' ORDER BY rate ASC";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ( $sthArows > 0 ) {
if ( $sthArows > 0 )
{
$rec_count=0;
@aryA = $sthA->fetchrow_array;
$carrier_string = "$aryA[0]";
@@ -177,6 +177,8 @@ if ( $sthArows > 0 ) {
if ($AGILOG) {$agi_string = "Setting LCRTRUNK to $carrier_string"; &agi_output;}
$AGI->set_variable( "LCRTRUNK",$carrier_string );
} else {
}
else
{
if ($AGILOG) {$agi_string = "No carrier found for NPANXX = $npanxx. Leaving the LCRTRUNK variable as the default."; &agi_output;}
}
}
+174 -175
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
# ADMIN_adjust_GMTnow_on_leads.pl verison 2.0.5
# ADMIN_adjust_GMTnow_on_leads.pl verison 2.2.0
#
# program goes throught the vicidial_list table and adjusts the gmt_offset_now
# field to change it to today's offset if needed because of Daylight Saving Time
@@ -24,6 +24,7 @@
# Added LSS-FSA for New Zealand (not active)
# 90129-1114 - Added NANPA prefix lookup option
# 90401-1327 - Fixed quiet flag function
# 91129-2155 - Replaced SELECT STAR queries with field lists, formatting fixes
#
$MT[0]='';
@@ -31,75 +32,74 @@ $q=0;
### begin parsing run-time options ###
if (length($ARGV[0])>1)
{
{
$i=0;
while ($#ARGV >= $i)
{
$args = "$args $ARGV[$i]";
$i++;
}
{
$args = "$args $ARGV[$i]";
$i++;
}
if ($args =~ /--help/i)
{
print "allowed run time options:\n";
print " [-q] = quiet\n";
print " [-t] = test\n";
print " [--debug] = debugging messages\n";
print " [--debugX] = Super debugging messages\n";
print " [--postal-code-gmt] = Attempt postal codes lookup for timezones\n";
print " [--nanpa-prefix-gmt] = Attempt nanpa prefix lookup for timezones\n";
print " [--singlelistid=XXX] = Only lookup and alter leads in one list_id\n";
print "\n";
{
print "allowed run time options:\n";
print " [-q] = quiet\n";
print " [-t] = test\n";
print " [--debug] = debugging messages\n";
print " [--debugX] = Super debugging messages\n";
print " [--postal-code-gmt] = Attempt postal codes lookup for timezones\n";
print " [--nanpa-prefix-gmt] = Attempt nanpa prefix lookup for timezones\n";
print " [--singlelistid=XXX] = Only lookup and alter leads in one list_id\n";
print "\n";
exit;
}
exit;
}
else
{
{
if ($args =~ /-q/i)
{
$q=1;
}
{
$q=1;
}
if ($args =~ /-t|--test/i)
{
$T=1; $TEST=1;
if ($q < 1) {print "\n-----TESTING -----\n\n";}
}
{
$T=1; $TEST=1;
if ($q < 1) {print "\n-----TESTING -----\n\n";}
}
if ($args =~ /--debug/i)
{
$DB=1;
print "\n-----DEBUGGING -----\n\n";
}
{
$DB=1;
print "\n-----DEBUGGING -----\n\n";
}
if ($args =~ /--debugX/i)
{
$DBX=1;
print "\n----- SUPER-DUPER DEBUGGING -----\n\n";
}
{
$DBX=1;
print "\n----- SUPER-DUPER DEBUGGING -----\n\n";
}
if ($args =~ /--postal-code-gmt/i)
{
$searchPOST=1;
if ($q < 1) {print "\n----- DO POSTAL CODE LOOKUP -----\n\n";}
}
{
$searchPOST=1;
if ($q < 1) {print "\n----- DO POSTAL CODE LOOKUP -----\n\n";}
}
if ($args =~ /--nanpa-prefix-gmt/i)
{
$searchNANPA=1;
if ($q < 1) {print "\n----- DO NANPA PREFIX LOOKUP -----\n\n";}
}
{
$searchNANPA=1;
if ($q < 1) {print "\n----- DO NANPA PREFIX LOOKUP -----\n\n";}
}
if ($args =~ /-singlelistid=/i)
{
@data_in = split(/-singlelistid=/,$args);
$singlelistid = $data_in[1];
if ($q < 1) {print "\n----- SINGLE LISTID OVERRIDE: $singlelistid -----\n\n";}
}
{
@data_in = split(/-singlelistid=/,$args);
$singlelistid = $data_in[1];
if ($q < 1) {print "\n----- SINGLE LISTID OVERRIDE: $singlelistid -----\n\n";}
}
else
{$singlelistid = '';}
}
}
}
else
{
print "no command line options set\n";
}
{
print "no command line options set\n";
}
if ($DB) {print "STARTING TIME ZONE DAYLIGHT SAVING TIME CALCULATION SCRIPT\n\n\n\n";}
@@ -152,15 +152,15 @@ $secX = time();
# $secX = '1079989363'; # epoch for March 22, 2993
# $secX = '1097989363'; # epoch for October 17, 2004
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secX);
$mon++;
$year = ($year + 1900);
if ($mon < 10) {$mon = "0$mon";}
if ($mday < 10) {$mday = "0$mday";}
if ($hour < 10) {$hour = "0$hour";}
if ($min < 10) {$min = "0$min";}
if ($sec < 10) {$sec = "0$sec";}
$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec );
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secX);
$mon++;
$year = ($year + 1900);
if ($mon < 10) {$mon = "0$mon";}
if ($mday < 10) {$mday = "0$mday";}
if ($hour < 10) {$hour = "0$hour";}
if ($min < 10) {$min = "0$min";}
if ($sec < 10) {$sec = "0$sec";}
$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec );
use DBI;
@@ -216,87 +216,86 @@ if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_countY=0;
@phone_codes=@MT;
$phone_codes_list='|';
$rec_countY=0;
@phone_codes=@MT;
$phone_codes_list='|';
while ($sthArows > $rec_countY)
{
@aryA = $sthA->fetchrow_array;
@aryA = $sthA->fetchrow_array;
$phone_codes[$rec_countY] = $aryA[0];
$phone_codes_ORIG[$rec_countY] = $aryA[0];
$phone_codes[$rec_countY] =~ s/011|0011| |\t|\r|\n//gi;
$phone_codes[$rec_countY] = $aryA[0];
$phone_codes_ORIG[$rec_countY] = $aryA[0];
$phone_codes[$rec_countY] =~ s/011|0011| |\t|\r|\n//gi;
# if ( ($phone_codes_list !~ /\|$phone_codes[$rec_countY]\|/) && (length($phone_codes[$rec_countY]) > 0) )
# {
# $phone_codes_list .= "$phone_codes[$rec_countY]|";
# }
if ($DBX) {print "|",$aryA[0],"|","\n";}
$rec_countY++;
if ($DBX) {print "|",$aryA[0],"|","\n";}
$rec_countY++;
}
$sthA->finish();
if ($DB) {print " - Unique Country dial codes found: $rec_countY\n";}
$sthA->finish();
if ($DB) {print " - Unique Country dial codes found: $rec_countY\n";}
##### Put all country/area code records into an array for speed
$stmtA = "select * from vicidial_phone_codes;";
##### Put all country/area code records into an array for speed
$stmtA = "select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes;";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_countZ=0;
@codefile=@MT;
while ($sthArows > $rec_countZ)
{
@aryA = $sthA->fetchrow_array;
$codefile[$rec_countZ] = "$aryA[0]\t$aryA[1]\t$aryA[2]\t$aryA[3]\t$aryA[4]\t$aryA[5]\t$aryA[6]\t$aryA[7]\n";
$rec_countZ++;
}
if ($searchPOST > 0)
{
##### Put all postal code records into an array for speed
$stmtA = "select postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes;";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_countZ=0;
@codefile=@MT;
while ($sthArows > $rec_countZ)
$sthArows=$sthA->rows;
$rec_countT=0;
@postalfile=@MT;
while ($sthArows > $rec_countT)
{
@aryA = $sthA->fetchrow_array;
$codefile[$rec_countZ] = "$aryA[0]\t$aryA[1]\t$aryA[2]\t$aryA[3]\t$aryA[4]\t$aryA[5]\t$aryA[6]\t$aryA[7]\n";
$rec_countZ++;
$postalfile[$rec_countT] = "$aryA[0]\t$aryA[1]\t$aryA[2]\t$aryA[3]\t$aryA[4]\t$aryA[5]\t$aryA[6]";
$rec_countT++;
}
$sthA->finish();
if ($DB) {print " - GMT postal codes records: $rec_countT\n";}
}
if ($searchPOST > 0)
if ($searchNANPA > 0)
{
##### Put all nanpa prefix records into an array for speed
$stmtA = "select areacode,prefix,GMT_offset,DST from vicidial_nanpa_prefix_codes;";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_countN=0;
@nanpafile=@MT;
while ($sthArows > $rec_countN)
{
##### Put all postal code records into an array for speed
$stmtA = "select * from vicidial_postal_codes;";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_countT=0;
@postalfile=@MT;
while ($sthArows > $rec_countT)
{
@aryA = $sthA->fetchrow_array;
$postalfile[$rec_countT] = "$aryA[0]\t$aryA[1]\t$aryA[2]\t$aryA[3]\t$aryA[4]\t$aryA[5]\t$aryA[6]";
$rec_countT++;
}
$sthA->finish();
if ($DB) {print " - GMT postal codes records: $rec_countT\n";}
}
if ($searchNANPA > 0)
{
##### Put all nanpa prefix records into an array for speed
$stmtA = "select areacode,prefix,GMT_offset,DST from vicidial_nanpa_prefix_codes;";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_countN=0;
@nanpafile=@MT;
while ($sthArows > $rec_countN)
{
if ($aryA[3] =~ /Y/) {$DST_method = 'SSM-FSN';}
else {$DST_method = '';}
@aryA = $sthA->fetchrow_array;
$nanpafile[$rec_countN] = "$aryA[0]\t$aryA[1]\t$aryA[2]\t$DST_method";
$rec_countN++;
}
$sthA->finish();
if ($DB) {print " - NANPA prefix records: $rec_countN\n";}
if ($aryA[3] =~ /Y/) {$DST_method = 'SSM-FSN';}
else {$DST_method = '';}
@aryA = $sthA->fetchrow_array;
$nanpafile[$rec_countN] = "$aryA[0]\t$aryA[1]\t$aryA[2]\t$DST_method";
$rec_countN++;
}
$sthA->finish();
if ($DB) {print " - NANPA prefix records: $rec_countN\n";}
}
$ep=0; $ei=0; $ee=0;
$d=0;
@@ -319,34 +318,34 @@ foreach (@phone_codes)
chomp($codefile[$e]);
if ($codefile[$e] =~ /^$match_code\t/)
{
@m = split(/\t/, $codefile[$e]);
$area_code = $m[2];
$area_state = $m[3];
$area_GMT = $m[4]; $area_GMT =~ s/\+//gi; $area_GMT = ($area_GMT + 0);
$area_GMT_method = $m[6];
if ($area_code =~ /S/) # look for state override flag in areacode field
{
$area_code =~ s/\D//gi;
$AC_match = " and phone_number LIKE \"$area_code%\" and state='$area_state'";
if ($DB) {print " AREA CODE STATE OVERRIDE: $codefile[$e]\n";}
}
else
{
if ($area_code =~ /\*/) {$AC_match = '';}
else {$AC_match = " and phone_number LIKE \"$area_code%\"";}
}
if ($DBX) {print "PROCESSING THIS LINE: $codefile[$e]\n";}
$stmtA = "select count(*) from vicidial_list where phone_code='$match_code_ORIG' $AC_match $XlistSQL;";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_countZ=0;
@aryA = $sthA->fetchrow_array;
$rec_countZ = $aryA[0];
$sthA->finish();
@m = split(/\t/, $codefile[$e]);
$area_code = $m[2];
$area_state = $m[3];
$area_GMT = $m[4]; $area_GMT =~ s/\+//gi; $area_GMT = ($area_GMT + 0);
$area_GMT_method = $m[6];
if ($area_code =~ /S/) # look for state override flag in areacode field
{
$area_code =~ s/\D//gi;
$AC_match = " and phone_number LIKE \"$area_code%\" and state='$area_state'";
if ($DB) {print " AREA CODE STATE OVERRIDE: $codefile[$e]\n";}
}
else
{
if ($area_code =~ /\*/) {$AC_match = '';}
else {$AC_match = " and phone_number LIKE \"$area_code%\"";}
}
if ($DBX) {print "PROCESSING THIS LINE: $codefile[$e]\n";}
$stmtA = "select count(*) from vicidial_list where phone_code='$match_code_ORIG' $AC_match $XlistSQL;";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_countZ=0;
@aryA = $sthA->fetchrow_array;
$rec_countZ = $aryA[0];
$sthA->finish();
if (!$rec_countZ)
{
@@ -355,8 +354,8 @@ foreach (@phone_codes)
}
else
{
$AC_GMT_diff = ($area_GMT - $LOCAL_GMT_OFF_STD);
$AC_localtime = ($secX + (3600 * $AC_GMT_diff));
$AC_GMT_diff = ($area_GMT - $LOCAL_GMT_OFF_STD);
$AC_localtime = ($secX + (3600 * $AC_GMT_diff));
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime);
$year = ($year + 1900);
$mon++;
@@ -452,13 +451,13 @@ foreach (@phone_codes)
if ($AC_processed)
{
$stmtA = "select count(*) from vicidial_list where phone_code='$match_code_ORIG' $AC_match and (gmt_offset_now != '$area_GMT' or gmt_offset_now IS NULL) $XlistSQL;";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_countW=0;
@aryA = $sthA->fetchrow_array;
$rec_countW = $aryA[0];
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_countW=0;
@aryA = $sthA->fetchrow_array;
$rec_countW = $aryA[0];
$sthA->finish();
if (!$rec_countW)
@@ -537,8 +536,8 @@ foreach (@phone_codes)
}
else
{
$AC_GMT_diff = ($area_GMT - $LOCAL_GMT_OFF_STD);
$AC_localtime = ($secX + (3600 * $AC_GMT_diff));
$AC_GMT_diff = ($area_GMT - $LOCAL_GMT_OFF_STD);
$AC_localtime = ($secX + (3600 * $AC_GMT_diff));
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime);
$year = ($year + 1900);
$mon++;
@@ -634,13 +633,13 @@ foreach (@phone_codes)
if ($AC_processed)
{
$stmtA = "select count(*) from vicidial_list where phone_code='$match_code_ORIG' $AC_match and (gmt_offset_now != '$area_GMT' or gmt_offset_now IS NULL) $XlistSQL;";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_countW=0;
@aryA = $sthA->fetchrow_array;
$rec_countW = $aryA[0];
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_countW=0;
@aryA = $sthA->fetchrow_array;
$rec_countW = $aryA[0];
$sthA->finish();
if (!$rec_countW)
@@ -719,8 +718,8 @@ foreach (@phone_codes)
}
else
{
$AC_GMT_diff = ($area_GMT - $LOCAL_GMT_OFF_STD);
$AC_localtime = ($secX + (3600 * $AC_GMT_diff));
$AC_GMT_diff = ($area_GMT - $LOCAL_GMT_OFF_STD);
$AC_localtime = ($secX + (3600 * $AC_GMT_diff));
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime);
$year = ($year + 1900);
$mon++;
@@ -816,13 +815,13 @@ foreach (@phone_codes)
if ($AC_processed)
{
$stmtA = "select count(*) from vicidial_list where phone_code='$match_code_ORIG' $AC_match and (gmt_offset_now != '$area_GMT' or gmt_offset_now IS NULL) $XlistSQL;";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_countW=0;
@aryA = $sthA->fetchrow_array;
$rec_countW = $aryA[0];
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_countW=0;
@aryA = $sthA->fetchrow_array;
$rec_countW = $aryA[0];
$sthA->finish();
if (!$rec_countW)
+1 -1
View File
@@ -356,7 +356,7 @@ while ($master_loop<$CLIloops)
if ($CLIcampaign)
{
$stmtA = "SELECT * 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,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,UNIX_TIMESTAMP(campaign_changedate),campaign_stats_refresh,campaign_allow_inbound,drop_rate_group from vicidial_campaigns where campaign_id='$CLIcampaign'";
}
else
{
+1 -1
View File
@@ -1844,7 +1844,7 @@ while($one_day_interval > 0)
### For debugging purposes, try to grab Jammed calls and log them to jam logfile
if ($useJAMdebugFILE)
{
$stmtA = "SELECT * FROM vicidial_auto_calls where server_ip='$server_ip' and last_update_time < '$BDtsSQLdate' and status IN('LIVE')";
$stmtA = "SELECT auto_call_id,server_ip,campaign_id,status,lead_id,uniqueid,callerid,channel,phone_code,phone_number,call_time,call_type,stage,last_update_time,alt_dial,queue_priority,agent_only,agent_grab FROM vicidial_auto_calls where server_ip='$server_ip' and last_update_time < '$BDtsSQLdate' and status IN('LIVE')";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
+65 -65
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# AST_agent_logout.pl version 2.0.5 *DBI-version*
# AST_agent_logout.pl version 2.2.0
#
# DESCRIPTION:
# forces logout of agents in a specified campaign or all campaigns
@@ -25,6 +25,7 @@
#
# CHANGELOG
# 80112-0330 - First Build
# 91129-2138 - Replace SELECT STAR in SQL statement, fixed other formatting
#
# constants
@@ -49,51 +50,51 @@ $inactive_epoch = ($secT - 60);
### begin parsing run-time options ###
if (length($ARGV[0])>1)
{
{
$i=0;
while ($#ARGV >= $i)
{
$args = "$args $ARGV[$i]";
$i++;
}
{
$args = "$args $ARGV[$i]";
$i++;
}
if ($args =~ /--help/i)
{
print "allowed run time options(must stay in this order):\n [--debug] = debug\n [--debugX] = super debug\n [-t] = test\n [--campaign=XXX] = run for campaign XXX only\n\n";
exit;
}
else
{
if ($args =~ /--campaign=/i)
{
# print "\n|$ARGS|\n\n";
@data_in = split(/--campaign=/,$args);
$CLIcampaign = $data_in[1];
$CLIcampaign =~ s/ .*$//gi;
print "allowed run time options(must stay in this order):\n [--debug] = debug\n [--debugX] = super debug\n [-t] = test\n [--campaign=XXX] = run for campaign XXX only\n\n";
exit;
}
else
{
if ($args =~ /--campaign=/i)
{
# print "\n|$ARGS|\n\n";
@data_in = split(/--campaign=/,$args);
$CLIcampaign = $data_in[1];
$CLIcampaign =~ s/ .*$//gi;
}
else
{$CLIcampaign = '';}
if ($args =~ /--debug/i)
{
$DB=1;
print "\n----- DEBUG -----\n\n";
}
{
$DB=1;
print "\n----- DEBUG -----\n\n";
}
if ($args =~ /--debugX/i)
{
$DBX=1;
print "\n----- SUPER DEBUG -----\n\n";
}
{
$DBX=1;
print "\n----- SUPER DEBUG -----\n\n";
}
if ($args =~ /-t/i)
{
$T=1; $TEST=1;
print "\n-----TESTING -----\n\n";
{
$T=1; $TEST=1;
print "\n-----TESTING -----\n\n";
}
}
}
}
else
{
print "no command line options set\n";
}
{
print "no command line options set\n";
}
# default path to astguiclient configuration file:
$PATHconf = '/etc/astguiclient.conf';
@@ -143,22 +144,22 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
### Grab Server values from the database
$stmtA = "SELECT vd_server_logs,local_gmt FROM servers where server_ip = '$VARserver_ip';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_count=0;
while ($sthArows > $rec_count)
{
@aryA = $sthA->fetchrow_array;
$DBvd_server_logs = "$aryA[0]";
$DBSERVER_GMT = "$aryA[1]";
if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';}
else {$SYSLOG = '0';}
if (length($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;}
$rec_count++;
}
$sthA->finish();
$stmtA = "SELECT vd_server_logs,local_gmt FROM servers where server_ip = '$VARserver_ip';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_count=0;
while ($sthArows > $rec_count)
{
@aryA = $sthA->fetchrow_array;
$DBvd_server_logs = "$aryA[0]";
$DBSERVER_GMT = "$aryA[1]";
if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';}
else {$SYSLOG = '0';}
if (length($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;}
$rec_count++;
}
$sthA->finish();
@@ -202,11 +203,10 @@ if ($DB) {print "AGENTS TO LOGOUT: $rec_count\n";}
$i=0;
foreach(@user)
{
### attempt to gracefully update the timers in the logs before logging out the agent
if ($last_update_time[$i] > $inactive_epoch)
{
$stmtA = "SELECT * from vicidial_agent_log where user='$user[$i]' and campaign_id='$campaign_id[$i]' order by agent_log_id desc LIMIT 1;";
$stmtA = "SELECT agent_log_id,user,server_ip,event_time,lead_id,campaign_id,pause_epoch,pause_sec,wait_epoch,wait_sec,talk_epoch,talk_sec,dispo_epoch,dispo_sec,status,user_group,comments,sub_status,dead_epoch,dead_sec from vicidial_agent_log where user='$user[$i]' and campaign_id='$campaign_id[$i]' order by agent_log_id desc LIMIT 1;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -291,28 +291,28 @@ foreach(@user)
$dbhA->disconnect();
if($DB)
{
### calculate time to run script ###
$secY = time();
$secZ = ($secY - $secT);
{
### calculate time to run script ###
$secY = time();
$secZ = ($secY - $secT);
if (!$q) {print "DONE. Script execution time in seconds: $secZ\n";}
}
if (!$q) {print "DONE. Script execution time in seconds: $secZ\n";}
}
exit;
sub event_logger
{
if ($SYSLOG)
{
### open the log file for writing ###
open(Lout, ">>$VDALOGfile")
|| die "Can't open $VDALOGfile: $!\n";
print Lout "$now_date|$event_string|\n";
close(Lout);
if ($SYSLOG)
{
### open the log file for writing ###
open(Lout, ">>$VDALOGfile")
|| die "Can't open $VDALOGfile: $!\n";
print Lout "$now_date|$event_string|\n";
close(Lout);
}
$event_string='';
}
$event_string='';
}
+84 -52
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# AST_manager_send.pl version 2.0.5
# AST_manager_send.pl version 2.2.0
#
# Part of the Asterisk Central Queue System (ACQS)
#
@@ -16,7 +16,7 @@
# scalability over just using a single process. Also, this means that a single
# action execution lock cannot bring the entire system down.
#
# Copyright (C) 2008 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
# 50823-1514 - Added commandline debug options with debug printouts
@@ -28,6 +28,7 @@
# 60817-1211 - added more ARGS to go to child process to remove DBI from child
# 61221-1926 - optimize and clean code, lc
# 80418-0901 - reduced time between Actions being sent, raised endless loop timer
# 91129-2146 - removed SELECT STAR and formatting fixes
#
$|++;
@@ -44,7 +45,8 @@ my $COUNTER_OUTPUT=1; # set to 1 to display the counter as the script runs
my ($CLOhelp, $sendonlyone, $TEST, $DB, $DBX, $SYSLOG);
### begin parsing run-time options ###
if (scalar @ARGV) {
if (scalar @ARGV)
{
GetOptions('help!' => \$CLOhelp,
'sendonlyone!' => \$sendonlyone,
'counteroutput!' => \$COUNTER_OUTPUT,
@@ -52,14 +54,16 @@ if (scalar @ARGV) {
'debug!' => \$DB,
'debugX!' => \$DBX );
$DB = 1 if ($DBX);
if ($DB) {
if ($DB)
{
print "----- DEBUGGING -----\n";
print "----- EXTRA-VERBOSE DEBUGGING -----\n" if ($DBX);
print "COUNTER_OUTPUT: $COUNTER_OUTPUT\n";
print "sendonlyone: $sendonlyone\n" if ($sendonlyone);
print "TEST: $TEST\n" if ($TEST);
}
if ($CLOhelp) {
}
if ($CLOhelp)
{
print "\nAST_manager_send.pl\n";
print "allowed run time options:\n";
print " [--help] = This help screen.\n";
@@ -69,22 +73,25 @@ if (scalar @ARGV) {
print " [--debug] or [-v] = Verbose debug messages\n";
print " [--debugX] or [-vv] = Extra-verbose debug messages\n\n";
exit 0;
}
}
}
### end parsing run-time options ###
# Begin Parsing astguiclient config file.
open(CONF, $conf{PATHconf}) || die "can't open " . $conf{PATHconf} . ": " . $! . "\n";
while (my $line = <CONF>) {
while (my $line = <CONF>)
{
$line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi;
foreach my $key (qw( PATHhome PATHlogs PATHagi PATHweb PATHsounds PATHmontior
VARserver_ip VARDB_server VARDB_database VARDB_user VARDB_pass VARDB_port)) {
if ($line =~ /^$key/) {
VARserver_ip VARDB_server VARDB_database VARDB_user VARDB_pass VARDB_port))
{
if ($line =~ /^$key/)
{
$conf{$key} = $line;
$conf{$key} =~ s/.*=//gi;
}
}
}
}
$conf{VARDB_port} = '3306' unless ($conf{VARDB_port});
# Connect to DB
@@ -99,11 +106,13 @@ eventLogger($conf{PATHlogs}, 'process', $event_string);
my $one_day_interval = 182; # 2 day loops for 12 months
while ($one_day_interval > 0) {
while ($one_day_interval > 0)
{
my $endless_loop = 1728000; # 2 days at .10 seconds per loop
my $affected_rows;
my $NEW_actions;
while ($endless_loop > 0) {
while ($endless_loop > 0)
{
my $stmtA = "SELECT count(*) from vicidial_manager where server_ip = '" . $conf{VARserver_ip} . "' and status = 'NEW'";
my $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -111,23 +120,27 @@ while ($one_day_interval > 0) {
print STDERR $NEW_actions . " NEW Actions to send on server " . $conf{VARserver_ip} . " $endless_loop\n" if ($DB);
$sthA->finish();
if ($NEW_actions) {
if ($NEW_actions)
{
my $stmtA = "UPDATE vicidial_manager set status='QUEUE' where server_ip = '" . $conf{VARserver_ip} . "' and status = 'NEW' order by entry_date limit 1";
$affected_rows = $dbhA->do($stmtA);
print STDERR "rows updated to QUEUE: |$affected_rows|\n" if ($DB);
} else {
}
else
{
$affected_rows = 0;
}
}
if ($affected_rows) {
my $stmtA = "SELECT * FROM vicidial_manager where server_ip = '" . $conf{VARserver_ip} . "' and status = 'QUEUE' order by entry_date desc limit 1";
if ($affected_rows)
{
my $stmtA = "SELECT man_id,uniqueid,entry_date,status,response,server_ip,channel,action,callerid,cmd_line_b,cmd_line_c,cmd_line_d,cmd_line_e,cmd_line_f,cmd_line_g,cmd_line_h,cmd_line_i,cmd_line_j,cmd_line_k FROM vicidial_manager where server_ip = '" . $conf{VARserver_ip} . "' and status = 'QUEUE' order by entry_date desc limit 1";
eventLogger($conf{'PATHlogs'}, 'process', "SQL_QUERY|" . $stmtA . "|");
my $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
while (my $vdm = $sthA->fetchrow_hashref) {
while (my $vdm = $sthA->fetchrow_hashref)
{
print STDERR $vdm->{man_id} . "|" . $vdm->{uniqueid} . "|" . $vdm->{channel} . "|" .
$vdm->{action} . "|" . $vdm->{callerid} . "\n" if ($DB);
@@ -145,7 +158,8 @@ while ($one_day_interval > 0) {
$originate_command .= "\n";
my $SENDNOW=1;
if ($originate_command =~ /Action: Hangup|Action: Redirect/) {
if ($originate_command =~ /Action: Hangup|Action: Redirect/)
{
$SENDNOW=0;
print STDERR "\n|checking for dead call before executing|" . $vdm->{callerid} . "|" . $vdm->{uniqueid} . "|\n" if ($DB);
my $stmtB = "SELECT count(*) FROM vicidial_manager where server_ip = '" . $conf{VARserver_ip} . "' and callerid='" . $vdm->{callerid} . "' and status = 'DEAD'";
@@ -154,17 +168,21 @@ while ($one_day_interval > 0) {
my $dead_count = ($sthB->fetchrow_array)[0];
$sthB->finish();
if ($dead_count) {
if ($dead_count)
{
print STDERR "\n|not sending command line is dead|" . $vdm->{callerid} . "|" . $vdm->{uniqueid} . "|\n" if ($DB);
} else {
}
else
{
$SENDNOW=1;
}
}
}
my $event_string = "----BEGIN NEW COMMAND----\nCallerID: " . $vdm->{callerid} . "\n$originate_command----END NEW COMMAND----\n";
eventLogger($conf{'PATHlogs'}, 'process', $event_string);
if ($SENDNOW) {
if ($SENDNOW)
{
my $cPATHlogs = $conf{PATHlogs};
$cPATHlogs =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
$vdm->{cmd_line_b} =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
@@ -214,55 +232,65 @@ while ($one_day_interval > 0) {
$event_string = "SQL_QUERY|$stmtA|";
eventLogger($conf{'PATHlogs'}, 'process', $event_string);
} else {
}
else
{
$stmtA = "UPDATE vicidial_manager set status='DEAD' where man_id='" . $vdm->{man_id} . "'";
print STDERR "\n|$stmtA|\n" if ($DB);
$affected_rows = $dbhA->do($stmtA);
$event_string="COMMAND NOT SENT, SQL_QUERY|$stmtA|";
eventLogger($conf{'PATHlogs'}, 'process', $event_string);;
}
}
}
$sthA->finish();
}
}
if ($affected_rows) {
if ($affected_rows)
{
### sleep for 1 hundredth of a second if just send an ACTION
usleep(1*10*1000);
} else {
}
else
{
### sleep for 10 hundredths of a second if no actions sent
usleep(1*100*1000);
}
}
$endless_loop--;
print STDERR "loop counter: |$endless_loop|\r" if($COUNTER_OUTPUT or $DB);
### putting a blank file called "sendmgr.kill" in a directory will automatically safely kill this program
if (-e $conf{PATHhome} . "/sendmgr.kill" or $sendonlyone) {
if (-e $conf{PATHhome} . "/sendmgr.kill" or $sendonlyone)
{
unlink($conf{PATHhome} . "/sendmgr.kill");
$endless_loop = 0;
$one_day_interval = 0;
print "\nPROCESS KILLED MANUALLY... EXITING\n\n";
}
}
my $running_listen = 0;
if ($endless_loop =~ /0$/) {
if ($endless_loop =~ /0$/)
{
### Grab Server values from the database
$servConf = getServerConfig($dbhA, $conf{VARserver_ip});
print "checking to see if listener is dead |$sendonlyone|$running_listen|\n" if($COUNTER_OUTPUT or $DB);
#my @psoutput = `/bin/ps -f --no-headers -A`;
my @psoutput = `/bin/ps -o "%p %a" --no-headers -A`;
foreach my $line (@psoutput) {
foreach my $line (@psoutput)
{
chomp($line);
print "|$line| \n" if ($DBX);
my @psline = split(/\/usr\/bin\/perl /,$line);
if ($psline[1] =~ /AST_manager_li/) {
if ($psline[1] =~ /AST_manager_li/)
{
$running_listen++;
print "SEND RUNNING: |$psline[1]|\n" if ($DB);
}
}
}
unless ($running_listen) {
unless ($running_listen)
{
$sendonlyone++;
print "LISTENER DEAD STOPPING PROGRAM... ATTEMPTING TO START keepalive SCRIPT\n" if ($COUNTER_OUTPUT or $DB);
$event_string = 'LISTENER DEAD STOPPING PROGRAM... ATTEMPTING TO START keepalive SCRIPT|';
@@ -270,15 +298,14 @@ while ($one_day_interval > 0) {
# `/usr/bin/at now < $PATHhome/ADMIN_keepalive_send_listen.at 2>/dev/null 1>&2`;
my $screencmd = "/usr/bin/screen -d -m " . $conf{PATHhome} . "/ADMIN_keepalive_AST_send_listen.pl 2>/dev/null 1>&2";
`$screencmd`;
}
}
}
}
print "DONE... Exiting... Goodbye... See you later... Not really, initiating next loop...$one_day_interval left\n" if($COUNTER_OUTPUT or $DB);
$one_day_interval--;
}
}
$event_string='CLOSING DB CONNECTION|';
eventLogger($conf{'PATHlogs'}, 'process', $event_string);
@@ -299,16 +326,17 @@ exit 0;
# $serverIP : IP of server to get config for.
# Returns:
# hashref with conents of table entry.
sub getServerConfig {
sub getServerConfig
{
my ($dbhA, $serverip) = @_;
my $stmtA = "SELECT * FROM servers where server_ip = '" . $serverip ."';";
my $stmtA = "SELECT server_id,server_description,server_ip,active,asterisk_version,max_vicidial_trunks,telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,local_gmt,voicemail_dump_exten,answer_transfer_agent,ext_context,sys_perf_log,vd_server_logs,agi_output,vicidial_balance_active,balance_trunks_offlimits,recording_web_link,alt_server_ip,active_asterisk_server,generate_vicidial_conf,rebuild_conf_files,outbound_calls_per_second,sysload,channels_total,cpu_idle_percent,disk_usage,sounds_update,vicidial_recording_limit,carrier_logging_active,vicidial_balance_rank,rebuild_music_on_hold,active_agent_login_server,conf_secret FROM servers where server_ip = '" . $serverip ."';";
my $sthA = $dbhA->prepare($stmtA) or die "preparing: " . $dbhA->errstr;
$sthA->execute or die "executing: $stmtA " . $dbhA->errstr;
my $servConf = $sthA->fetchrow_hashref;
$SYSLOG = 1 if ($servConf->{vd_server_logs} =~ /Y/);
$sthA->finish();
return $servConf;
}
}
# eventLogger usage:
# eventLgger($LogFileDir, $LogType, $EventString);
@@ -316,14 +344,15 @@ sub getServerConfig {
# $LogFilePath : Directory where log files are.
# $LogType : Type of log, ie process, send, launch, full
# $EventString : String to record in log.
sub eventLogger {
sub eventLogger
{
my ($path,$type,$string) = @_;
open(LOG, ">>" . $path . "/action_" . $type . "." . logDate())
|| die "Can't open " . $path . "/action_" . $type . "." .
logDate() . ": " . $! . "\n";
print LOG nowDate() . "|" . $string . "|\n";
close(LOG);
}
}
# getTime usage:
# getTime($SecondsSinceEpoch);
@@ -331,7 +360,8 @@ sub eventLogger {
# $SecondsSinceEpoch : Request time in seconds, defaults to current date/time.
# Returns:
# ($sec, $min, $hour. $day, $mon, $year)
sub getTime {
sub getTime
{
my ($tms) = @_;
$tms = time unless ($tms);
my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime($tms);
@@ -342,7 +372,7 @@ sub getTime {
$min = "0" . $min if ($min < 10);
$sec = "0" . $sec if ($sec < 10);
return ($sec,$min,$hour,$mday,$mon,$year);
}
}
# nowDate usage:
# nowDate($SecondsSinceEpoch);
@@ -350,11 +380,12 @@ sub getTime {
# $SecondsSinceEpoch : Request time in seconds, defaults to current date/time.
# Returns:
# scalar date/time string (MySQL formatted) ie "2007-01-01 00:00:00"
sub nowDate {
sub nowDate
{
my ($tms) = @_;
my($sec,$min,$hour,$mday,$mon,$year) = getTime($tms);
return $year.'-'.$mon.'-'.$mday.' '.$hour.':'.$min.':'.$sec;
}
}
# logDate usage:
# logDate($SecondsSinceEpoch);
@@ -362,10 +393,11 @@ sub nowDate {
# $SecondsSinceEpoch : Request time in seconds, defaults to current date/time.
# Returns:
# scalar date string ie "2007-01-01"
sub logDate {
sub logDate
{
my ($tms) = @_;
my($sec,$min,$hour,$mday,$mon,$year) = getTime($tms);
return $year . '-' . $mon . '-' . $mday;
}
}
### End of subs
@@ -39,6 +39,7 @@
# 90810-0956 - Added sccsv11 file format
# 90830-0953 - Added forcelistfilename option
# 91112-0645 - Added title/alt_phone duplicate checks
# 91129-2202 - removed SELECT STAR and formatting fixes
#
$secX = time();
@@ -419,7 +420,7 @@ else
$i=0;
foreach(@FILES)
{
{
$size1 = 0;
$size2 = 0;
$person_id_delete = '';
@@ -428,14 +429,12 @@ foreach(@FILES)
if (length($FILES[$i]) > 4)
{
$size1 = (-s "$dir1/$FILES[$i]");
if (!$q) {print "$FILES[$i] $size1\n";}
sleep(2);
$size2 = (-s "$dir1/$FILES[$i]");
if (!$q) {print "$FILES[$i] $size2\n\n";}
if ( ($FILES[$i] !~ /^TRANSFERRED/i) && ($size1 eq $size2) && (length($FILES[$i]) > 4))
{
$GOODfname = $FILES[$i];
@@ -1088,7 +1087,7 @@ foreach(@FILES)
{
if ($phone_code =~ /^1$/)
{
$stmtA = "select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";";
$stmtA = "select postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -1114,7 +1113,7 @@ foreach(@FILES)
### UNITED STATES ###
if ($phone_code =~ /^1$/)
{
$stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
$stmtA = "select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -1134,7 +1133,7 @@ foreach(@FILES)
### MEXICO ###
if ($phone_code =~ /^52$/)
{
$stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
$stmtA = "select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -1154,7 +1153,7 @@ foreach(@FILES)
### AUSTRALIA ###
if ($phone_code =~ /^61$/)
{
$stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';";
$stmtA = "select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and state='$state';";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -1174,7 +1173,7 @@ foreach(@FILES)
### ALL OTHER COUNTRY CODES ###
if (!$PC_processed)
{
$stmtA = "select * from vicidial_phone_codes where country_code='$phone_code';";
$stmtA = "select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code';";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
+12 -11
View File
@@ -57,6 +57,7 @@
# 60619-1103 - Added variable filters to close security holes for login form
# 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php
# 90508-0727 - Changed to PHP long tags
# 91129-2211 - Replaced SELECT STAR in SQL query
#
require("dbconnect.php");
@@ -88,8 +89,8 @@ $user_abb = "$user$user$user$user";
while ( (strlen($user_abb) > 4) and ($forever_stop < 200) )
{$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;}
$version = '2.0.1';
$build = '60829-1528';
$version = '2.2.0';
$build = '91129-2211';
### security strip all non-alphanumeric characters out of the variables ###
$DB=ereg_replace("[^0-9a-z]","",$DB);
@@ -100,15 +101,15 @@ $build = '60829-1528';
if ($force_logout)
{
if( (strlen($_SERVER['user'])>0) or (strlen($_SERVER['pass'])>0) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
}
if( (strlen($_SERVER['user'])>0) or (strlen($_SERVER['pass'])>0) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
}
echo "You have now logged out. Thank you\n";
exit;
}
}
$StarTtime = date("U");
$NOW_TIME = date("Y-m-d H:i:s");
@@ -140,7 +141,7 @@ $agcPAGE = "$HTTPprotocol$server_name$server_port$script_name";
$agcDIR = $agcPAGE;
$agcDIR = eregi_replace('astguiclient.php','',$agcDIR);
if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') )
if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth) or ($relogin == 'YES') )
{
header ("Content-type: text/html; charset=utf-8");
@@ -173,7 +174,7 @@ $agcDIR = eregi_replace('astguiclient.php','',$agcDIR);
echo "</html>\n\n";
exit;
}
else
else
{
if($auth>0)
@@ -276,7 +277,7 @@ if (!$authphone)
else
{
echo "<title>astGUIclient web client</title>\n";
$stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';";
$stmt="SELECT extension,dialplan_number,voicemail_id,phone_ip,computer_ip,server_ip,login,pass,status,active,phone_type,fullname,company,picture,messages,old_messages,protocol,local_gmt,ASTmgrUSERNAME,ASTmgrSECRET,login_user,login_pass,login_campaign,park_on_extension,conf_on_extension,VICIDIAL_park_on_extension,VICIDIAL_park_on_filename,monitor_prefix,recording_exten,voicemail_exten,voicemail_dump_exten,ext_context,dtmf_send_extension,call_out_number_group,client_browser,install_directory,local_web_callerID_URL,VICIDIAL_web_URL,AGI_call_logging_enabled,user_switching_enabled,conferencing_enabled,admin_hangup_enabled,admin_hijack_enabled,admin_monitor_enabled,call_parking_enabled,updater_check_enabled,AFLogging_enabled,QUEUE_ACTION_enabled,CallerID_popup_enabled,voicemail_button_enabled,enable_fast_refresh,fast_refresh_rate,enable_persistant_mysql,auto_dial_next_number,VDstop_rec_after_each_call,DBX_server,DBX_database,DBX_user,DBX_pass,DBX_port,DBY_server,DBY_database,DBY_user,DBY_pass,DBY_port,outbound_cid,enable_sipsak_messages,email,template_id,conf_override,phone_context,phone_ring_timeout,conf_secret from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
+7 -7
View File
@@ -260,22 +260,22 @@ echo "<B>$NOW_TIME</B><BR><BR>\n";
}
$MT[0]='';
$row=''; $rowx='';
$channel_live=1;
if (strlen($uniqueid)<9)
$MT[0]='';
$row=''; $rowx='';
$channel_live=1;
if (strlen($uniqueid)<9)
{
$channel_live=0;
echo "Uniqueid $uniqueid is not valid\n";
exit;
}
else
else
{
$stmt="SELECT * FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';";
$stmt="SELECT uniqueid,channel,server_ip,caller_id,extension,phone_ext,start_time,acknowledged,inbound_number,comment_a,comment_b,comment_c,comment_d,comment_e FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
$channels_list = mysql_num_rows($rslt);
if ($channels_list>0)
if ($channels_list>0)
{
$row=mysql_fetch_row($rslt);
# echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|";
+1 -1
View File
@@ -117,7 +117,7 @@ echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
else
{
##### print parked calls from the parked_channels table
$stmt="SELECT * from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;";
$stmt="SELECT channel,server_ip,channel_group,extension,parked_by,parked_time from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
$park_calls_count = mysql_num_rows($rslt);
+2 -2
View File
@@ -1090,7 +1090,7 @@ if ($ACTION == 'manDiaLnextCaLL')
$g++;
}
$stmt="SELECT * FROM vicidial_call_times where call_time_id='$local_call_time';";
$stmt="SELECT call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times FROM vicidial_call_times where call_time_id='$local_call_time';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00237',$user,$server_ip,$session_name,$one_mysql_log);}
@@ -1126,7 +1126,7 @@ if ($ACTION == 'manDiaLnextCaLL')
{
if (strlen($state_rules[$b])>1)
{
$stmt="SELECT * from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';";
$stmt="SELECT state_call_time_id,state_call_time_state,state_call_time_name,state_call_time_comments,sct_default_start,sct_default_stop,sct_sunday_start,sct_sunday_stop,sct_monday_start,sct_monday_stop,sct_tuesday_start,sct_tuesday_stop,sct_wednesday_start,sct_wednesday_stop,sct_thursday_start,sct_thursday_stop,sct_friday_start,sct_friday_stop,sct_saturday_start,sct_saturday_stop from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00238',$user,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
@@ -167,7 +167,7 @@ while ($i < $groups_to_print)
$i++;
}
$stmt="select * from vicidial_user_groups;";
$stmt="select user_group,group_name,allowed_campaigns,qc_allowed_campaigns,qc_allowed_inbound_groups,group_shifts,forced_timeclock_login,shift_enforcement,agent_status_viewable_groups,agent_status_view_time from vicidial_user_groups;";
if ($non_latin > 0)
{
$rslt=mysql_query("SET NAMES 'UTF8'");
+1 -1
View File
@@ -1982,7 +1982,7 @@ else
# 90908-1207 - Added cross-listing linking for DIDs, CallMenus and In-groups
# 90916-1105 - Added second web form to ingroups and campaigns and added audio choose for answering machine message and waitforsilence_options
# 90917-1108 - Added Extra Voicemail boxes config in Admin section
# 90919-2251 - Removed all "SELECT *" instances in the code, code cleanup to conform to standard
# 90919-2251 - Removed all SELECT STAR instances in the code, code cleanup to conform to standard
# 90924-1645 - Added list_id overrides for cid, am_message and drop in-group
# 90930-2107 - Added agent territory selection options for ViciDial agents
# 91026-1050 - Added AREACODE DNC option for campaigns
@@ -20,7 +20,7 @@
# 90310-2146 - Added admin header
# 90508-0644 - Changed to PHP long tags
# 90917-2307 - Added alternate phone number searching option
# 90921-0713 - Removed select *
# 90921-0713 - Removed SELECT STAR
#
require("dbconnect.php");
+1 -1
View File
@@ -261,7 +261,7 @@ $row=mysql_fetch_row($rslt);
$parked_count = $row[0];
if ($parked_count > 0)
{
$stmt="SELECT * from parked_channels where server_ip='" . mysql_real_escape_string($server_ip) . "' and channel_group LIKE \"CL_%\" order by channel_group,parked_time";
$stmt="SELECT channel,server_ip,channel_group,extension,parked_by,parked_time from parked_channels where server_ip='" . mysql_real_escape_string($server_ip) . "' and channel_group LIKE \"CL_%\" order by channel_group,parked_time";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$parked_to_print = mysql_num_rows($rslt);
+2 -2
View File
@@ -205,7 +205,7 @@ else
if ($lead_count > 0)
{
$stmt="SELECT * from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'";
$stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
@@ -268,7 +268,7 @@ else
echo "<tr><td align=right>Comments : </td><td align=left><input type=text name=comments size=30 maxlength=255 value=\"$comments\"></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Disposition: </td><td align=left><select size=1 name=status>\n";
$stmt="SELECT * from vicidial_statuses where selectable='Y' order by status";
$stmt="SELECT status,status_name from vicidial_statuses where selectable='Y' order by status";
$rslt=mysql_query($stmt, $link);
$statuses_to_print = mysql_num_rows($rslt);
$statuses_list='';
@@ -244,7 +244,7 @@ echo "<br><br>\n";
echo "<input type=hidden name=DB value=$DB>\n";
echo "group: <select size=1 name=group>\n";
$stmt="SELECT * from vicidial_user_groups order by user_group";
$stmt="SELECT user_group,group_name from vicidial_user_groups order by user_group";
$rslt=mysql_query($stmt, $link);
$groups_to_print = mysql_num_rows($rslt);
$o=0;
+5 -5
View File
@@ -438,7 +438,7 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
{
if ($phone_code =~ /^1$/)
{
$stmtA = "select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";";
$stmtA = "select postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -464,7 +464,7 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
### UNITED STATES ###
if ($phone_code =~ /^1$/)
{
$stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
$stmtA = "select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -484,7 +484,7 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
### MEXICO ###
if ($phone_code =~ /^52$/)
{
$stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
$stmtA = "select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -504,7 +504,7 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
### AUSTRALIA ###
if ($phone_code =~ /^61$/)
{
$stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';";
$stmtA = "select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and state='$state';";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -524,7 +524,7 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
### ALL OTHER COUNTRY CODES ###
if (!$PC_processed)
{
$stmtA = "select * from vicidial_phone_codes where country_code='$phone_code';";
$stmtA = "select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code';";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -440,7 +440,7 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
{
if ($phone_code =~ /^1$/)
{
$stmtA = "select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";";
$stmtA = "select postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -466,7 +466,7 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
### UNITED STATES ###
if ($phone_code =~ /^1$/)
{
$stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
$stmtA = "select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -486,7 +486,7 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
### MEXICO ###
if ($phone_code =~ /^52$/)
{
$stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
$stmtA = "select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -506,7 +506,7 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
### AUSTRALIA ###
if ($phone_code =~ /^61$/)
{
$stmtA = "select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';";
$stmtA = "select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and state='$state';";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -526,7 +526,7 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
### ALL OTHER COUNTRY CODES ###
if (!$PC_processed)
{
$stmtA = "select * from vicidial_phone_codes where country_code='$phone_code';";
$stmtA = "select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code';";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -1644,7 +1644,7 @@ if ( (eregi("POSTAL",$postalgmt)) && (strlen($postal_code)>4) )
{
if (preg_match('/^1$/', $phone_code))
{
$stmt="select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";";
$stmt="select postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";";
$rslt=mysql_query($stmt, $link);
$pc_recs = mysql_num_rows($rslt);
if ($pc_recs > 0)
@@ -1665,7 +1665,7 @@ if ($postalgmt_found < 1)
### UNITED STATES ###
if ($phone_code =='1')
{
$stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
$stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
$rslt=mysql_query($stmt, $link);
$pc_recs = mysql_num_rows($rslt);
if ($pc_recs > 0)
@@ -1680,7 +1680,7 @@ if ($postalgmt_found < 1)
### MEXICO ###
if ($phone_code =='52')
{
$stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
$stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
$rslt=mysql_query($stmt, $link);
$pc_recs = mysql_num_rows($rslt);
if ($pc_recs > 0)
@@ -1695,7 +1695,7 @@ if ($postalgmt_found < 1)
### AUSTRALIA ###
if ($phone_code =='61')
{
$stmt="select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';";
$stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and state='$state';";
$rslt=mysql_query($stmt, $link);
$pc_recs = mysql_num_rows($rslt);
if ($pc_recs > 0)
@@ -1711,7 +1711,7 @@ if ($postalgmt_found < 1)
if (!$PC_processed)
{
$PC_processed++;
$stmt="select * from vicidial_phone_codes where country_code='$phone_code';";
$stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code';";
$rslt=mysql_query($stmt, $link);
$pc_recs = mysql_num_rows($rslt);
if ($pc_recs > 0)
+1 -1
View File
@@ -1867,7 +1867,7 @@ return $dialable;
{
if ( (strlen($state_rules[$b])>1) and (strlen($state)>1) )
{
$stmt="SELECT * from vicidial_state_call_times where state_call_time_id='$state_rules[$b]' and state_call_time_state='$state';";
$stmt="SELECT STAR from vicidial_state_call_times where state_call_time_id='$state_rules[$b]' and state_call_time_state='$state';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$Gstate_call_time_id = "$row[0]";
+2 -2
View File
@@ -203,7 +203,7 @@ else
if ($lead_count > 0)
{
$stmt="SELECT * from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'";
$stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
@@ -266,7 +266,7 @@ else
echo "<tr><td align=right>Comments : </td><td align=left><input type=text name=comments size=30 maxlength=255 value=\"$comments\"></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Disposition: </td><td align=left><select size=1 name=status>\n";
$stmt="SELECT * from vicidial_statuses where selectable='Y' order by status";
$stmt="SELECT status,status_name from vicidial_statuses where selectable='Y' order by status";
$rslt=mysql_query($stmt, $link);
$statuses_to_print = mysql_num_rows($rslt);
$statuses_list='';
@@ -104,7 +104,7 @@ $browser = getenv("HTTP_USER_AGENT");
}
}
$stmt="select * from vicidial_user_groups order by user_group desc;";
$stmt="select user_group,group_name from vicidial_user_groups order by user_group desc;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$groups_to_print = mysql_num_rows($rslt);
+46 -46
View File
@@ -80,14 +80,14 @@ $date = date("r");
$ip = getenv("REMOTE_ADDR");
$browser = getenv("HTTP_USER_AGENT");
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
else
else
{
if($auth>0)
@@ -437,27 +437,27 @@ echo "<B>CLOSER IN-GROUP SELECTION LOGS:</B>\n";
echo "<TABLE width=670 cellspacing=0 cellpadding=1>\n";
echo "<tr><td><font size=1># </td><td><font size=2>DATE/TIME </td><td align=left><font size=2> CAMPAIGN</td><td align=left><font size=2>BLEND</td><td align=left><font size=2> GROUPS</td></tr>\n";
$stmt="select * from vicidial_user_closer_log where user='" . mysql_real_escape_string($user) . "' and event_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and event_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by event_date desc limit 1000;";
$rslt=mysql_query($stmt, $link);
$logs_to_print = mysql_num_rows($rslt);
$stmt="select user,campaign_id,event_date,blended,closer_campaigns from vicidial_user_closer_log where user='" . mysql_real_escape_string($user) . "' and event_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and event_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by event_date desc limit 1000;";
$rslt=mysql_query($stmt, $link);
$logs_to_print = mysql_num_rows($rslt);
$u=0;
while ($logs_to_print > $u) {
$row=mysql_fetch_row($rslt);
if (eregi("1$|3$|5$|7$|9$", $u))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
$u++;
echo "<tr $bgcolor>";
echo "<td><font size=1>$u</td>";
echo "<td><font size=2>$row[2]</td>";
echo "<td align=left><font size=2> $row[1]</td>\n";
echo "<td align=left><font size=2> $row[3]</td>\n";
echo "<td align=left><font size=2> $row[4] </td>\n";
echo "</tr>\n";
$u=0;
while ($logs_to_print > $u)
{
$row=mysql_fetch_row($rslt);
if (eregi("1$|3$|5$|7$|9$", $u))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
$u++;
echo "<tr $bgcolor>";
echo "<td><font size=1>$u</td>";
echo "<td><font size=2>$row[2]</td>";
echo "<td align=left><font size=2> $row[1]</td>\n";
echo "<td align=left><font size=2> $row[3]</td>\n";
echo "<td align=left><font size=2> $row[4] </td>\n";
echo "</tr>\n";
}
@@ -470,31 +470,31 @@ echo "<B>OUTBOUND CALLS FOR THIS TIME PERIOD: (10000 record limit)</B>\n";
echo "<TABLE width=670 cellspacing=0 cellpadding=1>\n";
echo "<tr><td><font size=1># </td><td><font size=2>DATE/TIME </td><td align=left><font size=2>LENGTH</td><td align=left><font size=2> STATUS</td><td align=left><font size=2> PHONE</td><td align=right><font size=2> CAMPAIGN</td><td align=right><font size=2> GROUP</td><td align=right><font size=2> LIST</td><td align=right><font size=2> LEAD</td><td align=right><font size=2> HANGUP REASON</td></tr>\n";
$stmt="select * from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by call_date desc limit 10000;";
$rslt=mysql_query($stmt, $link);
$logs_to_print = mysql_num_rows($rslt);
$stmt="select uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed,user_group,term_reason,alt_dial from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by call_date desc limit 10000;";
$rslt=mysql_query($stmt, $link);
$logs_to_print = mysql_num_rows($rslt);
$u=0;
while ($logs_to_print > $u) {
$row=mysql_fetch_row($rslt);
if (eregi("1$|3$|5$|7$|9$", $u))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
$u++;
echo "<tr $bgcolor>";
echo "<td><font size=1>$u</td>";
echo "<td><font size=2>$row[4]</td>";
echo "<td align=left><font size=2> $row[7]</td>\n";
echo "<td align=left><font size=2> $row[8]</td>\n";
echo "<td align=left><font size=2> $row[10] </td>\n";
echo "<td align=right><font size=2> $row[3] </td>\n";
echo "<td align=right><font size=2> $row[14] </td>\n";
echo "<td align=right><font size=2> $row[2] </td>\n";
echo "<td align=right><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$row[1]\" target=\"_blank\">$row[1]</A> </td>\n";
echo "<td align=right><font size=2> $row[15] </td></tr>\n";
$u=0;
while ($logs_to_print > $u)
{
$row=mysql_fetch_row($rslt);
if (eregi("1$|3$|5$|7$|9$", $u))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
$u++;
echo "<tr $bgcolor>";
echo "<td><font size=1>$u</td>";
echo "<td><font size=2>$row[4]</td>";
echo "<td align=left><font size=2> $row[7]</td>\n";
echo "<td align=left><font size=2> $row[8]</td>\n";
echo "<td align=left><font size=2> $row[10] </td>\n";
echo "<td align=right><font size=2> $row[3] </td>\n";
echo "<td align=right><font size=2> $row[14] </td>\n";
echo "<td align=right><font size=2> $row[2] </td>\n";
echo "<td align=right><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$row[1]\" target=\"_blank\">$row[1]</A> </td>\n";
echo "<td align=right><font size=2> $row[15] </td></tr>\n";
}
@@ -507,7 +507,7 @@ echo "<B>INBOUND/CLOSER CALLS FOR THIS TIME PERIOD: (10000 record limit)</B>\n";
echo "<TABLE width=670 cellspacing=0 cellpadding=1>\n";
echo "<tr><td><font size=1># </td><td><font size=2>DATE/TIME </td><td align=left><font size=2>LENGTH</td><td align=left><font size=2> STATUS</td><td align=left><font size=2> PHONE</td><td align=right><font size=2> CAMPAIGN</td><td align=right><font size=2> WAIT (S)</td><td align=right><font size=2> LIST</td><td align=right><font size=2> LEAD</td><td align=right><font size=2> HANGUP REASON</td></tr>\n";
$stmt="select * from vicidial_closer_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by call_date desc limit 10000;";
$stmt="select closecallid,lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed,queue_seconds,user_group,xfercallid,term_reason,uniqueid,agent_only from vicidial_closer_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by call_date desc limit 10000;";
$rslt=mysql_query($stmt, $link);
$logs_to_print = mysql_num_rows($rslt);
@@ -544,7 +544,7 @@ echo "<B>RECORDINGS FOR THIS TIME PERIOD: (10000 record limit)</B>\n";
echo "<TABLE width=750 cellspacing=0 cellpadding=1>\n";
echo "<tr><td><font size=1># </td><td align=left><font size=2> LEAD</td><td><font size=2>DATE/TIME </td><td align=left><font size=2>SECONDS </td><td align=left><font size=2> &nbsp; RECID</td><td align=center><font size=2>FILENAME</td><td align=center><font size=2>LOCATION &nbsp; </td></tr>\n";
$stmt="select * from recording_log where user='" . mysql_real_escape_string($user) . "' and start_time >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and start_time <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by recording_id desc limit 10000;";
$stmt="select recording_id,channel,server_ip,extension,start_time,start_epoch,end_time,end_epoch,length_in_sec,length_in_min,filename,location,lead_id,user,vicidial_id from recording_log where user='" . mysql_real_escape_string($user) . "' and start_time >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and start_time <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by recording_id desc limit 10000;";
$rslt=mysql_query($stmt, $link);
$logs_to_print = mysql_num_rows($rslt);
+1 -1
View File
@@ -154,7 +154,7 @@ else
}
$stmt="select * from vicidial_campaigns;";
$stmt="select campaign_id from vicidial_campaigns;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$groups_to_print = mysql_num_rows($rslt);
+97 -111
View File
@@ -12,10 +12,11 @@
# 60421-1229 - check GET/POST vars lines with isset to not trigger PHP NOTICES
# 60619-1603 - Added variable filtering to eliminate SQL injection attack threat
# 90508-0644 - Changed to PHP long tags
# 91129-2249 - Replaced SELECT STAR in SQL queries, formatting fixes
#
$version = '1.1.12';
$build = '90508-0644';
$version = '2.2.0';
$build = '91129-2249';
require("dbconnect.php");
@@ -56,15 +57,15 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
if (!isset($force_logout)) {$force_logout = 0;}
if ($force_logout)
{
if( (strlen($PHP_AUTH_USER)>0) or (strlen($PHP_AUTH_PW)>0) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
}
if( (strlen($PHP_AUTH_USER)>0) or (strlen($PHP_AUTH_PW)>0) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
}
echo "You have now logged out. Thank you\n";
exit;
}
}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
@@ -76,25 +77,25 @@ $NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 3;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 3;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$fp = fopen ("./project_auth_entries.txt", "a");
$date = date("r");
$ip = getenv("REMOTE_ADDR");
$browser = getenv("HTTP_USER_AGENT");
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
else
else
{
header ("Content-type: text/html; charset=utf-8");
@@ -202,14 +203,14 @@ if (strlen($ADD)>4)
##### get inbound groups listing for checkboxes
if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) )
{
$stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$closer_campaigns = $row[0];
$closer_campaigns = preg_replace("/ -$/","",$closer_campaigns);
$groups = explode(" ", $closer_campaigns);
}
{
$stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$closer_campaigns = $row[0];
$closer_campaigns = preg_replace("/ -$/","",$closer_campaigns);
$groups = explode(" ", $closer_campaigns);
}
$stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id";
$rslt=mysql_query($stmt, $link);
@@ -259,10 +260,10 @@ if (strlen($ADD)>4)
######################
if ($ADD==31111)
{
{
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
$stmt="SELECT * from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';";
$stmt="SELECT remote_agent_id,user_start,number_of_lines,server_ip,conf_exten,status,campaign_id,closer_campaigns from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$remote_agent_id = $row[0];
@@ -273,25 +274,23 @@ if ($ADD==31111)
$status = $row[5];
$campaign_id = $row[6];
echo "<br>MODIFY A REMOTE AGENTS ENTRY: $row[0]<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=ADD value=41111>\n";
echo "<input type=hidden name=remote_agent_id value=\"$row[0]\">\n";
echo "<center><TABLE width=600 cellspacing=3>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>User ID Start: </td><td align=left>$user_start</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Number of Lines: </td><td align=left><input type=text name=number_of_lines size=3 maxlength=3 value=\"$number_of_lines\"> (numbers only)</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Server IP: </td><td align=left>$row[3]</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>External Extension: </td><td align=left><input type=text name=conf_exten size=20 maxlength=20 value=\"$conf_exten\"> (number dialed to reach agents [i.e. 913125551212])</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Status: </td><td align=left><select size=1 name=status><option SELECTED>ACTIVE</option><option>INACTIVE</option><option SELECTED>$status</option></select></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Campaign: </td><td align=left>$campaign_id</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Inbound Groups: </td><td align=left>\n";
echo "$groups_list";
echo "</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2><input type=submit name=submit value=submit></td></tr>\n";
echo "</TABLE></center>\n";
echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n";
}
echo "<br>MODIFY A REMOTE AGENTS ENTRY: $row[0]<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=ADD value=41111>\n";
echo "<input type=hidden name=remote_agent_id value=\"$row[0]\">\n";
echo "<center><TABLE width=600 cellspacing=3>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>User ID Start: </td><td align=left>$user_start</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Number of Lines: </td><td align=left><input type=text name=number_of_lines size=3 maxlength=3 value=\"$number_of_lines\"> (numbers only)</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Server IP: </td><td align=left>$row[3]</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>External Extension: </td><td align=left><input type=text name=conf_exten size=20 maxlength=20 value=\"$conf_exten\"> (number dialed to reach agents [i.e. 913125551212])</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Status: </td><td align=left><select size=1 name=status><option SELECTED>ACTIVE</option><option>INACTIVE</option><option SELECTED>$status</option></select></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Campaign: </td><td align=left>$campaign_id</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Inbound Groups: </td><td align=left>\n";
echo "$groups_list";
echo "</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2><input type=submit name=submit value=submit></td></tr>\n";
echo "</TABLE></center>\n";
echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n";
}
@@ -300,12 +299,12 @@ echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to
######################
if ($ADD==41111)
{
{
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
if ( (strlen($number_of_lines) < 1) or (strlen($conf_exten) < 2) )
if ( (strlen($number_of_lines) < 1) or (strlen($conf_exten) < 2) )
{echo "<br>REMOTE AGENTS NOT MODIFIED - Please go back and look at the data you entered\n";}
else
else
{
$stmt="UPDATE vicidial_remote_agents set number_of_lines='" . mysql_real_escape_string($number_of_lines) . "', conf_exten='" . mysql_real_escape_string($conf_exten) . "', status='" . mysql_real_escape_string($status) . "', closer_campaigns='" . mysql_real_escape_string($groups_value) . "' where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';";
$rslt=mysql_query($stmt, $link);
@@ -317,10 +316,9 @@ if ($ADD==41111)
$fp = fopen ("./admin_changes_log.txt", "a");
fwrite ($fp, "$date|MODIFY REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n");
fclose($fp);
}
$stmt="SELECT * from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';";
$stmt="SELECT remote_agent_id,user_start,number_of_lines,server_ip,conf_exten,status,campaign_id,closer_campaigns from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$remote_agent_id = $row[0];
@@ -331,25 +329,23 @@ if ($ADD==41111)
$status = $row[5];
$campaign_id = $row[6];
echo "<br>MODIFY A REMOTE AGENTS ENTRY: $row[0]<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=ADD value=41111>\n";
echo "<input type=hidden name=remote_agent_id value=\"$row[0]\">\n";
echo "<center><TABLE width=600 cellspacing=3>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>User ID Start: </td><td align=left>$user_start</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Number of Lines: </td><td align=left><input type=text name=number_of_lines size=3 maxlength=3 value=\"$number_of_lines\"> (numbers only)</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Server IP: </td><td align=left>$row[3]</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>External Extension: </td><td align=left><input type=text name=conf_exten size=20 maxlength=20 value=\"$conf_exten\"> (number dialed to reach agents [i.e. 913125551212])</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Status: </td><td align=left><select size=1 name=status><option SELECTED>ACTIVE</option><option>INACTIVE</option><option SELECTED>$status</option></select></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Campaign: </td><td align=left>$campaign_id</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Inbound Groups: </td><td align=left>\n";
echo "$groups_list";
echo "</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2><input type=submit name=submit value=submit></td></tr>\n";
echo "</TABLE></center>\n";
echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n";
}
echo "<br>MODIFY A REMOTE AGENTS ENTRY: $row[0]<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=ADD value=41111>\n";
echo "<input type=hidden name=remote_agent_id value=\"$row[0]\">\n";
echo "<center><TABLE width=600 cellspacing=3>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>User ID Start: </td><td align=left>$user_start</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Number of Lines: </td><td align=left><input type=text name=number_of_lines size=3 maxlength=3 value=\"$number_of_lines\"> (numbers only)</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Server IP: </td><td align=left>$row[3]</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>External Extension: </td><td align=left><input type=text name=conf_exten size=20 maxlength=20 value=\"$conf_exten\"> (number dialed to reach agents [i.e. 913125551212])</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Status: </td><td align=left><select size=1 name=status><option SELECTED>ACTIVE</option><option>INACTIVE</option><option SELECTED>$status</option></select></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Campaign: </td><td align=left>$campaign_id</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Inbound Groups: </td><td align=left>\n";
echo "$groups_list";
echo "</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2><input type=submit name=submit value=submit></td></tr>\n";
echo "</TABLE></center>\n";
echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n";
}
@@ -358,14 +354,13 @@ echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to
######################
if ($ADD==61111)
{
{
echo "<FONT FACE=\"Courier\" COLOR=BLACK SIZE=2><PRE>";
if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
{echo "<br>REMOTE AGENTS ERROR - Please go back and look at the data you entered\n";}
else
else
{
$users_list = '';
$k=0;
while($k < $number_of_lines)
@@ -386,14 +381,14 @@ if ($ADD==61111)
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$talking_to_print = mysql_num_rows($rslt);
if ($talking_to_print > 0)
if ($talking_to_print > 0)
{
$i=0;
while ($i < $talking_to_print)
{
$leadlink=0;
$row=mysql_fetch_row($rslt);
if (eregi("READY|PAUSED",$row[4]))
if (eregi("READY|PAUSED",$row[4]))
{
$row[3]='';
$row[5]=' - WAITING - ';
@@ -410,7 +405,7 @@ if ($ADD==61111)
$leadid = "<a href=\"./remote_dispo.php?lead_id=$row[2]&call_began=$row[6]\" target=\"_blank\">$leadid</a>";
}
$channel = sprintf("%-10s", $row[3]);
$cc=0;
$cc=0;
while ( (strlen($channel) > 10) and ($cc < 100) )
{
$channel = eregi_replace(".$","",$channel);
@@ -439,14 +434,13 @@ if ($ADD==61111)
$i++;
}
echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n";
echo " $i agents logged in on server $server_ip\n\n";
echo " <SPAN class=\"yellow\"><B> </SPAN> - 5 minutes or more on call</B>\n";
echo " <SPAN class=\"orange\"><B> </SPAN> - Over 10 minutes on call</B>\n";
echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n";
echo " $i agents logged in on server $server_ip\n\n";
echo " <SPAN class=\"yellow\"><B> </SPAN> - 5 minutes or more on call</B>\n";
echo " <SPAN class=\"orange\"><B> </SPAN> - Over 10 minutes on call</B>\n";
}
else
else
{
echo "**************************************************************************************\n";
echo "********************************* NO AGENTS ON CALLS *********************************\n";
@@ -454,9 +448,8 @@ if ($ADD==61111)
}
}
echo "</PRE>\n\n";
}
echo "</PRE>\n\n";
}
######################
@@ -464,7 +457,7 @@ echo "</PRE>\n\n";
######################
if ($ADD==71111)
{
{
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET>\n";
echo "<INPUT TYPE=TEXT NAME=query_date SIZE=10 MAXLENGTH=10 VALUE=\"$query_date\">\n";
echo "<INPUT TYPE=HIDDEN NAME=ADD VALUE=\"71111\">\n";
@@ -473,11 +466,10 @@ if ($ADD==71111)
echo "</FORM>\n\n";
echo "<FONT FACE=\"Courier\" COLOR=BLACK SIZE=2><PRE>";
if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
{echo "<br>REMOTE AGENTS ERROR - Please go back and look at the data you entered\n";}
else
else
{
$users_list = '';
$k=0;
while($k < $number_of_lines)
@@ -493,15 +485,15 @@ if ($ADD==71111)
$row=mysql_fetch_row($rslt);
$in_calls = $row[0];
$in_time = $row[1];
$in_time_M = ($in_time / 60);
$in_time_M = round($in_time_M, 2);
$in_time_M_int = intval("$in_time_M");
$in_time_SEC = ($in_time_M - $in_time_M_int);
$in_time_SEC = ($in_time_SEC * 60);
$in_time_SEC = round($in_time_SEC, 0);
if ($in_time_SEC < 10) {$in_time_SEC = "0$in_time_SEC";}
$in_time_MS = "$in_time_M_int:$in_time_SEC";
$in_time_MS = sprintf("%7s", $in_time_MS);
$in_time_M = ($in_time / 60);
$in_time_M = round($in_time_M, 2);
$in_time_M_int = intval("$in_time_M");
$in_time_SEC = ($in_time_M - $in_time_M_int);
$in_time_SEC = ($in_time_SEC * 60);
$in_time_SEC = round($in_time_SEC, 0);
if ($in_time_SEC < 10) {$in_time_SEC = "0$in_time_SEC";}
$in_time_MS = "$in_time_M_int:$in_time_SEC";
$in_time_MS = sprintf("%7s", $in_time_MS);
echo "Remote Agent inbound stats $NOW_TIME\n\n";
echo "\n";
@@ -519,7 +511,7 @@ if ($ADD==71111)
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$talking_to_print = mysql_num_rows($rslt);
if ($talking_to_print > 0)
if ($talking_to_print > 0)
{
$i=0;
while ($i < $talking_to_print)
@@ -551,14 +543,13 @@ if ($ADD==71111)
$i++;
}
echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n";
# echo " $i agents logged in on server $server_ip\n\n";
# echo " <SPAN class=\"yellow\"><B> </SPAN> - 5 minutes or more on call</B>\n";
# echo " <SPAN class=\"orange\"><B> </SPAN> - Over 10 minutes on call</B>\n";
echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n";
# echo " $i agents logged in on server $server_ip\n\n";
# echo " <SPAN class=\"yellow\"><B> </SPAN> - 5 minutes or more on call</B>\n";
# echo " <SPAN class=\"orange\"><B> </SPAN> - Over 10 minutes on call</B>\n";
}
else
else
{
echo "**************************************************************************************\n";
echo "********************************* NO CALLS ON THIS DAY *******************************\n";
@@ -566,9 +557,8 @@ if ($ADD==71111)
}
}
echo "</PRE>\n\n";
}
echo "</PRE>\n\n";
}
@@ -599,7 +589,3 @@ exit;
?>