Simple VoIP setup in Ubuntu 22.04 using Asterisk

 



TABLE OF CONTENT

1. Prerequisites

2. Configuration Steps

3. Create New Configuration Files

4. Restart and Reload Asterisk

5. Configure Zoiper 5 Clients

6. Test the Setup

7. Verify Setup

8. Conclusion

 


1. Prerequisites


1. Ubuntu 22.04 installed and updated:

   

   sudo apt update && sudo apt upgrade -y

   

2. Asterisk installed:

   

   sudo apt install asterisk -y

   

3. Zoiper 5 softphone installed on client systems.

 

4. All client devices must be in the `192.168.0.0/255.255.255.0` subnet.


2. Configuration Steps

 1. Backup Existing Asterisk Configuration Files


Navigate to the Asterisk configuration directory and rename the default files:

cd /etc/asterisk

sudo mv sip.conf sip.conf.old

sudo mv extensions.conf extensions.conf.old

sudo mv voicemail.conf voicemail.conf.old

 

3. Create New Configuration Files

 

Create new files in the `/etc/asterisk` directory with the following content:

 

File Name: sip.conf

 

File Content:

 

[general]

context=internal

allowguest=no

allowoverlap=no

bindport=5060

bindaddr=0.0.0.0

srvlookup=no

disallow=all

allow=ulaw

alwaysauthreject=yes

canreinvite=no

nat=yes

session-timers=refuse

localnet=192.168.0.0/255.255.255.0

 

[7001]

type=friend

host=dynamic

secret=7001

context=internal

 

[7002]

type=friend

host=dynamic

secret=7002

context=internal


File Name: extensions.conf

 

File Content:

 

[internal]

exten => 7001,1,Answer()

exten => 7001,2,Dial(SIP/7001,60)

exten => 7001,3,Playback(vm-nobodyavail)

exten => 7001,4,VoiceMail(7001@main)

exten => 7001,5,Hangup()

 

exten => 7002,1,Answer()

exten => 7002,2,Dial(SIP/7002,60)

exten => 7002,3,Playback(vm-nobodyavail)

exten => 7002,4,VoiceMail(7002@main)

exten => 7002,5,Hangup()

 

exten => 8001,1,VoicemailMain(7001@main)

exten => 8001,2,Hangup()

 

exten => 8002,1,VoicemailMain(7002@main)

exten => 8002,2,Hangup()

 

File Name: voicemail.conf

 

File Content:

 

[main]

7001 => 7001

7002 => 7002

 To edit and save the files, use the following commands:

sudo nano /etc/asterisk/sip.conf

sudo nano /etc/asterisk/extensions.conf

sudo nano /etc/asterisk/voicemail.conf

4. Restart and Reload Asterisk 

Reload the Asterisk service to apply the new configurations:


sudo systemctl restart asterisk

sudo asterisk -rx "reload"

5. Configure Zoiper 5 Clients


On each device running Zoiper 5, configure the clients as follows:


Client 1 (Extension 7001):

 

1. Open Zoiper 5 and add a new SIP account.

2. Enter the following details:

   - Account Name: 7001

   - SIP Username: 7001

   - Password: 7001

   - Domain: `<Asterisk Server IP Address>` (e.g., `192.168.0.100`)

3. Save the configuration and ensure the client is registered.

 

Client 2 (Extension 7002):

 

1. Repeat the steps above, replacing `7001` with `7002`.


6. Test the Setup

 

1. Ensure both devices (running Zoiper 5) are connected to the same `192.168.0.0/24` subnet.

2. Use Zoiper 5 to dial the following:

   - From `7001`, dial `7002`.

   - From `7002`, dial `7001`.

3. Test voicemail functionality:

   - Dial `8001` from `7001` to access its voicemail.

   - Dial `8002` from `7002` to access its voicemail.


7. Verify Setup


Check SIP Peers:

Run the following command on the server:

 sudo asterisk -rx "sip show peers" 

Ensure both `7001` and `7002` are listed as Registered.

 

8. Conclusion

By following the detailed steps outlined in this document, you can successfully set up a VoIP system using the Asterisk server on Ubuntu 22.04. The configuration of Zoiper 5 clients allows seamless communication between two SIP devices. Additionally, the setup ensures that voicemail functionality is working correctly, and the SIP peers can register and communicate without issues.

 After completing the configuration and testing the setup, you should verify that the devices are correctly registered, and the dial plan is properly functioning. The system is now ready for use with basic VoIP functionalities, and further configurations, such as advanced call routing or security measures, can be added based on specific use cases.

 This guide provides a robust foundation for building a simple VoIP system, but there is always room for customization and further improvements.

Comments

Popular posts from this blog

VME Bus Specification And Architecture

Digital Down Conversion (DDC) Theory