diff --git a/agc_2-X/trunk/docs/REQUIRED_APPS_INSTALL.txt b/agc_2-X/trunk/docs/REQUIRED_APPS_INSTALL.txt index 47ba30e4..bb5c1d61 100644 --- a/agc_2-X/trunk/docs/REQUIRED_APPS_INSTALL.txt +++ b/agc_2-X/trunk/docs/REQUIRED_APPS_INSTALL.txt @@ -149,10 +149,10 @@ cd zlib-1.2.3 make make install cd /usr/local -wget http://gulus.usherbrooke.ca/pub/appl/ssh/OpenSSH/portable/openssh-4.7p1.tar.gz -gunzip openssh-4.7p1.tar.gz -tar xvf openssh-4.7p1.tar -cd openssh-4.7p1 +wget http://ftp.openssh.zone-h.org/pub/OpenBSD/OpenSSH/portable/openssh-5.0p1.tar.gz +gunzip openssh-5.0p1.tar.gz +tar xvf openssh-5.0p1.tar +cd openssh-5.0p1 ./configure make make install @@ -189,13 +189,14 @@ make install cd /usr/local -wget http://mirror.candidhosting.com/pub/apache/httpd/httpd-2.0.61.tar.gz -gunzip httpd-2.0.61.tar.gz -tar xvf httpd-2.0.61.tar -wget http://us2.php.net/distributions/php-4.4.8.tar.gz -gunzip php-4.4.8.tar.gz -tar xvf php-4.4.8.tar -cd httpd-2.0.61 +wget http://mirror.candidhosting.com/pub/apache/httpd/httpd-2.2.8.tar.gz +gunzip httpd-2.2.8.tar.gz +tar xvf httpd-2.2.8.tar +wget http://us2.php.net/distributions/php-5.2.6.tar.gz +gunzip php-5.2.6.tar.gz +tar xvf php-5.2.6.tar +cd httpd-2.2.8 +make clean ./configure --prefix=/usr/local/apache2 --enable-ssl --enable-setenvif --enable-so --with-apxs2 --enable-dav --enable-maintainer-mode make make install @@ -208,8 +209,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-4.4.8 -./configure --with-mysql=/usr/local/mysql --enable-inline-optimization --enable-memory-limit --enable-track-vars --enable-libgcc --with-xml --enable-versioning --enable-sysvsem --with-openssl --disable-debug --with-apxs2=/usr/local/apache2/bin/apxs --with-zlib +cd ../php-5.2.6 +make clean +./configure --with-mysql=/usr/local/mysql --enable-inline-optimization --enable-memory-limit --enable-track-vars --enable-libgcc --enable-sysvsem --with-openssl --with-apxs2=/usr/local/apache2/bin/apxs --with-zlib make make install cp php.ini-dist /usr/local/lib/php.ini @@ -218,9 +220,9 @@ vi /usr/local/apache2/conf/httpd.conf add the following lines: "AddType application/x-httpd-php .php .phtml" - "LoadModule php4_module libexec/libphp4.so" + "LoadModule php5_module modules/libphp5.so" or - "LoadModule php4_module module/libphp4.so" + "LoadModule php5_module modules/libphp5.so" modify the index.html line and add index.php to the list to disable logging, change: @@ -251,10 +253,8 @@ vi /usr/local/apache2/conf/httpd.conf vi /usr/local/lib/php.ini - modify the following line: - "memory_limit = 8M" - and change it to: - "memory_limit = 48M" + Make sure short tags are enabled: + "short_open_tag = On" some other fields to change if using web-based lead loader: max_execution_time = 330 @@ -278,7 +278,7 @@ vi /usr/local/lib/php.ini Add the following lines to the dynamic extensions section of php.ini: (you may need to change the extension location depending on your install of php) -extension="../../../usr/local/eaccelerator-0.9.5/modules/eaccelerator.so" +zend_extension="../../../usr/local/eaccelerator-0.9.5/modules/eaccelerator.so" eaccelerator.shm_size="48" eaccelerator.cache_dir="/tmp/eaccelerator" eaccelerator.enable="1" @@ -293,9 +293,9 @@ eaccelerator.shm_only="0" eaccelerator.compress="1" eaccelerator.compress_level="9" - mkdir /tmp/eaccelerator chmod 0777 /tmp/eaccelerator +ls -l /tmp/eaccelerator php -v /usr/local/apache2/bin/apachectl startssl diff --git a/agc_2-X/trunk/docs/SCRATCH_INSTALL.txt b/agc_2-X/trunk/docs/SCRATCH_INSTALL.txt index 82625eaa..43e0a986 100644 --- a/agc_2-X/trunk/docs/SCRATCH_INSTALL.txt +++ b/agc_2-X/trunk/docs/SCRATCH_INSTALL.txt @@ -648,10 +648,10 @@ updated on your system, so we're going to install a new version now. - make - make install - cd /usr/local - - wget http://gulus.usherbrooke.ca/pub/appl/ssh/OpenSSH/portable/openssh-4.7p1.tar.gz - - gunzip openssh-4.7p1.tar.gz - - tar xvf openssh-4.7p1.tar - - cd openssh-4.7p1 + - wget http://ftp.openssh.zone-h.org/pub/OpenBSD/OpenSSH/portable/openssh-5.0p1.tar.gz + - gunzip openssh-5.0p1.tar.gz + - tar xvf openssh-5.0p1.tar + - cd openssh-5.0p1 - ./configure - make - make install @@ -686,26 +686,28 @@ installation on another machine) Go to http://www.php.net/ and download the php unix source code - to install this directly on the command line type: - cd /usr/local - - wget http://mirror.candidhosting.com/pub/apache/httpd/httpd-2.0.61.tar.gz - - gunzip httpd-2.0.61.tar.gz - - tar xvf httpd-2.0.61.tar - - wget http://us2.php.net/distributions/php-4.4.8.tar.gz + - wget http://mirror.candidhosting.com/pub/apache/httpd/httpd-2.2.8.tar.gz + - gunzip httpd-2.2.8.tar.gz + - tar xvf httpd-2.2.8.tar + - wget http://us2.php.net/distributions/php-5.2.6.tar.gz NOTE: PHP 5.1.1 has also been tested with this release - - gunzip php-4.4.8.tar.gz - - tar xvf php-4.4.8.tar - - cd httpd-2.0.61 + - gunzip php-5.2.6.tar.gz + - tar xvf php-5.2.6.tar + - cd httpd-2.2.8 - ./configure --enable-so --with-apxs2 - make - make install - - cd ../php-4.4.8 + - cd ../php-5.2.6 - ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql - make - make install - cp php.ini-dist /usr/local/lib/php.ini NOTE: you will want to make sure NOTICE logging is turned off: error_reporting = E_ALL & ~E_NOTICE ; (this is default) -!!! REQUIRED !!! raise the memory limit for scripts in php.ini: +!!! REQUIRED !!! be sure the memory limit for scripts in php.ini is AT LEAST 48M: memory_limit = 48M + Make sure short tags are enabled: + short_open_tag = On some other fields to change if using web-based lead loader: max_execution_time = 330 max_input_time = 360 @@ -716,9 +718,9 @@ installation on another machine) - vi /usr/local/apache2/conf/httpd.conf add the following lines: "AddType application/x-httpd-php .php .phtml" - "LoadModule php4_module libexec/libphp4.so" + "LoadModule php4_module libexec/libphp5.so" or - "LoadModule php4_module modules/libphp4.so" + "LoadModule php4_module modules/libphp5.so" modify the index.html line and add index.php to the list to disable logging, change: @@ -763,7 +765,7 @@ installation on another machine) - vi /usr/local/lib/php.ini Add the following lines to the dynamic extensions section of php.ini: (you may need to change the extension location depending on your install of php) - extension="../../../usr/local/eaccelerator-0.9.5/modules/eaccelerator.so" + zend_extension="../../../usr/local/eaccelerator-0.9.5/modules/eaccelerator.so" eaccelerator.shm_size="48" eaccelerator.cache_dir="/tmp/eaccelerator" eaccelerator.enable="1" diff --git a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql index 238990db..3af9fbe0 100644 --- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql +++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql @@ -1063,6 +1063,13 @@ index (campaign_group_id), index (stat_date) ); + CREATE TABLE phones_alias ( +alias_id VARCHAR(20) NOT NULL UNIQUE PRIMARY KEY, +alias_name VARCHAR(50), +logins_list VARCHAR(255) +); + + ALTER TABLE vicidial_campaign_server_stats ENGINE=HEAP; ALTER TABLE live_channels ENGINE=HEAP; @@ -1109,4 +1116,4 @@ INSERT INTO vicidial_state_call_times SET state_call_time_id='utah',state_call_t INSERT INTO vicidial_state_call_times SET state_call_time_id='washington',state_call_time_state='WA',state_call_time_name='Washington 8am',sct_default_start='800',sct_default_stop='2100'; INSERT INTO vicidial_state_call_times SET state_call_time_id='wyoming',state_call_time_state='WY',state_call_time_name='Wyoming 8am-8pm',sct_default_start='800',sct_default_stop='2000'; -UPDATE system_settings SET db_schema_version='1082'; +UPDATE system_settings SET db_schema_version='1083'; diff --git a/agc_2-X/trunk/extras/upgrade_2.0.5.sql b/agc_2-X/trunk/extras/upgrade_2.0.5.sql index 358b28a9..b0d5c0ac 100644 --- a/agc_2-X/trunk/extras/upgrade_2.0.5.sql +++ b/agc_2-X/trunk/extras/upgrade_2.0.5.sql @@ -126,3 +126,11 @@ ALTER TABLE vicidial_inbound_groups MODIFY after_hours_action ENUM('HANGUP','MES ALTER TABLE vicidial_inbound_groups ADD afterhours_xfer_group VARCHAR(20) default '---NONE---'; UPDATE system_settings SET db_schema_version='1082'; + + CREATE TABLE phones_alias ( +alias_id VARCHAR(20) NOT NULL UNIQUE PRIMARY KEY, +alias_name VARCHAR(50), +logins_list VARCHAR(255) +); + +UPDATE system_settings SET db_schema_version='1083'; diff --git a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt index d3ce66e0..61cc3e3e 100644 --- a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt +++ b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt @@ -78,6 +78,39 @@ CALL HANGUP REASON STATS|| After Hours Action -<\/B> The action to perform if it is after hours as defined in the call time for this inbound group. HANGUP will immediately hangup the call, MESSASGE will play the file in the After Hours Message Filenam field, EXTENSION will send the call to the After Hours Extension in the dialplan and VOICEMAIL will send the call to the voicemail box listed in the After Hours Voicemail field, IN_GROUP will send the call to the inbound group selected in the After Hours Transfer Group select list. Default is MESSAGE|| After Hours Transfer Group -<\/B> If After Hours Action is set to IN_GROUP, the call will be sent to this inbound group if it enters the in-group outside of the call time scheme defined for the in-group|| After Hours Transfer Group: || +Total calls taken in to this In-Group:|| +CALL HOLD TIME BREAKDOWN IN SECONDS|| +Date Range:|| +ADDING NEW PHONE ALIAS|| +ADD NEW PHONE ALIAS|| +MODIFY PHONE ALIAS|| +DELETE PHONE ALIAS|| +PHONE ALIAS LIST|| +Phone Alias List|| +Add A New Phone Alias|| +ADD A NEW PHONE ALIAS|| +Alias ID: || +Alias Name: || +Phone Logins List: || +PHONE ALIAS NOT ADDED|| +there is already a Phone Alias in the system with this ID|| +there is already a Phone Login in the system with this ID|| +PHONE ALIAS ADDED|| +PHONE ALIAS NOT MODIFIED|| +PHONE ALIAS MODIFIED|| +PHONE ALIAS NOT DELETED|| +PHONE ALIAS DELETION CONFIRMATION|| +Click here to delete phone alias|| +PHONE ALIAS DELETION COMPLETED|| +PHONE ALIAS LISTINGS|| +there is already a Phone alias in the system with this login|| +there is already a Phone in the system with this login|| +DELETE THIS PHONE ALIAS|| +MODIFY A PHONE ALIAS RECORD|| +Alias ID -<\/B> The ID of the alias used to allow for phone load balanced logins. no spaces or other special characters allowed. Must be between 2 and 20 characters in length|| +Alias Name -<\/B> The name used to describe a phones alias, Must be between 2 and 50 characters in length|| +Phones Logins List -<\/B> The comma separated list of phone logins used when an agent logs in using phone load balanced logins. The Agent application will find the active server with the fewest agents logged into it and place a call from that server to the agent upon login|| +PHONES WITHIN THIS PHONES ALIAS|| ############################################################ CLIENT diff --git a/agc_2-X/trunk/www/agc/vicidial.php b/agc_2-X/trunk/www/agc/vicidial.php index 3a4358a5..136ec283 100644 --- a/agc_2-X/trunk/www/agc/vicidial.php +++ b/agc_2-X/trunk/www/agc/vicidial.php @@ -173,10 +173,11 @@ # 80407-2112 - Work on adding phone login load balancing across servers # 80416-0559 - Added ability to log computer_ip at login, set the $PhoneSComPIP variable # 80428-0413 - UTF8 changes and testing +# 80505-0054 - Added multi-phones load-balanced alias option # -$version = '2.0.5-152'; -$build = '80428-0413'; +$version = '2.0.5-153'; +$build = '80505-0054'; require("dbconnect.php"); @@ -947,6 +948,28 @@ $VDloginDISPLAY=0; # will send multiple phones-table logins so that the script can determine the # server that has the fewest agents logged into it. # login: ca101,cb101,cc101 + $alias_found=0; +$stmt="select count(*) from phones_alias where alias_id = '$phone_login';"; +$rslt=mysql_query($stmt, $link); +$alias_ct = mysql_num_rows($rslt); +if ($alias_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alias_found = "$row[0]"; + } +if ($alias_found > 0) + { + $stmt="select alias_name,logins_list from phones_alias where alias_id = '$phone_login' limit 1;"; + $rslt=mysql_query($stmt, $link); + $alias_ct = mysql_num_rows($rslt); + if ($alias_ct > 0) + { + $row=mysql_fetch_row($rslt); + $alias_name = "$row[0]"; + $phone_login = "$row[1]"; + } + } + $pa=0; if ( (eregi(',',$phone_login)) and (strlen($phone_login) > 2) ) { @@ -957,7 +980,8 @@ if ( (eregi(',',$phone_login)) and (strlen($phone_login) > 2) ) { if ($pa > 0) {$phoneSQL .= " or ";} - $phoneSQL .= "(login='$phones_auto[$pa]' and pass='$phone_pass')"; + $desc = ($phones_auto_ct - $pa); # traverse in reverse order + $phoneSQL .= "(login='$phones_auto[$desc]' and pass='$phone_pass')"; $pa++; } $phoneSQL .= ")"; diff --git a/agc_2-X/trunk/www/vicidial/AST_CLOSERstats.php b/agc_2-X/trunk/www/vicidial/AST_CLOSERstats.php index dbc510bc..47aefe58 100644 --- a/agc_2-X/trunk/www/vicidial/AST_CLOSERstats.php +++ b/agc_2-X/trunk/www/vicidial/AST_CLOSERstats.php @@ -156,16 +156,16 @@ $row=mysql_fetch_row($rslt); $TOTALcalls = sprintf("%10s", $row[0]); if ( ($row[0] < 1) or ($row[1] < 1) ) - {$average_hold_seconds = ' 0';} + {$average_call_seconds = ' 0';} else { - $average_hold_seconds = ($row[1] / $row[0]); - $average_hold_seconds = round($average_hold_seconds, 0); - $average_hold_seconds = sprintf("%10s", $average_hold_seconds); + $average_call_seconds = ($row[1] / $row[0]); + $average_call_seconds = round($average_call_seconds, 0); + $average_call_seconds = sprintf("%10s", $average_call_seconds); } -echo "Total Calls placed from this Campaign: $TOTALcalls\n"; -echo "Average Call Length for all Calls: $average_hold_seconds seconds\n"; +echo "Total calls taken in to this In-Group: $TOTALcalls\n"; +echo "Average Call Length for all Calls: $average_call_seconds seconds\n"; echo "\n"; echo "---------- DROPS\n"; @@ -185,7 +185,9 @@ else } if ( ($row[0] < 1) or ($row[1] < 1) ) - {$average_hold_seconds = ' 0';} + { + $average_hold_seconds = ' 0'; + } else { $average_hold_seconds = ($row[1] / $row[0]); @@ -198,6 +200,115 @@ echo "Average hold time for DROP Calls: $average_hold_seconds second + +############################## +######### CALL QUEUE STATS +echo "\n"; +echo "---------- QUEUE STATS\n"; + +$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and (queue_seconds > 0);"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$row=mysql_fetch_row($rslt); + +$QUEUEcalls = sprintf("%10s", $row[0]); +if ( ($QUEUEcalls < 1) or ($TOTALcalls < 1) ) + {$QUEUEpercent = '0';} +else + { + $QUEUEpercent = (($QUEUEcalls / $TOTALcalls) * 100); + $QUEUEpercent = round($QUEUEpercent, 0); + } + +if ( ($row[0] < 1) or ($row[1] < 1) ) + {$average_queue_seconds = ' 0';} +else + { + $average_queue_seconds = ($row[1] / $row[0]); + $average_queue_seconds = round($average_queue_seconds, 2); + $average_queue_seconds = sprintf("%10.2f", $average_queue_seconds); + } + +if ( ($TOTALcalls < 1) or ($row[1] < 1) ) + {$average_total_queue_seconds = ' 0';} +else + { + $average_total_queue_seconds = ($row[1] / $TOTALcalls); + $average_total_queue_seconds = round($average_total_queue_seconds, 2); + $average_total_queue_seconds = sprintf("%10.2f", $average_total_queue_seconds); + } + +echo "Total Calls That entered Queue: $QUEUEcalls $QUEUEpercent%\n"; +echo "Average QUEUE Length for queue calls: $average_queue_seconds seconds\n"; +echo "Average QUEUE Length across all calls: $average_total_queue_seconds seconds\n"; + + + +############################## +######### CALL HOLD TIME BREAKDONW IN SECONDS + +$TOTALcalls = 0; + +echo "\n"; +echo "---------- CALL HOLD TIME BREAKDOWN IN SECONDS\n"; +echo "+-------------------------------------------------------------------------------------------+------------+\n"; +echo "| 0 5 10 15 20 25 30 35 40 45 50 55 60 90 +90 | TOTAL |\n"; +echo "+-------------------------------------------------------------------------------------------+------------+\n"; + +$stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' group by queue_seconds;"; +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$reasons_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $reasons_to_print) + { + $row=mysql_fetch_row($rslt); + + $TOTALcalls = ($TOTALcalls + $row[0]); + + if ($row[1] == 0) {$hd_0 = ($hd_0 + $row[0]);} + if ( ($row[1] > 0) and ($row{1} <= 5) ) {$hd_5 = ($hd_5 + $row[0]);} + if ( ($row[1] > 5) and ($row{1} <= 10) ) {$hd10 = ($hd10 + $row[0]);} + if ( ($row[1] > 10) and ($row{1} <= 15) ) {$hd15 = ($hd15 + $row[0]);} + if ( ($row[1] > 15) and ($row{1} <= 20) ) {$hd20 = ($hd20 + $row[0]);} + if ( ($row[1] > 20) and ($row{1} <= 25) ) {$hd25 = ($hd25 + $row[0]);} + if ( ($row[1] > 25) and ($row{1} <= 30) ) {$hd30 = ($hd30 + $row[0]);} + if ( ($row[1] > 30) and ($row{1} <= 35) ) {$hd35 = ($hd35 + $row[0]);} + if ( ($row[1] > 35) and ($row{1} <= 40) ) {$hd40 = ($hd40 + $row[0]);} + if ( ($row[1] > 40) and ($row{1} <= 45) ) {$hd45 = ($hd45 + $row[0]);} + if ( ($row[1] > 45) and ($row{1} <= 50) ) {$hd50 = ($hd50 + $row[0]);} + if ( ($row[1] > 50) and ($row{1} <= 55) ) {$hd55 = ($hd55 + $row[0]);} + if ( ($row[1] > 55) and ($row{1} <= 60) ) {$hd60 = ($hd60 + $row[0]);} + if ( ($row[1] > 60) and ($row{1} <= 90) ) {$hd90 = ($hd90 + $row[0]);} + if ($row[1] > 90) {$hd99 = ($hd99 + $row[0]);} + $i++; + } + +$hd_0 = sprintf("%5s", $hd_0); +$hd_5 = sprintf("%5s", $hd_5); +$hd10 = sprintf("%5s", $hd10); +$hd15 = sprintf("%5s", $hd15); +$hd20 = sprintf("%5s", $hd20); +$hd25 = sprintf("%5s", $hd25); +$hd30 = sprintf("%5s", $hd30); +$hd35 = sprintf("%5s", $hd35); +$hd40 = sprintf("%5s", $hd40); +$hd45 = sprintf("%5s", $hd45); +$hd50 = sprintf("%5s", $hd50); +$hd55 = sprintf("%5s", $hd55); +$hd60 = sprintf("%5s", $hd60); +$hd90 = sprintf("%5s", $hd90); +$hd99 = sprintf("%5s", $hd99); + +$TOTALcalls = sprintf("%10s", $TOTALcalls); + +echo "+-------------------------------------------------------------------------------------------+------------+\n"; +echo "| $hd_0 $hd_5 $hd10 $hd15 $hd20 $hd25 $hd30 $hd35 $hd40 $hd45 $hd50 $hd55 $hd60 $hd90 $hd99 | $TOTALcalls |\n"; +echo "+-------------------------------------------------------------------------------------------+------------+\n"; + + + ############################## ######### CALL HANGUP REASON STATS @@ -316,47 +427,6 @@ echo "+-------------------------------+------------+\n"; - -echo "\n"; -echo "---------- QUEUE STATS\n"; - -$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and (queue_seconds > 0);"; -$rslt=mysql_query($stmt, $link); -if ($DB) {echo "$stmt\n";} -$row=mysql_fetch_row($rslt); - -$QUEUEcalls = sprintf("%10s", $row[0]); -if ( ($QUEUEcalls < 1) or ($TOTALcalls < 1) ) - {$QUEUEpercent = '0';} -else - { - $QUEUEpercent = (($QUEUEcalls / $TOTALcalls) * 100); - $QUEUEpercent = round($QUEUEpercent, 0); - } - -if ( ($row[0] < 1) or ($row[1] < 1) ) - {$average_queue_seconds = ' 0';} -else - { - $average_queue_seconds = ($row[1] / $row[0]); - $average_queue_seconds = round($average_queue_seconds, 2); - $average_queue_seconds = sprintf("%10.2f", $average_queue_seconds); - } - -if ( ($TOTALcalls < 1) or ($row[1] < 1) ) - {$average_total_queue_seconds = ' 0';} -else - { - $average_total_queue_seconds = ($row[1] / $TOTALcalls); - $average_total_queue_seconds = round($average_total_queue_seconds, 2); - $average_total_queue_seconds = sprintf("%10.2f", $average_total_queue_seconds); - } - -echo "Total Calls That entered Queue: $QUEUEcalls $QUEUEpercent%\n"; -echo "Average QUEUE Length for queue calls: $average_queue_seconds seconds\n"; -echo "Average QUEUE Length across all calls: $average_total_queue_seconds seconds\n"; - - ############################## ######### USER STATS diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index 224ebe0a..2802d518 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -709,6 +709,12 @@ if (isset($_GET["code_name"])) {$code_name=$_GET["code_name"];} elseif (isset($_POST["code_name"])) {$code_name=$_POST["code_name"];} if (isset($_GET["afterhours_xfer_group"])) {$afterhours_xfer_group=$_GET["afterhours_xfer_group"];} elseif (isset($_POST["afterhours_xfer_group"])) {$afterhours_xfer_group=$_POST["afterhours_xfer_group"];} +if (isset($_GET["alias_id"])) {$alias_id=$_GET["alias_id"];} + elseif (isset($_POST["alias_id"])) {$alias_id=$_POST["alias_id"];} +if (isset($_GET["alias_name"])) {$alias_name=$_GET["alias_name"];} + elseif (isset($_POST["alias_name"])) {$alias_name=$_POST["alias_name"];} +if (isset($_GET["logins_list"])) {$logins_list=$_GET["logins_list"];} + elseif (isset($_POST["logins_list"])) {$logins_list=$_POST["logins_list"];} if (isset($script_id)) {$script_id= strtoupper($script_id);} if (isset($lead_filter_id)) {$lead_filter_id = strtoupper($lead_filter_id);} @@ -1009,6 +1015,10 @@ $drop_action = ereg_replace("[^-\_0-9a-zA-Z]","",$drop_action); $drop_inbound_group = ereg_replace("[^-\_0-9a-zA-Z]","",$drop_inbound_group); $afterhours_xfer_group = ereg_replace("[^-\_0-9a-zA-Z]","",$afterhours_xfer_group); $after_hours_action = ereg_replace("[^-\_0-9a-zA-Z]","",$after_hours_action); +$alias_id = ereg_replace("[^-\_0-9a-zA-Z]","",$alias_id); + +### ALPHA-NUMERIC and underscore and dash and comma +$logins_list = ereg_replace("[^-\,\_0-9a-zA-Z]","",$logins_list); ### ALPHA-NUMERIC and spaces $lead_order = ereg_replace("[^ 0-9a-zA-Z]","",$lead_order); @@ -1048,6 +1058,8 @@ $vcl_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vcl_name); $vsc_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vsc_name); $vsc_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vsc_description); $code_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$code_name); +$alias_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$alias_name); + ### ALPHA-NUMERIC and underscore and dash and slash and at and dot $call_out_number_group = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$call_out_number_group); @@ -1223,11 +1235,12 @@ $list_mix_container = ereg_replace(";","",$list_mix_container); # 80317-2037 - Added Recording override settings to in-groups # 80414-1505 - More work on QC, added vicidial_qc_codes # 80424-0442 - Added non_latin system_settings lookup at top to override dbconnect setting +# 80505-0333 - Added phones_alias sections to allow for load-balanced-phone-logins # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time -$admin_version = '2.0.5-127'; -$build = '80424-0442'; +$admin_version = '2.0.5-128'; +$build = '80505-0333'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -1377,6 +1390,7 @@ if ($ADD==11111111) {$hh='filters'; echo "Add New Filter";} if ($ADD==111111111) {$hh='admin'; $sh='times'; echo "Add New Call Time";} if ($ADD==1111111111) {$hh='admin'; $sh='times'; echo "Add New State Call Time";} if ($ADD==11111111111) {$hh='admin'; $sh='phones'; echo "ADD NEW PHONE";} +if ($ADD==12111111111) {$hh='admin'; $sh='phones'; echo "ADD NEW PHONE ALIAS";} if ($ADD==111111111111) {$hh='admin'; $sh='server'; echo "ADD NEW SERVER";} if ($ADD==1111111111111) {$hh='admin'; $sh='conference'; echo "ADD NEW CONFERENCE";} if ($ADD==11111111111111) {$hh='admin'; $sh='conference'; echo "ADD NEW VICIDIAL CONFERENCE";} @@ -1401,6 +1415,7 @@ if ($ADD==21111111) {$hh='filters'; echo "New Filter Addition";} if ($ADD==211111111) {$hh='admin'; $sh='times'; echo "New Call Time Addition";} if ($ADD==2111111111) {$hh='admin'; $sh='times'; echo "New State Call Time Addition";} if ($ADD==21111111111) {$hh='admin'; $sh='phones'; echo "ADDING NEW PHONE";} +if ($ADD==22111111111) {$hh='admin'; $sh='phones'; echo "ADDING NEW PHONE ALIAS";} if ($ADD==211111111111) {$hh='admin'; $sh='server'; echo "ADDING NEW SERVER";} if ($ADD==221111111111) {$hh='admin'; $sh='server'; echo "ADDING NEW SERVER VICIDIAL TRUNK RECORD";} if ($ADD==2111111111111) {$hh='admin'; $sh='conference'; echo "ADDING NEW CONFERENCE";} @@ -1449,6 +1464,7 @@ if ($ADD==311111111) {$hh='admin'; $sh='times'; echo "Modify Call Time";} if ($ADD==321111111) {$hh='admin'; $sh='times'; echo "Modify Call Time State Definitions List";} if ($ADD==3111111111) {$hh='admin'; $sh='times'; echo "Modify State Call Time";} if ($ADD==31111111111) {$hh='admin'; $sh='phones'; echo "MODIFY PHONE";} +if ($ADD==32111111111) {$hh='admin'; $sh='phones'; echo "MODIFY PHONE ALIAS";} if ($ADD==311111111111) {$hh='admin'; $sh='server'; echo "MODIFY SERVER";} if ($ADD==3111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY CONFERENCE";} if ($ADD==31111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY VICIDIAL CONFERENCE";} @@ -1476,6 +1492,7 @@ if ($ADD==41111111) {$hh='filters'; echo "Modify Filter";} if ($ADD==411111111) {$hh='admin'; $sh='times'; echo "Modify Call Time";} if ($ADD==4111111111) {$hh='admin'; $sh='times'; echo "Modify State Call Time";} if ($ADD==41111111111) {$hh='admin'; $sh='phones'; echo "MODIFY PHONE";} +if ($ADD==42111111111) {$hh='admin'; $sh='phones'; echo "MODIFY PHONE ALIAS";} if ($ADD==411111111111) {$hh='admin'; $sh='server'; echo "MODIFY SERVER";} if ($ADD==421111111111) {$hh='admin'; $sh='server'; echo "MODIFY SERVER VICIDIAL TRUNK RECORD";} if ($ADD==4111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY CONFERENCE";} @@ -1497,6 +1514,7 @@ if ($ADD==51111111) {$hh='filters'; echo "Delete Filter";} if ($ADD==511111111) {$hh='admin'; $sh='times'; echo "Delete Call Time";} if ($ADD==5111111111) {$hh='admin'; $sh='times'; echo "Delete State Call Time";} if ($ADD==51111111111) {$hh='admin'; $sh='phones'; echo "DELETE PHONE";} +if ($ADD==52111111111) {$hh='admin'; $sh='phones'; echo "DELETE PHONE ALIAS";} if ($ADD==511111111111) {$hh='admin'; $sh='server'; echo "DELETE SERVER";} if ($ADD==5111111111111) {$hh='admin'; $sh='conference'; echo "DELETE CONFERENCE";} if ($ADD==51111111111111) {$hh='admin'; $sh='conference'; echo "DELETE VICIDIAL CONFERENCE";} @@ -1518,6 +1536,7 @@ if ($ADD==61111111) {$hh='filters'; echo "Delete Filter";} if ($ADD==611111111) {$hh='admin'; $sh='times'; echo "Delete Call Time";} if ($ADD==6111111111) {$hh='admin'; $sh='times'; echo "Delete State Call Time";} if ($ADD==61111111111) {$hh='admin'; $sh='phones'; echo "DELETE PHONE";} +if ($ADD==62111111111) {$hh='admin'; $sh='phones'; echo "DELETE PHONE ALIAS";} if ($ADD==611111111111) {$hh='admin'; $sh='server'; echo "DELETE SERVER";} if ($ADD==621111111111) {$hh='admin'; $sh='server'; echo "DELETE SERVER VICIDIAL TRUNK RECORD";} if ($ADD==6111111111111) {$hh='admin'; $sh='conference'; echo "DELETE CONFERENCE";} @@ -1539,6 +1558,7 @@ if ($ADD==10000000) {$hh='filters'; echo "Filters";} if ($ADD==100000000) {$hh='admin'; $sh='times'; echo "Call Times";} if ($ADD==1000000000) {$hh='admin'; $sh='times'; echo "State Call Times";} if ($ADD==10000000000) {$hh='admin'; $sh='phones'; echo "PHONE LIST";} +if ($ADD==12000000000) {$hh='admin'; $sh='phones'; echo "PHONE ALIAS LIST";} if ($ADD==100000000000) {$hh='admin'; $sh='server'; echo "SERVER LIST";} if ($ADD==1000000000000) {$hh='admin'; $sh='conference'; echo "CONFERENCE LIST";} if ($ADD==10000000000000) {$hh='admin'; $sh='conference'; echo "VICIDIAL CONFERENCE LIST";} @@ -3474,6 +3494,21 @@ The VICIDIAL basic web-based lead loader is designed simply to take a lead file
DBY Port - The MySQL TCP port that this user should be using when connecting. Default is 3306. Secondary server, not used currently. +
+ +
+Alias ID - The ID of the alias used to allow for phone load balanced logins. no spaces or other special characters allowed. Must be between 2 and 20 characters in length. + +
+
+
+Alias Name - The name used to describe a phones alias, Must be between 2 and 50 characters in length. + +
+
+
+Phones Logins List - The comma separated list of phone logins used when an agent logs in using phone load balanced logins. The Agent application will find the active server with the fewest agents logged into it and place a call from that server to the agent upon login. +



