2018.09.01更新:
本人经过一段时间的测试,发现以下用官方文档介绍的方法安装后的ASTPP系统无法正常工作。连UDP端口5060都没有监听。请有兴趣安装测试的朋友们不要再用以下方法了。
新的安装方法也已经找到,国外大神提供的这个安装方法绝对无坑,本人测试过也没发现大的问题。堪称业界良心。请看另一篇博文。
https://blog.51cto.com/phenixjiang/2168495

请注意,CentOS 7上的Freeswitch不支持视频通话。要获得Freeswitch完整功能请看本人另一篇https://blog.51cto.com/phenixjiang/2157414
最近玩Freeswitch玩得很high,然而它不带计费功能。好在现在有不少的开源计费系统是基于Freeswitch的。比如VBilling,ASTPP等。
vBilling官网已经打不开了,没办法测试。于是找到了ASTPP的安装文档,
http://astpp.readthedocs.io/en/v3.6/Installation/centos7_installation.html#
这个是centos7的安装文档,根据本人安装完成后的经验来看,这个所谓的官方安装文档是基于centos6 64位的系统写的,很多命令在centos7上已经不支持了。
完全按照安装文档来的话,会遇到很多‘坑’,本人踩过了所有坑终于安装成功。所以以下贴出的安装命令是无坑版。
首先是安装前的准备工作,最小化安装centos7系统,设置好ntp以及网络连接。安装完成以root登录系统后就可以开始ASTPP的安装了。

#Install base packages
yum update
yum groupinstall "Development tools" -y

#Enable epel and freeswitch repository
yum install epel-release
rpm -Uvh http://files.freeswitch.org/freeswitch-release-1-6.noarch.rpm
yum update

#Install Freeswitch

  1. Install Freeswitch pre-requisite packages

yum install -y wget git autoconf automake expat-devel yasm gnutls-devel libtiff-devel libX11-devel unixODBC-devel python-devel zlib-devel alsa-lib-devel libogg-devel libvorbis-devel uuid-devel gdbm-devel db4-devel libjpeg libjpeg-devel compat-libtermcap ncurses ncurses-devel ntp screen sendmail sendmail-cf gcc-c++ bison bzip2 curl curl-devel dmidecode git make mysql-connector-odbc openssl-devel unixODBC zlib pcre-devel speex-devel sqlite-devel ldns-devel libedit-devel bc e2fsprogs-devel libcurl-devel libxml2-devel libyuv-devel opus-devel libvpx-devel libvpx2 libdb4 libidn-devel unbound-devel libuuid-devel lua-devel libsndfile-devel

  1. Download latest freeswitch version
    cd /usr/local/src
    git config --global pull.rebase true

#Clone freeswitch version 1.6.19 from git
git clone -b v1.6.19 https://freeswitch.org/stash/scm/fs/freeswitch.git
cd freeswitch
./bootstrap.sh -j

  1. Edit modules.conf

