forked from juned/trunk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathINSTALL
260 lines (180 loc) · 9.92 KB
/
INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
1. 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
2. Install packages
[Debian]
apt-get install git
[CentOS]
yum install git
3. Install Freeswitch :
* Install Freeswitch pre-requisite packages
[Debian]
apt-get update
apt-get -y install 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 chkconfig 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++ ntp ntpdate libspeexdsp-dev \
libldns-dev libsqlite3-dev libpcre3-dev mysql-server php5-mysql chkconfig ntpdate ntp
apt-get install -y libssl-dev libspeex-dev libspeexdsp-dev libsqlite3-dev libedit-dev libldns-dev libpq-dev
[CentOS]
yum install -y git
yum clean all
yum install -y autoconf automake expat-devel gnutls-devel libtiff-devel libX11-devel unixODBC-devel python-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
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
* Set the right time before continue
ntpdate pool.ntp.org
[Debian]
/etc/init.d/ntp restart
chkconfig ntp on
[CentOS]
/etc/init.d/ntpd restart
chkconfig ntpd on
* Download latest freeswitch version
cd /usr/local/src
git clone https://stash.freeswitch.org/scm/fs/freeswitch.git
cd freeswitch
./bootstrap.sh -j
* Edit modules.conf
Enable mod_xml_curl, mod_xml_cdr, mod_perl (if you want to use Calling Card feature)
* Compile the Source
./configure
make
* Install Freeswitch with sound files
make all install cd-sounds-install cd-moh-install
* 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
* Configure Freeswitch Startup Script
[Debian]
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 o-rwx /usr/local/freeswitch/
chmod -R u=rwx,g=rx /usr/local/freeswitch/bin/*
cp /usr/src/trunk/freeswitch/init/freeswitch.debian.init /etc/init.d/freeswitch
[CentOS]
cp <ASTPP SOURCE DIR>/freeswitch/init/freeswitch.init /etc/init.d/freeswitch
chmod 755 /etc/init.d/freeswitch
chkconfig --add freeswitch
chkconfig --level 345 freeswitch on
4. ASTPP Install :
1. Download ASTPP
cd /usr/src/
git clone https://github.com/ASTPP/trunk.git
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
4. Install ASTPP Perl packages
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'
perl -MCPAN -e "install CGI,XML::Simple,Data::Dumper,URI::Escape,JSON,POSIX,DBI,Time::HiRes,DateTime::Format::Strptime";
5. 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/
[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 <FreeSWITCH_SCRIPTS_DIR>/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/
6. 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/sites-available/astpp.conf
a2ensite astpp (Ubuntu)
or
a2ensite astpp.conf (Debian)
/etc/init.d/apache2 reload
[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
7. Start Services
1. Apache
[Debian]
/etc/init.d/apache2 restart
[CentOS]
/etc/init.d/httpd restart
2. Mysql
[Debian]
/etc/init.d/mysql restart
[CentOS]
/etc/init.d/mysqld restart
3. Freeswitch
/etc/init.d/freeswitch restart
8. Install ASTPP Database
Set Root Password
mysqladmin -u root password '<SET YOUR PASSWORD>'
Create astpp database
Create new mysql for above databases
GRANT ALL PRIVILEGES ON astpp.* TO astppuser@localhost IDENTIFIED BY '<SET YOUR PASSWORD>';
flush privileges;
mysql -uroot -p<PASSWORD> astpp < /usr/src/trunk/sql/astpp-2.0.sql
Enter appropriate values in prompt
9. Setup database credential in /var/lib/astpp/astpp-config.conf
Note : Default we are running astpp on 8081 port.
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/password is "admin/admin"
Note : In case of any issue please refer apache error log.
10. ASTPP Freeswitch Configuration
cd /usr/src/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/
cp dialplan/default/astpp_callingcards.xml /usr/local/freeswitch/conf/dialplan/default/
Note : Edit astpp_callingcards.xml file to change acccess 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.
Once above setting are done, restart freeswitch and check if above modules are loaded or not. If not then please load it manually.
11. 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
# Update currency rate
0 0 * * * cd /var/www/html/astpp/cron/ && php cron.php CurrencyUpdate
12. Setup Fail2ban
Visit this link to setup Fail2ban for FreeSWITCH
https://freeswitch.org/confluence/display/FREESWITCH/Fail2Ban
ASTPP Support :
Please email us at [email protected] for support.
ASTPP Forums :
http://groups.google.com/group/astpp
Refer astpp.org for more information.