CentOS 5 8 asterisk-1 8 10 1 安裝之一 安裝,新增藍芽支援,新增AMR-NB audio c
為什麼我要安裝比較老的asterisk-1.8.10.1,而不是更加新的穩定版本?
因為我還要加AMR-NB audio codec。
CentOS使用者準備:useradd asterisk
1.下載CentOS 5.8
國內高速下載
http://mirrors.163.com/centos/5.8/isos/i386/CentOS-5.8-i386-bin-DVD-1of2.isohttp://mirrors.163.com/centos/5.8/isos/i386/CentOS-5.8-i386-bin-DVD-2of2.iso2.Windows XP上用Vmware Player安裝CentOS虛擬機器
3.Download Asterisk , DAHDI, libpri, libSRTP. First got to /usr/src/ directorysu -cd /usr/src4.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.gz6.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 unzipExtract Asterisk & DAHDi & libpri & libsrtp9.tar -xzvf asterisk-1.8.10.1.tar.gzCFLAGS="-Wall -O4 -fexpensive-optimizations -funroll-loops -fPIC"
./configure --prefix=/usr15. make16. 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 runtest17. make install18. make clean--------------------------------------------------
Time to compile dahdi23. cd ../dahdi-linux-complete-2.5.0.2+2.5.0.224. 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 install26. make config螢幕提示:
/sbin/chkconfig --add dahdiDAHDI has been configured.List of detected DAHDI devices:pci:0000:03:0c.0 wcfxo- 1057:5608 Wildcard X100Prun 'dahdi_genconf modules' to load support for onlythe DAHDI hardware installed in this system. Bydefault support for all DAHDI hardware is loaded atDAHDI start.
Time to compile libpri27. cd ../libpri-1.4.11.4
(now we are in /usr/src/libpri-1.4.11.4)
28. make29. make install30.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
內容到extract-cfile.awk
awk -f extract-cfile.awk rfc3951.txt
這將在這個目錄下面產生幾十個檔案。
參考:
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 config36. make samples (this command will generate sample configuration files for Asterisk, under /etc/Asterisk/ folder)37. service dahdi restart38. service asterisk restartnetstat -na|grep 506udp 0 0 0.0.0.0:5060 0.0.0.0:*
Add AMR codec supportBefore 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 qualityusing 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 workover 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 stopWe go back to /usr/src/ folder,download the Asterisk-amr patch.40. cd /usr/src/Download Asterisk-amr patch41. wget http://sourceforge.net/projects/asterisk-amr/files/1.8.0-rc2_asterisk_amr_patch.diff/downloadApply the patch for AMR codec42. cd asterisk-1.8.10.1/ && patch -p2 < ../1.8.0-rc2_asterisk_amr_patch.diffGo to asterisk-1.8.0-rc2/codecs/amr/ folder43. cd ../asterisk-1.8.10.1/codecs/amr/Download AMR codec from 3GPP site44. wget http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-700.zip45. unzip -j 26104-700.zip46. unzip -j 26104-700_ANSI_C_source_code.zipgo back to Asterisk folder /usr/src/asterisk-1.8.0-rc247. cd ../.. /..48. wget http://sourceforge.net/projects/asterisk-amr/files/1.8.0-rc2_crypto_offer.diff/downloadApply the patch49. cd asterisk-1.8.10.1/ && patch -p2 < ../1.8.0-rc2_crypto_offer.diffGo to asterisk-1.8.0-rc2/ folder50.50. cd asterisk-1.8.10.1Recompile Asterisk ,51. make ; make install52. 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
================================
# service iptables save# service iptables stop# chkconfig iptables off
================================
啟用amr codec
vi sip_general_additional.conf
修改
disallow=allallow=ulaw allow=alaw為allow=all
重新啟動Asterisk
================================後續: