Установка Asterisk 13/14 + FreePBX 13 на CentOS 7

CentOS 7 64-bit Asterisk 13, FreePBX 13 , libpri, DAHDI, Mysql (mariadb), apache2, lame, php, httpd.conf, php.ini
(актуальные исправления: 13 марта 2017 г.)

Выключение SELinux

sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config

Зависимости

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install -y kernel-devel kernel-headers
yum install -y e2fsprogs-devel  keyutils-libs-devel krb5-devel libogg \
libselinux-devel libsepol-devel libxml2-devel libtiff-devel gmp php-pear \
php php-gd php-mysql php-pdo php-mbstring ncurses-devel \
mysql-connector-odbc unixODBC unixODBC-devel \
audiofile-devel libogg-devel openssl-devel zlib-devel  \
perl-DateManip sox git wget net-tools psmisc
yum install -y gcc gcc-c++ make gnutls-devel \
libxml2-devel ncurses-devel subversion doxygen \
texinfo curl-devel net-snmp-devel neon-devel  \
uuid-devel libuuid-devel sqlite-devel sqlite \
speex-devel gsm-devel libtool libtool-ltdl libtool-ltdl-devel \
libsrtp libsrtp-devel xmlstarlet

Сделайте полный апдейт

 yum update -y

Перезагрузите компьютер

 reboot

Установка mysql (mariadb)

1: Установим mariadb (MySQL)

 yum -y install mariadb-server mariadb mariadb-devel

2: Запустим и включим автозагрузку mariadb (MySQL)

 systemctl start mariadb.service
 systemctl enable mariadb.service

3: Запустим интерактивный конфигуратор (будет предложено задать пароль пользователя root для mysql и др.)

 mysql_secure_installation

показать

показать

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n
 ... skipping.

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Установите PearDB

 pear uninstall db
 pear install db-1.7.14

SRTP

  cd /usr/src && wget http://sourceforge.net/projects/srtp/files/srtp/1.4.4/srtp-1.4.4.tgz
tar zxvf srtp-*.tgz &&
sed -i 's/RTPW\=rtpw/RTPW\=\.\/rtpw/' /usr/src/srtp/test/rtpw_test.sh &&
cd srtp && autoconf && 
./configure CFLAGS=-fPIC --prefix=/usr && 
make && 
make runtest && 
make install

Исходники

cd /usr/src &&  
wget http://sourceforge.net/projects/lame/files/lame/3.98.4/lame-3.98.4.tar.gz &&
wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz &&
wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-current.tar.gz &&
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz &&
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-14-current.tar.gz

Lame

cd /usr/src && 
tar zxvf lame-3.98.4.tar.gz && 
cd lame-3.98.4 && 
./configure && 
make && 
make install 

DAHDI & LibPRI

 yum install "kernel-devel-uname-r == $(uname -r)"
cd /usr/src && 
tar xvfz dahdi-linux-complete-current.tar.gz && 
cd dahdi-linux-complete-* && 
make all && 
make install && 
make config
cd /usr/src && 
tar xvfz libpri-*.tar.gz && 
cd /usr/src/libpri-* && 
make && 
make install

SpanDSP

cd /usr/src && wget http://soft-switch.org/downloads/spandsp/spandsp-0.0.6.tar.gz
tar zxvf spandsp-0.0.6.tar.gz && 
cd spandsp-0.0.6 && 
./configure && 
make && 
make install &&
ln -s /usr/local/lib/libspandsp.so.2 /usr/lib64/libspandsp.so.2

Pjproject

Для установки Pjproject и Asterisk 14, рекомендуется использовать Pjproject Bundled Version.
В этом случае компиляцию Pjproject из исходников можно пропустить.
Описание установки pjproject при компиляции Asterisk 14.

Компиляция Pjproject из исходников

Компиляция Pjproject из исходников

Компиляция Pjproject из исходников

 cd /usr/src && git clone https://github.com/asterisk/pjproject pjproject 
cd pjproject/ && 
./configure --libdir=/usr/lib64 --prefix=/usr --enable-shared --disable-sound --disable-resample --disable-video &&
make dep &&
make &&
make install &&
ldconfig &&
ldconfig -p | grep pj

Вывод ldconfig -p | grep pj

        libpjsua.so (libc6,x86-64) => /usr/lib/libpjsua.so
        libpjsip.so (libc6,x86-64) => /usr/lib/libpjsip.so
        libpjsip-ua.so (libc6,x86-64) => /usr/lib/libpjsip-ua.so
        libpjsip-simple.so (libc6,x86-64) => /usr/lib/libpjsip-simple.so
        libpjnath.so (libc6,x86-64) => /usr/lib/libpjnath.so
        libpjmedia.so (libc6,x86-64) => /usr/lib/libpjmedia.so
        libpjmedia-videodev.so (libc6,x86-64) => /usr/lib/libpjmedia-videodev.so
        libpjmedia-codec.so (libc6,x86-64) => /usr/lib/libpjmedia-codec.so
        libpjmedia-audiodev.so (libc6,x86-64) => /usr/lib/libpjmedia-audiodev.so
        libpjlib-util.so (libc6,x86-64) => /usr/lib/libpjlib-util.so
        libpj.so (libc6,x86-64) => /usr/lib/libpj.so

