Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the rank-math domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/u763016847/domains/golinuxhub.com/public_html/wp-includes/functions.php on line 6114
Installing and Configuring Asterisk CLI - GoLinuxHub

Installing and Configuring Asterisk CLI

Asterisk is a software implementation of a telephone private branch exchange (PBX); it was created in 1999 by Mark Spencer of Digium. Like any PBX, it allows attached telephones to make calls to one another, and to connect to other telephone services, such as the Public Switched Telephone Network (PSTN) and Voice over Internet Protocol (VoIP) services. Its name comes from the asterisk symbol, *.

Here I am going to show you the most basic configuration of Asterisk to give you a clear picture of what and How Asterisk works

Download Asterisk from their Official website

Download Asterisk all versions

# wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-1.8-current.tar.gz
# tar -xzf asterisk-1.8-current.tar.gz
# cd asterisk-1.8.20.1

NOTE: Make sure you have gcc compiler pre installed in your system before moving towards next step

# ./configure
.$$$$$$$$$$$$$$$=..
.$7$7..          .7$$7:.
.$$:.                 ,$7.7
.$7.     7$$$$           .$$77
..$$.       $$$$$            .$$$7
..7$   .?.   $$$$$   .?.       7$$$.
$.$.   .$$$7. $$$$7 .7$$$.      .$$$.
.777.   .$$$$$$77$$$77$$$$$7.      $$$,
$$$~      .7$$$$$$$$$$$$$7.       .$$$.
.$$7          .7$$$$$$$7:          ?$$$.
$$$          ?7$$$$$$$$$$I        .$$$7
$$$       .7$$$$$$$$$$$$$$$$      :$$$.
$$$       $$$$$$7$$$$$$$$$$$$    .$$$.
$$$        $$$   7$$$7  .$$$    .$$$.
$$$$             $$$$7         .$$$.
7$$$7            7$$$$        7$$$
$$$$$                        $$$
$$$$7.                       $$  (TM)
$$$$$$$.           .7$$$$$$  $$
$$$$$$$$$$$$7$$$$$$$$$.$$$$$$
$$$$$$$$$$$$$$$$.
configure: Package configured for:
configure: OS type  : linux-gnu
configure: Host CPU : i686
configure: build-cpu:vendor:os: i686 : pc : linux-gnu :
configure: host-cpu:vendor:os: i686 : pc : linux-gnu :

Once the configure step is completed successfully you will see the above output on the screen

# make
# make install
# make samples

Once all the above steps are completed successfully it is time to start the asterisk services

# asterisk -vvvc
Asterisk Ready.
*CLI>

Now let us configure some local extensions to verify extension-extension calling

*CLI> !

Using ! (exclamation mark) will take you out of the asterisk CLI prompt but the service will be running in the background)
 

Configuring Asterisk SIP Account

Navigate inside /etc/asterisk

# cd /etc/asterisk

Take a backup of the original sip file and create a new one with the following details

# mv sip.conf sip.conf.orig
# vi sip.conf
[general]
port=5060
bindaddr=0.0.0.0
[1000]
type=friend
host=dynamic
secret=1000
[1001]
type=friend
host=dynamic
secret=1001

Now let me explain you the above used syntax

  • port - This is the port number which Asterisk uses to communicate
  • bindaddr - All the client IP range the server will listen to
  • type - type of connection (peer — outcoming calls only, user — incoming calls, friend — both incoming and outcoming calls)
  • host - Hostname of the phone (Dynamic Host name)
  • secret - Passsword used for authentication user

 

Configuring Extension Dial Plan

# mv extensions.conf extesnions.conf.orig
# vi extensions.conf
[general]
static=yes
writeprotect=no
priorityjumping=no
autofallthrough=yes
clearglobalvars=no
[default]
exten => 1000,1,Dial(SIP/1000,10)
exten => 1001,1,Dial(SIP/1001,10)

The above shown dial plan is one of the most basic which means that is a user dials 1000 from his extension using SIP Phone it will go to 1000 Extension and if the phone is not picked up till 10 seconds then the call will hangup. The same will happen for extension 1001
Now we are done with the initial configuration of Asterisk to verify internal calls. Restart the asterisk services
To connect to asterisk CLI

# asterisk -r
server*CLI>reload

This will reload all the configuration files of asterisk
 

Configure softphones

Let us configure two softphones for verifying the calls
For this demo purpose I will be using X-Lite and QuteCom
You can download the same from the following locations
X-Lite
Download X-Lite
QuteCom
Download QuteCom
Once the software are downloaded and installed follow the below screenshots to configure your softphone
 

Configuring Extension 1000 on QuteCom


Use your server IP at the place for SIP Domain For example: 192.168.0.xx

Configuring Extension 1001 on X-Lite


Now when both the Softphones are configure try to make calls between each other
Calling from 1001 to 1000


So you can pick the call on the other side and start talking.
Now this was the most basic configuration of Asterisk but it can get very vast and complex moving more and more ahead.