FreeSWITCH依赖及编译说明

706 阅读2分钟

FreeSWITCH依赖及编译说明

众所周知FreeSWITCH官方使用的Debian,并且已经支持Debian 12 bookworm。这里就以最新的FreeSWITCH代码及bookworm为例,整理一下FreeSWITCH源码编译的过程,Debian 10和11也基本类似。

基本环境

修改source.list,如果需要https自行修改即可,当然其他熟悉的源也没有问题。

deb http://mirrors.163.com/debian/ bookworm main non-free non-free-firmware contrib
deb http://mirrors.163.com/debian-security/ bookworm-security main
deb http://mirrors.163.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb http://mirrors.163.com/debian/ bookworm-backports main non-free non-free-firmware contrib

安装基本依赖:

apt update
apt install -y sqlite3 curl wget perl python3 swig cmake git yasm nasm \
    tig htop gdb sngrep vim lua5.2 automake autoconf pkg-config unixodbc
apt install -y odbc-postgresql build-essential uuid-dev zlib1g-dev libjpeg-dev \
     libncurses5-dev libssl-dev libpcre3-dev libcurl4-openssl-dev libedit-dev \
     libspeexdsp-dev libspeexdsp-dev libsqlite3-dev libgdbm-dev libdb-dev libvlc-dev \
     libsndfile1-dev libopus-dev lua5.2-dev libtiff-dev libfreetype6 unixodbc-dev\
     libpng16-16  libavformat-dev libswscale-dev libavfilter-dev libhiredis-dev\
     libavutil-dev libswresample-dev libshout-dev libmpg123-dev libmp3lame-dev \
     libmagickcore-dev libldns-dev libmariadb-dev openssh-client python3-dev\
     libpq-dev libpcap-dev librabbitmq-dev librabbitmq4

依赖库编译

  • sofia-sip
git clone https://github.com/freeswitch/sofia-sip.git
cd sofia-sip && ./bootstrap.sh && ./configure && make -j4 && make install
  • spandsp
git clone https://github.com/freeswitch/spandsp.git
cd spandsp && ./bootstrap.sh && ./configure && make -j4 && make install
  • libks
git clone https://github.com/signalwire/libks
cd libks && cmake . -DCMAKE_INSTALL_PREFIX:PATH=/usr/local && make -j4 && make install

FreeSWITC编译

git clone https://github.com/signalwire/freeswitch.git
cd freeswitch && ./bootstrap.sh && ./configure && make -j4 && make install

编译时遇到问题根据具体的报错信息再一步步解决。

不需要的模块,可以修改FreeSWTICH源码根目录下modules.conf注释掉相关的模块即可,比如mod_signalwire

./configure --help可以查看具体的编译选项,比如安装目录等。

实际工作中如果仅修改了某个模块比如mod_sofia,可以在源码根目录下直接执行make mod_sofia-install

如果修改了核心,可以moke core-install

install成功后,可以创建两个软连接:

ln -sf /usr/local/freeswitch/bin/freeswitch /usr/bin/
ln -sf /usr/local/freeswitch/bin/fs_cli /usr/bin/

启动FreeSWITCH:

# -nonat不进行nat检查,启动会快一点,-nc表示放到后台启动
freeswitch -nonat -nc

第一次启动可以不加-nc,启动到前台看看是不是有什么报错。

fs_cli -h可以查看选项,配置对应event_socket.conf.xml可以修改默认端口及用户名密码。

其他

如果需要unimrcp,直接参考github.com/freeswitch/… README很详细。