How to set up smartphones and PCs. Informational portal

Installing and configuring asterix from scratch. Basic setup of asterisk after installation

The graphical interface of the IP administrator - PBX Asterisk - FreePBX, has a huge number of configuration options, routing options, connecting various equipment, from telephone sets to gateways. In the article, we will describe the basic setup of the thirteenth version of FreePBX right after.

step by step video

Connecting to FreePBX

To connect to the FreePBX GUI, you need to enter the Asterisk IP address that you provided during the installation step. If you forget which IP address you entered, then connect a monitor and keyboard to your server, and then enter the details for the root user, as shown below:



When connecting, you will be given the IP address of your server. If your distribution version is different and you don't see similar output, issue the following command:

#ifconfig

The output of the command will allow you to see all available interfaces and their IP addresses.

Activation and administrator password

By connecting to FreePBX 13 via an Internet browser, you will immediately be prompted to create an administrator account by entering the login, password and e-mail address of the system administrator. After successful creation, select the item on the main page FreePBX Administration and specify the created parameters:



Immediately after connecting, go to the tab AdminSystem Admin and press the button activation




After that, follow the instructions of the installer. You will need to provide an email address, password, phone number, and the location of your server.


SIP settings

Module SIP Settings this is a graphical visualization of the settings in the /etc/asterisk/sip_nat.conf file. Here, with the help of a graphical interface, you can configure the most important parameters, such as NAT settings, external IP - address and codec settings. To go to the settings, click on the tab Settings, and then Asterisk Sip Settings.



Allow Anonymous inbound SIP Calls
This option allows you to allow or block incoming calls from unknown numbers. We advise you to prohibit this type of calls, as potentially, allowed anonymous calls can become a loophole for intruders.

Local networks
Enter the local (within your network) subnet addresses that Asterisk will trust. For instance, 192.168.2.0/255.255.255.0

RTP Ranges
Specify a range of RTP ports. We recommend leaving everything as default.

Strict RTP
When an RTP stream is established between two devices, source and destination addresses are assigned. With this option enabled, all packets coming from other IP addresses will be dropped. We recommend that you do not disable this option.

codecs
Check the box for the required codecs.

The position of the codecs indicates their priority. For example, in the screenshot below, g.711 u-law is prioritized, then g.711 a-law, gsm, and so on. You can read more about telephone calls in our previous articles.

Setting up NAT in FreePBX

In most cases, if the administrator detects a one-way hearing problem, or that calls are cut off after a few seconds of conversation, the problem is in NAT. Here is what you need to do to get rid of this problem: in the module configuration Asterisk SIP Settings, go to the tab Chan SIP Settings and note the following:

NAT-yes
IP Configuration- Static IP
Override external IP- enter your external IP address

Reinvite Behavior- No
Be sure to specify your local subnet in the Local Networks settings in the previous tab. In addition, forward port 5060 on your router and the port range from the parameter RTP Ranges, default is 10000-20000


Configuring FreePBX network settings

There are three important points in this setting:

  1. Set up a static IP address for the server
  2. Set up DNS
  3. Set up time zone
Let's move on to setting the IP. To do this, go to the tab AdminSystem Adminnetwork settings

Here we configure the following options:

  • network interface- network interface, i.e. a specific network card (NIC)
  • IP assignment- select Static to set up a static IP address
  • static IP- enter the IP address of the server
  • netmask- network mask
  • Gateway- default gateway
  • Start Automatically- start on server boot



Let's set up notifications for our Asterisk server, in case of failures such as low disk space or failure of the RAID array:



We configure the following options:

  • From address- e-mail address that the PBX will indicate as the sender's address when generating a letter
  • Storage Notifications- mail for notifications of storage problems (RAID failure or lack of disk space)
  • Intrusion Detection Notifications IP- mail for notifications about intrusions or attempts to hack the server

Security system configuration

Asterisk has a built-in intrusion detection system - Fail2Ban. To configure the system, go to the tab AdminSystem Adminintrusion detection