@@ -4267,7 +4302,7 @@ if (strlen($admin_hh) > 1) { 1) { ?> - >>  
> Show Phones   |   > Add A New Phone + >>   > Show Phones   |   > Add A New Phone   |   > Phone Alias List   |   > Add A New Phone Alias 1) { ?> @@ -4921,26 +4956,57 @@ if ($ADD==11111111111) echo "
\n"; echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Phone extension: $NWB#phones-extension$NWE
Dial Plan Number: (digits only)$NWB#phones-dialplan_number$NWE
Voicemail Box: (digits only)$NWB#phones-voicemail_id$NWE
Outbound CallerID: (digits only)$NWB#phones-outbound_cid$NWE
Phone IP address: (optional)$NWB#phones-phone_ip$NWE
Computer IP address: (optional)$NWB#phones-computer_ip$NWE
Dial Plan Number: (digits only)$NWB#phones-dialplan_number$NWE
Voicemail Box: (digits only)$NWB#phones-voicemail_id$NWE
Outbound CallerID: (digits only)$NWB#phones-outbound_cid$NWE
Phone IP address: (optional)$NWB#phones-phone_ip$NWE
Computer IP address: (optional)$NWB#phones-computer_ip$NWE
Server IP: $NWB#phones-server_ip$NWE
Login: $NWB#phones-login$NWE
Password: $NWB#phones-pass$NWE
Status: $NWB#phones-status$NWE
Active Account: $NWB#phones-active$NWE
Phone Type: $NWB#phones-phone_type$NWE
Full Name: $NWB#phones-fullname$NWE
Company: $NWB#phones-company$NWE
Picture: $NWB#phones-picture$NWE
Client Protocol: $NWB#phones-protocol$NWE
Local GMT: (Do NOT Adjust for DST)$NWB#phones-local_gmt$NWE
Login: $NWB#phones-login$NWE
Password: $NWB#phones-pass$NWE
Status: $NWB#phones-status$NWE
Active Account: $NWB#phones-active$NWE
Phone Type: $NWB#phones-phone_type$NWE
Full Name: $NWB#phones-fullname$NWE
Company: $NWB#phones-company$NWE
Picture: $NWB#phones-picture$NWE
Client Protocol: $NWB#phones-protocol$NWE
Local GMT: (Do NOT Adjust for DST)$NWB#phones-local_gmt$NWE
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + +###################### +# ADD=12111111111 display the ADD NEW PHONE ALIAS SCREEN +###################### + +if ($ADD==12111111111) +{ + if ($LOGast_admin_access==1) + { + echo "
\n"; + echo ""; + + echo "
ADD A NEW PHONE ALIAS
\n"; + echo "\n"; + echo "
\n"; + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "
Alias ID: $NWB#phones-alias_id$NWE
Alias Name: $NWB#phones-alias_name$NWE
Phone Logins List: (comma separated)$NWB#phones-logins_list$NWE
\n"; } @@ -5900,20 +5966,89 @@ echo "
\n"; {echo "
PHONE NOT ADDED - there is already a Phone in the system with this extension/server\n";} else { - if ( (strlen($extension) < 1) or (strlen($server_ip) < 7) or (strlen($dialplan_number) < 1) or (strlen($voicemail_id) < 1) or (strlen($login) < 1) or (strlen($pass) < 1)) - {echo "
PHONE NOT ADDED - Please go back and look at the data you entered\n";} - else + $stmt="SELECT count(*) from phones where login='$login';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
PHONE NOT ADDED - there is already a Phone in the system with this login\n";} + else { - echo "
PHONE ADDED\n"; - - $stmt="INSERT INTO phones (extension,dialplan_number,voicemail_id,phone_ip,computer_ip,server_ip,login,pass,status,active,phone_type,fullname,company,picture,protocol,local_gmt,outbound_cid) values('$extension','$dialplan_number','$voicemail_id','$phone_ip','$computer_ip','$server_ip','$login','$pass','$status','$active','$phone_type','$fullname','$company','$picture','$protocol','$local_gmt','$outbound_cid');"; + $stmt="SELECT count(*) from phones_alias where alias_id='$login';"; $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
PHONE NOT ADDED - there is already a Phone alias in the system with this login\n";} + else + { + if ( (strlen($extension) < 1) or (strlen($server_ip) < 7) or (strlen($dialplan_number) < 1) or (strlen($voicemail_id) < 1) or (strlen($login) < 1) or (strlen($pass) < 1)) + {echo "
PHONE NOT ADDED - Please go back and look at the data you entered\n";} + else + { + echo "
PHONE ADDED\n"; + + $stmt="INSERT INTO phones (extension,dialplan_number,voicemail_id,phone_ip,computer_ip,server_ip,login,pass,status,active,phone_type,fullname,company,picture,protocol,local_gmt,outbound_cid) values('$extension','$dialplan_number','$voicemail_id','$phone_ip','$computer_ip','$server_ip','$login','$pass','$status','$active','$phone_type','$fullname','$company','$picture','$protocol','$local_gmt','$outbound_cid');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW PHONE |$stmt|\n"); + fclose($fp); + } + } + } } } $ADD=31111111111; } +###################### +# ADD=22111111111 adds new phone alias to the system +###################### + +if ($ADD==22111111111) +{ +echo "
\n"; + echo ""; + $stmt="SELECT count(*) from phones_alias where alias_id='$alias_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
PHONE ALIAS NOT ADDED - there is already a Phone Alias in the system with this ID\n";} + else + { + $stmt="SELECT count(*) from phones where login='$alias_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
PHONE ALIAS NOT ADDED - there is already a Phone Login in the system with this ID\n";} + else + { + if ( (strlen($alias_id) < 1) or (strlen($alias_name) < 2) ) + {echo "
PHONE ALIAS NOT ADDED - Please go back and look at the data you entered\n";} + else + { + echo "
PHONE ALIAS ADDED\n"; + + $stmt="INSERT INTO phones_alias (alias_id,alias_name,logins_list) values('$alias_id','$alias_name','$logins_list');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW PHONE ALIAS |$stmt|\n"); + fclose($fp); + } + } + } + } +$ADD=32111111111; +} + + ###################### # ADD=211111111111 adds new server to the system ###################### @@ -5937,6 +6072,14 @@ echo "
\n"; $stmt="INSERT INTO servers (server_id,server_description,server_ip,active,asterisk_version) values('$server_id','$server_description','$server_ip','$active','$asterisk_version');"; $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW SERVER |$stmt|\n"); + fclose($fp); + } } } $ADD=311111111111; @@ -7410,6 +7553,14 @@ if ($ADD==41111111111) $stmt="UPDATE phones set extension='$extension', dialplan_number='$dialplan_number', voicemail_id='$voicemail_id', phone_ip='$phone_ip', computer_ip='$computer_ip', server_ip='$server_ip', login='$login', pass='$pass', status='$status', active='$active', phone_type='$phone_type', fullname='$fullname', company='$company', picture='$picture', protocol='$protocol', local_gmt='$local_gmt', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', login_user='$login_user', login_pass='$login_pass', login_campaign='$login_campaign', park_on_extension='$park_on_extension', conf_on_extension='$conf_on_extension', VICIDIAL_park_on_extension='$VICIDIAL_park_on_extension', VICIDIAL_park_on_filename='$VICIDIAL_park_on_filename', monitor_prefix='$monitor_prefix', recording_exten='$recording_exten', voicemail_exten='$voicemail_exten', voicemail_dump_exten='$voicemail_dump_exten', ext_context='$ext_context', dtmf_send_extension='$dtmf_send_extension', call_out_number_group='$call_out_number_group', client_browser='$client_browser', install_directory='$install_directory', local_web_callerID_URL='" . mysql_real_escape_string($local_web_callerID_URL) . "', VICIDIAL_web_URL='" . mysql_real_escape_string($VICIDIAL_web_URL) . "', AGI_call_logging_enabled='$AGI_call_logging_enabled', user_switching_enabled='$user_switching_enabled', conferencing_enabled='$conferencing_enabled', admin_hangup_enabled='$admin_hangup_enabled', admin_hijack_enabled='$admin_hijack_enabled', admin_monitor_enabled='$admin_monitor_enabled', call_parking_enabled='$call_parking_enabled', updater_check_enabled='$updater_check_enabled', AFLogging_enabled='$AFLogging_enabled', QUEUE_ACTION_enabled='$QUEUE_ACTION_enabled', CallerID_popup_enabled='$CallerID_popup_enabled', voicemail_button_enabled='$voicemail_button_enabled', enable_fast_refresh='$enable_fast_refresh', fast_refresh_rate='$fast_refresh_rate', enable_persistant_mysql='$enable_persistant_mysql', auto_dial_next_number='$auto_dial_next_number', VDstop_rec_after_each_call='$VDstop_rec_after_each_call', DBX_server='$DBX_server', DBX_database='$DBX_database', DBX_user='$DBX_user', DBX_pass='$DBX_pass', DBX_port='$DBX_port', DBY_server='$DBY_server', DBY_database='$DBY_database', DBY_user='$DBY_user', DBY_pass='$DBY_pass', DBY_port='$DBY_port', outbound_cid='$outbound_cid', enable_sipsak_messages='$enable_sipsak_messages' where extension='$old_extension' and server_ip='$old_server_ip';"; $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY PHONE |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } } } } @@ -7422,6 +7573,46 @@ $ADD=31111111111; # go to phone modification form below } +###################### +# ADD=42111111111 modify phone alias record in the system +###################### + +if ($ADD==42111111111) +{ + if ($LOGast_admin_access==1) + { + echo ""; + + $stmt="SELECT count(*) from phones_alias where alias_id='$alias_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( (strlen($alias_id) < 1) or (strlen($alias_name) < 2) ) + {echo "
PHONE ALIAS NOT MODIFIED - Please go back and look at the data you entered\n";} + else + { + echo "
PHONE ALIAS MODIFIED: $alias_id\n"; + + $stmt="UPDATE phones_alias set alias_name='$alias_name', logins_list='$logins_list' where alias_id='$alias_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY PHONES ALIAS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=32111111111; # go to phone alias modification form below +} + + ###################### # ADD=411111111111 modify server record in the system ###################### @@ -7454,6 +7645,14 @@ if ($ADD==411111111111) $stmt="UPDATE servers set server_id='$server_id',server_description='$server_description',server_ip='$server_ip',active='$active',asterisk_version='$asterisk_version', max_vicidial_trunks='$max_vicidial_trunks', telnet_host='$telnet_host', telnet_port='$telnet_port', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', ASTmgrUSERNAMEupdate='$ASTmgrUSERNAMEupdate', ASTmgrUSERNAMElisten='$ASTmgrUSERNAMElisten', ASTmgrUSERNAMEsend='$ASTmgrUSERNAMEsend', local_gmt='$local_gmt', voicemail_dump_exten='$voicemail_dump_exten', answer_transfer_agent='$answer_transfer_agent', ext_context='$ext_context', sys_perf_log='$sys_perf_log', vd_server_logs='$vd_server_logs', agi_output='$agi_output', vicidial_balance_active='$vicidial_balance_active', balance_trunks_offlimits='$balance_trunks_offlimits' where server_id='$old_server_id';"; $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SERVER |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } } } } @@ -8143,6 +8342,28 @@ $ADD='31111111111'; # go to phone modification below } +###################### +# ADD=52111111111 confirmation before deletion of phone alias record +###################### + +if ($ADD==52111111111) +{ + echo ""; + + if ( (strlen($alias_id) < 1) or ($LOGast_delete_phones < 1) ) + { + echo "
PHONE ALIAS NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Alias ID must be at least 2 characters in length\n"; + } + else + { + echo "
PHONE ALIAS DELETION CONFIRMATION: $alias_id\n"; + echo "

