From bcb667eef3352f1f7105949d8157540788dc0b30 Mon Sep 17 00:00:00 2001 From: mattf Date: Tue, 27 Jan 2009 08:03:01 +0000 Subject: [PATCH] added click-to-dial to Vtiger integration added agent alert option to vicidial.php some bug fixes and doc updates git-svn-id: svn://192.168.202.10@1038 3d104415-ff17-0410-8863-d5cf3c621b8a --- UPGRADE | 6 +- bin/AST_VDsales_export.pl | 2 +- docs/AGENT_API.txt | 16 +- docs/QUEUEMETRICS.txt | 43 +- docs/REQUIRED_APPS_INSTALL.txt | 8 +- docs/VTIGER.txt | 28 +- extras/MySQL_AST_CREATE_tables.sql | 10 +- extras/Vtiger504_vicidial.patch | 250 +++ extras/mysql-tuning.sh | 1466 +++++++++++++++++ extras/upgrade_2.0.5.sql | 6 + extras/vtiger_user_file_504.patch | 21 - .../TO_BE_TRANSLATED_2.0.5.txt | 5 +- www/agc/api.php | 2 + www/agc/vdc_db_query.php | 72 +- www/agc/vicidial.php | 113 +- www/vicidial/admin.php | 32 +- www/vicidial/admin_search_lead.php | 6 +- www/vicidial/vtiger_search.php | 12 +- 18 files changed, 1987 insertions(+), 111 deletions(-) create mode 100644 extras/Vtiger504_vicidial.patch create mode 100644 extras/mysql-tuning.sh delete mode 100644 extras/vtiger_user_file_504.patch diff --git a/UPGRADE b/UPGRADE index 140cba97..d3274ebe 100644 --- a/UPGRADE +++ b/UPGRADE @@ -218,7 +218,8 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom on Asterisk IVRs 49. Updated Vtiger integration to version 5.0.4 and allow searching by - leads/accounts/vendors. Also added user synchronization with vicidial_users + leads/accounts/vendors. Also added user synchronization with vicidial_users. + Also added click-to-dial from Vtiger sending call to vicidial agent screen 50. Added notification of time synchronization problems in the vicidial.php page @@ -228,6 +229,9 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom specific agents using the AGENTDIRECT transfer group with LOCAL CLOSER button and putting the agent to send the call to in the Number To Dial field. +52. Added agent alert option to agent screen. sends browser alert prompt when + a call is send to the agent screen. + diff --git a/bin/AST_VDsales_export.pl b/bin/AST_VDsales_export.pl index b3cfe197..b4c99111 100644 --- a/bin/AST_VDsales_export.pl +++ b/bin/AST_VDsales_export.pl @@ -668,9 +668,9 @@ if ($output_format =~ /^fixed-as400$/) if ($status =~ /^DROP$/) {$status = 'N';} if ($status =~ /^SALE$/) {$status = 'AP';} if ($status =~ /^A6$/) {$status = 'A6';} + if ($status =~ /^DC$/) {$status = 'D';} if ($status =~ /^DNC$/) {$status = 'DC';} if ($status =~ /^DNCL$/) {$status = 'DC';} - if ($status =~ /^DC$/) {$status = 'D';} if ($status =~ /^DIED$/) {$status = 'DD';} if ($status =~ /^COMP$/) {$status = 'DD';} if ($status =~ /^DEC$/) {$status = 'DD';} diff --git a/docs/AGENT_API.txt b/docs/AGENT_API.txt index 3aebb72e..11518a07 100644 --- a/docs/AGENT_API.txt +++ b/docs/AGENT_API.txt @@ -31,17 +31,17 @@ Required variables for API calls: Example URL strings for API calls: http://server/agc/api.php?function=version -http://server/agc/api.php?user=6666&pass=1234&agent_user=1000&function=external_hangup&value=1 -http://server/agc/api.php?user=6666&pass=1234&agent_user=1000&function=external_status&value=A -http://server/agc/api.php?user=6666&pass=1234&agent_user=1000&function=external_pause&value=PAUSE -http://server/agc/api.php?user=6666&pass=1234&agent_user=1000&function=external_pause&value=RESUME -http://server/agc/api.php?user=6666&pass=1234&agent_user=1000&function=external_dial&value=7275551212&phone_code=1&search=YES +http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=external_hangup&value=1 +http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=external_status&value=A +http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=external_pause&value=PAUSE +http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=external_pause&value=RESUME +http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=external_dial&value=7275551212&phone_code=1&search=YES&preview=NO&focus=YES To hangup the call, disposition it and then pause the agent, do the following in order: -http://server/agc/api.php?user=6666&pass=1234&agent_user=1000&function=external_pause&value=PAUSE -http://server/agc/api.php?user=6666&pass=1234&agent_user=1000&function=external_hangup&value=1 -http://server/agc/api.php?user=6666&pass=1234&agent_user=1000&function=external_status&value=A +http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=external_pause&value=PAUSE +http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=external_hangup&value=1 +http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=external_status&value=A diff --git a/docs/QUEUEMETRICS.txt b/docs/QUEUEMETRICS.txt index c4ca9bf2..bdd9f373 100644 --- a/docs/QUEUEMETRICS.txt +++ b/docs/QUEUEMETRICS.txt @@ -6,12 +6,14 @@ This document goes over the features and needed changes made to VICIDIAL to enab QueueMetrics is a closed-source, commercial product written by Loway Research in Italy. The writers of VICIDIAL do not support or warranty QueueMetrics or it's functionality with VICIDIAL in any way. -This feature was added to the package at the request of several users of VICIDIAL and was achieved with some help from the makers of QueueMetrics(although all VICIDIAL code changes were done entirely by Matt Florell). +This feature was added to the package at the request of several users of VICIDIAL and was achieved with some help from the creators of QueueMetrics(although all VICIDIAL code changes were done entirely by Matt Florell). This feature is functional on outbound manual dialing, auto dialing and inbound call handling as of 2008-06-30(SVN trunk 2.0.5). as of 2008-10-30, several validation and correction functions were added to the AST_cleanup_agent_log.pl script that is supposed to run every hour. These functions should clean up any queue_log errors that appear and cause QueueMetrics to display incorrect call totals. +Another very important issue to note is that just like with VICIDIAL on multi-server systems, if QueueMetrics data is being generated on a multi-server system the data will be corrupted if all of the servers are not on the same time. I strongly recommend getting ntp working properly on all servers in a VICIDIAL or QueueMetrics server cluster. + Here is a short summary of the needed steps to install QueueMetrics on your system: @@ -93,21 +95,24 @@ GRANT ALL PRIVILEGES ON queuemetrics.* TO qm@'%' IDENTIFIED BY 'qm'; Second, the queue_log table: mysql> describe queue_log; -+-----------+------------------+------+-----+---------+-------+ -| Field | Type | Null | Key | Default | Extra | -+-----------+------------------+------+-----+---------+-------+ -| partition | char(20) | NO | MUL | | | -| time_id | int(11) unsigned | NO | MUL | 0 | | -| call_id | char(30) | NO | MUL | | | -| queue | char(30) | NO | | | | -| agent | char(30) | NO | | | | -| verb | char(30) | NO | | | | -| data1 | char(30) | NO | | | | -| data2 | char(30) | NO | | | | -| data3 | char(30) | NO | | | | -| data4 | char(30) | NO | | | | -| serverid | varchar(10) | NO | | 0 | | -+-----------+------------------+------+-----+---------+-------+ ++------------------+------------------+------+-----+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++------------------+------------------+------+-----+---------+-------+ +| partition | char(20) | NO | MUL | NULL | | +| time_id | int(11) unsigned | NO | MUL | 0 | | +| call_id | char(30) | NO | MUL | NULL | | +| queue | char(30) | NO | | NULL | | +| agent | char(30) | NO | | NULL | | +| verb | char(30) | NO | | NULL | | +| data1 | char(30) | NO | | NULL | | +| data2 | char(30) | NO | | NULL | | +| data3 | char(30) | NO | | NULL | | +| data4 | char(30) | NO | | NULL | | +| serverid | varchar(10) | NO | | 0 | | +| fileid | int(10) unsigned | NO | | NULL | | +| recordid | int(10) unsigned | NO | | NULL | | +| unique_row_count | int(11) | NO | | NULL | | ++------------------+------------------+------+-----+---------+-------+ Use the following query to create a queue_log table in your asterisk database to gather queue_log entries without doing a full QueueMetrics install: @@ -124,10 +129,14 @@ data2 VARCHAR(30) NOT NULL, data3 VARCHAR(30) NOT NULL, data4 VARCHAR(30) NOT NULL, serverid VARCHAR(10) NOT NULL default '0', +fileid INT(10) UNSIGNED, +recordid INT(10) UNSIGNED, unique_row_count INT(10) UNSIGNED NOT NULL, -index(time_id) +index(time_id), +index(call_id) ); + partition: set to "P01" for the first partition, should match up with configuration.properties presets time_id: epoch, unixtime (seconds since 1970-01-01 00:00:00) [1170345603] diff --git a/docs/REQUIRED_APPS_INSTALL.txt b/docs/REQUIRED_APPS_INSTALL.txt index dcd199bb..27ece627 100644 --- a/docs/REQUIRED_APPS_INSTALL.txt +++ b/docs/REQUIRED_APPS_INSTALL.txt @@ -40,7 +40,7 @@ vi /etc/my.cnf # add this line below 'skip-locking' skip-name-resolve # comment out the line 'log-bin=mysql-bin' - + max_connections = 200 perl -MCPAN -e shell install MD5 @@ -510,9 +510,9 @@ rm -f /usr/lib/asterisk/modules/res_speech.so mkdir /usr/src/asterisk-1.4 cd /usr/src/asterisk-1.4 -wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.4.21.2.tar.gz -wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.4.12.1.tar.gz -wget http://ftp.digium.com/pub/libpri/releases/libpri-1.4.7.tar.gz +wget http://downloads.digium.com/pub/asterisk/releases/asterisk-1.4.21.2.tar.gz +wget http://downloads.digium.com/pub/zaptel/releases/zaptel-1.4.12.1.tar.gz +wget http://downloads.digium.com/pub/libpri/releases/libpri-1.4.7.tar.gz gunzip asterisk-1.4.21.2.tar.gz tar xvf asterisk-1.4.21.2.tar gunzip zaptel-1.4.12.1.tar.gz diff --git a/docs/VTIGER.txt b/docs/VTIGER.txt index 5f527f12..93d24aad 100644 --- a/docs/VTIGER.txt +++ b/docs/VTIGER.txt @@ -6,10 +6,11 @@ Current integration features: - vicidial.php WEBFORM search for lead/account/vendor - user synchronization of VICIDIAL users to Vtiger user database - added activity event option(call logging in Vtiger) when going from VICIDIAL to Vtiger +- added ability to click-to-dial a phone number from a record in Vtiger screen to the vicidial.php screen -There has been a basic vtiger integration option available in VICIDIAL since the 1.X release versions through the vtiger_search.php web script(when used as a web form in the campaign) that will search through the leads for the dialed phone number in vicidial.php and if it is not in the vtiger system as a lead then it will be put in as a new contact. +There has been a basic vtiger integration option available in VICIDIAL since the 1.X release versions through the vtiger_search.php web script(when used as a web form in the campaign) that will search through the leads for the dialed phone number in vicidial.php and if it is not in the vtiger system as a lead then it will be put in as a new lead. -More in-depth integration with Vtiger is a bit complicated due to the fact that it has 312 database tables(and you though VICIDIAL had a lot at 70). Attempts at using the built-in 5.0.4 API structure were unsuccessful because of inaccurate documentation and the inability to use the modules easily outside of the vtiger directory tree without major reworking of the vtiger code, so we decided to have VICIDIAL work directly with the database instead. Unfortunately, working only with the database doesn't get you the whole way with Vtiger. For user synchronization you need to make sure that the patch(vtiger_user_file_504.patch) is applied to Vtiger(see instructions below). This patch is used to create blank user profile files so Vtiger will load properly with synchronized users from VICIDIAL. Vtiger doesn't check to see if these user profile files exist before trying to use them, so all this patch does is check if the files exist for each user, and if they do not, it will create them with a simple placeholder. +More in-depth integration with Vtiger is a bit complicated due to the fact that it has 312 database tables(and you though VICIDIAL had a lot with about 70). Attempts at using the built-in 5.0.4 API structure were unsuccessful because of inaccurate documentation and the inability to use the modules easily outside of the vtiger directory tree without major reworking of the vtiger code, so we decided to have VICIDIAL work directly with the database instead. Unfortunately, working only with the database doesn't get you the whole way with Vtiger. For user synchronization you need to make sure that the patch(Vtiger504_vicidial.patch) is applied to Vtiger(see instructions below). This patch is used to create blank user profile files so Vtiger will load properly with synchronized users from VICIDIAL. Vtiger doesn't check to see if these user profile files exist before trying to use them, so one thing this patch does is check if the files exist for each user, and if they do not, it will create them with a simple placeholder. Another purpose of this patch is to allow for click-to-dial phone numbers in Vtiger, so that the numbers will be dialed as manual dial calls in a VICIDIAL agent screen. For this to work you must have applied the patch and the agent needs to be logged into vicidial.php(there is also a VICIDIAL Campaign Detail option to automatically login to Vtiger when an agent logs into vicidial.php) then when the agent clicks on any phone number with a "VCcall:" lable bext to it, a call will be placed in their vicidial.php agent screen and the Vtiger window will be closed so that they can open it up again with the vicidial.php WEB FORM button in VICIDIAL. as of 2008-12-31, several user synchronization features have been added to allow for the creation of vtiger users from the vicidial_users user database. The vtiger_search.php script has also been updated to work with the current vtiger release 5.0.4. To enable the Vtiger integration features you will need to go to the Admin -> System Settings section of the admin.php Administration web page to set Vtiger Integration to enabled and configure the connection details for the Vtiger database. @@ -19,7 +20,8 @@ There are options in the VICIDIAL Modify Campaign Detail screen that you can cho VENDOR- This option will only search through the Vtiger vendors LEAD- This option will search through the Vtiger leads only -Multiple search options can be used for each campaign, but on large databases this is not recommended. Default is LEAD. The order that you see the searching options above is the order in which they will be searched if you have selected multiple searching methods. If an account does not exist and you have LEAD selected as a search method, then(if the create lead option is enabled) it will insert the lead with that phone number and you will be taken to the edit screen for that lead when you go to the vtiger_search web page. There is also an option to log the call as an event in Vtiger that will associate with the Lead or Account that the agent screen is sent to. Vtiger recommends on standard equipment a limit of 50,000 account records, but many users report no issues with 100,000 or more account records in their Vtiger systems. + NOTE: For this to work, you must have the vtiger_search.php set as your webform page, i.e.(http://10.10.10.15/vicidial/vtiger_search.php) +Multiple search options can be used for each campaign(in the VICIDIAL Campaign Detail screen), but on large databases this is not recommended. Default is LEAD. The order that you see the searching options above is the order in which they will be searched if you have selected multiple searching methods. If an account does not exist and you have LEAD selected as a search method, then(if the create lead option is enabled) it will insert the lead with that phone number and you will be taken to the edit screen for that lead when you go to the vtiger_search web page. There is also an option to log the call as an event in Vtiger that will associate with the Lead or Account that the agent screen is sent to. Vtiger recommends on standard equipment a limit of 50,000 account records, but many users report no issues with 100,000 or more account records in their Vtiger systems. Here are the SQL queries used by the vtiger_search.php script to find records in the vtiger system: @@ -67,9 +69,9 @@ ls -l * database name: vtigercrm504 * change default admin(vtadmin) and standarduser(vtuser) passwords * click to install vtiger, then follow the on-screen instructions -# patch vtiger to fix issue with user synchronization: -wget http://www.eflo.net/files/vtiger_user_file_504.patch -patch -p1 < ./vtiger_user_file_504.patch +# patch vtiger to fix issue with user synchronization and add click-to-dial: +wget http://www.eflo.net/files/Vtiger504_vicidial.patch +patch -p1 < ./Vtiger504_vicidial.patch @@ -278,3 +280,17 @@ duration_minutes: 5 recurringtype: --None-- + +Files edited within Vtiger to allow for click-to-dial and user integration: +./include/utils/ListViewUtils.php +./Smarty/templates/DetailViewFields.tpl +./Smarty/templates/DetailViewUI.tpl +./include/js/general.js +./include/js/dtlviewajax.js +./vtigerservice.php +./include/utils/UserInfoUtil.php + +Click-to-dial: +uitype = '11' for phone fields + + diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index 0b5a7e7b..8bb4441e 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -478,7 +478,8 @@ alter_custphone_override ENUM('NOT_ACTIVE','ALLOW_ALTER') default 'NOT_ACTIVE', vdc_agent_api_access ENUM('0','1') default '0', modify_inbound_dids ENUM('1','0') default '0', delete_inbound_dids ENUM('1','0') default '0', -active ENUM('Y','N') default 'Y' +active ENUM('Y','N') default 'Y', +alert_enabled ENUM('1','0') default '0' ); @@ -607,7 +608,8 @@ three_way_dial_prefix VARCHAR(20) default '', web_form_target VARCHAR(100) NOT NULL default 'vdcwebform', vtiger_search_category VARCHAR(100) default 'LEAD', vtiger_create_call_record ENUM('Y','N') default 'Y', -vtiger_create_lead_record ENUM('Y','N') default 'Y' +vtiger_create_lead_record ENUM('Y','N') default 'Y', +vtiger_screen_login ENUM('Y','N') default 'Y' ); CREATE TABLE vicidial_lists ( @@ -1357,7 +1359,7 @@ INSERT INTO vicidial_inbound_groups(group_id,group_name,group_color,active,queue INSERT INTO vicidial_lists SET list_id='999',list_name='Default inbound list',campaign_id='TESTCAMP',active='N'; INSERT INTO vicidial_lists SET list_id='998',list_name='Default Manual list',campaign_id='TESTCAMP',active='N'; -INSERT INTO system_settings (version,install_date) values('2.0.X', CURDATE()); +INSERT INTO system_settings (version,install_date) values('2.0.5b0.5', CURDATE()); INSERT INTO vicidial_status_categories (vsc_id,vsc_name) values('UNDEFINED','Default Category'); @@ -1424,7 +1426,7 @@ CREATE INDEX phone_number on vicidial_closer_log (phone_number); CREATE INDEX date_user on vicidial_closer_log (call_date,user); CREATE INDEX comment_a on live_inbound_log (comment_a); -UPDATE system_settings SET db_schema_version='1125'; +UPDATE system_settings SET db_schema_version='1126'; GRANT RELOAD ON *.* TO cron@'%'; GRANT RELOAD ON *.* TO cron@localhost; diff --git a/extras/Vtiger504_vicidial.patch b/extras/Vtiger504_vicidial.patch new file mode 100644 index 00000000..ed36179b --- /dev/null +++ b/extras/Vtiger504_vicidial.patch @@ -0,0 +1,250 @@ +--- ./Smarty/templates/DetailViewFields.tpl 2009-01-26 11:01:37.000000000 -0500 ++++ ./Smarty/templates/DetailViewFields.tpl 2009-01-26 15:03:13.000000000 -0500 +@@ -13,28 +13,34 @@ + -->*} + + +- {if $keyid eq '1' || $keyid eq 2 || $keyid eq '11' || $keyid eq '7' || $keyid eq '9' || $keyid eq '55' || $keyid eq '71' || $keyid eq '72' || $keyid eq '255'} +-   +- {if $keyid eq '55' || $keyid eq '255'} +- {if $keyaccess eq $APP.LBL_NOT_ACCESSIBLE} +- {$APP.LBL_NOT_ACCESSIBLE} +- {else} +- {$keysalut} +- {/if} +- {*elseif $keyid eq '71' || $keyid eq '72'} ++ {if $keyid eq '1' || $keyid eq 2 || $keyid eq '7' || $keyid eq '9' || $keyid eq '55' || $keyid eq '71' || $keyid eq '72' || $keyid eq '255'} ++   ++ {if $keyid eq '55' || $keyid eq '255'} ++ {if $keyaccess eq $APP.LBL_NOT_ACCESSIBLE} ++ {$APP.LBL_NOT_ACCESSIBLE} ++ {else} ++ {$keysalut} ++ {/if} ++ {*elseif $keyid eq '71' || $keyid eq '72'} + {$keycursymb*} + {/if} + {$keyval} + + {elseif $keyid eq '13'} + +- {if $smarty.session.internal_mailer eq 1} ++ {if $smarty.session.internal_mailer eq 1} + {$keyval} + {else} + {$keyval} + {/if} + +- ++ ++ {elseif $keyid eq '11'} ++ ++ ++ VCcall: {$keyval} ++ ++ + {elseif $keyid eq '15' || $keyid eq '16' || $keyid eq '111'} +   + {foreach item=arr from=$keyoptions} +--- ./Smarty/templates/DetailViewUI.tpl 2009-01-26 11:03:34.000000000 -0500 ++++ ./Smarty/templates/DetailViewUI.tpl 2009-01-26 15:03:44.000000000 -0500 +@@ -13,7 +13,7 @@ + -->*} + + +- {if $keyid eq '1' || $keyid eq 2 || $keyid eq '11' || $keyid eq '7' || $keyid eq '9' || $keyid eq '55' || $keyid eq '71' || $keyid eq '72' || $keyid eq '103' || $keyid eq '255'} ++ {if $keyid eq '1' || $keyid eq 2 || $keyid eq '7' || $keyid eq '9' || $keyid eq '55' || $keyid eq '71' || $keyid eq '72' || $keyid eq '103' || $keyid eq '255'} + + {if $keyid eq '55' || $keyid eq '255'} + {if $keyaccess eq $APP.LBL_NOT_ACCESSIBLE} +@@ -46,6 +46,17 @@ + + + ++ {elseif $keyid eq '11'} ++ ++ VCcall: ++ {$keyval} ++ ++ ++ + + {elseif $keyid eq '15' || $keyid eq '16' || $keyid eq '111'} + {foreach item=arr from=$keyoptions} +--- ./vtigerservice.php 2009-01-26 20:13:22.000000000 -0500 ++++ ./vtigerservice.php 2009-01-26 22:16:02.000000000 -0500 +@@ -42,6 +42,58 @@ + } + else + { ++ if(isset($_REQUEST['VCcall'])) ++ { ++ $CL=':'; ++ $server_name = getenv("SERVER_NAME"); ++ $server_port = getenv("SERVER_PORT"); ++ if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} ++ else {$HTTPprotocol = 'http://';} ++ if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} ++ else {$server_port = "$CL$server_port";} ++ $URLbase = "$HTTPprotocol$server_name$server_port"; ++ ++ global $entityDel; ++ global $display; ++ global $category; ++ header('Content-Type: text/html; charset='. $charset); ++ session_start(); ++ require_once('include/utils/utils.php'); ++ require_once('config.inc.php'); ++ $default_config_values = Array( "allow_exports"=>"all","upload_maxsize"=>"3000000", "listview_max_textlength" => "40" ); ++ set_default_config($default_config_values); ++ require_once('include/logging.php'); ++ require_once('modules/Users/Users.php'); ++ global $currentModule; ++ $current_user = new Users(); ++ ++ $log =& LoggerManager::getLogger('index'); ++ global $seclog; ++ $seclog =& LoggerManager::getLogger('SECURITY'); ++ $log->debug($_REQUEST); ++ ++ // Check to see if there is an authenticated user in the session. ++ if(isset($_SESSION["authenticated_user_id"]) && (isset($_SESSION["app_unique_key"]) && $_SESSION["app_unique_key"] == $application_unique_key)) ++ { ++ $log->debug("We have an authenticated user id: ".$_SESSION["authenticated_user_id"]); ++ $result = $current_user->retrieveCurrentUserInfoFromFile($_SESSION['authenticated_user_id']); ++ $log->debug('Current user is: '.$current_user->user_name); ++ } ++ ++ $phone = $_REQUEST['phone']; ++ $user = $current_user->user_name; ++ ++ $VCapiURL = "/agc/api.php"; ++ $VCpauseQuery = "?source=vtiger&user=1000&pass=1234&agent_user=$user&function=external_pause&value=PAUSE"; ++ $VCcallQuery = "?source=vtiger&user=1000&pass=1234&agent_user=$user&function=external_dial&value=$phone&phone_code=1&search=YES&preview=NO&focus=YES"; ++ $replyP = file("$URLbase$VCapiURL$VCpauseQuery"); ++// sleep(1); ++ $replyC = file("$URLbase$VCapiURL$VCcallQuery"); ++ echo "$replyP[0]|$replyC[0]\n"; ++// echo "$URLbase$VCapiURL$VCcallQuery\n"; ++ } ++ else ++ { + echo "

