Skip to main content

FreePBX-Installation

FreePBX-Installation



1. Pre-installation
In order to setup call center server first we have to confirm that our system is full filled the minimum requirements. This asterisk deployment is based on RedHat distribution aka CentOS.  To full-fill the above requirement we are going to setup asterisk 11 on CentOS 6.5 (x64).

1.2 CentOS 6.5x64 installation 

It is recommended to install CentOS 6.5x64 minimum version and manually install all the other package as our requirement. 

At the beginning it recommended to configure the logical disk drives aka Raid. 

Note that some of the server-rigs will not compatible to centos 6.5x64, most of the time it’s because the particular server’s Raid drivers might not be found in centos 6.5x64 disk. In such scenario please follow the below instruction.
First we have to download the Raid driver from relevant vendor. (If it’s HP you will find somewhat like this hpvsa-X.X.X-X.rhel6u.5x86_64.dd).

Note that if the driver has compressed with gzip(.gz) it is recommended to extract by using “tar” in a Linux platform.
Use your Fat32 formatted usb stick and copy those extracted driver (.dd) files.
Now boot your server with centos 6.5x64 and plug your USB stick during the boot time.  At the installation menu, select the installation method and hit “ESC” key to receive the "boot:" prompt. In the boot prompt enter following command 

                linux dd blacklist=ahci

and then let your system to boot (Don’t reboot the system).

And during the installation you will be prompted a window to select the Raid driver and select the relevant driver. On successful driver installation you will be able to see your Logical (Raid driver).

And install the centos 6.5x64 without customize any package.

Note that it is recommended to customize your Logical disk in order to accommodate root user to enough space.  

2 Asterisks Installation

2.2 Disable SELinux

First You have to disable SELinux

             # sed -i 's/\(^SELINUX=\).*/\SELINUX=disabled/' /etc/sysconfig/selinux

Afterwards to affect the system changes restart the PC.

           # init 6

Now check selinux stats by using

          # sestatus



Or you can confirm it on “/etc/sysconfig/selinux” file


2.3 Network Configuration 

          # vim /etc/sysconfig/network-scripts/ifcfg-<netowrk card>`
   Note that network card name can be found using
         # ifconfig

This an example network scripts for network card called “eth0” assign with the IP address “192.168.1.250”.

Make sure that your changes only limited to following parameters,
ONBOOT 
BOOTPROTO 
IPADDR 
NETMASK 
GATEWAY 
DNS1 
DNS2

You are always welcome to use `[root@localhost ~]# setup` in order to perform following configurations.

2.4 Update the System

Then you have to update your system.
Make sure that internet connectivity of the server is alive.

Now using yum application manger lets update the server,

            # yum -y update
These Updating processes will take a while.

         # yum groupinstall core
         # yum groupinstall base

2.5 Install essential dependencies 

In order to deploy the system, we have to install some additional packages aka dependencies.  

           # yum install gcc gcc-c++ lynx bison mysql-devel mysql-server php php-mysql php-pear php-mbstring tftp-server httpd make ncurses-devel libtermcap-devel sendmail sendmail-cf caching-nameserver sox newt-devel libxml2-devel libtiff-devel audiofile-devel gtk2-devel subversion kernel-devel git subversion kernel-devel php-process crontabs cronie cronie-anacron wget vim php-xml uuid-devel libtool sqlite-devel unixODBC mysql-connector-odbc

2.6 Disabling Default IP tables 

