From ed5cce759f00b8dae9e3dad62c26a0591ed2221d Mon Sep 17 00:00:00 2001 From: mattf Date: Wed, 12 Aug 2009 05:44:35 +0000 Subject: [PATCH] Fixed extended alt dial bug in agent scripts Changed agent screen to not delete session reservations at logout, instead ADMIN_keepalive will clear them out once a day at timeclock reset time Changed callback purge to clear out ACTIVE callbacks older than month/week as well as LIVE git-svn-id: svn://192.168.202.10@1202 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/UPGRADE | 5 + agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl | 79 ++++++++++- .../trunk/bin/ADMIN_timeclock_auto_logout.pl | 125 ++++++++--------- agc_2-X/trunk/bin/AST_conf_update.pl | 127 +++++++++--------- agc_2-X/trunk/docs/REQUIRED_APPS_INSTALL.txt | 18 +-- agc_2-X/trunk/www/agc/vdc_db_query.php | 88 +++++++++++- agc_2-X/trunk/www/agc/vicidial.php | 7 +- agc_2-X/trunk/www/vicidial/admin.php | 16 +-- 8 files changed, 313 insertions(+), 152 deletions(-) diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index 99573c73..9205b697 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -193,6 +193,11 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom in "state"(INCALL, READY, PAUSED, etc...) instead of being based upon the time of the last call they handled. +49. Changed the ViciDial agent screen to not delete session reservations by + default at agent logout. Instead, the ADMIN_keepalive process will clear + out unused session reservations once a day at the timeclock reset time + as set in system_settings. + diff --git a/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl b/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl index bd7fd1f5..67dfd991 100644 --- a/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl +++ b/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl @@ -8,6 +8,7 @@ # # Other functions of this program: # - Launches the timeclock auto-logout process +# - clear out non-used vicidial_conferences sessions # - Generates Asterisk conf files and reloads Asterisk # - Synchronizes the audio store files # - Runs trigger processes at defined times @@ -37,6 +38,7 @@ # 90630-2259 - Added vicidial_process_triggers functionality # 90713-0140 - Changed direct dial phone extensions to failover to voicemail forwarder # 90722-1102 - Added list reset by time option +# 90812-0053 - Added clear out non-used vicidial_conferences sessions # $DB=0; # Debug flag @@ -49,7 +51,7 @@ $mon++; $wtoday = $wday; if ($mon < 10) {$mon = "0$mon";} if ($mday < 10) {$mday = "0$mday";} -if ($hour < 10) {$Fhour = "0$hour";} +if ($hour < 10) {$hour = "0$hour";} if ($min < 10) {$min = "0$min";} if ($sec < 10) {$sec = "0$sec";} $now_date = "$year-$mon-$mday $hour:$min:$sec"; @@ -478,10 +480,8 @@ if ($timeclock_auto_logout > 0) - - ################################################################################ -##### START Creation of auto-generated conf files +##### START clear out non-used vicidial_conferences sessions ################################################################################ # default path to astguiclient configuration file: @@ -525,6 +525,77 @@ use DBI; $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") or die "Couldn't connect to database: " . DBI->errstr; +$timeclock_end_of_day_NOW=0; +### Grab system_settings values from the database + $stmtA = "SELECT count(*) from system_settings where timeclock_end_of_day LIKE \"%$reset_test%\";"; + if ($DB) {print "|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $timeclock_end_of_day_NOW = "$aryA[0]"; + } + $sthA->finish(); + +if ($timeclock_end_of_day_NOW > 0) + { + if ($DB) {print "Starting clear out non-used vicidial_conferences sessions process...\n";} + + $stmtA = "SELECT conf_exten,extension from vicidial_conferences where server_ip='$server_ip' and leave_3way='0';"; + if ($DB) {print "|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $VCexten_ct=$sthA->rows; + $rec_count=0; + while ($VCexten_ct > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $PT_conf_extens[$rec_count] = $aryA[0]; + $PT_extensions[$rec_count] = $aryA[1]; + if ($DBX) {print "|$PT_conf_extens[$rec_count]|$PT_extensions[$rec_count]|\n";} + $rec_count++; + } + $sthA->finish(); + $k=0; + while ($k < $rec_count) + { + $live_session=0; + $stmtA = "SELECT count(*) from vicidial_live_agents where conf_exten='$PT_conf_extens[$k]' and server_ip='$server_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $live_session = "$aryA[0]"; + } + $sthA->finish(); + + if ($live_session < 1) + { + $stmtA = "UPDATE vicidial_conferences set extension='' where server_ip='$server_ip' and conf_exten='$PT_conf_extens[$k]';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n"; + } + $k++; + } + + } + +################################################################################ +##### END clear out non-used vicidial_conferences sessions +################################################################################ + + + + + +################################################################################ +##### START Creation of auto-generated conf files +################################################################################ + ##### Get the settings from system_settings ##### $stmtA = "SELECT sounds_central_control_active,active_voicemail_server FROM system_settings;"; # print "$stmtA\n"; diff --git a/agc_2-X/trunk/bin/ADMIN_timeclock_auto_logout.pl b/agc_2-X/trunk/bin/ADMIN_timeclock_auto_logout.pl index f19f0d97..225b33b8 100644 --- a/agc_2-X/trunk/bin/ADMIN_timeclock_auto_logout.pl +++ b/agc_2-X/trunk/bin/ADMIN_timeclock_auto_logout.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# ADMIN_timeclock_auto_logout.pl version 2.0.5 *DBI-version* +# ADMIN_timeclock_auto_logout.pl version 2.2.0 *DBI-version* # # DESCRIPTION: # forces logout of all users still logged into the timeclock @@ -8,11 +8,12 @@ # This script is launched by the ADMIN_keepalive_ALL.pl script with the '9' flag # defined in astguiclient.conf # -# Copyright (C) 2008 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2009 Matt Florell LICENSE: AGPLv2 # # CHANGELOG # 80526-0958 - First Build -# 80604-0733 - fixed minor bug in update +# 80604-0733 - Fixed minor bug in update +# 90812-0103 - Formatting fixes # # constants @@ -38,47 +39,47 @@ $HHMM = "$hour$min"; ### 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 [--force-run] = force run even if already run for the day\n\n"; - exit; - } + { + print "allowed run time options(must stay in this order):\n [--debug] = debug\n [--debugX] = super debug\n [-t] = test\n [--force-run] = force run even if already run for the day\n\n"; + exit; + } else - { + { if ($args =~ /--force-run/i) - { - $force_run=1; - print "\n----- FORCE RUN -----\n\n"; - } + { + $force_run=1; + print "\n----- FORCE RUN -----\n\n"; + } 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'; @@ -135,13 +136,13 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA $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++; + @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(); @@ -152,9 +153,9 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA $sthArows=$sthA->rows; if ($sthArows > 0) { - @aryA = $sthA->fetchrow_array; - $timeclock_end_of_day = "$aryA[0]"; - $timeclock_last_reset_date = "$aryA[1]"; + @aryA = $sthA->fetchrow_array; + $timeclock_end_of_day = "$aryA[0]"; + $timeclock_last_reset_date = "$aryA[1]"; } $sthA->finish(); @@ -165,7 +166,7 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA $nowtest = ($HHMM+0); $logtest = ($timeclock_end_of_day+0); if ( ($force_run > 0) || ( ($nowtest >= $logtest) && ($timeclock_last_reset_date ne "$file_date") ) ) -{ + { @user=@MT; ### grab users that are currently logged-in to the timeclock @@ -239,20 +240,20 @@ if ( ($force_run > 0) || ( ($nowtest >= $logtest) && ($timeclock_last_reset_date $event_string = "SYSTEM SETTINGS UPDATE|$affected_rows|$stmtA|"; &event_logger; -} + } else -{ -print "cannot run: |$force_run|$HHMM($nowtest)|$timeclock_end_of_day($logtest)|$timeclock_last_reset_date|$file_date|\n"; -} + { + print "cannot run: |$force_run|$HHMM($nowtest)|$timeclock_end_of_day($logtest)|$timeclock_last_reset_date|$file_date|\n"; + } 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";} + } $dbhA->disconnect(); @@ -261,15 +262,15 @@ 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_conf_update.pl b/agc_2-X/trunk/bin/AST_conf_update.pl index 95037d23..6087ba30 100644 --- a/agc_2-X/trunk/bin/AST_conf_update.pl +++ b/agc_2-X/trunk/bin/AST_conf_update.pl @@ -22,36 +22,36 @@ $MT[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 [-t] = test\n [-debug] = verbose debug messages\n\n"; - } + { + print "allowed run time options:\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } else - { + { if ($args =~ /-debug/i) - { - $DB=1; # Debug flag - print "-- DEBUGGING ENABLED --\n\n"; - } + { + $DB=1; # Debug flag + print "-- DEBUGGING ENABLED --\n\n"; + } if ($args =~ /-t/i) - { - $TEST=1; - $T=1; + { + $TEST=1; + $T=1; + } } } -} else -{ -# print "no command line options set\n"; -} + { + # print "no command line options set\n"; + } ### end parsing run-time options ### # default path to astguiclient configuration file: @@ -113,29 +113,29 @@ $sthArows=$sthA->rows; $rec_count=0; if ($sthArows > 0) { - @aryA = $sthA->fetchrow_array; - $DBtelnet_host = "$aryA[0]"; - $DBtelnet_port = "$aryA[1]"; - $DBASTmgrUSERNAME = "$aryA[2]"; - $DBASTmgrSECRET = "$aryA[3]"; - $DBASTmgrUSERNAMEupdate = "$aryA[4]"; - $DBASTmgrUSERNAMElisten = "$aryA[5]"; - $DBASTmgrUSERNAMEsend = "$aryA[6]"; - $DBmax_vicidial_trunks = "$aryA[7]"; - $DBanswer_transfer_agent= "$aryA[8]"; - $DBSERVER_GMT = "$aryA[9]"; - $DBext_context = "$aryA[10]"; - if ($DBtelnet_host) {$telnet_host = $DBtelnet_host;} - if ($DBtelnet_port) {$telnet_port = $DBtelnet_port;} - if ($DBASTmgrUSERNAME) {$ASTmgrUSERNAME = $DBASTmgrUSERNAME;} - if ($DBASTmgrSECRET) {$ASTmgrSECRET = $DBASTmgrSECRET;} - if ($DBASTmgrUSERNAMEupdate) {$ASTmgrUSERNAMEupdate = $DBASTmgrUSERNAMEupdate;} - if ($DBASTmgrUSERNAMElisten) {$ASTmgrUSERNAMElisten = $DBASTmgrUSERNAMElisten;} - if ($DBASTmgrUSERNAMEsend) {$ASTmgrUSERNAMEsend = $DBASTmgrUSERNAMEsend;} - if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} - if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} - if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} - if ($DBext_context) {$ext_context = $DBext_context;} + @aryA = $sthA->fetchrow_array; + $DBtelnet_host = "$aryA[0]"; + $DBtelnet_port = "$aryA[1]"; + $DBASTmgrUSERNAME = "$aryA[2]"; + $DBASTmgrSECRET = "$aryA[3]"; + $DBASTmgrUSERNAMEupdate = "$aryA[4]"; + $DBASTmgrUSERNAMElisten = "$aryA[5]"; + $DBASTmgrUSERNAMEsend = "$aryA[6]"; + $DBmax_vicidial_trunks = "$aryA[7]"; + $DBanswer_transfer_agent= "$aryA[8]"; + $DBSERVER_GMT = "$aryA[9]"; + $DBext_context = "$aryA[10]"; + if ($DBtelnet_host) {$telnet_host = $DBtelnet_host;} + if ($DBtelnet_port) {$telnet_port = $DBtelnet_port;} + if ($DBASTmgrUSERNAME) {$ASTmgrUSERNAME = $DBASTmgrUSERNAME;} + if ($DBASTmgrSECRET) {$ASTmgrSECRET = $DBASTmgrSECRET;} + if ($DBASTmgrUSERNAMEupdate) {$ASTmgrUSERNAMEupdate = $DBASTmgrUSERNAMEupdate;} + if ($DBASTmgrUSERNAMElisten) {$ASTmgrUSERNAMElisten = $DBASTmgrUSERNAMElisten;} + if ($DBASTmgrUSERNAMEsend) {$ASTmgrUSERNAMEsend = $DBASTmgrUSERNAMEsend;} + if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} + if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} + if ($DBext_context) {$ext_context = $DBext_context;} } $sthA->finish(); @@ -163,14 +163,14 @@ if ($Tmday < 10) {$Tmday = "0$Tmday";} if ($Thour < 10) {$Thour = "0$Thour";} if ($Tmin < 10) {$Tmin = "0$Tmin";} if ($Tsec < 10) {$Tsec = "0$Tsec";} - $TDSQLdate = "$Tyear-$Tmon-$Tmday $Thour:$Tmin:$Tsec"; - $TDnum = "$Tyear$Tmon$Tmday$Thour$Tmin$Tsec"; +$TDSQLdate = "$Tyear-$Tmon-$Tmday $Thour:$Tmin:$Tsec"; +$TDnum = "$Tyear$Tmon$Tmday$Thour$Tmin$Tsec"; ###################################################################### ##### CLEAR vicidial_conferences ENTRIES IN LEAVE-3WAY FOR MORE THAN ONE HOUR ###################################################################### @PTextensions=@MT; @PT_conf_extens=@MT; @PTmessages=@MT; @PTold_messages=@MT; @NEW_messages=@MT; @OLD_messages=@MT; -$stmtA = "SELECT conf_exten from vicidial_conferences where server_ip='$server_ip' and leave_3way='1' and leave_3way_datetime < \"$TDSQLdate\";"; +$stmtA = "SELECT conf_exten,extension from vicidial_conferences where server_ip='$server_ip' and leave_3way='1' and leave_3way_datetime < \"$TDSQLdate\";"; if ($DB) {print "|$stmtA|\n";} $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -180,7 +180,8 @@ while ($sthArows > $rec_count) { @aryA = $sthA->fetchrow_array; $PT_conf_extens[$rec_count] = "$aryA[0]"; - if ($DB) {print "|$PT_conf_extens[$rec_count]|$PTextensions[$rec_count]|\n";} + $PT_extensions[$rec_count] = "$aryA[0]"; + if ($DB) {print "|$PT_conf_extens[$rec_count]|$PT_extensions[$rec_count]|\n";} $rec_count++; } $sthA->finish(); @@ -217,13 +218,13 @@ $sthArows=$sthA->rows; $rec_count=0; while ($sthArows > $rec_count) { - @aryA = $sthA->fetchrow_array; - $PTextensions[$rec_count] = "$aryA[0]"; - $PT_conf_extens[$rec_count] = "$aryA[1]"; - if ($DB) {print "|$PT_conf_extens[$rec_count]|$PTextensions[$rec_count]|\n";} - $rec_count++; - } - $sthA->finish(); + @aryA = $sthA->fetchrow_array; + $PTextensions[$rec_count] = "$aryA[0]"; + $PT_conf_extens[$rec_count] = "$aryA[1]"; + if ($DB) {print "|$PT_conf_extens[$rec_count]|$PTextensions[$rec_count]|\n";} + $rec_count++; + } +$sthA->finish(); if (!$telnet_port) {$telnet_port = '5038';} @@ -333,13 +334,13 @@ $sthArows=$sthA->rows; $rec_count=0; while ($sthArows > $rec_count) { - @aryA = $sthA->fetchrow_array; - $PTextensions[$rec_count] = "$aryA[0]"; - $PT_conf_extens[$rec_count] = "$aryA[1]"; - if ($DB) {print "|$PT_conf_extens[$rec_count]|$PTextensions[$rec_count]|\n";} - $rec_count++; - } - $sthA->finish(); + @aryA = $sthA->fetchrow_array; + $PTextensions[$rec_count] = "$aryA[0]"; + $PT_conf_extens[$rec_count] = "$aryA[1]"; + if ($DB) {print "|$PT_conf_extens[$rec_count]|$PTextensions[$rec_count]|\n";} + $rec_count++; + } +$sthA->finish(); if (!$telnet_port) {$telnet_port = '5038';} @@ -348,8 +349,8 @@ $t = new Net::Telnet (Port => $telnet_port, Prompt => '/.*[\$%#>] $/', Output_record_separator => '',); #$fh = $t->dump_log("$telnetlog"); # uncomment for telnet log - if (length($ASTmgrUSERNAMEsend) > 3) {$telnet_login = $ASTmgrUSERNAMEsend;} - else {$telnet_login = $ASTmgrUSERNAME;} +if (length($ASTmgrUSERNAMEsend) > 3) {$telnet_login = $ASTmgrUSERNAMEsend;} +else {$telnet_login = $ASTmgrUSERNAME;} $t->open("$telnet_host"); $t->waitfor('/[01]\n$/'); # print login diff --git a/agc_2-X/trunk/docs/REQUIRED_APPS_INSTALL.txt b/agc_2-X/trunk/docs/REQUIRED_APPS_INSTALL.txt index b76d4136..8dab16a9 100644 --- a/agc_2-X/trunk/docs/REQUIRED_APPS_INSTALL.txt +++ b/agc_2-X/trunk/docs/REQUIRED_APPS_INSTALL.txt @@ -193,13 +193,13 @@ make install cd /usr/local -wget http://us2.php.net/distributions/php-5.2.9.tar.gz -gunzip php-5.2.9.tar.gz -tar xvf php-5.2.9.tar -wget http://mirror.nyi.net/apache/httpd/httpd-2.2.11.tar.gz -gunzip httpd-2.2.11.tar.gz -tar xvf httpd-2.2.11.tar -cd httpd-2.2.11 +wget http://us2.php.net/distributions/php-5.2.10.tar.gz +gunzip php-5.2.10.tar.gz +tar xvf php-5.2.10.tar +wget http://mirror.nyi.net/apache/httpd/httpd-2.2.13.tar.gz +gunzip httpd-2.2.13.tar.gz +tar xvf httpd-2.2.13.tar +cd httpd-2.2.13 make clean ./configure --prefix=/usr/local/apache2 --enable-ssl --enable-setenvif --enable-so --with-apxs2 --enable-dav --enable-maintainer-mode --with-ssl=/usr/local/ssl make @@ -213,9 +213,9 @@ openssl req -new -x509 -days 1200 -keyout /usr/local/apache2/conf/ssl.key/server openssl rsa -in /usr/local/apache2/conf/ssl.key/server.key.cpy -out /usr/local/apache2/conf/ssl.key/server.key -cd ../php-5.2.9 +cd ../php-5.2.10 make clean -./configure --with-mysql=/usr/local/mysql --enable-inline-optimization --enable-memory-limit --enable-track-vars --enable-libgcc --enable-sysvsem --with-openssl=/usr/local/ssl --with-apxs2=/usr/local/apache2/bin/apxs --with-zlib +./configure --with-mysql=/usr/local/mysql --enable-inline-optimization --enable-memory-limit --enable-track-vars --enable-libgcc --enable-sysvsem --with-openssl=/usr/local/ssl --with-apxs2=/usr/local/apache2/bin/apxs --with-zlib --enable-mbstring make make install cp php.ini-dist /usr/local/lib/php.ini 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 1ec810a3..cbdcf439 100644 --- a/agc_2-X/trunk/www/agc/vdc_db_query.php +++ b/agc_2-X/trunk/www/agc/vdc_db_query.php @@ -383,6 +383,8 @@ if (isset($_GET["vtiger_callback_id"])) {$vtiger_callback_id=$_GET["vtiger_ca elseif (isset($_POST["vtiger_callback_id"])) {$vtiger_callback_id=$_POST["vtiger_callback_id"];} if (isset($_GET["dial_method"])) {$dial_method=$_GET["dial_method"];} elseif (isset($_POST["dial_method"])) {$dial_method=$_POST["dial_method"];} +if (isset($_GET["no_delete_sessions"])) {$no_delete_sessions=$_GET["no_delete_sessions"];} + elseif (isset($_POST["no_delete_sessions"])) {$no_delete_sessions=$_POST["no_delete_sessions"];} header ("Content-type: text/html; charset=utf-8"); @@ -3278,7 +3280,46 @@ if ($ACTION == 'VDADcheckINCOMING') $dialed_label =$row[2]; $call_type =$row[3]; if ( ($dialed_number != $phone_number) and (strlen($dialed_label) < 3) ) - {$dialed_label = 'ALT';} + { + if ($dialed_number != $alt_phone) + { + if ($dialed_number != $address3) + { + $dialed_label = 'X1'; + $stmt = "SELECT alt_phone_count from vicidial_list_alt_phones where lead_id='$lead_id' and phone_number = '$dialed_number' order by alt_phone_count limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + $VDAP_cid_ct = mysql_num_rows($rslt); + if ($VDACP_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $Xalt_phone_count =$row[0]; + + $stmt = "SELECT count(*) from vicidial_list_alt_phones where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + $VDAPct_cid_ct = mysql_num_rows($rslt); + if ($VDACPct_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $COUNTalt_phone_count =$row[0]; + + if ($COUNTalt_phone_count <= $Xalt_phone_count) + {$dialed_label = 'XLAST';} + else + {$dialed_label = "X$Xalt_phone_count";} + } + + } + } + else + {$dialed_label = 'ADDR3';} + } + else + {$dialed_label = 'ALT';} + } } else { @@ -3915,7 +3956,7 @@ if ($ACTION == 'updateDISPO') $user_group = "$row[0]"; } - $stmt = "SELECT list_id,phone_number,phone_code FROM vicidial_list where lead_id='$lead_id';"; + $stmt = "SELECT list_id,phone_number,phone_code,alt_phone,address3 FROM vicidial_list where lead_id='$lead_id';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00216',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -3928,6 +3969,8 @@ if ($ACTION == 'updateDISPO') { $VLphone_number = "$row[1]"; $VLalt = 'MAIN'; + $VLalt_phone = "$row[3]"; + $VLaddress3 = "$row[4]"; } else { @@ -3935,7 +3978,46 @@ if ($ACTION == 'updateDISPO') if ($phone_number == "$row[1]") {$VLalt = 'MAIN';} else - {$VLalt = 'ALT';} + { + if ($phone_number != $VLalt_phone) + { + if ($phone_number != $VLaddress3) + { + $VLalt = 'X1'; + $stmt = "SELECT alt_phone_count from vicidial_list_alt_phones where lead_id='$lead_id' and phone_number = '$dialed_number' order by alt_phone_count limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + $VDAP_cid_ct = mysql_num_rows($rslt); + if ($VDACP_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $Xalt_phone_count =$row[0]; + + $stmt = "SELECT count(*) from vicidial_list_alt_phones where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + $VDAPct_cid_ct = mysql_num_rows($rslt); + if ($VDACPct_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $COUNTalt_phone_count =$row[0]; + + if ($COUNTalt_phone_count <= $Xalt_phone_count) + {$VLalt = 'XLAST';} + else + {$VLalt = "X$Xalt_phone_count";} + } + + } + } + else + {$VLalt = 'ADDR3';} + } + else + {$VLalt = 'ALT';} + } } if (strlen($phone_code)<1) {$VLphone_code = "$row[2]";} diff --git a/agc_2-X/trunk/www/agc/vicidial.php b/agc_2-X/trunk/www/agc/vicidial.php index 19b9a8cf..fba0ca44 100644 --- a/agc_2-X/trunk/www/agc/vicidial.php +++ b/agc_2-X/trunk/www/agc/vicidial.php @@ -244,10 +244,11 @@ # 90729-0647 - Added agent_display_dialable_leads option # 90730-0145 - Fixed bugs in re-queue and INBOUND_MAN with blended selected # 90808-0117 - Fixed manual dial calls today bug, added last_state_change to vicidial_live_agents +# 90812-0046 - Added no-delete-sessions = 1 as default, unused sessions cleared out at timeclock end of day # -$version = '2.2.0-222'; -$build = '90808-0117'; +$version = '2.2.0-223'; +$build = '90812-0046'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=61; $one_mysql_log=0; @@ -368,7 +369,7 @@ $show_campname_pulldown = '1'; # set to 1 to show campaign name on login pulldow $webform_sessionname = '1'; # set to 1 to include the session_name in webform URL $local_consult_xfers = '1'; # set to 1 to send consultative transfers from original server $clientDST = '1'; # set to 1 to check for DST on server for agent time -$no_delete_sessions = '0'; # set to 1 to not delete sessions at logout +$no_delete_sessions = '1'; # set to 1 to not delete sessions at logout $volumecontrol_active = '1'; # set to 1 to allow agents to alter volume of channels $PreseT_DiaL_LinKs = '0'; # set to 1 to show a DIAL link for Dial Presets $LogiNAJAX = '1'; # set to 1 to do lookups on campaigns for login diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index f828ab4a..001f6255 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -21332,13 +21332,13 @@ if ($ADD==8) { if ($SUB==89) { - $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user='$user' and status='LIVE' and callback_time < '$past_month_date';"; + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user='$user' and status IN('LIVE','ACTIVE') and callback_time < '$past_month_date';"; $rslt=mysql_query($stmt, $link); echo "
User($user) callback listings LIVE for more than one month have been made INACTIVE\n"; } if ($SUB==899) { - $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user='$user' and status='LIVE' and callback_time < '$past_week_date';"; + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user='$user' and status IN('LIVE','ACTIVE') and callback_time < '$past_week_date';"; $rslt=mysql_query($stmt, $link); echo "
User($user) callback listings LIVE for more than one week have been made INACTIVE\n"; } @@ -21363,13 +21363,13 @@ if ($ADD==81) { if ($SUB==89) { - $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where campaign_id='$campaign_id' and status='LIVE' and callback_time < '$past_month_date';"; + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where campaign_id='$campaign_id' and status IN('LIVE','ACTIVE') and callback_time < '$past_month_date';"; $rslt=mysql_query($stmt, $link); echo "
campaign($campaign_id) callback listings LIVE for more than one month have been made INACTIVE\n"; } if ($SUB==899) { - $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where campaign_id='$campaign_id' and status='LIVE' and callback_time < '$past_week_date';"; + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where campaign_id='$campaign_id' and status IN('LIVE','ACTIVE') and callback_time < '$past_week_date';"; $rslt=mysql_query($stmt, $link); echo "
campaign($campaign_id) callback listings LIVE for more than one week have been made INACTIVE\n"; } @@ -21394,13 +21394,13 @@ if ($ADD==811) { if ($SUB==89) { - $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where list_id='$list_id' and status='LIVE' and callback_time < '$past_month_date';"; + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where list_id='$list_id' and status IN('LIVE','ACTIVE') and callback_time < '$past_month_date';"; $rslt=mysql_query($stmt, $link); echo "
list($list_id) callback listings LIVE for more than one month have been made INACTIVE\n"; } if ($SUB==899) { - $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where list_id='$list_id' and status='LIVE' and callback_time < '$past_week_date';"; + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where list_id='$list_id' and status IN('LIVE','ACTIVE') and callback_time < '$past_week_date';"; $rslt=mysql_query($stmt, $link); echo "
list($list_id) callback listings LIVE for more than one week have been made INACTIVE\n"; } @@ -21425,13 +21425,13 @@ if ($ADD==8111) { if ($SUB==89) { - $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user_group='$user_group' and status='LIVE' and callback_time < '$past_month_date';"; + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user_group='$user_group' and status IN('LIVE','ACTIVE') and callback_time < '$past_month_date';"; $rslt=mysql_query($stmt, $link); echo "
user group($user_group) callback listings LIVE for more than one month have been made INACTIVE\n"; } if ($SUB==899) { - $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user_group='$user_group' and status='LIVE' and callback_time < '$past_week_date';"; + $stmt="UPDATE vicidial_callbacks SET status='INACTIVE' where user_group='$user_group' and status IN('LIVE','ACTIVE') and callback_time < '$past_week_date';"; $rslt=mysql_query($stmt, $link); echo "
user group($user_group) callback listings LIVE for more than one week have been made INACTIVE\n"; }