The system is flexible, and sometimes it reacts when it is not needed :) Therefore, we advise you to make Whitelist a list of required IP - addresses, such as IP SIP - proxy, gateway addresses, such as FXS. Sometimes, it happens that the IP gets into the ban - the address of the FXS gateway to which all office analog phones are connected.

  • Status- we recommend that you always monitor the Fail2Ban state so that the status is running
  • intrusion detection- at this point, you can stop and restart the service.
  • Ban Time- time in seconds that the IP address will be in blocking status
  • Max Retry- the number of attempts to connect to the PBX, which the user can make during Find Time.
  • Find Time- the time during which the user has Max Retry attempts to connect to the system.
  • Email:- e-mail address to which notifications about the introduction of a new IP address in the ban will be sent.
  • Whitelist- a list of pre-made IP addresses that the administrator trusts.

Setting Up Extensions

To set up telephone sets and create internal numbers, go to the tab ApplicationsExtensions. We described the process of creating internal numbers (Extension) in the article at the link below:

SIP trunk setup

Connecting to an ISP is the most important step in setting up your Asterisk IP PBX server. It is the provider's settings that will allow our users to make outgoing and receive incoming calls. To configure a SIP trunk, go to the tab ConnectivityTrunks. The process of creating a SIP trunk is described in detail in the article at the link below:

Routing setup

