从零构建实时通信引擎:Freeswitch源码编译与深度优化指南

测试安装基础环境:

  • CentOS 7.9
  • Freeswitch 1.10.12
  • gcc 版本 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
  • cmake version 3.29.8
  • autoconf (GNU Autoconf) 2.71

首先需要明确:FreeSWITCH是一款开源的实时通信服务器,支持语音、视频通话、即时消息等功能,依赖大量音视频处理、跨平台编译、媒体I/O等工具和库

额外在源码构建Freeswitch之前,由于需要使用诸多音视频处理、编解码等方面的组件,因此需要引入一些依赖包,默认系统中可能不带有或者版本较低需要升级,最好依次确认。

如果不需要会议能力,视频相关依赖可自行省略。

一、构建工具:编译FreeSWITCH及其依赖库的基础

1. CMake
  • 基本功能:跨平台的构建系统生成器,可根据目标平台(如Linux、Windows)生成Makefile、Visual Studio项目等构建脚本,简化跨平台编译流程。
  • 在FreeSWITCH中的作用:FreeSWITCH支持多平台部署,CMake用于解析其源码中的编译规则,生成适配当前系统的构建文件,确保源码能在不同操作系统中正确编译。

如果发现没有cmake或版本较低,可以通过yum的方式来安装或升级

bash 复制代码
yum install cmake
yum update cmake
2. Autoconf
  • 基本功能 :生成跨平台的配置脚本(configure),通过检测系统环境(如依赖库是否存在、编译器特性)自动调整编译参数,是传统Unix/Linux下的经典构建工具(常与Automake配合使用)。
  • 在FreeSWITCH中的作用 :部分FreeSWITCH依赖库(如老旧版本的音视频库)可能使用Autoconf生成配置脚本,FreeSWITCH在编译这些依赖时,通过configure脚本适配系统环境,确保依赖库正确安装。
bash 复制代码
wget http://mirrors.kernel.org/gnu/autoconf/autoconf-2.71.tar.gz
tar xzvf autoconf-2.71.tar.gz
cd autoconf-2.71
./configure 
make
make install
----
autoconf -V
autoconf (GNU Autoconf) 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>, <https://gnu.org/licenses/exceptions.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David J. MacKenzie and Akim Demaille.

二、汇编器:提升音视频处理性能

3. YASM / NASM
  • 基本功能:x86/x64架构的汇编器,将汇编语言代码转换为机器码。音视频处理对性能要求极高,很多库会用汇编编写核心优化代码(如循环、数学运算),比C语言更高效。
  • 在FreeSWITCH中的作用:FreeSWITCH依赖的音视频库(如FFmpeg、x264、libvpx)包含大量汇编优化代码(如针对CPU指令集的优化),YASM/NASM用于编译这些汇编代码,提升音视频编解码、格式转换的效率。

yasm:

bash 复制代码
$ wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
--2025-07-17 10:00:23--  http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
正在解析主机 www.tortall.net (www.tortall.net)... 69.55.235.23
正在连接 www.tortall.net (www.tortall.net)|69.55.235.23|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1492156 (1.4M) [application/octet-stream]
正在保存至: "yasm-1.3.0.tar.gz"

100%[==================================================================================================================================================================>] 1,492,156   46.2KB/s 用时 25s    

2025-07-17 10:00:59 (58.6 KB/s) - 已保存 "yasm-1.3.0.tar.gz" [1492156/1492156])
bash 复制代码
$ tar -xvf yasm-1.3.0.tar.gz
yasm-1.3.0/
yasm-1.3.0/libyasm/
yasm-1.3.0/libyasm/cmake-module.c
yasm-1.3.0/libyasm/bitvect.h
yasm-1.3.0/libyasm/section.h
yasm-1.3.0/libyasm/mergesort.c
yasm-1.3.0/libyasm/strcasecmp.c
yasm-1.3.0/libyasm/value.c
......
bash 复制代码
$ cd yasm-1.3.0
$ ./configure

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
......
bash 复制代码
$ make && make install
gcc -std=gnu99  -I.  \
  -c -o genperf.o `test -f tools/genperf/genperf.c || echo './'`tools/genperf/genperf.c
gcc -std=gnu99  -I.  \
  -c -o gp-perfect.o `test -f tools/genperf/perfect.c || echo './'`tools/genperf/perfect.c
gcc -std=gnu99  -I.  \
  -c -o gp-phash.o `test -f libyasm/phash.c || echo './'`libyasm/phash.c
gcc -std=gnu99  -I.  \
  -c -o gp-xmalloc.o `test -f libyasm/xmalloc.c || echo './'`libyasm/xmalloc.c
......
bash 复制代码
yasm --version
yasm 1.3.0
Compiled on Jul 17 2025.
Copyright (c) 2001-2014 Peter Johnson and other Yasm developers.
Run yasm --license for licensing overview and summary.

nasm:

bash 复制代码
$ wget https://www.nasm.us/pub/nasm/releasebuilds/2.14/nasm-2.14.tar.gz
--2025-07-17 10:01:06--  https://www.nasm.us/pub/nasm/releasebuilds/2.14/nasm-2.14.tar.gz
正在解析主机 www.nasm.us (www.nasm.us)... 198.137.202.136, 2607:7c80:54:3::136
正在连接 www.nasm.us (www.nasm.us)|198.137.202.136|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1248463 (1.2M) [application/gzip]
正在保存至: "nasm-2.14.tar.gz"

100%[==================================================================================================================================================================>] 1,248,463   56.0KB/s 用时 16s    

2025-07-17 10:01:32 (77.7 KB/s) - 已保存 "nasm-2.14.tar.gz" [1248463/1248463])
bash 复制代码
$ tar -zxvf nasm-2.14.tar.gz

