Hands-on Lab - Setting Up a Basic VoIP Environment

Introduction

Setting up a basic VoIP environment is an essential step in understanding how VoIP technology works and how it can be leveraged for modern communication systems. This hands-on lab will guide you through the process of installing and configuring Asterisk, creating SIP accounts, and testing your setup to ensure it operates correctly.

Step 1: Installing Asterisk

Update System Packages

Ensure your system is up to date by running the following commands:

sudo apt-get update
sudo apt-get upgrade

Install Dependencies

Install necessary dependencies for Asterisk:

sudo apt-get install -y build-essential libncurses5-dev libssl-dev libxml2-dev libsqlite3-dev uuid-dev libjansson-dev libedit-dev

Download Asterisk

Download the latest version of Asterisk from the official website:

cd /usr/src
sudo wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-18-current.tar.gz
sudo tar -zxvf asterisk-18-current.tar.gz
cd asterisk-18.*

Compile and Install Asterisk

Compile and install Asterisk using the following commands:

sudo ./configure
sudo make
sudo make install
sudo make samples
sudo make config

Start Asterisk

Start the Asterisk service and enable it to start on boot:

sudo systemctl start asterisk
sudo systemctl enable asterisk

Verify Installation

Verify that Asterisk is running correctly:

sudo asterisk -rvvv

Step 2: Configuring Asterisk

Edit sip.conf

Configure SIP accounts by editing the sip.conf file:

sudo nano /etc/asterisk/sip.conf

Add the following configuration for two SIP accounts:

[general]
context=default
bindport=5060
bindaddr=0.0.0.0
allow=ulaw

[1001]
type=friend
host=dynamic
secret=welcome1
context=default

[1002]
type=friend
host=dynamic
secret=welcome2
context=default

Edit extensions.conf

Configure dial plan by editing the extensions.conf file:

sudo nano /etc/asterisk/extensions.conf

Add the following configuration:

[default]
exten => 1001,1,Dial(SIP/1001)
exten => 1002,1,Dial(SIP/1002)

Reload Asterisk Configuration

Reload the Asterisk configuration to apply the changes:

sudo asterisk -rx "reload"

Step 3: Testing the VoIP Setup

Install a SIP Client

Install a SIP client on your computer or mobile device (e.g., Zoiper, X-Lite).

Configure SIP Client

Configure the SIP client with the following settings:

Register and Test Call

Register the SIP client and test calling between the two SIP accounts (1001 and 1002) to ensure the setup is functioning correctly.

Conclusion

Setting up a basic VoIP environment with Asterisk provides a hands-on understanding of VoIP technology and its practical applications. By following this lab, you have learned how to install and configure Asterisk, create SIP accounts, and test your VoIP setup. This foundational knowledge will be crucial as you move forward with more advanced configurations and implementations using Asterisk.