• TechOps

    Need clarity?
    Chat with our experts now

    • Web Hosting SupportWeb Hosting Support
    • Helpdesk Support

      Skilled and professional 24/7 helpdesk support

    • Product Support

      Boost your product support with our expertise

    • Managed ServicesManaged Services
    • Server Management

      Don't let server issues slow you down. Let us manage them for you

    • Server Monitoring

      Safeguard your server health with our comprehensive monitoring solutions

    • Staff AugmentationStaff Augmentation
    • Hire an Admin

      Transform your business operations with our expert administrative support

    • Hire a Team

      Augment your workforce with highly skilled professional from our diverse talent pool

  • CloudOps

    Confused?
    Discuss with our sales team now.

    • Author ProfileAWS
      Well Architected Review
    • Author ProfileFinOps As a Service

      FinOps As a Service

    • Migrate

      Upgrade the journey: Migrate & Modernize seamlessly

    • Modernize

      Effortless CloudOps mastery for seamless cloud management

    • Optimize

      Efficient CloudOps: Boosting performance through optimization

    • Manage

      Simplify compliance complexities with our dedicated service

  • DevOps

    How Supportsages
    is creating an
    impact?

    View Casestudies
    • Author Profile24/7 DevOps As a Service

      Round-the-clock DevOps for uninterrupted efficiency

    • Author ProfileCI/CD Pipeline

      Automated CI/CD pipeline for seamless deployments

    • Author ProfileInfrastructure As a Code

      Crafting infrastructure with ingenious code

    • Author ProfileDevSecOps

      Integrated security in continuous DevOps practices

    • Author ProfileHire DevOps Engineers

      Level up your team with DevOps visionaries

    • Author ProfileConsulting Services

      Navigate success with expert DevOps consulting

  • SecOps

    Expert SecOps Services
    for any Scale

    • Author ProfileVAPT

      Vulnerability Assessment and Penetration Testing

    • Author ProfileSource Code Review

      Ensuring source code security and safe practices to reduce risks

    • Author ProfileSecurity Consultation

      On demand services for improving server security

    • Author ProfileSystem Hardening

      Reduced vulnerability and proactive protection

    • Author ProfileManaged SOC

      Monitors and maintains system security. Quick response on incidents

    • Author ProfileCompliance as a Service

      Regulatory compliance, reduced risk

  • Insights

    Explore our latest
    insights and resources

    Blog

    Explore our latest articles and insights

    Case Studies

    Read about our client success stories

  • Contact Us

  • About
  • Certifications
  • Life at Supportsages
  • Events
  • Contact
  • Careers
  • Blog

  • Dedicated Support Team
  • Quasi-dedicated Support Team
  • Hire a DevOps Engineer
  • Hire a Billing Support Staff
  • Per-ticket Support Plan
  • Managed Services

  • Microsoft Azure Expert
  • AWS Cloud Expert
  • Hire a developer
SS

SupportSages

Bites of wisdom @ work


Copyright © 2008 - 2026 SupportSages Pvt Ltd. All Rights Reserved.
Privacy PolicyLegal TermsData ProtectionCookie Policy

All you want to know about Asterisk – Asterisk PBX – Part 3

Scott S

  • 8 min read
All you want to know about Asterisk – Asterisk PBX – Part 3

Generating audio, please wait...

Asterisk is an OpenSource framework for building communication applications. By installing Asterisk you turn an ordinary computer into an VoIP server or communication server. An asterisk server holds the database of the users telephone number, IP address and other mapping information.

Lets learn the Asterisk server on the go with the installation and configuration procedures.

System Requirements

Hardware : Asterisk can run on all general purpose computers as well as on embedded systems. There are no strict requirements regarding memory size and the speed of the CPU.

Operating System :  The officially supported OS is LINUX with a kernel version higher than 2.6.25. But Asterisk can run on many other operating systems including Windows.

The recommended OS for Asterisk configuration/installation is Redhat based CentOS or Debian based Ubuntu.

The below are the system configuration that I use in this tutorial:

