반응형

CentOS 7.8 + Asterisk 12.8 + FreePBX 12

  • Asterisk 이전 버전 설치가 필요해서 정리해두었다..

Update system

yum -y update

SELINUX disabled

  • roboot 필수

    SELINUX=disabled
    reboot

Install packages

yum -y install net-tools wget 

Mariadb

yum install mariadb-server
systemctl enable mariadb
systemctl start mariadb
/usr/bin/mysql_secure_installation

Output:

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] Y
New password:
Re-enter new password:
Sorry, passwords do not match.

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]
 ... 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]
 ... Success!

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]
 - 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]
 ... 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!

Apache

yum -y install httpd php php-pear php-mysql php-process php-mbstring
systemctl enable httpd
useradd -c "Asterisk PBX" -d /var/lib/asterisk asterisk
  • Apache User, Group 변경

  • vi /etc/httpd/conf/httpd.conf User asterisk Group asterisk

  • <Directory "var/www/html"> 수정

  • AllowOverride All Options FollowSymLinks

  • timezone

    chgrp -R asterisk /var/lib/php/session/
    systemctl start httpd
  • vi /etc/php.ini date.timezone = "Asia/Seoul"

  • firewall-cmd 사용하는 경우에만

  • firewall-cmd --permanent --zone=public --add-service=http firewall-cmd --zone=public --add-service=http

Asterisk

yum install wget curl bison perl perl-CPAN openssl-devel kernel-devel audiofile-devel sox svn gcc-c++ make ncurses-devel libxml2-devel mysql-devel sqlite-devel libuuid-devel jansson-devel -y
yum install unixODBC unixODBC-devel libtool-ltdl libtool-ltdl-devel -y
yum install mysql-connector-odbc -y
cd /usr/local/src/
  • downloads 파일이 없을경우 oldRelease에서 확인

    wget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-12.8.0.tar.gz
    tar -xvzf asterisk-12.8.0.tar.gz
    cd asterisk-12.8.0/
    contrib/scripts/get_mp3_source.sh
    ./configure --libdir=/usr/lib64
  • Add-ons format_mp3 만 선택

  • 선택은 Enter

  • 나가기는 ESC

  • 나갈 때 저장은 Y

    make menuselect
    make
    make install
    chown -R asterisk:asterisk /var/run/asterisk
    chown -R asterisk:asterisk /var/log/asterisk
    chown -R asterisk:asterisk /var/lib/asterisk
    chown -R asterisk:asterisk /var/spool/asterisk
    chown -R asterisk:asterisk /etc/asterisk

FreePBX