Click here to delete phone alias $alias_id


\n"; + } +$ADD='32111111111'; # go to phone alias modification below +} + + ###################### # ADD=511111111111 confirmation before deletion of server record ###################### @@ -8921,7 +9142,7 @@ if ($ADD==61111111111) if ($WeBRooTWritablE > 0) { $fp = fopen ("./admin_changes_log.txt", "a"); - fwrite ($fp, "$date|!!!DELETING PHONE!!!|$PHP_AUTH_USER|$ip|extension='$extension'|server_ip='$server_ip'|\n"); + fwrite ($fp, "$date|!!!DELETING PHONE!!!|$PHP_AUTH_USER|$ip|$stmt|\n"); fclose($fp); } echo "
PHONE DELETION COMPLETED: $extension - $server_ip\n"; @@ -8931,6 +9152,38 @@ $ADD='10000000000'; # go to phone list } +###################### +# ADD=62111111111 delete phone alias record +###################### + +if ($ADD==62111111111) +{ + echo ""; + + if ( (strlen($alias_id) < 2) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) ) + { + echo "
PHONE ALIAS NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Alias ID must be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from phones_alias where alias_id='$alias_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETE PHONE ALIAS!|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + echo "
PHONE ALIAS DELETION COMPLETED: $alias_id\n"; + echo "