Screenshot from 2016-02-06 12:50:09

 

Asterisk Installation

Asterisk installation  can be done using two common methods

Using Ubuntu Repository

The easiest method for installing Asterisk on Ubuntu 12.04 or later is using the Ubuntu repositories. The default Ubuntu repository has the package for Asterisk. So we install it using the below commands.


root@asterisk:~# apt-get update

root@asterisk:~# apt-get upgrade

root@asterisk:~# apt-get install asterisk libpri1.4 dahdi

The DAHDI library allows Asterisk to communicate with analog/digital telephones and telephone lines, including connections to PSTN. The libpri library allows Asterisk to communicate with ISDN connections.

Note: If you are using any traditional analog telephones with VOIP and integrating with PSTN network you need to have dahdi and libpri. For the basic peer to peer SIP configuration using IP phones, the installation of asterisk package is enough.

Once the packages are installed, you can check the installation using the below command:


root@asterisk:~# asterisk -rvvv

You should get the Asterisk command line interface as shown in the screenshot below: It shows the version of Asterisk installed.

Here its Asterisk 1.8.10.1.

By default, Asterisk will be started and running after installation, so use the -r switch with asterisk command to reconnect to asterisk which is already running and -vvv represents the verbosity.

Screenshot from 2016-02-06 12:59:44

 

From Source

1) Download the Asterisk package from their official site as shown below.


root@asterisk:~# wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-<version>-current.tar.gz

Replace <version> with the Asterisk version you prefer.

2) Untar the Asterisk source file as shown below;


root@asterisk:~# tar -zxvf asterisk-&lt;version&gt;-current.tar.gz

3) Change directory to the extracted Asterisk Directory


root@asterisk:~# cd asterisk*

4) Run the Make file to compile Asterisk


root@asterisk:~# make

5) Now install the compiled Asterisk program and modules using the below command


root@asterisk:~# make install

6) Make the sample configuration files used by Asterisk using the below command


root@asterisk:~# make sample

7) Install the init scripts so that Asterisk runs when the system starts.


root@asterisk:~# make config

8) make sure that Asterisk is installed correctly using the below Asterisk init script command


root@asterisk:~# /etc/init.d/asterisk status

The output should show the status of Asterisk as Running.

Configuring Asterisk PBX.

Once Asterisk is installed, we get the main configuration file for Asterisk located at /etc/asterisk/asterisk.conf.

We are configuring Asterisk using SIP protocol. The SIP configuration file for Asterisk is located at /etc/asterisk/sip.conf.

Another configuration file located at /etc/asterisk/extensions.conf is used for configuring the database for Asterisk. The database here means the information on mapping numbers, SIP accounts and other dialing options.

First edit /etc/asterisk/sip.conf with the following entries.

====================================

[general]
transport=udp

[this_context]
type=friend
host=dynamic
context=this_context
disallow=all
allow=ulaw

[sip_name1](this_context) //SIP account 1
secret=your_pass_for_sipaccount1

[sip_name2](this_context) //SIP account 2
secret=your_pass_for_sipaccount2

========================================

The [general] options is set to use UDP as the transport protocol. All the sip accounts inherit the settings defined in the [general] section.

Then a context section is defined with a desired name, and then set the context variable under that section to that name. The type variable is friend in this tutorial. Most of the peer to peer SIP connections use friend as the type. Some other general variables are also defined.

The [sip_name1] and [sip_name2] defines two SIP account name/id’s respectively. The secret in sip section defines the respective sip account’s password. Also make sure to define the context to be used by the SIP accounts as shown in the conf.

You can choose your desired context name.

Now we edit /etc/asterisk/extensions.conf with the following entries:

===========================================

[this_context]
exten=>100,1,Dial(SIP/sip_name1)

exten=>200,1,Dial(SIP/sip_name2)

===========================================

The extensions.conf file has all the details regarding the SIP extensions. Configuring extensions.conf is also known as Dialplan Configuration.

Here, first we define that the context to be used is [this_context]. Then we use dialplan commands for further configurations. “exten” is a dialplan command to specify an extension number. The exten command format is :

