📜 ⬆️ ⬇️

Easy installation of Asterisk + FreePBX for beginners

Situation


There are a lot of descriptions of IP telephony deployment on the network today and basically these are two options:

Each option has both advantages and disadvantages. If the first method implies almost zero training and makes it possible to get a result without understanding how it works, the second one on the contrary requires extensive knowledge of linux and is very difficult for beginners, although it provides high flexibility and scaling.

Prerequisites


In the process of introducing IP telephony in one of the companies with an extensive branch structure, both options were considered but both were not suitable for a number of reasons:


We faced a dilemma, on the one hand, it is easier to set up the servers and send them to the regions, and on the other hand, the entire burden of escorting such a “black box” falls on our shoulders, but we are few. In general, this situation did not suit us. The option of ordering the introduction of a third-party company was immediately flagged by management for financial reasons.
The option with a ready-made distribution package also disappeared, since the project implied the need to expand the telephony functionality to the needs of the company, taking into account the specifics of the branches, and this extension had to be carried out by local staff. That is, without learning nix systems in any way.

Decision


We decided to go the way more difficult and labor-intensive for us, but cheap for the company. Began to teach system administrators the basics of working with linux. The concept of learning is that an employee can independently take a typical linux ubutu server 12.04 distribution to install Asterisk, the FreePBX Web management and the hylafax + Avantfax web fax management system on it, while using real projects in their current states.
')
In addition, to simplify deployment, the instruction should be as simple and short as possible. In the end, it all came down to a simple copy-paste and install most packages from the repositories. The whole process was checked many times by repeated installations. We have tried to ensure the principle of minimum sufficiency. All without which you can do without skipping (left for self-development by employees).
This made the task for Win admins who were not used to the console much easier and made them feel more confident, especially when they received a working system in the minimum number of attempts. This is very encouraging in the early stages.

So the instruction itself


After installing a clean ubuntu server 12.04 LTS with this instruction, we are ready to start the installation.

For the first time, ALL actions are performed by copying - pasting without changing anything as it is!

LAMPA installation

LAMPA - (Linux, Apache, Mysql, Php, Asterisk)
apt-get update apt-get install lamp-server^ libmysqlclient18 asterisk-dev \ asterisk-mysql asterisk-moh-opsound-wav php-db selinux-utils audiofile-tools \ bison libset-intspan-perl curl openssl php5-gd lame sox libxml2 subversion \ dahdi-* linux-headers-`uname -r` 

During the installation process, the wizard will ask you to set a password for the mysql server. We set for example PaSs or ours and remember. Empty password is not necessary to leave!

Freepbx


Specify the password that you installed when installing mysql
 passwd=PaSs #     fpbxver=2.10 


Download and create database

 svn co http://svn.freepbx.org/freepbx/branches/$fpbxver /usr/src/freepbx cd /usr/src/freepbx mysqladmin create asterisk -p${passwd} mysqladmin create asteriskcdrdb -p${passwd} mysql asterisk < SQL/newinstall.sql -p${passwd} mysql asteriskcdrdb < SQL/cdr_mysql_table.sql -p${passwd} echo "GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY '${passwd}';" > /tmp/tmpfbpx echo "GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY '${passwd}';" >> /tmp/tmpfbpx echo "flush privileges;" >> /tmp/tmpfbpx echo "quit" >> /tmp/tmpfbpx mysql -p${passwd} < /tmp/tmpfbpx 


Install FREEPBX

Run the installation (fill in the parameters or leave the default):
 rm /var/www/index.html ./install_amp --password=${passwd} --webroot=/var/www 

Confirm the parameters
 adduser www-data asterisk /etc/init.d/apache2 restart wget http://127.0.0.1/admin/config.php# -O /dev/null 


WEB server preparation

Changing the configuration of apache2, for correct work with the Russian language, as well as changing the user www-data on behalf of which apache2 starts on the user asterisk
 locale-gen ru_RU perl -pi -e 's/#AddDefaultCharset UTF-8/AddDefaultCharset UTF-8/g' /etc/apache2/conf.d/charset perl -pi -e 's/export APACHE_RUN_USER=www-data/export APACHE_RUN_USER=asterisk/g' /etc/apache2/envvars perl -pi -e 's/export APACHE_RUN_GROUP=www-data/export APACHE_RUN_GROUP=asterisk/g' /etc/apache2/envvars /etc/init.d/apache2 restart 

Download modules and updates

Download and install fresh modules.
 ./setup_svn.php ./install_amp cp amp_conf/moh/*.wav /var/lib/asterisk/moh cd /etc/asterisk rm ccss.conf extensions.conf logger.conf iax.conf sip.conf features.conf sip_notify.conf chan_dahdi.conf chown asterisk:asterisk /etc/amportal.conf 


At this basic functionality is ready, you can connect to the server by
login and password: admin

Some additions and fixes

A small tweak for stable operation of the FOP panel, restarts it every 10 minutes
 chmod 770 -R /var/www/admin/modules/fw_fop echo "*/10 * * * * root amportal 2 > /dev/null">>/etc/crontab 

We fix shoals with ways to store sounds
 cp -r /var/lib/asterisk/sounds/ /usr/share/asterisk/ rm -r /var/lib/asterisk/sounds/ ln -s /usr/share/asterisk/sounds /var/lib/asterisk/ chown -R asterisk:asterisk /var/lib/asterisk/sounds/ chown -R asterisk:asterisk /var/lib/asterisk/sounds/custom/ 


Russification of voice
 paths=/usr/share/asterisk/sounds/ cd /tmp wget -c http://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-ru-wav-current.tar.gz mkdir $paths/ru cd $paths/ru tar zxvf /tmp/asterisk-core-sounds-ru-wav-current.tar.gz 


At this stage, the base system is considered to be deployed, then the configuration via the WEB interface is already underway.

Link to the wiki with instructions

Source: https://habr.com/ru/post/171163/


All Articles