Centos7安装Freeswitch并加载mod_ilbc

系统:centos 7 1611 64
freeSWITCH版本:1.6.14 64

一、安装FreeSWITCH
1.下载源代码

wget http://files.freeswitch.org/freeswitch-releases/freeswitch-1.6.14.tar.gz

2.编译
运行 ./devel_bootstrap.sh
如果会出现类似autoconf not found错误提示,是因为没有下载第三方依赖库。
freeswitch依赖的第三方库有: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, python26-devel ,python-devel ,soundtouch-devel,speex-devel, sqlite-devel ,unbound-devel, unixODBC-devel ,libuuid-devel ,which yasm zlib-devel

3.安装依赖库:
(1)可以一个个安装,如下:

yum install autoconf
yum install automake 
yum install libtool 
…… 

(2)也可以全部一起安装:

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 python26-devel python-devel soundtouch-devel speex-devel sqlite-devel unbound-devel unixODBC-devel libuuid-devel which yasm zlib-devel

4.再一次编译
运行 ./devel_bootstrap.sh
接着运行 ./configure
如果出现以下界面,就是默认配置成功.
Centos7安装Freeswitch并加载mod_ilbc_第1张图片

5.选择安装的模块
编辑freeswitch-1.6.14/modules.conf 文件去掉模块前的”#”限可增加相应模块

[root@Freeswitch freeswitch]# more modules.conf 
    #applications/mod_abstraction
    #applications/mod_av
    #applications/mod_avmd
    #applications/mod_bert
    #applications/mod_blacklist
    #applications/mod_callcenter
    #applications/mod_cidlookup
    #applications/mod_cluechoo
    applications/mod_commands
    applications/mod_conference
    #applications/mod_curl
    #applications/mod_cv
    applications/mod_db
    --More--(8%)

注:加载mod_ilbc时不需要配置modules.conf使之加载,因为配置了也不会编译成功,会报找不到libilbc-devel。而且centos 7中yum install libilbc-devel不成功(找不到相关),用源码编译出libilbc.so还是会提示找不到libilbc-devel。解决办法往下看。

6.运行 make 命令
如果出现以下界面,则编译成功。
Centos7安装Freeswitch并加载mod_ilbc_第2张图片

7.安装
运行make install命令,缺省安装目录/usr/local/freeswitch/
如果出现以下界面,则安装成功。
Centos7安装Freeswitch并加载mod_ilbc_第3张图片

8.启动freeswitch
进入cd /usr/local/freeswitch/bin/目录,然后运行 ./freeswitch命令。
如果出现以下界面,则运行成功。
Centos7安装Freeswitch并加载mod_ilbc_第4张图片

二、加载mod_ilbc
freeswitch 要加载mod_ilbc就得有mod_ilbc.so和mod_ilbc.la。
mod_ilbc.so依赖libilbc.so。

1.编译libilbc.so

[root@localhost ~]# cd /root/freeswitch-1.6.14/libs/ilbc
[root@localhost ilbc]# aclocal
[root@localhost ilbc]# autoconf
[root@localhost ilbc]# Autoheader
[root@localhost ilbc]# libtoolize --automake --copy --debug --force
[root@localhost ilbc]# automake --add-missing(生成configure文件)
[root@localhost ilbc]# ./configure
[root@localhost ilbc]# make

验证是否生成libilbc.so
Centos7安装Freeswitch并加载mod_ilbc_第5张图片

2.编译mod_ilbc.so
i. 从FreeSWITCH1.4.4中拷贝mod_ilbc.la(从Google得知1.4版本还可以加载mod_ilbc,但是mod_ilbc.so不可用)

 [root@localhost mod]# vim mod_ilbc.la
    # mod_ilbc.la - a libtool library file
    # Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.1
    #
    # Please DO NOT delete this file!
    # It is necessary for linking the library.

    # The name that we can dlopen(3).
    dlname='mod_ilbc.so'

    # Names of this library.
    library_names='mod_ilbc.so mod_ilbc.so mod_ilbc.so'

    # The name of the static archive.
    old_library=''

    # Linker flags that can not go in dependency_libs.
    inherited_linker_flags=' -pthread'

    # Libraries that this one depends upon.
    dependency_libs=' /usr/local/freeswitch/lib/libfreeswitch.la -L/root/freeswitch-1.4.4/libs/apr-util/xml/expat/lib /usr/local/freeswitch/lib/libexpat.la /us
    r/local/freeswitch/lib/libapr-1.la -lpthread -lsqlite3 -lcurl -lpcre -lspeex -lspeexdsp -ledit -ltinfo -ldl -lcrypt -lrt -lz -lm -lssl -lcrypto -ljpeg'
    # Names of additional weak libraries provided by this library
    weak_library_names=''

    # Version information for mod_ilbc.
    current=0
    age=0
    revision=0

    # Is this an already installed library?
    installed=yes

    # Should we warn about portability when linking against -modules?
    shouldnotlink=yes

    # Files to dlopen/dlpreopen
    dlopen=''
    dlpreopen=''

    # Directory that this library needs to be installed in:
    libdir='/usr/local/freeswitch/mod'

