freeswitch的编译安装(ubuntu、debain)

工作中使用freeswitch,期间一些遇到的问题和值得整理成文档的东西,在这边陆续的整理发表一下,如果有疑问的朋友可以留言大家互相交流学习,谢谢。

对于freeswitch的编译,最方便的系统就是debain,按照官方的步骤,很容易可以编译安装完成,尤其是视频支持,步骤如下:

系统:Debian 8 Jessie

wget -O - https://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub | apt-key add -
echo "debhttp://files.freeswitch.org/repo/deb/freeswitch-1.6/ jessie main" >/etc/apt/sources.list.d/freeswitch.list
apt-get update 
apt-getinstall -y --force-yes freeswitch-video-deps-most
# because we're in a branch that will go through many rebases it's
# better to set this one, or you'll get CONFLICTS when pulling (update)
git config --global pull.rebase true
# then let's get the source. Use the -b flag to get a specific branch
cd /usr/src/
git clone https://freeswitch.org/stash/scm/fs/freeswitch.git -bv1.6 freeswitch
cd freeswitch
./bootstrap.sh -j
./configure
make
make install

按照上面的步骤是编译的freeswitch默认的核心部分和模块,如果默认编译的模块中没有需要的(例如需要视频支持的需要放开mod_av模块的编译),那么需要在编译过程中修改需要编译的模块列表,具体是在configure之前,修改源码目录下面的modules.conf文件,将需要改动的模块名字前面增加或者去掉注释就可以了,全部安装完毕之后安装好的freeswitch在目录/usr/local/freeswitch中。

将freeswitch启动脚本添加到系统服务中:

脚本如下,具体路径需要根据自己需要修改:

;;;;; Author: Travis Cross <tc@traviscross.com>

[Unit]
Description=freeswitch
After=syslog.target network.target local-fs.target

[Service]
; service
Type=forking
PIDFile=/usr/local/freeswitch/run/freeswitch.pid
;;;EnvironmentFile=-/etc/default/freeswitch
ExecStart=/usr/local/freeswitch/bin/freeswitch -u fs -g freeswitch -nc -nonat
TimeoutSec=45s
Restart=always
; exec
User=root
Group=daemon
LimitCORE=infinity
LimitNOFILE=100000
LimitNPROC=60000
LimitSTACK=250000
LimitRTPRIO=infinity
LimitRTTIME=infinity
IOSchedulingClass=realtime
IOSchedulingPriority=2
CPUSchedulingPolicy=rr
CPUSchedulingPriority=89
UMask=0007

; alternatives which you can enforce by placing a unit drop-in into
; /etc/systemd/system/freeswitch.service.d/*.conf:
;
; User=freeswitch
; Group=freeswitch
; ExecStart=
; ExecStart=/usr/bin/freeswitch -ncwait -nonat -rp
;
; empty ExecStart is required to flush the list.
;
; if your filesystem supports extended attributes, execute
;   setcap 'cap_net_bind_service,cap_sys_nice=+ep' /usr/bin/freeswitch
; this will also allow socket binding on low ports
;
; otherwise, remove the -rp option from ExecStart and
; add these lines to give real-time priority to the process:
;
; PermissionsStartOnly=true
; ExecStartPost=/bin/chrt -f -p 1 $MAINPID
;
; execute "systemctl daemon-reload" after editing the unit files.

[Install]
WantedBy=multi-user.target

添加到系统服务:
cp /usr/src/freeswitch.git/debian/freeswitch-systemd.freeswitch.service /etc/systemd/system/freeswitch.service
systemctl daemon-reload
启动freeswitch:
systemctl start freeswitch
停止:
systemctl stop freeswitch
设置freeswitch为随机启动:
systemctl enable freeswitch


在ubuntu系统上面编译freeswitch,在mod_av模块方面需要编译安装libav,还有可能在编译过程中缺少一些依赖,需要手动安装的,没有在debain上面那么省力。

系统:Ubuntu 14.04 Trusty

按照官方给出的安装依赖的步骤

wget -O - https://files.freeswitch.org/repo/ubuntu/freeswitch-unstable/freeswitch_archive_g0.pub | apt-key add -
echo "debhttp://files.freeswitch.org/repo/ubuntu/freeswitch-unstable/ trusty main" >/etc/apt/sources.list.d/freeswitch.list
apt-get update && apt-get install -y freeswitch-all
cd /usr/src/
git clone https://freeswitch.org/stash/scm/fs/freeswitch.git -bv1.6 freeswitch
cd freeswitch
./bootstrap.sh -j
./configure
make
make install

需要注意的是,如果在过程中出错,提示缺少某些依赖包或者库,请相应的自行安装,安装完执行 ldconfig确保依赖生效,并且重新执行./configure 直到编译完全通过。具体可能会需要手动安装的依赖,我只记得下面几个:

opus

git clone https://freeswitch.org/stash/scm/sd/opus.git
cd opus
./autogen.sh
./configure
make
make install

libpng

git clone https://freeswitch.org/stash/scm/sd/libpng.git
cd libpng
./configure
make
make install

libsilk

git clone https://freeswitch.org/stash/scm/sd/libsilk.git
cd libsilk
./configure
make
make install

libav
wget -c http://files.freeswitch.org/downloads/libs/libav-12.tar.bz2
tar -jxvf libav-12.tar.bz2
./configure --disable-static --enable-shared --enable-pic
make CXXFLAGS="-fPIC"
make install


官方页面参照:

https://freeswitch.org/confluence/display/FREESWITCH/Debian+8+Jessie

https://freeswitch.org/confluence/display/FREESWITCH/Ubuntu+14.04+Trusty

https://freeswitch.org/confluence/display/FREESWITCH/FreeSWITCH+1.6+Video

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

大头菜馅馒头

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值