After we have configured extension numbers and SIP trunks to connect to the provider, we need to configure call routing. As part of this setup, we will teach our Asterisk server how to handle incoming and outgoing calls. Connectivity We are sorry that the article was not useful to you: (Please, if it does not make it difficult, indicate for what reason? We will be very grateful for a detailed answer. Thank you for helping us become better!

The Asterisk Linux program is needed to create telephony and PBX servers. It has many useful features that will be in place in any office. Conferences, answering machines, call distribution, text messages, video, voice menu and voicemail. The utility supports popular communication protocols. They can be switched. But installing Asterisk on Ubuntu is not the easiest thing to do. The application is downloaded and configured through the terminal. Therefore it is necessary to study console commands.

  1. Navigate to the "contrib/scripts/" folder using the "cd" command.
  2. Open the "get_mp3_source.sh" script.
  3. Enter "make install".
  4. Wait for the archives to load.

The installed Asterisk must be configured both through the menu and through the terminal. So open the console.

  1. Make config files. It can be used as a test. The command is "make samples".
  2. Activate the autorun feature - "make config ldconfig".
  3. Now you can start the service - "service asterisk start".
  4. Or immediately open it as a daemon - "/etc/init.d/asterisk start". To enable its console, enter the command "sudo asterisk -rvvvcd".

For now, you need superuser rights to work with Asterisk. But it is better to create a separate user and give him access to the program's functions. For this:

  1. Temporarily disable the utility - "service asterisk stop".
  2. Add a new user - "adduser [Name]". You can create a group to which you grant the necessary rights. It will come in handy if you decide to make several users work with different Asterisk services.
  3. Now we need a directory to run. Add it with the "mkdir" command. After it, write the “-p” parameter and the path to the “/var/run/asterisk” folder.
  4. To make the application open immediately under the desired user, edit the "/etc/default/asterisk" file. Set the following parameters there: "AST_GROUP="dialout"" and "AST_USER="asterisk"".
  5. You can make it easier - enter the script "sed -i 's/#AST_USER="asterisk"/AST_USER="asterisk"/g' /etc/default/asterisk".
  6. Give the user access to all program folders - "chown -R [UserName] [Directory Path]".
  7. Open the "asterisk.conf" file, find the "runuser" parameter in it and specify the newly created user in it. If you made a group, also rewrite the line "rungroup".
  8. Reboot the system - "reboot".
  9. Log in as Asterisk user - "su [Name]".
  10. And run the program.
  11. To see information about it, type "asterisk -rvvvv".

The utility is ready to go. Further actions depend on the conditions in which the station will be used. There are several files in which the configuration is written:

  • conf - general server settings. In it you can specify how many subscribers are connected. They set the dialing rules.
  • conf - it also sets up dialing rules and sets call parameters.
  • conf - configuration of subscriber accounts.

With Asterisk, you can create a PBX of any complexity. It has many useful functions and modules. After installation and configuration, you will be able to interact with the station using the client software. For example Linphone.

Asterisk, the installation of which will be discussed in this material, is software for organizing the so-called office telephone exchange or IP-PBX (Private Branch eXchange, PBX). It combines all the telephones in the office into one information network, on the basis of which a variety of voice communication services operate. Asterisk runs on Linux, BSD, OS X and Windows using an emulator.

Asterisk can carry voice over four different VoIP protocols and interoperate with virtually all standardized telephones (including mobiles) using relatively inexpensive hardware. Asterisk implements a variety of voicemail capabilities, including telephone directory, conferencing, interactive voice response, and call queues.

In this article, we will look at the process of installing Asterisk on Linux, in particular on popular distributions of CentOS and Debian, as well as the basic procedures for setting up a voicemail server.

Installing the Asterisk server from sources

To begin with, let's consider the algorithm for installing an IP telephony server, which is available on absolutely any Linux distribution, namely, building and installing software from source code. This method allows you to install Asterisk from scratch.

Before installing an IP telephony server, a number of conditions must be met in the system. Asterisk must be installed on a system running at least kernel version 2.6, and the header files must be present on the system for the program to compile successfully. Asterisk is written in C, so the gcc compiler with accompanying libraries such as termcap and openssl must be installed on the system to build. Building Asterisk add-ons also requires the pre-installed libraries and the mysql client, as well as their corresponding header files.

When the system is ready for installation, you will need to go to the Download section on the official website and download the following archives from it:

  1. asterisk.
  2. asterisk-sounds.
  3. asterisk-addons.
  4. zaptel.
  5. libpri.

The files must be copied to the server that will perform the functions of a PBX. Put them in a folder /usr/src/.

After that, run on Go to the directory with the archives and unpack each of them with the command:

tar-xzf<имя_архива>tar.gz

The archives will be unpacked into folders with the same names as the archives. Sequentially go to each of the folders with the command:

cd<имя_папки>

And run the following commands in each folder.

1. Preparation for assembly:

2. Assembly:

3. Installation:

If the above commands succeed, you will build and install Asterisk on your server.

The procedure for installing from source is the same for all Linux distributions, but not everyone is used to it. Generally, most users prefer the installation methods offered by a particular distribution.

In this regard, we will consider the installation procedures for Asterisk on two popular platforms for creating office PBXs: CentOS and Debian GNU/Linux.

Installing Asterisk on CentOS

For this example, we will be installing Asterisk 13. We will be installing Asterisk on CentOS 7.

It is assumed that the installation will be performed in text console mode on behalf of the superuser (root).

First you need to install all the necessary prerequisites. Make sure you have all the packages listed below on your system. There are quite a few of them:

As a result, the system will have all the dependencies required to successfully build the Asterisk telephony server.

The next step should be to disable SELinux. The Security-Enhanced Linux security system on CentOS is enabled by default and very often prevents Asterisk from functioning properly. Therefore, for successful configuration and operation of the server, it must be disabled.

Check the activity status of the SELinux system with the following command:

If the system reports that SELinux is enabled, perform the disable procedure. To do this, you need to make changes to the configuration file in the folder /etc/selinux, by setting the appropriate flag.

sed -i "s/\(^SELINUX=\).*/\SELINUX=DISABLED/" config

timedatectl set-timezone<имя_зоны>(e.g. America/Los_Angeles)

To check if the timezone has been set, you can use the following command:

timedatectl status

After that, you will need to reboot the system to activate the changes. To do this, use the reboot command.

Now let's move on to installing Asterisk.

In fact, installing Asterisk on CentOS comes down to the same build from source that we saw in the previous section. Here we will consider the build process, taking into account the features of a particular Linux distribution, namely CentOS 7.

First, let's download and install the IP telephony server itself.

Download from the Downloads section on the official website of the product the archive with Asterisk 13 and save it to the /usr/src folder. Let's unpack archive command:

tar zxvf<имя_архива>

Let's go to the folder with the unpacked archive and execute the commands below.

./configure --libdir=/usr/lib64 --with-pjproject-bundled

This sequence of commands will allow you to prepare the sources for assembly.

make menuselect.makeopts

After setting the compilation options, perform the following sequence of actions:

1. Create a separate user account for the VoIP server.

adduser asterisk -s /sbin/nologin -c "Asterisk User"

2. Build and install the server.

make && make install

3. Set Asterisk permissions for the newly created user.

chown -R asterisk. /var/lib/asterisk

As a result, the basic Asterisk server will be built and installed.

In addition to Asterisk itself, you can install useful additions to the server in a similar way on CentOS. Read about it below.

freepbx

FreePBX is a full-featured graphical Web-based interface for configuring and managing a PBX. Installing Asterisk with FreePBX is done in the following sequence.

Let's start the database:

systemctl start mariadb

Download the FreePBX source code from the GitHub site to the /usr/src folder:

git clone -b release/13.0 https://github.com/FreePBX/framework.git freepbx

./start_asterisk start

And a number of commands to configure FreePBX:

DAHDI

DAHDI is a driver that allows Asterisk to interact with various telephony equipment. It is responsible for the operation of telephony interface cards installed directly on the server running Asterisk. The DAHDI installation procedure is described below.

Download the archive with the driver to the /usr/src directory, unpack it and go to the unzipped folder. Run the following commands in it:

PJSIP

PJSIP is a library written in C that is responsible for supporting various IP telephony protocols. From Asterisk version 13.8 inclusive, the PJSIP library can be installed separately. However, if Asterisk is compiled with the flag --with-pjproject-bundled(which we did in the previous section), the PJSIP library will be installed directly when the server is compiled.

In order to install PJSIP separately, the following procedure is required.

Download the archive with the driver from pjsip.org to the /usr/src directory, unpack it and go to the unzipped folder. Run the following commands in it:

Post-Installation Procedures

Once the installation of Asterisk is complete, there are a number of additional steps that need to be taken. These procedures are mandatory.

1. Set protection for the database server:

mysql_secure_installation

To complete the procedure, simply answer Y to all questions.

2. Change web server settings:

3. Open access to services and ports required for Asterisk to work:

firewall-cmd --permanent --zone=public --add-service=(http,https) --add-port=5060-5061/tcp --add-port=5060-5061/udp --add-port= 10000-20000/udp

4. Configure database autoload:

systemctl enable mariadb

5. Configure the web server loading at system startup:

systemctl enable httpd

6. Configure FreePBX autostart on system boot:

nano /etc/systemd/system/freepbx.service

systemctl enable freepbx

7. Set up a connection to the database via ODBC. If an obsolete module is installed cdr_mysql.so this item is optional, but still recommended:

nano /etc/odbc.ini

To test ODBC communication, use the following command:

isql -v asteriskcdrdb

8. Reboot the system to apply the changes made:

Installing Asterisk 13 on Debian

In this section, we will cover the installation procedure on another popular platform - Debian. The good news for users is that it's relatively simple, even though it also includes building from source. As an example, we will install Asterisk on Debian 8.

Installation is performed on behalf of the superuser (root). Open the terminal, get the appropriate rights, after which you can proceed with the installation.

First, download Asterisk 13 from the official website and extract the downloaded archive. Go to the folder with unpacked sources.

Now let's install the required dependencies. The most important one, the gcc compiler, is already in Debian. So let's just load the rest:

After all dependencies are downloaded and installed, run the following command in the folder with the unpacked Asterisk archive:

The command should complete without error. If this results in a message that some dependencies are missing, install them.

Before compiling Asterisk, there is an option to enable or disable individual modules:

A console application will open with a list of modules. By moving up and down the list with the keys, you can turn them on and off. Some additional modules require dependencies to be installed. This can be done using apt-get.

Now let's start compiling Asterisk. Enter the familiar commands in the console:

1. Building sources:

2. Installation in system directories:

When the compilation completes without errors, you need to run the command:

This completes the installation. Asterisk has been successfully installed on your server. The following command will bring up the Asterisk management console:

asterisk -vvvvvvgc

Setting up Asterisk

Now let's look at the basic procedures for configuring the Asterisk telephony server. They are fundamentally the same for all Linux distributions.

First you need to add the following text to the file sip.conf:

This will create five accounts that can be used by any SIP client (Cisco SIP Phone, xlite, ATA, etc.). All users will be registered with Asterisk. If this configuration does not work, try disabling the firewall before completing the software setup.

Create your first dial plan

The number plan (dialplan) provides a formalized description of the processes for processing telephone calls. The dialplan tells the system in detail what to do with outgoing and incoming calls. For example, Asterisk can forward them, answer them with an autoresponder, and so on.

Open file extension.conf in the folder /etc/asterisk and add the line to it:

exten=> _XXXX,1,Dial(SIP/$(EXTEN))

Now all configured SIP clients will be able to receive and send calls. The ease of setting up a dialplan makes Asterisk one of the friendliest IP telephony platforms around. Not so many skills are required to raise a PBX.

Creating the first SIP trunk

Asterisk can make outgoing and incoming calls. For outgoing calls, we need an ISP that will forward calls to our system, as well as a public IP address.

To do this, you need to set up a SIP trunk - a virtual communication channel between client equipment and a telephone operator. If our server with Asterisk will act as the client’s equipment, setting up the trunk will allow you to connect any number of city telephone numbers to it using the SIP protocol

To create a trunk, add the following code to the file sip.conf:

After that, you will need to enter extension.conf one more line:

exten => _XXXXXXX.,1,Dial(SIP/trunk1/$(EXTEN))

This will establish a connection with the provider for outgoing calls.

Conclusion

Setting up a full-fledged office PBX based on Asterisk, the installation of which was discussed in this article, includes many more procedures than described above. Detailed information about the telephony server and its capabilities is presented in the official Asterisk documentation.

23.02.2012 15:56

An article that allows novice programmers to do basic asterisk setup

Asterisk is one of the most common IP telephony servers along with systems such as Switchwox and 3CX. This system gained great popularity with the spread of high-quality Internet in our country, as well as many telephone providers providing telephone numbers in SIP format or so-called SIP numbers. One of these companies is Datagroup, which has established itself as one of the leaders in the communications services market. With the reduction in the cost of SIP numbers, it made sense to use modern IP-telephony telephone systems instead of the old analog PBX. This is due to the wide functionality of call centers based on Asterisk. At the same time, the cost of equipment and setting up Asterisk is practically not inferior in cash costs.

Installing asterisk is done by downloading and further compiling the free source code developed by Digium. Asterisk sources exist only for unix-compatible operating systems, the most common of which are Linux and FreeBSD. Installing asterisk under Windows is only possible by implementing a virtual machine. You can download the latest versions of asterisk from the following link. At the moment, 4 versions of this server are being developed at once. The most stable versions of all modules are asterisk 1.4 and asterisk 1.6. On the other hand, in terms of functionality, asterisk 1.8 version compares favorably, which has support for many new modules and functions, including support for the SRTP protocol, work with IPv6, and improved performance when working with SIP and ISDN.

This article will cover the installation of asterisk v 1.6.22 on Linux Fedora Core.

To start the installation, download the asterisk sources. To do this, execute the following commands in the server console:

# wget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-1.6.2.22.tar.gz

# tar -xzvf asterisk-1.6.2.22.tar.gz

Before compiling the sources, install all the necessary related modules and utilities:

# yum install gcc

# yum install gcc-c++

# yum install make

# yum install libxml2-devel

# yum install ncurses-devel

After all additional utilities are installed, we install asterisk itself:

# cd asterisk-1.6.2.22

After a successful installation in the /etc/asterisk directory, you will find the asterisk "a configuration files. Asterisk configuration is done by editing configuration files that have a very specific structure and operators. The basis of the configuration when configuring an asterisk is the sip.conf and extensions.conf files. Having studied and edited these files, you can achieve the correct operation of the server.

The sip.conf file includes the settings of all sip devices registered on the server, which subsequently interact with each other by connecting two or more sip channels, due to which a telephone connection is initiated - that is, a call.

Example sip.conf file:


qualify=yes
nat=no


defaultexpiry=3600
disallow=all
allow=alaw
allow=ulaw
fromuser=044XXXXXXX
host=80.91.169.2
insecure=invite,port
secret=xxxxxxxxxxx
type=peer
username=044XXXXXXX
context=incoming
language=ru
qualify=yes
dtmfmode=auto


type=friend
host=dynamic
insecure=invite,port
username=fxo
secret=xxxxxxxx
context=incoming
qualify=yes
nat=no
canreinvite=no
allowtransfer=no
dtmfmode=auto
disallow=all
allow=alaw
allow=ulaw


type=friend
regexten=101
secret=xxxxxxxxxxxxx
context=internal
host=dynamic
callerid="101"<101>
disallow=all
allow=alaw
allow=ulaw
language=ru
callgroup=1
pickupgroup=1
qualify=yes
canreinvite=yes
call-limit=4
nat=no

This example shows the simplest list of sip devices. It is easy to see that there are blocks enclosed in square brackets in the configuration. It is these blocks that describe the configuration of any devices (peers) when configuring Asterisk. Let's go through the blocks and the most basic parameters.

The block is required. It includes settings and parameters that apply to all blocks by default. In other words, if a parameter is not specified when describing a particular device, then Asterisk reads it from this block.

The next three blocks describe sip devices directly. For clarity, all three devices have different purposes. The block describes the parameters for the sip number of the Datagroup company, the block describes the parameters for connecting to the VOIP gateway, and the block describes the parameters of a regular internal sip device, which can be a software or hardware ip phone.

Let's go over the main parameters of sip devices. The context parameter determines which action algorithm to apply to a particular device. Callerid determines the number and name of the peer that will be displayed when an outgoing call is made from it. The disallow and allow options determine which codecs to use for communication. The secret option is the password to register this peer. It is desirable to make passwords complex enough to avoid hacking by ill-wishers.

The extensions.conf file describes the interactions between contexts and communication channels, which can be many. In fact, this file is the main one when setting up asterisk.

An example extensions.conf file:


exten => _XXX,1,Dial(SIP/$(EXTEN),120,tT)
exten => _XXX,n,Hangup

Exten => _X.,1,Dial(SIP/datagroup/$(EXTEN),120,tT)
exten => _X.,n,Hangup


exten => _X.,1,Dial(SIP/101,60,tT)
exten => _X.,2,Hangup

Exten => h,1,Hangup

In this simplest example, we have two action (context) algorithms - internal and incoming. Recall that binding to contexts is carried out when creating peers in the sip.conf file and is later assigned in extensions.conf when trying to initiate communication with a peer.

Let us describe two contexts in more detail. Already by their names it becomes clear that they are used for algorithms for internal subscribers (internal) and incoming calls (incoming). To understand the construction of this file, a generalized example will help, which can be expressed as a line:

Exten => _XXX,n,Command(Options)

These options are decoded as follows:

Exten => _XXX - service prefix that starts almost all lines in this file. It describes the representation of the incoming context. In other words, if peer number 101 accessed this context, then the algorithm for it should begin with the construction exten => 101. The prefix supports regular expressions and can be specified generically. For example, exten => _XXX says that all peers that consist of three digits fall under this algorithm.

N is the line number of the algorithm. In any program code, there is a sequence of statements that are executed in turn. Similarly, there is such a sequence in the asterisk settings. The only difference is that the commands executed by asterisk are numbered. It is obligatory to indicate the first line explicitly. As you have noticed, all contexts begin with the lines:

Exten => _XXX,1,…..
exten => _X.,1,…..
exten => h,1,……

But further lines can be numbered implicitly, that is, like this:

Exten => _XXX,n,…..
exten => _X.,n,…..
exten => h,n,……

When a line number is implicitly specified, asterisk executes them sequentially from top to bottom, as it does with any other code.

Command - command executed by asterisk. There are not so many basic commands. For basic setup, it is enough to know the syntax of the Dial command (call), on the example of which we will consider the remaining options.

For instance:
exten => _X.,1,Dial(SIP/101,60,tT) - asterisk will dial extension number 101 and will try to reach the subscriber for 60 seconds with the possibility of intercepting the call from the calling and receiving peers (options tT)
exten => _X.,1,Dial(SIP/datagroup/$(EXTEN),120,tT) asterisk will dial the number that is passed in the $(EXTEN) variable using the datagroup peer previously specified in sip.conf

The first example was applied in the incoming context. This indicates that all incoming calls coming to this context are redirected to the internal subscriber who answers these calls. The second example, in turn, shows how an outgoing call is made by passing the dialed number in the $(EXTEN) service variable.

Sample files can be directly copied from this article and pasted into your sip.conf and extensions.conf and edit some options (logins, peer names, passwords, etc.). After setting up asterisk, we start the server with a simple command:

Further actions can be performed from the asterisk command line, which is launched by the command:

# asterisk -rvvvvd

Once in the console, you can check the operation of your server. It will display all the actions that he performs.

P.S. If you failed to set up the server, or if you need a more complex configuration, we will be happy to help you set up asterisk. Our contacts .


To install from a repository on debian/Ubuntu, run from the command line:

sudo apt-get install asterisk

To install from a repository on RHEL/CentOS, run from the command line:

yum install asterisk

This will analyze the dependencies, and if the necessary packages are missing, these packages will be installed first, and then Asterisk.

The main disadvantage of this approach is that you have no control over which version of Asterisk is installed. Most likely, it will be a stable version, but rather old. Therefore, I strongly recommend installing Asterisk from source. In this case, you not only control which version will be installed, but you can also select the necessary components, enable or disable the necessary Asterisk modules.

Installing from sources

Installing required packages

First you need to install additional packages that are necessary for Asterisk to be installed and running. Without some of these packages, Asterisk will refuse to install at all (for example, if gcc is missing). Without some packages, Asterisk will install and even work, but some of the functionality will not be available. For example, the bison package is required to process expressions in the extensions.conf file. Another example: libnewt is required for the astman management interface to work. It is not required for the Asterisk server, but without this package you will not have the astman application, which is a standalone program.

For Debian/Ubuntu:

sudo apt-get install linux-headers-`uname -r` bison flex curl sox libncurses5-dev libssl-dev libxml2-dev binutils gcc g++ ncurses-dev libsqlite3-dev make uuid uuid-dev

For RHEL/CentOS:

Yum -y install gcc gcc-c++ make ncurses-devel libxml2-devel sqlite-devel bison kernel-headers kernel-devel openssl openssl-devel newt newt-devel flex curl sox binutils

then run the command:
yum update
(to download the latest package updates)

Add-on for asterisk 12 / 13

For asterisk 12 / 13 you also need to install the uuid and libjansson libraries.

To install the uuid library on RHEL / Centos, run the command:
yum -y install libuid-devel

To install the libjansson package, you must first enable the additional EPEL repository.

After that, in RHEL / CentOS, you need to install the jansson-devel package by running the command:
yum -y install jansson-devel

Automating the installation of required packages

DAHDI and LibPRI

Before installing Asterisk itself, you need to decide for yourself whether to install the DAHDI and/or libpri components. On the official Asterisk website, in the wiki section (), the developers strongly recommend installing these packages, even if you do not plan to use them (libpri is designed to work with ISDN connections, and DAHDI - with analog telephone lines - PTSN).

If you choose to install DAHDI and/or LibPRI, download and installation instructions can be found here:

Downloading and unpacking Asterisk

Change to the Linux source directory:

cd /usr/src

for version 1.8 it would be:

Wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-1.8-current.tar.gz

For version 11 it would be:

Wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-11-current.tar.gz

unpack asterisk - for this we execute the tar command:

Tar -xvzf asterisk-...tar.gz

where asterisk...tar.gz is the name of the asterisk archive, for example:

Tar -xvzf asterisk-1.8-current.tar.gz

Tar -xvzf asterisk-11-current.tar.gz

Now we need to go to the folder that was created when unpacking the archive. The folder name may or may not be the same as the archive name. You can find out what folders are in /usr/src using the ls command. Having found the folder, go to it:

Cd asterisk-X.Y.Z

Compiling asterisk

Going to the folder with the asterisk source codes, we run the package configuration before compiling:

./configure

If the configuration was successful, then at the end of the command execution, the asterisk icon (asterisk) will appear on the screen.

Now we launch the selection of package components:

Make menuselect

Here you can select any necessary components. Components that cannot be selected are marked with crosses (XXX). To be able to select them, you need to exit this menu, install the missing packages (for example, codecs, the Festival application, and so on), and start compiling asterisk again (starting with the configure command).

At this stage, we recommend installing support for Russian sound files in asterisk. In short: to do this, go to the Core Sound Packages section, and check the boxes CORE-SOUNDS-EN-WAV and CORE-SOUNDS-RU-WAV. Also, go to the Extras Sound Packages section and check the EXTRA-SOUNDS-EN-WAV box. In this case, we chose to install the basic voice package for the Russian language, as well as the installation of the basic and advanced voice packages for the English language (there is no extended package of sound files for the Russian language directly in the asterisk distribution yet). We recommend installing the English package, because if the necessary files are not in the Russian package, the file from the English package will be played - and problems will be easier to detect.

After selecting the required packages, be sure to select "save changes and exit": "Save and exit".

Now we run the most important (and longest) part of compiling the package - the assembly:

If the build was successful, the result will be a boxed text that says something like: "Asterisk build complete", "Asterisk has successfully been built...". If this does not happen, then this means that there were problems installing asterisk . Most likely, some of the packages required for asterisk to work are not installed (for a list of packages needed by asterisk, see above, "Installing the required packages"). Alternatively, you can try installing a different (newer or older) version of asterisk.

If everything went well, we perform the installation of asterisk itself:

make install

If additional sound packs were selected in the make menuselect step, asterisk will download them from the Internet before installation.

If the installation was successful, you will see a boxed message that looks like "Asterisk Installation Complete".

If you are installing for the first time, you will also need to create configuration files. If you are reinstalling/upgrading asterisk, make sure that your configuration files are saved (or do not run the command to create configs).

Create configuration files:

Make samples

And now we add asterisk to the linux startup scripts:

makeconfig

If you have RHEL/CentOS, you will need to run one more command:

Chkconfig asterisk on

Now, before restarting the computer, you can check if asterisk is running or not. To do this, at the linux command line, type:

If you see the message "Asterisk ready", then asterisk has been successfully installed. Then from the asterisk command line (Asterisk CLI) type:

core stop now

to stop the asterisk.

Now you can restart your computer and make sure that asterisk is automatically started at startup. To do this, after restarting (and logging in as root), run the following command:

If you see the asterisk system prompt, then asterisk has been installed successfully, you have correctly configured asterisk to start at computer startup, and no other errors have occurred.

Problems installing asterisk

For problems that arise during the compilation/installation/running of asterisk, see .

Top Related Articles