Friday, February 22, 2019

Issabel Contact Center GUI Tweaks

Here are some modifications you can make to ISSABEL asterisk distribution to make it more customized at a HTML level.

Make sure you backup the files.  If you aren't familiar with HTML JAVA etc one wrong place quote or tick could make the system completely unusable!

Agent Contact Center Desktop:

CUSTOMIZE LOGIN SCREEN MODIFICATIONS
Edit the file:

/var/www/html/modules/agent_console/index.php

On around LINE 180 alter the text in ' ' section on the right. (shown in bold
 'WELCOME_AGENT'         =>  _tr('COMPANYNAME Agent Console'),

Save your changes and reload the page (CTRL+F5) and the title should update

=========================================

MODIFY AGENT CONSOLE TABS

Can change the name of the VTIGER CRM tab that ISSABEL puts in.
I changed mine to CUSTOMER CRM


Edit the file:
/var/www/html/modules/agent_console/index.php

Alter the section in BOLD

    'BTN_VTIGERCRM'  =>  file_exists('/var/www/html/vtigercrm') ? _tr('CUSTOMER CRM') : NULL,

=========================================
Change "END SESSION" to "LOGOUT"
My agents were confused sometimes and would press end session instead of hangup.

Edit the file:
/var/www/html/modules/agent_console/index.php

'BTN_FINALIZAR_LOGIN'           =>  _tr('End Calls and Logout'),


=========================================

Issable has a feature that if you click on the "VTIGER" CRM tab in the agent desktop console window, it will launch VTIGER.  

This tab can be useful for a number of reasons.   One being that even if you DONT have vtiger installed on your system, IF you create the folder called "vtigercrm" in  /var/www/html/ the presence of that directory will make the tab appear in the console.

In my situation I have Vtiger 7 installed in a completely different server, so I created a file called "index.php" in this directory with the following inside the file to direct any web traffic to that directory to the new server.

<?php
        echo "<script> location.href='http://company.com/vtiger7'; </script>";
        exit;
?>

However you could make this tab be anything.  You can rename it (process outlined in this post) and then you can put any URL in there you like.

==============================================
Change the stuff under the "ADMIN" drop down menu
In this example I changed the value from "ISSABEL" to "CONTACT CENTER" 
(we have a product with a similar name and it was causing confusion)

/var/www/html/themes/tenant/themesetup.php

Modify the options in BOLD to be what you want

"CHANGE_PASSWORD"           =>  _tr("Change Issabel Password"),


===============================================================

EDIT "INFO" options

edit the file:
/var/www/html/themes/tenant/_common/_menu.tpl

you'll see options listed.  You can customize and ADD options in!

In this example we copy/pasted some lines and modified them with Hotmail, Reddit and Google to show how you can point to other URL locations

<!-- Profile sub-links -->
<li><a href="#" class="register_link">{$Registered}</a></li>
<li><a href="#" id="viewDetailsRPMs"><i class="fa fa-cube"></i>{$VersionDetails}</a></li>
<li><a href="http://www.issabel.org" target="_blank"><i class="fa fa-external-link"></i>Visit Issabel Website</a></li>
<li><a href="http://www.hotmail.com" target="_blank"><i class="fa fa-external-link"></i>Hotmail</a></li>
<li><a href="http://www.reddit.com" target="_blank"><i class="fa fa-external-link"></i>Reddit</a></li>  
<li><a href="http://www.google.com" target="_blank"><i class="fa fa-external-link"></i>Google</a></li>  
<li><a href="#" id="dialogaboutissabel"><i class="fa fa-info-circle"></i>{$ABOUT_ISSABEL2}</a></li>





===============================================================

Add Additional menus of your own in the Agent console:





You'll notice in this example we've add 2 more menu options, and we've updated the ICON.



edit the file:

/var/www/html/themes/tenant/_common/_menu.tpl

Copy paste the BOLD code and alter it to suite your environment.

            <ul class="dropdown-menu">

                <!-- Reverse Caret -->
                <li class="caret"></li>

                <!-- Profile sub-links -->
                <li><a href="#" class="register_link">{$Registered}</a></li>
                <li><a href="#" id="viewDetailsRPMs"><i class="fa fa-cube"></i>{$VersionDetails}</a></li>
<!--            <li><a href="http://www.issabel.org" target="_blank"><i class="fa fa-external-link"></i>Issabel Website</a></li>  -->
                <li><a href="http://www.hotmail.com" target="_blank"><i class="fa fa-external-link"></i>Hotmail</a></li>
                <li><a href="http://www.reddit.com" target="_blank"><i class="fa fa-external-link"></i>Reddit</a></li>
                <li><a href="#" id="dialogaboutissabel"><i class="fa fa-info-circle"></i>{$ABOUT_ISSABEL2}</a></li>
            </ul>
        </li>

<!------- doubled up code ---->

        <li id="header_notification_bar" class="profile-info dropdown">
            <a data-toggle="dropdown" class="" href="#">
                <i class="fa fa-info-circle"></i>
            </a>
            <ul class="dropdown-menu">

                <!-- Reverse Caret -->
                <li class="caret"></li>

                <!-- Profile sub-links -->
                <li><a href="http://www.google.com" target="_blank"><i class="fa fa-external-link"></i>Google</a></li>
            </ul>
        </li>

<!------ end doubledup code ----->

        <!--li id="header_notification_bar" class="dropdown">
            <a {*data-toggle="dropdown"*} class="" href="index.php?menu=addons">
                <i class="fa fa-cubes"></i>
            </a>


Customize the icon that you click on by altering
<i class="fa fa-info-circle"></i>

Here's a few you can use
fa-cog
fa-laptop
fa-envelope
fa-lock
fa-phone
fa-print
fa-bar-chart-o
fa-comments
fa-book
fa-fax
fa-cubes
fa-plus
fa-tachometer

Icon changed from an "I" to a gauge (tachometer)


You can have a whole bunch of them.  Just repeat the code in bold above then customize each one.


======================================================
AGENT PASSWORD CHANGE SCREEN

You can edit the PASSWORD prompt on the login. Again, we have a product with a similar name so we had agents getting confused.

Alter the password popup box when you click on "CHANGE ISSABEL PASSWORD"

/var/www/html/modules/_issabelutils/index.php

    $jsonObject->set_message(array(
        'title' =>  _tr('Change GUI Password'),
        'html'  =>  $smarty->fetch("$local_templates_dir/_change_password.tpl"),



=========================================================

Modify Login password box.  

My users sometimes get confused between the agent id they logon to the GUI with and the one for their phone.  IE.  jsmith/password01  vs  SIP/1000  / numeric password they key into the phone.  Agents are smart, but we live in a society of too many passwords.

/var/www/html/themes/tenant/_common/login.tpl

=====================================================================
This hack will let you change the Campaign Monitoring screen to show the agent name instead of the just the extension.  its not perfect but its a start.

Just use these 2 lines for each agent you want to change and repeat it for each additional agent.
 if ($agent ['agentchannel'] == "SIP/1001")
     $agent ['agentchannel'] = "John Smith";

Find this code in the file /var/www/html/modules/campaign_monitoring/index.php
function formatoAgente($agent)
{
$sEtiquetaStatus = _tr($agent['status']);
$sFechaHoy = date('Y-m-d');
$sDesde = '-';
switch ($agent['status']) {
case 'paused':
    // Prioridad de pausa: hold, break, agendada
    if ($agent['onhold']) {
        $sEtiquetaStatus = _tr('Hold');
        // TODO: desde cuándo está en hold?
    } elseif (!is_null($agent['pauseinfo'])) {
        $sDesde = $agent['pauseinfo']['pausestart'];
        $sEtiquetaStatus .= ': '.$agent['pauseinfo']['pausename'];
    }
    // TODO: exponer pausa de agendamiento
    break;
case 'oncall':
    $sDesde = $agent['callinfo']['linkstart'];
    break;
}
if (strpos($sDesde, $sFechaHoy) === 0)
    $sDesde = substr($sDesde, strlen($sFechaHoy) + 1);

return array(
    'agent'         =>  $agent['agentchannel'],
    'status'        =>  $sEtiquetaStatus,
    'callnumber'    =>  is_null($agent['callinfo']['callnumber']) ? '-' : $agent['callinfo']['callnumber'],
    'trunk'         =>  is_null($agent['callinfo']['trunk']) ? '-' : $agent['callinfo']['trunk'],
    'desde'         =>  $sDesde,
);
Now insert the 'fix' above the "return array(" section below
EXAMPLE:
 if (strpos($sDesde, $sFechaHoy) === 0)
    $sDesde = substr($sDesde, strlen($sFechaHoy) + 1);

     if ($agent ['agentchannel'] == "SIP/1001")
         $agent ['agentchannel'] = "John Smith";

    return array(
    'agent'         =>  $agent['agentchannel'],
    'status'        =>  $sEtiquetaStatus,
    'callnumber'    =>  is_null($agent['callinfo']['callnumber']) ? '-' : $agent['callinfo']['callnumber'],
    'trunk'         =>  is_null($agent['callinfo']['trunk']) ? '-' : $agent['callinfo']['trunk'],
    'desde'         =>  $sDesde,
);
You can repeat the code for a more agents
if (strpos($sDesde, $sFechaHoy) === 0)
    $sDesde = substr($sDesde, strlen($sFechaHoy) + 1);

     if ($agent ['agentchannel'] == "SIP/1001")
         $agent ['agentchannel'] = "John Smith";

     if ($agent ['agentchannel'] == "SIP/1002")
         $agent ['agentchannel'] = "Barb Dell";

     if ($agent ['agentchannel'] == "SIP/1003")
         $agent ['agentchannel'] = "Jane Doe";

     if ($agent ['agentchannel'] == "SIP/1004")
         $agent ['agentchannel'] = "Maria Jones";

    return array(
    'agent'         =>  $agent['agentchannel'],
    'status'        =>  $sEtiquetaStatus,
    'callnumber'    =>  is_null($agent['callinfo']['callnumber']) ? '-' : $agent['callinfo']['callnumber'],
    'trunk'         =>  is_null($agent['callinfo']['trunk']) ? '-' : $agent['callinfo']['trunk'],
    'desde'         =>  $sDesde,
);

Looks like this:



=====================================================================
MODIFY REPLACE ISSABEL or ELASTIX logos.

If you need to modify the Issabel logos and replace them with your own, just replace this png file.

the main menu logo is located in this directory:

/var/www/html/themes/tenant/images/issabel_logo_mini.png 

Hey I don't want to NOT give Issabel credit for this product, its awesome.  But my login is public facing so I want to avoid advertising the system to reduce chances of exploits being attempted.

This is the reference file - changes it to the new name
The default file is about 200x60 in size.

The file name reference is in the
/var/www/html/themes/tenant/_common/login.tpl

and called "issabel_logo_mini.png"
/var/www/html/themes/tenant/_common/login.tpl

You can make the logo size doubled with the following commands:

sed -i -r 's/width="200"/width="400"/' /var/www/html/themes/tenant/_common/login.tpl
sed -i -r 's/height="62"/height="110"/' /var/www/html/themes/tenant/_common/login.tpl

=================================================================

You can remove the change password option completely
/var/www/html/themes/tenant/_common/_menu.tpl

search for 'password'
Delete these 3 lines
<a href="#" class="setadminpassword"> <i class="fa fa-user"></i> {$CHANGE_PASSWORD}
=============================================================================




Agent Logoin screens
themes/tenant/_common/login.tpl

themes/tenant/_common/index.tpl


grep -R "agent_call" /var/www/html/

Add customer portal to vtiger 7.1.0

Here's what I did to get the Customer Portal to work on an instance of 7.1.0
This was pretty much step by step after an install.  SOME sections might not apply to you. 

ASSUMPTIONS
This is tested on CENTOS 7.0 (based on the install detailed in this blog site)

You might need to change it a little if using another form of OS to suit that OS.
the server ip we are using is 10.1.105.50, so you'll need to change that to your own needs
Also our installation directory for vtiger is "vtigercrm" which might differ from yours.

So, here's what the screen will pretty much look like when you click on the "Customer Portal" for the first time.


In 7.1.0 there's a problem.  The URL is formatted wrong and has an extra " / " in the title that will fail everything right away.

http://ip/vtigercrm//customerportal
That is fixed by editing the file 
/var/www/html/vtigercrm/config.inc.php
 and in the section "$PORTAL_URL" you'll see this " /customerportal

Remove the "/" in front of customer portal.  Should look like this:

$PORTAL_URL = $site_URL.'customerportal';

Save those changes

Now you need to download the customer portal code which is usually separate from Vtiger install.
This threw me for a loop why this code isnt' included with the install.  So you can grab it from source forge.

from cli type this:
cd /tmp
wget https://sourceforge.net/projects/vtigercrm/files/vtiger%20CRM%207.1.0/Add-ons/vtigercrm-customerportal-7.1.0.zip
Now you need to unzip it.
unzip vtigercrm-customerportal-7.1.0.zip
(if you are on centos and need to install unzip type in   " yum -y install unzip " and it will download and install the app)
mv vtigercrm-customerportal-7.1.0 customerportal
mv customerportal/ /var/www/html/scansourcecrm/
chown -R apache:apache /var/www/html/vtigercrm/customerportal
cd /var/www/html/vtigercrm/customerportal
cp config.sample.php config.php
edit the file config.php

You'll see this section in the file


//CRM URL without trialing/
//Example: http://yourdomain.com/crm
'crm.url' => '',
//Portal URL without trialing/
//Example: http://yourdomain.com/portal
'portal.url' => '',




//CRM URL without trialing/
//Example: http://yourdomain.com/crm
'crm.url' => 'http://10.1.105.50/vtigercrm',

//Portal URL without trialing/
//Example: http://yourdomain.com/portal
'portal.url' => 'http://10.1.105.50/vtigercrm/customerportal',


Save those changes

Now, log OUT of Vtiger and log back in

Go to CRM SETTINGS - CONFIGURATION - CUSTOMER PORTAL

Now you should have a logon screen!


If you get an error in this window with something like:

Warning: strftime(): It is not safe to rely on the system's timezone settings.
You are *required* to use the date.timezone setting or the date_default_timezone_set() function.

then you need to edit the /etc/php.ini file

Under [DATE}, make sure you have a valid date.timezone setting in there.  If not add it in (like in bold) and save your changes.  Here is a link of valid time zone syntax


[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;date.timezone =
date.timezone = America/Denver

Save your changes enter in

service httpd restart

Should be all fixed

Issabel Call Center - Make Callback Agent default

Issabel call center makes "agent" the default menu selection in the gui to login with "Call Back Agent" is the secondary.  

If you run a contact center that is primarily a callback, this is an extra step that you can get around by adjusting the following piece of code.   My coworker Vince and HTML wizard had this engineered in minutes.  A master of slick code.

This code clicks the "Callback Login" button automatically to make this screen the default one.
It saves agents in a center that is primarily "CallBack" agents the tedious step of clicking on this very small checkbox.

First edit this file:
/var/www/html/themes/tenant/_common/index.tpl
Scroll down to the </head> function and you'll see the following:


    
{$HEADER_MODULES}
    </head>
    <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" "class="mainBody page-body" {$BODYPARAMS}>
    <div class="page-container">



Insert the code in BOLD into this section and make it look like this:


   
 {$HEADER_MODULES}

<script type='text/javascript'>
        function checkTheBox()
        {
        document.getElementById("input_callback").click();
        document.getElementById("input_callback").checked=true;
        }
</script>

    </head>
    <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="checkTheBox()" class="mainBody page-body" {$BODYPARAMS}>


Save your changes

Now go to your logon screen and test.

When you click on Agent Console, you will be taken directly to the CallBack Agent Screen.


Wednesday, February 20, 2019

Remove vTiger 7.1.0 banner advertisement

Installed Vtiger 7.1.0 but don't want the banner advertisement on the desktop?
here's what you do:

create file " removead.php " in /var/www/html/DirectoryOfvTiger 

Inside this file put in the following:

<?php
include_once 'vtlib/Vtiger/Module.php';
$moduleInstance = Vtiger_Module::getInstance('ExtensionStore');
if ($moduleInstance) $moduleInstance->deleteLink('HEADERSCRIPT', 'ExtensionStoreCommonHeaderScript');
echo "ads removed";
?>


Save that file
now from a web browser run that file

http://FQDNorIP/removead.php

You should see the web browser display "vtiger banner has been removed"

You can now delete the file removead.php

 vTIGER login screen logo

That logo is stored in /var/www/html/vtigercrm/layouts/v7/modules/Users/Login.tpl

in a filename of vtiger.png and is located at /var/www/html/scansourcecrm/layouts/v7/resources/Images


 vTIGER login background screen logo
That is stored in is stored 

in /var/www/html/vtigercrm/layouts/v7/modules/Users/Login.tpl
refereed to by a file called "login-background.jpg"



The code to display the advertisement on the login screen is located in
 /var/www/html/vtigercrm/layouts/v7/modules/Users/Login.tpl

from lines from around 260 to 310 
you'll see it start with this bit:

<div class="col-lg-5">
<div class="marketingDiv widgetHeight">{if $JSON_DATA}
and end around line 310 with

   <a href="https://marketplace.vtiger.com/app/listings" target="_blank" style="margin-right: 25px;"><img src="layouts/v7/resources/Images/extensionstore.pn#" style="width: 85%; height: 100%; margin-top: 25px;"/></a>
                                        </div>
                                {/if}

The alignment for the login box is at around line 208.



This keeps it left justified
leftclass=”col-log-5″ 

This would make it middle justified
 class=”col-lg-4 col-lg-offset-4″

How to enable SSL on your vTiger CRM


Get an SSL certificate, free one from let’s encrypt will work
Edit config.inc.php to add https:// to your site URL
Force everyone to be redirected to the https version of the app. To force that, you need to access your CRM folder in the server and create a new file called “.htaccess” At the top of the file, you need to include the following code:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

Save the file and test!

Optimize Vtiger Mysql server

MariaDB has a system known as  “Slow Query Log", but is default off.
To enable the slow query log 


mysql -u root -pSET GLOBAL slow_query_log = 'ON';SET GLOBAL long_query_time = X;
By default, the log file is stored in /var/lib/mysql/hostname-slow.log. You can change it with the following command


SET GLOBAL slow_query_log_file = '/path/filename';
Continue to monitor the slow query log file to see which queries take a long time to run.
You can trigger a sleep with this command.
SELECT SLEEP(X);SET GLOBAL slow_query_log = 'OFF';

Now that you have identified the slow or problematic queries you will need to fix and improve them
Fixing bad or slow queries
MariaDB has an EXPLAIN command which will look at queries for performance issues:
EXPLAIN describes how a SELECT statement
EXPLAIN EXTENDED provides information of the table rows that are filtered by the statement

Tuesday, February 19, 2019

Install osTticket 1.11 on CENTOS 7



Install osTicket 1.11 on CENTOS 7

Assumptions:
Standard installation of CENTOS 7 minimal build 1810 completed with root access to SSH session and root access.
Deployment below is based on a fully updated OS available (as of January 2019) test on HyperV)

Copy/Paste the commands in BOLD.  Submit them one at a time, waiting for each action to complete.  


Install base packages

yum -y install epel-release*
sudo yum -y install httpd mariadb mariadb-server php php-mysql php-fpm php-cli php-xml php-common php-gd php-mbstring wget unzip php-opcache php-pecl-apcu php-intl php-imap
Install MySQL/MariaDB
systemctl start mariadb.service
systemctl enable mariadb.service 
mysql_secure_installation
Configure MYSQL
sudo mysql -u root -p
 Setup database tables. You can change anything in itelics to suit your installation ids
CREATE DATABASE osticket_db;
CREATE USER 'osticket_user'@'localhost' IDENTIFIED BY 'osticket_password';
GRANT ALL PRIVILEGES on osticket_db.* TO 'osticket_user'@'localhost' ;
FLUSH PRIVILEGES;
EXIT;
Install latest version (as of FEB 2019) of osTicket from GITHUB
cd /tmp/
wget https://github.com/osTicket/osTicket/releases/download/v1.11/osTicket-v1.11.zip
Unzip (defaults to 'upload' folder)
unzip osTicket-v1.11.zip  
Move it to apache web directory
sudo mv /tmp/upload /var/www/html/support
Set permissions
sudo chown apache: -R /var/www/html/support
Preinstall osTicket configs
cd /var/www/html/support/
sudo cp /var/www/html/support/include/ost-sampleconfig.php include/ost-config.php
Sets SELINUX to disable 
sed -i -r 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
Update Firewall Rules
sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
sudo firewall-cmd --reload
This next command is super important.  This resolves the error "is currently unable to handle this request." When you try and login to (as of my testing) above 1.9.  If you have a different location name for your osTicket installation just alter the file path in the command.
sudo chmod -R 755 /var/www/html/support/
Set config file ready for initial customization
sudo chmod 0666 /var/www/html/support/include/ost-config.php
service httpd restart
Test your install! 
http://IPofserver/support
You should see something like this screen, everything should be GREEN check marked.

Click on CONTINUE

You'll be at the osTicket basic information.  This section allows you to do some initial configs.

System Settings
HELP DESK NAME = The name that this trouble ticket system should be associated with.  Maybe the name of the company or project.

Default email is the email address that interaction with this ticket system will use.

Database settings

Use the settings that you configured when installing the the maria db
Once completed, click on INSTALL NOW


Once completed the initial configuration you'll see a window like this:



When you see this window, go back to your CLI and change the privileges from the configuration file.
chmod 0644 /var/www/html/support/include/ost-config.php
All Done!  Start using it!