macOS 安装 FreeSWITCH
概述
在 macOS 上安装 FreeSWITCH 主要有两种方式:
- Homebrew 安装(推荐,简单快速)
- 源码编译安装(适合需要自定义配置的场景)
🍺 Homebrew 安装
前置条件
安装 Homebrew(如果尚未安装):
1
| /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
安装依赖
1 2 3 4 5 6 7 8 9 10 11 12 13
| brew update
brew install autoconf automake curl ffmpeg@5 jpeg ldns libpq \ libsndfile libtiff libtool lua openssl opus pcre \ pkg-config sofia-sip speex speex speexdsp sqlite yasm \ signalwire/homebrew-signalwire/libks \ signalwire/homebrew-signalwire/signalwire-c \ signalwire/homebrew-signalwire/spandsp
brew link ffmpeg@5
|
安装 FreeSWITCH
1 2 3 4 5
| brew install freeswitch
freeswitch -version
|
📂 文件/目录路径
⚙️ 修改加载的配置模块
编辑模块配置文件
1 2
| vim /opt/homebrew/etc/freeswitch/autoload_configs/modules.conf.xml
|
启用/禁用模块
1 2 3 4 5 6 7 8 9 10 11 12 13
| <configuration name="modules.conf" description="Modules"> <modules> <load module="mod_sofia"/> <load module="mod_verto"/> <load module="mod_opus"/>
<noload module="mod_amr"/> <noload module="mod_celt"/> </modules> </configuration>
|
重启或运行
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
brew services restart freeswitch
freeswitch -nc
freeswitch -c
freeswitch -stop
fs_cli
|
验证修改
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| fs_cli
module_exists mod_<模块名>
fs_cli -x "reloadxml"
global_getvar
netstat -an | grep 5060
sofia status profile internal reg
module list sofia status verto status
|
🚨 常见问题
找不到配置文件
如果路径不同,通过以下命令查找:
1 2 3 4 5
| brew list freeswitch
find /opt/homebrew -name "modules.conf.xml" 2>/dev/null
|
权限问题
如果修改配置后无法生效,尝试赋予权限:
1 2 3 4 5
| sudo chown -R $(whoami) /opt/homebrew/etc/freeswitch/
sudo chown -R $(whoami) /opt/homebrew/var/log/freeswitch/
|
模块依赖错误
如果启动报错(如缺少依赖),检查日志:
1 2 3 4 5
| tail -f /opt/homebrew/var/log/freeswitch/freeswitch.log
brew reinstall freeswitch
|
🗑️ 卸载 FreeSWITCH
1 2 3 4 5 6
| brew uninstall freeswitch
rm -rf /opt/homebrew/etc/freeswitch/ rm -rf /opt/homebrew/var/log/freeswitch/
|
🔧 源码编译安装
克隆项目
1 2 3
| git clone https://github.com/signalwire/freeswitch.git cd freeswitch
|
配置编译选项
1 2 3 4 5 6 7 8 9
| ./configure \ --build=arm64-apple-darwin24.2.0 \ --prefix=/usr/local/freeswitch \ --with-openssl=/opt/homebrew/opt/openssl@3 \ --enable-shared \ --disable-static \ --with-arm-neon \ --disable-nice
|
编译安装
1 2 3 4 5 6
| sudo make install
make sounds-install make moh-install
|
创建软链接
1 2 3 4 5
| sudo ln -sfn /usr/local/freeswitch/bin/freeswitch /usr/bin/freeswitch
sudo ln -sf /usr/local/freeswitch/bin/fs_cli /usr/bin/fs_cli
|
设置权限
1 2
| sudo chown -R $(whoami) /usr/local/freeswitch/
|
📋 拓展命令
版本管理
1 2 3 4 5 6 7 8
| make current
make sure
make samples
|
模块管理
1 2 3 4 5 6 7 8 9 10
| make mod_XXX
make mod_xxx-install
load mod_xxx
|
运行管理
1 2 3 4 5 6 7 8 9 10 11
| fs_cli -x "reloadxml"
netstat -an | grep 5060
sofia status profile internal reg
global_getvar
|
🔗 相关文档