rocket.chat Debian

Debian 11
Asterisk 18
sudo apt -y install git vim curl wget libnewt-dev libssl-dev \
libncurses5-dev subversion software-properties-common \
libsqlite3-dev build-essential libjansson-dev libxml2-dev uuid-dev
cd /usr/src/ && sudo wget https://downloads.asterisk.org/pub/telephony/asterisk/asterisk-18-current.tar.gz && \
sudo tar xvf asterisk-18-current.tar.gz && cd asterisk-18*/ && sudo contrib/scripts/get_mp3_source.sh
sudo contrib/scripts/install_prereq install

вводим код страны 7

sudo ./configure
sudo make menuselect

В меню выбираем следующие параметры

Add-ons (See README-addons.txt)
	[*] chan_ooh323 
	[*] format_mp3
Core Sound Packages
	[*] CORE-SOUNDS-RU-WAV      
	[*] CORE-SOUNDS-RU-ULAW     
	[*] CORE-SOUNDS-RU-ALAW     
	[*] CORE-SOUNDS-RU-GSM      
	[*] CORE-SOUNDS-RU-G729     
	[*] CORE-SOUNDS-RU-G722     
	[*] CORE-SOUNDS-RU-SLN16    
	[*] CORE-SOUNDS-RU-SIREN7   
	[*] CORE-SOUNDS-RU-SIREN14
Music On Hold File Packages
	[*] MOH-OPSOUND-WAV  
	[*] MOH-OPSOUND-ULAW 
	[*] MOH-OPSOUND-ALAW 
	[*] MOH-OPSOUND-GSM
Extras Sound Packages
	[*] EXTRA-SOUNDS-EN-WAV
	[*] EXTRA-SOUNDS-EN-ULAW
	[*] EXTRA-SOUNDS-EN-ALAW
	[*] EXTRA-SOUNDS-EN-GSM
Applications - добавить
	[*] app_macro

Save & Exit
sudo make

По завершении должны получить:

	+--------- Asterisk Build Complete ---------+
	+ Asterisk has successfully been built, and +
	+ can be installed by running:              +
	+                                           +
	+                make install               +
	+-------------------------------------------+
sudo make install

По завершении должны получить:

 +---- Asterisk Installation Complete -------+
 +                                           +
 +    YOU MUST READ THE SECURITY DOCUMENT    +
 +                                           +
 + Asterisk has successfully been installed. +
 + If you would like to install the sample   +
 + configuration files (overwriting any      +
 + existing config files), run:              +
 +                                           +
 + For generic reference documentation:      +
 +    make samples                           +
 +                                           +
 + For a sample basic PBX:                   +
 +    make basic-pbx                         +
 +                                           +
 +                                           +
 +-----------------  or ---------------------+
 +                                           +
 + You can go ahead and install the asterisk +
 + program documentation now or later run:   +
 +                                           +
 +               make progdocs               +
 +                                           +
 + **Note** This requires that you have      +
 + doxygen installed on your local system    +
 +-------------------------------------------+
sudo make samples && \
sudo make config && \
sudo ldconfig

Создаем пользователя Asterisk и запускаем

sudo groupadd asterisk && \
sudo useradd -r -d /var/lib/asterisk -g asterisk asterisk && \
sudo usermod -aG audio,dialout 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
sudo sed -i 's/#AST_USER="asterisk"/AST_USER="asterisk"/' /etc/default/asterisk && \
sudo sed -i 's/#AST_GROUP="asterisk"/AST_GROUP="asterisk"/' /etc/default/asterisk && \
sudo sed -i 's/;runuser = asterisk/runuser = asterisk/' /etc/asterisk/asterisk.conf && \
sudo sed -i 's/;rungroup = asterisk/rungroup = asterisk/' /etc/asterisk/asterisk.conf
sudo systemctl restart asterisk && sudo systemctl enable asterisk && sudo systemctl status asterisk

Проверяем доступность

sudo asterisk -rv

Открываем необходимые порты tcp 5060,5061.

