Linux Căn Bản Linux Nâng Cao Tutorial

Hướng dẫn cài đặt Asterisk VoIP trên Ubuntu 22

Asterisk

Setting up a VoIP server can be a daunting task, but with Asterisk on Ubuntu 22, you can create a robust and scalable communication system. Asterisk is a powerful open-source software that enables you to develop a variety of communication applications. In this guide, we’ll walk through the steps to install and configure an Asterisk VoIP server on Ubuntu 22, ensuring you have a fully operational setup by the end.

Prerequisites

  • An Ubuntu 22 server
  • Root or sudo privileges
  • Basic knowledge of Linux commands and the terminal
  • Internet connection

Installing Dependencies

Before installing Asterisk, you need to update your package lists and install the necessary dependencies. Open your terminal and execute the following commands:

sudo apt update
sudo apt upgrade
sudo apt install -y wget build-essential subversion

Downloading and Installing Asterisk

With the dependencies in place, you can now download and compile Asterisk:

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

Change into the extracted directory and install additional required packages:

cd asterisk-18*
sudo contrib/scripts/install_prereq install

Now, proceed to compile and install Asterisk:

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

With Asterisk installed, you can now set up its user and group permissions:

sudo adduser --system --group --no-create-home asterisk
sudo chown -R asterisk:asterisk /etc/asterisk
sudo chown -R asterisk:asterisk /var/{lib,log,spool}/asterisk
sudo chown -R asterisk:asterisk /usr/lib/asterisk

Configuring Asterisk

Editing the main configuration file is the next step. Open it using your favorite text editor:

sudo nano /etc/asterisk/asterisk.conf

Make the necessary changes according to your setup, then start and enable Asterisk at boot:

sudo systemctl start asterisk
sudo systemctl enable asterisk

Ensure that Asterisk is running without issues:

sudo asterisk -vvvr

Setting Up SIP Accounts

To handle VoIP calls, you need to set up SIP accounts. Edit the sip.conf and extensions.conf files:

sudo nano /etc/asterisk/sip.conf
sudo nano /etc/asterisk/extensions.conf

Add your SIP users in sip.conf and dial plan in extensions.conf.

Testing the VoIP Server

Finally, connect a SIP client to your server using the credentials you created and test making and receiving calls.

Conclusion

Setting up an Asterisk VoIP server on Ubuntu 22 is a straightforward process if you follow the steps carefully. With Asterisk, you’re now equipped with a flexible and powerful communication tool that can be scaled and customized to fit your needs.

https://forum.congdonglinux.com

Add Comment

Click here to post a comment