Setup EPEL Yum Repositories with newer packages and install Git

[CentOS]
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/`uname -m`/epel-release-6-8.noarch.rpm

Install packages

[Debian]
apt-get install git

[CentOS]
yum install git

Install Freeswitch

1. Install Freeswitch pre-requisite packages

[Debian]
apt-get update && apt-get upgrade

apt-get install -y autoconf automake devscripts gawk g++ git-core libjpeg62-dev libncurses5-dev libtool make python-dev gawk pkg-config libperl-dev libgdbm-dev libdb-dev gettext sudo lua5.1 apache2 apache2-threaded-dev php5 php5-dev php5-common php5-cli php5-gd php-pear php5-cli php-apc php5-curl libapache2-mod-php5 perl libapache2-mod-perl2 libxml2 libxml2-dev openssl libcurl4-openssl-dev gettext libtool gcc g++ libldns-dev libpcre3-dev build-essential bc

apt-get install -y libssl-dev libspeex-dev libspeexdsp-dev libsqlite3-dev libedit-dev libldns-dev libpq-dev mysql-server php5-mysql chkconfig ntpdate ntp

[CentOS]
yum install -y git
yum clean all

yum install -y autoconf automake expat-devel gnutls-devel libtiff-devel libX11-devel unixODBC-devel bash-devel zlib-devel alsa-lib-devel libogg-devel libvorbis-devel perl perl-libs uuid-devel @development-tools gdbm-devel db4-devel libjpeg libjpeg-devel compat-libtermcap ncurses ncurses-devel ntp screen sendmail sendmail-cf gcc-c++ libtool cpan bc

yum install -y bison bzip2 curl curl-devel dmidecode git make mysql-connector-odbc openssl-devel unixODBC zlib
yum install -y pcre-devel speex-devel sqlite-devel ldns-devel libedit-devel

2.Download latest freeswitch version

cd /usr/local/src
git clone -b v1.4 https://freeswitch.org/stash/scm/fs/freeswitch.git
cd freeswitch
./bootstrap.sh -j

3.Edit modules.conf

Enable mod_xml_curl, mod_xml_cdr, mod_perl (If you want to use calling card features)
Note : # add a module by removing ‘#’ comment character at the beginning of the line
# remove a module by inserting the ‘#’ comment character at the beginning of the line containing the name of the module
to be skipped

4. Compile the Source

./configure -C
make && make install

5. Install Freeswitch with sound files

make cd-sounds-install
make cd-moh-install

6. Set Owner and permissions