\n"; + } +$ADD='12000000000'; # go to phone alias list +} + + ###################### # ADD=611111111111 delete server record ###################### @@ -12445,6 +12698,80 @@ if ($ADD==31111111111) } +###################### +# ADD=32111111111 modify phone alias record in the system +###################### + +if ($ADD==32111111111) +{ + if ($LOGast_admin_access==1) + { + echo "\n"; echo "
\n"; + echo ""; + + $stmt="SELECT * from phones_alias where alias_id='$alias_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + echo "
MODIFY A PHONE ALIAS RECORD: $row[0]\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Alias ID: $row[0] $NWB#phones-alias_id$NWE
Alias Name: $NWB#phones-alias_name$NWE
Phones Logins List: (comma separated)$NWB#phones-logins_list$NWE
\n"; + + + ### list of phones in this phones alias + $phone_alias_SQL = ereg_replace(',',"','",$row[2]); + + echo "
\n"; + echo "
PHONES WITHIN THIS PHONES ALIAS:
\n"; + echo "\n"; + echo "\n"; + + $stmt="SELECT login,extension,server_ip,protocol,phone_ip from phones where login IN ('$phone_alias_SQL');"; + if ($DB) {echo "|$stmt|";} + $rsltx=mysql_query($stmt, $link); + $lists_to_print = mysql_num_rows($rsltx); + + $o=0; + while ($lists_to_print > $o) { + $rowx=mysql_fetch_row($rsltx); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + } + + echo "
LOGINEXTENSIONSERVERPROTOCOLIP
$rowx[0]$rowx[1]$rowx[2]$rowx[3]$rowx[4]