MariaDB
sudo apt -y install mariadb-server mariadb-client && \
sudo systemctl start mariadb && \
sudo systemctl enable mariadb && \
sudo mysql_secure_installation

root SQL password - СЛОЖНЫЙ ПАРОЛЬ_РУТА - генерируем и записываем.

Node.JS
sudo apt install -y curl dirmngr apt-transport-https lsb-release ca-certificates && \
sudo curl -sL https://deb.nodesource.com/setup_14.x | sudo bash && \
sudo apt update && sudo apt -y install gcc g++ make && sudo apt -y install nodejs
Apache2
sudo apt -y install apache2 && \
sudo cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf_orig && \
sudo sed -i 's/export APACHE_RUN_USER=www-data/export APACHE_RUN_USER=asterisk/' /etc/apache2/envvars && \
sudo sed -i 's/export APACHE_RUN_GROUP=www-data/export APACHE_RUN_GROUP=asterisk/' /etc/apache2/envvars && \
sudo sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf && \
sudo rm -f /var/www/html/index.html && \
sudo unlink  /etc/apache2/sites-enabled/000-default.conf
PHP 7.4
sudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2 && \
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list && \
wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add - && \
sudo apt remove php* && sudo apt install -y php7.4-{mysql,cli,common,imap,ldap,xml,fpm,curl,mbstring,zip,gd,gettext,xml,json} libapache2-mod-php7.4 && \
sudo sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php/7.4/apache2/php.ini && \
sudo sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php/7.4/cli/php.ini && \
sudo sed -i 's/\(^memory_limit = \).*/\1256M/' /etc/php/7.4/apache2/php.ini && \
sudo apt install -y sox mpg123 lame ffmpeg sqlite3 git unixodbc dirmngr postfix  odbc-mariadb pkg-config libicu-dev
Настраиваем ODBC
sudo tee /etc/odbcinst.ini<<EOF
[MySQL]
Description = ODBC for MySQL (MariaDB)
Driver = /usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so
FileUsage = 1
EOF
sudo tee /etc/odbc.ini<<EOF
[MySQL-asteriskcdrdb]
Description = MySQL connection to 'asteriskcdrdb' database
Driver = MySQL
Server = localhost
Database = asteriskcdrdb
Port = 3306
Socket = /var/run/mysqld/mysqld.sock
Option = 3
EOF
FreePBX 16
cd /usr/src && sudo wget http://mirror.freepbx.org/modules/packages/freepbx/7.4/freepbx-16.0-latest.tgz && \
sudo tar xfz freepbx-16.0-latest.tgz && sudo rm -f freepbx-16.0-latest.tgz && \
cd freepbx && sudo systemctl stop asterisk && sudo ./start_asterisk start

Подключаемся к БД и настраиваем (вставляем записанный ранее пароль)

sudo ./install -n --dbuser root --dbpass "СЛОЖНЫЙ ПАРОЛЬ_РУТА"
sudo tee /etc/systemd/system/freepbx.service<<EOF
[Unit]
Description=FreePBX VoIP Server
After=mariadb.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/fwconsole start -q
ExecStop=/usr/sbin/fwconsole stop -q
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload && sudo systemctl enable freepbx
sudo fwconsole ma disablerepo commercial && \
sudo fwconsole ma installall && \
sudo fwconsole ma delete firewall && \
sudo fwconsole reload && \
sudo fwconsole restart && \
sudo a2enmod rewrite && \
sudo systemctl restart apache2

Если нет записей в CDR-reports, то выполняем следующие команды:

cd /tmp && wget https://wiki.freepbx.org/download/attachments/202375584/libssl1.0.2_1.0.2u-1_deb9u4_amd64.deb && \
wget https://wiki.freepbx.org/download/attachments/122487323/mariadb-connector-odbc_3.0.7-1_amd64.deb && \
sudo dpkg -i libssl1.0.2_1.0.2u-1_deb9u4_amd64.deb && sudo dpkg -i mariadb-connector-odbc_3.0.7-1_amd64.deb && \
sudo apt install -f && ln -s /usr/local/lib/libmaodbc.so /usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so

IT-Admins. 2020