vtigerCRM Soap Services

"; + echo "
  • vtigerCRM Outlook Plugin EndPoint URL -- Click here
  • "; + echo "
  • vtigerCRM Word Plugin EndPoint URL -- Click here
  • "; +@@ -49,6 +101,7 @@ + echo "
  • vtigerCRM Customer Portal EndPoint URL -- Click here
  • "; + echo "
  • vtigerCRM WebForm EndPoint URL -- Click here
  • "; + echo "
  • vtigerCRM FireFox Extension EndPoint URL -- Click here
  • "; ++ } + } + + +--- ./include/js/dtlviewajax.js 2009-01-26 13:59:25.000000000 -0500 ++++ ./include/js/dtlviewajax.js 2009-01-26 15:02:33.000000000 -0500 +@@ -293,6 +293,9 @@ + if(secEmail) + secEmail.value = tagValue; + } ++ }else if(uitype == '11') ++ { ++ getObj(dtlView).innerHTML = ""+tagValue+" "; + }else if(uitype == '17') + { + getObj(dtlView).innerHTML = ""+tagValue+" "; +--- ./include/js/general.js 2009-01-26 14:14:11.000000000 -0500 ++++ ./include/js/general.js 2009-01-26 21:26:31.000000000 -0500 +@@ -1768,6 +1768,54 @@ + openPopUp('xComposeEmail',this,url,'createemailWin',830,662,opts); + } + ++function VICIDIALcall(record_id,field_name,phone,user_name) { ++//alert(record_id + "|" + field_name + "|" + phone + "|" user_name); ++var xmlhttp=false; ++/*@cc_on @*/ ++/*@if (@_jscript_version >= 5) ++// JScript gives us Conditional compilation, we can cope with old IE versions. ++// and security blocked creation of the objects. ++ try { ++ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); ++ } catch (e) { ++ try { ++ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); ++ } catch (E) { ++ xmlhttp = false; ++ } ++ } ++@end @*/ ++if (!xmlhttp && typeof XMLHttpRequest!='undefined') ++ { ++ xmlhttp = new XMLHttpRequest(); ++ } ++if (xmlhttp) ++ { ++ var VCcallQuery = "VCcall=1&phone=" + phone; ++ xmlhttp.open('POST', 'vtigerservice.php'); ++ xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); ++ xmlhttp.send(VCcallQuery); ++ xmlhttp.onreadystatechange = function() ++ { ++ if (xmlhttp.readyState == 4 && xmlhttp.status == 200) ++ { ++ // alert(xmlhttp.responseText); ++ var Xoutput = null; ++ Xoutput = xmlhttp.responseText; ++ var regXFerr = new RegExp("ERROR","g"); ++ if (Xoutput.match(regXFerr)) ++ { ++ alert(xmlhttp.responseText); ++ } ++ else ++ { ++ self.close(); ++ } ++ } ++ } ++ delete xmlhttp; ++ } ++} + function fnHide_Event(obj){ + document.getElementById(obj).style.visibility = 'hidden'; + } +--- ./include/utils/ListViewUtils.php 2009-01-26 10:42:14.000000000 -0500 ++++ ./include/utils/ListViewUtils.php 2009-01-26 18:54:39.000000000 -0500 +@@ -1291,6 +1291,11 @@ + $value = ''.$temp_val.''; + + } ++ // VICIDIAL agent screen phone number click to dial ++ elseif($uitype == 11) ++ { ++ $value = "VCcall: user_name');\">$temp_val"; ++ } + elseif($uitype == 56) + { + if($temp_val == 1) +--- ./include/utils/UserInfoUtil.php 2008-12-31 21:39:39.000000000 -0500 ++++ ./include/utils/UserInfoUtil.php 2009-01-01 01:20:17.000000000 -0500 +@@ -1175,6 +1175,18 @@ + global $adb; + global $current_user; + global $seclog; ++ if (!file_exists('user_privileges/user_privileges_'.$current_user->id.'.php')) ++ { ++ $up = fopen('user_privileges/user_privileges_'.$current_user->id.'.php',"a"); ++ fwrite($up, ''); ++ fclose($up); ++ } ++ if (!file_exists('user_privileges/sharing_privileges_'.$current_user->id.'.php')) ++ { ++ $sp = fopen('user_privileges/sharing_privileges_'.$current_user->id.'.php',"a"); ++ fwrite($sp, ''); ++ fclose($sp); ++ } + require('user_privileges/user_privileges_'.$current_user->id.'.php'); + require('user_privileges/sharing_privileges_'.$current_user->id.'.php'); + $permission = "no"; diff --git a/extras/mysql-tuning.sh b/extras/mysql-tuning.sh new file mode 100644 index 00000000..b82ebdb7 --- /dev/null +++ b/extras/mysql-tuning.sh @@ -0,0 +1,1466 @@ +#!/bin/bash + +######################################################################### +# # +# MySQL performance tuning primer script # +# Writen by: Matthew Montgomery # +# Inspired by: MySQLARd (http://gert.sos.be/demo/mysqlar/) # +# Version: 1.4-r0 Released: 2008-02-21 # +# Licenced under GPLv2 # +# # +######################################################################### + +######################################################################### +# # +# Little known feature: 1st argument is execution mode # +# # +# Usage: ./tuning-primer.sh [ mode ] # +# # +# Available Modes: # +# all : perform all checks (default) # +# prompt : prompt for login credintials and socket # +# and execution mode # +# mem, memory : run checks for tunable options which # +# effect memory usage # +# disk, file : run checks for options which effect # +# i/o performance or file handle limits # +# innodb : run InnoDB checks /* to be improved */ # +# misc : run checks for that don't categorise # +# well Slow Queries, Binary logs, # +# Used Connections and Worker Threads # +######################################################################### +# # +# Set this socket variable ONLY if you have multiple instances running # +# or we are unable to find your socket, and you don't want to to be # +# prompted for input each time you run this script. # +# # +######################################################################### +socket= + +function cecho () + +## -- Function to easliy print colored text -- ## + +# Color-echo. +# Argument $1 = message +# Argument $2 = color +{ +export black='\E[0m\c' +export boldblack='\E[1;0m\c' +export red='\E[31m\c' +export boldred='\E[1;31m\c' +export green='\E[32m\c' +export boldgreen='\E[1;32m\c' +export yellow='\E[33m\c' +export boldyellow='\E[1;33m\c' +export blue='\E[34m\c' +export boldblue='\E[1;34m\c' +export magenta='\E[35m\c' +export boldmagenta='\E[1;35m\c' +export cyan='\E[36m\c' +export boldcyan='\E[1;36m\c' +export white='\E[37m\c' +export boldwhite='\E[1;37m\c' + +local default_msg="No message passed." +# Doesn't really need to be a local variable. + +message=${1:-$default_msg} # Defaults to default message. +color=${2:-$black} # Defaults to black, if not specified. + +echo -e "$color" +echo -e "$message" +tput sgr0 # Reset to normal. +echo -e "$black" +return +} + +function print_banner () { + +## -- Banner -- ## + +cecho "\t\c " $black +cecho "-- MYSQL PERFORMANCE TUNING PRIMER --" $boldblue +cecho "\t - By: Matthew Montgomery -" $black + +} + +## -- Find the location of the mysql.sock file -- ## + +function check_for_socket () { +if [ -z "$socket" ] ; then +if [ -S /var/lib/mysql/mysql.sock ] ; then +socket=/var/lib/mysql/mysql.sock +elif [ -S /tmp/mysql.sock ] ; then +socket=/tmp/mysql.sock +else +if [ -S "$ps_socket" ] ; then +socket=$ps_socket +fi +fi +fi +if [ -S "$socket" ] ; then +echo UP > /dev/null +else +cecho "\c" +cecho "No valid socket file \"$socket\" found!" $boldred +cecho "The mysqld process is not running or it is installed in a custom location." $red +cecho "If you are sure mysqld is running, execute script in \"prompt\" mode or set " $red +cecho "the socket= variable at the top of this script" $red +exit 1 +fi +} + + +function check_for_plesk_passwords () { + +## -- Check for the existance of plesk and login using it's credentials -- ## + +if [ -f /etc/psa/.psa.shadow ] ; then +mysql="mysql -S $socket -u admin -p$(cat /etc/psa/.psa.shadow)" +mysqladmin="mysqladmin -S $socket -u admin -p$(cat /etc/psa/.psa.shadow)" +else +mysql="mysql -S $socket" +mysqladmin="mysqladmin -S $socket" +fi +} + +function check_mysql_login () { + +## -- Test for running mysql -- ## + +is_up=$($mysqladmin ping 2>&1) +if [ "$is_up" = "mysqld is alive" ] ; then +echo UP > /dev/null +elif [ "$is_up" != "mysqld is alive" ] ; then +cecho "\n\c" +cecho "- INITIAL LOGIN ATTEMPT FAILED -\n" $boldred +if [ -z $prompted ] ; then +find_webmin_passwords +else +return 1 +fi + +else +cecho "Unknow exit status" $red +exit -1 +fi +} + +function final_login_attempt () { +is_up=$($mysqladmin ping 2>&1) +if [ "$is_up" = "mysqld is alive" ] ; then +echo UP > /dev/null +elif [ "$is_up" != "mysqld is alive" ] ; then +cecho "- FINAL LOGIN ATTEMPT FAILED -\n" $boldred +cecho "Unable to log into socket: $socket" $boldred +exit 1 +fi +} + +function second_login_failed () { + +## -- create a ~/.my.cnf and exit when all else fails -- ## + +cecho "- RETRY LOGIN ATTEMPT FAILED -\n" $boldred +cecho "Could not auto detect login info!\n" +read -p "Do you have your login handy ? [y/N] : " +case $REPLY in +yes | y | Y | YES) +answer1='yes' +read -p "User: " user +read -rsp "Password: " pass +if [ -z $pass ] ; then +export mysql="$mysql -u$user" +export mysqladmin="$mysqladmin -u$user" +else +export mysql="$mysql -u$user -p$pass" +export mysqladmin="$mysqladmin -u$user -p$pass" +fi +;; +*) +cecho "\nPlease create a valid login to MySQL" +cecho "Or, set correct values for 'user=' and 'password=' in ~/.my.cnf" +;; +esac +cecho "\n\c" +read -p "Would you like me to create a ~/.my.cnf file for you? [y/N] : " +case $REPLY in +yes | y | Y | YES) +answer2='yes' +if [ ! -f ~/.my.cnf ] ; then +umask 077 +echo -e "[client]\nuser=$user\npassword=$pass" > ~/.my.cnf +if [ "$answer1" != 'yes' ] ; then +exit 1 +else +final_login_attempt +return 0 +fi +else +cecho "\n~/.my.cnf already exists!\n" $boldred +read -p "Replace ? [y/N] : " +if [ "$REPLY" = 'y' ] || [ "$REPLY = 'Y' " ] ; then +echo -e "[client]\nuser=$user\npassword=$pass" > ~/.my.cnf +if [ "$answer1" != 'yes' ] ; then +exit 1 +else +final_login_attempt +return 0 +fi +else +cecho "Please set the 'user=' and 'password=' values in ~/.my.cnf" +exit 1 +fi +fi +;; +*) +if [ "$answer1" != 'yes' ] ; then +exit 1 +else +final_login_attempt +return 0 +fi +;; +esac +} + +function find_webmin_passwords () { + +## -- populate the .my.cnf file using values harvested from Webmin -- ## + +cecho "Testing Stored for passwords:\c" +if [ -f /etc/webmin/mysql/config ] ; then +user=$(grep ^login= /etc/webmin/mysql/config | cut -d "=" -f 2) +pass=$(grep ^pass= /etc/webmin/mysql/config | cut -d "=" -f 2) +if [ $user ] && [ $pass ] && [ ! -f ~/.my.cnf ] ; then +cecho "Setting login info as User: $user Password: $pass" +touch ~/.my.cnf +chmod 600 ~/.my.cnf +echo -e "[client]\nuser=$user\npassword=$pass" > ~/.my.cnf +cecho "Retrying login" +is_up=$($mysqladmin ping 2>&1) +if [ "$is_up" = "mysqld is alive" ] ; then +echo UP > /dev/null +else +second_login_failed +fi +echo +else +second_login_failed +echo +fi +else +cecho " None Found\n" $boldred +second_login_failed +fi +} + +######################################################################### +# # +# Function to pull MySQL status variable # +# # +# Call using : # +# mysql_status \'Mysql_status_variable\' bash_dest_variable # +# # +######################################################################### + +function mysql_status () { +local status=$($mysql -Bse "show /*!50000 global */ status like $1" | awk '{ print $2 }') +export "$2"=$status +} + +######################################################################### +# # +# Function to pull MySQL server runtime variable # +# # +# Call using : # +# mysql_variable \'Mysql_server_variable\' bash_dest_variable # +# - OR - # +# mysql_variableTSV \'Mysql_server_variable\' bash_dest_variable # +# # +######################################################################### + +function mysql_variable () { +local variable=$($mysql -Bse "show /*!50000 global */ variables like $1" | awk '{ print $2 }') +export "$2"=$variable +} +function mysql_variableTSV () { +local variable=$($mysql -Bse "show /*!50000 global */ variables like $1" | awk -F \t '{ print $2 }') +export "$2"=$variable +} + +function float2int () { +local variable=$(echo "$1 / 1" | bc -l) +export "$2"=$variable +} + +function divide () { + +# -- Divide two intigers -- # + +usage="$0 dividend divisor '$variable' scale" +if [ $1 -ge 1 ] ; then +dividend=$1 +else +cecho "Invalid Dividend" $red +echo $usage +exit 1 +fi +if [ $2 -ge 1 ] ; then +divisor=$2 +else +cecho "Invalid Divisor" $red +echo $usage +exit 1 +fi +if [ ! -n $3 ] ; then +cecho "Invalid variable name" $red +echo $usage +exit 1 +fi +if [ -z $4 ] ; then +scale=2 +elif [ $4 -ge 0 ] ; then +scale=$4 +else +cecho "Invalid scale" $red +echo $usage +exit 1 +fi +export $3=$(echo "scale=$scale; $dividend / $divisor" | bc -l) +} + +function human_readable () { + +######################################################################### +# # +# Convert a value in to human readable size and populate a variable # +# with the result. # +# # +# Call using: # +# human_readable $value 'variable name' [ places of precision] # +# # +######################################################################### + +## value=$1 +## variable=$2 +scale=$3 + +if [ $1 -ge 1073741824 ] ; then +if [ -z $3 ] ; then +scale=2 +fi +divide $1 1073741824 "$2" $scale +unit="G" +elif [ $1 -ge 1048576 ] ; then +if [ -z $3 ] ; then +scale=0 +fi +divide $1 1048576 "$2" $scale +unit="M" +elif [ $1 -ge 1024 ] ; then +if [ -z $3 ] ; then +scale=0 +fi +divide $1 1024 "$2" $scale +unit="K" +else +export "$2"=$1 +unit="bytes" +fi +# let "$2"=$HR +} + +function human_readable_time () { + +######################################################################## +# # +# Function to produce human readable time # +# # +######################################################################## + +usage="$0 seconds 'variable'" +if [ -z $1 ] || [ -z $2 ] ; then +cecho $usage $red +exit 1 +fi +days=$(echo "scale=0 ; $1 / 86400" | bc -l) +remainder=$(echo "scale=0 ; $1 % 86400" | bc -l) +hours=$(echo "scale=0 ; $remainder / 3600" | bc -l) +remainder=$(echo "scale=0 ; $remainder % 3600" | bc -l) +minutes=$(echo "scale=0 ; $remainder / 60" | bc -l) +seconds=$(echo "scale=0 ; $remainder % 60" | bc -l) +export $2="$days days $hours hrs $minutes min $seconds sec" +} + +function check_mysql_version () { + +## -- Print Version Info -- ## + +mysql_variable \'version\' mysql_version +mysql_variable \'version_compile_machine\' mysql_version_compile_machine + +if [ $major_version == '3.23' ] || [ $major_version == '4.0' ] ; then +cecho "MySQL Version $mysql_version $mysql_version_compile_machine is EOL please upgrade to MySQL 4.1 or later" $boldred +else +cecho "MySQL Version $mysql_version $mysql_version_compile_machine" +fi + + +} + +function post_uptime_warning () { + +######################################################################### +# # +# Present a reminder that mysql must run for a couple of days to # +# build up good numbers in server status variables before these tuning # +# suggestions should be used. # +# # +######################################################################### + +mysql_status \'Uptime\' uptime +mysql_status \'Threads_connected\' threads +let queries_per_sec=$questions/$uptime +human_readable_time $uptime uptimeHR + +cecho "Uptime = $uptimeHR" +cecho "Avg. qps = $queries_per_sec" +cecho "Total Questions = $questions" +cecho "Threads Connected = $threads" +echo + +if [ $uptime -gt 172800 ] ; then +cecho "Server has been running for over 48hrs." +cecho "It should be safe to follow these recommendations" +else +cecho "Warning: \c" $boldred +cecho "Server has not been running for at least 48hrs." $boldred +cecho "It may not be safe to use these recommendations" $boldred + +fi +echo "" +cecho "To find out more information on how each of these" $red +cecho "runtime variables effects performance visit:" $red +if [ $major_version == '3.23' ] || [ $major_version == '4.0' ] || [ $major_version == '4.1' ]; then +cecho "http://dev.mysql.com/doc/refman/4.1/en/server-system-variables.html" $boldblue +elif [ $major_version == '5.0' ] || [ $major_version == '5.1' ] ; then +cecho "http://dev.mysql.com/doc/refman/$major_version/en/server-system-variables.html" $boldblue +else +cecho "UNSUPPORTED MYSQL VERSION" $boldred +exit 1 +fi +cecho "Visit http://www.mysql.com/products/enterprise/advisors.html" $boldblue +cecho "for info about MySQL's Enterprise Monitoring and Advisory Service" $boldblue +} + +function check_slow_queries () { + +## -- Slow Queries -- ## + +cecho "SLOW QUERIES" $boldblue + +mysql_status \'Slow_queries\' slow_queries +mysql_variable \'long_query_time\' long_query_time +mysql_variable \'log%queries\' log_slow_queries + +prefered_query_time=5 +if [ -e /etc/my.cnf ] ; then +if [ -z $log_slow_queries ] ; then +log_slow_queries=$(grep log-slow-queries /etc/my.cnf) +fi +fi + +if [ "$log_slow_queries" = 'ON' ] ; then +cecho "The slow query log is enabled." +elif [ "$log_slow_queries" = 'OFF' ] ; then +cecho "The slow query log is \c" +cecho "NOT \c" $boldred +cecho "enabled." +elif [ -z $log_slow_queries ] ; then +cecho "The slow query log is \c" +cecho "NOT \c" $boldred +cecho "enabled." +else +cecho "Error: $log_slow_queries" $boldred +fi +cecho "Current long_query_time = $long_query_time sec." +cecho "You have \c" +cecho "$slow_queries \c" $boldred +cecho "out of \c" +cecho "$questions \c" $boldred +cecho "that take longer than $long_query_time sec. to complete" + +if [ "$major_version" = '5.1' ]; then +float2int long_query_time long_query_timeInt +else +let long_query_timeInt=$long_query_time +fi + +if [ $long_query_timeInt -gt $prefered_query_time ] ; then +cecho "Your long_query_time may be too high, I typically set this under $prefered_query_time sec." $red +else +cecho "Your long_query_time seems to be fine" $green +fi + +} + +function check_binary_log () { + +## -- Binary Log -- ## + +cecho "BINARY UPDATE LOG" $boldblue + +mysql_variable \'log_bin\' log_bin +mysql_variable \'max_binlog_size\' max_binlog_size +mysql_variable \'expire_logs_days\' expire_logs_days +# mysql_variable \'max_binlog_cache_size\' max_binlog_cache_size + +if [ "$log_bin" = 'ON' ] ; then +cecho "The binary update log is enabled" +if [ -z "$max_binlog_size" ] ; then +cecho "The max_binlog_size is not set. The binary log will rotate when it reaches 1GB." $red +fi +if [ "$expire_logs_days" -eq 0 ] ; then +cecho "The expire_logs_days is not set." $boldred +cecho "The mysqld will retain the entire binary log until \c" $red +cecho "RESET MASTER or PURGE MASTER LOGS commands are run manually" $red +cecho "Setting expire_log_days will allow you to remove old binary logs automatically" $yellow +cecho "See http://dev.mysql.com/doc/refman/$major_version/en/purge-master-logs.html" $yellow +fi +else +cecho "The binary update log is \c" +cecho "NOT \c" $boldred +cecho "enabled." +cecho "You will not be able to do point in time recovery" $red +cecho "See http://dev.mysql.com/doc/refman/$major_version/en/point-in-time-recovery.html" $yellow +fi +} + +function check_used_connections () { + +## -- Used Connections -- ## + +mysql_variable \'max_connections\' max_connections +mysql_status \'Max_used_connections\' max_used_connections +mysql_status \'Threads_connected\' threads_connected + +let connections_ratio=$max_used_connections*100/$max_connections + +cecho "MAX CONNECTIONS" $boldblue +cecho "Current max_connections = $max_connections" +cecho "Current threads_connected = $threads_connected" +cecho "Historic max_used_connections = $max_used_connections" +cecho "The number of used connections is \c" +if [ $connections_ratio -ge 85 ] ; then +txt_color=$red +error=1 +elif [ $connections_ratio -le 10 ] ; then +txt_color=$red +error=2 +else +txt_color=$green +error=0 +fi +# cecho "$max_used_connections \c" $txt_color +# cecho "which is \c" +cecho "$connections_ratio% \c" $txt_color +cecho "of the configured maximum." + +if [ $error -eq 1 ] ; then +cecho "You should raise max_connections" $txt_color +elif [ $error -eq 2 ] ; then +cecho "You are using less than 10% of your configured max_connections." $txt_color +cecho "Lowering max_connections could help to avoid an over-allocation of memory" $txt_color +cecho "See \"MEMORY USAGE\" section to make sure you are not over-allocating" $txt_color +else +cecho "Your max_connections variable seems to be fine." $txt_color +fi +unset txt_color +} + +function check_threads() { + +## -- Worker Threads -- ## + +cecho "WORKER THREADS" $boldblue + +mysql_status \'Threads_created\' threads_created1 +sleep 1 +mysql_status \'Threads_created\' threads_created2 + +mysql_status \'Threads_cached\' threads_cached +mysql_status \'Uptime\' uptime +mysql_variable \'thread_cache_size\' thread_cache_size + +let historic_threads_per_sec=$threads_created1/$uptime +let current_threads_per_sec=$threads_created2-$threads_created1; + +cecho "Current thread_cache_size = $thread_cache_size" +cecho "Current threads_cached = $threads_cached" +cecho "Current threads_per_sec = $current_threads_per_sec" +cecho "Historic threads_per_sec = $historic_threads_per_sec" + +if [ $historic_threads_per_sec -ge 2 ] && [ $threads_cached -le 1 ] ; then +cecho "Threads created per/sec are overrunning threads cached" $red +cecho "You should raise thread_cache_size" $red +elif [ $current_threads_per_sec -ge 2 ] ; then +cecho "Threads created per/sec are overrunning threads cached" $red +cecho "You should raise thread_cache_size" $red +else +cecho "Your thread_cache_size is fine" $green +fi +} + +function check_key_buffer_size () { + +## -- Key buffer Size -- ## + +cecho "KEY BUFFER" $boldblue + +mysql_status \'Key_read_requests\' key_read_requests +mysql_status \'Key_reads\' key_reads +mysql_status \'Key_blocks_used\' key_blocks_used +mysql_status \'Key_blocks_unused\' key_blocks_unused +mysql_variable \'key_buffer_size\' key_buffer_size +mysql_variable \'datadir\' datadir +mysql_variable \'version_compile_machine\' mysql_version_compile_machine +myisam_indexes=$($mysql -Bse "/*!50000 SELECT SUM(INDEX_LENGTH) from information_schema.TABLES where ENGINE='MyISAM' */") + +if [ -z $myisam_indexes ] ; then +myisam_indexes=$(find $datadir -name '*.MYI' -exec du $duflags '{}' \; 2>&1 | awk '{ s += $1 } END { printf("%.0f\n", s )}') +fi + +if [ $key_reads -eq 0 ] ; then +cecho "No key reads?!" $boldred +cecho "Seriously look into using some indexes" $red +key_cache_miss_rate=0 +key_buffer_ratio=0 +key_buffer_ratioRND=0 +else +let key_cache_miss_rate=$key_read_requests/$key_reads +if [ ! -z $key_blocks_unused ] ; then +let key_blocks_total=$key_blocks_used+$key_blocks_unused +divide $key_blocks_used $key_blocks_total key_buffer_fill 2 +key_buffer_ratio=$(echo "$key_buffer_fill * 100" | bc -l) +key_buffer_ratioRND=$(echo "scale=0; $key_buffer_ratio / 1" | bc -l) +else +key_buffer_ratio='Unknown' +key_buffer_ratioRND=75 +fi +fi + +human_readable $myisam_indexes myisam_indexesHR 0 +cecho "Current MyISAM index space = $myisam_indexesHR $unit" + +human_readable $key_buffer_size key_buffer_sizeHR 0 +cecho "Current key_buffer_size = $key_buffer_sizeHR $unit" +cecho "Key cache miss rate is 1 : $key_cache_miss_rate" +cecho "Key buffer fill ratio = $key_buffer_ratio %" + +if [ "$major_version" == '5.1' ] && [ $mysql_version_num -lt '5123' ] ; then +if [ $key_buffer_size -ge 4294967296 ] && ( echo "x86_64 ppc64 ia64 sparc64 i686" | grep -q $mysql_version_compile_machine ) ; then +cecho "Using key_buffer_size > 4GB will cause instability in versions prior to 5.1.23 " $boldred +cecho "See Bug#5731, Bug#29419, Bug#29446" $boldred +fi +fi +if [ "$major_version" == '5.0' ] && [ $mysql_version_num -lt '5052' ] ; then +if [ $key_buffer_size -ge 4294967296 ] && ( echo "x86_64 ppc64 ia64 sparc64 i686" | grep -q $mysql_version_compile_machine ) ; then +cecho "Using key_buffer_size > 4GB will cause instability in versions prior to 5.0.52 " $boldred +cecho "See Bug#5731, Bug#29419, Bug#29446" $boldred +fi +fi +if [ "$major_version" == '4.1' -o "$major_version" == '4.0' ] && [ $key_buffer_size -ge 4294967296 ] && ( echo "x86_64 ppc64 ia64 sparc64 i686" | grep -q $mysql_version_compile_machine ) ; then +cecho "Using key_buffer_size > 4GB will cause instability in versions prior to 5.0.52 " $boldred +cecho "Reduce key_buffer_size to a safe value" $boldred +cecho "See Bug#5731, Bug#29419, Bug#29446" $boldred +fi + +if [ $key_cache_miss_rate -le 100 ] && [ $key_cache_miss_rate -gt 0 ] && [ $key_buffer_ratioRND -ge 80 ]; then +cecho "You could increase key_buffer_size" $boldred +cecho "It is safe to raise this up to 1/4 of total system memory;" +cecho "assuming this is a dedicated database server." +elif [ $key_buffer_ratioRND -ge 80 ] && [ $key_buffer_size -le $myisam_indexes ] ; then +cecho "You could increase key_buffer_size" $boldred +cecho "It is safe to raise this up to 1/4 of total system memory;" +cecho "assuming this is a dedicated database server." +elif [ $key_cache_miss_rate -ge 10000 ] || [ $key_buffer_ratioRND -le 50 ] ; then +cecho "Your key_buffer_size seems to be too high." $red +cecho "Perhaps you can use these resources elsewhere" $red +else +cecho "Your key_buffer_size seems to be fine" $green +fi +} + +function check_query_cache () { + +## -- Query Cache -- ## + +cecho "QUERY CACHE" $boldblue + +mysql_variable \'version\' mysql_version +mysql_variable \'query_cache_size\' query_cache_size +mysql_variable \'query_cache_limit\' query_cache_limit +mysql_variable \'query_cache_min_res_unit\' query_cache_min_res_unit +mysql_status \'Qcache_free_memory\' qcache_free_memory +mysql_status \'Qcache_total_blocks\' qcache_total_blocks +mysql_status \'Qcache_free_blocks\' qcache_free_blocks +mysql_status \'Qcache_lowmem_prunes\' qcache_lowmem_prunes + +if [ -z $query_cache_size ] ; then +cecho "You are using MySQL $mysql_version, no query cache is supported." $red +cecho "I recommend an upgrade to MySQL 4.1 or better" $red +elif [ $query_cache_size -eq 0 ] ; then +cecho "Query cache is supported but not enabled" $red +cecho "Perhaps you should set the query_cache_size" $red +else +let qcache_used_memory=$query_cache_size-$qcache_free_memory +qcache_mem_fill_ratio=$(echo "scale=2; $qcache_used_memory * 100 / $query_cache_size" | bc -l) +qcache_mem_fill_ratioHR=$(echo "scale=0; $qcache_mem_fill_ratio / 1" | bc -l) + +cecho "Query cache is enabled" $green +human_readable $query_cache_size query_cache_sizeHR +cecho "Current query_cache_size = $query_cache_sizeHR $unit" +human_readable $qcache_used_memory qcache_used_memoryHR +cecho "Current query_cache_used = $qcache_used_memoryHR $unit" +human_readable $query_cache_limit query_cache_limitHR +cecho "Current query_cache_limit = $query_cache_limitHR $unit" +cecho "Current Query cache Memory fill ratio = $qcache_mem_fill_ratio %" +human_readable $query_cache_min_res_unit query_cache_min_res_unitHR +cecho "Current query_cache_min_res_unit = $query_cache_min_res_unitHR $unit" +if [ $qcache_free_blocks -gt 2 ] && [ $qcache_total_blocks -gt 0 ] ; then +qcache_percent_fragmented=$(echo "scale=2; $qcache_free_blocks * 100 / $qcache_total_blocks" | bc -l) +qcache_percent_fragmentedHR=$(echo "scale=0; $qcache_percent_fragmented / 1" | bc -l) +if [ $qcache_percent_fragmentedHR -gt 20 ] ; then +cecho "Query Cache is $qcache_percent_fragmentedHR % fragmented" $red +cecho "Run \"FLUSH QUERY CACHE\" periodically to defragment the query cache memory" $red +cecho "If you have many small queries lower 'query_cache_min_res_unit' to reduce fragmentation." $red +fi +fi + +if [ $qcache_mem_fill_ratioHR -le 25 ] ; then +cecho "Your query_cache_size seems to be too high." $red +cecho "Perhaps you can use these resources elsewhere" $red +fi +if [ $qcache_lowmem_prunes -ge 50 ] && [ $qcache_mem_fill_ratioHR -ge 80 ]; then +cecho "However, \c" +cecho "$qcache_lowmem_prunes \c" $boldred +cecho "queries have been removed from the query cache due to lack of memory" +cecho "Perhaps you should raise query_cache_size" $boldred +fi +cecho "MySQL won't cache query results that are larger than query_cache_limit in size" $yellow +fi + +} + +function check_sort_operations () { + +## -- Sort Operations -- ## + +cecho "SORT OPERATIONS" $boldblue + +mysql_status \'Sort_merge_passes\' sort_merge_passes +mysql_status \'Sort_scan\' sort_scan +mysql_status \'Sort_range\' sort_range +mysql_variable \'sort_buffer%\' sort_buffer_size +mysql_variable \'read_rnd_buffer_size\' read_rnd_buffer_size + +let total_sorts=$sort_scan+$sort_range +if [ -z $read_rnd_buffer_size ] ; then +mysql_variable \'record_buffer\' read_rnd_buffer_size +fi + +## Correct for rounding error in mysqld where 512K != 524288 ## +let sort_buffer_size=$sort_buffer_size+8 +let read_rnd_buffer_size=$read_rnd_buffer_size+8 + +human_readable $sort_buffer_size sort_buffer_sizeHR +cecho "Current sort_buffer_size = $sort_buffer_sizeHR $unit" + +human_readable $read_rnd_buffer_size read_rnd_buffer_sizeHR +cecho "Current \c" +if [ "$major_version" == '3.23' ] ; then +cecho "record_rnd_buffer \c" +else +cecho "read_rnd_buffer_size \c" +fi +cecho "= $read_rnd_buffer_sizeHR $unit" + +if [ $total_sorts -eq 0 ] ; then +cecho "No sort operations have been performed" +passes_per_sort=0 +fi +if [ $sort_merge_passes -ne 0 ] ; then +let passes_per_sort=$sort_merge_passes/$total_sorts +else +passes_per_sort=0 +fi + +if [ $passes_per_sort -ge 2 ] ; then +cecho "On average \c" +cecho "$passes_per_sort \c" $boldred +cecho "sort merge passes are made per sort operation" +cecho "You should raise your sort_buffer_size" +cecho "You should also raise your \c" +if [ $major_version == '3.23' ] ; then +cecho "record_rnd_buffer_size" +else +cecho "read_rnd_buffer_size" +fi +else +cecho "Sort buffer seems to be fine" $green +fi +} + +function check_join_operations () { + +## -- Joins -- ## + +cecho "JOINS" $boldblue + +mysql_status \'Select_full_join\' select_full_join +mysql_status \'Select_range_check\' select_range_check +mysql_variable \'join_buffer%\' join_buffer_size + +## Some 4K is dropped from join_buffer_size adding it back to make sane ## +## handling of human-readable conversion ## + +let join_buffer_size=$join_buffer_size+4096 + +human_readable $join_buffer_size join_buffer_sizeHR 2 + +cecho "Current join_buffer_size = $join_buffer_sizeHR $unit" +cecho "You have had $select_full_join queries where a join could not use an index properly" + +if [ $select_range_check -eq 0 ] && [ $select_full_join -eq 0 ] ; then +cecho "Your joins seem to be using indexes properly" $green +fi +if [ $select_full_join -gt 0 ] ; then +print_error='true' +raise_buffer='true' +fi +if [ $select_range_check -gt 0 ] ; then +cecho "You have had $select_range_check joins without keys that check for key usage after each row" $red +print_error='true' +raise_buffer='true' +fi + +## For Debuging ## +# print_error='true' +if [ $join_buffer_size -ge 4194304 ] ; then +cecho "join_buffer_size >= 4 M" $boldred +cecho "This is not advised" $boldred +raise_buffer= +fi + +if [ $print_error ] ; then +if [ $major_version == '3.23' ] || [ $major_version == '4.0' ] ; then +cecho "You should enable \"log-long-format\" " +elif [ $major_version == '4.1' ] || [ $major_version == '5.0' ] || [ $major_version == '5.1' ] ; then +cecho "You should enable \"log-queries-not-using-indexes\"" +fi +cecho "Then look for non indexed joins in the slow query log." +if [ $raise_buffer ] ; then +cecho "If you are unable to optimize your queries you may want to increase your" +cecho "join_buffer_size to accommodate larger joins in one pass.\n" +cecho "Note! This script will still suggest raising the join_buffer_size when" $boldred +cecho "ANY joins not using indexes are found." $boldred +fi +fi + +# XXX Add better tests for join_buffer_size XXX # +} + +check_tmp_tables () { + +## -- Temp Tables -- ## + +cecho "TEMP TABLES" $boldblue + +mysql_status \'Created_tmp_tables\' created_tmp_tables +mysql_status \'Created_tmp_disk_tables\' created_tmp_disk_tables +mysql_variable \'tmp_table_size\' tmp_table_size +mysql_variable \'max_heap_table_size\' max_heap_table_size + + +if [ $created_tmp_tables -eq 0 ] ; then +tmp_disk_tables=0 +else +let tmp_disk_tables=created_tmp_disk_tables*100/created_tmp_tables +fi +human_readable $max_heap_table_size max_heap_table_sizeHR +cecho "Current max_heap_table_size = $max_heap_table_sizeHR $unit" + +human_readable $tmp_table_size tmp_table_sizeHR +cecho "Current tmp_table_size = $tmp_table_sizeHR $unit" + +cecho "Of $created_tmp_tables temp tables, $tmp_disk_tables% were created on disk" +if [ $tmp_table_size -gt $max_heap_table_size ] ; then +cecho "Effective in-memory tmp_table_size is limited to max_heap_table_size." $yellow +fi +if [ $tmp_disk_tables -ge 25 ] ; then +cecho "Perhaps you should increase your tmp_table_size and/or max_heap_table_size" $boldred +cecho "to reduce the number of disk-based temporary tables" $boldred +cecho "Note! BLOB and TEXT columns are not allow in memory tables." $yellow +cecho "If you are using these columns raising these values might not impact your " $yellow +cecho "ratio of on disk temp tables." $yellow +else +cecho "Created disk tmp tables ratio seems fine" $green +fi +} + +function check_open_files () { + +## -- Open Files Limit -- ## +cecho "OPEN FILES LIMIT" $boldblue + +mysql_variable \'open_files_limit\' open_files_limit +mysql_status \'Open_files\' open_files + +if [ -z $open_files_limit ] || [ $open_files_limit -eq 0 ] ; then +open_files_limit=$(ulimit -n) +cant_override=1 +else +cant_override=0 +fi +cecho "Current open_files_limit = $open_files_limit files" + +let open_files_ratio=$open_files*100/$open_files_limit + +cecho "The open_files_limit should typically be set to at least 2x-3x" $yellow +cecho "that of table_cache if you have heavy MyISAM usage." $yellow +if [ $open_files_ratio -ge 75 ] ; then +cecho "You currently have open more than 75% of your open_files_limit" $boldred +if [ $cant_override -eq 1 ] ; then +cecho "You should set a higer value for ulimit -u in the mysql startup script then restart mysqld" $boldred +cecho "MySQL 3.23 users : This is just a guess based upon the current shell's ulimit -u value" $yellow +elif [ $cant_override -eq 0 ] ; then +cecho "You should set a higher value for open_files_limit in my.cnf" $boldred +else +cecho "ERROR can't determine if mysqld override of ulimit is allowed" $boldred +exit 1 +fi +else +cecho "Your open_files_limit value seems to be fine" $green +fi + + + +} + +function check_table_cache () { + +## -- Table Cache -- ## + +cecho "TABLE CACHE" $boldblue + +mysql_variable \'datadir\' datadir +mysql_variable \'table_cache\' table_cache + +## /* MySQL +5.1 version of table_cache */ ## +mysql_variable \'table_open_cache\' table_open_cache +mysql_variable \'table_definition_cache\' table_definition_cache + +mysql_status \'Open_tables\' open_tables +mysql_status \'Opened_tables\' opened_tables +mysql_status \'Open_table_definitions\' open_table_definitions + +table_count=$($mysql -Bse "/*!50000 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE' */") + +if [ -z "$table_count" ] ; then +if [ "$UID" != "$socket_owner" ] && [ "$UID" != "0" ] ; then +cecho "You are not '$socket_owner' or 'root'" $red +cecho "I am unable to determine the table_count!" $red +else +table_count=$(find $datadir 2>&1 | grep -c .frm$) +fi +fi +if [ $table_open_cache ] ; then +table_cache=$table_open_cache +fi + +if [ $opened_tables -ne 0 ] && [ $table_cache -ne 0 ] ; then +let table_cache_hit_rate=$open_tables*100/$opened_tables +let table_cache_fill=$open_tables*100/$table_cache +elif [ $opened_tables -eq 0 ] && [ $table_cache -ne 0 ] ; then +table_cache_hit_rate=100 +let table_cache_fill=$open_tables*100/$table_cache +else +cecho "ERROR no table_cache ?!" $boldred +exit 1 +fi +if [ $table_cache ] && [ ! $table_open_cache ] ; then +cecho "Current table_cache value = $table_cache tables" +fi +if [ $table_open_cache ] ; then +cecho "Current table_open_cache = $table_open_cache tables" +cecho "Current table_definition_cache = $table_definition_cache tables" +fi +if [ $table_count ] ; then +cecho "You have a total of $table_count tables" +fi + +if [ $table_cache_fill -lt 95 ] ; then +cecho "You have \c" +cecho "$open_tables \c" $green +cecho "open tables." +cecho "The table_cache value seems to be fine" $green +elif [ $table_cache_hit_rate -le 85 -o $table_cache_fill -ge 95 ]; then +cecho "You have \c" +cecho "$open_tables \c" $boldred +cecho "open tables." +cecho "Current table_cache hit rate is \c" +cecho "$table_cache_hit_rate%\c" $boldred +cecho ", while \c" +cecho "$table_cache_fill% \c" $boldred +cecho "of your table cache is in use" +cecho "You should probably increase your table_cache" $red +else +cecho "Current table_cache hit rate is \c" +cecho "$table_cache_hit_rate%\c" $green +cecho ", while \c" +cecho "$table_cache_fill% \c" $green +cecho "of your table cache is in use" +cecho "The table cache value seems to be fine" $green +fi +if [ $table_definition_cache ] && [ $table_definition_cache -le $table_count ] && [ $table_count -ge 100 ] ; then +cecho "You should probably increase your table_definition_cache value." $red +fi +} + +function check_table_locking () { + +## -- Table Locking -- ## + +cecho "TABLE LOCKING" $boldblue + +mysql_status \'Table_locks_waited\' table_locks_waited +mysql_status \'Table_locks_immediate\' table_locks_immediate +mysql_variable \'concurrent_insert\' concurrent_insert +mysql_variable \'low_priority_updates\' low_priority_updates +if [ "$concurrent_insert" = 'ON' ]; then +let concurrent_insert=1 +elif [ "$concurrent_insert" = 'OFF' ]; then +let concurrent_insert=0 +fi + +cecho "Current Lock Wait ratio = \c" +if [ $table_locks_waited -gt 0 ]; then +let immediate_locks_miss_rate=$table_locks_immediate/$table_locks_waited +cecho "1 : $immediate_locks_miss_rate" $red +else +let immediate_locks_miss_rate=99999 # perfect +cecho "0 : $questions" +fi +if [ $immediate_locks_miss_rate -lt 5000 ] ; then +cecho "You may benefit from selective use of InnoDB." +if [ "$low_priority_updates" == 'OFF' ] ; then +cecho "If you have long running SELECT's against MyISAM tables and perform" +cecho "frequent updates consider setting 'low_priority_updates=1'" +fi +if [ $concurrent_insert -le 1 ] && [ $major_version == '5.0' -o $major_version == '5.1' ] ; then +cecho "If you have a high concurrency of inserts on Dynamic row-length tables" +cecho "consider setting 'concurrent_insert=2'." +fi +else +cecho "Your table locking seems to be fine" $green +fi +} + +function check_table_scans () { + +## -- Table Scans -- ## + +cecho "TABLE SCANS" $boldblue + +mysql_status \'Com_select\' com_select +mysql_status \'Handler_read_rnd_next\' read_rnd_next +mysql_variable \'read_buffer_size\' read_buffer_size + +if [ -z $read_buffer_size ] ; then +mysql_variable \'record_buffer\' read_buffer_size +fi + +human_readable $read_buffer_size read_buffer_sizeHR +cecho "Current read_buffer_size = $read_buffer_sizeHR $unit" + +if [ $com_select -gt 0 ] ; then +let full_table_scans=$read_rnd_next/$com_select +cecho "Current table scan ratio = $full_table_scans : 1" +if [ $full_table_scans -ge 4000 ] && [ $read_buffer_size -le 2097152 ] ; then +cecho "You have a high ratio of sequential access requests to SELECTs" $red +cecho "You may benefit from raising \c" $red +if [ $major_version == '3.23' ] ; then +cecho "record_buffer \c" $red +else +cecho "read_buffer_size \c" $red +fi +cecho "and/or improving your use of indexes." $red +elif [ $read_buffer_size -gt 8388608 ] ; then +cecho "read_buffer_size is over 8 MB \c" $red +cecho "there is probably no need for such a large read_buffer" $red + +else +cecho "read_buffer_size seems to be fine" $green +fi +else +cecho "read_buffer_size seems to be fine" $green +fi +} + + +function check_innodb_status () { + +## -- InnoDB -- ## + +mysql_variable \'have_innodb\' have_innodb + +if [ "$have_innodb" == "YES" ] ; then +mysql_variable \'innodb_buffer_pool_size\' innodb_buffer_pool_size +mysql_variable \'innodb_additional_mem_pool_size\' innodb_additional_mem_pool_size +mysql_variable \'innodb_fast_shutdown\' innodb_fast_shutdown +mysql_varaible \'innodb_flush_log_at_trx_commit\' innodb_flush_log_at_trx_commit +mysql_variable \'innodb_locks_unsafe_for_binlog\' innodb_locks_unsafe_for_binlog +mysql_varaible \'innodb_log_buffer_size\' innodb_log_buffer_size +mysql_variable \'innodb_log_file_size\' innodb_log_file_size +mysql_variable \'innodb_log_files_in_group\' innodb_log_files_in_group +mysql_variable \'innodb_safe_binlog\' innodb_safe_binlog +mysql_variable \'innodb_thread_concurrency\' innodb_thread_concurrency + +echo +cecho "INNODB STATUS" $boldblue +innodb_indexes=$($mysql -Bse "/*!50000 SELECT SUM(INDEX_LENGTH) from information_schema.TABLES where ENGINE='InnoDB' */") + +if [ ! -z "$innodb_indexes" ] ; then + +mysql_status \'Innodb_buffer_pool_pages_data\' innodb_buffer_pool_pages_data +mysql_status \'Innodb_buffer_pool_pages_misc\' innodb_buffer_pool_pages_misc +mysql_status \'Innodb_buffer_pool_pages_free\' innodb_buffer_pool_pages_free +mysql_status \'Innodb_buffer_pool_pages_total\' innodb_buffer_pool_pages_total + +mysql_status \'Innodb_buffer_pool_read_ahead_seq\' innodb_buffer_pool_read_ahead_seq +mysql_status \'Innodb_buffer_pool_read_requests\' innodb_buffer_pool_read_requests + +mysql_status \'Innodb_os_log_pending_fsyncs\' innodb_os_log_pending_fsyncs +mysql_status \'Innodb_os_log_pending_writes\' innodb_os_log_pending_writes +mysql_status \'Innodb_log_waits\' innodb_log_waits + +mysql_status \'Innodb_row_lock_time\' innodb_row_lock_time +mysql_status \'Innodb_row_lock_waits\' innodb_row_lock_waits + +human_readable $innodb_indexes innodb_indexesHR 0 +cecho "Current InnoDB index space = $innodb_indexesHR $unit" +else +cecho "Cannot find InnoDB index space prior to 5.0.x" $red +fi + +human_readable $innodb_buffer_pool_size innodb_buffer_pool_sizeHR +cecho "Current innodb_buffer_pool_size = $innodb_buffer_pool_sizeHR $unit" +cecho "Depending on how much space your innodb indexes take up it may be safe" +cecho "to increase this value to up to 1 / 3 of total system memory" +echo +$mysql -s -e "SHOW /*!50000 ENGINE */ INNODB STATUS\G" +else +cecho "No InnoDB Support Enabled!" $boldred +fi +} + +function total_memory_used () { + +## -- Total Memory Usage -- ## +cecho "MEMORY USAGE" $boldblue + +mysql_variable \'read_buffer_size\' read_buffer_size +mysql_variable \'read_rnd_buffer_size\' read_rnd_buffer_size +mysql_variable \'sort_buffer_size\' sort_buffer_size +mysql_variable \'thread_stack\' thread_stack +mysql_variable \'max_connections\' max_connections +mysql_variable \'join_buffer_size\' join_buffer_size +mysql_variable \'tmp_table_size\' tmp_table_size +mysql_variable \'max_heap_table_size\' max_heap_table_size +mysql_variable \'log_bin\' log_bin +mysql_status \'Max_used_connections\' max_used_connections + +if [ "$major_version" = "3.23" ] ; then +mysql_variable \'record_buffer\' read_buffer_size +mysql_variable \'record_rnd_buffer\' read_rnd_buffer_size +mysql_variable \'sort_buffer\' sort_buffer_size +fi + +if [ "$log_bin" == "ON" ] ; then +mysql_variable \'binlog_cache_size\' binlog_cache_size +else +binlog_cache_size=0 +fi + +if [ $max_heap_table_size -le $tmp_table_size ] ; then +effective_tmp_table_size=$max_heap_table_size +else +effective_tmp_table_size=$tmp_table_size +fi + + +per_thread_buffers=$(echo "($read_buffer_size+$read_rnd_buffer_size+$sort_buffer_size+$thread_stack+$join_buffer_size+$binlog_cache_size)*$max_connections" | bc -l) +per_thread_max_buffers=$(echo "($read_buffer_size+$read_rnd_buffer_size+$sort_buffer_size+$thread_stack+$join_buffer_size+$binlog_cache_size)*$max_used_connections" | bc -l) + +mysql_variable \'innodb_buffer_pool_size\' innodb_buffer_pool_size +if [ -z $innodb_buffer_pool_size ] ; then +innodb_buffer_pool_size=0 +fi + +mysql_variable \'innodb_additional_mem_pool_size\' innodb_additional_mem_pool_size +if [ -z $innodb_additional_mem_pool_size ] ; then +innodb_additional_mem_pool_size=0 +fi + +mysql_variable \'innodb_log_buffer_size\' innodb_log_buffer_size +if [ -z $innodb_log_buffer_size ] ; then +innodb_log_buffer_size=0 +fi + +mysql_variable \'key_buffer_size\' key_buffer_size + +mysql_variable \'query_cache_size\' query_cache_size +if [ -z $query_cache_size ] ; then +query_cache_size=0 +fi + +global_buffers=$(echo "$innodb_buffer_pool_size+$innodb_additional_mem_pool_size+$innodb_log_buffer_size+$key_buffer_size+$query_cache_size" | bc -l) + + +max_memory=$(echo "$global_buffers+$per_thread_max_buffers" | bc -l) +total_memory=$(echo "$global_buffers+$per_thread_buffers" | bc -l) + +pct_of_sys_mem=$(echo "scale=0; $total_memory*100/$physical_memory" | bc -l) + +if [ $pct_of_sys_mem -gt 90 ] ; then +txt_color=$boldred +error=1 +else +txt_color= +error=0 +fi + +human_readable $max_memory max_memoryHR 0 +cecho "Max Memory Ever Allocated : $max_memoryHR $unit" $txt_color +human_readable $per_thread_buffers per_thread_buffersHR 0 +cecho "Configured Max Per-thread Buffers : $per_thread_buffersHR $unit" $txt_color +human_readable $global_buffers global_buffersHR 0 +cecho "Configured Max Global Buffers : $global_buffersHR $unit" $txt_color +human_readable $total_memory total_memoryHR 0 +cecho "Configured Max Memory Limit : $total_memoryHR $unit" $txt_color +# human_readable $effective_tmp_table_size effective_tmp_table_sizeHR 0 +# cecho "Plus $effective_tmp_table_sizeHR $unit per temporary table created" +human_readable $physical_memory physical_memoryHR 2 +cecho "Physical Memory : $physical_memoryHR $unit" $txt_color +if [ $error -eq 1 ] ; then +cecho "\nMax memory limit exceeds 90% of physical memory" $txt_color +else +cecho "Max memory limit seem to be within acceptable norms" $green +fi +unset txt_color +} + +function snarky () { + +## -- Be Snarky -- ## + +fortune=$(which fortune 2>/dev/null) +if [ -z $fortune ] ; then +echo "What the hell sort of straight-lace bastard doesn't have fortune installed?" +else +$fortune +fi +} + +## Required Functions ## + +function login_validation () { +check_for_socket # determine the socket location -- 1st login +check_for_plesk_passwords # determine the login method -- 2nd login +check_mysql_login # determine if mysql is accepting login -- 3rd login +export major_version=$($mysql -Bse 'SELECT SUBSTRING_INDEX(VERSION(), ".", +2)') +export mysql_version_num=$($mysql -Bse "SELECT LEFT(REPLACE(SUBSTRING_INDEX(VERSION(), '-', +1), '.', ''),4)" ) +} + +function shared_info () { +export major_version=$($mysql -Bse 'select substring_index(version(), ".", +2)') +export mysql_version_num=$($mysql -Bse "SELECT LEFT(REPLACE(SUBSTRING_INDEX(VERSION(), '-', +1), '.', ''),4)" ) +mysql_status \'Questions\' questions +# socket_owner=$(find -L $socket -printf '%u\n') +socket_owner=$(ls -nH $socket | awk '{ print $3 }') +} + + +function get_system_info () { + +export OS=$(uname) + +# Get information for various UNIXes +if [ "$OS" = 'Darwin' ]; then +ps_socket=$(netstat -ln | awk '/mysql(d)?\.sock/ { print $9 }') +export physical_memory=$(sysctl -n hw.memsize) +export duflags='' +elif [ "$OS" = 'FreeBSD' ] || [ "$OS" == 'OpenBSD' ]; then +## On FreeBSD must be root to locate sockets. +ps_socket=$(netstat -ln | awk '/mysql(d)?\.sock/ { print $9 }') +export physical_memory=$(sysctl -n hw.realmem) +export duflags='' +elif [ "$OS" = 'Linux' ] ; then +## Includes SWAP +## export physical_memory=$(free -b | grep -v buffers | awk '{ s += $2 } END { printf("%.0f\n", s ) }') +ps_socket=$(netstat -ln | awk '/mysql(d)?\.sock/ { print $9 }') +export physical_memory=$(awk '/^MemTotal/ { printf("%.0f", $2*1024 ) }' < /proc/meminfo) +export duflags='-b' +elif [ "$OS" = 'SunOS' ] ; then +ps_socket=$(netstat -a | awk '/mysql(d)?.sock/ { print $5 }') +export physical_memory=$(prtconf | awk '/^Memory\ size:/ { print $3*1048576 }') +fi +} + + +## Optional Components Groups ## + +function banner_info () { +shared_info +print_banner ; echo +check_mysql_version ; echo +post_uptime_warning ; echo +} + +function misc () { +shared_info +check_slow_queries ; echo +check_binary_log ; echo +check_threads ; echo +check_used_connections ; echo +} + +function memory () { +shared_info +total_memory_used ; echo +check_key_buffer_size ; echo +check_query_cache ; echo +check_sort_operations ; echo +check_join_operations ; echo +} + +function file () { +shared_info +check_open_files ; echo +check_table_cache ; echo +check_tmp_tables ; echo +check_table_scans ; echo +check_table_locking ; echo +} + +function all () { +banner_info +misc +memory +file +# snarky +} + +function prompt () { +prompted='true' +read -p "Username [anonymous] : " user +read -rsp "Password [] : " pass +cecho "\n\c" +read -p "Socket [ /var/lib/mysql/mysql.sock ] : " socket +if [ -z $socket ] ; then +export socket='/var/lib/mysql/mysql.sock' +fi + +if [ -z $pass ] ; then +export mysql="mysql -S $socket -u$user" +export mysqladmin="mysqladmin -S $socket -u$user" +else +export mysql="mysql -S $socket -u$user -p$pass" +export mysqladmin="mysqladmin -S $socket -u$user -p$pass" +fi + +check_for_socket +check_mysql_login + +if [ $? = 1 ] ; then +exit 1 +fi +read -p "Mode to test (see usage:) [all] : " pmode +if [ -z $pmode ] ; then +pmode='all' +fi +case $pmode in +banner | BANNER | header | HEADER | head | HEAD) +banner_info +;; +misc | MISC | miscelaneous ) +misc +;; +mem | memory | MEM | MEMORY ) +memory +;; +file | FILE | disk | DISK ) +file +;; +innodb | INNODB ) +innodb +;; +all | ALL ) +cecho "\n\c" +all +;; +* ) +cecho "Invalid Mode! Valid options are 'banner', 'misc', 'memory', 'file', 'innodb' or 'all'" $boldred +exit 1 +;; +esac +} + +## Address environmental differences ## +get_system_info + + +if [ -z "$1" ] ; then +login_validation +mode='ALL' +elif [ "$1" = "prompt" ] || [ "$1" = "PROMPT" ] ; then +mode=$1 +elif [ "$1" != "prompt" ] || [ "$1" != "PROMPT" ] ; then +login_validation +mode=$1 +fi + +case $mode in +all | ALL ) +cecho "\n\c" +all +;; +mem | memory | MEM | MEMORY ) +cecho "\n\c" +memory +;; +file | FILE | disk | DISK ) +cecho "\n\c" +file +;; +banner | BANNER | header | HEADER | head | HEAD ) +banner_info +;; +misc | MISC | miscelaneous ) +cecho "\n\c" +misc +;; +innodb | INNODB ) +banner_info +check_innodb_status ; echo +;; +prompt | PROMPT ) +prompt +;; +*) +cecho "usage: $0 [ all | banner | file | innodb | memory | misc | promp ]" $boldred +exit 1 +;; +esac diff --git a/extras/upgrade_2.0.5.sql b/extras/upgrade_2.0.5.sql index 188ff4f6..d0e73693 100644 --- a/extras/upgrade_2.0.5.sql +++ b/extras/upgrade_2.0.5.sql @@ -640,3 +640,9 @@ index(api_date) ); UPDATE system_settings SET db_schema_version='1125'; + +ALTER TABLE vicidial_campaigns ADD vtiger_screen_login ENUM('Y','N') default 'Y'; + +ALTER TABLE vicidial_users ADD alert_enabled ENUM('1','0') default '0'; + +UPDATE system_settings SET db_schema_version='1126'; diff --git a/extras/vtiger_user_file_504.patch b/extras/vtiger_user_file_504.patch deleted file mode 100644 index a5c08e39..00000000 --- a/extras/vtiger_user_file_504.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- ./include/utils/UserInfoUtil.php 2008-12-31 21:39:39.000000000 -0500 -+++ ./include/utils/UserInfoUtil.php 2009-01-01 01:20:17.000000000 -0500 -@@ -1175,6 +1175,18 @@ - global $adb; - global $current_user; - global $seclog; -+ if (!file_exists('user_privileges/user_privileges_'.$current_user->id.'.php')) -+ { -+ $up = fopen('user_privileges/user_privileges_'.$current_user->id.'.php',"a"); -+ fwrite($up, ''); -+ fclose($up); -+ } -+ if (!file_exists('user_privileges/sharing_privileges_'.$current_user->id.'.php')) -+ { -+ $sp = fopen('user_privileges/sharing_privileges_'.$current_user->id.'.php',"a"); -+ fwrite($sp, ''); -+ fclose($sp); -+ } - require('user_privileges/user_privileges_'.$current_user->id.'.php'); - require('user_privileges/sharing_privileges_'.$current_user->id.'.php'); - $permission = "no"; diff --git a/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt b/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt index ea7e458a..eb80ebde 100644 --- a/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt +++ b/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt @@ -373,7 +373,10 @@ Vtiger Create Call Record -<\/B> If Vtiger integration is enabled in the system Vtiger Create Call Record:|| Vtiger Create Lead Record -<\/B> If Vtiger integration is enabled in the system settings and Vtiger Search Category includes LEAD then this setting will define whether a new Vtiger lead record is created when the agent goes to the vtiger_search page and no record is found to have the call phone number. Default is Y|| Vtiger Create Lead Record:|| - +Vtiger Screen Login -<\/B> If Vtiger integration is enabled in the system settings then this setting will define whether the user is logged into the Vtiger interface automatically when they login to VICIDIAL. Default is Y|| +Vtiger Screen Login:|| +Alert Enabled -<\/B> This field shows whether the agent has web browser alerts enabled for when calls come into their vicidial.php session. Default is 0 for NO|| +Alert Enabled:|| ############################################################ CLIENT diff --git a/www/agc/api.php b/www/agc/api.php index 91092588..c2be8a92 100644 --- a/www/agc/api.php +++ b/www/agc/api.php @@ -366,6 +366,8 @@ if ($function == 'external_pause') ################################################################################ if ($function == 'external_dial') { + $value = ereg_replace("[^0-9]","",$value); + if ( (strlen($value)<2) || (strlen($agent_user)<2) || (strlen($search)<2) || (strlen($preview)<2) || (strlen($focus)<2) ) { $result = 'ERROR'; diff --git a/www/agc/vdc_db_query.php b/www/agc/vdc_db_query.php index 959535f0..80d5ae31 100644 --- a/www/agc/vdc_db_query.php +++ b/www/agc/vdc_db_query.php @@ -13,7 +13,7 @@ # - $pass # optional variables: # - $format - ('text','debug') -# - $ACTION - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT','PauseCodeSubmit','LogiNCamPaigns','alt_phone_change') +# - $ACTION - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT','PauseCodeSubmit','LogiNCamPaigns','alt_phone_change','AlertControl') # - $stage - ('start','finish','lookup','new') # - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -') # - $conf_exten - ('8600011',...) @@ -181,12 +181,13 @@ # 81126-1522 - Fixed callback comments bug # 81211-0420 - Fixed Manual dial agent_log bug # 90120-1718 - Added external pause and dial option +# 90126-1759 - Fixed QM section that wasn't qualified and added agent alert option # -$version = '2.0.5-98'; -$build = '90120-1718'; +$version = '2.0.5-99'; +$build = '90126-1759'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=184; +$mysql_log_count=185; $one_mysql_log=0; require("dbconnect.php"); @@ -1124,6 +1125,34 @@ if ($ACTION == 'alt_phone_change') } +################################################################################ +### AlertControl - change the agent alert setting in vicidial_users +### +################################################################################ +if ($ACTION == 'AlertControl') +{ + if (strlen($stage)<1) + { + $channel_live=0; + echo "AGENT ALERT SETTING NOT CHANGED\n"; + echo "$stage is not valid\n"; + exit; + } + else + { + if (ereg('ON',$stage)) {$stage = '1';} + else {$stage = '0';} + + $stmt = "UPDATE vicidial_users set alert_enabled='$stage' where user='$user' and pass='$pass';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'000185',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "AGENT ALERT SETTING CHANGED $stage\n"; + } +} + + ################################################################################ ### manDiaLskip - for manual VICIDiaL dialing this skips the lead that was ### previewed in the step above and puts it back in orig status @@ -2052,25 +2081,28 @@ if ($stage == "end") $affected_rows = mysql_affected_rows($link); } - if ( (strlen($QL_term) > 0) and ($leaving_threeway > 0) ) + if ($enable_queuemetrics_logging > 0) { - $stmt="SELECT count(*) from queue_log where call_id='$MDnextCID' and verb='COMPLETEAGENT' and queue='$VDcampaign_id';"; - $rslt=mysql_query($stmt, $linkB); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00093',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $VAC_cc_ct = mysql_num_rows($rslt); - if ($VAC_cc_ct > 0) + if ( (strlen($QL_term) > 0) and ($leaving_threeway > 0) ) { - $row=mysql_fetch_row($rslt); - $agent_complete = $row[0]; - } - if ($agent_complete < 1) - { - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$VDcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; - if ($DB) {echo "$stmt\n";} + $stmt="SELECT count(*) from queue_log where call_id='$MDnextCID' and verb='COMPLETEAGENT' and queue='$VDcampaign_id';"; $rslt=mysql_query($stmt, $linkB); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00094',$user,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00093',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $VAC_cc_ct = mysql_num_rows($rslt); + if ($VAC_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $agent_complete = $row[0]; + } + if ($agent_complete < 1) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$VDcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00094',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + } } } } diff --git a/www/agc/vicidial.php b/www/agc/vicidial.php index 053ebd79..1f347b80 100644 --- a/www/agc/vicidial.php +++ b/www/agc/vicidial.php @@ -214,10 +214,11 @@ # 90102-1402 - Added time sync check notification # 90115-0619 - Added ability to send Local Closer to AGENTDIRECT agent_only # 90120-1719 - Added API pause/resume and number dial functionality +# 90126-2302 - Added Vtiger login option and agent alert option # -$version = '2.0.5-193'; -$build = '90120-1719'; +$version = '2.0.5-194'; +$build = '90126-2302'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=53; $one_mysql_log=0; @@ -292,7 +293,7 @@ $random = (rand(1000000, 9999999) + 10000000); ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day FROM system_settings;"; +$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day,vtiger_url,enable_vtiger_integration FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01001',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -307,6 +308,8 @@ while ($i < $qm_conf_ct) $vdc_header_phone_format = $row[3]; $WeBRooTWritablE = $row[4]; $timeclock_end_of_day = $row[5]; + $vtiger_url = $row[6]; + $enable_vtiger_integration = $row[7]; $i++; } @@ -341,6 +344,7 @@ $hangup_all_non_reserved= '1'; # set to 1 to force hangup all non-reserved chann $LogouTKicKAlL = '1'; # set to 1 to hangup all calls in session upon agent logout $PhoneSComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login $DefaulTAlTDiaL = '0'; # set to 1 to enable ALT DIAL by default if enabled for the campaign +$AgentAlert_allowed = '1'; # set to 1 to allow Agent alert option $TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen @@ -702,7 +706,7 @@ $VDloginDISPLAY=0; $login=strtoupper($VD_login); $password=strtoupper($VD_pass); ##### grab the full name of the agent - $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,closer_default_blended,user_group,vicidial_recording_override,alter_custphone_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; + $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,closer_default_blended,user_group,vicidial_recording_override,alter_custphone_override,alert_enabled from vicidial_users where user='$VD_login' and pass='$VD_pass'"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01007',$VD_login,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); @@ -719,8 +723,11 @@ $VDloginDISPLAY=0; $VU_user_group=$row[10]; $VU_vicidial_recording_override=$row[11]; $VU_alter_custphone_override=$row[12]; + $VU_alert_enabled=$row[13]; + + if ($VU_alert_enabled > 0) {$VU_alert_enabled = 'ON';} + else {$VU_alert_enabled = 'OFF';} - ### BEGIN - CHECK TO SEE IF AGENT IS LOGGED IN TO TIMECLOCK, IF NOT, OUTPUT ERROR $stmt="SELECT forced_timeclock_login from vicidial_user_groups where user_group='$VU_user_group';"; $rslt=mysql_query($stmt, $link); @@ -885,7 +892,7 @@ $VDloginDISPLAY=0; $HKstatusnames = substr("$HKstatusnames", 0, -1); ##### grab the campaign settings - $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups,disable_alter_custphone,display_queue_count,manual_dial_filter,agent_clipboard_copy,use_campaign_dnc,three_way_call_cid,dial_method,three_way_dial_prefix,web_form_target FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups,disable_alter_custphone,display_queue_count,manual_dial_filter,agent_clipboard_copy,use_campaign_dnc,three_way_call_cid,dial_method,three_way_dial_prefix,web_form_target,vtiger_screen_login FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01013',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -932,6 +939,7 @@ $VDloginDISPLAY=0; $dial_method = $row[39]; $three_way_dial_prefix = $row[40]; $web_form_target = $row[41]; + $vtiger_screen_login = $row[42]; if ( (!ereg('DISABLED',$VU_vicidial_recording_override)) and ($VU_vicidial_recording > 0) ) { @@ -2153,6 +2161,10 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var TEMP_VDIC_web_form_address = ''; var APIPausE_ID = '99999'; var APIDiaL_ID = '99999'; + var VtigeRLogiNScripT = ''; + var VtigeRurl = ''; + var VtigeREnableD = ''; + var alert_enabled = '' var DiaLControl_auto_HTML = "\"\"Resume\""; var DiaLControl_auto_HTML_ready = "\"\"Resume\""; var DiaLControl_auto_HTML_OFF = "\"\"Resume\""; @@ -2315,6 +2327,60 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } +// ################################################################################ +// Send alert control command for agent + function alert_control(taskalert) + { + var xmlhttp=false; + /*@cc_on @*/ + /*@if (@_jscript_version >= 5) + // JScript gives us Conditional compilation, we can cope with old IE versions. + // and security blocked creation of the objects. + try { + xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (E) { + xmlhttp = false; + } + } + @end @*/ + if (!xmlhttp && typeof XMLHttpRequest!='undefined') + { + xmlhttp = new XMLHttpRequest(); + } + if (xmlhttp) + { + alert_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=AlertControl&format=text&stage=" + taskalert; + xmlhttp.open('POST', 'vdc_db_query.php'); + xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); + xmlhttp.send(alert_query); + xmlhttp.onreadystatechange = function() + { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) + { + Nactiveext = null; + Nactiveext = xmlhttp.responseText; + // alert(xmlhttp.responseText); + } + } + delete xmlhttp; + } + if (taskalert=='ON') + { + alert_enabled = 'ON'; + document.getElementById("AgentAlertSpan").innerHTML = "Alert is ON"; + } + else + { + alert_enabled = 'OFF'; + document.getElementById("AgentAlertSpan").innerHTML = "Alert is OFF"; + } + + } + + // ################################################################################ // park customer and place 3way call function xfer_park_dial() @@ -2711,7 +2777,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { // set to pause on next dispo document.vicidial_form.DispoSelectStop.checked=true; - alert("Setting dispo to PAUSE"); + // alert("Setting dispo to PAUSE"); } else { @@ -2754,7 +2820,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} else {document.vicidial_form.LeadLookuP.checked=false;} if (APIDiaL_array_detail[4] == 'YES') // focus on vicidial agent screen - {window.focus();} + {window.focus(); alert("Placing call to:" + APIDiaL_array_detail[1] + " " + APIDiaL_array_detail[0]);} if (APIDiaL_array_detail[3] == 'YES') // call preview {NeWManuaLDiaLCalLSubmiT('PREVIEW');} else @@ -3999,7 +4065,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if (VDIC_web_form_address.match(regWFAcustom)) { URLDecode(VDIC_web_form_address,'YES'); - var TEMP_VDIC_web_form_address = decoded; + TEMP_VDIC_web_form_address = decoded; TEMP_VDIC_web_form_address = TEMP_VDIC_web_form_address.replace(regWFAcustom, ''); } else @@ -4066,7 +4132,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} else {web_form_vars = '?' + web_form_vars} - var TEMP_VDIC_web_form_address = VDIC_web_form_address + "" + web_form_vars; + TEMP_VDIC_web_form_address = VDIC_web_form_address + "" + web_form_vars; } document.getElementById("WebFormSpan").innerHTML = "\"Web\n"; @@ -4851,7 +4917,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if (VDIC_web_form_address.match(regWFAcustom)) { URLDecode(VDIC_web_form_address,'YES'); - var TEMP_VDIC_web_form_address = decoded; + TEMP_VDIC_web_form_address = decoded; TEMP_VDIC_web_form_address = TEMP_VDIC_web_form_address.replace(regWFAcustom, ''); } else @@ -4918,7 +4984,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} else {web_form_vars = '?' + web_form_vars} - var TEMP_VDIC_web_form_address = VDIC_web_form_address + "" + web_form_vars; + TEMP_VDIC_web_form_address = VDIC_web_form_address + "" + web_form_vars; } @@ -4957,6 +5023,10 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} window.clipboardData.setData('Text', tmp_clip.value) } + if (alert_enabled=='ON') + { + alert(" Incoming: " + status_display_number + "\n Group- " + VDIC_data_VDIG[1] + "   " + VDIC_fronter); + } } else { @@ -4991,7 +5061,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if (VDIC_web_form_address.match(regWFAcustom)) { URLDecode(VDIC_web_form_address,'YES'); - var TEMP_VDIC_web_form_address = decoded; + TEMP_VDIC_web_form_address = decoded; TEMP_VDIC_web_form_address = TEMP_VDIC_web_form_address.replace(regWFAcustom, ''); } else @@ -5058,7 +5128,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} else {web_form_vars = '?' + web_form_vars} - var TEMP_VDIC_web_form_address = VDIC_web_form_address + "" + web_form_vars; + TEMP_VDIC_web_form_address = VDIC_web_form_address + "" + web_form_vars; } @@ -5651,6 +5721,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} WebFormRefresH('NO','YES'); + document.getElementById("WebFormSpan").innerHTML = "\"Web"; + window.open(TEMP_VDIC_web_form_address, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); DispoSelect_submit(); @@ -6886,6 +6958,11 @@ else document.getElementById("DiaLControl").innerHTML = DiaLControl_manual_HTML; } } + if ( (VtigeRLogiNScripT == 'Y') && (VtigeREnableD > 0) ) + { + document.getElementById("ScriptContents").innerHTML = " "; + + } VICIDiaL_closer_login_checked = 1; } else @@ -7888,6 +7965,14 @@ Your Status:
    Calls Dialing: + + 0) ) + {echo "Alert is ON";} +else + {echo "Alert is OFF";} +?> + diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index c4e48473..ce8ac70e 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -879,6 +879,8 @@ if (isset($_GET["vtiger_create_call_record"])) {$vtiger_create_call_record=$_G elseif (isset($_POST["vtiger_create_call_record"])) {$vtiger_create_call_record=$_POST["vtiger_create_call_record"];} if (isset($_GET["vtiger_create_lead_record"])) {$vtiger_create_lead_record=$_GET["vtiger_create_lead_record"];} elseif (isset($_POST["vtiger_create_lead_record"])) {$vtiger_create_lead_record=$_POST["vtiger_create_lead_record"];} +if (isset($_GET["vtiger_screen_login"])) {$vtiger_screen_login=$_GET["vtiger_screen_login"];} + elseif (isset($_POST["vtiger_screen_login"])) {$vtiger_screen_login=$_POST["vtiger_screen_login"];} if (isset($script_id)) {$script_id= strtoupper($script_id);} if (isset($lead_filter_id)) {$lead_filter_id = strtoupper($lead_filter_id);} @@ -1248,6 +1250,7 @@ $recording_web_link = ereg_replace("[^-\_0-9a-zA-Z]","",$recording_web_link); $vtiger_search_category = ereg_replace("[^-\_0-9a-zA-Z]","",$vtiger_search_category); $vtiger_create_call_record = ereg_replace("[^-\_0-9a-zA-Z]","",$vtiger_create_call_record); $vtiger_create_lead_record = ereg_replace("[^-\_0-9a-zA-Z]","",$vtiger_create_lead_record); +$vtiger_screen_login = ereg_replace("[^-\_0-9a-zA-Z]","",$vtiger_screen_login); ### ALPHA-NUMERIC and underscore and dash and comma $logins_list = ereg_replace("[^-\,\_0-9a-zA-Z]","",$logins_list); @@ -1521,11 +1524,12 @@ $survey_camp_record_dir = ereg_replace(";","",$survey_camp_record_dir); # 90101-1216 - Added options for user synchronization with vtiger # 90112-0335 - Added vtiger_create_lead_record and vtiger_create_lead_record options # 90115-0502 - Activated AGENT DID routing option +# 90126-2256 - Added vtiger_screen_login campaign option and user agent alert option # # 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-158'; -$build = '90115-0502'; +$admin_version = '2.0.5-159'; +$build = '90126-2256'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -2454,6 +2458,11 @@ echo "
    VICIDIAL Recording Override - This option will override whatever the option is in the campaign for recording. DISABLED will not override the campaign recording setting. NEVER will disable recording on the client. ONDEMAND is the default and allows the agent to start and stop recording as needed. ALLCALLS will start recording on the client whenever a call is sent to an agent. ALLFORCE will start recording on the client whenever a call is sent to an agent giving the agent no option to stop recording. For ALLCALLS and ALLFORCE there is an option to use the Recording Delay to cut down on very short recordings and recude system load. +
    + +
    +Alert Enabled - This field shows whether the agent has web browser alerts enabled for when calls come into their vicidial.php session. Default is 0 for NO. +

    @@ -3124,6 +3133,11 @@ echo "\n"; echo "\n"; echo "\n"; + echo "\n"; + echo "
    Vtiger Create Lead Record - If Vtiger integration is enabled in the system settings and Vtiger Search Category includes LEAD then this setting will define whether a new Vtiger lead record is created when the agent goes to the vtiger_search page and no record is found to have the call phone number. Default is Y. +
    + +
    +Vtiger Screen Login - If Vtiger integration is enabled in the system settings then this setting will define whether the user is logged into the Vtiger interface automatically when they login to VICIDIAL. Default is Y. + @@ -6396,7 +6410,7 @@ if ($ADD=="2A") $rslt=mysql_query($stmt, $link); } - $stmt="INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active) SELECT \"$user\",\"$pass\",\"$full_name\",user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active from vicidial_users where user=\"$source_user_id\";"; + $stmt="INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active,alert_enabled) SELECT \"$user\",\"$pass\",\"$full_name\",user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active,alert_enabled from vicidial_users where user=\"$source_user_id\";"; $rslt=mysql_query($stmt, $link); $stmtA="INSERT INTO vicidial_inbound_group_agents (user,group_id,group_rank,group_weight,calls_today) SELECT \"$user\",group_id,group_rank,group_weight,\"0\" from vicidial_inbound_group_agents where user=\"$source_user_id\";"; @@ -6612,7 +6626,7 @@ if ($ADD==20) { echo "
    CAMPAIGN COPIED: $campaign_id copied from $source_campaign_id\n"; - $stmt="INSERT INTO vicidial_campaigns (campaign_name,campaign_id,active,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,drop_action,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,list_order_mix,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,queue_priority,drop_inbound_group,qc_enabled,qc_statuses,qc_lists,qc_web_form_address,qc_script,survey_first_audio_file,survey_dtmf_digits,survey_ni_digit,survey_opt_in_audio_file,survey_ni_audio_file,survey_method,survey_no_response_action,survey_ni_status,survey_response_digit_map,survey_xfer_exten,survey_camp_record_dir,disable_alter_custphone,display_queue_count,qc_get_record_launch,qc_show_recording,qc_shift_id,manual_dial_filter,agent_clipboard_copy,agent_extended_alt_dial,use_campaign_dnc,three_way_call_cid,three_way_dial_prefix,web_form_target,vtiger_search_category,vtiger_create_call_record,vtiger_create_lead_record) SELECT \"$campaign_name\",\"$campaign_id\",\"N\",dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,drop_action,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,\"DISABLED\",campaign_allow_inbound,manual_dial_list_id,default_xfer_group,queue_priority,drop_inbound_group,qc_enabled,qc_statuses,qc_lists,qc_web_form_address,qc_script,survey_first_audio_file,survey_dtmf_digits,survey_ni_digit,survey_opt_in_audio_file,survey_ni_audio_file,survey_method,survey_no_response_action,survey_ni_status,survey_response_digit_map,survey_xfer_exten,survey_camp_record_dir,disable_alter_custphone,display_queue_count,qc_get_record_launch,qc_show_recording,qc_shift_id,manual_dial_filter,agent_clipboard_copy,agent_extended_alt_dial,use_campaign_dnc,three_way_call_cid,three_way_dial_prefix,web_form_target,vtiger_search_category,vtiger_create_call_record,vtiger_create_lead_record from vicidial_campaigns where campaign_id='$source_campaign_id';"; + $stmt="INSERT INTO vicidial_campaigns (campaign_name,campaign_id,active,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,drop_action,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,list_order_mix,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,queue_priority,drop_inbound_group,qc_enabled,qc_statuses,qc_lists,qc_web_form_address,qc_script,survey_first_audio_file,survey_dtmf_digits,survey_ni_digit,survey_opt_in_audio_file,survey_ni_audio_file,survey_method,survey_no_response_action,survey_ni_status,survey_response_digit_map,survey_xfer_exten,survey_camp_record_dir,disable_alter_custphone,display_queue_count,qc_get_record_launch,qc_show_recording,qc_shift_id,manual_dial_filter,agent_clipboard_copy,agent_extended_alt_dial,use_campaign_dnc,three_way_call_cid,three_way_dial_prefix,web_form_target,vtiger_search_category,vtiger_create_call_record,vtiger_create_lead_record,vtiger_screen_login) SELECT \"$campaign_name\",\"$campaign_id\",\"N\",dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,drop_action,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,\"DISABLED\",campaign_allow_inbound,manual_dial_list_id,default_xfer_group,queue_priority,drop_inbound_group,qc_enabled,qc_statuses,qc_lists,qc_web_form_address,qc_script,survey_first_audio_file,survey_dtmf_digits,survey_ni_digit,survey_opt_in_audio_file,survey_ni_audio_file,survey_method,survey_no_response_action,survey_ni_status,survey_response_digit_map,survey_xfer_exten,survey_camp_record_dir,disable_alter_custphone,display_queue_count,qc_get_record_launch,qc_show_recording,qc_shift_id,manual_dial_filter,agent_clipboard_copy,agent_extended_alt_dial,use_campaign_dnc,three_way_call_cid,three_way_dial_prefix,web_form_target,vtiger_search_category,vtiger_create_call_record,vtiger_create_lead_record,vtiger_screen_login from vicidial_campaigns where campaign_id='$source_campaign_id';"; $rslt=mysql_query($stmt, $link); $stmtA="INSERT INTO vicidial_campaign_stats (campaign_id) values('$campaign_id');"; @@ -8333,7 +8347,7 @@ if ($ADD==41) if ( (!ereg("DISABLED",$list_order_mix)) and ($hopper_level < 100) ) {$hopper_level='100';} - $stmtA="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', $adlSQL next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='" . mysql_real_escape_string($web_form_address) . "', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number',xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',lead_filter_id='$lead_filter_id',alt_number_dialing='$alt_number_dialing',scheduled_callbacks='$scheduled_callbacks',drop_action='$drop_action',drop_call_seconds='$drop_call_seconds',safe_harbor_exten='$safe_harbor_exten',wrapup_seconds='$wrapup_seconds',wrapup_message='$wrapup_message',closer_campaigns='$groups_value',use_internal_dnc='$use_internal_dnc',allcalls_delay='$allcalls_delay',omit_phone_code='$omit_phone_code',dial_method='$dial_method',available_only_ratio_tally='$available_only_ratio_tally',adaptive_dropped_percentage='$adaptive_dropped_percentage',adaptive_maximum_level='$adaptive_maximum_level',adaptive_latest_server_time='$adaptive_latest_server_time',adaptive_intensity='$adaptive_intensity',adaptive_dl_diff_target='$adaptive_dl_diff_target',concurrent_transfers='$concurrent_transfers',auto_alt_dial='$auto_alt_dial',agent_pause_codes_active='$agent_pause_codes_active',campaign_description='$campaign_description',campaign_changedate='$SQLdate',campaign_stats_refresh='$campaign_stats_refresh',disable_alter_custdata='$disable_alter_custdata',no_hopper_leads_logins='$no_hopper_leads_logins',list_order_mix='$list_order_mix',campaign_allow_inbound='$campaign_allow_inbound',manual_dial_list_id='$manual_dial_list_id',default_xfer_group='$default_xfer_group',xfer_groups='$XFERgroups_value',queue_priority='$queue_priority',drop_inbound_group='$drop_inbound_group',disable_alter_custphone='$disable_alter_custphone',display_queue_count='$display_queue_count',manual_dial_filter='$manual_dial_filter',agent_clipboard_copy='$agent_clipboard_copy',agent_extended_alt_dial='$agent_extended_alt_dial',use_campaign_dnc='$use_campaign_dnc',three_way_call_cid='$three_way_call_cid',three_way_dial_prefix='$three_way_dial_prefix',web_form_target='$web_form_target',vtiger_search_category='$vtiger_search_category',vtiger_create_call_record='$vtiger_create_call_record',vtiger_create_lead_record='$vtiger_create_lead_record' where campaign_id='$campaign_id';"; + $stmtA="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', $adlSQL next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='" . mysql_real_escape_string($web_form_address) . "', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number',xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',lead_filter_id='$lead_filter_id',alt_number_dialing='$alt_number_dialing',scheduled_callbacks='$scheduled_callbacks',drop_action='$drop_action',drop_call_seconds='$drop_call_seconds',safe_harbor_exten='$safe_harbor_exten',wrapup_seconds='$wrapup_seconds',wrapup_message='$wrapup_message',closer_campaigns='$groups_value',use_internal_dnc='$use_internal_dnc',allcalls_delay='$allcalls_delay',omit_phone_code='$omit_phone_code',dial_method='$dial_method',available_only_ratio_tally='$available_only_ratio_tally',adaptive_dropped_percentage='$adaptive_dropped_percentage',adaptive_maximum_level='$adaptive_maximum_level',adaptive_latest_server_time='$adaptive_latest_server_time',adaptive_intensity='$adaptive_intensity',adaptive_dl_diff_target='$adaptive_dl_diff_target',concurrent_transfers='$concurrent_transfers',auto_alt_dial='$auto_alt_dial',agent_pause_codes_active='$agent_pause_codes_active',campaign_description='$campaign_description',campaign_changedate='$SQLdate',campaign_stats_refresh='$campaign_stats_refresh',disable_alter_custdata='$disable_alter_custdata',no_hopper_leads_logins='$no_hopper_leads_logins',list_order_mix='$list_order_mix',campaign_allow_inbound='$campaign_allow_inbound',manual_dial_list_id='$manual_dial_list_id',default_xfer_group='$default_xfer_group',xfer_groups='$XFERgroups_value',queue_priority='$queue_priority',drop_inbound_group='$drop_inbound_group',disable_alter_custphone='$disable_alter_custphone',display_queue_count='$display_queue_count',manual_dial_filter='$manual_dial_filter',agent_clipboard_copy='$agent_clipboard_copy',agent_extended_alt_dial='$agent_extended_alt_dial',use_campaign_dnc='$use_campaign_dnc',three_way_call_cid='$three_way_call_cid',three_way_dial_prefix='$three_way_dial_prefix',web_form_target='$web_form_target',vtiger_search_category='$vtiger_search_category',vtiger_create_call_record='$vtiger_create_call_record',vtiger_create_lead_record='$vtiger_create_lead_record',vtiger_screen_login='$vtiger_screen_login' where campaign_id='$campaign_id';"; $rslt=mysql_query($stmtA, $link); if ($reset_hopper == 'Y') @@ -11512,7 +11526,7 @@ if ($ADD==3) $modify_inbound_dids = $row[56]; $delete_inbound_dids = $row[57]; $active = $row[58]; - + $alert_enabled = $row[59]; if ( ($user_level >= $LOGuser_level) and ($LOGuser_level < 9) ) { @@ -11577,6 +11591,8 @@ if ($ADD==3) echo "
    VICIDIAL Recording Override: $NWB#vicidial_users-vicidial_recording_override$NWE
    Agent Alter Customer Data Override: $NWB#vicidial_users-alter_custdata_override$NWE
    Agent Alter Customer Phone Override: $NWB#vicidial_users-alter_custphone_override$NWE
    Alert Enabled: $alert_enabled $NWB#vicidial_users-alert_enabled$NWE
    Campaign Ranks: $NWB#vicidial_users-campaign_ranks$NWE
    \n"; echo "\n"; echo "$RANKcampaigns_list"; @@ -11795,6 +11811,7 @@ if ($ADD==31) $vtiger_search_category = $row[99]; $vtiger_create_call_record = $row[100]; $vtiger_create_lead_record = $row[101]; + $vtiger_screen_login = $row[102]; if (ereg("DISABLED",$list_order_mix)) {$DEFlistDISABLE = ''; $DEFstatusDISABLED=0;} @@ -12237,12 +12254,15 @@ if ($ADD==31) echo "\n"; echo "\n"; + + echo "\n"; } else { echo "\n"; echo "\n"; echo "\n"; + echo "\n"; } if ($campaign_allow_inbound == 'Y') diff --git a/www/vicidial/admin_search_lead.php b/www/vicidial/admin_search_lead.php index 3acb463c..ecf371dc 100644 --- a/www/vicidial/admin_search_lead.php +++ b/www/vicidial/admin_search_lead.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2009 Matt Florell LICENSE: AGPLv2 # # AST GUI database administration search for lead info # admin_modify_lead.php @@ -15,6 +15,7 @@ # - Added required user/pass to gain access to this page # - Changed results to multi-record # 80710-0023 - Added searching by list, user, status +# 90121-0500 - Added filter for phone to remove non-digits # require("dbconnect.php"); @@ -43,6 +44,7 @@ if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); +$phone = ereg_replace("[^0-9]","",$phone); $STARTtime = date("U"); $TODAY = date("Y-m-d"); @@ -108,7 +110,7 @@ $browser = getenv("HTTP_USER_AGENT"); VICIDIAL ADMIN: Lead search
    \n"; +echo "VICIDIAL ADMIN: Lead search: $vendor_id $phone $lead_id $status $list_id $user
    \n"; if ( (!$vendor_id) and (!$phone) and (!$lead_id) and ( (strlen($status)<1) and (strlen($list_id)<1) and (strlen($user)<1) )) diff --git a/www/vicidial/vtiger_search.php b/www/vicidial/vtiger_search.php index ff23a5ca..5e9c9761 100644 --- a/www/vicidial/vtiger_search.php +++ b/www/vicidial/vtiger_search.php @@ -283,7 +283,7 @@ if ($acctid_search > 0) } echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "
    \n"; echo "
    ";
    @@ -444,7 +444,7 @@ if ($account_search > 0)
     			}
     		echo "\n";
     		echo "\n";
    -		echo "\n";
    +		echo "\n";
     		echo "
    \n"; echo "
    ";
    @@ -491,7 +491,7 @@ if ($vendor_search > 0)
     		$account_URL = "$vtiger_url/index.php?module=Vendors&action=DetailView&record=$vendorid&parenttab=Inventory";
     		echo "\n";
     		echo "\n";
    -		echo "\n";
    +		echo "\n";
     		echo "
    \n"; echo "
    ";
    @@ -527,7 +527,7 @@ if ($lead_search > 0)
     		if (ereg('Y',$vtiger_create_lead_record))
     			{
     			echo "\n";
    -			echo "\n";
    +			echo "\n";
     			echo "
    \n"; echo "$phone not found, creating account...\n"; @@ -656,7 +656,7 @@ if ($lead_search > 0) echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "
    \n"; echo "
    ";
    @@ -740,7 +740,7 @@ if ($lead_search > 0)
     			}
     		echo "\n";
     		echo "\n";
    -		echo "\n";
    +		echo "\n";
     		echo "
    \n"; echo "
    ";
    
    Vtiger Create Call Record: $NWB#vicidial_campaigns-vtiger_create_call_record$NWE
    Vtiger Create Lead Record: $NWB#vicidial_campaigns-vtiger_create_lead_record$NWE
    Vtiger Screen Login: $NWB#vicidial_campaigns-vtiger_screen_login$NWE