Hands-on Lab - Installing Asterisk and Basic Configuration

Introduction

In this hands-on lab, you will install Asterisk and configure its basic settings to create a working telecommunication system. By the end of this lab, you will be able to:

This practical exercise will provide you with the essential skills needed to deploy and manage Asterisk in a real-world environment.

Step-by-Step Instructions

Note: This lab builds on Lecture 4 by introducing new features and configurations.

1. Advanced SIP Configuration

Add More SIP Accounts

Open the SIP configuration file:

sudo nano /etc/asterisk/sip.conf

Add the following configuration for two more extensions:

[1003]
type=friend
context=phones
host=dynamic
secret=welcome123

[1004]
type=friend
context=phones
host=dynamic
secret=welcome123

Configure Additional Extensions

Open the extensions configuration file:

sudo nano /etc/asterisk/extensions.conf

Add the following dial plan:

exten => 1003,1,Dial(SIP/1003)
exten => 1003,n,Hangup()

exten => 1004,1,Dial(SIP/1004)
exten => 1004,n,Hangup()

Reload Asterisk Configuration

Access Asterisk CLI:

sudo asterisk -r

Reload the configurations:

sip reload
dialplan reload
exit

2. Implement Voicemail

Configure Voicemail

Open the voicemail configuration file:

sudo nano /etc/asterisk/voicemail.conf

Add the following configuration:

[default]
1001 => 1234,User One,user1@yourdomain.com
1002 => 1234,User Two,user2@yourdomain.com
1003 => 1234,User Three,user3@yourdomain.com
1004 => 1234,User Four,user4@yourdomain.com

Configure Dial Plan for Voicemail

Open the extensions configuration file:

sudo nano /etc/asterisk/extensions.conf

Add the following dial plan for voicemail:

[phones]
exten => 1001,1,Dial(SIP/1001,20)
exten => 1001,n,Voicemail(1001@default,u)
exten => 1001,n,Hangup()

exten => 1002,1,Dial(SIP/1002,20)
exten => 1002,n,Voicemail(1002@default,u)
exten => 1002,n,Hangup()

exten => 1003,1,Dial(SIP/1003,20)
exten => 1003,n,Voicemail(1003@default,u)
exten => 1003,n,Hangup()

exten => 1004,1,Dial(SIP/1004,20)
exten => 1004,n,Voicemail(1004@default,u)
exten => 1004,n,Hangup()

Reload Asterisk Configuration

Access Asterisk CLI:

sudo asterisk -r

Reload the configurations:

dialplan reload
voicemail reload
exit

3. Implement Call Forwarding

Configure Call Forwarding

Open the extensions configuration file:

sudo nano /etc/asterisk/extensions.conf

Add the following dial plan for call forwarding:

[phones]
exten => 2001,1,Dial(SIP/1001,20)
exten => 2001,n,Dial(SIP/1002,20)
exten => 2001,n,Dial(SIP/1003,20)
exten => 2001,n,Dial(SIP/1004,20)
exten => 2001,n,Hangup()

Reload Asterisk Configuration

Access Asterisk CLI:

sudo asterisk -r

Reload the configurations:

dialplan reload
exit

4. Test Advanced Features

Test Voicemail

Dial `1002` from any SIP client and let it go to voicemail. Leave a voicemail message for extension 1002. Retrieve the voicemail by dialing `*97` from extension 1002 and entering the password `1234`.

Test Call Forwarding

Dial `2001` from any SIP client. Verify that the call is forwarded through extensions 1001, 1002, 1003, and 1004.

Conclusion

By following these detailed hands-on labs, you will build a comprehensive understanding of Asterisk, starting from basic installation and configuration to advanced telecommunication solutions. Each lab builds upon the previous one, ensuring a smooth learning curve and avoiding redundancy.