yum install -y git gcc-c++ wget alsa-lib-devel autoconf automake bison broadvoice-devel bzip2 curl-devel db-devel e2fsprogs-devel flite-devel g722_1-devel gdbm-devel gnutls-devel ilbc2-devel ldns-devel libcodec2-devel libcurl-devel libedit-devel libidn-devel libjpeg-devel libmemcached-devel libogg-devel libsilk-devel libsndfile-devel libtiff-devel libtheora-devel libtool libvorbis-devel libxml2-devel lua-devel lzo-devel mongo-c-driver-devel ncurses-devel net-snmp-devel openssl-devel opus-devel pcre-devel perl perl-ExtUtils-Embed pkgconfig portaudio-devel postgresql-devel python26-devel python-devel soundtouch-devel speex-devel sqlite-devel unbound-devel unixODBC-devel libuuid-devel which yasm zlib-develnode
三、wget http://files.freeswitch.org/freeswitch-releases/freeswitch-1.8.2.tar.bz2python
四、tar xvjf freeswitch-1.8.2.tar.bz2linux
五、cd freeswitch-1.8.2c++
六、./configuregit
七、make installgithub
---------------------------以上是安裝freeswitch 下面是安裝聲音文件---------------------------sql
語音包是安裝在 /usr/local/freeswitch-1.8.2/sounds 下的express
一、make sounds-installvim
二、make moh-installpromise
安裝 以前, 最好 先安裝 這幾個東西(若是有, 請忽略):
yasm (有nasm的話 不用裝這個) ,
opus-devel(可能 提示 libopus-dev 或 libopus-devel 等) ,
lua-devel , libsndfile-devel , libtiff-devel
固然了, 你也能夠 先無論, 等 出錯 提示了, 在按照下面的方法安裝:
1. 安裝 yasm , yasm 和 nasm 必需要有一個,必須裝了!
錯誤提示: Neither yasm nor nasm have been found
((which nasm) || (which yasm) || (git clone https://github.com/yasm/yasm.git && cd yasm && ./autogen.sh && make && make install))
錯誤提示: 找不到 lua.h 等lua的頭文件
yum install lua lua-devel
錯誤提示: You must install libopus-dev to build mod_opus
yum -y install opus-devel
#可能須要清理: make clean && ./configure && make
若是仍是報這個錯誤, 就註釋這兩行,在Makefile:
vim freeswitch/src/mod/codecs/mod_opus/Makefile
# Comment line 896 & 897
#install: error
#all: error
錯誤提示 : You must install libsndfile-dev to build mod_sndfile
#下載包libsndfile-x.x.xx.tar.gz from地址 http://www.mega-nerd.com/libsndfile/#Download, 而後
tar zxvf libsndfile-1.0.26.tar.gz
./configure
make
make install
cp /usr/local/lib/pkgconfig/sndfile.pc /usr/lib64/pkgconfig
#而後 從新 configure FreeSWITCH...
若是仍是報這個錯誤,就註釋這兩行,在Makefile:
vim src/mod/formats/mod_sndfile/Makefile
# Comment line 897 & 898
#install: error
#all: error
錯誤提示: You must install libyuv-dev to build mod_fsv
cd freeswitch/libs
git clone https://freeswitch.org/stash/scm/sd/libyuv.gitcd libyuv
make -f linux.mk CXXFLAGS="-fPIC -O2 -fomit-frame-pointer -Iinclude/"
make install
cp /usr/lib/pkgconfig/libyuv.pc /usr/lib64/pkgconfig/
錯誤提示: You must install libvpx-dev to build ....
cd freeswitch/libs
git clone https://freeswitch.org/stash/scm/sd/libvpx.git
cd libvpx
./configure --enable-pic --disable-static --enable-shared
make
make install
cp /usr/local/lib/pkgconfig/vpx.pc /usr/lib64/pkgconfig
7.安裝 libpng
錯誤提示: You must install libpng-dev to build ....
git clone https://freeswitch.org/stash/scm/sd/libpng.git
cd libpng
./configure
Make
make install
cp /usr/local/lib/pkgconfig/libpng* /usr/lib64/pkgconfig/
8.安裝 libav
錯誤提示: You must install libav-dev to build ....
git clone https://freeswitch.org/stash/scm/sd/libav.git
cd libav
./configure #CFLAGS="-fPIC" ./configure --enable-pic --enable-shared
make # make CXXFLAGS="-fPIC"
make install
二. 其餘問題
1.錯誤提示: libs/spandsp
configure: loading cache ../../config.cache
configure: error: `CFLAGS' was not set in the previous run
configure: error: `CPPFLAGS' was not set in the previous run
configure: error: in `/usr/src/freeswitch.git/libs/spandsp':
configure: error: changes in the environment can compromise the build
configure: error: run `make distclean' and/or `rm ../../config.cache' and start over
解決: 從新 configure
./configure -C && make
三. 安裝中文語音
fs默認不加載中文語音。須要在fs的src中首先編譯中文模塊。
1.編譯:
a.在 configure 以前, 編輯 modules.conf, 取消 "#say/mod_say_zh" 這行的註釋 ->"say/mod_say_zh"
b.補救安裝 `make mod_say_zh-install`
2.加載(不重啓fs)
在fs控制檯上加載該模塊 `load mod _say_zh`
若想fs在每次啓動的時候都加載該模塊,就在`autoload_configs/modules.conf.xml`中`<load module="mod_say_zh">`的註釋去掉便可。
也能夠這樣:
sed -i 's#<!-- <load module="mod_say_zh"/> -->#<load module="mod_say_zh"/>#g' autoload_configs/modules.conf.xml
3.修改 `var.xml`中的配置
`<X-PRE-PROCESS cmd="set" data="sound_prefix=$${sounds_dir}/en/us/callie"/>`修改成中文語音文件的目錄
`<X-PRE-PROCESS cmd="set" data="sound_prefix=$${sounds_dir}/zh/cn/link"/>`
加入如下幾行(也能夠不加)
<X-PRE-PROCESS cmd="set" data="default_language=zh"/>
<X-PRE-PROCESS cmd="set" data="default_dialect=cn"/>
<X-PRE-PROCESS cmd="set" data="default_voice=sue"/>
4.加入中文語音配置
cd conf/lang
cp -R en zh
mv zh/en.xml zh/zh.xml
vim zh/zh.xml
(替換路徑`en/us/callie`和 `en`等:第二行修改成)
<language name="zh" say-module="zh" sound-prefix="$${sounds_dir}/zh/cn/link" tts-engine="cepstral" tts-voice="link">
或者修改zh.xml
<language name="zh" say-module="zh" sound-prefix="$${sound_prefix}/zh/cn/link" tts-engine="mod_tts_commandline" tts-voice="link">
七、/usr/local/freeswitch/conf/freeswitch.xml
在61行增長 <X-PRE-PROCESS cmd="include" data="lang/zh/*.xml"/>
8、控制檯 reloadxml
5. 載入中文配置
在`freeswitch.xml`的`<section name="languages" `節點中增長一行 (或那一行取消註釋)
` <X-PRE-PROCESS cmd="include" data="lang/zh/*.xml"/>`
四. 解決ESL拒絕鏈接問題
默認是隻接受本機鏈接的,稍一改動就 內外都不能鏈接了,或者只能接受內外之一鏈接
解決方法:
1. event_socket.conf.xml 加入:
<param name="apply-inbound-acl" value="domains"/>
2. acl.conf.xml 加入:
<list name="domains" default="deny">
<node type="allow" domain="$${domain}"/>
<node type="allow" cidr="192.168.1.0/24"/>
<node type="allow" cidr="127.0.0.1/24"/>
</list>
修改撥碼計劃
打開文件../freeswitch/conf/dialplan/default.xml
找到Local_Extension節點
<extension name="Local_Extension">
<condition field="destination_number" expression="^(10[01][0-8])$">
在其下,添加:
<action application="set" data="RECORD_TITLE=Recording ${destination_number} ${caller_id_number} ${strftime(%Y-%m-%d %H:%M)}"/>
<action application="set" data="RECORD_COPYRIGHT=(c) 2011"/>
<action application="set" data="RECORD_SOFTWARE=FreeSWITCH"/>
<action application="set" data="RECORD_ARTIST=FreeSWITCH"/>
<action application="set" data="RECORD_COMMENT=FreeSWITCH"/>
<action application="set" data="RECORD_DATE=${strftime(%Y-%m-%d %H:%M)}"/>
<action application="set" data="RECORD_STEREO=true"/>
<action application="record_session" data="$${base_dir}/recordings/archive/${strftime(%Y-%m-%d-%H-%M-%S)}_${destination_number}_${caller_id_number}.wav"/>
安裝完freeswitch後,測試中發現呼叫請求服務器處理的特別慢,後來跟蹤發如今/usr/local/freeswitch/conf/dialplan/default.xml中有個sleep 10s的處理,
<condition field="${default_password}" expression="^1234$" break="never">
<action application="log" data="CRIT WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING "/>
<action application="log" data="CRIT Open $${conf_dir}/vars.xml and change the default_password."/>
<action application="log" data="CRIT Once changed type 'reloadxml' at the console."/>