pear install db-1.7.14 unzip
  • Install lame

  • cd /usr/local/src wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz tar -xvzf lame-3.99.5.tar.gz cd lame-3.99.5 ./configure make make install

  • FreePBX source

    mysqladmin -u root -p create asteriskcdrdb
    mysql -u root -p asteriskcdrdb < SQL/cdr_mysql_table.sql
    mysqladmin -u root -p create asterisk
    mysql -u root -p asterisk < SQL/newinstall.sql
  • cd /usr/local/src wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-12.0-latest.tgz tar -xvzf freepbx-12.0-latest.tgz cd freepbx

  • 권한 생성 후 mysql -u asteriskuser -p 접속 확인

  • mysql -u root -pmy GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'YOUR-PASSWORD'; GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost; flush privileges;

  • Start Asterisk

    vi libfreepbx.install.php
    199 line:     
    $ret=mkdir($directory, $modenum, $recursive); 

    to

    ./install_amp

    output:

    Checking for PEAR DB..OK
    Checking for PEAR Console::Getopt..OK
    Checking user..OK
    Checking if Asterisk is running..running with PID: 46287..OK
    Checking for /etc/amportal.conf../etc/amportal.conf does not exist, copying default
    Creating new /etc/amportal.conf
    Enter your USERNAME to connect to the 'asterisk' database:
    [asteriskuser]
    Enter your PASSWORD to connect to the 'asterisk' database:
    [amp109] znjsxja1234
    Enter the hostname of the 'asterisk' database:
    [localhost]
    Enter a USERNAME to connect to the Asterisk Manager interface:
    [admin]
    Enter a PASSWORD to connect to the Asterisk Manager interface:
    [amp111]
    Enter the path to use for your AMP web root:
    [/var/www/html]
    
    Created /var/www/html
    Enter the IP ADDRESS or hostname used to access the AMP web-admin:
    [192.168.1.1]
    Use simple Extensions [extensions] admin or separate Devices and Users [deviceanduser]?
    [extensions]
    Enter directory in which to store AMP executable scripts:
    [/var/lib/asterisk/bin]
    
    Created /var/lib/asterisk/bin
    Enter directory in which to store super-user scripts:
    [/usr/local/sbin]
    
    /etc/amportal.conf writtenAssuming new install, --install-moh added to command line
    OK
    Reading /etc/amportal.conf..parsed amp_conf variables from /etc/amportal.conf:
    amp_conf [AMPDBHOST] => [localhost]
    amp_conf [AMPDBENGINE] => [mysql]
    amp_conf [AMPENGINE] => [asterisk]
    amp_conf [AMPMGRUSER] => [admin]
    amp_conf [AMPMGRPASS] => [amp111]
    amp_conf [AMPBIN] => [/var/lib/asterisk/bin]
    amp_conf [AMPSBIN] => [/usr/local/sbin]
    amp_conf [AMPWEBROOT] => [/var/www/html]
    amp_conf [AMPCGIBIN] => [/var/www/cgi-bin ]
    amp_conf [FOPWEBROOT] => [/var/www/html/panel]
    amp_conf [FOPPASSWORD] => [passw0rd]
    amp_conf [AUTHTYPE] => [database]
    amp_conf [AMPEXTENSIONS] => [extensions]
    amp_conf [AMPDBUSER] => [asteriskuser]
    amp_conf [AMPDBPASS] => [znjsxja1234]
    amp_conf [AMPWEBADDRESS] => [192.168.1.1]
    amp_conf [AMPDBNAME] => [asterisk]
    OK
    Checking for /etc/asterisk/asterisk.conf../etc/asterisk/asterisk.conf does not exist, copying default
    Detected lib64 based system, adjusting asterisk.conf
    OK
    Reading /etc/asterisk/asterisk.conf..OK
    Using asterisk as PBX Engine
    Checking for Asterisk version..12.8.0
    Checking for selinux..OK
    Connecting to database..OK
    Checking current version of FreePBX..2.11.0rc1
    Installing new FreePBX files..OK (1132 files copied, 0 skipped)
    amportal..no fpbx..freepbx_engine..freepbx_setting..gen_amp_conf.php..done
    apply username/password changes to conf files:
    running apply_conf.sh from /etc/amportal.conf
          Reading /etc/amportal.conf
          Updating configuration...
          /etc/asterisk/cdr_mysql.conf user: [asteriskuser] password: [znjsxja1234] hostname: [localhost]
          /etc/asterisk/manager.conf user: [admin] secret: [amp111]
          Adjusting File Permissions..
          SETTING FILE PERMISSIONS.............Done
          Removing any dangling symlinks
          Dangling symlinks removed
    Done
    done with apply_conf.sh
    creating missing #include files..OK
    Module 'manager' reloaded successfully.
    Setting permissions on files..OK
    Loading Bootstrap..OK
    Checking for upgrades..8 found
    Upgrading to 2.11.0..
    -> Running PHP script /usr/local/src/freepbx/upgrades/2.11.0/migration.php
    Upgrading to 2.11.0..OK
    Upgrading to 12.0.1alpha16..
    -> Running PHP script /usr/local/src/freepbx/upgrades/12.0.1alpha16/upgrade.php
    Upgrading to 12.0.1alpha16..OK
    Upgrading to 12.0.1alpha31..
    -> Running PHP script /usr/local/src/freepbx/upgrades/12.0.1alpha31/upgrade.php
    Upgrading to 12.0.1alpha31..OK
    Upgrading to 12.0.1alpha45..
    -> Running PHP script /usr/local/src/freepbx/upgrades/12.0.1alpha45/upgrade.php
    Upgrading to 12.0.1alpha45..OK
    Upgrading to 12.0.1beta10..
    -> Running PHP script /usr/local/src/freepbx/upgrades/12.0.1beta10/upgrade.php
    Upgrading to 12.0.1beta10..OK
    Upgrading to 12.0.1beta30..
    -> Running PHP script /usr/local/src/freepbx/upgrades/12.0.1beta30/upgrade.php
    Upgrading to 12.0.1beta30..OK
    Upgrading to 12.0.32..
    -> Running PHP script /usr/local/src/freepbx/upgrades/12.0.32/upgrade.php
    Upgrading to 12.0.32..OK
    Upgrading to 12.0.38..
    -> Running PHP script /usr/local/src/freepbx/upgrades/12.0.38/upgrade.php
    Upgrading to 12.0.38..OK
    Checking core.. updated to 12.0.46
    Checking cdr.. updated to 12.0.23
    Checking dashboard.. updated to 12.0.33
    Checking customappsreg.. updated to 12.0.3.2
    Checking voicemail.. updated to 12.0.44
    Checking music.. updated to 12.0.2
    Checking featurecodeadmin.. updated to 12.0.2
    Checking infoservices.. updated to 12.0.3.2
    Checking sipsettings.. updated to 12.0.16
    Checking logfiles.. updated to 12.0.6
    Checking callrecording.. updated to 12.0.4
    Checking recordings.. updated to 12.0.8
    Checking conferences.. updated to 12.0.22
    ..OK
    Generating AMP configs..
    Generating Configurations.conf, (if Asterisk is not running, you will get an error)
    In case of error, start Asterisk and hit the red bar in the GUI to generate the Configurations.conf files
    PHP Warning:  file_put_contents(/var/log/asterisk/freepbx.log): failed to open stream: Permission denied in /var/www/html/admin/libraries/utility.functions.php on line 112
    PHP Warning:  file_put_contents(/var/log/asterisk/freepbx.log): failed to open stream: Permission denied in /var/www/html/admin/libraries/utility.functions.php on line 112
    PHP Warning:  file_put_contents(/var/log/asterisk/freepbx.log): failed to open stream: Permission denied in /var/www/html/admin/libraries/utility.functions.php on line 112
    PHP Warning:  file_put_contents(/var/log/asterisk/freepbx.log): failed to open stream: Permission denied in /var/www/html/admin/libraries/utility.functions.php on line 112
    PHP Warning:  file_put_contents(/var/log/asterisk/freepbx.log): failed to open stream: Permission denied in /var/www/html/admin/libraries/utility.functions.php on line 112
    PHP Warning:  file_put_contents(/var/log/asterisk/freepbx.log): failed to open stream: Permission denied in /var/www/html/admin/libraries/utility.functions.php on line 112
    PHP Warning:  file_put_contents(/var/log/asterisk/freepbx.log): failed to open stream: Permission denied in /var/www/html/admin/libraries/utility.functions.php on line 112
    Checking for PEAR Console::Getopt..OK
    Running module install.php and install.sql scripts
    Skipping extension and destination registry checks
    PHP Warning:  file_put_contents(/var/log/asterisk/freepbx.log): failed to open stream: Permission denied in /var/www/html/admin/libraries/utility.functions.php on line 112
    PHP Warning:  file_put_contents(/var/log/asterisk/freepbx.log): failed to open stream: Permission denied in /var/www/html/admin/libraries/utility.functions.php on line 112
    PHP Warning:  file_put_contents(/var/log/asterisk/freepbx.log): failed to open stream: Permission denied in /var/www/html/admin/libraries/utility.functions.php on line 112
    PHP Warning:  file_put_contents(/var/log/asterisk/freepbx.log): failed to open stream: Permission denied in /var/www/html/admin/libraries/utility.functions.php on line 112
    PHP Warning:  file_put_contents(/var/log/asterisk/freepbx.log): failed to open stream: Permission denied in /var/www/html/admin/libraries/utility.functions.php on line 112
    PHP Warning:  file_put_contents(/var/log/asterisk/freepbx.log): failed to open stream: Permission denied in /var/www/html/admin/libraries/utility.functions.php on line 112
    PHP Warning:  file_put_contents(/var/log/asterisk/freepbx.log): failed to open stream: Permission denied in /var/www/html/admin/libraries/utility.functions.php on line 112
    PHP Warning:  file_put_contents(/var/log/asterisk/freepbx.log): failed to open stream: Permission denied in /var/www/html/admin/libraries/utility.functions.php on line 112
    PHP Warning:  file_put_contents(/var/log/asterisk/freepbx.log): failed to open stream: Permission denied in /var/www/html/admin/libraries/utility.functions.php on line 112
    PHP Warning:  file_put_contents(/var/log/asterisk/freepbx.log): failed to open stream: Permission denied in /var/www/html/admin/libraries/utility.functions.php on line 112
    PHP Warning:  file_put_contents(/var/log/asterisk/freepbx.log): failed to open stream: Permission denied in /var/www/html/admin/libraries/utility.functions.php on line 112
    PHP Warning:  file_put_contents(/var/log/asterisk/freepbx.log): failed to open stream: Permission denied in /var/www/html/admin/libraries/utility.functions.php on line 112
    PHP Warning:  file_put_contents(/var/log/asterisk/freepbx.log): failed to open stream: Permission denied in /var/www/html/admin/libraries/utility.functions.php on line 112
    Please update your modules and reload Asterisk by visiting http://192.168.1.1/admin
    PHP Warning:  file_put_contents(/var/log/asterisk/freepbx.log): failed to open stream: Permission denied in /var/www/html/admin/libraries/utility.functions.php on line 112
    PHP Warning:  file_put_contents(/var/log/asterisk/freepbx.log): failed to open stream: Permission denied in /var/www/html/admin/libraries/utility.functions.php on line 112
    PHP Warning:  file_put_contents(/var/log/asterisk/freepbx.log): failed to open stream: Permission denied in /var/www/html/admin/libraries/utility.functions.php on line 112
    PHP Warning:  file_put_contents(/var/log/asterisk/freepbx.log): failed to open stream: Permission denied in /var/www/html/admin/libraries/utility.functions.php on line 112
    Generating AMP configs..OK
    Checking core.. Checking if directdids need migrating..already done
    updating zap callgroup, pickupgroup..not needed
    checking for delay_answer field ..already exists
    checking for reversal field ..added
    checking for pricid field ..already exists
    Checking if trunk table migration required..not needed
    Checking if privacy manager options exists..already exists
    Checking for noanswer_cid field..already exists
    Checking for busy_cid field..already exists
    Checking for chanunavail_cid field..already exists
    Checking for noanswer_dest field..already exists
    Checking for busy_dest field..already exists
    Checking for chanunavail_dest field..already exists
    Unable to add index to extensions field in users
    Checking for General Setting migrations..not needed
    Deleting unused globals..done
    Converting IAX notransfer to transfer if needed..updated 0000 records
    deleting obsoleted record_in and record_out entries..ok
    checking for dest field in outbound_routes..already exists
    checking for continue field in trunks..already exists
    upgrading any zap trunks to dahdi if foundok
    Generating CSS...Done
    Module core successfully installed
    
    SETTING FILE PERMISSIONS.............Done
    Removing any dangling symlinks
    Dangling symlinks removed
    Module core successfully enabled
    installed
    Checking cdr.. Checking if field did is present in cdr table..
    did field already present.
    Checking if field recordingfile is present in cdr table..
    recordingfile field already present.
    Checking if field cnum is present in cdr table..
    Adding cnum field to cdr
    Added field cnum to cdr
    Checking if field cnam is present in cdr table..
    Adding cnam field to cdr
    Added field cnam to cdr
    Checking if field outbound_cnum is present in cdr table..
    Adding outbound_cnum field to cdr
    Added field outbound_cnum to cdr
    Checking if field outbound_cnam is present in cdr table..
    Adding outbound_cnam field to cdr
    Added field outbound_cnam to cdr
    Checking if field dst_cnam is present in cdr table..
    Adding dst_cnam field to cdr
    Added field dst_cnam to cdr
    Creating cel if needed..OK
    Generating CSS...Done
    Module cdr successfully installed
    
    SETTING FILE PERMISSIONS.............Done
    Removing any dangling symlinks
    Dangling symlinks removed
    Module cdr successfully enabled
    installed
    Checking dashboard.. Generating CSS...Done
    Module dashboard successfully installed
    
    SETTING FILE PERMISSIONS.............Done
    Removing any dangling symlinks
    Dangling symlinks removed
    Module dashboard successfully enabled
    installed
    Checking customappsreg.. Generating CSS...Done
    Module customappsreg successfully installed
    
    SETTING FILE PERMISSIONS.............Done
    Removing any dangling symlinks
    Dangling symlinks removed
    Module customappsreg successfully enabled
    installed
    Checking voicemail.. Checking for General Setting migrations..not needed
    checking if Voicemail Admin (vmailadmin) is installed..not installed, ok
    Generating CSS...Done
    Module voicemail successfully installed
    
    SETTING FILE PERMISSIONS.............Done
    Removing any dangling symlinks
    Dangling symlinks removed
    Module voicemail successfully enabled
    installed
    Checking music.. Generating CSS...Done
    Module music successfully installed
    
    SETTING FILE PERMISSIONS.............Done
    Removing any dangling symlinks
    Dangling symlinks removed
    Module music successfully enabled
    installed
    Checking featurecodeadmin.. Generating CSS...Done
    Module featurecodeadmin successfully installed
    
    SETTING FILE PERMISSIONS.............Done
    Removing any dangling symlinks
    Dangling symlinks removed
    Module featurecodeadmin successfully enabled
    installed
    Checking infoservices.. Generating CSS...Done
    Module infoservices successfully installed
    
    SETTING FILE PERMISSIONS.............Done
    Removing any dangling symlinks
    Dangling symlinks removed
    Module infoservices successfully enabled
    installed
    Checking sipsettings.. checking for sipsettings table..none, creating table
    chan_pjsip support detected. Enabling.
    populating default codecs..ulaw, alaw, gsm, g726 added
    Migrate rtp.conf values if needed and initialize
    Migrating Audio Codecs
    Generating CSS...Done
    Module sipsettings successfully installed
    
    SETTING FILE PERMISSIONS.............Done
    Removing any dangling symlinks
    Dangling symlinks removed
    Module sipsettings successfully enabled
    installed
    Checking logfiles.. Generating CSS...Done
    Module logfiles successfully installed
    
    SETTING FILE PERMISSIONS.............Done
    Removing any dangling symlinks
    Dangling symlinks removed
    Module logfiles successfully enabled
    installed
    Checking callrecording.. Generating CSS...Done
    Module callrecording successfully installed
    
    SETTING FILE PERMISSIONS.............Done
    Removing any dangling symlinks
    Dangling symlinks removed
    Module callrecording successfully enabled
    installed
    Checking recordings.. checking for fcode field..OK
    checking for fcode_pass field..OK
    Generating CSS...Done
    Module recordings successfully installed
    
    SETTING FILE PERMISSIONS.............Done
    Removing any dangling symlinks
    Dangling symlinks removed
    Module recordings successfully enabled
    installed
    Checking conferences.. Checking if music field present..already present
    Checking if recordings need migration..already migrated
    Checking for users field..already present
    Generating CSS...Done
    Module conferences successfully installed
    
    SETTING FILE PERMISSIONS.............Done
    Removing any dangling symlinks
    Dangling symlinks removed
    Module conferences successfully enabled
    installed
    Framework has been detected as being in Developer mode, Please make sure to run './install_amp --update-links' manually so that any database or system settings can be updated
    Generating CSS...Done
    Module framework successfully installed
    
    SETTING FILE PERMISSIONS.............Done
    Removing any dangling symlinks
    Dangling symlinks removed
    Please update your modules and reload Asterisk by browsing to your server.
    *************************************************************************
    * Note: It's possible that if you click the red 'Update Now' bar BEFORE *
    * updating your modules, your machine will start dropping calls. Ensure *
    * that all modules are up to date BEFORE YOU CLICK THE RED BAR. As long *
    * as this is observed, your machine will be fully functional whilst the *
    * upgrade is in progress.                                               *
    *************************************************************************
    ****************************************
    * At This Time Please Restart Asterisk *
    ****************************************
systemctl daemon-reload
systemctl enable amportal.service
asterisk -rx "core stop now"
systemctl start amportal.service
systemctl enable amportal.service

sngrep 설치

vi /etc/yum.repos.d/sngrep.repo
[irontec]
name=Irontec RPMs repository
baseurl=http://packages.irontec.com/centos/$releasever/$basearch/
rpm --import http://packages.irontec.com/public.key
yum update
yum isntall sngrep
반응형
Posted by kev1n
,