exten=><extensionnumber>,<priority>,<commandoptions>(Protocol/id)

So, exten=>100,1,Dial(SIP/sip_name1) means, if the number/extension request is 100, Dial the SIP account named sip_name1 as the first priority. Similarly for extension 200, Dial the SIP account named sip_name2.

Configuring SIP Clients

For both Soft and Hard IP phones, the SIP account creation and registration is the foremost thing to accomplish. Different phones have different methods to register the SIP account.

Zoiper is one among several soft IP phones that are available for Linux OS. You can install and configure Zoiper as the SIP client with the instructions given below.

1) Download and install the Zoiper soft phone from their official website http://www.zoiper.com/en/voip-softphone/download/zoiper3

2) Run the Zoiper soft phone.

3) Click Settings and select “Create a new account”

Screenshot from 2016-02-06 18:01:47

4) Select SIP as the account type.

Screenshot from 2016-02-06 18:03:35

 

5) Enter the SIP account credentials which is already specified in the /etc/asterisk/sip.conf file.

The SIP account name and password should match the values specified in the sip.conf file. The Server IP should be the hostname or the IP address of the Asterisk server.

Screenshot from 2016-02-06 18:13:42

6) Set a desired name for the Account Name.

Screenshot from 2016-02-06 18:12:59

 

7) The new SIP account will be setup after doing above mentioned steps correctly. Then Click on settings as mentioned in step 3 and click “preferences“.

8) Click the register button to make sure that the SIP account is registered to be used with Asterisk. And you are done.

Follow the same steps and install Zoiper on an another system on the same network. But this time make sure to add the SIP account2 (sip_name2)  in the /etc/asterisk/sip.conf file.

Now you can communicate over VoIP using both the Zoiper soft IP phones. Once this is done, the Zoiper phone registered with SIP account sip_name1 will have extension 100 and the phone with SIP account registered as sip_name2 will have its extension as 200. From sip_name1 phone dial 200 to reach the other phone and vice versa.

This is the very basics of VoIP configuration, ie; you enable VoIP call between the two soft phones registered.

Similarly you can add SIP accounts in the /etc/asterisk/sip.conf file and add the corresponding extensions in /etc/asterisk/extensions.conf file. Then register soft phones with the new credentials, now all the phones are in the private branch network.This is the very basic working of a PBX running Asterisk as the PBX server.

In the next blog, we will get a little deeper and see how to use dialplan commands to build an IVR(Interactive Voice Response) menu for use in the PBX and also how to configure the Grandstream GPX1625 IP phone to be used with Asterisk.

Recommended Readings

VoIP Fundamentals

VoIP System Architecture

Asterisk IVR

Get 24/7 expert server management

  • Linux

Looking for AWS Experts?

We provide top-of-the-line custom AWS setup services tailored to your needs.

All you want to know about Asterisk – VoIP system architecture – Part 2

All you want to know about Asterisk – VoIP system architecture – Part 2
  • Howtos
  • Linux
logo

All you want to know about Asterisk – VoIP Fundamentals – Part 1

All you want to know about Asterisk – VoIP Fundamentals – Part 1
  • Howtos
  • Linux
logo

Asterisk Setup – Frequently Asked Questions and Answers

Asterisk Setup – Frequently Asked Questions and Answers
  • Linux
logo

CEPH -Part 5 – Ceph Configuration on Ubuntu

CEPH -Part 5 – Ceph Configuration on Ubuntu
  • Howtos
  • Linux
logo
All you want to know about Asterisk – Asterisk PBX – Part 3

Posts by Scott S

Scott follows his heart and enjoys design and implementation of advanced, sophisticated enterprise solutions. His never ending passion towards technological advancements, unyielding affinity to perfection and excitement in exploration of new areas, helps him to be on the top of everything he is involved with. This amateur bike stunting expert probably loves cars and bikes much more than his family. He currently spearheads the Enterprise Solutions and Infrastructure Consultancy wing of SupportSages.