nasm-2.14/
nasm-2.14/AUTHORS
nasm-2.14/TODO
nasm-2.14/headers/
nasm-2.14/headers/c
nasm-2.14/headers/mac
nasm-2.14/headers/perl
nasm-2.14/headers/doc
nasm-2.14/test/
nasm-2.14/test/objtest.asm
nasm-2.14/test/float8.asm
nasm-2.14/test/avx512cd.asm
nasm-2.14/test/br890790_i.asm
......
bash 复制代码
$ cd nasm-2.14
$ ./configure
checking for prefix by checking for nasm... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
......
bash 复制代码
$ make && make install
[1] 6452
perl -I./perllib -I. tools/mkdep.pl -M Makefile.in -- . include config x86 rdoff stdlib nasmlib output asm disasm x86 common macros
perl -I./perllib -I. tools/mkdep.pl -M Makefile.in -- . include config x86 rdoff stdlib nasmlib output asm disasm x86 common macros
gcc -std=gnu99 -c  -g -O3 -fwrapv -U__STRICT_ANSI__ -fno-common -Werror=attributes -fvisibility=hidden -W -Wall -pedantic -Wno-long-long -Werror=implicit -Werror=missing-braces -Werror=return-type -Werror=trigraphs -Werror=pointer-arith -Werror=missing-prototypes -Werror=missing-declarations -Werror=comment -Werror=vla -fgnu89-inline -DHAVE_CONFIG_H -I. -I. -I./include -I./include -I./x86 -I./x86 -I./asm -I./asm -I./disasm -I./disasm -I./output -I./output -o asm/nasm.o asm/nasm.c
gcc -std=gnu99 -c  -g -O3 -fwrapv -U__STRICT_ANSI__ -fno-common -Werror=attributes -fvisibility=hidden -W -Wall -pedantic -Wno-long-long -Werror=implicit -Werror=missing-braces -Werror=return-type -Werror=trigraphs -Werror=pointer-arith -Werror=missing-prototypes -Werror=missing-declarations -Werror=comment -Werror=vla -fgnu89-inline -DHAVE_CONFIG_H -I. -I. -I./include -I./include -I./x86 -I./x86 -I./asm -I./asm -I./disasm -I./disasm -I./output -I./output -o asm/nasm.o asm/nasm.c
......
bash 复制代码
nasm --version
NASM version 2.14 compiled on Jul 17 2025

三、音视频编解码器:支撑实时媒体传输

4. Opus
  • 基本功能:开源的高性能音频编解码器,支持语音(窄带/宽带)和音乐,低延迟(20-50ms)、高压缩率,是实时通信(如VOIP、WebRTC)的首选音频编码。
  • 在FreeSWITCH中的作用:作为核心音频编码之一,FreeSWITCH用Opus处理实时语音流的压缩和解压缩,确保语音通话的低延迟和高质量(尤其在网络带宽有限时)。
bash 复制代码
$ wget https://archive.mozilla.org/pub/opus/opus-1.3.1.tar.gz
--2025-07-17 10:08:02--  https://archive.mozilla.org/pub/opus/opus-1.3.1.tar.gz
正在解析主机 archive.mozilla.org (archive.mozilla.org)... 199.232.151.19, 2a04:4e42:1a::787
正在连接 archive.mozilla.org (archive.mozilla.org)|199.232.151.19|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1040054 (1016K) [application/x-tar]
正在保存至: "opus-1.3.1.tar.gz"

100%[==================================================================================================================================================================>] 1,040,054   20.0KB/s 用时 42s    

2025-07-17 10:08:55 (24.1 KB/s) - 已保存 "opus-1.3.1.tar.gz" [1040054/1040054])
bash 复制代码
$ tar -zxvf opus-1.3.1.tar.gz 
opus-1.3.1/
opus-1.3.1/COPYING
opus-1.3.1/README
opus-1.3.1/config.h.cmake.in
opus-1.3.1/config.guess
opus-1.3.1/NEWS
opus-1.3.1/ltmain.sh
opus-1.3.1/install-sh
......
bash 复制代码
$ ./configure 
checking whether make supports nested variables... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
......
configure:
------------------------------------------------------------------------
  opus 1.3.1:  Automatic configuration OK.

    Compiler support:

      C99 var arrays: ................ yes
      C99 lrintf: .................... yes
      Use alloca: .................... no (using var arrays)

    General configuration:

      Floating point support: ........ yes
      Fast float approximations: ..... no
      Fixed point debugging: ......... no
      Inline Assembly Optimizations: . No inline ASM for your platform, please send patches
      External Assembly Optimizations: 
      Intrinsics Optimizations: ...... x86 SSE SSE2 SSE4.1 AVX
      Run-time CPU detection: ........ x86 SSE4.1 AVX
      Custom modes: .................. no
      Assertion checking: ............ no
      Hardening: ..................... yes
      Fuzzing: ....................... no
      Check ASM: ..................... no

      API documentation: ............. yes
      Extra programs: ................ yes
------------------------------------------------------------------------

 Type "make; make install" to compile and install
 Type "make check" to run the test suite
bash 复制代码
$ make; make install
make  install-recursive
make[1]: 进入目录"/data/software/freeswitch/opus"
......
libtool: finish: PATH="/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/go/bin:/root/bin:/usr/lib64:/usr/local/go/bin:/sbin" ldconfig -n /usr/local/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the 'LD_RUN_PATH' environment variable
     during linking
   - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to '/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
make[4]: 进入目录"/data/software/freeswitch/opus/doc"
make[5]: 进入目录"/data/software/freeswitch/opus/doc"
make[5]: 对"install-exec-am"无需做任何事。
make[5]: 对"install-data-am"无需做任何事。
make[5]: 离开目录"/data/software/freeswitch/opus/doc"
make[4]: 离开目录"/data/software/freeswitch/opus/doc"
 /usr/bin/mkdir -p '/usr/local/share/aclocal'
 /usr/bin/install -c -m 644 opus.m4 '/usr/local/share/aclocal'
 /usr/bin/mkdir -p '/usr/local/lib/pkgconfig'
 /usr/bin/install -c -m 644 opus.pc '/usr/local/lib/pkgconfig'
 /usr/bin/mkdir -p '/usr/local/include/opus'
 /usr/bin/install -c -m 644 include/opus.h include/opus_multistream.h include/opus_types.h include/opus_defines.h include/opus_projection.h '/usr/local/include/opus'
make[3]: 离开目录"/data/software/freeswitch/opus"
make[2]: 离开目录"/data/software/freeswitch/opus"
make[1]: 离开目录"/data/software/freeswitch/opus"
bash 复制代码
cp /usr/local/lib/pkgconfig/opus.*   /usr/lib64/pkgconfig/
# 安装libsndfile-devel
yum install libsndfile-devel
5. x264 (可选)
  • 基本功能:开源的H.264视频编码器,支持将原始视频流压缩为H.264格式(目前应用最广泛的视频编码标准之一),平衡压缩效率和画质。
  • 在FreeSWITCH中的作用:若FreeSWITCH启用视频通话功能,x264用于将原始视频流编码为H.264格式(或解码H.264流),实现高效的视频传输(H.264在同等画质下带宽占用更低)。

如果需要使用会议视频等功能,是需要进行安装的。

bash 复制代码
wget https://codeload.github.com/ShiftMediaProject/x264/zip/refs/heads/master
unzip x264-master.zip
cd x264-master
./configure --prefix=/usr/local --enable-shared
make
make install
 
