Installing PBX debug tools in RHEL v6 (Asterisk v1.10+, FreePBX v2.10+)

10 Feb
PBX,(Private Branch exchange) is a private telephone network used in mid-size enterprises. Consumers that use PBX are configured in a particular number of outside lines to make phone calls for the PBX. Companies make use of a PBX because it’s much less expensive connecting an outside phone line to every single telephone from the organization. It’s much easier to call someone in a PBX because the total numbers you need to dial is usually 3 or 4 digits.

You only require to run in console text mode not GUI graphics mode.  If you currently have a desktop or server GUI installed you are going to need to exit to console mode. you need to automatically let your server boot into a console. You do that by typing init 3 in your inittab file from the terminal console. You will have to have root privileges. Eliminate all installed groups except ‘Yum Utilities’ and then you can start confirming the delete list before entering ‘y’ to make sure none of the ‘sshd’ or ‘yum’ they check change with newer revisions.

yum grouplist installed

Installed Groups:
  DNS Name Server
  Editors
  Legacy Network Server
  Mail Server
  Network Servers
  System Tools
  Text-based Internet
  Web Server
  Windows File Server
  Yum Utilities
DNS Name Server'
  yum groupremove 'Editors'
  yum groupremove 'Legacy Network Server'
  yum groupremove 'Mail Server'
  yum groupremove 'Network Servers'
  yum groupremove 'System Tools'
  yum groupremove 'Text-based Internet'
  yum groupremove 'Web Server'
  yum groupremove 'Windows File Server'

update the base install

DNS Name Server'
  yum groupremove 'Editors'
  yum groupremove 'Legacy Network Server'
  yum groupremove 'Mail Server'
  yum groupremove 'Network Servers'
  yum groupremove 'System Tools'
  yum groupremove 'Text-based Internet'
  yum groupremove 'Web Server'
  yum groupremove 'Windows File Server'

update the base install

yum -y update

Install Asterisk/FreePBX required packages, other useful packages, with their dependencies

yum groupinstall core
yum groupinstall base
yum install gcc gcc-c++ wget bison mysql-devel mysql-server php php-mysql php-process php-pear php-pear-DB php-mbstring nano tftp-server httpd make ncurses-devel libtermcap-devel sendmail sendmail-cf caching-nameserver sox newt-devel libxml2-devel libtiff-devel php-gd audiofile-devel gtk2-devel subversion nano kernel-devel selinux-policy sqlite-devel.

Since php-pear-DB package isn’t included with RH linux version and its clones, you can download it from an official mirror and install otherwise the FreePBX install will fail.  update it to the most recent version

cd /usr/src

wget http://dl.fedoraproject.org/pub/epel/6/i386/php-pear-DB-1.7.13-3.el6.noarch.rpm

rpm -ivh php-pear-DB*

Firewall

Find out if the firewall (iptables) is activated automatically and if the RHEL v6 default configuration blocks the FreePBX web GUI.  Once you know what services/ports are essential you’ll be able to run “system-config-firewall-tui” and configure the firewall.

To start, these ports need to be opened:
TCP 80 (www)
TCP 4445 (Flash Operator Panel)
UDP 5060-5061 (SIP)
UDP 10,000 – 20,000 (RTP)
UDP 4569 (IAX)

An alternative option is usually to remove existing settings from your firewall and save.

iptables -P input accept
iptables -F
service iptables save

you’ll also be able to disable the firewall for the present time and prevent it from starting on reboot.

service iptables stop
chkconfig iptables off

Selinux

Selinux isn’t needed or recommended at this point. So you need to disable selinux from “enforce” to “disable”

nano /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.

SELINUXTYPE=targeted
# SETLOCALDEFS= Check local definition changes
SETLOCALDEFS=0

(Ctrl-x> y >Enter)

Turn off selinux for any session

setenforce 0

TFTP

(Enable the TFTP for configuring phones)

nano /etc/xinetd.d/tftp

change server_args = from “-s /var/lib/tftpboot” to “-s /tftpboot”
change &ldquodisable=yes&rdquo to &ldquodisable=no&rdquo

(Ctrl-X>y>ENTER)

mkdir /tftpboot
chmod 777 /tftpboot
service xinetd restart

Set Timezone

System timezone
Create the appropriate timezone from /etc/localtime.
Example:

ln -sf /usr/share/zoneinfo/America/Vancouver /etc/localtime

PHP Settings

To avoid a variety of warnings set, PHP to the the correct default time zone

