From 86202b04cff2da45c6200562e998700a19139643 Mon Sep 17 00:00:00 2001 From: mattf Date: Mon, 30 Nov 2009 04:25:17 +0000 Subject: [PATCH] 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 --- agc_2-X/trunk/UPGRADE | 3 + agc_2-X/trunk/agi/agi-LCR-Route.agi | 74 ++-- .../trunk/bin/ADMIN_adjust_GMTnow_on_leads.pl | 349 +++++++++--------- agc_2-X/trunk/bin/AST_VDadapt.pl | 2 +- agc_2-X/trunk/bin/AST_VDauto_dial.pl | 2 +- agc_2-X/trunk/bin/AST_agent_logout.pl | 130 +++---- agc_2-X/trunk/bin/AST_manager_send.pl | 136 ++++--- .../trunk/bin/VICIDIAL_IN_new_leads_file.pl | 15 +- agc_2-X/trunk/www/agc/astguiclient.php | 23 +- agc_2-X/trunk/www/agc/inbound_popup.php | 14 +- agc_2-X/trunk/www/agc/park_calls_display.php | 2 +- agc_2-X/trunk/www/agc/vdc_db_query.php | 4 +- .../www/vicidial/AST_timeonVDADallREC.php | 2 +- agc_2-X/trunk/www/vicidial/admin.php | 2 +- .../trunk/www/vicidial/admin_search_lead.php | 2 +- agc_2-X/trunk/www/vicidial/closer.php | 2 +- agc_2-X/trunk/www/vicidial/closer_dispo.php | 4 +- .../trunk/www/vicidial/group_hourly_stats.php | 2 +- agc_2-X/trunk/www/vicidial/listloader.pl | 10 +- .../trunk/www/vicidial/listloader_super.pl | 10 +- .../www/vicidial/new_listloader_superL.php | 10 +- agc_2-X/trunk/www/vicidial/non_agent_api.php | 2 +- agc_2-X/trunk/www/vicidial/remote_dispo.php | 4 +- .../www/vicidial/user_group_bulk_change.php | 2 +- agc_2-X/trunk/www/vicidial/user_stats.php | 92 ++--- agc_2-X/trunk/www/vicidial/user_status.php | 2 +- agc_2-X/trunk/www/vicidial/vdremote.php | 208 +++++------ 27 files changed, 565 insertions(+), 543 deletions(-) diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index 60ad6965..2d941ff9 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -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. diff --git a/agc_2-X/trunk/agi/agi-LCR-Route.agi b/agc_2-X/trunk/agi/agi-LCR-Route.agi index 605004d5..c578ca59 100644 --- a/agc_2-X/trunk/agi/agi-LCR-Route.agi +++ b/agc_2-X/trunk/agi/agi-LCR-Route.agi @@ -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;} -} + } diff --git a/agc_2-X/trunk/bin/ADMIN_adjust_GMTnow_on_leads.pl b/agc_2-X/trunk/bin/ADMIN_adjust_GMTnow_on_leads.pl index 06f91d95..11ab0a21 100644 --- a/agc_2-X/trunk/bin/ADMIN_adjust_GMTnow_on_leads.pl +++ b/agc_2-X/trunk/bin/ADMIN_adjust_GMTnow_on_leads.pl @@ -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) diff --git a/agc_2-X/trunk/bin/AST_VDadapt.pl b/agc_2-X/trunk/bin/AST_VDadapt.pl index bce0a8bd..c6b0386b 100644 --- a/agc_2-X/trunk/bin/AST_VDadapt.pl +++ b/agc_2-X/trunk/bin/AST_VDadapt.pl @@ -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 { diff --git a/agc_2-X/trunk/bin/AST_VDauto_dial.pl b/agc_2-X/trunk/bin/AST_VDauto_dial.pl index 5c2c9a90..0aefd1cb 100644 --- a/agc_2-X/trunk/bin/AST_VDauto_dial.pl +++ b/agc_2-X/trunk/bin/AST_VDauto_dial.pl @@ -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; diff --git a/agc_2-X/trunk/bin/AST_agent_logout.pl b/agc_2-X/trunk/bin/AST_agent_logout.pl index 30ca85aa..baf09d69 100644 --- a/agc_2-X/trunk/bin/AST_agent_logout.pl +++ b/agc_2-X/trunk/bin/AST_agent_logout.pl @@ -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=''; -} diff --git a/agc_2-X/trunk/bin/AST_manager_send.pl b/agc_2-X/trunk/bin/AST_manager_send.pl index 3d9fcd0b..f19e8392 100644 --- a/agc_2-X/trunk/bin/AST_manager_send.pl +++ b/agc_2-X/trunk/bin/AST_manager_send.pl @@ -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 LICENSE: AGPLv2 +# Copyright (C) 2009 Matt Florell 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 = ) { +while (my $line = ) + { $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 diff --git a/agc_2-X/trunk/bin/VICIDIAL_IN_new_leads_file.pl b/agc_2-X/trunk/bin/VICIDIAL_IN_new_leads_file.pl index 6a95a2dc..ddd7807f 100644 --- a/agc_2-X/trunk/bin/VICIDIAL_IN_new_leads_file.pl +++ b/agc_2-X/trunk/bin/VICIDIAL_IN_new_leads_file.pl @@ -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; diff --git a/agc_2-X/trunk/www/agc/astguiclient.php b/agc_2-X/trunk/www/agc/astguiclient.php index 40f10d5e..7424e159 100644 --- a/agc_2-X/trunk/www/agc/astguiclient.php +++ b/agc_2-X/trunk/www/agc/astguiclient.php @@ -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 "\n\n"; exit; } - else +else { if($auth>0) @@ -276,7 +277,7 @@ if (!$authphone) else { echo "astGUIclient web client\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); diff --git a/agc_2-X/trunk/www/agc/inbound_popup.php b/agc_2-X/trunk/www/agc/inbound_popup.php index d1eb5afa..3ebb6c58 100644 --- a/agc_2-X/trunk/www/agc/inbound_popup.php +++ b/agc_2-X/trunk/www/agc/inbound_popup.php @@ -260,22 +260,22 @@ echo "$NOW_TIME

