CentOS 5.8+Asterisk-11.0.1+FreePBX
配置前的软件包列表以及下载(或者到我个人的百度云网盘下载也可)
网盘地址:http://pan.baidu.com/s/1o6iaIFK
软件 |
版本 |
文件名称 |
备注 |
|
||||||||||||||||||||||||||||
CentOS |
5.8 |
|
|
|||||||||||||||||||||||||||||
Asterisk |
11.0.1 |
|
|
|
||||||||||||||||||||||||||||
Asterisk 运行需求(列表即是按照顺序,可选安装根据个人需求而定)
|
|
|||||||||||||||||||||||||||||||
VMware |
10 |
|
|
说明:本文档中所有黑体均表示CentOS下的相关终端命令。
1. 下载CentOS 5.8
国内高速下载
http://mirrors.163.com/centos/5.8/isos/i386/CentOS-5.8-i386-bin-DVD-1of2.iso
http://mirrors.163.com/centos/5.8/isos/i386/CentOS-5.8-i386-bin-DVD-2of2.iso
2. Windows XP/2003/Win7上用VMware 10安装CentOS虚拟机
(略)
3. 下载 Asterisk,dahdi,libpri,libsrtp。
切换至文件目录存放目录 /usr/src/
su –
cd /usr/src
4. 下载Asterisk 11.0.1
wgethttp://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-11.0.1.tar.gz
5. 下载dahdi
6. 下载libpri
wgethttp://downloads.Asterisk.org/pub/telephony/libpri/releases/libpri-1.4.11.4.tar.gz
7. 下载libsrtp
wget http://sourceforge.net/projects/srtp/files/srtp/1.4.4/srtp-1.4.4.tgz/download
8. 安装相关的依赖软件
yum-y install kernel-devel gcc make gcc-c++ libxml2-devel pkgconfigzlib-devel
yum-y install openssl-devel ncurses-devel autoconf automake libtool zip unzip
9. tar -xzvf asterisk-11.0.1.tar.gz
10. tar –xzvf dahdi-linux-complete-2.10.0.1+2.10.0.1.tar.gz
11. tar -xzvf libpri-1.4.11.4.tar.gz
12. tar -xzvf srtp-1.4.4.tgz
13. 编译srtp,dahdi,libpri,Asterisk (注意编译的顺序)
------------------------------------------------------------------------------------------------------------------------------------------------
编译srtp
cd /usr/src/srtp
CFLAGS="-Wall -O4 -fexpensive-optimizations-funroll-loops -fPIC"
./configure --prefix=/usr
make
vi /root/.bash_profile
修改PATH=$PATH:$HOME/bin为 PATH=$PATH:$HOME/bin:.
su-
cd/usr/src/srtp
否则make runtest报错:rtpw_test.sh:line 27: rtpw: command not found
makeruntest
makeinstall
make clean
-----------------------------------------------------------------------------------------------------------------------------------------------
编译dahdi
cd../dahdi-linux-complete-2.5.0.2+2.5.0.2
make all
连接无法更新解决方案:
sudo fc-cache -fv 2>&1 | grep failed| cut -f1 -d":" | xargs -i sudo touch {} && sudo fc-cache –fv
出错处理:
You do notappear to have the sources for the 2.6.18-308.el5 kernel installed.
uname -r
2.6.18-308.el5
cd /lib/modules/
看到下面有 2.6.18-308.11.1.el5 2.6.18-308.el5
cd /lib/modules/2.6.18-308.el5
重新创建build link
rm build
ln-s ../../../usr/src/kernels/2.6.18-308.11.1.el5-i686/ build
解决办法2:
yum -y install kernel-devel-`uname -r`
makeinstall
------------------------------------------------------------------------------------------------------------------------------------------------
安装dahdi-tools后方可执行26
若出现提示:
List ofdetected DAHDI devices:
No hardwarefound
则需要对应的硬件
make config
屏幕提示:
/sbin/chkconfig--add dahdi
DAHDI hasbeen configured.
List ofdetected DAHDI devices:
pci:0000:03:0c.0 wcfxo- 1057:5608 Wildcard X100P --提示检测到硬件Wildcard X100P
run‘dahdi_genconf modules‘ to load support for only
the DAHDIhardware installed in this system. By
defaultsupport for all DAHDI hardware is loaded at
DAHDI start.
-----------------------------------------------------------------------------------------------------------------------------------------------
编译libpri
cd../libpri-1.4.11.4
make
make install
-----------------------------------------------------------------------------------------------------------------------------------------------
编译Asterisk
makemenuconfig前置包安装
yuminstall ncurses-devel
cdasterisk-11.0.1
contrib/scripts/install_prereqinstall
注意:如要mp3,需要执行下面操作
yuminstall subversion
contrib/scripts/get_mp3_source.sh
注意:如要ilbc codec,需要执行下面操作
contrib/scripts/get_ilbc_source.sh
cdcodec/ilbc/
看到里面只有几个文件
extract-cfile.awkrfc3951.txt
拷贝 http://ilbcfreeware.org/documentation/extract-cfile.txt内容到extract-cfile.awk
awk -f extract-cfile.awk rfc3951.txt
这将在这个目录下面产生几十个文件。
cd ../../
./configure--with-bluetooth
makemenuconfig
(add-on 选择chan_mobile, format_mp3, res_config_mysql, EXTRAS-SOUNDS-EN-GSM )
准备工作完成后进入asterisk正式编译步骤
make
makeinstall
makeconfig
makesamples
(生成Asterisk相关的例子配置文件位于/etc/Asterisk/文件夹中)
-----------------------------------------------------------------------------------------------------------------------------------------------
14. 启动dahdi
service dahdi restart
15. 启动asterisk
service asterisk restart
16. 查看端口5060使用情况来判定asterisk服务是否已经启动
netstat-na|grep 5060
udp 0 0 0.0.0.0:5060 0.0.0.0:*
17. 添加AMR codec的支持
开始配置Asterisk前,需要添加一些工具。用到工具有ARM-NB codec编码方式支持移动电话从而能得到最好的音质。
先停止Asterisk服务
service asterisk stop
进入/usr/src文件夹,下载Asterisk-amr补丁。
cd /usr/src/
wgethttp://sourceforge.net/projects/asterisk-amr/files/1.8.0-rc2_asterisk_amr_patch.diff/download
cd asterisk-11.0.1/ && patch -p2 <../1.8.0-rc2_asterisk_amr_patch.diff
cd../asterisk-11.0.1/codecs/amr/
从3GPP网站下载AMR codec
wget http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-700.zip
unzip-j 26104-700.zip
unzip-j 26104-700_ANSI_C_source_code.zip
回到asterisk-11.0.1目录
cd ../.. /..
wgethttp://sourceforge.net/projects/asterisk-amr/files/1.8.0-rc2_crypto_offer.diff/download
cd asterisk-11.0.1/&& patch -p2 < ../1.8.0-rc2_crypto_offer.diff 补丁未打成功
切换至asterisk-11.0.1/目录
cd asterisk-11.0.1
重新编译asterisk-11.0.1
make ; make install
启动asterisk
asterisk-rvvvvvvvvvvv
coreshow codecs
2048 (1<< 11) (0x800) audio g726 (G.726 RFC3551)
4096 (1<< 12) (0x1000) audio g722 (G722)
8192 (1<< 13) (0x2000) audio amr (AMR NB)
-----------------------------------------------------------------------------------------------------------------------------------------------
18. 以下为可选步骤
19. 设置runlevel 3
编辑/etc/inittab
id:3:initdefault:
20. 安装vncserver
yum install vnc
------------------------------------------------------------------------------------------------------------------------------------------------
每小时reboot一次:
cd /etc/cron.hourly/
touchreboot
chmod777 reboot
#!/bin/sh
/sbin/reboot
------------------------------------------------------------------------------------------------------------------------------------------------
# service iptables save
#service iptables stop
#chkconfig iptables off
------------------------------------------------------------------------------------------------------------------------------------------------
21. 启用amr codec
vi sip_general_additional.conf
修改
disallow=all
allow=ulaw
allow=alaw
为
allow=all
可选步骤到此为止
22. 重新启动Asterisk
Service asteriskrestart
23. 安装FreePBX-2.11.0
------------------------------------------------------------------------------------------------------------------------------------------------
1) 查看系统中是否缺少以下服务,缺少将用 ”yum install服务名“来安装
安装bind,httpd,sendmail,mysql,mysql-server
yum install bind httpd sendmailmysql mysql-server
------------------------------------------------------------------------------------------------------------------------------------------------
2) 禁用Selinux
说明:这个是安全级别和防火墙的东西,启用的话会影响我们的freepbx的安装。
vi /etc/sysconfig/selinux
把 SELINUX=enforcing
改成 SELINUX=disabled
保存:wq重启下
reboot
3) 安装需要的扩展包
yum install e2fsprogs-develkeyutils-libs-devel krb5-devel libogg libselinux-devel libsepol-devellibxml2-devel
yum install libtiff-devel gmp php-pearphp-pear-DB php-gd php-mysql php-pdo kernel-devel ncurses-develaudiofile-devel
yum install libogg-devel openssl-develmysql-server mysql-devel zlib-devel perl-DateManip sendmail-cf sox
------------------------------------------------------------------------------------------------------------------------------------------------
4) 安装 phpmyadmin(可选)
说明:CentOS 5.8的php是5.1版本的(php-v),phpmyadmin 3版本需要php 5.2所以这里就用phpmyadmin 2.11
-------------------------------------------------------------------------------------------------------------------------------------------① 下载phpMyAdmin-2.11.11.2-english.zip
http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/
wget http://jaist.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/2.11.11/phpMyAdmin-2.11.11-english.zip
unzipphpMyAdmin-2.11.11-english.zip
mvphpMyAdmin-2.11.11-english phpmyadmin
chownasterisk:asterisk -R phpmyadmin/
chmod777 -R phpmyadmin/
mvphpmyadmin /var/www/html
cd/var/www/html/phpmyadmin/libraries/
viconfig.default.php
$cfg[‘blowfish_secret‘]= ‘xxxx‘;
$cfg[‘Servers‘][$i][‘password‘]= ‘password‘;
servicemysqld start
mysqladmin-u root password "password"
vi/etc/httpd/conf/httpd.conf
加入 ServerName asterisk1101
修改
Userasterisk
Groupasterisk
chmod777 /var/lib/php/session/
chmod777 -R /var/lib/php/session/* ——有可能提示没有这个目录,不用理会
servicemysqld restart
/etc/init.d/httpdrestart
在浏览器中输入后面的网址http://asterisk1101/phpmyadmin/测试访问结果
排错:
Forbidden
You don‘t have permission toaccess /phpmyadmin/ on this server.
原因1:没有关闭SE Linux,或者关闭了SE Linux配置但是没有reboot Linux
原因2:phpmyadmin的owner不是asterisk,mode不是777
-------------------------------------------------------------------------------------------------------------------------------------------
② 安装lame
wget http://sourceforge.net/projects/lame/files/lame/3.99/lame-3.99.5.tar.gz/download
或 http://nchc.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tarzxvf lame-3.99.5.tar.gz
cdlame-3.99.5
./configure
make
makeinstall
-------------------------------------------------------------------------------------------------------------------------------------------
5) 安装FreePBX
这个必须在asterisk 完全安装后才能装
下载地址:http://www.freepbx.org(官方)
wget http://mirror.freepbx.org/freepbx-2.11.0.38.tgz
tar-xvf freepbx-2.9.0.tar.gz
cdfreepbx-2.9.0
./start_asteriskstart
PS:必须吧mysql密码设置为空,方便运行以下命令(建立相关asterisk 数据库)
/etc/init.d/mysqldstart
mysql -uroot –p password
mysql> set password for root@localhost=password(‘‘);
mysql> exit;
mysql -uroot (测试可以通过空口令登录)
mysqladmincreate asterisk
mysqladmincreate asteriskcdrdb
mysqlasterisk < SQL/newinstall.sql
mysqlasteriskcdrdb < SQL/cdr_mysql_table.sql
mysql
mysql> GRANTALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY‘password‘;
mysql> GRANTALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY ‘password‘;
mysql> flushprivileges;
mysql> quit;
把mysql密码设置不能为空
mysqladmin-u root password "password"
再运行以下命令
./install_amp--username=root --password=password //这里我的mysql用名为root,密码是password
以下是终端的一些输出提示:
Checking for PEAR DB..OK
Checking for PEARConsole::Getopt..OK
Using username: root
Using password: ********
Checking user..OK
Checking if Asterisk isrunning..running with PID: 4173..OK
Checking for/etc/amportal.conf../etc/amportal.conf does not exist, copying defaultCreatingnew /etc/amportal.conf
Enter your USERNAME to connect tothe ‘asterisk‘ database:
[root]Enter your PASSWORDto connect to the ‘asterisk‘ database:
[passw0rd]
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 IP ADDRESS or hostname used to access the AMP web-admin:
[xx.xx.xx.xx] asterisk1101
Enter a PASSWORD to perform call transfers with the Flash Operator Panel:
[passw0rd]
Use simple Extensions [extensions] admin or separate Devices and Users[devicean
duser]?
[extensions]
Created /var/lib/asterisk/bin
Enter directory in which to store super-user scripts:
[/usr/local/sbin]
# echo "/usr/local/sbin/amportalstart" >> /etc/rc.local
chkconfighttpd on
chkconfigmysqld on
OK 安装完成重启
reboot
6) 后续一些权限修改
-------------------------------------------------------------------------------------------------------------------------------------------
chmod 777/var/www/html -R
cd/var/lib/asterisk/
chmod 777 bin
chmod -R 777bin/*
chmod 777/var/lib/php/session/
chmod 777 -R/var/lib/php/session/*
-------------------------------------------------------------------------------------------------------------------------------------------
登录至FreePBX测试
http://192.168.100.128(你的本机IP地址)
用户名:admin
口令:admin
第一次登陆管理界面,需要进行配置。
现在可以创建SIP号码。
-------------------------------------------------------------------------------------------------------------------------------------------
一些排错信息:
-------------------------------------------------------------------------------------------------------------------------------------------
日志:
tail -f /var/log/httpd/access_log
tail -f /var/log/httpd/error_log
/var/log/mysqld.log
asterisk 日志
tail -f /var/log/asterisk/full
tail -f /var/log/asterisk/freepbx.log
-------------------------------------------------------------------------------------------------------------------------------------------
排错:检查数据访问
mysql -h localhost -u root -ppassword
use asterisk;
-------------------------------------------------------------------------------------------------------------------------------------------
排错:
http://192.168.158.134/phpmyadmin/
-------------------------------------------------------------------------------------------------------------------------------------------
提示:
/etc/amportal.conf
控制谁能用amp 管理协议访问asterisk服务器
/etc/asterisk/manager.conf
7) FreePBX忘记口令
修改口令为freepbx后,登录FreePBX Administration页面并修改口令。
错误之处敬请之处!谢谢!
后续添加硬件测试IP电话通话,以及Extension.conf编程扩展!敬请关注!
CentOS 5.8+Asterisk-11.0.1+FreePBX ——支持蓝牙,AMR-NB audio codec
原文地址:http://blog.csdn.net/mimica247706624/article/details/40707563