asterisk、dahdi安装

来源:互联网 发布:sqlserver导入sql脚本 编辑:程序博客网 时间:2024/04/30 04:27

转自:http://blog.csdn.net/berryreload/article/details/7390326

为什么我要安装比较老的asterisk-1.8.10.1,而不是更加新的稳定版本?

因为我还要加AMR-NB audio codec。

参考文档:http://www.venturevoip.com/How-to-asterisk.1.8_SRTPTLS_snom300_pgsm.pdf


CentOS用户准备:
useradd asterisk

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上用Vmware Player安装CentOS虚拟机


3.Download Asterisk , DAHDI, libpri, libSRTP. First got to /usr/src/ directory
su -
cd /usr/src


4.wget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-1.8.10.1.tar.gz


可能是因为我的CentOS比较新,所以要高于2.4版本的dahdi

5.wget http://downloads.Asterisk.org/pub/telephony/dahdi-linux-complete/releases/dahdi-linux-complete-2.5.0.2+2.5.0.2.tar.gz


6.wget http://downloads.Asterisk.org/pub/telephony/libpri/releases/libpri-1.4.11.4.tar.gz


7.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 pkgconfig zlib-devel 
yum -y install openssl-devel ncurses-devel autoconf automake libtool zip unzip



Extract Asterisk & DAHDi & libpri & libsrtp
9.
tar -xzvf asterisk-1.8.10.1.tar.gz
10.
tar -xzvf  dahdi-linux-complete-2.5.0.2+2.5.0.2.tar.gz
11.
tar -xzvf libpri-1.4.11.4.tar.gz
12.
tar -xzvf srtp-1.4.4.tgz


Compile srtp, dahdi , libpri and Asterisk (the compilations order is important)
13. cd /usr/src/srtp
14.

 CFLAGS="-Wall -O4 -fexpensive-optimizations -funroll-loops -fPIC"

./configure --prefix=/usr
15. make
16. 
 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 


make runtest
17. make install
18. make clean

--------------------------------------------------


Time to compile dahdi
23. cd ../dahdi-linux-complete-2.5.0.2+2.5.0.2

24. make all


出错处理:You do not appear 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`



25. make install
26. make config


屏幕提示:

/sbin/chkconfig --add dahdi
DAHDI has been configured.

List of detected DAHDI devices:

pci:0000:03:0c.0     wcfxo-       1057:5608 Wildcard X100P

run 'dahdi_genconf modules' to load support for only
the DAHDI hardware installed in this system.  By
default support for all DAHDI hardware is loaded at
DAHDI start.



Time to compile libpri

27. cd ../libpri-1.4.11.4 

(now we are in /usr/src/libpri-1.4.11.4)

28. make
29. make install


30.Time to copmpile Asterisk

注:yum install ncurses-devel (make menuconfig要这个包)


cd asterisk-1.8.10.1

contrib/scripts/install_prereq install


注意:如要mp3,需要执行下面操作
yum install subversion 
contrib/scripts/get_mp3_source.sh


注意:如要ilbc codec,需要执行下面操作
contrib/scripts/get_ilbc_source.sh

cd codec/ilbc/

看到里面只有几个文件

extract-cfile.awk rfc3951.txt

拷贝 http://ilbcfreeware.org/documentation/extract-cfile.txt

内容到extract-cfile.awk

awk -f extract-cfile.awk rfc3951.txt

这将在这个目录下面产生几十个文件。

参考:

http://www.telecom-cafe.com/forum/viewthread.php?tid=3992


31.  cd ../../

./configure --with-bluetooth


32. make menuconfig    (add-on 选择chan_mobile, format_mp3, res_config_mysql,  EXTRAS-SOUNDS-EN-GSM )
Running this command will be show the following menu :



asterisk compilation step.

33. make

34. make install

35. make config
36. make samples (this command will generate sample configuration files for Asterisk, under /etc/Asterisk/ folder)


37. service dahdi restart
38. service asterisk restart


 netstat -na|grep 506
udp        0      0 0.0.0.0:5060                0.0.0.0:*


Add AMR codec support
Before start to configure Asterisk, we would like to add one more tool, we reallly need to use ARM-NB codec (AdaptiveMultirate-Codec Ultra Narrow Band) in conjunction with PrivateGSM Enterprise on a mobile phone to get the best voice quality
using mobile internet connections.
Please consider that G.729 codec does not work for mobile network connections in a reliable way, for example it does not work
over GPRS or in degraded network conditions (that on a mobile, means often).
Be sure to read notes on licensing at the end of this howto in order to properly license the AMR codec.


Stop Asterisk

39. service asterisk stop
We go back to /usr/src/ folder,download the Asterisk-amr patch.
40. cd /usr/src/


Download Asterisk-amr patch
41. wget http://sourceforge.net/projects/asterisk-amr/files/1.8.0-rc2_asterisk_amr_patch.diff/download


Apply the patch for AMR codec
42. cd asterisk-1.8.10.1/ && patch -p2 < ../1.8.0-rc2_asterisk_amr_patch.diff


Go to asterisk-1.8.0-rc2/codecs/amr/ folder
43. cd ../asterisk-1.8.10.1/codecs/amr/
Download AMR codec from 3GPP site
44. wget http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-700.zip
45. unzip -j 26104-700.zip
46. unzip -j 26104-700_ANSI_C_source_code.zip
go back to Asterisk folder /usr/src/asterisk-1.8.0-rc2
47. cd ../.. /..


48. wget http://sourceforge.net/projects/asterisk-amr/files/1.8.0-rc2_crypto_offer.diff/download
Apply the patch
49. cd asterisk-1.8.10.1/ && patch -p2 < ../1.8.0-rc2_crypto_offer.diff

Go to  asterisk-1.8.0-rc2/ folder
50.
50. cd asterisk-1.8.10.1
Recompile Asterisk ,
51. make ; make install



52. asterisk -rvvvvvvvvvvv

core show 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)

================================

CentOS后记:

设置runlevel 3

编辑/etc/inittab

id:3:initdefault:


安装vncserver

yum install vnc

================================

每小时reboot一次:

cd /etc/cron.hourly/

touch reboot

chmod 777 reboot

#!/bin/sh
/sbin/reboot

================================

关闭Ubuntu 防火墙

# service iptables save
# service iptables stop
# chkconfig iptables off

================================

启用amr codec

vi sip_general_additional.conf

修改

disallow=all
allow=ulaw
 allow=alaw

allow=all

重新启动Asterisk

================================
原创粉丝点击