\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";} $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]|"; diff --git a/agc_2-X/trunk/www/agc/park_calls_display.php b/agc_2-X/trunk/www/agc/park_calls_display.php index 58896b3b..55e975df 100644 --- a/agc_2-X/trunk/www/agc/park_calls_display.php +++ b/agc_2-X/trunk/www/agc/park_calls_display.php @@ -117,7 +117,7 @@ echo " 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";} $rslt=mysql_query($stmt, $link); $park_calls_count = mysql_num_rows($rslt); diff --git a/agc_2-X/trunk/www/agc/vdc_db_query.php b/agc_2-X/trunk/www/agc/vdc_db_query.php index 8a78fdff..50c86892 100644 --- a/agc_2-X/trunk/www/agc/vdc_db_query.php +++ b/agc_2-X/trunk/www/agc/vdc_db_query.php @@ -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); diff --git a/agc_2-X/trunk/www/vicidial/AST_timeonVDADallREC.php b/agc_2-X/trunk/www/vicidial/AST_timeonVDADallREC.php index 03ae10f3..fb47cdc5 100644 --- a/agc_2-X/trunk/www/vicidial/AST_timeonVDADallREC.php +++ b/agc_2-X/trunk/www/vicidial/AST_timeonVDADallREC.php @@ -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'"); diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index b40eb28d..cb9a10c4 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -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 diff --git a/agc_2-X/trunk/www/vicidial/admin_search_lead.php b/agc_2-X/trunk/www/vicidial/admin_search_lead.php index b412812c..5bd89ff3 100644 --- a/agc_2-X/trunk/www/vicidial/admin_search_lead.php +++ b/agc_2-X/trunk/www/vicidial/admin_search_lead.php @@ -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"); diff --git a/agc_2-X/trunk/www/vicidial/closer.php b/agc_2-X/trunk/www/vicidial/closer.php index 0e078b70..3069c281 100644 --- a/agc_2-X/trunk/www/vicidial/closer.php +++ b/agc_2-X/trunk/www/vicidial/closer.php @@ -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); diff --git a/agc_2-X/trunk/www/vicidial/closer_dispo.php b/agc_2-X/trunk/www/vicidial/closer_dispo.php index 002f4798..486351a4 100644 --- a/agc_2-X/trunk/www/vicidial/closer_dispo.php +++ b/agc_2-X/trunk/www/vicidial/closer_dispo.php @@ -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 "Comments : \n"; echo "Disposition: \n"; echo "group: \n"; echo "Disposition: \n"; -echo "\n"; -echo "
\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "
User ID Start: $user_start
Number of Lines: (numbers only)
Server IP: $row[3]
External Extension: (number dialed to reach agents [i.e. 913125551212])
Status:
Campaign: $campaign_id
Inbound Groups: \n"; -echo "$groups_list"; -echo "
\n"; -echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; - -} - + echo "
MODIFY A REMOTE AGENTS ENTRY: $row[0]
\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
User ID Start: $user_start
Number of Lines: (numbers only)
Server IP: $row[3]
External Extension: (number dialed to reach agents [i.e. 913125551212])
Status:
Campaign: $campaign_id
Inbound Groups: \n"; + echo "$groups_list"; + echo "
\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 ""; - if ( (strlen($number_of_lines) < 1) or (strlen($conf_exten) < 2) ) + if ( (strlen($number_of_lines) < 1) or (strlen($conf_exten) < 2) ) {echo "
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 "
MODIFY A REMOTE AGENTS ENTRY: $row[0]\n"; -echo "\n"; -echo "\n"; -echo "
\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "
User ID Start: $user_start
Number of Lines: (numbers only)
Server IP: $row[3]
External Extension: (number dialed to reach agents [i.e. 913125551212])
Status:
Campaign: $campaign_id
Inbound Groups: \n"; -echo "$groups_list"; -echo "
\n"; -echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n"; - -} - + echo "
MODIFY A REMOTE AGENTS ENTRY: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
User ID Start: $user_start
Number of Lines: (numbers only)
Server IP: $row[3]
External Extension: (number dialed to reach agents [i.e. 913125551212])
Status:
Campaign: $campaign_id
Inbound Groups: \n"; + echo "$groups_list"; + echo "
\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 "
";
 