#Enabling mod_xml_curl, mod_json_cdr, mod_db
sed -i "s##xml_int/mod_xml_curl#xml_int/mod_xml_curl#g" /usr/local/src/freeswitch/modules.conf
sed -i "s##mod_db#mod_db#g" /usr/local/src/freeswitch/modules.conf
sed -i "s##event_handlers/mod_json_cdr#event_handlers/mod_json_cdr#g" /usr/local/src/freeswitch/modules.conf
sed -i "s##applications/mod_voicemail#applications/mod_voicemail#g" /usr/local/src/freeswitch/modules.conf`

  1. Compile the Source

./configure -C

  1. Install Freeswitch with sound files

make all install cd-sounds-install cd-moh-install
make && make install

  1. Create symbolic links for Freeswitch executables

ln -s /usr/local/freeswitch/bin/freeswitch /usr/local/bin/freeswitch
ln -s /usr/local/freeswitch/bin/fs_cli /usr/local/bin/fs_cli

#ASTPP Install

  1. Download ASTPP 3.6 from git

    cd /usr/src
    git clone -b v3.6 https://github.com/iNextrix/ASTPP

  2. Install ASTPP pre-requisite packages

#php7.0 repository
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install yum-utils
yum-config-manager --enable remi-php70
yum update
yum install -y autoconf automake bzip2 cpio curl nginx php-fpm php-mcrypt* unixODBC mysql-connector-odbc curl-devel php php-devel php-common php-cli php-gd php-pear php-mysql php-mbstring sendmail sendmail-cf php-pdo php-pecl-json mysql mariadb-server mysql-devel libxml2 libxml2-devel openssl openssl-devel gettext-devel fileutils gcc-c++

  1. Normalize ASTPP

#Create access & error log files.
touch /var/log/nginx/astpp_access_log
touch /var/log/nginx/astpp_error_log
touch /var/log/nginx/fs_access_log
touch /var/log/nginx/fs_error_log
systemctl restart php-fpm
systemctl restart nginx

ASTPP using FreeSWITCH

  1. Configure freeswitch startup script

cp /usr/src/ASTPP/freeswitch/init/freeswitch.centos.init /etc/init.d/freeswitch
chmod 755 /etc/init.d/freeswitch
chmod +x /etc/init.d/freeswitch
mkdir /var/run/freeswitch

  1. Configure ASTPP with freeswitch

#Create directory structure for ASTPP
mkdir -p /var/lib/astpp/
mkdir -p /var/log/astpp/
mkdir -p /usr/local/astpp/
mkdir -p /var/www/

#Setting permisssion
chown -Rf root.root /var/lib/astpp/
chown -Rf root.root /var/log/astpp/
chown -Rf root.root /usr/local/astpp/
chown -Rf root.root /var/www//

#Setting up Scripts and Sounds for fs
cp -rf /usr/src/ASTPP/freeswitch/scripts/ /usr/local/freeswitch/scripts/
cp -rf /usr/src/ASTPP/freeswitch/fs /var/www/html/
cp -rf /usr/src/ASTPP/freeswitch/sounds/
.wav /usr/local/freeswitch/sounds/en/us/callie/
chmod -Rf 777 /usr/local/freeswitch/sounds/en/us/callie/
rm -rf /usr/local/freeswitch/conf/dialplan/
touch /usr/local/freeswitch/conf/dialplan/astpp.xml
rm -rf /usr/local/freeswitch/conf/directory/

touch /usr/local/freeswitch/conf/directory/astpp.xml
rm -rf /usr/local/freeswitch/conf/sip_profiles/*
touch /usr/local/freeswitch/conf/sip_profiles/astpp.xml

Install ASTPP web interface

mkdir -p /var/lib/astpp
cp /usr/src/ASTPP/config/* /var/lib/astpp/

#Setup web interface for ASTPP
mkdir -p /var/www/html/astpp
cp -rf /usr/src/ASTPP/web_interface/astpp/ /var/www/html/astpp/
chown -Rf root.root /var/www/html/astpp
cp /usr/src/ASTPP/webinterface/nginx/cent
/etc/nginx/conf.d/

#apply security policy
sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/sysconfig/selinux
sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
chmod -Rf 755 /var/www/html/astpp
touch /var/log/astpp/astpp.log

Install ASTPP Database

#Restart mysql service
systemctl start mariadb
mysql -uroot -e "UPDATE mysql.user SET password=PASSWORD('') WHERE user='root'; FLUSH PRIVILEGES;"

#Create database astpp
mysql -uroot -p -e "create database astpp;"
mysql -uroot -p -e "CREATE USER 'astppuser'@'localhost' IDENTIFIED BY 'astppuserpass';"
mysql -uroot -p -e "GRANT ALL PRIVILEGES ON `astpp` . * TO 'astppuser'@'localhost' WITH GRANT OPTION;FLUSH PRIVILEGES;"
mysql -uroot -p astpp < /usr/src/ASTPP/database/astpp-3.0.sql
mysql -uroot -p astpp < /usr/src/ASTPP/database/astpp-upgrade-3.5.sql
mysql -uroot -p astpp < /usr/src/ASTPP/database/astpp-upgrade-3.6.sql

ASTPP Freeswitch Configuration

cp /usr/src/ASTPP/freeswitch/conf/autoload_configs/* /usr/local/freeswitch/conf/autoload_configs/

#Edit db password in autoload config files.
sed -i "s#dbpass = #dbpass = #g" /var/lib/astpp/astpp-config.conf
sed -i "s#DB_PASSWD=\"\"#DB_PASSWD = \"\"#g" /var/lib/astpp/astpp.lua

#Setup ODBC Connection for mysql
cp /usr/src/ASTPP/misc/odbc/cent_odbc.ini /etc/odbc.ini
cp /usr/src/ASTPP/misc/odbc/cent_odbcinst.ini /etc/odbcinst.ini

#Edit base URL in astpp-config
sed -i "s#base_url=http://localhost:8089/#base_url=http://:8089/#g" /var/lib/astpp/astpp-config.conf

Note:- Replace "" with your server domain name or IPaddress

Finalize Installation & Start Services

#Open php short tag
sed -i "s#short_open_tag = Off#short_open_tag = On#g" /etc/php.ini
sed -i "s#;cgi.fix_pathinfo=1#cgi.fix_pathinfo=1#g" /etc/php.ini
sed -i "s/max_execution_time = 30/max_execution_time = 3000/" /etc/php.ini
sed -i "s/upload_max_filesize = 2M/upload_max_filesize = 20M/" /etc/php.ini
sed -i "s/post_max_size = 8M/post_max_size = 20M/" /etc/php.ini
sed -i "s/memory_limit = 128M/memory_limit = 512M/" /etc/php.ini
systemctl restart php-fpm
systemctl restart nginx

#Configure services for startup
systemctl disable httpd #If you are using it then change the port or update your configuration for nginx otherwise your gui will not up

systemctl enable nginx
systemctl enable php-fpm
systemctl start mariadb
systemctl start freeswitch

Note:- If you want to use firewall then configure it to allow all port used in fs and ASTPP.

#Setup cron

#Generate Invoice
0 12 * cd /var/www/html/astpp/cron/ && php cron.php GenerateInvoice

#Update balance notification
0 12 * cd /var/www/html/astpp/cron/ && php cron.php UpdateBalance

#Low balance notification
0 0 * cd /var/www/html/astpp/cron/ && php cron.php LowBalance

#Update currency rate
0 0 * cd /var/www/html/astpp/cron/ && php cron.php CurrencyUpdate

#Email Broadcasting
0 0 * cd /var/www/html/astpp/cron/ && php cron.php BroadcastEmail

Finally Reboot it.

#You are almost done with your configuration so just reboot it and make sure everything is working fine.

reboot now

#Once server up and running again, check below service status.
systemctl status nginx
systemctl status mariadb
systemctl status freeswitch
systemctl status php-fpm


1.在安装环境包的过程中yum会提示找不到compat-libtermcap,忽略这个就可以了。因为这个包是centos5,和6所用的,centos7安装源里已经没有了。
2.在导入数据库的最后一个文件升级到3.6时,会出现一个错误 Unknown column interval。改用mysql管理工具连上数据库导入又没有提示这个错误。本人目前还没找到是什么原因 ,有精通数据库的朋友可以帮忙看看。
3.本安装文档仅仅保证能顺利完成安装,能登录到ASTPP管理界面。至于后续使用中会出现什么bug,本人无法保证。