2.1 安装
yum install git gcc-c++ autoconf automake libtool wget python ncurses-devel zlib-devel libjpeg-devel openssl-devel e2fsprogs-devel sqlite-devel libcurl-devel pcre-devel speex-devel ldns-devel libedit-devel
yum install lua lua-devel
wget http://files.freeswitch.org/freeswitch-releases/freeswitch-1.6.0.tar.gz
cd freeswitch-1.6.0
./configure --disable-debug --disable-libyuv --disable-libvpx --enable-core-odbc-support
make
make install
出现了下面的错误:
make[4]: Entering directory `/usr/local/src/freeswitch-1.6.0/src/mod/formats/mod_sndfile'
Makefile:796: *** You must install libsndfile-dev to build mod_sndfile. Stop
解决方法:
下载包libsndfile-1.0.26.tar.gz 上传到服务器
下载地址 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
重新执行重新执行FreeSWITCH的“./configure”,再make make install
下载yasm并编译
yasm是一个汇编编译器,是nasm的升级版
可以直接yum install yasm
或者下载源码包安装
yasm下载地址:http://www.tortall.net/projects/yasm/releases/
yasm解压命令:tar -zxvf ****.tar.gz
yasm编译安装:① ./configure, ② make, ③make install
yasm安装完毕之后回到第二步重新安装libvpx
下载opus并编译
cd ..
git clone https://freeswitch.org/stash/scm/sd/opus.git
cd opus
./autogen.sh
./configure
make
make install
cp /usr/local/lib/pkgconfig/opus.pc /usr/lib64/pkgconfig
下载libpng并编译
cd ..
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/
重新执行FreeSWITCH的“./configure”之后,“make && make install”安装FreeSWITCH了
然后根据需要安装语音包
make cd-sounds-install
make cd-moh-install
安装简单的配置文件
make samples
以上便完成了安装,但是启动的时候又报错了:
root@localhost bin]# ./freeswitch
./freeswitch: error while loading shared libraries: libyuv.so: cannot open shared object file: No such file or directory
解决办法: cp /usr/lib/libyuv.so /usr/lib64/
然后就可以正常启动的
conf\autoload_configs\opus.conf.xml
2.2.2 OPUS带宽设置
<configuration name="opus.conf">
<settings>
<param name="use-vbr" value="1"/>
<!--<param name="use-dtx" value="1"/>-->
<param name="complexity" value="10"/>
<!-- Set the initial packet loss percentage 0-100 -->
<!--<param name="packet-loss-percent" value="10"/>-->
<!-- Support asymmetric sample rates -->
<!--<param name="asymmetric-sample-rates" value="1"/>-->
<!-- Keep FEC Enabled -->
<param name="keep-fec-enabled" value="1"/>
<!--<param name="use-jb-lookahead" value="true"/> -->
<!--
maxaveragebitrate: the maximum average codec bitrate (values: 6000 to 510000 in bps) 0 is not considered
maxplaybackrate: the maximum codec internal frequency (values: 8000, 12000, 16000, 24000, 48000 in Hz) 0 is not considered
This will set the local encoder and instruct the remote encoder trough specific "fmtp" attibute in the SDP.
Example: if you receive "maxaveragebitrate=20000" from SDP and you have set "maxaveragebitrate=24000" in this configuration
the lowest will prevail in this case "20000" is set on the encoder and the corresponding fmtp attribute will be set
to instruct the remote encoder to do the same.
-->
<param name="maxaveragebitrate" value="6000"/>
<param name="maxplaybackrate" value="8000"/>
<!-- Max capture rate, 8000, 12000, 16000, 24000 and 48000 are valid options -->
<param name="sprop-maxcapturerate" value="8000"/>
</settings>
</configuration>
2.2.3 公网IP
conf\sip_profiles\external.xml
<param name="ext-rtp-ip" value="120.77.183.212"/>
<param name="ext-sip-ip" value="120.77.183.212"/>
conf\sip_profiles\internal.xml
<param name="ext-rtp-ip" value="120.77.183.212"/>
<param name="ext-sip-ip" value="120.77.183.212"/>
<param name="tls-cert-dir" value="/usr/local/freeswitch/certs"/>
2.2.4编码配置
conf\vars.xml
<X-PRE-PROCESS cmd="set" data="global_codec_prefs=OPUS,G722,PCMU,PCMA"/>
<X-PRE-PROCESS cmd="set" data="outbound_codec_prefs=OPUS,G722,PCMU,PCMA"/>
<X-PRE-PROCESS cmd="set" data="internal_ssl_enable=true"/>
<X-PRE-PROCESS cmd="set" data="external_ssl_enable=true"/>
2.2.5 录音
首先备份/usr/local/freeswitch/conf/dialplan/default.xml
然后vi编辑default.xml ,在
<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"/>
大家应该看明白了,录音会自动存放在${base_dir}/recordings/archive下。
2.2.6 Change Default Password
/usr/loca/freeswitch/conf/vars.xml
<X-PRE-PROCESS cmd="set" data="default_password=MAKE_GOOD_PASSWORD"/>
service freeswitch restart