首页  :: 新随笔  :: 管理

centos 7.5源码安装freeswitch 1.10.3

Posted on 2020-06-06 16:54  季枫  阅读(1628)  评论(0编辑  收藏  举报

1、下载freeswitch安装包(freeswitch-1.10.2.-release.tar.gz)

yum install -y http://files.freeswitch.org/freeswitch-release-1-6.noarch.rpm epel-release

wget http://files.freeswitch.org/releases/freeswitch/freeswitch-1.10.3.-release.tar.bz2

2、安装对应依赖

yum install -y git alsa-lib-devel autoconf automake bison broadvoice-devel bzip2 curl-devel libdb4-devel e2fsprogs-devel erlang flite-devel g722_1-devel gcc-c++ 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 libtheora-devel libtiff-devel libtool libuuid-devel 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-devel python-devel soundtouch-devel speex-devel sqlite-devel unbound-devel unixODBC-devel wget which yasm zlib-devel libshout-devel libmpg123-devel lame-devel

  

3、安装cmake

yum remove cmake #卸载yum安装的版本,若无安装则忽略
cd /usr/local/src
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

cd /usr/local/src
yum install libatomic
git clone https://github.com/signalwire/libks.git
cd libks
cmake .
make
make install

5、安装signalwire-c

cd /usr/local/src
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、编译x264

wget https://www.nasm.us/pub/nasm/releasebuilds/2.14/nasm-2.14.tar.gz
tar -zxvf nasm-2.14.tar.gz
cd nasm-2.14
./configure
make
make install

cd /usr/local/src
git clone https://git.videolan.org/git/x264.git cd ../x264 ./configure --enable-shared --enable-static --disable-opencl make make install cp /usr/local/lib/pkgconfig/x2* /usr/lib64/pkgconfig #否则libav在configure时会提示ERROR:x264 not found

7、编译安装mod_av

wget http://download1.rpmfusion.org/free/el/updates/7/x86_64/x/x264-libs-0.148-24.20170521gitaaa9aa8.el7.x86_64.rpm
wget http://download1.rpmfusion.org/free/el/updates/7/x86_64/x/x264-devel-0.148-24.20170521gitaaa9aa8.el7.x86_64.rpm
rpm -hiv x264-libs-0.148-24.20170521gitaaa9aa8.el7.x86_64.rpm
rpm -hiv x264-devel-0.148-24.20170521gitaaa9aa8.el7.x86_64.rpm
cd /usr/local/src
wget https://libav.org/releases/libav-12.3.tar.gz
tar -zxvf libav-12.3.tar.gz

需要修改源码解决错误:

libav编译时出错:
libavcodec/libx264.c: In function ‘X264_frame’:
libavcodec/libx264.c:246:9: error: ‘x264_bit_depth’ undeclared (first use in this function)
if (x264_bit_depth > 8)
^
libavcodec/libx264.c:246:9: note: each undeclared identifier is reported only once for each function it appears in
libavcodec/libx264.c: In function ‘X264_init_static’:
libavcodec/libx264.c:707:9: error: ‘x264_bit_depth’ undeclared (first use in this function)
if (x264_bit_depth == 8)
vim libavcodec/libx264.c

 static av_cold void X264_init_static(AVCodec *codec)
 {
-    if (x264_bit_depth == 8)
+    if (X264_BIT_DEPTH == 8)
         codec->pix_fmts = pix_fmts_8bit;
-    else if (x264_bit_depth == 9)
+    else if (X264_BIT_DEPTH == 9)
         codec->pix_fmts = pix_fmts_9bit;
-    else if (x264_bit_depth == 10)
+    else if (X264_BIT_DEPTH == 10)
         codec->pix_fmts = pix_fmts_10bit;
}

另外还有一行使用了变量x264_bit_depth,也要替换成X264_BIT_DEPTH

遇到错误:undefined reference to x264_encoder_open

注释掉这行:

//x4->enc = x264_encoder_open(&x4->params);

改掉代码后重新执行

tar -zxvf libav-12.3.tar.gz
./configure --enable-pic --enable-shared  --enable-libx264 --enable-gpl --extra-libs="-ldl"
make                                                                                  
make install
cp /usr/local/lib/pkgconfig/libavcodec.pc    /usr/lib64/pkgconfig/
cp /usr/local/lib/pkgconfig/libavdevice.pc   /usr/lib64/pkgconfig/
cp /usr/local/lib/pkgconfig/libavfilter.pc   /usr/lib64/pkgconfig/
cp /usr/local/lib/pkgconfig/libavformat.pc   /usr/lib64/pkgconfig/
cp /usr/local/lib/pkgconfig/libavresample.pc /usr/lib64/pkgconfig/
cp /usr/local/lib/pkgconfig/libavutil.pc     /usr/lib64/pkgconfig/
cp /usr/local/lib/pkgconfig/libswscale.pc    /usr/lib64/pkgconfig/
ldconfig  #动态链接库管理命令,其目的为了让动态链接库为系统所共享

8、编译freeswitch

 

cd /usr/local/src/
tar xvjf  freeswitch-1.10.3.-release.tar.bz2
cd freeswitch-1.10.2.-release
./configure 
make
make install
# freeswitch其默认的安装位置是/usr/local/freeswitch

 

# 后台启动命令
freeswitch -nc -rp
 
# 进入命令
fs_cli
 
# 退出命令
/exit 
/bye 
等等...
 
# fs_cli报错
fs_cli.c:1673 main() Error Connecting [] 
# 解决方法
vim /usr/local/freeswitch/conf/autoload_configs/event_socket.conf.xml 
<param name="listen-ip" value="::"/>  改为 <param name="listen-ip" value="0.0.0.0"/>

  

 

 

 

 https://blog.csdn.net/weixin_43069862/article/details/105409504

https://blog.csdn.net/tidehc/article/details/86593130

 

 

 

 

 

 

 

智读 | 成都会领科技有限公司官网 | 智读App下载 | 每天听本书的博客 | |