• centos7下编译安装freeswitch及常见编译问题的解决



    前言

    freswitch在centos7下编译总体上还是不难的,但一些看似很难实则很容易甚至不需要解决的问题往往会”欺负“一些初学者(比如说本人);本文主要介绍centos7下freeswitch的编译过程,和常见的编译中问题及解决方法。



    一、环境

    centos 7.6
    freeswitch 1.10.7


    二、安装依赖

    freeswitch的依赖非常多,如果不安装依赖就开始编译freeswitch,那就遇到更多的问题,安装依赖之后,可以解决90%以上的问题。

    安装依赖命令如下:

    yum install -y https://files.freeswitch.org/repo/yum/centos-release/freeswitch-release-repo-0-1.noarch.rpm epel-release 
    
    yum install -y yum-utils --enablerepo=extras 
    
    yum install -y yum-plugin-ovl centos-release-scl rpmdevtools yum-utils git wget vim devtoolset-7-gcc* devtoolset-7 libtiff-devel cmake3 libatomic unixODBC unixODBC-devel.x86_64 postgresql-libs postgresql-devel libpqxx-devel
    
    yum install -y gcc-c++ autoconf automake libtool ncurses-devel zlib-devel libjpeg-devel openssl-devel e2fsprogs-devel sqlite-devel libcurl-devel pcre-devel speex-devel ldns-devel libedit-devel libxml2-devel libyuv-devel libvpx-devel libvpx2* libdb4* libidn-devel unbound-devel libuuid-devel lua-devel libsndfile-devel yasm-devel
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    三、下载源码

    freeswitch下载地址: https://github.com/signalwire/freeswitch.git
    另外有两个比较重新的库需要手动安装,分别是spandsp和sofia-sip

    下载命令:

    cd /data
    git clone -b v1.10.7 https://github.com/signalwire/freeswitch
    cd /data/freeswitch
    git clone https://github.com/freeswitch/spandsp.git
    git clone https://github.com/freeswitch/sofia-sip.git
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    四、编译

    1. 编译必需库

    首先,要先编译spandsp和sofia-sip, 否则freeswitch在configure阶段会报错。

    #编译spandsp
    cd /data/freeswitch/spandsp
    ./bootstrap.sh
    ./configure
    make
    make install
    
    #编译sofia-sip
    cd /data/freeswitch/sofia-sip
    ./bootstrap.sh
    ./configure
    make
    make install
    
    #添加库的路径到系统
    export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:${PKG_CONFIG_PATH} 
    ldconfig
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17

    2. 修改module.conf

    下面则是安装freeswitch, 由于freeswitch支持动态编译和动态加载,一些不需要的模块可以不编译,如:mod_signalwire、mod_av,修改方法:

    找到module.conf文件,找到mod_signalwire和mod_av注释掉,修改如下:

    #applications/mod_signalwire
    #applications/mod_av
    
    • 1
    • 2

    3. 编译freeswitch

    有了前两步的准备,编译freeswitch基本就不会遇到问题了,命令如下:

    cd /data/freeswitch
    ./bootstrap.sh
    ./configure --enable-portable-binary --prefix=/usr/local/freeswitch --with-gnu-ld --with-python --with-openssl --enable-core-odbc-support --enable-zrtp
    make
    make install
    
    • 1
    • 2
    • 3
    • 4
    • 5

    五、验证

    freeswitch安装完成之后,下一步就是启动freeswitch并验证可用性了。

    首先

    1. 启动freeswitch

    cd /usr/local/freeswitch/bin
    ./freeswitch -nonat
    
    • 1
    • 2

    启动成功:
    在这里插入图片描述

    2. 验证必要端口是否启动

    检查5060、5066、8021等端口是否启动(还有其他端口,但现在只需要看这几个端口就可以证明freeswitch启动正常了)。

    netstat -anp |grep freeswitch
    在这里插入图片描述

    另外,可以软电话注册到freeswitch验证,这里不再赘述。

    六、常见编译问题

    首先,谨记的是先安装依赖,可以解决90%以上的编译问题!

    1. checking for spandsp >= 3.0… configure: error: no usable spandsp; please install spandsp3 devel package or equivalent
      在这里插入图片描述
      这个问题是缺少依赖库spandsp, 安装方法参见本文步骤《 四、编译->2. 修改module.conf》。

    2. checking for sofia-sip-ua >= 1.13.6… configure: error: no usable sofia-sip; please install sofia-sip-ua devel package or equivalent

    在这里插入图片描述
    这个是由于缺少依赖库sofia-sip,安装方法参见本文步骤《 四、编译->2. 修改module.conf》。


    3. *** You must install signalwire-client-c to build mod_signalwire. Stop.
    在这里插入图片描述
    报错的是mod_signalwire, 这个模块怎么看也是不需要的,注释掉它,注释方法在本文步骤《四、编译-> 1.编译必需库》。


    4. **** You must install libavformat-dev and libswscale-dev to build mod_av. Stop.
    在这里插入图片描述
    由于项目没有用到mod_av模块,选择注释掉,注释方法在本文步骤《四、编译-> 1.编译必需库》。

    总结

    本文介绍freeswitch在centos7下的编译过程,和一些常见的编译问题及其解决办法。如果觉得有帮助,可以关注一下博主~

  • 相关阅读:
    RCNN系列1:RCNN介绍
    hue编译、启动、使用
    如何用好Nginx的gzip指令
    ROS-Ubuntu 版本相关
    Java面试、面经丨从试题到面试讲个遍
    在listener.ora配置文件中配置listener 1527的监听并且使用tnsnames连接测试
    递归法求二进制
    wgcna 原文复现 小胶质细胞亚群在脑发育时髓鞘形成的作用 microglial
    JS-语法-变量(声明、命名规范、一次性声明多个变量、使用)
    Tinker源码解析
  • 原文地址:https://blog.csdn.net/xxm524/article/details/125582663