Then you have to disable default IP tables and you may enable them again after the installation.



            chkconfig --level 0123456 iptables off`

2.7 Configurations on MySQL and Apache

It is required MySQL and Apache servers to perform Both asterisk and FreePBX operations and it’s recommended if MySQL and Apache services start at the server boot time.


          chkconfig --level 345 mysqld on

          chkconfig --level 345 Apache on


Let’s bring up the Both Apache and MySQL server


          service mysqld start

          service httpd start

2.8 PearDB Installation

PearDB is a database abstraction library which allows to connect to different kinds of databases such as    PostgreSQL, MySQL using a consistent API.

             # pear channel-update pear.php.net
   # pear channel-update pear.php.net
You may found some warnings saying “WARNING: "pear/DB" is deprecated in favor of "pear/MDB2"”, You can just ignore them.

It is preferred to reboot the system before continue further.

         # init 6

2.9 Setup the Asterisk user

Then it is required add user to the system  with relevant permission to perform asterisk activities.

          # adduser asterisk -M -c "Asterisk User"

2.10 Download Asterisk Source Files


Use following links to download asterisk sources files. 

Note that it is preferred  to download the following files to “/usr/src/”.
       # cd /usr/src
       # wgethttp://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
       # wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-current.tar.gz
       # wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-11-current.tar.gz
       # git clone https://github.com/akheron/jansson.git
       # wget http://www.pjsip.org/release/2.2.1/pjproject-2.2.1.tar.bz2

2.11 LibPRI and DAHDI

        # cd /usr/src
        # tar xvfz dahdi-linux-complete-current.tar.gz
        # tar xvfz libpri-current.tar.gz
        # rm -f dahdi-linux-complete-current.tar.gz libpri-current.tar.gz
        # cd dahdi-linux-complete-…… Folder……
        # make all
        # make install
        # make config
        # cd /usr/src/libpri-……Folder……
        # make
        # make install


These modules are recommended to install even those modules required only if you are using physical devices.

2.12 Pjproject Setup


pjproject is a collection of utilities, libraries for building and testing SIP based applications.

         # cd /usr/src`
         # tar -xjvf pjproject-2.2.1.tar.bz2`
         # cd pjproject-2.2.1`
         # CFLAGS='-DPJ_HAS_IPV6=1' ./configure --prefix=/usr --enable-shared --disable-sound\ --disable-resample --disable-video --disable-opencore-amr --libdir=/usr/lib64`
         # make dep`
         # make`
         # make install`


2.13 Jansson Setup 

Jansson is a C library for encoding, decoding and manipulating JSON (JavaScript Object Notation is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming) data. 

         # cd /usr/src/jansson
         # autoreconf -i
         #./configure --libdir=/usr/lib64
         # make
         # make install

2.14 Asterisk Setup

        # cd /usr/src
        # tar xvfz asterisk-13-current.tar.gz
        # rm -f asterisk-13-current.tar.gz
        # cd asterisk-.....Folder....
        # contrib/scripts/install_prereq install
        #./configure --libdir=/usr/lib64
        # contrib/scripts/get_mp3_source.sh
        #make menuselect


Now you must be prompted with “Asterisk Module and Build Option Selection”.



Add mp3 format support if you’re required too compatible mp3 formats on your asterisk server and then press “Save & Exit”.
Finally let’s complete the asterisk installation process.

        # make
        # make install
        # make config
        # ldconfig


You may need to install Asterisk-Extra-Sound

           # mkdir -p /var/lib/asterisk/sounds
           # cd /var/lib/asterisk/sounds
           # wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-wav-current.tar.gz
          # tar xfz asterisk-extra-sounds-en-wav-current.tar.gz
          # rm -f asterisk-extra-sounds-en-wav-current.tar.gz
          # wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-g722-current.tar.gz
         # tar xfz asterisk-extra-sounds-en-g722-current.tar.gz
         # rm -f asterisk-extra-sounds-en-g722-current.tar.gz

3 FreePBX Installation


Note that asterisk is our actual PBX aka core switch, while FreePDB can defined as a web-based GUI and configuration file writer which will write asterisk dial planes and configuration for you.

3.1 Download FreePBX Source Files

        # cd /usr/src
        # wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-12.0-latest.tgz
        #tar vxfz freepbx-12-latest.tgz

3.2 Setup Relevant permission on Asterisk

