Monday, February 18, 2019

Install CENTOS 7 and RT - Request Ticket

Do a base install of Centos 7 1810 (tested on)

Install RT prerequisites
yum -y install expat gd graphviz openssl expat-devel gd-devel graphviz-devel  openssl-devel perl perl-CPAN wget screen mod_fcgid postgresql-server postgresql-devel
yum -y groupinstall "Development Tools" "Web Server"
Update system files 
yum -y update
Disable SELINX 
sed -i -r 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
shutdown -r now
Install Postgres database 
postgresql-setup initdb
systemctl enable postgresql.service
systemctl enable httpd.service
systemctl start postgresql.service
systemctl stop httpd.service
sudo -u postgres psql
 Change the entry "XXXXXXX" to your preferable password
ALTER USER postgres PASSWORD 'XXXXXXX';
\q
Edit the config
vi /var/lib/pgsql/data/pg_hba.conf
Look for:

# "local" is for Unix domain socket connections only#local  all  all  peerlocal  all all peer

change "peer" to "md5"

# "local" is for Unix domain socket connections only#local  all  all  peerlocal  all all md5 
systemctl restart postgresql.service
Install CPAN (Comprehensive Perl Archive Network) 
curl -L http://cpanmin.us | perl - --sudo App::cpanminus
Get RT
cd /tmp 
wget https://download.bestpractical.com/pub/rt/release/rt-4.4.3.tar.gz
tar xvzf rt-4.4.3.tar.gz -C /tmp
cd /tmp/rt-4.4.3
Configure RT 
./configure --enable-graphviz --enable-gd --with-web-user=apache --with-web-group=apache --with-db-type=Pg
export RT_FIX_DEPS_CMD=/usr/local/bin/cpanm
make testdeps
Depending on network and CPU step this next step can be 30 minute process
make fixdeps
cpanm HTTP::Headers::Fast --force
make fixdeps

Edit the handler.pm file
vi lib/RT/Interface/Web/Handler.pm
Find these two lines (around line 60)

use RT::Interface::Web::Request;
use File::Path qw( rmtree );
Insert the following line between them

use RT::ObjectCustomFieldValues; 
Make it look like this

use RT::Interface::Web::Request;
use RT::ObjectCustomFieldValues;
use File::Path qw( rmtree );

Complete the installation of RT
make install
Update Firewall Entries
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
Start RT service
/opt/rt4/sbin/rt-server
Login to RT - http://serverIP

Configure using the web interface refer to the RT documents on what to do

Press CTRL+C

Configure web server

edit 

vi /etc/httpd/conf.d/fcgid.conf

Add the following to the bottom

FcgidMaxRequestLen 1073741824

Create /etc/httpd/conf.d/rt.conf and put this in the file
# RT4 configuration for Apache
#
# With minor changes, this configuration is based on the original documentation:
# https://docs.bestpractical.com/rt/4.4.2/web_deployment.html
#
### Optional apache logs for RT
# Ensure that your log rotation scripts know about these files
# ErrorLog /opt/rt4/var/log/apache2.error
# TransferLog /opt/rt4/var/log/apache2.access
# LogLevel debug

AddDefaultCharset UTF-8

ScriptAlias / /opt/rt4/sbin/rt-server.fcgi/

DocumentRoot "/opt/rt4/share/html"

<Location />
  # For Centos7/Apache 2.4 use this line:
  Require all granted

  # For Centos6/Apache 2.2 use these two lines:
  # Order allow,deny
  # Allow from all

  Options +ExecCGI
  AddHandler fcgid-script fcgi
</Location>


Start apache:
systemctl start httpd.service



Wednesday, February 13, 2019

Install vTIGER 7.1.0 on UBUNTU 18.04 LTS

Tested on a standard deployment of UBUNTU 1804 (in HyperV environment)

Assumptions:

This was tested on a basic standard installation of Ubuntu 18.04.  Not even updated.  Deployment below is based on a fully updated OS available (as of January 2019).  The instillation procedure below starts at the point where the OS has been installed, but nothing updated.


