I will give an example of a quick installation of Asterisk on Ubuntu Server.
I will install it on versions 14.04 LTS and 16.04 LTS.
First, check if there are updates for the system and install them:
sudo apt-get update sudo apt-get upgrade
Perform the Asterisk installation:
sudo apt-get install asterisk
Install additional components:
sudo apt-get install dahdi asterisk-dahdi asterisk-mp3 asterisk-mysql asterisk-core-sounds-ru asterisk-core-sounds-ru-g722 asterisk-core-sounds-ru-gsm asterisk-dev asterisk-core-sounds-ru-wav lame
You can see whether Asterisk and its version are running with the commands:
ps aux | grep asterisk sudo netstat -tap | grep asterisk sudo netstat -na | grep 5060 sudo netstat -na | grep :5060 | wc -l asterisk -V
Connect to the Asterisk console using the command:
sudo asterisk -rvv
This is where Asterisk installation is complete, since we didn’t set up unnecessary web interfaces for management, and for advanced users and tweaking they are not needed, all settings must be made in the configuration files located in the /etc/asterisk/ directory.
In the sip.conf file in the “general” block, we will change the specified parameters for security reasons:
And restart asterisk:
sudo service asterisk restart
In case of problems, you can analyze incoming packets, for example, via tcpdump:
tcpdump -i any -vnn -s0 port 5060 tcpdump -i any -vnn -s0 port 5060 and net 192.168.1.0/24
If IPTables are used, then read my article – IPTables rules for Asterisk