Установка Asterisk12 + FreePBX 12 на CentOS 6


Выключение SELinux

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

Исходники

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-1.4.15.tar.gz &&
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-12-current.tar.gz

Зависимости

      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 kernel-devel ncurses-devel \
      audiofile-devel libogg-devel openssl-devel mysql-devel mysql-server zlib-devel \
      perl-DateManip sox
srtp srtp-devel gmime gmime-devel
     yum install -y gcc-c++ make gnutls-devel kernel-devel libxml2-devel ncurses-devel \
     subversion doxygen texinfo curl-devel net-snmp-devel neon-devel \
     uuid-devel libuuid-devel sqlite-devel sqlite git speex-devel gsm-devel \
     unixODBC unixODBC-devel mysql-connector-odbc libtool-ltdl libtool-ltdl-devel

SRTP

 wget http://srtp.sourceforge.net/srtp-1.4.2.tgz
tar zxvf srtp-1.4.2.tgz 
cd srtp 
autoconf
./configure CFLAGS=-fPIC --prefix=/usr
make && make runtest  && make install
cd ..

Pjproject

 git clone git://github.com/asterisk/pjproject pjproject
cd pjproject/ 
./configure --libdir=/usr/lib64 --prefix=/usr --enable-shared --disable-sound --disable-resample --disable-video --disable-opencore-amr 
make dep && make && make install
ldconfig 
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

 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

Lame

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

DAHDI

   tar zxvf dahdi-linux-complete-current.tar.gz
   cd dahdi-linux-complete-*
   make all && make install && make config
   cd ..

Libpri

tar zxvf libpri-1.4.15.tar.gz 
cd libpri-1.4.15 
make && make install
ldconfig
ldconfig -p | grep libpri
        libpri.so.1.4 (libc6,x86-64) => /usr/lib/libpri.so.1.4
        libpri.so.1.4 (libc6,x86-64) => /usr/lib64/libpri.so.1.4
        libpri.so (libc6,x86-64) => /usr/lib/libpri.so
 cd ..

SpanDSP

 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

для 64 битной системы:

 
 ln -s /usr/local/lib/libspandsp.so.2 /usr/lib64/libspandsp.so.2
 
 cd ..

Asterisk 12

tar zvxf asterisk-12-current.tar.gz

cd asterisk-<version>/

useradd -d /home/asterisk  asterisk

 mkdir /var/run/asterisk

 mkdir /var/log/asterisk

chown -R asterisk:asterisk /var/run/asterisk

chown -R asterisk:asterisk /var/log/asterisk

chown -R asterisk:asterisk /var/lib/php/session/

nano +242 /etc/httpd/conf/httpd.conf

  User asterisk
  Group asterisk

nano +338 /etc/httpd/conf/httpd.conf

   AllowOverride  All

contrib/scripts/get_mp3_source.sh
 ./configure --libdir=/usr/lib64
  make menuselect
PjSIP Resource Modules

Resource Modules

                                    
          [*] res_pjsip
          [*] res_pjsip_acl
          [*] res_pjsip_authenticator_digest
          [*] res_pjsip_caller_id
          [*] res_pjsip_diversion
          [*] res_pjsip_dtmf_info
          [*] res_pjsip_endpoint_identifier_anonymous
          [*] res_pjsip_endpoint_identifier_ip
          [*] res_pjsip_endpoint_identifier_user
          [*] res_pjsip_exten_state
          [*] res_pjsip_header_funcs
          [*] res_pjsip_log_forwarder
          [*] res_pjsip_logger
          [*] res_pjsip_messaging
          [*] res_pjsip_mwi
          [*] res_pjsip_mwi_body_generator
          [*] res_pjsip_nat
          [*] res_pjsip_notify
          [*] res_pjsip_one_touch_record_info
          [*] res_pjsip_outbound_authenticator_digest
          [*] res_pjsip_outbound_registration
          [*] res_pjsip_path
          [*] res_pjsip_pidf_body_generator
          [*] res_pjsip_pidf_eyebeam_body_supplement
          [*] res_pjsip_pubsub
          [*] res_pjsip_refer
          [*] res_pjsip_registrar
 make
 make install
 make config

 

nano +112 /usr/sbin/safe_asterisk

     
 ASTARGS="-U asterisk"
 cp /usr/src/asterisk-<version>/configs/asterisk.conf.sample /etc/asterisk/asterisk.conf

или

cp  /usr/src/asterisk-13.*/configs/samples/asterisk.conf.sample  /etc/asterisk/asterisk.conf

nano +3 /etc/asterisk/asterisk.conf

 astmoddir => /usr/lib64/asterisk/modules

FreePBX12

 
 wget http://mirror.freepbx.org/freepbx-12.0.3.tgz
 
 tar zxvf freepbx-12.0.3.tgz
cd /usr/src/freepbx

/etc/init.d/mysqld start

mysqladmin create asterisk
mysqladmin create asteriskcdrdb
mysql asterisk < SQL/newinstall.sql
mysql asteriskcdrdb < SQL/cdr_mysql_table.sql

mysql
GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'SOMEPASSWORD';
GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'SOMEPASSWORD';
flush privileges;
\q

mysqladmin -u root password 'SOMEPASSWORD'
cd /usr/src/freepbx
./start_asterisk start

#php53
nano +946 /etc/php.ini
     date.timezone = "Europe/Moscow"
pear uninstall db
pear install db-1.7.14
yum  install php-posix
 ./install_amp --username=asteriskuser --password=SOMEPASSWORD
error
 PHP Warning:  mkdir(): File exists in /usr/src/freepbx/libfreepbx.install.php on line 199

Запустите установку ещё раз

amportal a ma refreshsignatures
amportal a ma  upgradeall
amportal reload
amportal chown

или

/usr/local/sbin/amportal  ...
 echo "/usr/local/sbin/amportal start" >> /etc/rc.local

Установим коммерческий репозиторий FreePBX

  wget -P /etc/yum.repos.d/ -N http://yum.schmoozecom.net/schmooze-commercial/schmooze-commercial.repo

Установим требуемые пакеты

yum -y install php-5.3-zend-guard-loader sysadmin fail2ban incron ImageMagick
service httpd restart
service asterisk restart
chkconfig httpd on
chkconfig mysqld on
chkconfig asterisk on

Входите в веб-интерфейс FreePBX и устанавливайте недостающие модули.

Ещё один момент. Если надо писать разговоры и чтоб было видно всё через вебку, то надо ставить asterisk-addon отсюда http://downloads.asterisk.org/pub/telephony/asterisk/releases/

нужно поставить cdr_addon_mysql

перед make не забудем делать make menuselect

полученные модули у меня не скопировались в нужную папку, пришлось руками скопировать