\n"; + + + + + + + + + if ($LOGast_delete_phones > 0) + { + echo "

DELETE THIS PHONE ALIAS\n"; + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + ###################### # ADD=311111111111 modify server record in the system ###################### @@ -13798,6 +14125,41 @@ echo "
LINKS
\n"; } +###################### +# ADD=12000000000 display all phones alias +###################### +if ($ADD==12000000000) +{ +echo "
\n"; +echo ""; + + $stmt="SELECT * from phones_alias order by alias_id;"; + $rslt=mysql_query($stmt, $link); + $phones_to_print = mysql_num_rows($rslt); + +echo "
PHONE ALIAS LISTINGS:\n"; +echo "
\n"; +echo ""; +echo ""; +echo ""; +echo ""; +echo "\n"; + + $o=0; + while ($phones_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo "\n"; + $o++; + } + +echo "
ALIAS IDALIAS NAMEPHONE LOGINS LISTMODIFY
$row[0]$row[1]$row[2]MODIFY
\n"; +} + ###################### # ADD=100000000000 display all servers ###################### diff --git a/agc_2-X/trunk/www/vicidial/sph_report.php b/agc_2-X/trunk/www/vicidial/sph_report.php new file mode 100644 index 00000000..78a4144e --- /dev/null +++ b/agc_2-X/trunk/www/vicidial/sph_report.php @@ -0,0 +1,567 @@ + LICENSE: AGPLv2 +# +# CHANGES +# +# 80502-0857 - First build +# 80506-0228 - Added user field to search by +# + +require("dbconnect.php"); + +##### Pull values from posted form variables ##### +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} + elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} +if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["user_group"])) {$user_group=$_GET["user_group"];} + elseif (isset($_POST["user_group"])) {$user_group=$_POST["user_group"];} +if (isset($_GET["shift"])) {$shift=$_GET["shift"];} + elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} +if (isset($_GET["role"])) {$role=$_GET["role"];} + elseif (isset($_POST["role"])) {$role=$_POST["role"];} +if (isset($_GET["order"])) {$order=$_GET["order"];} + elseif (isset($_POST["order"])) {$order=$_POST["order"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +if (strlen($shift)<2) {$shift='ALL';} +if (strlen($role)<2) {$role='ALL';} +if (strlen($order)<2) {$order='sales_down';} + +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin FROM system_settings;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysql_num_rows($rslt); +$i=0; +while ($i < $qm_conf_ct) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $i++; + } +##### END SETTINGS LOOKUP ##### +########################################### + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; +if ($DB) {echo "|$stmt|\n";} +if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + + 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; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} +if (!isset($end_date)) {$end_date = $NOW_DATE;} + +$stmt="select campaign_id from vicidial_campaigns;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$campaigns_to_print = mysql_num_rows($rslt); +$i=0; + $LISTcampaigns[$i]='---NONE---'; + $i++; + $campaigns_to_print++; +while ($i < $campaigns_to_print) + { + $row=mysql_fetch_row($rslt); + $LISTcampaigns[$i] =$row[0]; + $i++; + } + +$stmt="select group_id from vicidial_inbound_groups;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; + $LISTgroups[$i]='---NONE---'; + $i++; + $groups_to_print++; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $LISTgroups[$i] =$row[0]; + $i++; + } + +$stmt="select user_group from vicidial_user_groups;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$user_groups_to_print = mysql_num_rows($rslt); +$i=0; + $LISTuser_groups[$i]='---ALL---'; + $i++; + $user_groups_to_print++; +while ($i < $user_groups_to_print) + { + $row=mysql_fetch_row($rslt); + $LISTuser_groups[$i] =$row[0]; + $i++; + } + +##### START HTML ##### +?> + + + + + + + +VICIDIAL: Agent SPH Report + + + + 0) + { + echo "
\n"; + echo "$campaign_ct|$campaign_string|$campaign_SQL\n"; + echo "
\n"; + echo "$group_ct|$group_string|$group_SQL\n"; + echo "
\n"; + echo "$user_group_ct|$user_group_string|$user_group_SQL\n"; + echo "
\n"; + echo "$role|$role_SQL\n"; + echo "
\n"; + + } + +echo "
\n"; +echo "\n"; +echo ""; +echo "
\n"; + +echo "Date Range:
\n"; +echo ""; +echo "
to
\n"; +echo "\n"; +/* +echo "
\n"; +echo "Campaigns:
\n"; +echo "\n"; +*/ +echo "
\n"; +echo "Inbound Groups:
\n"; +echo "\n"; +echo "
\n"; +echo "User Groups:
\n"; +echo "\n"; +echo "
\n"; +echo "Shift:
\n"; +echo " \n"; + +echo "
\n"; +echo "Role:
\n"; +echo " \n"; + +echo "
\n"; +echo "     REPORTS \n"; + +echo "
\n"; +echo "Order:
\n"; +echo "
\n"; + +echo "
\n"; +echo "User:
\n"; +echo "\n"; + +echo "
\n"; +echo "\n"; +echo "
\n"; +echo "\n\n"; + +echo "
\n";
+
+
+if ($group_ct < 1)
+{
+echo "\n";
+echo "PLEASE SELECT AN IN-GROUP AND DATE RANGE ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from shift specified\n";
+}
+
+else
+{
+/*
+if ($shift == 'AM') 
+	{
+	$time_BEGIN=$AM_shift_BEGIN;
+	$time_END=$AM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}   
+	if (strlen($time_END) < 6) {$time_END = "15:15:00";}
+	}
+if ($shift == 'PM') 
+	{
+	$time_BEGIN=$PM_shift_BEGIN;
+	$time_END=$PM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:15:00";}
+	}
+if ($shift == 'ALL') 
+	{
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+	}
+$query_date_BEGIN = "$query_date $time_BEGIN";   
+$query_date_END = "$end_date $time_END";
+
+if (strlen($user_group)>0) {$ugSQL="and vicidial_agent_log.user_group='$user_group'";}
+else {$ugSQL='';}
+*/
+
+echo "VICIDIAL: Agent SPH Report                        $NOW_TIME\n";
+
+echo "Time range: $query_date to $end_date\n\n";
+echo "---------- AGENTS SPH DETAILS -------------\n
\n"; + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +$order_SQL=''; +if ($order == 'sph_up') {$order_SQL = "order by full_name,campaign_group_id,role";} +if ($order == 'sph_down') {$order_SQL = "order by full_name,campaign_group_id,role";} +if ($order == 'hours_up') {$order_SQL = "order by login";} +if ($order == 'hours_down') {$order_SQL = "order by login desc";} +if ($order == 'sales_up') {$order_SQL = "order by sales, sph desc";} +if ($order == 'sales_down') {$order_SQL = "order by sales desc, sph";} +if ($order == 'calls_up') {$order_SQL = "order by calls";} +if ($order == 'calls_down') {$order_SQL = "order by calls desc";} +if ($order == 'user_up') {$order_SQL = "order by vicidial_users.user";} +if ($order == 'user_down') {$order_SQL = "order by vicidial_users.user desc";} +if ($order == 'name_up') {$order_SQL = "order by full_name";} +if ($order == 'name_down') {$order_SQL = "order by full_name desc";} + +if (strlen($user) > 0) {$user_SQL = "and vicidial_agent_sph.user='$user'";} +else {$user_SQL='';} + +$stmt="select vicidial_users.user,full_name,role,campaign_group_id,sum(login_sec) as login,sum(calls) as calls,sum(sales) as sales,avg(sph) as sph from vicidial_users,vicidial_agent_sph where stat_date >= '$query_date' and stat_date <= '$end_date' and shift='$shift' and vicidial_users.user=vicidial_agent_sph.user and campaign_group_id IN($group_SQL) $role_SQL $user_SQL group by vicidial_users.user,campaign_group_id,role $order_SQL limit 100000;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$rows_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $rows_to_print) + { + $dbHOURS=0; $dbSPH=0; + $row=mysql_fetch_row($rslt); + $user_id[$i] = $row[0]; + $full_name[$i] = $row[1]; + $roleX[$i] = $row[2]; + $group[$i] = $row[3]; + $login_sec[$i] = $row[4]; $TOTlogin_sec = ($TOTlogin_sec + $row[4]); + $calls[$i] = $row[5]; $TOTcalls = ($TOTcalls + $row[5]); + $sales[$i] = $row[6]; $TOTsales = ($TOTsales + $row[6]); + + if ($login_sec[$i] > 0) + { + $dbHOURS = ($login_sec[$i] / 3600); + if ($sales[$i] > 0) + { + $dbSPH = ( $sales[$i] / $dbHOURS ); + $dbSPH = round($dbSPH, 2); + $dbSPH = sprintf("%01.2f", $dbSPH); + } + else + {$dbSPH='0.00';} + $dbHOURS = round($dbHOURS, 2); + $dbHOURS = sprintf("%01.2f", $dbHOURS); + } + else + {$dbHOURS='0.00';} + + $sph[$i] = $dbSPH; + $hours[$i] = $dbHOURS; + + $sphSORT[$i] = "$dbSPH-----$i"; + $hoursSORT[$i] = "$dbHOURS-----$i"; + + $i++; + } + +### Sort by sph if selected +if ($order == 'sph_up') + { + sort($sphSORT, SORT_NUMERIC); + } +if ($order == 'sph_down') + { + rsort($sphSORT, SORT_NUMERIC); + } + +$j=0; +while ($j < $rows_to_print) + { + + $sph_split = explode("-----",$sphSORT[$j]); + $i = $sph_split[1]; + + if (eregi("1$|3$|5$|7$|9$", $j)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + + $j++; + } + + +if ($TOTlogin_sec > 0) + { + $TOTdbHOURS = ($TOTlogin_sec / 3600); + if ($TOTsales > 0) + { + $TOTdbSPH = ( $TOTsales / $TOTdbHOURS ); + $TOTdbSPH = round($TOTdbSPH, 2); + $TOTdbSPH = sprintf("%01.2f", $TOTdbSPH); + } + else + {$TOTdbSPH='0.00';} + $TOTdbHOURS = round($TOTdbHOURS, 0); + $TOTdbHOURS = sprintf("%01.0f", $TOTdbHOURS); + } +else + {$TOTdbHOURS='0.00';} + +$TOTsph = $TOTdbSPH; +$TOThours = $TOTdbHOURS; + + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "
#  USER    NAME    ROLE    GROUP    CALLS    HOURS    SALES    SPH  
$j$user_id[$i] $full_name[$i] $roleX[$i] $group[$i] $calls[$i] $hours[$i] $sales[$i] $sph[$i]
TOTALS $TOTcalls $TOThours $TOTsales $TOTsph
\n"; + +/* + $TOTavgWAIT_M = ( ($TOTtotWAIT / $TOTcalls) / 60); + $TOTavgWAIT_M = round($TOTavgWAIT_M, 2); + $TOTavgWAIT_M_int = intval("$TOTavgWAIT_M"); + $TOTavgWAIT_S = ($TOTavgWAIT_M - $TOTavgWAIT_M_int); + $TOTavgWAIT_S = ($TOTavgWAIT_S * 60); + $TOTavgWAIT_S = round($TOTavgWAIT_S, 0); + if ($TOTavgWAIT_S < 10) {$TOTavgWAIT_S = "0$TOTavgWAIT_S";} + $TOTavgWAIT_MS = "$TOTavgWAIT_M_int:$TOTavgWAIT_S"; + $TOTavgWAIT_MS = sprintf("%6s", $TOTavgWAIT_MS); + while(strlen($TOTavgWAIT_MS)>6) {$TOTavgWAIT_MS = substr("$TOTavgWAIT_MS", 0, -1);} +*/ + + +echo "\n"; + +} + + +?> +
+ \ No newline at end of file