1)Имеем "голый"
debian
apt-get update && apt-get upgrade -y
Подготовка к установке, ставим пакеты, все,что может понадобится и больше
apt-get install gcc g++ make libncurses5-dev libmysqlclient-dev libxml2 libxml2-dev libtiff4 libtiff4-dev apache2 libapache2-mod-php5 php5-mysql php5-gd php-pear mysql-server openssl libssl-dev bison libncurses5-dev libaudiofile-dev curl sox sudo screen mc vlan vim apache2 mysql-server php5 htop libspandsp-dev subversion libsqlite3-dev
mpg123
apt-get
install
-y build-essential linux-headers-`
uname
-r` openssh-server apache2 mysql-server\
mysql-client bison flex php5 php5-curl php5-cli php5-mysql php-pear php5-gd curl sox\
libncurses5-dev libssl-dev libmysqlclient-dev mpg123 libxml2-dev libnewt-dev sqlite3\
libsqlite3-dev pkg-config automake libtool autoconf git unixodbc-dev uuid uuid-dev\
libasound2-dev libogg-dev libvorbis-dev libcurl4-openssl-dev libical-dev libneon27-dev libsrtp0-dev\
libspandsp-dev
sudo
libmyodbc subversion
2) Качаем и устанавливаем
cd
/usr/src
wget http:
//downloads
.asterisk.org
/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current
.
tar
.gz
wget http:
//downloads
.asterisk.org
/pub/telephony/libpri/libpri-1
.4-current.
tar
.gz
wget http:
//downloads
.asterisk.org
/pub/telephony/asterisk/asterisk-13-current
.
tar
.gz
wget -O jansson.
tar
.gz https:
//github
.com
/akheron/jansson/archive/v2
.7.
tar
.gz
wget http:
//www
.pjsip.org
/release/2
.4
/pjproject-2
.4.
tar
.bz2
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-1.8-current.tar.gz
http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-11-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz
Compile and install DAHDI.
cd /usr/src
tar xvfz dahdi-linux-complete-current. tar .gz
rm -f dahdi-linux-complete-current. tar .gz
cd dahdi-linux-complete-*
make all
make install
make config
cd /usr/src
tar xvfz libpri-1.4-current. tar .gz
rm -f libpri-1.4-current. tar .gz
cd libpri-*
make
make install
|
Compile and install pjproject
cd /usr/src
tar -xjvf pjproject-2.4. tar .bz2
rm -f pjproject-2.4. tar .bz2
cd pjproject-2.4
CFLAGS= '-DPJ_HAS_IPV6=1' . /configure -- enable -shared --disable-sound --disable-resample --disable-video --disable-opencore-amr
make dep
make
make install
|
Compile and Install jansson
cd /usr/src
tar vxfz jansson. tar .gz
rm -f jansson. tar .gz
cd jansson-*
autoreconf -i
. /configure
make
make install
|
Compile and install Asterisk
cd /usr/src
tar xvfz asterisk-13-current. tar .gz
rm -f asterisk-13-current. tar .gz
cd asterisk-*
contrib /scripts/get_mp3_source .sh
contrib /scripts/install_prereq install
. /configure
make menuselect
|
make
make
install
make
config
ldconfig
update-rc.d -f asterisk remove
cd
/var/lib/asterisk/sounds
wget http:
//downloads
.asterisk.org
/pub/telephony/sounds/asterisk-core-sounds-en-wav-current
.
tar
.gz
wget http:
//downloads
.asterisk.org
/pub/telephony/sounds/asterisk-extra-sounds-en-wav-current
.
tar
.gz
tar
xvf asterisk-core-sounds-en-wav-current.
tar
.gz
rm
-f asterisk-core-sounds-en-wav-current.
tar
.gz
tar
xfz asterisk-extra-sounds-en-wav-current.
tar
.gz
rm
-f asterisk-extra-sounds-en-wav-current.
tar
.gz
wget http:
//downloads
.asterisk.org
/pub/telephony/sounds/asterisk-core-sounds-en-g722-current
.
tar
.gz
wget http:
//downloads
.asterisk.org
/pub/telephony/sounds/asterisk-extra-sounds-en-g722-current
.
tar
.gz
tar
xfz asterisk-extra-sounds-en-g722-current.
tar
.gz
rm
-f asterisk-extra-sounds-en-g722-current.
tar
.gz
tar
xfz asterisk-core-sounds-en-g722-current.
tar
.gz
rm
-f asterisk-core-sounds-en-g722-current.
tar
.gz
3) Добавим пользователя и группу./
groupadd asterisk
useradd -c "asterisk PBX" -d /var/lib/asterisk -g asterisk asterisk
useradd
-m asterisk
chown
asterisk.
/var/run/asterisk
chown
-R asterisk.
/etc/asterisk
chown
-R asterisk.
/var/
{lib,log,spool}
/asterisk
chown
-R asterisk.
/usr/lib/asterisk
rm
-rf
/var/www/html
sed
-i
's/\(^upload_max_filesize = \).*/\120M/'
/etc/php5/apache2/php
.ini
cp
/etc/apache2/apache2
.conf
/etc/apache2/apache2
.conf_orig
sed
-i
's/^\(User\|Group\).*/\1 asterisk/'
/etc/apache2/apache2
.conf
sed
-i
's/AllowOverride None/AllowOverride All/'
/etc/apache2/apache2
.conf
service apache2 restart
cat
>>
/etc/odbcinst
.ini << EOF
[MySQL]
Description = ODBC
for
MySQL
Driver =
/usr/lib/x86_64-linux-gnu/odbc/libmyodbc
.so
Setup =
/usr/lib/x86_64-linux-gnu/odbc/libodbcmyS
.so
FileUsage = 1
EOF
cat
>>
/etc/odbc
.ini << EOF
[MySQL-asteriskcdrdb]
Description=MySQL connection to
'asteriskcdrdb'
database
driver=MySQL
server=localhost
database=asteriskcdrdb
Port=3306
Socket=
/var/run/mysqld/mysqld
.sock
option=3
EOF
4) Теперь сам FreePbx
wget http://mirror.freepbx.org/freepbx-2.10.0.tar.gz
(wget http://mirror.freepbx.org/freepbx-2.11.0rc1.tar.gz )
http://mirror.freepbx.org/modules/packages/freepbx/freepbx-12.0-latest.tgz
tar -zxvf freepbx-2.10.0.tar.gz
cd /usr/src/freepbx-2.10.0/
cd
/usr/src
wget http:
//mirror
.freepbx.org
/modules/packages/freepbx/freepbx-13
.0-latest.tgz
tar
vxfz freepbx-13.0-latest.tgz
rm
-f freepbx-13.0-latest.tgz
cd
freepbx
.
/start_asterisk
start
.
/install
-n
ну как бэ все
5) Если хотим факсы, ставим модуль spandsp c http://www.soft-switch.org
cd /usr/src/spandsp-xxx
./configure
make && make install
или из репозитория
apt-get in
stall libspandsp-dev
6)Если хотим использовать МП3
./contrib/scripts/get_mp3_source.sh
7) Ставим добавки (addons) если версия астериска ниже 1.8
cd /usr/src/asterisk-addons
make clean && make && make install
8) Звуки для IVR и прочих (для 1.8 нет необходимости)
cd /usr/src/asterisk-sounds
make install
4)Готовим базы в "мускуле"
mysql -u root -p
Enter password:
mysql> create database asteriskcdrdb;
mysql> create database asterisk;
mysql> GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asterisk@localhost IDENTIFIED BY 'amp109';
mysql> GRANT ALL PRIVILEGES ON asterisk.* TO asterisk@localhost IDENTIFIED BY 'amp109';
mysql> quit;
5) Создаем таблицы из готовых шаблонов
mysql -u asterisk -pamp109 asteriskcdrdb < /usr/src/freepbx-2.10.0/SQL/cdr_mysql_table.sql
mysql -u asterisk -pamp109 asterisk < /usr/src/freepbx-2.10.0/SQL/newinstall.sql
6) Ставим
mv /etc/asterisk/sip_notify.conf /etc/asterisk/sip_notify.conf.backup
/usr/src/freepbx-2.10.0/start_asterisk start
pear install DB
/usr/src/freepbx-2.9.0/install_amp
7) Отвечаем на вопросы скрипта
Enter your USERNAME to connect to the ‘asterisk’ database: [asteriskuser]
Enter your PASSWORD to connect to the ‘asterisk’ database: [amp109]
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] /var/www
Enter the IP ADDRESS or hostname used to access the AMP web-admin: [xx.xx.xx.xx] 10.1.2.3
Enter a PASSWORD to perform call transfers with the Flash Operator Panel: [passw0rd]
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]
Enter directory in which to store super-user scripts: [/usr/local/sbin]
8) Настроим веб сервер на запуск от пользователя
"astersik" и перезапустим его
в /etc/apache2/envvars
меняем
export APACHE_RUN_USER=asterisk
export APACHE_RUN_GROUP=asterisk
после выполнить
chown -R asterisk:asterisk /var/lock/apache2
или в /etc/apache2/httpd.conf
User asterisk
Group asterisk
перегружаем апач
/etc/init.d/apache2 restart
на "всякий"
chown asterisk -R /var/lib/php5/
8а) Тут веб интерфейс должен работать по сылке
ip
login: admin
password: admin
8б) Управление через amportal
[root@pbx root]# amportal
----------AMP Control Script-----------
Usage: amportal start|stop|kill|chown
start: Starts Asterisk and Flash Operator Panel server
stop: Gracefully stops Asterisk
kill: Kills Asterisk
chown: Sets appropriate permissions on files
[root@pbx root]# /usr/sbin/amportal stop
[root@pbx root]# /usr/sbin/amportal start
9) Меняем "дефолтные" пароли на свои
Для MySQL (default amp109) :
/etc/amportal.conf замена переменной AMPDBPASS
/etc/asterisk/cdr_mysql.conf замена переменной password
/etc/asterisk/extensions_additional.conf замена переменной AMPDBPASS
/etc/freepbx.conf замена переменной $amp_conf['AMPDBPASS']
В настройках MySQL
Effectuer le changement dans la base SQL comme suis :
/etc/asterisk/manager.conf замена переменной secret
/etc/asterisk/extensions_additional.conf замена переменной AMPMGRPASS
/etc/amportal.conf замена переменной AMPMGRPASS
Перегазрузите модуль manager для астериска
NEWPASSWORD='password';
sed -i "s/\(^AMPDBPASS=*\)\(.*\)/\1$NEWPASSWORD/" /etc/amportal.conf
sed -i "s/\(^password = *\)\(.*\)/\1$NEWPASSWORD/" /etc/asterisk/cdr_mysql.conf
sed -i "s/\(^AMPDBPASS = *\)\(.*\)/\1$NEWPASSWORD/" /etc/asterisk/extensions_additional.conf
sed -i "s/\($amp_conf\['AMPDBPASS'\]\\t= '*\)\(.*\)/\1$NEWPASSWORD';/" /etc/freepbx.conf
echo "SET PASSWORD FOR 'asteriskuser'@'localhost' = PASSWORD('$NEWPASSWORD');" | mysql -u root -p
10) Для автозапуска правим /etc/rc.d/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
echo Loading wcfxs
/sbin/modprobe wcfxs
/usr/sbin/amportal start