Thứ Tư, 25 tháng 8, 2010

Các bước cài đặt một tổng đài IPPBX hoàn chỉnh bằng Asterisk

http://www.freepbx.org/support/documentation/installation/install-process-for-centos-5-1 (có thể xem thêm ở đây)
Bước 1: Cài Centos 5.3
Cái này khỏi bàn!!
Bước 2:Update hệ thống
yum -y update
init 6
Bước 3:Cài các thư viện phụ thuộc
yum install php* mysql* ncurses* tftp* php-pear libtermcap* nano ntp wget setuptool gcc gcc* make flex patch bison kernel byacc sendmail cpuspeed system-config-network-tui acpid smartmontools libtool* unixODBC*
Bước 4:Disable SELinux và Firewall
setup agent
reboot
Bước 5:Enable the tftp server
nano /etc/xinetd.d/tftp
change “disable=yes” to “disable=no”
Bước 6:Cấu hình đồng bộ thời gian ( nếu cần )
vi /etc/ntp.conf

restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
server IP Server1
server IP Server2
server IP Server3

/sbin/chkconfig --level 345 ntpd on
Bước 7: Install lame ( gói này không có trong miror list của Centos,có 3 cách cài)
Cách 1:
rpm -ivh http://apt.sw.be/redhat/el5/en/i386/RPMS.dag/lame-3.97-1.el5.rf.i386.rpm
Cách 2:
wget http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
rpm --import RPM-GPG-KEY.dag.txt
rm -f RPM-GPG-KEY.dag.txt
vi /etc/yum.repos.d/dag.repo ( past đoạn sau vào)
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el5/en/i386/dag/
gpgcheck=1
enabled=0
yum --enablerepo=dag -y install lame*
Cách 3:Cài từ rpmforge
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
(for 32 bits )
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
(for 64 bits)
Bước 8:Download Asterisk, Asterisk-addons,zaptel,
cd /usr/local/src
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-1.4.25.tar.gz
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-addons-1.4.8.tar.gz
wget http://downloads.asterisk.org/pub/telephony/zaptel/zaptel-1.4.12.1.tar.gz
wget http://umn.dl.sourceforge.net/sourceforge/amportal/freepbx-2.5.1.tar.gz
http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4.10.tar.gz
Bước 9:Tiến hành cài compile
ln -s kernels/ 2.6.18-128.1.10.el5-i686 linux <<<< thêm vào để build lại các gói.
Cài Zaptel
cd /usr/local/src
tar -zxvf zaptel-1.4.12.1.tar.gz
cd zaptel-1.4.12.1
./configure
make menuselect
press "x"
make clean
make
make install
make config
Cài Asterisk:
cd /usr/local/src
tar -zxvf asterisk-1.4.25.tar.gz
cd asterisk-1.4.25
./configure
make menuselect
select core sounds and uncheck all except ulaw
press "x" to save
make clean
make
make install
make samples
make webvmail
make progdocs
make config
mkdir /var/run/asterisk
mkdir /var/lib/asterisk/sounds/custom
Cài libpri-1.4.10.tar.gz
cd /usr/local/src
tar -zxvf libpri-1.4.10.tar.gz
cd libpri-1.4.10
make
make install
Bước 10:Sangoma Wanpipe Installation ( Driver ho trợ cho card Sangoma – Quan trọng nhất là Non-CRC)
cd /usr/local/src
ln -s zaptel-1.4.12.1 zaptel
wget ftp://ftp.sangoma.com/linux/current_wanpipe/wanpipe-2.3.4-13.tgz
tar -zxvf wanpipe-2.3.4-13.tgz
cd wanpipe-2.3.4-13
./Setup install
Would you like to install WAN Router now? (y/n) y

Would you like update/upgrade wanpipe drivers? (y/n) y

Press [Enter] to continue...

Proceed to build WANPIPE kernel modules ? (y/n) y

Please Select Compilation Mode

1. WAN Protocol Support (Default)

Protocols: Frame Relay, CHDLC, PPP, X25 and ADSL

2. TDM Voice (Asterisk) Support Only

Protocols: TDMV (Asterisk) on AFT adatpers.

3. TDM Voice (Asterisk) + WAN Protocol Support

Protocols: TDMV, Frame Relay, CHDLC, PPP, X25, ADSL

4. TDM Voice (Asterisk) + SS7 Support + WAN Protocol Support

Protocols: TDMV, SS7, Frame Relay, CHDLC, PPP, X25, ADSL

5. Custom Compilation Mode

Specify protocols to be added into the WANPIPE

kernel drivers.

Please select (1,2,3,4 or 5) [Default: 1]: 2

Press Enter for Default
Press Enter for Default

