0

 

Modern telephone communications using the IP protocol are gaining popularity in offices of the sphere of small and medium-sized businesses. Installing asterisk and the freepbx control panel on a server running CentOS 7 is the theme of my next story. We will consistently perform all the steps to configure and assemble the source code of the installed products.

If you have not yet decided how you better configure and use the asterisk, I recommend my article on the basic configuration of asterisk for the needs of small and medium-sized offices. The basic functionality that is necessary for effective work is considered. The instructions are detailed, in steps, from and to: from installation to recording conversations and call statistics.

This article is part of a single article series on the Centos server.

Introduction

Asterisk – a free solution for organizing voip telephony. It has all the capabilities of conventional exchanges, but provides a richer functionality for managing calls. For the relative ease of configuration, in comparison with digital exchanges, free of charge and wide opportunities, he gained such popularity.

Freepbx – A free web interface for managing asterisk. It greatly simplifies the work with configurations, allows you to perform some functions for people who are generally far from the asterisk. For example, with it, almost anyone can be taught to manage user accounts.

Personally, I like to configure asterisk manually more than using the finished panel. Yes, there are a lot of asterisk configs, they are voluminous, working with them is not convenient. However, a pure asterisk provides almost unlimited configuration options. With the finished panel, you will be limited by its capabilities. But if they completely satisfy you, then it is better to use it.

Further installation of FreePBX will proceed as follows:

  1. System preparation.
  2. Install MariaDB.
  3. Web server setup.
  4. Install NodeJS.
  5. Install Asterisk.
  6. Install and configure Freepbx.

System preparation

I recommend that you familiarize yourself with my material on the topic of initial setup of centos 7. Many issues are discussed there in more detail, here I will not linger on them, I will simply execute the necessary commands.

Before we start installing asterisk, we need to perform a number of preparatory steps. First of all, turn off selinux. To do this, open the file:

# mcedit /etc/sysconfig/selinux

and set the value SELINUX = disabled. After that, we apply the configuration without rebooting the server:

# setenforce 0

The recommendation to disable selinux is given in the official freepbx installation instructions, as this may lead to disruption of the installation process.

Next, update the system and install Development Tools packages:

# yum update # yum groupinstall core base "Development Tools"

Install Mariadb

FreePBX uses the Mysql database in its work. As mysql server we will use mariadb. We connect the repository with the latest version of MariaDB. To do this, create a file /etc/yum.repos.d/MariaDB.repo the following content.

# MariaDB 10.3 CentOS repository list - created 2019-04-01 09:11 UTC # http://downloads.mariadb.org/mariadb/repositories/ (mariadb) name = MariaDB baseurl = http://yum.mariadb.org/10.3/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1

Install MariaDB.

# yum install MariaDB-server MariaDB-client MariaDB-shared

Install Mariadb on Centos 7

Launch mariadb and add it to startup.

# systemctl start mariadb # systemctl enable mariadb

Web Server setup

For the FreePBX panel to work, you need a web server with php. I will use php version 7.1. You can read more about setting up a web server on Centos separately. Now for a brief walk through the steps of the whole process.

We connect the epel repository, if you have not done it before.

# yum install epel-release

We connect remi repository for centos 7.

# rpm -Uhv http://rpms.remirepo.net/enterprise/remi-release-7.rpm

We put the package yum-utils.

# yum install yum-utils

We activate the remi-php71 turnip, for this we execute the command.

# yum-config-manager --enable remi-php71

Install the necessary packages for the voip server to work.

# yum install wget php php-pear php-cgi php-common php-curl php-mbstring php-gd php-mysql php-gettext php-bcmath php-zip php-xml php-imap php-json php-process php-snmp

Web server installation

Next, install httpd. It, in theory, should be installed as a dependency in the previous step, but just in case, check.

# yum install httpd

Now we need to change some parameters of httpd – run it from the asterisk user and enable the AllowOverride option. This can be done with your hands in the file. /etc/httpd/conf/httpd.conf, or automatically using sed.

# sed -i 's/^(User|Group).*/1 asterisk/' /etc/httpd/conf/httpd.conf # sed -i 's/AllowOverride None/AllowOverride All/' /etc/httpd/conf/httpd.conf

We just set the following parameters:

  • User asterisk
  • Group asterisk
  • AllowOverride All

Httpd does not need to be launched yet, since we have not yet created the asterisk user. We do this after installing asterisk.

Change the php parameter, which is responsible for the maximum size of the uploaded file. The default value is too low for freepbx. For this in /etc/php.ini set the parameter.

upload_max_filesize = 120M

This can be done either by hand or automatically using sed.

# sed -i 's/(^upload_max_filesize = ).*/120M/' /etc/php.ini

We’ve finished with the web server. We are continuing preparations for installing FreePBX on CentOS.

Install NodeJS

Freepbx requires a NodeJS server to work. We install it on Centos 7. We connect the NodeJS repository using the automation script from the developer.

