How to Install Asterisk on Ubuntu 18.04
Reference mark is the most mainstream and broadly embraced open-source PBX stage that powers IP PBX frameworks, meeting workers and VoIP doors. It is utilized by people, private companies, huge undertakings and governments around the world.
Mark highlights incorporate phone message, music on hold, gathering calling, call lining, call recording, intuitive voice reaction and substantially more.
This instructional exercise will control you through the means needed to introduce Asterisk 15 on Ubuntu 18.04.
A more established variant of Asterisk (rendition 13) is accessible in the Ubuntu programming store and can be effortlessly introduced with well-suited introduce indicator.
Prerequisites
Prior to proceeding with this instructional exercise, ensure you are signed in as a client with sudo advantages .
Update your Ubuntu framework and introduce the accompanying bundles which are important to download and construct Asterisk:
sudo apt update && sudo apt upgrade
sudo apt install wget build-essential subversion
Downloading Asterisk
We will download Asterisk source in the/usr/src index which is the regular area to put source records, change to the registry with:
cd /usr/src/
Download the most recent form of Asterisk 15 utilizing the accompanying wget order :
sudo wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-15-current.tar.gz
Once the download is finished concentrate the tarball with:
sudo tar zxf asterisk-15-current.tar.gz
Prior to proceeding with the subsequent stages, ensure you change to the Asterisk source catalog by composing:
cd asterisk-15.*/
Installing Asterisk Dependencies
The accompanying content will download the MP3 sources which are needed to fabricate the MP3 module and use MP3 documents on Asterisk:
sudo contrib/scripts/get_mp3_source.sh
Utilize the install_prereq content to determine the entirety of the conditions on your Ubuntu framework:
sudo contrib/scripts/install_prereq install
The content will introduce every important bundle and upon fruitful finish, it will print the accompanying message:
#############################################
## install completed successfully
#############################################
Installing Asterisk
The arrange content will play out various checks to ensure the entirety of the conditions on your framework are available, start the content by composing:
sudo ./configure
Upon fruitful finish, you will see the accompanying yield:
The subsequent stage is to choose the modules you need to accumulate and introduce. Access the Menuselect framework, by composing:
sudo make menuselect
We have just downloaded the MP3 source documents and now we need to advise Asterisk to construct the MP3 module by choosing format_mp3:
Whenever you are done, press F12 to save and exit, or change to the Save and Exit catch and press Enter.
Presently we can begin the accumulation cycle utilizing the make order:
sudo make -j2
The aggregation may take some time, contingent upon your framework. You can alter the - j banner concurring the quantity of centers your processor.
When the construct cycle is finished, you will be given the accompanying message:
As the message above says, the subsequent stage is to introduce Asterisk and its modules by composing:
sudo make install
When the establishment is done the content will show the accompanying message:
Since we have Asterisk introduced we need to introduce the example design records.
Introduce either the conventional arrangement records with reference documentation by composing:
sudo make samples
Or then again introduce the fundamental PBX arrangement records:
sudo make basic-pbx
The last advance is to introduce the Asterisk init content by composing:
sudo make config
It is likewise a smart thought to run ldconfig to refresh the shared libraries store:
sudo ldconfig
Creating Asterisk User
Naturally Asterisk runs as a root client. For security reasons we will make another framework client and design Asterisk to run as the recently made client.
To make another framework client named reference mark run the accompanying order:
sudo adduser --system --group --home /var/lib/asterisk --no-create-home --gecos "Asterisk PBX" asterisk
To design Asterisk to run as mark client, open the/and so on/default/reference bullet record and uncomment the accompanying two lines:
/etc/default/asterisk
AST_USER="asterisk"
AST_GROUP="asterisk"
Add the indicator client to the dialout and sound gatherings:
sudo usermod -a -G dialout,audio asterisk
We likewise need to change the possession and consents of all mark records and indexes so the client bullet can get to those documents:
sudo chown -R asterisk: /var/{lib,log,run,spool}/asterisk /usr/lib/asterisk /etc/asterisk
sudo chmod -R 750 /var/{lib,log,run,spool}/asterisk /usr/lib/asterisk /etc/asterisk
Starting Asterisk
Since we are good to go up, we can begin the Asterisk administration with the accompanying order:
sudo systemctl start asterisk
To check that Asterisk is running, associate with the Asterisk order line interface (CLI) by composing:
sudo asterisk -vvvr
You'll see the default Asterisk CLI brief:
reference bullet cli
The last advance is to empower Asterisk administration to begin on boot with:
sudo systemctl enable asterisk
Configuring Firewall
The firewall will make sure about your worker against undesirable traffic.
On the off chance that you don't have a firewall arranged on your worker, you can check our guide about how to arrangement a firewall with ufw on ubuntu
Of course, SIP utilizes the UDP port 5060, to open the port run:
sudo ufw allow 5060/udp
On the off chance that you empowered the Real Time Protocol (RTP) at that point you additionally need to open the accompanying port reach:
sudo ufw allow 10000:20000/udp
Don't hesitate to change the firewall as indicated by your need.
Conclusion
In this guide we have told you the best way to introduce the most recent Asterisk adaptation from source on your Ubuntu framework.
You should now check the Asterisk Documentation and get familiar with how to arrange and utilize Asterisk.
In the event that you hit an issue or have criticism, leave a remark beneath.