ii. 找到一个与freeswitch-1.6.14 版本相近的freeswitch专用ilbc rpm包

wget --no-check-certificate https://rpmfind.net/linux/mageia/distrib/cauldron/x86_64/media/core/release/freeswitch-codec-ilbc-1.6.19-3.mga7.x86_64.rpm

从其中拷贝mod_ilbc.so

3.解决mod_ilbc的依赖

[root@localhost mod]# ldd mod_ilbc.so | grep not
    libfreeswitch.so.1 => not found
    libpng16.so.16 => not found
    libssl.so.1.0.0 => not found
    libcrypto.so.1.0.0 => not found
    libtinfo.so.6 => not found

i. 查找是否已有.so却找不到,还是.so是别的名字

[root@localhost ~]# find /usr/ -iname *libfreeswitch*so*
    /usr/local/freeswitch/lib/libfreeswitch.so.1.0.0
    /usr/local/freeswitch/lib/libfreeswitch.so.1
    /usr/local/freeswitch/lib/libfreeswitch.so
[root@localhost ~]# find /usr/ -iname *libpng*so*
    /usr/lib64/libpng15.so.15
    /usr/lib64/libpng15.so.15.13.0
    /usr/lib64/libpng.so.3
    /usr/lib64/libpng.so.3.50.0
    /usr/lib64/libpng12.so.0
    /usr/lib64/libpng12.so.0.50.0
    /usr/lib64/libpng16.so.16
[root@localhost ~]# find /usr/ -iname *libssl*so*
    /usr/lib64/libssl.so.10
    /usr/lib64/.libssl.so.1.0.1e.hmac
    /usr/lib64/.libssl.so.10.hmac
    /usr/lib64/libssl.so.1.0.1e
    /usr/lib64/libssl3.so
    /usr/lib64/libssl.so.6
    /usr/lib64/.libssl.so.0.9.8e.hmac
    /usr/lib64/.libssl.so.6.hmac
    /usr/lib64/libssl.so.0.9.8e
    /usr/lib64/libssl.so.1.0.0
[root@localhost ~]# find /usr/ -iname *libcrypto*so*
    /usr/lib64/.libcrypto.so.1.0.1e.hmac
    /usr/lib64/.libcrypto.so.10.hmac
    /usr/lib64/libcrypto.so.1.0.1e
    /usr/lib64/libcrypto.so.10
    /usr/lib64/.libcrypto.so.0.9.8e.hmac
    /usr/lib64/.libcrypto.so.6.hmac
    /usr/lib64/libcrypto.so.0.9.8e
    /usr/lib64/libcrypto.so.6
    /usr/lib64/libcrypto.so.1.0.0
[root@localhost ~]# find /usr/ -iname *libtinfo*so*
    /usr/lib64/libtinfo.so.5
    /usr/lib64/libtinfo.so.5.9
    /usr/lib64/libtinfo.so
    /usr/lib64/libtinfo.so.6

ii. 如果有*.so,增加动态库所在目录(方案一)
在/etc/ld.so.conf中增加动态库所在目录
ldconfig使配置生效

iii. 如果有.so,将相关.so修改文件名拷贝到/usr/lib64下(方案二)

[root@localhost ~]# cp /usr/local/freeswitch/lib/libfreeswitch.so.1 /usr/lib64/libfreeswitch.so.1
[root@localhost ~]# cp /usr/lib64/libpng15.so.15 /usr/lib64/libpng16.so.16
[root@localhost ~]# cp /usr/lib64/libssl.so.10 /usr/lib64/libssl.so.1.0.0
[root@localhost ~]# cp /usr/lib64/libcrypto.so.10 /usr/lib64/libcrypto.so.1.0.0
[root@localhost ~]# cp /usr/lib64/libtinfo.so /usr/lib64/libtinfo.so.6

4.加载mod_ilbc
启动FreeSWITCH

[root@localhost ~]# cd /usr/local/freeswitch/bin/
[root@localhost bin]# ./freeswitch 
[root@localhost bin]# ./fs_cli 

这里写图片描述

5.验证编码格式
Centos7安装Freeswitch并加载mod_ilbc_第6张图片

6.目前mod_ilbc是手动加载方式。若想自动加载如下所示。
[root@localhost ~]# vim /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml
Centos7安装Freeswitch并加载mod_ilbc_第7张图片

三、验证
1.配置iLBC编码格式

[root@localhost ~]# vim /usr/local/freeswitch/conf/vars.xml

Centos7安装Freeswitch并加载mod_ilbc_第8张图片

2.使用linphone配置ilbc编码,亲测有效。

注:可以去我的资源下载mod_ilbc.la和mod_ilbc.so文件

你可能感兴趣的:(FreeSWITCH)