added phones_alias feature to allow for an alias to a group of phones entries for easier phone-login-load-balancing

Updated install docs to use Apache 2.2.8 and PHP 5.2.6
Update to Closer report

git-svn-id: svn://192.168.202.10@852 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2008-05-06 13:15:43 +00:00
parent 74a56d57bf
commit 2a31a04f70
9 changed files with 1187 additions and 114 deletions
+21 -21
View File
@@ -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
+18 -16
View File
@@ -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"
@@ -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';
+8
View File
@@ -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';
@@ -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
+27 -3
View File
@@ -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 .= ")";
+118 -48
View File
@@ -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
+387 -25
View File
@@ -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
<BR>
<B>DBY Port -</B> The MySQL TCP port that this user should be using when connecting. Default is 3306. Secondary server, not used currently.
<BR>
<A NAME="phones-alias_id">
<BR>
<B>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.
<BR>
<A NAME="phones-alias_name">
<BR>
<B>Alias Name -</B> The name used to describe a phones alias, Must be between 2 and 50 characters in length.
<BR>
<A NAME="phones-logins_list">
<BR>
<B>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.
<BR><BR><BR><BR>
@@ -4267,7 +4302,7 @@ if (strlen($admin_hh) > 1) {
<? }
if (strlen($phones_sh) > 1) {
?>
<TR BGCOLOR=<?=$phones_color ?>><TD ALIGN=LEFT COLSPAN=10><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?=$subheader_font_size ?>> &nbsp; <a href="<? echo $PHP_SELF ?>?ADD=10000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?=$subheader_font_size ?>> Show Phones </a> &nbsp; | &nbsp; <a href="<? echo $PHP_SELF ?>?ADD=11111111111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?=$subheader_font_size ?>> Add A New Phone </a></TD></TR>
<TR BGCOLOR=<?=$phones_color ?>><TD ALIGN=LEFT COLSPAN=10><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?=$subheader_font_size ?>> &nbsp; <a href="<? echo $PHP_SELF ?>?ADD=10000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?=$subheader_font_size ?>> Show Phones </a> &nbsp; | &nbsp; <a href="<? echo $PHP_SELF ?>?ADD=11111111111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?=$subheader_font_size ?>> Add A New Phone </a> &nbsp; | &nbsp; <a href="<? echo $PHP_SELF ?>?ADD=12000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?=$subheader_font_size ?>> Phone Alias List </a> &nbsp; | &nbsp; <a href="<? echo $PHP_SELF ?>?ADD=12111111111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?=$subheader_font_size ?>> Add A New Phone Alias </a></TD></TR>
<? }
if (strlen($conference_sh) > 1) {
?>
@@ -4921,26 +4956,57 @@ if ($ADD==11111111111)
echo "<center><TABLE width=$section_width cellspacing=3>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Phone extension: </td><td align=left><input type=text name=extension size=20 maxlength=100 value=\"\">$NWB#phones-extension$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Dial Plan Number: </td><td align=left><input type=text name=dialplan_number size=15 maxlength=20 value=\"$row[1]\"> (digits only)$NWB#phones-dialplan_number$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Voicemail Box: </td><td align=left><input type=text name=voicemail_id size=10 maxlength=10 value=\"$row[2]\"> (digits only)$NWB#phones-voicemail_id$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Outbound CallerID: </td><td align=left><input type=text name=outbound_cid size=10 maxlength=20 value=\"$row[65]\"> (digits only)$NWB#phones-outbound_cid$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Phone IP address: </td><td align=left><input type=text name=phone_ip size=20 maxlength=15 value=\"$row[3]\"> (optional)$NWB#phones-phone_ip$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Computer IP address: </td><td align=left><input type=text name=computer_ip size=20 maxlength=15 value=\"$row[4]\"> (optional)$NWB#phones-computer_ip$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Dial Plan Number: </td><td align=left><input type=text name=dialplan_number size=15 maxlength=20> (digits only)$NWB#phones-dialplan_number$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Voicemail Box: </td><td align=left><input type=text name=voicemail_id size=10 maxlength=10> (digits only)$NWB#phones-voicemail_id$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Outbound CallerID: </td><td align=left><input type=text name=outbound_cid size=10 maxlength=20> (digits only)$NWB#phones-outbound_cid$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Phone IP address: </td><td align=left><input type=text name=phone_ip size=20 maxlength=15> (optional)$NWB#phones-phone_ip$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Computer IP address: </td><td align=left><input type=text name=computer_ip size=20 maxlength=15> (optional)$NWB#phones-computer_ip$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Server IP: </td><td align=left><select size=1 name=server_ip>\n";
echo "$servers_list";
echo "<option SELECTED>$row[5]</option>\n";
echo "</select>$NWB#phones-server_ip$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Login: </td><td align=left><input type=text name=login size=10 maxlength=10 value=\"$row[6]\">$NWB#phones-login$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Password: </td><td align=left><input type=text name=pass size=10 maxlength=10 value=\"$row[7]\">$NWB#phones-pass$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Status: </td><td align=left><select size=1 name=status><option>ACTIVE</option><option>SUSPENDED</option><option>CLOSED</option><option>PENDING</option><option>ADMIN</option><option selected>$row[8]</option></select>$NWB#phones-status$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Active Account: </td><td align=left><select size=1 name=active><option>Y</option><option>N</option><option selected>$row[9]</option></select>$NWB#phones-active$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Phone Type: </td><td align=left><input type=text name=phone_type size=20 maxlength=50 value=\"$row[10]\">$NWB#phones-phone_type$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Full Name: </td><td align=left><input type=text name=fullname size=20 maxlength=50 value=\"$row[11]\">$NWB#phones-fullname$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Company: </td><td align=left><input type=text name=company size=10 maxlength=10 value=\"$row[12]\">$NWB#phones-company$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Picture: </td><td align=left><input type=text name=picture size=20 maxlength=19 value=\"$row[13]\">$NWB#phones-picture$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Client Protocol: </td><td align=left><select size=1 name=protocol><option>SIP</option><option>Zap</option><option>IAX2</option><option>EXTERNAL</option><option selected>$row[16]</option></select>$NWB#phones-protocol$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Local GMT: </td><td align=left><select size=1 name=local_gmt><option>12.75</option><option>12.00</option><option>11.00</option><option>10.00</option><option>9.50</option><option>9.00</option><option>8.00</option><option>7.00</option><option>6.50</option><option>6.00</option><option>5.75</option><option>5.50</option><option>5.00</option><option>4.50</option><option>4.00</option><option>3.50</option><option>3.00</option><option>2.00</option><option>1.00</option><option>0.00</option><option>-1.00</option><option>-2.00</option><option>-3.00</option><option>-3.50</option><option>-4.00</option><option>-5.00</option><option>-6.00</option><option>-7.00</option><option>-8.00</option><option>-9.00</option><option>-10.00</option><option>-11.00</option><option>-12.00</option><option selected>$row[17]</option></select> (Do NOT Adjust for DST)$NWB#phones-local_gmt$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Login: </td><td align=left><input type=text name=login size=10 maxlength=10>$NWB#phones-login$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Password: </td><td align=left><input type=text name=pass size=10 maxlength=10>$NWB#phones-pass$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Status: </td><td align=left><select size=1 name=status><option SELECTED>ACTIVE</option><option>SUSPENDED</option><option>CLOSED</option><option>PENDING</option><option>ADMIN</option></select>$NWB#phones-status$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Active Account: </td><td align=left><select size=1 name=active><option SELECTED>Y</option><option>N</option></select>$NWB#phones-active$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Phone Type: </td><td align=left><input type=text name=phone_type size=20 maxlength=50>$NWB#phones-phone_type$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Full Name: </td><td align=left><input type=text name=fullname size=20 maxlength=50>$NWB#phones-fullname$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Company: </td><td align=left><input type=text name=company size=10 maxlength=10>$NWB#phones-company$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Picture: </td><td align=left><input type=text name=picture size=20 maxlength=19>$NWB#phones-picture$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Client Protocol: </td><td align=left><select size=1 name=protocol><option SELECTED>SIP</option><option>Zap</option><option>IAX2</option><option>EXTERNAL</option></select>$NWB#phones-protocol$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Local GMT: </td><td align=left><select size=1 name=local_gmt><option>12.75</option><option>12.00</option><option>11.00</option><option>10.00</option><option>9.50</option><option>9.00</option><option>8.00</option><option>7.00</option><option>6.50</option><option>6.00</option><option>5.75</option><option>5.50</option><option>5.00</option><option>4.50</option><option>4.00</option><option>3.50</option><option>3.00</option><option>2.00</option><option>1.00</option><option>0.00</option><option>-1.00</option><option>-2.00</option><option>-3.00</option><option>-3.50</option><option>-4.00</option><option SELECTED>-5.00</option><option>-6.00</option><option>-7.00</option><option>-8.00</option><option>-9.00</option><option>-10.00</option><option>-11.00</option><option>-12.00</option></select> (Do NOT Adjust for DST)$NWB#phones-local_gmt$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2><input type=submit name=submit VALUE=SUBMIT></td></tr>\n";
echo "</TABLE></center>\n";
}
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 "<TABLE><TR><TD>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
echo "<br>ADD A NEW PHONE ALIAS<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=ADD value=22111111111>\n";
echo "<center><TABLE width=$section_width cellspacing=3>\n";
echo "<center><TABLE width=$section_width cellspacing=3>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Alias ID: </td><td align=left><input type=text name=alias_id size=20 maxlength=20 value=\"\">$NWB#phones-alias_id$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Alias Name: </td><td align=left><input type=text name=alias_name size=30 maxlength=50> $NWB#phones-alias_name$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Phone Logins List: </td><td align=left><input type=text name=logins_list size=50 maxlength=255> (comma separated)$NWB#phones-logins_list$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2><input type=submit name=submit VALUE=SUBMIT></td></tr>\n";
echo "</TABLE></center>\n";
}
@@ -5900,20 +5966,89 @@ echo "<TABLE><TR><TD>\n";
{echo "<br>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 "<br>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 "<br>PHONE NOT ADDED - there is already a Phone in the system with this login\n";}
else
{
echo "<br>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 "<br>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 "<br>PHONE NOT ADDED - Please go back and look at the data you entered\n";}
else
{
echo "<br>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 "<TABLE><TR><TD>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
$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 "<br>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 "<br>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 "<br>PHONE ALIAS NOT ADDED - Please go back and look at the data you entered\n";}
else
{
echo "<br>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 "<TABLE><TR><TD>\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 "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
$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 "<br>PHONE ALIAS NOT MODIFIED - Please go back and look at the data you entered\n";}
else
{
echo "<br>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 "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
if ( (strlen($alias_id) < 1) or ($LOGast_delete_phones < 1) )
{
echo "<br>PHONE ALIAS NOT DELETED - Please go back and look at the data you entered\n";
echo "<br>Alias ID must be at least 2 characters in length\n";
}
else
{
echo "<br><B>PHONE ALIAS DELETION CONFIRMATION: $alias_id</B>\n";
echo "<br><br><a href=\"$PHP_SELF?ADD=62111111111&alias_id=$alias_id&CoNfIrM=YES\">Click here to delete phone alias $alias_id</a><br><br><br>\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 "<br><B>PHONE DELETION COMPLETED: $extension - $server_ip</B>\n";
@@ -8931,6 +9152,38 @@ $ADD='10000000000'; # go to phone list
}
######################
# ADD=62111111111 delete phone alias record
######################
if ($ADD==62111111111)
{
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
if ( (strlen($alias_id) < 2) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) )
{
echo "<br>PHONE ALIAS NOT DELETED - Please go back and look at the data you entered\n";
echo "<br>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 "<br><B>PHONE ALIAS DELETION COMPLETED: $alias_id</B>\n";
echo "<br><br>\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 "<TABLE><TR><TD>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
$stmt="SELECT * from phones_alias where alias_id='$alias_id';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
echo "<br>MODIFY A PHONE ALIAS RECORD: $row[0]<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=ADD value=42111111111>\n";
echo "<input type=hidden name=alias_id value=\"$row[0]\">\n";
echo "<center><TABLE width=$section_width cellspacing=3>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Alias ID: </td><td align=left><B>$row[0]</B> $NWB#phones-alias_id$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Alias Name: </td><td align=left><input type=text name=alias_name size=30 maxlength=50 value=\"$row[1]\"> $NWB#phones-alias_name$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Phones Logins List: </td><td align=left><input type=text name=logins_list size=50 maxlength=255 value=\"$row[2]\"> (comma separated)$NWB#phones-logins_list$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2><input type=submit name=submit VALUE=SUBMIT></td></tr>\n";
echo "</TABLE></center>\n";
### list of phones in this phones alias
$phone_alias_SQL = ereg_replace(',',"','",$row[2]);
echo "<center>\n";
echo "<br><b>PHONES WITHIN THIS PHONES ALIAS:</b><br>\n";
echo "<TABLE width=600 cellspacing=3>\n";
echo "<tr><td>LOGIN</td><td>EXTENSION</td><td>SERVER</td><td>PROTOCOL</td><td>IP</td></tr>\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 "<tr $bgcolor><td><font size=1><a href=\"$PHP_SELF?ADD=31111111111&extension=$rowx[1]&server_ip=$rowx[2]\">$rowx[0]</a></td><td><font size=1>$rowx[1]</td><td><font size=1>$rowx[2]</td><td><font size=1>$rowx[3]</td><td><font size=1>$rowx[4]</td></tr>\n";
}
echo "</table></center><br>\n";
if ($LOGast_delete_phones > 0)
{
echo "<br><br><a href=\"$PHP_SELF?ADD=52111111111&alias_id=$row[0]\">DELETE THIS PHONE ALIAS</a>\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 "<td align=center><font size=1 color=white><B>LINKS</B></td></tr>\n";
echo "</TABLE></center>\n";
}
######################
# ADD=12000000000 display all phones alias
######################
if ($ADD==12000000000)
{
echo "<TABLE><TR><TD>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
$stmt="SELECT * from phones_alias order by alias_id;";
$rslt=mysql_query($stmt, $link);
$phones_to_print = mysql_num_rows($rslt);
echo "<br>PHONE ALIAS LISTINGS:\n";
echo "<center><TABLE width=$section_width cellspacing=0 cellpadding=1>\n";
echo "<tr bgcolor=black>";
echo "<td><font size=1 color=white><B>ALIAS ID</B></a></td>";
echo "<td><font size=1 color=white><B>ALIAS NAME</B></a></td>";
echo "<td><font size=1 color=white><B>PHONE LOGINS LIST</B></a></td>";
echo "<td align=center><font size=1 color=white><B>MODIFY</B></td></tr>\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 "<tr $bgcolor><td><a href=\"$PHP_SELF?ADD=32111111111&alias_id=$row[0]\"><font size=1 color=black>$row[0]</font></a></td><td><font size=1>$row[1]</td><td><font size=1>$row[2]</td>";
echo "<td><font size=1><a href=\"$PHP_SELF?ADD=32111111111&extension=$row[0]&server_ip=$row[0]\">MODIFY</a></td></tr>\n";
$o++;
}
echo "</TABLE></center>\n";
}
######################
# ADD=100000000000 display all servers
######################
+567
View File
@@ -0,0 +1,567 @@
<?
# sph_report.php
#
# Copyright (C) 2008 Matt Florell <vicidial@gmail.com> 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 #####
?>
<HTML>
<HEAD>
<style type="text/css">
<!--
div.scroll_callback {height: 300px; width: 620px; overflow: scroll;}
div.scroll_list {height: 400px; width: 140px; overflow: scroll;}
div.scroll_script {height: 331px; width: 600px; background: #FFF5EC; overflow: scroll; font-size: 12px; font-family: sans-serif;}
div.text_input {overflow: auto; font-size: 10px; font-family: sans-serif;}
.body_text {font-size: 13px; font-family: sans-serif;}
.preview_text {font-size: 13px; font-family: sans-serif; background: #CCFFCC}
.preview_text_red {font-size: 13px; font-family: sans-serif; background: #FFCCCC}
.body_small {font-size: 11px; font-family: sans-serif;}
.body_tiny {font-size: 10px; font-family: sans-serif;}
.log_text {font-size: 11px; font-family: monospace;}
.log_text_red {font-size: 11px; font-family: monospace; font-weight: bold; background: #FF3333}
.sd_text {font-size: 16px; font-family: sans-serif; font-weight: bold;}
.sh_text {font-size: 14px; font-family: sans-serif; font-weight: bold;}
.sb_text {font-size: 12px; font-family: sans-serif;}
.sk_text {font-size: 11px; font-family: sans-serif;}
.skb_text {font-size: 13px; font-family: sans-serif; font-weight: bold;}
.ON_conf {font-size: 11px; font-family: monospace; color: black; background: #FFFF99}
.OFF_conf {font-size: 11px; font-family: monospace; color: black; background: #FFCC77}
.cust_form {font-family: sans-serif; font-size: 10px; overflow: auto}
.select_bold {font-size: 14px; font-family: sans-serif; font-weight: bold;}
.header_white {font-size: 14px; font-family: sans-serif; font-weight: bold; color: white}
.data_records {font-size: 12px; font-family: sans-serif; color: black}
.data_records_fix {font-size: 12px; font-family: monospace; color: black}
.data_records_fix_small {font-size: 9px; font-family: monospace; color: black}
-->
</style>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<TITLE>VICIDIAL: Agent SPH Report</TITLE>
</HEAD><BODY BGCOLOR=WHITE>
<?
$campaign_ct = count($campaign);
$group_ct = count($group);
$user_group_ct = count($user_group);
$campaign_string='|';
$group_string='|';
$user_group_string='|';
$i=0;
while($i < $campaign_ct)
{
$campaign_string .= "$campaign[$i]|";
$campaign_SQL .= "'$campaign[$i]',";
$i++;
}
if ( (ereg("--NONE--",$campaign_string) ) or ($campaign_ct < 1) )
{
$campaign_SQL = "campaign_id IN('')";
}
else
{
$campaign_SQL = eregi_replace(",$",'',$campaign_SQL);
$campaign_SQL = "campaign_id IN($campaign_SQL)";
}
$i=0;
while($i < $group_ct)
{
$group_string .= "$group[$i]|";
$group_SQL .= "'$group[$i]',";
$i++;
}
if ( (ereg("--NONE--",$group_string) ) or ($group_ct < 1) )
{
$group_SQL = "''";
# $group_SQL = "group_id IN('')";
}
else
{
$group_SQL = eregi_replace(",$",'',$group_SQL);
# $group_SQL = "group_id IN($group_SQL)";
}
$i=0;
while($i < $user_group_ct)
{
$user_group_string .= "$user_group[$i]|";
$user_group_SQL .= "'$user_group[$i]',";
$i++;
}
if ( (ereg("--ALL--",$user_group_string) ) or ($user_group_ct < 1) )
{
$user_group_SQL = "";
}
else
{
$user_group_SQL = eregi_replace(",$",'',$user_group_SQL);
$user_group_SQL = "user_group_id IN($user_group_SQL)";
}
if ($role == "ALL")
{
$role_SQL = "";
}
else
{
$role_SQL = "and role='$role'";
}
if ($DB > 0)
{
echo "<BR>\n";
echo "$campaign_ct|$campaign_string|$campaign_SQL\n";
echo "<BR>\n";
echo "$group_ct|$group_string|$group_SQL\n";
echo "<BR>\n";
echo "$user_group_ct|$user_group_string|$user_group_SQL\n";
echo "<BR>\n";
echo "$role|$role_SQL\n";
echo "<BR>\n";
}
echo "<CENTER>\n";
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET>\n";
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">";
echo "<TABLE BORDER=0 CELLSPACING=6><TR><TD ALIGN=LEFT VALIGN=TOP ROWSPAN=3>\n";
echo "<font class=\"select_bold\"><B>Date Range:</B></font><BR><CENTER>\n";
echo "<INPUT TYPE=TEXT NAME=query_date SIZE=10 MAXLENGTH=10 VALUE=\"$query_date\">";
echo "<BR>to<BR>\n";
echo "<INPUT TYPE=TEXT NAME=end_date SIZE=10 MAXLENGTH=10 VALUE=\"$end_date\">\n";
/*
echo "</TD><TD ALIGN=LEFT VALIGN=TOP ROWSPAN=2>\n";
echo "<font class=\"select_bold\"><B>Campaigns:</B></font><BR><CENTER>\n";
echo "<SELECT SIZE=5 NAME=campaign[] multiple>\n";
$o=0;
while ($campaigns_to_print > $o)
{
if (ereg("\|$LISTcampaigns[$o]\|",$campaign_string))
{echo "<option selected value=\"$LISTcampaigns[$o]\">$LISTcampaigns[$o]</option>\n";}
else
{echo "<option value=\"$LISTcampaigns[$o]\">$LISTcampaigns[$o]</option>\n";}
$o++;
}
echo "</SELECT>\n";
*/
echo "</TD><TD ALIGN=LEFT VALIGN=TOP ROWSPAN=3>\n";
echo "<font class=\"select_bold\"><B>Inbound Groups:</B></font><BR><CENTER>\n";
echo "<SELECT SIZE=5 NAME=group[] multiple>\n";
$o=0;
while ($groups_to_print > $o)
{
if (ereg("\|$LISTgroups[$o]\|",$group_string))
{echo "<option selected value=\"$LISTgroups[$o]\">$LISTgroups[$o]</option>\n";}
else
{echo "<option value=\"$LISTgroups[$o]\">$LISTgroups[$o]</option>\n";}
$o++;
}
echo "</SELECT>\n";
echo "</TD><TD ALIGN=LEFT VALIGN=TOP ROWSPAN=3>\n";
echo "<font class=\"select_bold\"><B>User Groups:</B></font><BR><CENTER>\n";
echo "<SELECT SIZE=5 NAME=user_group[] multiple>\n";
$o=0;
while ($user_groups_to_print > $o)
{
if (ereg("\|$LISTuser_groups[$o]\|",$user_group_string))
{echo "<option selected value=\"$LISTuser_groups[$o]\">$LISTuser_groups[$o]</option>\n";}
else
{echo "<option value=\"$LISTuser_groups[$o]\">$LISTuser_groups[$o]</option>\n";}
$o++;
}
echo "</SELECT>\n";
echo "</TD><TD ALIGN=LEFT VALIGN=TOP>\n";
echo "<font class=\"select_bold\"><B>Shift:</B></font><BR>\n";
echo "<SELECT SIZE=1 NAME=shift>\n";
echo "<option selected value=\"$shift\">$shift</option>\n";
echo "<option value=\"\">--</option>\n";
echo "<option value=\"AM\">AM</option>\n";
echo "<option value=\"PM\">PM</option>\n";
echo "<option value=\"ALL\">ALL</option>\n";
echo "</SELECT>&nbsp;\n";
echo "</TD><TD ALIGN=LEFT VALIGN=TOP COLSPAN=2>\n";
echo "<font class=\"select_bold\"><B>Role:</B></font><BR>\n";
echo "<SELECT SIZE=1 NAME=role>\n";
echo "<option selected value=\"$role\">$role</option>\n";
echo "<option value=\"\">--</option>\n";
echo "<option value=\"FRONTER\">FRONTER</option>\n";
echo "<option value=\"CLOSER\">CLOSER</option>\n";
echo "<option value=\"ALL\">ALL</option>\n";
echo "</SELECT>&nbsp;\n";
echo "</TD><TD ALIGN=CENTER VALIGN=TOP ROWSPAN=3>\n";
echo "<FONT class=\"select_bold\" COLOR=BLACK SIZE=2> &nbsp; &nbsp; <a href=\"./admin.php?ADD=999999\">REPORTS</a> </FONT>\n";
echo "</TD></TR><TR></TD><TD ALIGN=LEFT VALIGN=TOP COLSPAN=2>\n";
echo "<font class=\"select_bold\"><B>Order:</B></font><BR>\n";
echo "<SELECT SIZE=1 NAME=order>\n";
echo "<option selected value=\"$order\">$order</option>\n";
echo "<option value=\"\">--</option>\n";
echo "<option>sph_up</option>\n";
echo "<option>sph_down</option>\n";
echo "<option>hours_up</option>\n";
echo "<option>hours_down</option>\n";
echo "<option>sales_up</option>\n";
echo "<option>sales_down</option>\n";
echo "<option>calls_up</option>\n";
echo "<option>calls_down</option>\n";
echo "<option>user_up</option>\n";
echo "<option>user_down</option>\n";
echo "<option>name_up</option>\n";
echo "<option>name_down</option>\n";
echo "</SELECT><BR><CENTER>\n";
echo "</TD><TD ALIGN=LEFT VALIGN=TOP>\n";
echo "<font class=\"select_bold\"><B>User:</B></font><BR>\n";
echo "<INPUT TYPE=text NAME=user SIZE=7 MAXLENGTH=20 VALUE=\"$user\">\n";
echo "</TD></TR><TR></TD><TD ALIGN=LEFT VALIGN=TOP COLSPAN=3>\n";
echo "<INPUT TYPE=SUBMIT NAME=SUBMIT VALUE=SUBMIT>\n";
echo "</TD></TR></TABLE>\n";
echo "</FORM>\n\n";
echo "<PRE><FONT SIZE=3>\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</PRE>\n";
echo "<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=3><TR BGCOLOR=BLACK>\n";
echo "<TD ALIGN=CENTER><FONT class=\"header_white\">#</TD>\n";
echo "<TD ALIGN=CENTER><FONT class=\"header_white\">&nbsp; USER &nbsp;</TD>\n";
echo "<TD ALIGN=CENTER><FONT class=\"header_white\">&nbsp; NAME &nbsp;</TD>\n";
echo "<TD ALIGN=CENTER><FONT class=\"header_white\">&nbsp; ROLE &nbsp;</TD>\n";
echo "<TD ALIGN=CENTER><FONT class=\"header_white\">&nbsp; GROUP &nbsp;</TD>\n";
echo "<TD ALIGN=CENTER><FONT class=\"header_white\">&nbsp; CALLS &nbsp;</TD>\n";
echo "<TD ALIGN=CENTER><FONT class=\"header_white\">&nbsp; HOURS &nbsp;</TD>\n";
echo "<TD ALIGN=CENTER><FONT class=\"header_white\">&nbsp; SALES &nbsp;</TD>\n";
echo "<TD ALIGN=CENTER><FONT class=\"header_white\">&nbsp; SPH &nbsp;</TD>\n";
echo "</TR>\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 "<TR $bgcolor>\n";
echo "<TD ALIGN=LEFT><FONT class=\"data_records_fix_small\">$j</TD>\n";
echo "<TD><FONT class=\"data_records\">$user_id[$i] </TD>\n";
echo "<TD><FONT class=\"data_records\">$full_name[$i] </TD>\n";
echo "<TD><FONT class=\"data_records\">$roleX[$i] </TD>\n";
echo "<TD><FONT class=\"data_records\">$group[$i] </TD>\n";
echo "<TD ALIGN=RIGHT><FONT class=\"data_records_fix\"> $calls[$i]</TD>\n";
echo "<TD ALIGN=RIGHT><FONT class=\"data_records_fix\"> $hours[$i]</TD>\n";
echo "<TD ALIGN=RIGHT><FONT class=\"data_records_fix\"> $sales[$i]</TD>\n";
echo "<TD ALIGN=RIGHT><FONT class=\"data_records_fix\"> $sph[$i]</TD>\n";
echo "</TR>\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 "<TR BGCOLOR=#E6E6E6>\n";
echo "<TD ALIGN=LEFT COLSPAN=5><FONT class=\"data_records\">TOTALS</TD>\n";
echo "<TD ALIGN=RIGHT><FONT class=\"data_records_fix\"> $TOTcalls</TD>\n";
echo "<TD ALIGN=RIGHT><FONT class=\"data_records_fix\"> $TOThours</TD>\n";
echo "<TD ALIGN=RIGHT><FONT class=\"data_records_fix\"> $TOTsales</TD>\n";
echo "<TD ALIGN=RIGHT><FONT class=\"data_records_fix\"> $TOTsph</TD>\n";
echo "</TR>\n";
echo "</TABLE>\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";
}
?>
</CENTER>
</BODY></HTML>