Copy/Paste the commands in BOLD.  

Submit them one at a time, waiting for each action to complete.  
If you already have Database, Apache and PHP installed, you can skip down to the install Vtiger setup, however additional or modified installation requirements for your system may need to be researched by you for a successful install. 

UPDATE BOX
sudo apt update
sudo apt upgrade

INSTALL APACHE
sudo apt install apache2
sudo systemctl status apache2

UPDATE FIREWALL RULES
sudo ufw allow 80/tcp
 sudo ufw allow 443/tcp
 sudo ufw reload

INSTALL SQL
sudo apt install mariadb-server mariadb-client
sudo systemctl status mysql
sudo mysql_secure_installation
SQL base Configuration
(press enter if asked for root/current password)
Set a SQL root password of your choice
say Y yes to subsequent configuration questions MariaDB install asks


INSTALL PHP
sudo apt install php php-common php-mysql php-gd php-cli
Instal PHPmyADMIN (if using vtiger chances are you'll want to look at the SQL tables with browser)
sudo apt install phpmyadmin
System will prompt for which web server you are asking, select "APACHE"
System will ask to configure phpmyadmin with "dbconfig-common" (select YES")
select the root password for the MYSQL instance
sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf 
sudo a2enconf phpmyadmin
sudo systemctl restart apache2
sudo mysql -u root -p
(mysql password)

UPDATE USER FOR PHPmyADMIN (please update password below to your liking)
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'PICKpassWORD';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;
sudo systemctl restart apache2
http://IPofSERver/phpmyadmin
login using admin and the password you set in "PICKpassWORD" above.


VTIGER install 7.1.0
cd /tmp
wget https://sourceforge.net/projects/vtigercrm/files/vtiger%20CRM%207.1.0/Core%20Product/vtigercrm7.1.0.tar.gz
tar -xzvf vtigercrm7.1.0.tar.gz
sudo mv vtigercrm /var/www/html/
chown -R root:root /var/www/html
This fix up the php to adjust for requirements of vTIGER
sudo sed -i -r 's/display_errors = Off/display_errors = On/' /etc/php/7.2/apache2/php.ini
sudo sed -i -r 's/log_errors = On/log_errors = Off/' /etc/php/7.2/apache2/php.ini
sudo sed -i -r 's/memory_limit = 128M/memory_limit = 256M/' /etc/php/7.2/apache2/php.ini
sudo sed -i -r 's/max_execution_time = 30/max_execution_time = 0/' /etc/php/7.2/apache2/php.ini
sudo sed -i -r 's/short_open_tag = On/short_open_tag = Off/' /etc/php/7.2/apache2/php.ini
Now we update the database for the VTIGER install
sudo mysql -u root -p
(enter password)
CREATE DATABASE vtiger710;
CREATE USER 'vtiger_admin'@'localhost' IDENTIFIED BY 'PaSsw0rd';
GRANT ALL PRIVILEGES ON `vtiger710`.* TO 'vtiger_admin'@'localhost';
FLUSH PRIVILEGES;
ALTER DATABASE vtiger710 CHARACTER SET utf8 COLLATE utf8_general_ci;
EXIT
sudo chown -R www-data:www-data /var/www/html/vtigercrm/
sudo chmod -R 755 /var/www/html/vtigercrm/
http://IPofSErver/vtigercrm

You should be presented with the Vtiger setup screen like this one

Select  INSTALL

Click I AGREE if you agree with the licence

Screen will show you Installation Pre-req.
Error_reporting will be in red with NOT RECOMMENDED.

Never been able to sort this, but have a bunch of vtiger installations and never had a problem.  Just continue

SYSTEM CONFIGURATION
Hostname = localhost
username = vtiger_admin
password = PaSsw0rd
database name = vtiger710
Select "CREATE NEW DATABASE"
put in your MariaDB user/password (root/Password)
Pick the currency of your country

Vtiger admin user name - defaults to admin
password = password of your choice
First Name is optional
Last Name = Administrator
email = your email address for admin messages.
Select time zone
Press NEXT
Assuming you have everything configured properly you'll be presented with a summary screen of config settings.
Press NEXT
Select your type of company.
This is strictly for anonymous info for vtiger.
Click on NEXT

The system will start doing installations of the application.  You'll see a status bar moving around.  Usually only takes a 1inute or two, sometimes 5.  Depends on speed of your system.  Just be patient,

The system will then present you some check boxes of the type of business you are running and additional modules that are custom to your environment.  Once the installation is completed, you will be at the vTiger admin window and your installation is completed.

You'll be presented with a "ALMOST THERE" menu.  Its double checking your preferences.
Select "GET STARTED"
You should now be in the VTIGER dashboard

Tuesday, February 12, 2019

Install OpenFire on ISSABEL asterisk distribution

If you want to install Openfire on Centos, here's some instructions.

This document was writted and tested with ISSABEL distribution of asterisk.  It runs on CENTOS 7.

Use putty or an SSH client and connect to the IP of your server

From the command prompt, copy and paste each line one at a time.
Wait for it to finish.   The whole setup takes 5 minutes.
cd /tmp
wget -O openfire-4.3.2-1.x86_64.rpm https://www.igniterealtime.org/downloadServlet?filename=openfire/openfire-4.3.2-1.x86_64.rpm
yum -y install openfire-4.3.2-1.x86_64.rpm
systemctl start openfire.service
systemctl enable openfire.service
mysql -p
enter your MySql/MariaDB password
CREATE DATABASE openfire;
CREATE USER 'openfireuser'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON openfire.* TO 'openfireuser'@'localhost' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;
http://IPofISSABEL:9090

Select your language


Leave configuration default
Press Continuar


Press Continuar


Populating Database information:




SELECT MYSQL


Change HOSTNAME -> localhost
Change DATABASENAME to openfire

Put in MySQL login and password


click CONTINUAR


Select CONTINUAR



You can put in your email.
Then provide a password
Then press CONTINUAR


Now you can login

usuario = admin
then your password

Now you are at administration screen



Issabel dashboard will show "Running"

In the openfire admin console select
USERS/GROUPS - CREATE NEW USER

Fill in credentials

Here's an example of what a user might look like


Download the Openfire client called SPARK for your platform
https://igniterealtime.org/downloads/index.jsp#spark

The installation is fairly self explanatory

Once installed put in your username and password and server then click on ADVNACED

If installing on ISSABEL, you may need to select the check box Accept certs and Disable certificate


Click on OK and LOGIN


Monday, February 11, 2019

Asterisk Dialplan SQL integration with vTIGER

We use asterisk in our contact center using the Issabel distribution.
A caller in the IVR can enter their ticket number via the touch tone on their phone

Asterisk then looks up that ticket number in the vTiger CRM database, and when the call is delivered to an agent it pushes the URL to their contact center screen pop, but the URL is formatted to automatically show the ticket the caller is requesting.
  1. The diaplan is to get the ticket number and query the database.
  2. It asks for the caller to enter their ticket number and press # pound symbol.
  3. Then it does a SQL look up in vTiger database to find that ticket number and then find its internal designation.
Here is the code in "extensions_custom.conf"

[getticket]
exten => s,1,Read(ticketnumber,then-press-pound,7,,1,10)
exten => s,2,MYSQL(Connect connid 10.1.100.217 asterisk password01 vtiger710)
;this will get us a ticket number
exten => s,3,MYSQL(Query resultid ${connid} SELECT ticketid FROM vtiger_troubletickets WHERE ticket_no = ${ticketnumber})
exten => s,4,MYSQL(Fetch fetchid ${resultid} vttnumber)
exten => s,5,MYSQL(Disconnect ${connid})
exten => s,6,NoOp(&& the value found is ${vttnumber} )
exten => s,7,goto(ext-queues,5000,1)

So
Line 1 (s,1) asks the caller to enter their ticket number

Line 2 (s,2) opens a connection to the SQL server, and connects to the database

Line 3 queries the database to search for the ticket number.  Ticket numbers that are displayed in Vtiger are different then the number that Vtiger uses in the database to keep track of them.  So this SQL statement finds the ticket number that the users would see, and translates it to the proper reference number that the database uses.

Line 4 Fetches the data that the SQL statement found and saves that number in variable "vttnumber"

Line 5 Closes the connection the database

Line 6 Echos the value found into the asterisk live log

Line 7 Sends this particular call to queue 5000


Now in the Issabel call_center system, we use URL pop to push that data to the customer screen using the external URL application and putting in the varilable "vttnumber" into the URL

http://10.1.100.217/vtigercrm/index.php?module=HelpDesk&view=Detail&record={vttnumber}&app=SUPPORT



Heres a more functional example:

User is asked to put a number into the IVR, sql call to a table to match that number

[macro-pincollection] exten => s,1,Answer() ;set a variable to prevent looping over and over in IVR, either by accident or malicious exten => s,n,Set(Attempts=1) ;throw a entry in the asterisk log for troubleshooting exten => s,n(begin),NooP(&&&&&&& Collecting PIN info for ${CALLERID(all)} attempt ${Attempts} &&&&&) ;ask the caller to entier their pin. exten => s,n,Playback(please-enter-your&pin_number) ;system listens for DTMF and records it in variable "pinnumber" ;the syntax at the end= 7=MAX DIGITS, 1=attempts if no data, 10=timeout. The ",," value i'm not using in this code example) exten => s,n,Read(pinnumber,then-press-pound,7,,1,10) ;system checks for blank value and asks again exten => s,n,ExecIf($["${pinnumber}"=""]?goto(macro-pincollection,s,1)) ;systems plays back the number they entered in to caller exten => s,n,Playback(you-entered) exten => s,n,SayDigits(${pinnumber}) ;system asks them to press 1 to accept or 2 to retry exten => s,n,Playback(if-this-is-correct-press) exten => s,n,SayDigits(1) exten => s,n,Playback(otherwise-press) exten => s,n,SayDigits(2) ;system listens for the value entered exten => s,n,Read(digi,,1) ;this section we test for invalid entries. On their 4 try we hangup. We dont want someone looping over and over again. exten => s,n,Set(Attempts=${MATH(${Attempts}+1,i)}) ;if they reach their 4th attempt, system plays some messages and hangsup. ;Change the "4" to a different value if you want to increase/decrease chances ;Change the "HANGUP to RETURN" if you want the system to go back to a different location as set in the CUSTOM DESTINATIONS section exten => s,n,ExecIf($["${Attempts}"="4"]?playback(sorry-youre-having-problems)) exten => s,n,ExecIf($["${Attempts}"="4"]?playback(hangup-try-again)) exten => s,n,ExecIf($["${Attempts}"="4"]?HANGUP()) ;if user presses 1 to confirm, system sends the call on to the SQL lookup exten => s,n,ExecIf($["${digi}"="1"]?goto(checkvalue)) ;if callers presses any other digit, system will re-ask them to enter in their number exten => s,n,goto(macro-pincollection,s,begin) ;now we call a SQL command to look up the data. Change LOCALHOST, USER PASSWORD and SQL_DATABSE_NAME to match what you use that you use exten => s,n(checkvalue),MYSQL(Connect connid localhost USERNAME PASSWORD SQL_DATABASE_NAME) ;query the database for the pinnumber entered in the IVR and select data from your TABLE and COLUMN that fits your database exten => s,n,MYSQL(Query resultid ${connid} select * from TABLE where COLUMN='${pinnumber}') ;fetch the result exten => s,n,MYSQL(Fetch fetchid ${resultid} number) ;close database connection exten => s,n,MYSQL(Disconnect ${connid}) ;this echos the result to the livelog what the asterisk system found. exten => s,n,NoOp(&& the value found is ${number}) exten => 1,n,GotoIf($[${pinnumber} = ${number}]?10:20) ;go hear if match exten => 1,10,NoOp(&&&&&MATCHING DATA!) exten => s,n,Hangup() ;go hear if NO match exten => 1,20,NoOp(&&&&& NO MATCHING DATA!) exten => s,n,Hangup()