Centos 7.x Install and Setup Asterisk (PBX)

Source: Internet
Author: User
Tags unpack

Asterisk (PBX) is a open source communication server released under the GPL license maintained by Gigium and Asterisk com Munity. Asterisk is used for creating communication applications, turns an ordinary computer into a communication server. So, using the Asterisk in your network environment, you can connect your employees from home to the office PBX over BROADB and connections and can also give them voicemail, integrated with Web and e-mail.

The benefits of using Asterisk is too much, so let's follow this tutorial to setup your own Asterisk server whether in yo ur home, office or in your organization and enjoy with the great features to fill communication gaps.

Asterisk Prerequisites

As we'll be using the CentOS 7 for Asterisk setup with minimal installed packages, so make sure that your system are up to Da Ta and you are rooted user privileges on the system for the installation of different required packages.

1) System Update

You can use below command-system update after successful root login.

#yum Update

2) Installing Required Packages

Once your system is patched with latest updates, you are to install some packages including development tools and other P Ackages that is necessary for its successful operation. You can easily does this by using the below command, that would install its all required packages included all dependencies.

[email protected] ~]# Yum install gcc gcc-c++ php-xml php php-mysql php-pear php-mbstring mariadb-devel mariadb-server ma RIADB sqlite-devel Lynx Bison gmime-devel psmisc tftp-server httpd make ncurses-devel libtermcap-devel sendmail sendmail-c F Caching-nameserver sox newt-devel libxml2-devel libtiff-devel audiofile-devel gtk2-devel uuid-devel libtool Libuuid-devel Subversion kernel-devel kernel-devel-$ (uname-r) git subversion kernel-devel php-process crontabs Cronie cr Onie-anacron wget Vim

Check the list of packages that is going to being installed on your system and press "Y" to continue, this would take about 1 25MB of your disk space.

After successful operation, you'll see the list of installed packages and updates including all its required dependencies .

3) Setup MariaDB

After installation by default we can connect to the database without using any password. So, first we'll enable/start MARIADB services as shown in below image, so we can setup its root password.

Once The MariaDB services is fine, run the below command to setup its root password and remove anonymous user, test data Base and disallow remote user login.

[Email protected] ~]# mysql_secure_installation

4) Installing Libjansson

Jansson is a-C library for encoding, decoding and manipulating JSON data. Let's download, unpack and compile it using the below command.

# wget http://www.digip.org/jansson/releases/jansson-2.7.tar.gz

To extract the use below command.

# TAR-ZXVF Jansson-2.7.tar.gz

Then change directory and configure the package as shown.

5) Make Jansson

Now to compile the configured package we is required to use below ' make ' and ' make install ' command within the same direc Tory to compile fully functional Jansson library.

[[email protected] Jansson-2.7] #make clean
[[email protected] Jansson-2.7] #make && make install
[[email protected] Jansson-2.7] #ldconfig

Installing Asterisk 13.5.0

Here we go with the most important download, which is Asterisk. Let's download its current latest package from their official web linkasterisk download Page. We'll be using ' wget ' command to download it package, so change your current directory and run the command as shown Bel ow.

Using below commands unpack its package, change directory and then run its configuration command.

[Email protected] ~]# TAR-ZXVF asterisk-13.5.0.tar.gz
[Email protected] ~]# CD asterisk-13.5.0
[Email protected] asterisk-13.5.0]#/configure--libdir=/usr/lib64

Upon successful completion of asterisk installation you'll find its logo as shown below.

Asterisk Modules Setup

Now in the next few steps we'll configure Asterisk for its necessary modules.

1) Asterisk Main menu Selection

In order to setup your menu items, let's run the below command and then choose the appropriate options.

[email protected] asterisk-13.5.0]# make MenuSelect

Once you run this command, a new window would be opened where can would see that for the most part, all the necessary m Odules is already included. You can add something or remove when you select a module there are a brief description of its purpose. The add-ons to enable MP3 support module select ' Format_mp3 ' as shown below.

Then move to the next Core sound Packages and select the formats of Audio packets as shown in the image.

Then select all the packages from the ' Music on hold packages ' and then form the ' Extra sound packages Choose the 4 that I Ncludes a first module containing EN and the Choose the "Save and Exit" button to proceed for the next step.

2) Loading mp3 Libraries

Now run the following command to download the MP3 decoder library into the source tree.

[Email protected] asterisk-13.5.0]# contrib/scripts/get_mp3_source.sh

