Asterisk is a Linux utility that allows to play the role of a telephonic IP server. Which means it will allow you to make calls from your computer, IP phone, or even from your personal mobile via WIFI through the local network. This solution allows you to establish an internal telephonic system on your (personal or professional) network. In second hand, linked to a SIP (Session Initiation Protocol) service which is a voice transfer protocol via internet, it allows to make calls to fixed numbers or portable, directly via your local network. There are many SIP providers (OVH or Free) who propose it freely (calls towards non-included). But we will see about this later. Today I will explain to you how to Install, configure and use Asterisk as I already did in a company I worked for. To follow along this tutorial, you will need a machine (or a VM) with Ubuntu 14.04 installed or an inferior version, but Debian will work just as well. You will also need Internet and a second client machine (OS doesn’t matter), my client machine is a Win 10 but a MacOS will do the job just as well.
2. Installation Prerequisites:
Start by opening a terminal and log in as root, this will delete all problems concerning the rights and file access. After doing this, the first thing to do is verifying that your system is up to date using the following commands:
When you will finish updating your system, restart it and re-open a terminal as root. The first thing to do is to install Asterisk dependencies. To do this, use the following command:
Apt-get install build-essential libxm12-dev libncurses5-dev linux-headers- ‘uname -r’ libsqlite3-dev libssl-dev
After completing this task, you must configure your server (or VM) with a fixed IP to be able to stay connected to it without having to check your IP address each time your machine restarts or each time the DHCP configuration changes.
3. Asterisk Installation:
After installing the dependencies, we will see how to install Asterisk. First go to the folder /usr/src and create another folder named Asterisk from which we will get the sources. These are the commands:
After this step, we must download the sources and store them in this folder we just created. We will download the version 10.7.0 using the following command:
wget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk- 10.7.0.tar.gz
tar -xvf asterisk-10.7.0.tar.gz
Now we will go to the folder and configure the installation menu and run it:
When you run the make menuselect command, and you get this error:
make: Entering directory ‘/usr/scr/asterisk/asterisk-10.7.0’
Terminal must be at least 80 x 27.
This means that your console is very small (inferior to 80×27) and you need to enlarge it.
After doing this, verify that your machine is connected to internet and run the installation command:
Now that everything is installed we will verify that it is working correctly by starting it and opening its console with the following command:
Asterisk is correctly installed on your machine.
4. User Account Configuration:
We will start by configuring the user accounts. To do that we will use the users.conf file. If you look inside this file, you will see that it contains comments explaining all the possible parameters we can use in this file. But we will first change its name to users.conf.old and recreate another one :
mv user.conf user.conf.old
We will add in this file all the general parameters:
Hassip = yes ; Defines that users can use the SIP protocol
Hasiax = yes
Callwaiting = yes
Threewaycalling = yes
Callwaitingcallerid = yes
Nat = yes ; Usage of NAT forced
After this, we will create a template for all users to avoid writing the same thing for each one of them:
Type = friend; Object type
Host = dynamic; no fixed IP address, allows to connect everywhere
Dtmfmode=rfc2833 ; type of rfc used for transport
Disallow= all; desactivate all codec formats
Allow= ulaw ; activation of ulaw format, the one we will use
Context= Internal_Bureau; the context within which the user is added
You must know that the context is not mandatory if you want to add users with different contexts.
Now we will create our users:
Callerid = “John Doe” <101>
Secret = secretjd
Mailbox = email@example.com
We have a complete Asterisk Server, but the external calls are not supported yet.