It is required to setup couple of ownership permissions as follows.

         #chown asterisk. /var/run/asterisk
         #chown -R asterisk. /etc/asterisk
         #chown -R asterisk. /var/{lib,log,spool}/asterisk
         #chown -R asterisk. /usr/lib/asterisk
         #chown -R asterisk. /usr/lib64/asterisk
         #mkdir /var/www/html
         #chown -R asterisk. /var/www/

3.3 Configuration on Apache Server

FreePBX use Apache web server to provide web-based GUI, Following modifications are essential on Apache server.

            #sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php.ini
            #cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf_orig
           #1 asterisk/' /etc/httpd/conf/httpd.conf
           #service httpd restart

3.4 Configuration on MySQL Server


Asterisk uses MySQL database engine to perform its database activities, These Following modifications are essential on MySQL database.

          #cd /usr/src/freepbx
          #export ASTERISK_DB_PW=amp109
          #mysqladmin -u root create asterisk
          #mysqladmin -u root create asteriskcdrdb


Now It’s required Grant relevant permissions on asterisk database.

         #mysql -u root -e "GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY '${ASTERISK_DB_PW}';"
        #mysql -u root -e "GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY '${ASTERISK_DB_PW}';"
        #mysql -u root -e "flush privileges;"

3.5 Finalize the FreePBX installation

        #cd /usr/src/freepbx
         #./start_asterisk start
         #./install_amp --installdb --username=asteriskuser --password=${ASTERISK_DB_PW}
         #amportal chown
         #amportal a ma installall
         #amportal a reload
         #amportal a ma refreshsignatures
         #amportal chown

Let’s Start the FreePBX

          #ln -s /var/lib/asterisk/moh /var/lib/asterisk/mohmp3
          #amportal restart

Note that amportal is the Linux command which is use to controls FreePBX by using Linux command prompt.











Comments

Popular posts from this blog

Asterisk on Docker

This Document covers asterisk basic installation on docker. Since till now there is no official asterisk image on Docker hub we will use Debian core to install the asterisk. Prerequisites Linux host to install docker, Internet connectivity and docker account to download docker images. 1. Installing Docker (Ensure your Internet connectivity) Centos 7           #wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm           #rpm -ivh epel-release-latest-7.noarch.rpm           #yum install docker  Install Docker on RHEL and CentOS 6          # yum install epel-release          # yum install docker-io 2. Start Docker Centos 7          # systemctl start docker          # systemctl status docker          # systemctl enable docker ...

Simple Squid (Proxy server) Configuration

1.  SETUP THE INITIAL NETWORK CONNECTIVITY ON CENTOS After installing centos completely configured the network interfaces as follows, 1. Add a network interface to centos virtual machine as “Lan segment”(Centos lan) 2. And configure the ip address for that LAN segment If this centos machine has only one NIC we have to create two vlans and trunk them.             One to connect to the internet.            One to connect to the local area network interface which we created earlier 3. Using fedora(Another vm guest os) verify the network connectivity 4. Pinging to the LAN-segment that we created in order to verify the internet connectivity. Now we are connected to the private network that we created using centos earlier. Note that in this scenario centos is act as a router. So we are going to convert this centos virtual machine to router, in order to do that we nee...

HAProxy

HAProxy implementation Case Study This tutorial covers HAProxy Deployment on Firewall and SELinux enabled Centos7 systems. First of all lets get an overall idea about my situation.  I've bought a domain call mycompany.com so all of my  hosted sites should be followed by this main domain. As an example, if someone look for london.mycompany.com he should reach to London server, if someone look for chicago.mycompany.com he should reach to Chicago server So, I've created a Cloudflare account and point mycompany.com to our public IP address and created two                 CNAME entries from Cloudflare by adding London and Chicago. From the Cloudflare all the request to mycompany.com will forward to our public address and HAProxy may read those requests and Process them and forward them accordingly between two IIS servers. Note that al...

Asterisk Gateway Interface - Perl

