fs_cli 命令行
概述
FreeSWITCH CLI (fs_cli) 是 FreeSWITCH 的命令行管理工具,用于实时控制和管理 FreeSWITCH。
快捷键配置文件: /conf/autoload_configs/switch.conf.xml
🔧 基础操作
进入/退出 CLI
1 2 3 4 5 6 7 8
| fs_cli
fs_cli -x "命令"
/exit 或 quit
|
帮助
📞 Sofia 调试命令
Profile 状态
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| sofia status profile internal
sofia status profile internal reg
sofia status profile internal reg 1000
sofia status profile internal user 1000
sofia status
|
网关管理
1 2 3 4 5 6 7 8 9
| sofia status gateway
sofia status gateway gw-name
sofia profile external killgw gw-name sofia profile external rescan
|
SIP 抓包
1 2 3 4 5 6 7
| sofia profile internal capture on sofia profile internal capture off
sofia global siptrace on sofia global siptrace off
|
Debug 日志
1 2 3 4 5
| sofia loglevel nua 9
console loglevel 7
|
🎵 常用功能
回铃音测试
1 2 3 4 5
| originate user/1000 &echo()
originate {ringback=%(2000,4000,440,480)}user/1000 &echo()
|
播放放音
1 2 3 4 5
| uuid_broadcast <uuid> play::misc/welcome.wav
uuid_park <uuid>
|
设置外显号码
1 2 3 4 5
| originate {origination_caller_id_number=13800138000}user/1001 &echo()
originate {effective_caller_id_name=张三,effective_caller_id_number=1001}user/1001 &echo()
|
呼叫并录音
1 2 3 4 5 6
| originate {record_path=/tmp/record.wav,record_append=true}user/1001 &echo()
uuid_record <uuid> start /tmp/call.wav uuid_record <uuid> stop /tmp/call.wav
|
🧪 正则校验
1 2 3 4 5 6 7 8 9 10 11
|
regex 1234 | ^\d
regex 1001 | ^10\d{2}$ regex 912345678 | ^9(\d+)$ regex 5000 | ^5000$
|
📊 状态查询
通道状态
1 2 3 4 5 6 7 8 9 10 11
| show channels
show detailed channels
show channels count
show channels <uuid>
|
呼叫状态
1 2 3 4 5 6 7 8
| show calls
show detailed calls
show calls count
|
分机状态
1 2 3 4 5
| user_exists <分机号>
sofia status profile internal reg
|
🔍 调试技巧
实时日志
1 2 3 4 5 6 7 8
| console loglevel 7
console loglevel 7 | grep sofia
console loglevel | grep -i error
|
抓包分析
1 2 3 4 5 6 7 8
| sofia global siptrace on
sofia profile internal capture on
|
呼叫追踪
1 2 3 4 5
| uuid_setvar <uuid> process_cdr true
uuid_getvar <uuid> <variable_name>
|
📝 配置重载
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| reloadxml
reload mod_sofia
sofia profile internal restart reloadxml
reload mod_dialplan_xml
reload mod_acl
|
🚨 常用操作
挂断呼叫
1 2 3 4 5
| uuid_kill <uuid>
hupall
|
转移呼叫
1 2 3 4 5
| uuid_transfer <uuid> 1001
uuid_transfer <uuid> 13800138000 XML default
|
变量操作
1 2 3 4 5 6 7 8
| uuid_setvar <uuid> variable_name value
uuid_getvar <uuid> variable_name
uuid_dump <uuid>
|
📚 相关文档