| 1 |
### |
|---|
| 2 |
Installing freePBX |
|---|
| 3 |
|
|---|
| 4 |
### |
|---|
| 5 |
Important Warning! |
|---|
| 6 |
freePBX _will_ overwrite any exisiting asterisk configurations you may have. This project attempts |
|---|
| 7 |
to manage as much of asterisk as it can, and this means lots of automatically generated dialplans. |
|---|
| 8 |
Please visit both the Documentation wiki (http://www.aussievoip.com.au/wiki/freePBX) and the Dev |
|---|
| 9 |
wiki (http://www.freepbx.org/wiki) for instructions, hints and tips. As a rule of thumb, any |
|---|
| 10 |
existing sip, iax, or extensions files can be copied to the same name with _custom.conf appended, |
|---|
| 11 |
and things will continue to work as before. |
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
### |
|---|
| 15 |
freePBX has several requirements, including the following packages (names may vary based on distro): |
|---|
| 16 |
|
|---|
| 17 |
libxml2 |
|---|
| 18 |
libxml2-devel |
|---|
| 19 |
libtiff |
|---|
| 20 |
libtiff-devel |
|---|
| 21 |
lame |
|---|
| 22 |
httpd (or Apache2) |
|---|
| 23 |
mysql (or mysql-client) |
|---|
| 24 |
mysql-devel (or libmysqlclient10-dev) |
|---|
| 25 |
mysql-server |
|---|
| 26 |
php (or php4) |
|---|
| 27 |
(on debian, also install libapache2-mod-php4) |
|---|
| 28 |
php4-pear (if pear is not included with your php) |
|---|
| 29 |
php-mysql |
|---|
| 30 |
(on SUSE, also install php4-gettext and php4-session) |
|---|
| 31 |
php-gd |
|---|
| 32 |
openssl |
|---|
| 33 |
openssl-devel (or libssl-dev) |
|---|
| 34 |
kernel-devel (or linux-source) |
|---|
| 35 |
perl |
|---|
| 36 |
perl-CPAN |
|---|
| 37 |
bison |
|---|
| 38 |
ncurses-devel (or libncurses5-dev) |
|---|
| 39 |
audiofile-devel (or libaudiofile-devel) |
|---|
| 40 |
curl |
|---|
| 41 |
sox |
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
### |
|---|
| 45 |
freePBX requires the following changes to php and apache for uploading new MOH files: |
|---|
| 46 |
(Note: Thise are reasonably distro specifc. Check http://www.aussievoip.com/wiki/freePBX |
|---|
| 47 |
for more documentation) |
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
- vi +482 /etc/php.ini (or /etc/php4/apache2/php.ini) |
|---|
| 51 |
upload_max_filesize=20M |
|---|
| 52 |
- vi +14 /etc/httpd/conf.d/php.conf (if you have it) |
|---|
| 53 |
LimitRequestBody 20000000 |
|---|
| 54 |
|
|---|
| 55 |
### |
|---|
| 56 |
Download the latest freePBX files: |
|---|
| 57 |
|
|---|
| 58 |
- download the latest freePBX tarball to /usr/src |
|---|
| 59 |
- tar -zxvf freepbx<version>.tar.gz |
|---|
| 60 |
|
|---|
| 61 |
### |
|---|
| 62 |
Getting Asterisk and Zaptel from SVN or download the latest Asterisk and Zaptel source archives |
|---|
| 63 |
(freePBX uses the v2.0 branch) |
|---|
| 64 |
|
|---|
| 65 |
- cd /usr/src |
|---|
| 66 |
- svn checkout http://svn.digium.com/svn/asterisk/branches/1.2 asterisk-1.2 |
|---|
| 67 |
- svn checkout http://svn.digium.com/svn/zaptel/branches/1.2 zaptel-1.2 |
|---|
| 68 |
- svn checkout http://svn.digium.com/svn/libpri/branches/1.2 libpri-1.2 |
|---|
| 69 |
|
|---|
| 70 |
### |
|---|
| 71 |
For TDM zap devices (FXO/FXS): |
|---|
| 72 |
|
|---|
| 73 |
- cd /usr/src/zaptel |
|---|
| 74 |
- make && make install |
|---|
| 75 |
|
|---|
| 76 |
If you will be using a Digium telephony card that supports T1/E1 signaling do this step as well: |
|---|
| 77 |
- cd /usr/src/libpri |
|---|
| 78 |
- make && make install |
|---|
| 79 |
|
|---|
| 80 |
### |
|---|
| 81 |
Patching Asterisk with softfax/spandsp. |
|---|
| 82 |
|
|---|
| 83 |
- Download the latest spandsp files from http://www.soft-switch.org |
|---|
| 84 |
- cd /usr/src/spandsp-xxx |
|---|
| 85 |
- ./configure |
|---|
| 86 |
- make && make install |
|---|
| 87 |
|
|---|
| 88 |
The spandsp libraries are installed to /usr/local/lib. Therefore /usr/local/lib must be added to the LD_LIBRARY_PATH environment variable of the user that starts the asterisk process. To be safe, also add it to /etc/ld.so.conf and run ldconfig. |
|---|
| 89 |
|
|---|
| 90 |
Copy the following files (from soft-switch.org) to /usr/src/asterisk/apps/ : |
|---|
| 91 |
|
|---|
| 92 |
- cp app_rxfax.c /usr/src/asterisk/apps/ |
|---|
| 93 |
- cp app_txfax.c /usr/src/asterisk/apps/ |
|---|
| 94 |
- cp apps_makefile.patch /usr/src/asterisk/apps/ |
|---|
| 95 |
|
|---|
| 96 |
- cd /usr/src/asterisk/apps |
|---|
| 97 |
- patch < apps_makefile.patch |
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
### |
|---|
| 101 |
Create a group and non-root user: |
|---|
| 102 |
|
|---|
| 103 |
- groupadd asterisk |
|---|
| 104 |
- useradd -c "asterisk PBX" -d /var/lib/asterisk -g asterisk asterisk |
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 |
### |
|---|
| 108 |
Building Asterisk and configuring it to run as a non-root user |
|---|
| 109 |
|
|---|
| 110 |
- mkdir /var/run/asterisk |
|---|
| 111 |
- cd /usr/src/asterisk |
|---|
| 112 |
- make clean && make && make install |
|---|
| 113 |
|
|---|
| 114 |
### |
|---|
| 115 |
Get and build cdr_mysql module for asterisk |
|---|
| 116 |
|
|---|
| 117 |
- cd /usr/src/asterisk-addons |
|---|
| 118 |
- perl -p -i.bak -e 's/CFLAGS.*D_GNU_SOURCE/CFLAGS+=-D_GNU_SOURCE\nCFLAGS+=-DMYSQL_LOGUNIQUEID/' Makefile |
|---|
| 119 |
- make clean && make && make install |
|---|
| 120 |
|
|---|
| 121 |
### |
|---|
| 122 |
Install asterisk-sounds |
|---|
| 123 |
|
|---|
| 124 |
- cd /usr/src/asterisk-sounds |
|---|
| 125 |
- make install |
|---|
| 126 |
|
|---|
| 127 |
### |
|---|
| 128 |
Setting up MySQL for CDR and freePBX web interface |
|---|
| 129 |
|
|---|
| 130 |
- /usr/bin/mysql_install_db |
|---|
| 131 |
- /etc/init.d/mysqld start (or /etc/init.d/mysql start) |
|---|
| 132 |
|
|---|
| 133 |
- mysqladmin -u root password 'db_root_pwd' |
|---|
| 134 |
- mysqladmin create asteriskcdrdb -p |
|---|
| 135 |
- mysql --user=root --password=db_root_pwd asteriskcdrdb < /usr/src/freepbx<version>/SQL/cdr_mysql_table.sql |
|---|
| 136 |
|
|---|
| 137 |
- mysqladmin create asterisk -p |
|---|
| 138 |
- mysql --user root -p asterisk < /usr/src/freepbx<version>/SQL/newinstall.sql |
|---|
| 139 |
|
|---|
| 140 |
|
|---|
| 141 |
### |
|---|
| 142 |
Grant access to these two databases you just created |
|---|
| 143 |
|
|---|
| 144 |
**Note the default mysql username/password is asteriskuser/amp109. |
|---|
| 145 |
**If you change either of these, you will be prompted for them while running ./install below |
|---|
| 146 |
|
|---|
| 147 |
- mysql --user root -p |
|---|
| 148 |
|
|---|
| 149 |
mysql> GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'amp109'; |
|---|
| 150 |
Query OK, 0 rows affected (0.00 sec) |
|---|
| 151 |
|
|---|
| 152 |
mysql> GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'amp109'; |
|---|
| 153 |
Query OK, 0 rows affected (0.00 sec) |
|---|
| 154 |
|
|---|
| 155 |
mysql> quit |
|---|
| 156 |
|
|---|
| 157 |
### |
|---|
| 158 |
Run the "install" script to install all the freePBX files: |
|---|
| 159 |
|
|---|
| 160 |
- /usr/src/freePBX/install_amp |
|---|
| 161 |
|
|---|
| 162 |
### |
|---|
| 163 |
Configure zaptel driver: |
|---|
| 164 |
|
|---|
| 165 |
a. Edit /etc/zaptel.conf to reflect installed Digium telephony card(s). |
|---|
| 166 |
|
|---|
| 167 |
Only the parameters/values relevant to a TDM400P with 4 FXO modules are included below: |
|---|
| 168 |
|
|---|
| 169 |
fxsks=1-4 |
|---|
| 170 |
loadzone=us |
|---|
| 171 |
defaultzone=us |
|---|
| 172 |
|
|---|
| 173 |
Only the parameters/values relevant to a TE110P (T1 configuration) are included below: |
|---|
| 174 |
|
|---|
| 175 |
span=1,1,0,esf,b8zs |
|---|
| 176 |
bchan=1-23 |
|---|
| 177 |
dchan=24 |
|---|
| 178 |
loadzone=us |
|---|
| 179 |
defaultzone=us |
|---|
| 180 |
|
|---|
| 181 |
b. ztcfg -v |
|---|
| 182 |
|
|---|
| 183 |
Zaptel Configuration |
|---|
| 184 |
====================== |
|---|
| 185 |
|
|---|
| 186 |
1 channels configured. |
|---|
| 187 |
|
|---|
| 188 |
If you get a warning about unable to open master device /dev/zap/ctl, that's ok. It's a result |
|---|
| 189 |
of the zaptel module(s) not loaded yet. |
|---|
| 190 |
|
|---|
| 191 |
Detailed information with regard to Asterisk's configuration files can be found here: |
|---|
| 192 |
http://voip-info.org/wiki-Asterisk+config+files |
|---|
| 193 |
|
|---|
| 194 |
### |
|---|
| 195 |
Configure zapata module in asterisk config. |
|---|
| 196 |
|
|---|
| 197 |
- edit /etc/asterisk/zapata.conf to reflect installed digium interfaces (see zapata.conf.template) |
|---|
| 198 |
|
|---|
| 199 |
Only the parameters/values relevant to a TDM400P with 4 FXO modules are included below: |
|---|
| 200 |
|
|---|
| 201 |
[channels] |
|---|
| 202 |
language=en |
|---|
| 203 |
#include zapata_additional.conf |
|---|
| 204 |
context=from-pstn |
|---|
| 205 |
signalling=fxs_ks |
|---|
| 206 |
faxdetect=incoming |
|---|
| 207 |
usecallerid=yes |
|---|
| 208 |
callerid=asreceived |
|---|
| 209 |
echocancel=yes |
|---|
| 210 |
callprogress=no |
|---|
| 211 |
busydetect=no |
|---|
| 212 |
echocancelwhenbridged=no |
|---|
| 213 |
echotraining=800 |
|---|
| 214 |
group=0 |
|---|
| 215 |
channel=1-4 |
|---|
| 216 |
|
|---|
| 217 |
|
|---|
| 218 |
Only the parameters/values relevant to a TE110P (T1 configuration) are included below: |
|---|
| 219 |
|
|---|
| 220 |
[channels] |
|---|
| 221 |
language=en |
|---|
| 222 |
#include zapata_additional.conf |
|---|
| 223 |
context=from-pstn |
|---|
| 224 |
switchtype=national |
|---|
| 225 |
pridialplan=national |
|---|
| 226 |
signalling=pri_cpe |
|---|
| 227 |
faxdetect=incoming |
|---|
| 228 |
usecallerid=yes |
|---|
| 229 |
echocancel=yes |
|---|
| 230 |
callerid=asreceived |
|---|
| 231 |
echocancelwhenbridged=no |
|---|
| 232 |
echotraining=800 |
|---|
| 233 |
group=0 |
|---|
| 234 |
channel=1-23 |
|---|
| 235 |
|
|---|
| 236 |
|
|---|
| 237 |
Note: if your configuration is using zap channels as FXS endpoints, zapata.conf must |
|---|
| 238 |
contain the following line in order to provision these endpoints in freePBX's Extensions admin: |
|---|
| 239 |
#include zapata_additional.conf |
|---|
| 240 |
|
|---|
| 241 |
Detailed information with regard to Asterisk's configuration files can be found here: |
|---|
| 242 |
http://voip-info.org/wiki-Asterisk+config+files |
|---|
| 243 |
|
|---|
| 244 |
### |
|---|
| 245 |
httpd (Apache) configuration |
|---|
| 246 |
|
|---|
| 247 |
- Edit /etc/httpd/conf/httpd.conf (or /etc/apache2/apache2.conf) so that: |
|---|
| 248 |
|
|---|
| 249 |
User asterisk |
|---|
| 250 |
Group asterisk |
|---|
| 251 |
|
|---|
| 252 |
### |
|---|
| 253 |
Chown the PHP session.save_path directory: |
|---|
| 254 |
|
|---|
| 255 |
- chown asterisk /var/lib/php/session |
|---|
| 256 |
|
|---|
| 257 |
|
|---|
| 258 |
### |
|---|
| 259 |
Amportal Control Script |
|---|
| 260 |
|
|---|
| 261 |
FreePBX's amportal control script starts, stops or kills services in the freePBX environment, and sets permissions on directories/files in the |
|---|
| 262 |
freePBX environment: |
|---|
| 263 |
|
|---|
| 264 |
[root@pbx root]# amportal |
|---|
| 265 |
|
|---|
| 266 |
----------AMP Control Script----------- |
|---|
| 267 |
Usage: amportal start|stop|kill|chown |
|---|
| 268 |
start: Starts Asterisk and Flash Operator Panel server |
|---|
| 269 |
stop: Gracefully stops Asterisk and the FOP server |
|---|
| 270 |
kill: Kills Asterisk and the FOP server |
|---|
| 271 |
chown: Sets appropriate permissions on files |
|---|
| 272 |
|
|---|
| 273 |
The amportal script is the recommended way to stop and start asterisk: |
|---|
| 274 |
|
|---|
| 275 |
[root@pbx root]# /usr/sbin/amportal stop |
|---|
| 276 |
[root@pbx root]# /usr/sbin/amportal start |
|---|
| 277 |
|
|---|
| 278 |
### |
|---|
| 279 |
Auto Start |
|---|
| 280 |
|
|---|
| 281 |
The module/driver that you load at boot time depends upon whether you are using a |
|---|
| 282 |
TDM400P or TE110P. The wcfxs module should be loaded for the former and the wcte11xp |
|---|
| 283 |
module should be loaded for the latter. |
|---|
| 284 |
|
|---|
| 285 |
The following scripts are for RedHat and derivatives that use an rc.local: |
|---|
| 286 |
|
|---|
| 287 |
Edit /etc/rc.d/rc.local to include the following for the TDM400P: |
|---|
| 288 |
#!/bin/sh |
|---|
| 289 |
# |
|---|
| 290 |
# This script will be executed *after* all the other init scripts. |
|---|
| 291 |
# You can put your own initialization stuff in here if you don't |
|---|
| 292 |
# want to do the full Sys V style init stuff. |
|---|
| 293 |
touch /var/lock/subsys/local |
|---|
| 294 |
echo Loading wcfxs |
|---|
| 295 |
/sbin/modprobe wcfxs |
|---|
| 296 |
/usr/sbin/amportal start |
|---|
| 297 |
|
|---|
| 298 |
Edit /etc/rc.d/rc.local to include the following for the TE110P: |
|---|
| 299 |
|
|---|
| 300 |
#!/bin/sh |
|---|
| 301 |
# |
|---|
| 302 |
# This script will be executed *after* all the other init scripts. |
|---|
| 303 |
# You can put your own initialization stuff in here if you don't |
|---|
| 304 |
# want to do the full Sys V style init stuff. |
|---|
| 305 |
touch /var/lock/subsys/local |
|---|
| 306 |
echo Loading wcte11xp |
|---|
| 307 |
/sbin/modprobe wcte11xp |
|---|
| 308 |
/usr/sbin/amportal start |
|---|
| 309 |
|
|---|
| 310 |
For Debian and others (?), you'll have to add startup script(s) to /etc/init.d and link them |
|---|
| 311 |
to the appropriate rc?.d runlevel. |
|---|
| 312 |
|
|---|
| 313 |
|
|---|
| 314 |
Also ensure that mysql and apache are set to start at bootup. For RedHat-based systems do the following: |
|---|
| 315 |
|
|---|
| 316 |
- chkconfig --level 3 httpd on |
|---|
| 317 |
- chkconfig --level 3 mysqld on |
|---|
| 318 |
|
|---|
| 319 |
### |
|---|
| 320 |
Start everything (or reboot and it should start automagically): |
|---|
| 321 |
|
|---|
| 322 |
- As root run: |
|---|
| 323 |
|
|---|
| 324 |
service httpd restart |
|---|
| 325 |
(or /etc/init.d/apache2 restart) |
|---|
| 326 |
|
|---|
| 327 |
- As root run: |
|---|
| 328 |
|
|---|
| 329 |
amportal start |
|---|
| 330 |
|
|---|
| 331 |
- Point your browser to: |
|---|
| 332 |
|
|---|
| 333 |
http://[ip address] (default login is admin/admin) |
|---|
| 334 |
|
|---|
| 335 |
If you notice any errors or updates that are needed to this document, please e-mail: |
|---|
| 336 |
info@coalescentsystems.ca |
|---|