nano +946 /etc/php.ini

Uncomment () date.timezone = add your time zone

Adjust memory limit accordingly

nano +457 /etc/php.ini

memory_limit = 128M

restart apache or your installed websever then afterwards to effect your changes

service httpd restart

Get FreePBX

Check if this is the latest released version.

cd /usr/src wget http://mirror.freepbx.org/freepbx-2.10.0.tar.gz tar zxvf freepbx-2.10.0.tar.gz

Get and Install Asterisk

wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-10-current.tar.gz tar zxvf asterisk-10-current.tar.gz

cd /usr/src/asterisk-10*

make clean && make distclean

./configure && make menuselect

After installation create a user

useradd -c “Asterisk PBX” -d /var/lib/asterisk asterisk

and lastly set ownership to these files

chown -R asterisk /var/run/asterisk
chown -R asterisk /var/log/asterisk 
chown -R asterisk /var/lib/asterisk/moh

then change the apache group and users

sed -i “s/User apache/User asterisk/” /etc/httpd/conf/httpd.conf

sed -i “s/Group apache/Group asterisk/” /etc/httpd/conf/httpd.conf

MySQL Setup

First, discover if mysql instance is running, if not start it manually

service mysqld start

Initializing MySQL database:                               [  OK  ]
Starting MySQL:                                            [  OK  ]

configure the mysql database  using -p option if you have an SQL password as MySql user, FreePBX will prompt you for the password  mysqladmin -p create asterisk

cd /usr/src/freepbx-2.10.
mysqladmin create asterisk
mysqladmin create asteriskcdrdb
mysql asterisk < SQL/newinstall.sql
mysql asteriskcdrdb < SQL/cdr_mysql_table.sql

Securing any databases is mandatory and in a case where your server does not have an active firewall, then you need to set  bind-address = 127.0.0.1  so that MySQL  listens only to localhost and nothing else. If you do not perform this step, anyone can use your settings or credentials via the HTTP (80 port if you are using gui to access the administrators panel) and gain administrative access. For security reasons a database password should be strong and consist other characters than the normal alphanumeric; for this session we will use a simple username “admin” and password “admin” using mysqladmin -u root password ‘admin’ command.

mysql

mysql> DROP DATABASE test Query OK, rows affected (.00 sec)

mysql> SHOW VARIABLES LIKE 'hostname' +---------------+----------------+
| Variable_name | Value          |
+---------------+----------------+
| hostname      | somehostname.com |
+---------------+----------------+
1 row in set (.00 sec)

mysql> DROP USER ''@'localhost' Query OK, rows affected (.00 sec)

mysql> DROP USER ''@'somehostname.com' Query OK, rows affected (.00 sec)

mysql> DROP USER 'root'@'somehostname.com'

mysql> GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO admin@localhost {IDENTIFIED BY|Recognized By} 'admin' Query OK, rows affected (.00 sec)

mysql> GRANT ALL PRIVILEGES ON asterisk.* TO admin@localhost {IDENTIFIED BY|Recognized By} 'admin' Query OK, rows affected (.00 sec)

mysql> flush privileges Query OK, rows affected (.00 sec)

mysql>q Bye

install FreePBX now

cd /usr/src/freepbx-2.10.0

./install_amp

set FreePBX to start on boot

echo /usr/local/sbin/amportal start >> /etc/rc.local

Enable Apache and MySQL to start on boot


chkconfig httpd on
chkconfig mysqld on

After a  reboot  you should be able to access

Steps you need to take after reboot

You can access the graphical login of FreePBX with your web browser in the format http://IPaddressOFyourFreePBXserver/.

When accessing web-based FreePBX Admin GUI for the first time you need to “Apply Configuration Changes” so all the *.conf files are installed. or it can also be achieved  by using the command ‘amportal restart’ from the console.

when adding the external SIP extension in FreePBX, change the nat=never default in the configuration to nat=yes for the extension that will be external.

delete or rename /etc/asterisk/sip_notify.conf when you get a symlink fail error during FreePBX installation

Setup external sip extensions if going through NAT

nano /etc/asterisk/sip_nat.conf
nat=yes
externip= or
;externhost=yourdns.com
localnet=192.168.1.0/255.255.255.0
;change the above to whatever your local subnet is
externrefresh=10

(Ctrl-X>y>ENTER)

 

Source: http://edzeame.wordpress.com/2014/02/07/installing-pbx-debug-tools-in-rhel-v6-asterisk-v1-10-freepbx-v2-10/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: