美文网首页
docker安装FreeSWITCH服务器(一)

docker安装FreeSWITCH服务器(一)

作者: dbasy | 来源:发表于2021-07-29 09:37 被阅读0次

    1.选择centos镜像进入

    2.进入src目录,安装git

    cd /usr/local/src
    yum install -y git
    

    3.下载freeswitch

    git clone -b v1.6 https://github.com/signalwire/freeswitch.git freeswitch
    
    

    4.安装相关依赖包

    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
    
    

    依赖包安装结果

    Installed:
      alsa-lib-devel.x86_64 0:1.1.8-1.el7                                           
      autoconf.noarch 0:2.69-11.el7                                                 
      automake.noarch 0:1.13.4-3.el7                                                
      bison.x86_64 0:3.0.4-2.el7                                                    
      bzip2.x86_64 0:1.0.6-13.el7                                                   
      e2fsprogs-devel.x86_64 0:1.42.9-19.el7                                        
      flite-devel.x86_64 0:1.3-22.el7                                               
      gcc-c++.x86_64 0:4.8.5-44.el7                                                 
      gdbm-devel.x86_64 0:1.10-8.el7                                                
      gnutls-devel.x86_64 0:3.3.29-9.el7_6                                          
      ldns-devel.x86_64 0:1.6.16-10.el7                                             
      libcurl-devel.x86_64 0:7.29.0-59.el7_9.1                                      
      libedit-devel.x86_64 0:3.0-12.20121213cvs.el7                                 
      libidn-devel.x86_64 0:1.28-4.el7                                              
      libjpeg-turbo-devel.x86_64 0:1.2.90-8.el7                                     
      libmemcached-devel.x86_64 0:1.0.16-5.el7                                      
      libogg-devel.x86_64 2:1.3.0-7.el7                                             
      libsndfile-devel.x86_64 0:1.0.25-12.el7                                       
      libtheora-devel.x86_64 1:1.1.1-8.el7                                          
      libtiff-devel.x86_64 0:4.0.3-35.el7                                           
      libtool.x86_64 0:2.4.2-22.el7_3                                               
      libuuid-devel.x86_64 0:2.23.2-65.el7_9.1                                      
      libvorbis-devel.x86_64 1:1.3.3-8.el7.1                                        
      libxml2-devel.x86_64 0:2.9.1-6.el7.5                                          
      lua-devel.x86_64 0:5.1.4-15.el7                                               
      lzo-devel.x86_64 0:2.06-8.el7                                                 
      ncurses-devel.x86_64 0:5.9-14.20130511.el7_4                                  
      net-snmp-devel.x86_64 1:5.7.2-49.el7_9.1                                      
      openssl-devel.x86_64 1:1.0.2k-21.el7_9                                        
      opus-devel.x86_64 0:1.0.2-6.el7                                               
      pcre-devel.x86_64 0:8.32-17.el7                                               
      perl-ExtUtils-Embed.noarch 0:1.30-299.el7_9                                   
      postgresql-devel.x86_64 0:9.2.24-7.el7_9                                      
      python-devel.x86_64 0:2.7.5-90.el7                                            
      soundtouch-devel.x86_64 0:1.4.0-9.el7                                         
      speex-devel.x86_64 0:1.2-0.19.rc1.el7                                         
      sqlite-devel.x86_64 0:3.7.17-8.el7_7.1                                        
      unbound-devel.x86_64 0:1.6.6-5.el7_8                                          
      unixODBC-devel.x86_64 0:2.3.1-14.el7                                          
      wget.x86_64 0:1.14-18.el7_6.1                                                 
      which.x86_64 0:2.20-7.el7                                                     
      zlib-devel.x86_64 0:1.2.7-19.el7_9                                            
    
    Dependency Installed:
      alsa-lib.x86_64 0:1.1.8-1.el7                                                 
      cpp.x86_64 0:4.8.5-44.el7                                                     
      cyrus-sasl.x86_64 0:2.1.26-23.el7                                             
      cyrus-sasl-devel.x86_64 0:2.1.26-23.el7                                       
      e2fsprogs-libs.x86_64 0:1.42.9-19.el7                                         
      elfutils-devel.x86_64 0:0.176-5.el7                                           
      elfutils-libelf-devel.x86_64 0:0.176-5.el7                                    
      flac-libs.x86_64 0:1.3.0-5.el7_1                                              
      flite.x86_64 0:1.3-22.el7                                                     
      gcc.x86_64 0:4.8.5-44.el7                                                     
      glibc-devel.x86_64 0:2.17-324.el7_9                                           
      glibc-headers.x86_64 0:2.17-324.el7_9                                         
      gmp-devel.x86_64 1:6.0.0-15.el7                                               
      gnutls.x86_64 0:3.3.29-9.el7_6                                                
      gnutls-c++.x86_64 0:3.3.29-9.el7_6                                            
      gnutls-dane.x86_64 0:3.3.29-9.el7_6                                           
      gsm.x86_64 0:1.0.13-11.el7                                                    
      initscripts.x86_64 0:9.49.53-1.el7_9.1                                        
      iproute.x86_64 0:4.11.0-30.el7                                                
      iptables.x86_64 0:1.4.21-35.el7                                               
      jbigkit-libs.x86_64 0:2.0-11.el7                                              
      kernel-headers.x86_64 0:3.10.0-1160.36.2.el7                                  
      keyutils-libs-devel.x86_64 0:1.5.8-3.el7                                      
      krb5-devel.x86_64 0:1.15.1-50.el7                                             
      ldns.x86_64 0:1.6.16-10.el7                                                   
      libcom_err-devel.x86_64 0:1.42.9-19.el7                                       
      libdb-devel.x86_64 0:5.3.21-25.el7                                            
      libevent.x86_64 0:2.0.21-4.el7                                                
      libevent-devel.x86_64 0:2.0.21-4.el7                                          
      libgomp.x86_64 0:4.8.5-44.el7                                                 
      libjpeg-turbo.x86_64 0:1.2.90-8.el7                                           
      libkadm5.x86_64 0:1.15.1-50.el7                                               
      libmemcached.x86_64 0:1.0.16-5.el7                                            
      libmnl.x86_64 0:1.0.3-7.el7                                                   
      libmpc.x86_64 0:1.0.1-3.el7                                                   
      libnetfilter_conntrack.x86_64 0:1.0.6-1.el7_3                                 
      libnfnetlink.x86_64 0:1.0.1-4.el7                                             
      libogg.x86_64 2:1.3.0-7.el7                                                   
      libpcap.x86_64 14:1.5.3-12.el7                                                
      libselinux-devel.x86_64 0:2.5-15.el7                                          
      libsepol-devel.x86_64 0:2.5-10.el7                                            
      libsndfile.x86_64 0:1.0.25-12.el7                                             
      libstdc++-devel.x86_64 0:4.8.5-44.el7                                         
      libtasn1-devel.x86_64 0:4.10-1.el7                                            
      libtheora.x86_64 1:1.1.1-8.el7                                                
      libtiff.x86_64 0:4.0.3-35.el7                                                 
      libtool-ltdl.x86_64 0:2.4.2-22.el7_3                                          
      libverto-devel.x86_64 0:0.2.5-4.el7                                           
      libvorbis.x86_64 1:1.3.3-8.el7.1                                              
      lm_sensors-devel.x86_64 0:3.4.0-8.20160601gitf9185e5.el7                      
      lm_sensors-libs.x86_64 0:3.4.0-8.20160601gitf9185e5.el7                       
      lzo.x86_64 0:2.06-8.el7                                                       
      lzo-minilzo.x86_64 0:2.06-8.el7                                               
      m4.x86_64 0:1.4.16-10.el7                                                     
      make.x86_64 1:3.82-24.el7                                                     
      mariadb-libs.x86_64 1:5.5.68-1.el7                                            
      mpfr.x86_64 0:3.1.1-4.el7                                                     
      net-snmp.x86_64 1:5.7.2-49.el7_9.1                                            
      net-snmp-agent-libs.x86_64 1:5.7.2-49.el7_9.1                                 
      net-snmp-libs.x86_64 1:5.7.2-49.el7_9.1                                       
      nettle.x86_64 0:2.7.1-9.el7_9                                                 
      nettle-devel.x86_64 0:2.7.1-9.el7_9                                           
      openssl.x86_64 1:1.0.2k-21.el7_9                                              
      opus.x86_64 0:1.0.2-6.el7                                                     
      p11-kit-devel.x86_64 0:0.23.5-3.el7                                           
      perl-Data-Dumper.x86_64 0:2.145-3.el7                                         
      perl-ExtUtils-Install.noarch 0:1.58-299.el7_9                                 
      perl-ExtUtils-MakeMaker.noarch 0:6.68-3.el7                                   
      perl-ExtUtils-Manifest.noarch 0:1.61-244.el7                                  
      perl-ExtUtils-ParseXS.noarch 1:3.18-3.el7                                     
      perl-Test-Harness.noarch 0:3.28-3.el7                                         
      perl-Thread-Queue.noarch 0:3.02-2.el7                                         
      perl-devel.x86_64 4:5.16.3-299.el7_9                                          
      popt-devel.x86_64 0:1.13-16.el7                                               
      postgresql.x86_64 0:9.2.24-7.el7_9                                            
      postgresql-libs.x86_64 0:9.2.24-7.el7_9                                       
      pyparsing.noarch 0:1.5.6-9.el7                                                
      python-rpm-macros.noarch 0:3-34.el7                                           
      python-srpm-macros.noarch 0:3-34.el7                                          
      python2-rpm-macros.noarch 0:3-34.el7                                          
      rpm-devel.x86_64 0:4.11.3-45.el7                                              
      soundtouch.x86_64 0:1.4.0-9.el7                                               
      speex.x86_64 0:1.2-0.19.rc1.el7                                               
      systemd-sysv.x86_64 0:219-78.el7_9.3                                          
      systemtap-sdt-devel.x86_64 0:4.0-13.el7                                       
      sysvinit-tools.x86_64 0:2.88-14.dsf.el7                                       
      tcp_wrappers-devel.x86_64 0:7.6-77.el7                                        
      tcp_wrappers-libs.x86_64 0:7.6-77.el7                                         
      trousers.x86_64 0:0.3.14-2.el7                                                
      unbound-libs.x86_64 0:1.6.6-5.el7_8                                           
      unixODBC.x86_64 0:2.3.1-14.el7                                                
      xz-devel.x86_64 0:5.2.2-1.el7                                                 
    
    Dependency Updated:
      curl.x86_64 0:7.29.0-59.el7_9.1         glibc.x86_64 0:2.17-324.el7_9        
      glibc-common.x86_64 0:2.17-324.el7_9    libblkid.x86_64 0:2.23.2-65.el7_9.1  
      libcurl.x86_64 0:7.29.0-59.el7_9.1      libmount.x86_64 0:2.23.2-65.el7_9.1  
      libsmartcols.x86_64 0:2.23.2-65.el7_9.1 libuuid.x86_64 0:2.23.2-65.el7_9.1   
      openssl-libs.x86_64 1:1.0.2k-21.el7_9   python.x86_64 0:2.7.5-90.el7         
      python-libs.x86_64 0:2.7.5-90.el7       systemd.x86_64 0:219-78.el7_9.3      
      systemd-libs.x86_64 0:219-78.el7_9.3    util-linux.x86_64 0:2.23.2-65.el7_9.1
      zlib.x86_64 0:1.2.7-19.el7_9           
    
    Complete!
    
    

    再安装

     yum install -y http://files.freeswitch.org/freeswitch-release-1-6.noarch.rpm epel-release
    Loaded plugins: fastestmirror, ovl
    

    5.进入 freeswitch目录

    cd /usr/local/src/freeswitch
    
    5.1执行./bootstrap.sh
    ./bootstrap.sh
    
    5.2 运行./configure
    ./configure
    

    运行结果

    -------------------------- FreeSWITCH configuration --------------------------
    
      Locations:
    
          prefix:          /usr/local/freeswitch
          exec_prefix:     /usr/local/freeswitch
          bindir:          ${exec_prefix}/bin
          confdir:         /usr/local/freeswitch/conf
          libdir:          ${exec_prefix}/lib
          datadir:         /usr/local/freeswitch
          localstatedir:   /usr/local/freeswitch
          includedir:      /usr/local/freeswitch/include/freeswitch
    
          certsdir:        /usr/local/freeswitch/certs
          dbdir:           /usr/local/freeswitch/db
          grammardir:      /usr/local/freeswitch/grammar
          htdocsdir:       /usr/local/freeswitch/htdocs
          fontsdir:        /usr/local/freeswitch/fonts
          logfiledir:      /usr/local/freeswitch/log
          modulesdir:      /usr/local/freeswitch/mod
          pkgconfigdir:    ${exec_prefix}/lib/pkgconfig
          recordingsdir:   /usr/local/freeswitch/recordings
          imagesdir:       /usr/local/freeswitch/images
          runtimedir:      /usr/local/freeswitch/run
          scriptdir:       /usr/local/freeswitch/scripts
          soundsdir:       /usr/local/freeswitch/sounds
          storagedir:      /usr/local/freeswitch/storage
          cachedir:        /usr/local/freeswitch/cache
    
    ------------------------------------------------------------------------------
    
    5.3 进行make
    make
    

    报错最后一行 make: *** [libs/libvpx/Makefile] Error 1

    sh-4.2# make
    gcc -o /usr/local/src/freeswitch/build/print_git_revision /usr/local/src/freeswitch/build/print_git_revision.c
    cd libs/libvpx && CC="gcc" CXX="g++" CFLAGS="-g -O2" CXXFLAGS="-g -O2" LDFLAGS="" ./configure --enable-pic --disable-docs --disable-examples --disable-install-bins --disable-install-srcs --disable-unit-tests --extra-cflags="-fvisibility=hidden"
      enabling pic
      disabling docs
      disabling examples
      disabling install_bins
      disabling install_srcs
      disabling unit_tests
      enabling vp8_encoder
      enabling vp8_decoder
      enabling vp9_encoder
      enabling vp9_decoder
    Configuring for target 'x86_64-linux-gcc'
      enabling x86_64
      enabling runtime_cpu_detect
      enabling mmx
      enabling sse
      enabling sse2
      enabling sse3
      enabling ssse3
      enabling sse4_1
      enabling avx
      enabling avx2
    Neither yasm nor nasm have been found. See the prerequisites section in the README for more info.
    
    Configuration failed. This could reflect a misconfiguration of your
    toolchains, improper options selected, or another problem. If you
    don't see any useful error messages above, the next step is to look
    at the configure error log file (config.log) to determine what
    configure was trying to do when it died.
    make: *** [libs/libvpx/Makefile] Error 1
    

    通过yum install opus-devel该方法不起效果,进入mod_opus修改文件

    cd /usr/local/src/freeswitch/src/mod/codecs/mod_opus
    

    回到freeswitch,再进行make

    make
    

    make成功

     +---------- FreeSWITCH Build Complete ----------+
     + FreeSWITCH has been successfully built.       +
     + Install by running:                           +
     +                                               +
     +                make install                   +
     +                                               +
     + While you're waiting, register for ClueCon!   +
     + https://www.cluecon.com                       +
     +                                               +
     +-----------------------------------------------+
    
    .=======================================================================================================.
    |    ____ _             ____                                                                            |
    |   / ___| |_   _  ___ / ___|___  _ __                                                                  |
    |  | |   | | | | |/ _ \ |   / _ \| '_ \                                                                 |
    |  | |___| | |_| |  __/ |__| (_) | | | |                                                                |
    |   \____|_|\__,_|\___|\____\___/|_| |_|                                                                |
    |                                                                                                       |
    |   _____    _            _                          ____             __                                |
    |  |_   _|__| | ___ _ __ | |__   ___  _ __  _   _   / ___|___  _ __  / _| ___ _ __ ___ _ __   ___ ___   |
    |    | |/ _ \ |/ _ \ '_ \| '_ \ / _ \| '_ \| | | | | |   / _ \| '_ \| |_ / _ \ '__/ _ \ '_ \ / __/ _ \  |
    |    | |  __/ |  __/ |_) | | | | (_) | | | | |_| | | |__| (_) | | | |  _|  __/ | |  __/ | | | (_|  __/  |
    |    |_|\___|_|\___| .__/|_| |_|\___/|_| |_|\__, |  \____\___/|_| |_|_|  \___|_|  \___|_| |_|\___\___|  |
    |                  |_|                      |___/                                                       |
    |   _____                           _                         _                                         |
    |  | ____|_   _____ _ __ _   _     / \  _   _  __ _ _   _ ___| |_                                       |
    |  |  _| \ \ / / _ \ '__| | | |   / _ \| | | |/ _` | | | / __| __|                                      |
    |  | |___ \ V /  __/ |  | |_| |  / ___ \ |_| | (_| | |_| \__ \ |_                                       |
    |  |_____| \_/ \___|_|   \__, | /_/   \_\__,_|\__, |\__,_|___/\__|                                      |
    |                        |___/                |___/                                                     |
    |                                       ____ _             ____                                         |
    |  __      ____      ____      __      / ___| |_   _  ___ / ___|___  _ __         ___ ___  _ __ ___     |
    |  \ \ /\ / /\ \ /\ / /\ \ /\ / /     | |   | | | | |/ _ \ |   / _ \| '_ \       / __/ _ \| '_ ` _ \    |
    |   \ V  V /  \ V  V /  \ V  V /   _  | |___| | |_| |  __/ |__| (_) | | | |  _  | (_| (_) | | | | | |   |
    |    \_/\_/    \_/\_/    \_/\_/   (_)  \____|_|\__,_|\___|\____\___/|_| |_| (_)  \___\___/|_| |_| |_|   |
    |                                                                                                       |
    .=======================================================================================================.
    
    
    
    

    再进行make install

    make install
    

    6.挂载目录及启动

    sh-4.2# ln -sf /usr/local/freeswitch/bin/freeswitch /usr/bin/
    sh-4.2# ln -sf /usr/local/freeswitch/bin/fs_cli /usr/bin/
    

    前台启动 后台启动就用 freewitch -nc

    freeswitch -c  
    

    安装成功

    2021-07-29 01:08:26.299782 [CONSOLE] switch_core.c:2427 
    .=============================================================.
    |   _____              ______        _____ _____ ____ _   _   |
    |  |  ___| __ ___  ___/ ___\ \      / /_ _|_   _/ ___| | | |  |
    |  | |_ | '__/ _ \/ _ \___ \\ \ /\ / / | |  | || |   | |_| |  |
    |  |  _|| | |  __/  __/___) |\ V  V /  | |  | || |___|  _  |  |
    |  |_|  |_|  \___|\___|____/  \_/\_/  |___| |_| \____|_| |_|  |
    |                                                             |
    .=============================================================.
    |   Anthony Minessale II, Michael Jerris, Brian West, Others  |
    |   FreeSWITCH (http://www.freeswitch.org)                    |
    |   Paypal Donations Appreciated: paypal@freeswitch.org       |
    |   Brought to you by ClueCon http://www.cluecon.com/         |
    .=============================================================.
    
    .===============================================================.
    |       _                                                       |
    |   ___| |_   _  ___  ___ ___  _ __         ___ ___  _ __ ___   |
    |  / __| | | | |/ _ \/ __/ _ \| '_ \       / __/ _ \| '_ ` _ \  |
    | | (__| | |_| |  __/ (_| (_) | | | |  _  | (_| (_) | | | | | | |
    |  \___|_|\__,_|\___|\___\___/|_| |_| (_)  \___\___/|_| |_| |_| |
    |                                                               |
    .===============================================================.
    
    
    2021-07-29 01:08:26.299797 [INFO] switch_core.c:2436 
    FreeSWITCH Version 1.6.20+git~20180507T185611Z~43a9feb7f8~64bit (git 43a9feb 2018-05-07 18:56:11Z 64bit)
    
    FreeSWITCH Started
    Max Sessions [1000]
    Session Rate [30]
    SQL [Enabled]
    

    7.看下freeswitch状态

    freeswitch@de3e8f89bda7> sofia status
    
                         Name      Type                                       Data  State
    =================================================================================================
                   172.17.0.2     alias                                   internal  ALIASED
                     external   profile              sip:mod_sofia@172.17.0.2:5080  RUNNING (0)
        external::example.com   gateway                    sip:joeuser@example.com  NOREG
                     internal   profile              sip:mod_sofia@172.17.0.2:5060  RUNNING (0)
    =================================================================================================
    2 profiles 1 alias
    

    参考资料

    https://github.com/BetterVoice/freeswitch-container/blob/master/README.md
    https://www.pianshen.com/article/670750899/
    https://blog.csdn.net/quantum7/article/details/106908751

    相关文章

      网友评论

          本文标题:docker安装FreeSWITCH服务器(一)

          本文链接:https://www.haomeiwen.com/subject/sheomltx.html