Asterisk Gateway Interface 1. What is Asterisk Gateway Interface?  In simple word AGI is Language Independent API to programmers to control the call flow on their Asterisk PBXs. Asterisk provides more than its own dial-plan, to control to the call flow or lets say call logics. So which means you may use either one of Dialplan Asterisk Manager Interface (AMI) Asterisk Gateway Interface (AGI) to manipulate your call logics. Before we move on to AGI lets briefly discuss about each one of above, Dialplan Dial plan is Asterisk native call logics performer, it's fast, easy to learn and efficient. But this configuration script is more closer to assembly program (If you have any previous experience on assembly), the main drawback of the Asterisk Dialplan in it's lack of support on standard procedural  language as an example when you want create a loop.  Any way in the following tutorials we will only discuss about the AGI, But we can't av...

Discussion : SIP vs BRI/PRI

SIP SIP standards for Session Initiation Protocol and It's Purely IP based.  BRI/PRI PRI stands for Primary Rate Interface and It contains One 64Kbps T1 or E1 Chanel for Signaling AKA Channel D and 23 T1 or 30 E1 Channels as Bearing Chanel aka Channel B.\ BRI standards for Basic Rate Interface and Contain Two Barer channel and One Signaling Chnnel AKA 2B+D. Further Both Both PRI and BRI are ISDN services and also data rate of PRI is 2.048Mbps while 128-144Kbps. ISDN : Integrated Service Digital Network / It's Some Dumb Network SIP vs BRI/PRI SIP does Best effort Delivery as same as IP traffic do, while BRI/PRI Provide QoS. If someone requires to attain QoS through SIP something like MPLS will do with a considerable amount cost. SIP is more flexible than BRI/PRI because it can be accommodated by company existing data network while BRI/PRI reuires to have a dedicated link for it self.

RHEL Recover your root Password

Root Password recovery In this tutorial I will demonstrate you how to recover you lost password. This tutorial is for RHEL 7 Password recovery. Before we go further I would like to brief Linux boot process, When pushed power button your PC/Server it will powered on and the system firmware will runs POST (Power On Self Test) which will check and initiate attached hardware. You can do modifications to these process by BIOS/UFFI configuration After POST, system firmware will look for bootable device in other words it look for Master Boor Record (MBR) Then the System will reads the boot loader from the disk and let boot loader to take control of the system Now the boot loader loads its configuration from disk, at that point you may display the boot options Depends on your selection boot loader will load the kernel and initramfs from disk to you memory(RAM). Initramfs  is some gziped archive contains kernel modules for hardware all hardware w...

Perl - Database Transactions

Database Transactions with Perl To understand what is a database transaction lets look at a simple bank withdrawal and deposit scenario. Assume that you have two bank accounts call A and B, and you need withdraw some amount from account A and Deposit it on account B. In this scenario what happen if you couldn't withdraw money from your account A, the deposit part won't carry out. Again if you couldn't deposit the money to your account B you have to deposit them back on account A (Which means a roll back). So in the  context of Database, Transaction is refer to  a sequence of jobs which is supposed to run as a whole. So in other words, it should happen as whole or not. So as in our following example, we have 3 Database queries which should perform as a whole. Further assume that our first Database query is supposed to perform a insert if successful, second query  should update a table if successful, third query  should delete an entry from a ...

Share-A-Directory-between-two-server-NFS

Share-A-Directory-between-two-server-NFS Please grant the relevant permission on the shell scripts ./client_Export.sh Takes three argument as follows 1. server ip address to be exported 2. client directory which should be exported to the particular server 3. options aka permission for the expoted folder rw: This option allows the client server to both read and write within the shared directory sync: Sync confirms requests to the shared directory only once the changes have been committed. no_subtree_check: This option prevents the subtree checking. When a shared directory is the subdirectory of a larger filesystem, nfs performs scans of every directory above it, in order to verify its permissions and details. Disabling the subtree check may increase the reliability of NFS, but reduce security. no_root_squash: This phrase allows root to connect to the designated directory E...