#查看是否安装成功
x264 --version
6. libvpx / libvpx2 (可选)
  • 基本功能:Google开源的视频编解码库,支持VP8(早期WebRTC默认视频编码)和VP9(新一代开源视频编码,压缩效率高于H.264)。
  • 在FreeSWITCH中的作用 :补充H.264的视频编码支持,FreeSWITCH通过libvpx处理VP8/VP9格式的视频流(如WebRTC场景中常见的VP8编码),实现跨平台视频互通(尤其与开源客户端兼容)。
    注:libvpx2通常指libvpx的更新版本或特定分支。

同样是为了支持视频的需求,准备的解码包,如果你的仓库包比较新可以直接yum安装,但是这边centos7.9自带的版本还是比较老旧,可以考虑源码安装

bash 复制代码
yum install libvpx
or
wget https://files.freeswitch.org/downloads/libs/libvpx2-2.0.0.tar.gz
tar -zxvf libvpx2-2.0.0.tar.gz
cd libvpx2-2.0.0
./configure
make
make install

四、多媒体框架与工具库:处理音视频流的核心

7. FFmpeg / libav(可选)
  • 基本功能 :FFmpeg是一套完整的多媒体处理框架,包含音视频编解码(libavcodec)、格式转换(libavformat)、流媒体处理(libavfilter)等模块,支持几乎所有音视频格式;libav是FFmpeg的衍生项目,功能类似。
  • 在FreeSWITCH中的作用 :作为"媒体处理引擎",FreeSWITCH依赖FFmpeg/libav实现复杂的音视频处理任务,例如:
    • 将不同编码的音频(如G.711、G.729)转码为Opus(FreeSWITCH常用编码);
    • 处理音视频流的格式封装(如将RTP流转换为MP4文件存储);
    • 解析或生成多种媒体容器格式(如RTSP、WebRTC的RTP/RTCP)。

ffmpeg:

ffmpeg是一个历史比价悠久的工具包了,在早期各种音视频工具编解码、转码上,都不少利用了这个底层组件。

bash 复制代码
$ wget https://ffmpeg.org/releases/ffmpeg-5.1.tar.gz
--2025-07-16 17:53:31--  https://ffmpeg.org/releases/ffmpeg-5.1.tar.gz
正在解析主机 ffmpeg.org (ffmpeg.org)... 79.124.17.100
正在连接 ffmpeg.org (ffmpeg.org)|79.124.17.100|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:15070588 (14M) [application/x-gzip]
正在保存至: "ffmpeg-5.1.tar.gz"

100%[==================================================================================================================================================================>] 15,070,588  1.75MB/s 用时 8.4s   

2025-07-16 17:53:51 (1.71 MB/s) - 已保存 "ffmpeg-5.1.tar.gz" [15070588/15070588])
bash 复制代码
$ tar xzvf ffmpeg-5.1.tar.gz
ffmpeg-5.1/
ffmpeg-5.1/Makefile
ffmpeg-5.1/libavcodec/
ffmpeg-5.1/libavcodec/roqvideo.h
ffmpeg-5.1/libavcodec/txd.c
ffmpeg-5.1/libavcodec/h264dsp_template.c
ffmpeg-5.1/libavcodec/v4l2_context.c
......
bash 复制代码
$ cd ffmpeg-5.1
./configure --enable-shared --enable-libx264 --enable-gpl --enable-sdl2 --enable-pic # 根据需求来配置,对于视频不需要的,可不开启libx264
$ make -j$(nproc) 
GEN	libavutil/libavutil.version
GEN	libswscale/libswscale.version
GEN	libswresample/libswresample.version
GEN	libpostproc/libpostproc.version
GEN	libavcodec/libavcodec.version
GEN	libavformat/libavformat.version
GEN	libavfilter/libavfilter.version
GEN	libavdevice/libavdevice.version
......
LD	ffmpeg_g
LD	ffprobe_g
LD	ffplay_g
STRIP	ffplay
STRIP	ffprobe
STRIP	ffmpeg
bash 复制代码
$ make install
INSTALL	libavdevice/libavdevice.a
INSTALL	libavdevice/libavdevice.so
STRIP	install-libavdevice-shared
INSTALL	libavfilter/libavfilter.a
INSTALL	libavfilter/libavfilter.so
STRIP	install-libavfilter-shared
......
INSTALL	libavutil/film_grain_params.h
INSTALL	libavutil/avconfig.h
INSTALL	libavutil/ffversion.h
INSTALL	libavutil/libavutil.pc
bash 复制代码
$ ffmpeg -version
ffmpeg version 5.1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-44)
  configuration: --enable-shared --enable-gpl --enable-sdl2 --enable-pic
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100

libav(可选):

同样对于默认版本较低的情况,可自行手动安装高等级版本,由于与ffmpeg功能类似,也不一定需要冗余安装,多数场景下建议直接使用 FFmpeg,兼容性更佳且维护活跃。

CentOS 官方仓库仅提供 FFmpeg(ffmpeg 包),而非 libav。若需安装 libav,需通过第三方源(如 Nux Dextop)

bash 复制代码
sudo yum install epel-release
sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
sudo yum install libav-tools
8. PortAudio (可选)
  • 基本功能:跨平台的音频I/O库,提供统一的API访问操作系统的音频设备(如麦克风、扬声器),支持Windows、Linux、macOS等系统。
  • 在FreeSWITCH中的作用 :FreeSWITCH在需要直接与本地音频硬件交互的场景中使用PortAudio,例如:
    • 调试时播放/录制通话音频(如测试语音质量);
    • 软电话功能(如FreeSWITCH客户端模块)中采集麦克风输入或输出到扬声器。

如果需要使用软电话功能,或是支持手动的录音和放音等功能,可引入PortAudio,官方直达:http://www.portaudio.com/

bash 复制代码
$ tar -zxvf pa_stable_v190700_20210406.tgz
$ cd portaudio
$ ./configure
$ make
$ make install
9. SDL2(Simple DirectMedia Layer)
  • 基本功能:跨平台多媒体开发库,封装了音频、视频、输入设备(如鼠标、键盘)的底层接口,简化多媒体应用开发。
  • 在FreeSWITCH中的作用 :主要用于测试或客户端场景 ,例如:
    • 调试视频通话时显示实时视频流(通过SDL2的窗口渲染功能);
    • 辅助开发基于FreeSWITCH的轻量客户端(如简单的音视频通话测试工具)。服务器端部署时通常不依赖SDL2。
bash 复制代码
$ wget https://www.libsdl.org/release/SDL2-2.0.22.tar.gz
--2025-07-16 17:56:03--  https://www.libsdl.org/release/SDL2-2.0.22.tar.gz
正在解析主机 www.libsdl.org (www.libsdl.org)... 192.241.223.99, 2604:a880:1:20::181:e001
正在连接 www.libsdl.org (www.libsdl.org)|192.241.223.99|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:7250633 (6.9M) [application/x-gzip]
正在保存至: "SDL2-2.0.22.tar.gz"

100%[==================================================================================================================================================================>] 7,250,633    227KB/s 用时 35s    

2025-07-16 17:56:49 (201 KB/s) - 已保存 "SDL2-2.0.22.tar.gz" [7250633/7250633])
bash 复制代码
#安装依赖
$ yum -y install libX11-devel libXext-devel libXv-devel
$ tar -zxvf SDL2-2.0.22.tar.gz
SDL2-2.0.22/
SDL2-2.0.22/WhatsNew.txt
SDL2-2.0.22/Xcode/
SDL2-2.0.22/android-project/
SDL2-2.0.22/VisualC-WinRT/
SDL2-2.0.22/configure.ac
SDL2-2.0.22/Android.mk
SDL2-2.0.22/wayland-protocols/
......
bash 复制代码
$ cd SDL2-2.0.22/
$ ./configure 
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name...
......
SDL2 Configure Summary:
Building Shared Libraries
Building Static Libraries
Enabled modules : atomic audio video render events joystick haptic hidapi sensor power filesystem threads timers file misc locale loadso cpuinfo assembly
Assembly Math   : mmx 3dnow sse sse2 sse3
Audio drivers   : disk dummy oss alsa(dynamic) pulse(dynamic)
Video drivers   : dummy opengl_es2 vulkan
Input drivers   : linuxev linuxkd
Enable virtual joystick APIs : YES
Using libsamplerate : NO
Using libudev       : NO
Using dbus          : NO
Using ime           : YES
Using ibus          : NO
Using fcitx         : NO
bash 复制代码
$ make
/bin/sh build-scripts/updaterev.sh
/bin/sh build-scripts/mkinstalldirs build
mkdir -p -- build
touch build/.created
  CC     build/SDL.lo
  CC     build/SDL_assert.lo
  CC     build/SDL_dataqueue.lo
......  
$ make install
/bin/sh build-scripts/updaterev.sh
/bin/sh build-scripts/mkinstalldirs /usr/local/bin
/usr/bin/install -c -m 755 sdl2-config /usr/local/bin/sdl2-config
/bin/sh build-scripts/mkinstalldirs /usr/local/include/SDL2
......
/bin/sh build-scripts/mkinstalldirs /usr/local/lib/pkgconfig
/usr/bin/install -c -m 644 sdl2.pc /usr/local/lib/pkgconfig
/bin/sh build-scripts/mkinstalldirs /usr/local/lib/cmake/SDL2
mkdir -p -- /usr/local/lib/cmake/SDL2
/usr/bin/install -c -m 644 sdl2-config.cmake /usr/local/lib/cmake/SDL2
/usr/bin/install -c -m 644 sdl2-config-version.cmake /usr/local/lib/cmake/SDL2
bash 复制代码
$ ldconfig
$ pkg-config --modversion sdl2
2.0.22

五、其他关键库

10. libks
  • 基本功能:是一个开源的轻量级 C 语言基础库,主要服务于实时通信和信号处理领域,尤其在多媒体通信系统(如 FreeSWITCH)中扮演核心支撑角色。其设计聚焦于跨平台兼容性和高效性,为上层应用提供底层基础功能模块
  • 与FreeSWITCH的关联
    • 作为 FreeSWITCH 的底层库,提供线程调度、内存管理、网络 I/O 等基础功能,支撑 VoIP 媒体服务器的稳定运行。
bash 复制代码
$ yum -y install libatomic
$ wget https://files.freeswitch.org/downloads/libs/libks-2%202.0.2.tar.gz
$ tar --zxvf libks-2.2.0.2.tar.gz
$ cd libks-2.2.0.2
$ cmake .
$ make
$ make install

综上

FreeSWITCH的核心功能是"实时媒体流传输与呼叫控制",这些组件从编译构建媒体处理 再到功能扩展形成完整支撑:

  • 编译阶段:CMake/Autoconf处理跨平台配置,YASM/NASM编译汇编优化代码,确保源码和依赖库能在目标系统运行;
  • 媒体编解码:Opus(音频)、x264/libvpx(视频)提供高效的实时编解码能力,是通话质量的基础;
  • 媒体处理:FFmpeg/libav负责音视频转码、格式转换等核心任务,PortAudio/SDL2辅助硬件交互和调试;
  • 安全与兼容:libks 提供线程调度、内存管理、网络 I/O 等基础功能,支撑 VoIP 媒体服务器的稳定运行。

六、FreeSwitch的编译准备和安装

11.Spandsp(可选)
  • 基本功能:Spandsp 是一个为软件定义的电信应用提供支持的库,它实现了多种电信相关的功能,包括传真(T.38)、调制解调器、文本电话等协议的支持。Spandsp 被广泛用于需要处理传真传输或传统电话网络(PSTN)集成的应用中
  • 与freeswitch的关联:如果你计划在你的 FreeSWITCH 实例中启用传真功能,那么你可能需要安装并配置 Spandsp。
bash 复制代码
# 后续迁移至freeswitch安装目录下
$ git clone https://github.com/freeswitch/spandsp.git
$ cd spandsp
bash 复制代码
$ ./bootstrap.sh -j
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `config'.
libtoolize: copying file `config/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
configure.ac:48: installing 'config/config.guess'
configure.ac:48: installing 'config/config.sub'
configure.ac:46: installing 'config/install-sh'
configure.ac:46: installing 'config/missing'
Makefile.am: installing './INSTALL'
spandsp-sim/Makefile.am: installing 'config/depcomp'
bash 复制代码
$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
bash 复制代码
$ make
Making all in src
make[1]: 进入目录"/data/software/freeswitch/spandsp/src"
make  all-am
make[2]: 进入目录"/data/software/freeswitch/spandsp/src"
bash 复制代码
$ make install
Making install in src
make[1]: 进入目录"/data/software/freeswitch/spandsp/src"
......
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

......
make[2]: 进入目录"/data/software/freeswitch/spandsp"
make[2]: 对"install-exec-am"无需做任何事。
 /usr/bin/mkdir -p '/usr/local/lib/pkgconfig'
 /usr/bin/install -c -m 644 spandsp.pc '/usr/local/lib/pkgconfig'
make[2]: 离开目录"/data/software/freeswitch/spandsp"
make[1]: 离开目录"/data/software/freeswitch/spandsp"

根据install后的提示,追加pkgconfig路径:

bash 复制代码
vi ~/.bashrc
#文末追加
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:${PKG_CONFIG_PATH}
source ~/.bashrc
12.Sofia-sip
  • 基本功能:Sofia-sip 是一个用于 SIP(Session Initiation Protocol)协议栈的开源库,提供了构建基于 SIP 的应用所需的基本功能。SIP 是一种信令协议,用于控制多媒体通信会话的发起、修改和终止,常用于 VoIP 电话。Sofia-sip 库可以用来创建支持 SIP 的客户端或服务器端应用程序,如 IP 电话、即时通讯工具等。
  • 与freeswitch的关联:Sofia-sip 是 FreeSWITCH 中处理 SIP 信令的核心组件之一。FreeSWITCH 使用 Sofia-sip 来管理 SIP 会话,这意味着 Sofia-sip 对于支持基本的 VoIP 功能至关重要。FreeSWITCH 中名为 sofia 的模块就是基于 Sofia-sip 开发的,负责处理所有 SIP 相关的操作,比如注册、呼叫建立等
bash 复制代码
# 后续迁移至freeswitch安装目录下
$ git clone https://github.com/freeswitch/sofia-sip.git
$ cd sofia-sip/

./bootstrap.sh 
+ AUTOMAKE=automake
+ ACLOCAL=aclocal
+ export AUTOMAKE ACLOCAL
+ autoreconf -i
......
parallel-tests: installing './test-driver'
+ find . '(' -name 'run*' -o -name '*.sh' ')' -a -type f
+ xargs chmod +x
+ chmod +x scripts/coverage scripts/fix-include-sofia-sip scripts/hide_emails.sh scripts/lcov-report scripts/rpmbuild-snaphot scripts/uncovered
bash 复制代码
$ ./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking cached information... ok
checking for a BSD-compatible install... /usr/bin/install -c
......
bash 复制代码
$ make
make[1]: 进入目录"/data/software/freeswitch/sofia-sip/libsofia-sip-ua"
Making built-sources in su
make[2]: 进入目录"/data/software/freeswitch/sofia-sip/libsofia-sip-ua/su"
gawk -f ../../libsofia-sip-ua/su/tag_dll.awk NODLL=1  REF=su_tag_ref.c su_tag.c
make[2]: 离开目录"/data/software/freeswitch/sofia-sip/libsofia-sip-ua/su"
......
make[2]: 进入目录"/data/software/freeswitch/sofia-sip/utils"
	 COMPILE sip-options.o
	 LINK sip-options
	 COMPILE sip-date.o
	 LINK sip-date
	 COMPILE sip-dig.o
	 LINK sip-dig
make[2]: 离开目录"/data/software/freeswitch/sofia-sip/utils"
make[2]: 进入目录"/data/software/freeswitch/sofia-sip"
make[2]: 离开目录"/data/software/freeswitch/sofia-sip"
make[1]: 离开目录"/data/software/freeswitch/sofia-sip"
bash 复制代码
$ make install
Making install in libsofia-sip-ua
make[1]: 进入目录"/data/software/freeswitch/sofia-sip/libsofia-sip-ua"
Making install in su
make[2]: 进入目录"/data/software/freeswitch/sofia-sip/libsofia-sip-ua/su"
make  install-am
make[3]: 进入目录"/data/software/freeswitch/sofia-sip/libsofia-sip-ua/su"
make[4]: 进入目录"/data/software/freeswitch/sofia-sip/libsofia-sip-ua/su"
......
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/go/bin:/root/bin:/usr/lib64:/usr/local/go/bin:/sbin" ldconfig -n /usr/local/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
......
make[2]: 进入目录"/data/software/freeswitch/sofia-sip/utils"
 /usr/bin/mkdir -p '/usr/local/bin'
  /bin/sh ../libtool   --mode=install /usr/bin/install -c sip-options sip-date sip-dig '/usr/local/bin'
libtool: install: /usr/bin/install -c .libs/sip-options /usr/local/bin/sip-options
libtool: install: /usr/bin/install -c .libs/sip-date /usr/local/bin/sip-date
libtool: install: /usr/bin/install -c .libs/sip-dig /usr/local/bin/sip-dig
make[2]: 对"install-data-am"无需做任何事。
make[2]: 离开目录"/data/software/freeswitch/sofia-sip/utils"
make[1]: 离开目录"/data/software/freeswitch/sofia-sip/utils"
make[1]: 进入目录"/data/software/freeswitch/sofia-sip"
make[2]: 进入目录"/data/software/freeswitch/sofia-sip"
make[2]: 对"install-exec-am"无需做任何事。
make[2]: 对"install-data-am"无需做任何事。
make[2]: 离开目录"/data/software/freeswitch/sofia-sip"
make[1]: 离开目录"/data/software/freeswitch/sofia-sip"
12.freeswitch

安装包可以提供github等多种途径获得

解压安装包:

bash 复制代码
$ tar -zxvf freeswitch-1.10.12.tar.gz 
freeswitch-1.10.12/
freeswitch-1.10.12/.clang-format
freeswitch-1.10.12/.drone.yml
freeswitch-1.10.12/.gitattributes
freeswitch-1.10.12/.gitconfig
freeswitch-1.10.12/.github/
......
$ ./bootstrap.sh -j

初始化完毕后,目录下会生成 module.conf 文件,即需要引入编译的模块,需要自行判断是否需要视频、是否需要额外数据库、是否需要http交互等,建议自行对每个模块的功能有基础的了解。需要额外引入的模块,例如PG数据库、Redis等,都需要Linux服务器上安装必要的依赖包,比如libpq\hiredis等。初期使用,可以就依赖默认的sqlite做数据存储,文件做基础交互。

源码安装就是更能够使用开发的需求,可以自选模块进行编译,更为灵活。

为了快速编译启动体验,以下模块可以做出修改:

  1. 注释 applications/mod_signalwire: 暂不需要支持通过 SignalWire 的 API 和 SIP 中继实现语音、短信、视频等通信功能
  2. 注释 applications/mod_verto: 暂不需要支持 WebRTC 的浏览器端实时音视频通信能力,支持 JavaScript API

以下开始编译构建:

bash 复制代码
$ ./configure 
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
......

-------------------------- 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

------------------------------------------------------------------------------
bash 复制代码
$ make
gcc -std=gnu11 -o /data/software/freeswitch/freeswitch/build/print_git_revision /data/software/freeswitch/freeswitch/build/print_git_revision.c
cd libs/libvpx && CC="gcc -std=gnu11" CXX="g++" CFLAGS="-g -O2 -fvisibility=hidden" CXXFLAGS="-g -O2" LDFLAGS="" ./configure --enable-pic --disable-docs --disable-examples --disable-install-bins --disable-install-srcs --disable-unit-tests --size-limit=16384x16384
  enabling pic
  disabling docs
......
bash 复制代码
$ make -j install
make  install-recursive
make[1]: 进入目录"/data/software/freeswitch/freeswitch"
 /usr/bin/mkdir -p '/usr/local/freeswitch/lib'
 /bin/sh /data/software/freeswitch/freeswitch/libtool   --mode=install /usr/bin/install -c   libfreeswitch.la '/usr/local/freeswitch/lib'
libtool: install: /usr/bin/install -c .libs/libfreeswitch.so.1.0.0 /usr/local/freeswitch/lib/libfreeswitch.so.1.0.0
libtool: install: (cd /usr/local/freeswitch/lib && { ln -s -f libfreeswitch.so.1.0.0 libfreeswitch.so.1 || { rm -f libfreeswitch.so.1 && ln -s libfreeswitch.so.1.0.0 libfreeswitch.so.1; }; })
libtool: install: (cd /usr/local/freeswitch/lib && { ln -s -f libfreeswitch.so.1.0.0 libfreeswitch.so || { rm -f libfreeswitch.so && ln -s libfreeswitch.so.1.0.0 libfreeswitch.so; }; })
libtool: install: /usr/bin/install -c .libs/libfreeswitch.lai /usr/local/freeswitch/lib/libfreeswitch.la
libtool: finish: PATH="/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/go/bin:/root/bin:/usr/lib64:/sbin" ldconfig -n /usr/local/freeswitch/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/freeswitch/lib
 +---------- FreeSWITCH install Complete ----------+
 + FreeSWITCH has been successfully installed.     +
 +                                                 +
 +       Install sounds:                           +
 +       (uhd-sounds includes hd-sounds, sounds)   +
 +       (hd-sounds includes sounds)               +
 +       ------------------------------------      +
 +                make cd-sounds-install           +
 +                make cd-moh-install              +
 +                                                 +
 +                make uhd-sounds-install          +
 +                make uhd-moh-install             +
 +                                                 +
 +                make hd-sounds-install           +
 +                make hd-moh-install              +
 +                                                 +
 +                make sounds-install              +
 +                make moh-install                 +
 +                                                 +
 +       Install non english sounds:               +
 +       replace XX with language                  +
 +       (ru : Russian)                            +
 +       (fr : French)                             +
 +       ------------------------------------      +
 +                make cd-sounds-XX-install        +
 +                make uhd-sounds-XX-install       +
 +                make hd-sounds-XX-install        +
 +                make sounds-XX-install           +
 +                                                 +
 +       Upgrade to latest:                        +
 +       ----------------------------------        +
 +                make current                     +
 +                                                 +
 +       Rebuild all:                              +
 +       ----------------------------------        +
 +                make sure                        +
 +                                                 +
 +       Install/Re-install default config:        +
 +       ----------------------------------        +
 +                make samples                     +
 +                                                 +
 +                                                 +
 +       Additional resources:                     +
 +       ----------------------------------        +
 +       https://www.freeswitch.org                +
 +       https://freeswitch.org/confluence         +
 +       https://freeswitch.org/jira               +
 +       http://lists.freeswitch.org               +
 +                                                 +
 +       irc.freenode.net / #freeswitch            +
 +                                                 +
 +       Register For ClueCon:                     +
 +       ----------------------------------        +
 +       https://www.cluecon.com                   +
 +                                                 +
 +-------------------------------------------------+