3) Modules Installation

Now we'll proceed with installation of selected modules using the ' Make command '.

So, Asterisk have been successfully built, now run the command as shown on the image to install Asterisk.

[[email protected] asterisk-13.5.0]# make install

In response to the above command, you'll be a greeted with a below put at the end of the nstallation.

+----Asterisk Installation complete-------+
+ +
+ You must READ the SECURITY DOCUMENT +
+ +
+ Asterisk has successfully been installed. +
+ If you would like to install the sample +
+ Configuration files (overwriting any +
+ existing config files), run: +
+ +
+ Make samples +
+ +
+-----------------or---------------------+
+ +
+ You can go ahead and install the asterisk +
+ Program documentation Now or later run: +
+ +
+ Make Progdocs +
+ +
+ **note** This requires.
+ Doxygen installed on your local system +
+-------------------------------------------+

Here we'll run the below commands to install sample configuration files as indicated above.

[email protected] asterisk-13.5.0]# make samples
[[email protected] asterisk-13.5.0]# make Config

Setup Asterisk User

You can create a separate user and give him the right to work with Asterisk in order to start its services with its own US ER and group. Run the below command.

[Email protected] asterisk-13.5.0]# useradd-m asterisk
[Email protected] asterisk-13.5.0]# chown Asterisk.asterisk/var/run/asterisk
[Email protected] asterisk-13.5.0]# chown-r Asterisk.asterisk/etc/asterisk
[Email protected] asterisk-13.5.0]# chown-r Asterisk.asterisk/var/{lib,log,spool}/asterisk
[Email protected] asterisk-13.5.0]# chown-r Asterisk.asterisk/usr/lib64/asterisk
[Email protected] asterisk-13.5.0]# systemctl restart asterisk
[Email protected] asterisk-13.5.0]# systemctl status asterisk

Setup Firewall Rules

Now begin to set up security. By default on CentOS 7 instead of Iptables uses the FirewallD.
Using below command you can start and enable the FIREWALLD services.

[Email protected] ~]# systemctl start FIREWALLD
[Email protected] ~]# Systemctl enable FIREWALLD

Now, access to the ports, that is being used in asterisk PBX by adding the following rules

[Email protected] ~]# firewall-cmd--zone=public--add-port=5060/udp--permanent
Success
[Email protected] ~]# firewall-cmd--zone=public--add-port=5060/tcp--permanent
Success
[Email protected] ~]# firewall-cmd--zone=public--add-port=5061/udp--permanent
Success
[Email protected] ~]# firewall-cmd--zone=public--add-port=5061/tcp--permanent
Success
[Email protected] ~]# firewall-cmd--zone=public--add-port=4569/udp--permanent
Success
[Email protected] ~]# firewall-cmd--zone=public--add-port=5038/tcp--permanent
Success
[Email protected] ~]# firewall-cmd--zone=public--add-port=10000-20000/udp--permanent
Success

To load new firewall rules, use the below command.

[Email protected] ~]# Firewall-cmd--reload

To confirm this all rules had been added, you can by using the command as shown in the image.

Setup Asterisk Database

Let's connect to the MySQL MariaDB and create new user and database then provide it all privileges using the following COM Mands.

[Email protected] ~]# mysql-u root-p
Enter password:******
Welcome to the MariaDB Monitor. Commands End With; or \g.
Your MariaDB Connection ID is 11
Server VERSION:5.5.44-MARIADB MariaDB Server

Copyright (c), Oracle, MariaDB Corporation Ab and others.

Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.

MariaDB [(None)]> create user ' asterisk ' @ ' localhost ' identified by ' ****** ';
MariaDB [(None)]> CREATE database asterisk;
MariaDB [(None)]> CREATE Database Cdrdb;
MariaDB [(None)]> GRANT all privileges on asterisk.* to [e-mail protected] identified by ' ****** ';
MariaDB [(None)]> GRANT all privileges on cdrdb.* to [e-mail protected] identified by ' ****** ';
MariaDB [(None)]> flush privileges;
MariaDB [(None)]>

Launching Asterisk

Launch Asterisk for the first time after it setup on Centos 7 using below command.

[Email protected] ~]# Asterisk-r

Conclusion

The Asterisk 13.5.0 (PBX) has a been successfully installed on the CentOS 7 with its required modules. If you find any mistakes in the article or inconsistencies we would is grateful if you write to us about it in the comment S.

Centos 7.x Install and Setup Asterisk (PBX)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.