# curl -sL https://rpm.nodesource.com/setup_10.x | bash -

Updating the yum cache.

# yum clean all && sudo yum makecache fast

Install NodeJS and some dependencies.

# yum install gcc-c++ make nodejs

We check the version just in case:

# node -v

Install NodeJS on Centos 7

If you see the version number, then the installation was successful. We are continuing preparations for installing Freepbx.

Install Asterisk

Download the archive of the latest version of Asterisk from the official site.

# cd ~ && wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-16-current.tar.gz

Unpack the source.

# tar zxvf asterisk-*.tar.gz

Go to the source directory.

# cd asterisk*

We execute a script to install dependency packages for asterisk.

# contrib/scripts/install_prereq install

Run the script to download the source for working with mp3.

# contrib/scripts/get_mp3_source.sh

Configure the configuration:

# ./configure --with-pjproject-bundled --with-jansson-bundled --with-crypto --with-ssl=ssl --with-srtp

Launch the menu to select the parameters:

make menuselect

Install Asterisk

In general, you can leave the default setting, if you do not really understand what to choose. You can look in more detail in my article about the detailed configuration of asterisk.

You can run the installation of asterisk.

# make && make install && make config && make samples && ldconfig

Configure the launch of the asterisk from the asterisk system user. To do this, edit the startup script / usr / sbin / safe_asteriskby setting the parameter.

ASTARGS="-U asterisk"

You can do the same automatically.

# sed -i 's/ASTARGS=""/ASTARGS="-U asterisk"/g' /usr/sbin/safe_asterisk

Create this user and assign the necessary rights to directories.

# useradd -m asterisk # chown asterisk.asterisk /var/run/asterisk # chown -R asterisk.asterisk /etc/asterisk # chown -R asterisk.asterisk /var/{lib,log,spool}/asterisk # chown -R asterisk.asterisk /usr/lib/asterisk

Launch Asterisk.

# systemctl start asterisk

Check immediately that it has started.

# systemctl status asterisk

Launch asterisk

Install and configure Freepbx

Download the latest version of Freepbx from the developer’s site.

# cd ~ && wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-15.0-latest.tgz

Unpack the source.

# tar xvfz freepbx-*.tgz

We go to the freepbx directory and run the asterisk startup script.

# cd freepbx && ./start_asterisk start

Checking the start of asterisk

If you have not received any errors, then we start the installation directly to FreePBX.

# ./install -n

Install FreePBX

If everything went without errors, then you can check the operation of Freepbx. But before that, disable Firewall if it works for you.

# systemctl stop firewalld && systemctl disable firewalld

I do not want to touch on its settings in this article. In detail, I examined the firewall configuration issue separately. There you can find out all the nuances. Here I proto say that for starters we need to open the 80th port so that we can work with the web interface:

iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT

For the asterisk to work properly, you need to open the following ports:

iptables -A INPUT -p udp -m udp --dport 5060 -j ACCEPT iptables -A INPUT -p udp -m udp --dport 5061 -j ACCEPT iptables -A INPUT -p tcp -m tcp --dport 5060 -j ACCEPT iptables -A INPUT -p tcp -m tcp --dport 5061 -j ACCEPT iptables -A INPUT -p udp -m udp --dport 4569 -j ACCEPT iptables -A INPUT -p tcp -m tcp --dport 5038 -j ACCEPT iptables -A INPUT -p udp -m udp --dport 5038 -j ACCEPT iptables -A INPUT -p udp -m udp --dport 10000:20000 -j ACCEPT

Now you can run httpd.

# systemctl start httpd

Add it to startup:

# systemctl enable httpd

This completes the installation of Freepbx. You can enter the browser with the server ip address. I have it http://85.143.175.176 The freepbx start page opens, where we are invited to create a new user:

Configure FreePBX

We create the user and go to the asterisk management web interface:

Freepbx dashboard

That’s all, then you can do the tuning. Previously, the next section was information on startup freepbx, but at the moment this information is irrelevant. You do not need to configure autoload for freepbx separately. It defaults to automatically starting at system startup.

Conclusion

In this manual, we carefully collected all the necessary components for configuration asterisk + freepbx bundles on the CentOS 7. server. We downloaded the latest versions of the software, compiled it from the source, and installed it. Thus, we fully prepared the server for telephony configuration. If the server will look on the Internet, you must definitely remember to carefully configure the firewall and at least fail2ban to provide minimal, although in most cases, quite sufficient protection.

An example of configuring asterisk from scratch is the indicated article. It can be taken as a basis for a holistic understanding of the basic functionality that can be implemented using asterisk.

I remind you that this article is part of a single article series about the Centos server.

Video

At the end of the video with the entire installation process:

How to use GitLab

Previous article

What are the Processor Cores in your Smartphone?

Next article

You may also like

Comments

Leave a reply

Your email address will not be published. Required fields are marked *

More in centos