.=======================================================================================================.
|       _                            _    ____ _             ____                                       |
|      / \   _ __  _ __  _   _  __ _| |  / ___| |_   _  ___ / ___|___  _ __                             |
|     / _ \ | '_ \| '_ \| | | |/ _` | | | |   | | | | |/ _ \ |   / _ \| '_ \                            |
|    / ___ \| | | | | | | |_| | (_| | | | |___| | |_| |  __/ |__| (_) | | | |                           |
|   /_/   \_\_| |_|_| |_|\__,_|\__,_|_|  \____|_|\__,_|\___|\____\___/|_| |_|                           |
|                                                                                                       |
|    ____ _____ ____    ____             __                                                             |
|   |  _ \_   _/ ___|  / ___|___  _ __  / _| ___ _ __ ___ _ __   ___ ___                                |
|   | |_) || || |     | |   / _ \| '_ \| |_ / _ \ '__/ _ \ '_ \ / __/ _ \                               |
|   |  _ < | || |___  | |__| (_) | | | |  _|  __/ | |  __/ | | | (_|  __/                               |
|   |_| \_\|_| \____|  \____\___/|_| |_|_|  \___|_|  \___|_| |_|\___\___|                               |
|                                                                                                       |
|     ____ _             ____                                                                           |
|    / ___| |_   _  ___ / ___|___  _ __         ___ ___  _ __ ___                                       |
|   | |   | | | | |/ _ \ |   / _ \| '_ \       / __/ _ \| '_ ` _ \                                      |
|   | |___| | |_| |  __/ |__| (_) | | | |  _  | (_| (_) | | | | | |                                     |
|    \____|_|\__,_|\___|\____\___/|_| |_| (_)  \___\___/|_| |_| |_|                                     |
|                                                                                                       |
.=======================================================================================================.
Checking module integrity in target [/usr/local/freeswitch/mod]


make[2]: 离开目录"/data/software/freeswitch/freeswitch/build"
Making install in tests/unit
make[2]: 进入目录"/data/software/freeswitch/freeswitch/tests/unit"
make[3]: 进入目录"/data/software/freeswitch/freeswitch/tests/unit"
make[3]: 对"install-data-am"无需做任何事。
 /usr/bin/mkdir -p '/usr/local/freeswitch/bin'
  /bin/sh /data/software/freeswitch/freeswitch/libtool   --mode=install /usr/bin/install -c switch_eavesdrop '/usr/local/freeswitch/bin'
libtool: install: /usr/bin/install -c .libs/switch_eavesdrop /usr/local/freeswitch/bin/switch_eavesdrop
make[3]: 离开目录"/data/software/freeswitch/freeswitch/tests/unit"
make[2]: 离开目录"/data/software/freeswitch/freeswitch/tests/unit"
make[1]: 离开目录"/data/software/freeswitch/freeswitch"

根据最后安装成功的提示,安装声音文件:

bash 复制代码
$ make sounds-install
#/data/software/freeswitch/freeswitch
# /data/software/freeswitch/freeswitch/build/getsounds.sh freeswitch-sounds-en-us-callie-8000-1.0.53.tar.gz /usr/local/freeswitch/sounds/
--2025-07-17 11:19:33--  http://files.freeswitch.org/freeswitch-sounds-en-us-callie-8000-1.0.53.tar.gz
正在解析主机 files.freeswitch.org (files.freeswitch.org)... 190.102.98.174, 2803:d000:fffe::174
正在连接 files.freeswitch.org (files.freeswitch.org)|190.102.98.174|:80... 已连接。
......
$ make moh-install
#/data/software/freeswitch/freeswitch
# /data/software/freeswitch/freeswitch/build/getsounds.sh freeswitch-sounds-music-8000-1.0.52.tar.gz /usr/local/freeswitch/sounds/
--2025-07-17 11:33:36--  http://files.freeswitch.org/freeswitch-sounds-music-8000-1.0.52.tar.gz
正在解析主机 files.freeswitch.org (files.freeswitch.org)... 190.102.98.174, 2803:d000:fffe::174
正在连接 files.freeswitch.org (files.freeswitch.org)|190.102.98.174|:80... 已连接。
......

以上完成后就可以开始体验Freeswitch的功能了

七、服务的启动和访问

可以前台启动或后台启动

前台

用于测试与调试,可以看到最完整的启动信息与交互日志,便于排查

bash 复制代码
$ freeswitch 
2025-07-17 15:14:38.811260 0.00% [INFO] switch_event.c:714 Activate Eventing Engine.
2025-07-17 15:14:38.821648 0.00% [WARNING] switch_event.c:685 Create additional event dispatch thread 0
2025-07-17 15:14:43.997438 0.00% [INFO] switch_stun.c:915 External ip address detected using STUN: 49.72.17.32
2025-07-17 15:14:54.016382 0.00% [ERR] switch_stun.c:918 STUN Failed! [Timeout]
2025-07-17 15:14:54.016425 0.00% [ERR] switch_xml.c:175 stun-set failed.
2025-07-17 15:14:54.047721 0.00% [INFO] switch_nat.c:417 Scanning for NAT
2025-07-17 15:14:54.047874 0.00% [DEBUG] switch_nat.c:170 Checking for PMP 1/5
2025-07-17 15:14:54.050407 0.00% [ERR] switch_nat.c:199 Error checking for PMP [wait sock failed]
2025-07-17 15:14:54.050446 0.00% [DEBUG] switch_nat.c:422 Checking for UPnP
2025-07-17 15:15:06.050999 0.00% [INFO] switch_nat.c:438 No PMP or UPnP NAT devices detected!
......
2025-07-17 15:18:10.552265 100.00% [CONSOLE] switch_core.c:2494 
.=============================================================.
|   _____              ______        _____ _____ ____ _   _   |
|  |  ___| __ ___  ___/ ___\ \      / /_ _|_   _/ ___| | | |  |
|  | |_ | '__/ _ \/ _ \___ \\ \ /\ / / | |  | || |   | |_| |  |
|  |  _|| | |  __/  __/___) |\ 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/         |
.=============================================================.

.=======================================================================================================.
|       _                            _    ____ _             ____                                       |
|      / \   _ __  _ __  _   _  __ _| |  / ___| |_   _  ___ / ___|___  _ __                             |
|     / _ \ | '_ \| '_ \| | | |/ _` | | | |   | | | | |/ _ \ |   / _ \| '_ \                            |
|    / ___ \| | | | | | | |_| | (_| | | | |___| | |_| |  __/ |__| (_) | | | |                           |
|   /_/   \_\_| |_|_| |_|\__,_|\__,_|_|  \____|_|\__,_|\___|\____\___/|_| |_|                           |
|                                                                                                       |
|    ____ _____ ____    ____             __                                                             |
|   |  _ \_   _/ ___|  / ___|___  _ __  / _| ___ _ __ ___ _ __   ___ ___                                |
|   | |_) || || |     | |   / _ \| '_ \| |_ / _ \ '__/ _ \ '_ \ / __/ _ \                               |
|   |  _ < | || |___  | |__| (_) | | | |  _|  __/ | |  __/ | | | (_|  __/                               |
|   |_| \_\|_| \____|  \____\___/|_| |_|_|  \___|_|  \___|_| |_|\___\___|                               |
|                                                                                                       |
|     ____ _             ____                                                                           |
|    / ___| |_   _  ___ / ___|___  _ __         ___ ___  _ __ ___                                       |
|   | |   | | | | |/ _ \ |   / _ \| '_ \       / __/ _ \| '_ ` _ \                                      |
|   | |___| | |_| |  __/ |__| (_) | | | |  _  | (_| (_) | | | | | |                                     |
|    \____|_|\__,_|\___|\____\___/|_| |_| (_)  \___\___/|_| |_| |_|                                     |
|                                                                                                       |
.=======================================================================================================.


2025-07-17 15:18:10.552279 100.00% [INFO] switch_core.c:2503 
FreeSWITCH Version 1.10.12-release~64bit ( 64bit)

FreeSWITCH Started
Max Sessions [1000]
Session Rate [30]
SQL [Enabled]
后台

用于生产启动,可以前往log查看启动进展

bash 复制代码
freeswitch -nc -nonat
24676 Backgrounding.
bash 复制代码
$ tail -100f /usr/local/freeswitch/log/freeswitch.log 
2025-07-17 14:32:09.797485 98.60% [NOTICE] switch_loadable_module.c:1546 Deleting Chat interface 'sip'
2025-07-17 14:32:09.797485 98.60% [NOTICE] switch_loadable_module.c:1590 Deleting Management interface 'mod_sofia' OID[.1.3.6.1.4.1.27880.1001]
2025-07-17 14:32:09.797485 98.60% [CONSOLE] switch_loadable_module.c:2354 Stopping: mod_sofia
2025-07-17 14:32:09.797485 98.60% [NOTICE] switch_event.c:467 Subclass reservation deleted for mod_sofia.c:sofi
......
2025-07-17 15:18:10.552265 100.00% [CONSOLE] switch_core.c:2494 
.=============================================================.
|   _____              ______        _____ _____ ____ _   _   |
|  |  ___| __ ___  ___/ ___\ \      / /_ _|_   _/ ___| | | |  |
|  | |_ | '__/ _ \/ _ \___ \\ \ /\ / / | |  | || |   | |_| |  |
|  |  _|| | |  __/  __/___) |\ 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/         |
.=============================================================.