Enable TDMV DCHAN Native HDLC Support & Patch Zaptel ? (y/n) y

Your Zaptel source was modified, recompile/reinstall zaptel ? (y/n) y

Everything else just continue to go with “y” or ENTER for defaults

To upgrade the Wanpipe driver proceed as follows:

Bước 11:Create user and set permissions
useradd -c "Asterisk PBX" -d /var/lib/asterisk asterisk
chown asterisk /var/lib/php/session/

cp -vR /var/lib/asterisk/moh /var/lib/asterisk/mohmp3
chown -vR asterisk.asterisk /var/lib/asterisk/mohmp3
chmod -v 775 /var/lib/asterisk/mohmp3
chmod -v 664 /var/lib/asterisk/mohmp3/*

sed -i “s/User apache/User asterisk/” /etc/httpd/conf/httpd.conf
sed -i “s/Group apache/Group asterisk/” /etc/httpd/conf/httpd.conf

sed -i “s/AllowOverride All/AllowOverride None/” /etc/httpd/conf/httpd.conf

sed -i “s/AllowOverride None/AllowOverride All/” /etc/httpd/conf/httpd.conf

Bước 12:Set up MySQL
/etc/init.d/mysqld start
cd /usr/local/src/freePBX-2.5.1
mysqladmin -u root -ppassword create asterisk
mysqladmin -u root -ppassword create asteriskcdrdb
mysql -u root -ppassword asterisk < SQL/newinstall.sql
mysql -u root -ppassword asteriskcdrdb < SQL/cdr_mysql_table.sql
mysql -u root -ppassword
mysql> GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';
mysql> GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';
mysql> flush privileges;
mysql> \q
Bye
Bước 13:FreePBX Pre-install
cd /usr/local/src/asterisk-addons-1.4.8
cp Makefile Makefile.orig
sed -i 's/SOURCE/SOURCE -DMYSQL_LOGUNIQUEID/' Makefile
./configure
make menuselect
press "x"
make clean
make
make install
Install PEAR Database
pear install DB
Bước 13:Install freePBX
cd /etc/asterisk
vi asterisk.conf
change /var/run --> /var/run/asterisk
cd /usr/local/src/freepbx-2.5.1
./install_amp
Checking for PEAR DB..OK
Checking for PEAR Console::Getopt..OK
Checking for libasteriskperl (perl bindings for asterisk)...Checking user..OK
Checking for /etc/amportal.conf../etc/amportal.conf does not exist, copying default
Creating new /etc/amportal.conf
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]
Enter the path to use for your FOP web root:[/var/www/html/panel]
Created /var/www/html/panel
Enter the path to your Apache cgi-bin:[/var/www/cgi-bin]
Enter the IP ADDRESS or hostname used to access the AMP web-admin:[xx.xx.xx.xx] The IP Address of your Asterisk Machine
**NOTE: Leave this IP blank if you intend to access Flash Operator Panel from the Internet 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]
Created /var/lib/asterisk/bin
Enter directory in which to store super-user scripts: [/usr/sbin]
/etc/amportal.conf writtenOK
Reading /etc/amportal.conf..OK
Checking for /etc/asterisk/asterisk.conf../etc/asterisk/asterisk.conf does not exist, copying default
OK
.
.
.
OK
Please Reload Asterisk by visiting http://XXX.XXX.XXX.XX/admin

If you get any warnings or errors in the last part of the output, they're usually not traumatic, but please use the IRC Support tool to report a bug to the developers.

amportal

Set FOP to run on startup
nano +52 /etc/amportal.conf
FOPRUN=true

/usr/local/sbin/amportal stop
/usr/local/sbin/amportal start

Automatic start-up
echo /usr/local/sbin/amportal start >> /etc/rc.local

chmod 775 /etc/amportal.conf

Bước 13:Firewall/Router configuration
Port 80 (Freepbx web access)
Port 4445 (Flash Operator Panel web access)
Port 4569 (IAX remote phone clients)
Port 5059-5061 (registration and proxy server access, default is 5060)
Port 10000-20000 (ports reserved for RTP voice packets for SIP phone conversations by Asterisk)
NOTE: The RTP ports 10000-xxxxx forwarded in the firewall/router need to match the setting in /etc/asterisk/rtp.conf
Bước 14:Password protection
cd /var/www/html
vi .htaccsee
AuthType Basic
AuthName "Vui Long Nhap Username va password"
AuthUserFile /etc/.pass
Require user admin

htpasswd -c /etc/.pass admin
Nhập password cần đặt
Như vầy quá trình cài đặt Asterisk va freePBX đã thành công.
Từ một máy khác gõ http://ip_asterisk/admin
OK!!!

Không có nhận xét nào:

Đăng nhận xét