libjansson

 cd /usr/src && wget http://www.digip.org/jansson/releases/jansson-2.5.tar.gz
tar zvxf jansson-2.5.tar.gz && 
cd jansson-2.5 && 
./configure --prefix=/usr/ && 
make clean && 
make && 
make install && 
ldconfig

Новые приключения с PJSIP veryfing (asterisk 15)

При компиляции выдается ошибка, потому что файла pjproject-2.6.md5 по указанному в скрипте адресу нет.

mkdir /tmp/downloads
wget -O /tmp/downloads/pjproject-2.6.tar.bz2 http://www.pjsip.org/release/2.6/pjproject-2.6.tar.bz2
cd /tmp/downloads
md5sum pjproject-2.6.tar.bz2

Скопируйте полученное значение в файл /tmp/downloads/pjproject-2.6.md5 и запустите ./configure asterisk с ключом:

  --with-externals-cache=/tmp/downloads 

Asterisk 12/13/14

cd /usr/src && 
tar xvfz asterisk-14*.tar.gz &&
cd asterisk-14.*
./contrib/scripts/install_prereq install
./configure --libdir=/usr/lib64 --with-pjproject-bundled --with-crypto --with-ssl=ssl --with-srtp &&
contrib/scripts/get_mp3_source.sh &&
make menuselect

Asterisk 13

Asterisk 13

cd /usr/src && 
tar xvfz asterisk-13*.tar.gz &&
cd asterisk-13.* &&
./configure --libdir=/usr/lib64 --with-crypto --with-ssl=ssl --with-srtp &&
contrib/scripts/get_mp3_source.sh &&
make menuselect

Asterisk 12

Asterisk 12

cd /usr/src && 
tar xvfz asterisk-12-current.tar.gz &&
cd asterisk-12.* &&
./configure --libdir=/usr/lib64 &&
contrib/scripts/get_mp3_source.sh &&
make menuselect

После ввода команды make menuselect, вам будет предложено выбрать устанавливаемые модули. Большинство требуемых модулей выбираются автоматически. Для поддержки mp3 включите модуль 'format_mp3'

 --->  Add-ons (See README-addons.txt)  
             --- extended ---
             XXX chan_mobile
             [*] chan_ooh323
             [*] format_mp3
             [*] res_config_mysql
             --- deprecated ---
             [*] app_mysql
             [*] app_saycountpl
             [*] cdr_mysql

  ---> Core Sound Packages
            [*] CORE-SOUNDS-RU-GSM
  --->  Extras Sound Packages
            [*] EXTRA-SOUNDS-EN-GSM  
make && make install && make config && ldconfig
 sed -i 's/ASTARGS=""/ASTARGS="-U asterisk"/g'  /usr/sbin/safe_asterisk

Создайте пользователя Asterisk и задайте права пользователя.

useradd -m asterisk &&
chown asterisk.asterisk /var/run/asterisk &&
chown -R asterisk.asterisk /etc/asterisk &&
chown -R asterisk.asterisk /var/{lib,log,spool}/asterisk &&
chown -R asterisk.asterisk /usr/lib64/asterisk 

Настроим httpd (Apache)

cp /etc/php.ini /etc/php.ini_orig &&
sed -ie 's/\;date\.timezone\ \=/date\.timezone\ \=\ "Europe\/Moscow"/g' /etc/php.ini &&
sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php.ini &&
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf_orig &&
sed -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/httpd/conf/httpd.conf &&
sed -i 's/AllowOverride None/AllowOverride All/'  /etc/httpd/conf/httpd.conf &&
systemctl restart httpd &&
systemctl enable httpd

FreePBX

freepbx13

pear install Console_Getopt
cd /usr/src &&
wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-13.0-latest.tgz
tar zxvf freepbx-13.0-latest.tgz &&
cd freepbx &&
./start_asterisk start
 ./install -n

Подключимся к FreePBX

http://IP.Address.FreePBX.Server/admin

Первым делом, вам будет предложено задать имя пользователя и пароль FreePBX

freepbx start set user login

Если появится предупреждение Can Not Connected To Asterisk, а Asterisk точно запущен, закомментируйте инклюды в файле /etc/asterisk/manager.conf

;#include manager_additional.conf
;#include manager_custom.conf

Установка Asterisk

~~socialite~~

  • asterisk_install/asterisk-13_freepbx-13_centos-7.txt
  • Последние изменения: 2017/11/17