-	 if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
+	if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
 		{echo "
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 = "$leadid"; } $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 " - 5 minutes or more on call\n"; - echo " - Over 10 minutes on call\n"; + echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n"; + echo " $i agents logged in on server $server_ip\n\n"; + echo " - 5 minutes or more on call\n"; + echo " - Over 10 minutes on call\n"; } - else + else { echo "**************************************************************************************\n"; echo "********************************* NO AGENTS ON CALLS *********************************\n"; @@ -454,9 +448,8 @@ if ($ADD==61111) } } -echo "
\n\n"; - -} + echo "\n\n"; + } ###################### @@ -464,7 +457,7 @@ echo "\n\n"; ###################### if ($ADD==71111) -{ + { echo "\n"; echo "\n"; echo "\n"; @@ -473,11 +466,10 @@ if ($ADD==71111) echo "\n\n"; echo "
";
 
-	 if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
+	if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
 		{echo "
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 " - 5 minutes or more on call\n"; - # echo " - Over 10 minutes on call\n"; + echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n"; +# echo " $i agents logged in on server $server_ip\n\n"; +# echo " - 5 minutes or more on call\n"; +# echo " - Over 10 minutes on call\n"; } - else + else { echo "**************************************************************************************\n"; echo "********************************* NO CALLS ON THIS DAY *******************************\n"; @@ -566,9 +557,8 @@ if ($ADD==71111) } } -echo "
\n\n"; - -} + echo "\n\n"; + } @@ -599,7 +589,3 @@ exit; ?> - - - -