1、yum 安装相关的依赖包
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 Python/ target=_blank class=infotextkey>Python26-devel python-devel soundtouch-devel speex-devel sqlite-devel unbound-devel unixODBC-devel libuuid-devel which yasm zlib-devel
2、安装 mod_shout 模块以支持 mp3 格式
yum install -y libshout-devel lame-devel libmpg123-devel
wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar -zxvf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure --enable-static --enable-shared
make
make install
vi /etc/ld.so.conf
#换行加入:/usr/local/lib
#保存退出 :wq
ldconfig
3、安装 cmake
yum remove cmake
wget https://cmake.org/files/v3.14/cmake-3.14.0.tar.gz
tar vzxf cmake-3.14.0.tar.gz
cd cmake-3.14.0
./configure
make
make install
4、 安装 libks
yum install libatomic
git clone https://Github.com/signalwire/libks.git
cd libks
cmake .
make
make install
5、安装 signalwire-c
git clone https://github.com/signalwire/signalwire-c.git
cd signalwire-c/
cmake .
make
make install
ln -sf
/usr/local/lib64/pkgconfig/signalwire_client.pc
/usr/lib64/pkgconfig/signalwire_client.pc
6、下载并安装 freeswitch1.8
如下 git 为国内址,速度较快,也可以从官方下载源码
git clone -b v1.8 https://git.oschina.net/nwaycn/freeswitch.git
./bootstrap.sh -j
./configure --enable-portable-binary
--prefix=/usr/local/freeswitch
--with-gnu-ld --with-python --with-openssl
--enable-core-odbc-support --enable-zrtp
--enable-libmp3lame
make
make -j install
如下安装语音文件,用时会较长
make -j cd-sounds-install
make -j cd-moh-install
7、安装后的一些操作
设置全局命令软连接
ln -sf /usr/local/freeswitch/bin/freeswitch /usr/bin/
ln -sf /usr/local/freeswitch/bin/fs_cli /usr/bin/
禁用 freeswitch 上 ipv6
mv external-ipv6.xml external-ipv6.xml.inactive
mv internal-ipv6.xml internal-ipv6.xml.inactive
8、启动 freeswitch
freeswitch -nc #后台启动
freeswitch 常用命令
#列出 internal SIP Profile 的状态
sofia status profile internal
#列出某个 Profile 上所有已注册用户
sofia status profile internal reg
#过滤某些符合条件
sofia status profile internal reg 1000
sofia status profile internal user 1000
#列出网关状态
sofia status gateway gw1
#以上命令都可以将 status 用 xmlstatus 来代替,以列出 XML 格式的状态,这样比较容易用
于其他程序解析
#启动、停止、重启某个 Profile 的命令
sofia profile internal start #启动
sofia profile internal stop #停止
sofia profile internal restart #重启
#有时候修改了某个 Profile 的某个参数,不需要重启(重启是影响通话的),可以使用下列
命令让 FreeSWITCH 重读 sofia 的配置
#注意并不是所有的参数都能生效
sofia profile internal rescan
#添加了一个新的 gateway 以后,也可以使用 rescan 指令读取
sofia profile external rescan
#如果是修改了一个网关,则可以先删除该网关,再 rescan
sofia profile external killgw gw1
sofia profile external rescan
#下列命令可以指定某个网关立即向外注册或注销
sofia profile external register gw1
sofia profile external unregister
#开启该 Profile 的 SIP 跟踪功能抓 SIP 包
sofia profile internal siptrace on
#有时候,希望将已经注册的用户清理掉,可以使用如下命令,注意此命令只是临时清理,
客户端重新注册的话还是可以注册成功的
sofia profile internal flush_inbound_reg 1000@192.168.1.7
#也可以根据 call-id 来清理
sofia profile internal reg 1000 #通过此命令查找到 call-id 的值
sofia profile flush_inbound_reg zsfsdfhdfgdfsdfsdfsdfsdf #清除 call-id=zsfsdfhdfgdfsdfsdfsdfsdf 的用户