.=======================================================================================================.
|       _                            _    ____ _             ____                                       |
|      / \   _ __  _ __  _   _  __ _| |  / ___| |_   _  ___ / ___|___  _ __                             |
|     / _ \ | '_ \| '_ \| | | |/ _` | | | |   | | | | |/ _ \ |   / _ \| '_ \                            |
|    / ___ \| | | | | | | |_| | (_| | | | |___| | |_| |  __/ |__| (_) | | | |                           |
|   /_/   \_\_| |_|_| |_|\__,_|\__,_|_|  \____|_|\__,_|\___|\____\___/|_| |_|                           |
|                                                                                                       |
|    ____ _____ ____    ____             __                                                             |
|   |  _ \_   _/ ___|  / ___|___  _ __  / _| ___ _ __ ___ _ __   ___ ___                                |
|   | |_) || || |     | |   / _ \| '_ \| |_ / _ \ '__/ _ \ '_ \ / __/ _ \                               |
|   |  _ < | || |___  | |__| (_) | | | |  _|  __/ | |  __/ | | | (_|  __/                               |
|   |_| \_\|_| \____|  \____\___/|_| |_|_|  \___|_|  \___|_| |_|\___\___|                               |
|                                                                                                       |
|     ____ _             ____                                                                           |
|    / ___| |_   _  ___ / ___|___  _ __         ___ ___  _ __ ___                                       |
|   | |   | | | | |/ _ \ |   / _ \| '_ \       / __/ _ \| '_ ` _ \                                      |
|   | |___| | |_| |  __/ |__| (_) | | | |  _  | (_| (_) | | | | | |                                     |
|    \____|_|\__,_|\___|\____\___/|_| |_| (_)  \___\___/|_| |_| |_|                                     |
|                                                                                                       |
.=======================================================================================================.


2025-07-17 15:18:10.552279 100.00% [INFO] switch_core.c:2503 
FreeSWITCH Version 1.10.12-release~64bit ( 64bit)

FreeSWITCH Started
Max Sessions [1000]
Session Rate [30]
SQL [Enabled]
访问命令行

启动后可以采用命令行访问,或者后续开发了java、webrtc等工具进行交互

bash 复制代码
$ fs_cli -H IP -P PORT -p "PASSWORD" -d DEBUG_LEVEL
DEBUG] esl_config.c:56 esl_config_open_file() Configuration file is /root/.fs_cli_conf.
[DEBUG] esl_config.c:56 esl_config_open_file() Configuration file is /etc/fs_cli.conf.
[DEBUG] fs_cli.c:1649 main() no profiles found, using builtin profile
=======================================================.
|            _____ ____     ____ _     ___              |
|           |  ___/ ___|   / ___| |   |_ _|             |
|           | |_  \___ \  | |   | |    | |              |
|           |  _|  ___) | | |___| |___ | |              |
|           |_|   |____/   \____|_____|___|             |
|                                                       |
.=======================================================.
| Anthony Minessale II, Ken Rice,                       |
| Michael Jerris, Travis Cross                          |
| FreeSWITCH (http://www.freeswitch.org)                |
| Paypal Donations Appreciated: paypal@freeswitch.org   |
| Brought to you by ClueCon http://www.cluecon.com/     |
.=======================================================.

.=======================================================================================================.
|       _                            _    ____ _             ____                                       |
|      / \   _ __  _ __  _   _  __ _| |  / ___| |_   _  ___ / ___|___  _ __                             |
|     / _ \ | '_ \| '_ \| | | |/ _` | | | |   | | | | |/ _ \ |   / _ \| '_ \                            |
|    / ___ \| | | | | | | |_| | (_| | | | |___| | |_| |  __/ |__| (_) | | | |                           |
|   /_/   \_\_| |_|_| |_|\__,_|\__,_|_|  \____|_|\__,_|\___|\____\___/|_| |_|                           |
|                                                                                                       |
|    ____ _____ ____    ____             __                                                             |
|   |  _ \_   _/ ___|  / ___|___  _ __  / _| ___ _ __ ___ _ __   ___ ___                                |
|   | |_) || || |     | |   / _ \| '_ \| |_ / _ \ '__/ _ \ '_ \ / __/ _ \                               |
|   |  _ < | || |___  | |__| (_) | | | |  _|  __/ | |  __/ | | | (_|  __/                               |
|   |_| \_\|_| \____|  \____\___/|_| |_|_|  \___|_|  \___|_| |_|\___\___|                               |
|                                                                                                       |
|     ____ _             ____                                                                           |
|    / ___| |_   _  ___ / ___|___  _ __         ___ ___  _ __ ___                                       |
|   | |   | | | | |/ _ \ |   / _ \| '_ \       / __/ _ \| '_ ` _ \                                      |
|   | |___| | |_| |  __/ |__| (_) | | | |  _  | (_| (_) | | | | | |                                     |
|    \____|_|\__,_|\___|\____\___/|_| |_| (_)  \___\___/|_| |_| |_|                                     |
|                                                                                                       |
.=======================================================================================================.

Type /help <enter> to see a list of commands



[INFO] fs_cli.c:1867 main() FS CLI Ready.
enter /help for a list of commands.
+OK log level  [7]
freeswitch@opensips>status

UP 0 years, 0 days, 0 hours, 39 minutes, 57 seconds, 346 milliseconds, 481 microseconds
FreeSWITCH (Version 1.10.12-release  64bit) is ready
0 session(s) since startup
0 session(s) - peak 0, last 5min 0 
0 session(s) per Sec out of max 30, peak 0, last 5min 0 
1000 session(s) max
min idle cpu 0.00/99.17
Current Stack Size/Max 240K/8192K
相关推荐
悲伤小伞4 小时前
Linux_Ext系列文件系统基本认识(一)
linux·运维·服务器·c语言·编辑器
网硕互联的小客服4 小时前
服务器无法访问公网的原因及解决方案
运维·服务器
nVisual5 小时前
智算中心光纤线缆如何实现自动化计算?
运维·自动化·数据中心·综合布线·机房规划
寒水馨6 小时前
聊聊DevOps,开发与运维如何分工协作?
运维·ci/cd·开发·devops
豆是浪个7 小时前
Linux(Centos 7.6)命令详解:jobs
linux·运维·centos
Fireworkitte7 小时前
ps aux 和 ps -ef
linux·运维·vim
hweiyu008 小时前
DevOps是什么?
运维·devops
云和数据.ChenGuang9 小时前
KVM中使用桥接模式.运维就业技术教程
运维·桥接模式·运维技术教程