[Debian]
# create user ‘freeswitch’
# add it to group ‘daemon’
# change owner and group of the freeswitch installation
cd /usr/local
adduser –disabled-password –quiet –system –home /usr/local/freeswitch –gecos “FreeSWITCH Voice Platform” –ingroup daemon freeswitch
chown -R freeswitch:daemon /usr/local/freeswitch/
chmod -R ug=rwX,o= /usr/local/freeswitch/
chmod -R u=rwx,g=rx /usr/local/freeswitch/bin/*

[CentOS]
# create user ‘freeswitch’
# add it to group ‘daemon’
# change owner and group of the freeswitch installation
cd /usr/local
useradd –system –home-dir /usr/local/freeswitch -G daemon freeswitch
passwd -l freeswitch

chown -R freeswitch:daemon /usr/local/freeswitch/
chmod -R 770 /usr/local/freeswitch/
chmod -R 750 /usr/local/freeswitch/bin/*

mkdir /var/run/freeswitch
chown -R freeswitch:daemon /var/run/freeswitch

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

8. Configure Freeswitch Startup Script

[Debian]
cp /usr/src/trunk/freeswitch/init/freeswitch.debian.init /etc/init.d/freeswitch

[CentOS]
cp /usr/src/trunk/freeswitch/init/freeswitch.centos.init to /etc/init.d/freeswitch
chmod 750 /etc/init.d/freeswitch
chown freeswitch:daemon /etc/init.d/freeswitch
chkconfig –add freeswitch && chkconfig –levels 35 freeswitch on

ASTPP Install

1. Download ASTPP

We assume you have downloaded package from our Download section.
If not then please download it from here http://goo.gl/0rQuW5

2. Install ASTPP pre-requisite packages using YUM

[Debian]
apt-get install -y mysql-server apache2 apache2-threaded-dev php5 php5-dev php5-common php5-cli php5-gd php-pear php5-mysql php5-cli php-apc php5-curl libapache2-mod-php5 perl libapache2-mod-perl2 libxml2 libxml2-dev openssl libcurl4-openssl-dev gettext libtool gcc g++

[CentOS]
yum install -y cpan autoconf automake bzip2 cpio curl curl-devel php php-devel php-common php-cli php-gd php-pear php-mysql php-pdo php-pecl-json mysql mysql-server mysql-devel libxml2 libxml2-devel openssl openssl-devel gettext-devel libtool fileutils gcc-c++ httpd httpd-devel perl-YAML cpan perl

3. Normalize ASTPP (for debian only)

sed -i “s#/var/log/httpd/astpp_access_log#/var/log/apache2/astpp_access_log#g” /usr/src/trunk/web_interface/apache/astpp.conf
sed -i “s#/var/log/httpd/astpp_error_log#/var/log/apache2/astpp_error_log#g” /usr/src/trunk/web_interface/apache/astpp.conf
touch /var/log/apache2/astpp_access_log
touch /var/log/apache2/astpp_error_log
a2enmod rewrite

4. Install ASTPP Perl packages

# Enable auto accept for CPAN pacakges.
perl -MCPAN -e ‘my $c = “CPAN::HandleConfig”; $c->load(doit => 1, autoconfig => 1); $c->edit(prerequisites_policy => “follow”); $c->edit(build_requires_install_policy => “yes”); $c->commit’

# Install required CPAN packages.
perl -MCPAN -e “install CGI,XML::Simple,Data::Dumper,URI::Escape,JSON,POSIX,DBI,Time::HiRes,DateTime::Format::Strptime”;

ASTPP using FreeSWITCH (if you want to use ASTPP with FreeSWITCH)

mkdir -p /var/lib/astpp/
mkdir -p /var/log/astpp/
mkdir -p /usr/local/astpp/
mkdir -p /var/www/

[Debian]
chown -Rf www-data.www-data /var/lib/astpp/
chown -Rf www-data.www-data /var/log/astpp/
chown -Rf www-data.www-data /usr/local/astpp/
chown -Rf www-data.www-data /var/www/

[CentOS]
chown -Rf apache.apache /var/lib/astpp/
chown -Rf apache.apache /var/log/astpp/
chown -Rf apache.apache /usr/local/astpp/
chown -Rf apache.apache /var/www/

cp -rf /usr/src/trunk/scripts/*.pl /usr/local/astpp/

[Debian]
cp -rf /usr/src/trunk/freeswitch/astpp /usr/lib/cgi-bin/
chmod -Rf 777 /usr/lib/cg-bin/

[CentOS]
cp -rf /usr/src/trunk/freeswitch/astpp /var/www/cgi-bin
chmod -Rf 777 /var/www/cgi-bin/astpp

cp /usr/src/trunk/freeswitch/astpp-callingcards.pl /usr/local/freeswitch/scripts/astpp-callingcards.pl
cp -rf /usr/src/trunk/sounds/*.wav /usr/local/freeswitch/sounds/en/us/callie/
chmod -Rf 777 /usr/local/freeswitch/sounds/en/us/callie/

Install ASTPP web interface

cp /usr/src/trunk/astpp_confs/sample.astpp-config.conf /var/lib/astpp/astpp-config.conf
cp /usr/src/trunk/astpp_confs/sample.reseller-config.conf /var/lib/astpp/sample.reseller-config.conf

mkdir -p /var/www/html/astpp
cp -rf /usr/src/trunk/web_interface/astpp/* /var/www/html/astpp/
cp /usr/src/trunk/web_interface/astpp/htaccess /var/www//html/astpp/.htaccess

[Debian]
chown -Rf www-data.www-data /var/www/html/astpp
cp /usr/src/trunk/web_interface/apache/astpp.conf /etc/apache2/conf.d/astpp.conf

[CentOS]
chown -Rf apache.apache /var/www//html/astpp
cp /usr/src/trunk/web_interface/apache/astpp.conf /etc/httpd/conf.d/astpp.conf

chmod -Rf 777 /var/www/html/astpp
touch /var/log/astpp/astpp.log

Start Services

Apache:

[Debian]
/usr/sbin/a2ensite astpp (Debian)
OR
/usr/sbin/a2ensite astpp.conf (Ubuntu)
/etc/init.d/apache2 reload
/etc/init.d/apache2 restart

[CentOS]
/etc/init.d/httpd restart

Mysql:

[Debian]
/etc/init.d/mysql restart

[CentOS]
/etc/init.d/mysqld restart

Freeswitch:

/etc/init.d/freeswitch restart

Install ASTPP Database

Set Root Password
mysqladmin -u root password ”

Create astpp database

Create new MySQL user for above databases
GRANT ALL PRIVILEGES ON astpp.* TO astppuser@localhost IDENTIFIED BY ”;
flush privileges;

mysql -uroot -p astpp < /usr/src/trunk/sql/astpp-2.0.sql
mysql -uroot -p astpp < /usr/src/trunk/sql/astpp-upgrade-2.1.sql

Enter appropriate values in prompt

Setup database credential and change other require things in astpp configuration file

vim /var/lib/astpp/astpp-config.conf
Note :
You are done with GUI installation. Enjoy 🙂
Visit the astpp admin page in your web browser. It can be found here: http://server_ip:8081/ Please change the ip address
depending upon your box. The default username and password is “admin”.
Note : In case of any issue please refer apache error log.

ASTPP Freeswitch Configuration

cd trunk/freeswitch/conf

cp autoload_configs/xml_curl.conf.xml /usr/local/freeswitch/conf/autoload_configs/
Note : Edit xml_curl.conf.xml file and change localhost to your ip or domain name.

cp autoload_configs/xml_cdr.conf.xml /usr/local/freeswitch/conf/autoload_configs/
Note : Edit xml_cdr.conf.xml file and change localhost to your ip or domain name.

cp autoload_configs/cdr_csv.conf.xml /usr/local/freeswitch/conf/autoload_configs/

Note: Follow below step if you want to use calling card.

cp dialplan/default/astpp_callingcards.xml /usr/local/freeswitch/conf/dialplan/default/
Note : Edit astpp_callingcards.xml file to change access number for calling card.

Enable mod_xml_curl, mod_xml_cdr, mod_cdr_csv, mod_perl in /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml file.

Setup cron

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

# Low balance notification
0 1 * * * 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

# Low credit notification
0 0 * * * cd /var/www/html/astpp/cron/ && php cron.php LowCredit

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