freeswitch 常用指令 fs_cli指令

简介: 显示注册用户 : show registrationsvars.xml | 一些经常使用变量
  1. 显示注册用户 : show registrations

  2. vars.xml | 一些经常使用变量
    dialplan/default.xml | 缺省的拨号计划
    directory/default/*.xml | SIP用户,每用户一个文件
    sip_profiles/internal.xml | 一个SIP profile,或称做一个SIP-UA,监听在本地IP及端口5060,通常供内网用户使用
    sip_profiles/externa.xml | 另外一个SIP-UA,用做外部链接,端口5080
    autoload_configs/modules.conf.xml | 配置当FreeSWITCH启动时自动装载哪些模块


FS> sofia status profile internal (显示多少用户已注册)

FS> originate sofia/profile/internal/1000 &echo (拨打1000并执行echo程序)

FS> originate user/1000 &echo (同上)

FS> originate sofia/profile/internal/1000 9999 (至关于在软电话1000上拨打9999)

FS> originate sofia/profile/internal/1000 9999 XML default (同上)we

fs_cli是FreeSWITCH的一个客户端连接程序,可以方便地查看运行情况,并对其进行控制。若在本机使用默认配置,可直接启动fs_cli;否则需要携带参数(以连接运行在192.168.1.100上的FreeSWITCH为例):


  • 启动一个命令行窗口,通过help可以查看操作命令;

fs_cli.exe -H 192.168.1.100 -P 8021 -p NewPSW

  • fs_cli也可执行一条指定的命令(如获取版本信息):

fs_cli.exe -H 192.168.1.100 -P 8021 -p NewPSW   -x "version"

 

以下‘Console窗口‘是指通过命令行启动(不用nc参数)时的显示与控制界面。

 


退出操作

退出fs_cli(保持FreeSWITCH运行):

  • /quit
  • /bye
  • /exit
  • ...:三个点,若在‘Console窗口‘中为退出FreeSWITCH;
  • Linux可通过ctrl+D快捷键;

退出FreeSWITCH:

  • shutdown

 


日志与显示操作

设定显示日志级别

  • 通过console loglevel设定显示级别(fs_cli和‘Console窗口‘中都可以):
  • debug,info,notice,warning,err,crit,alert:7个级别
  • 1~7: 对应上面7个级别(7为debug,1为alert)
  • 0:关闭所有输出(console loglevel 0);
  • fsctl loglevel :设定指定日志级别;
  • /log:默认为debug或指定的级别(与loglevel相同);
  • /nolog:关闭日志;
  • sofia profile internal siptrace  on/off:开启或关闭SIP消息跟踪功能。

 


全局变量

  • 全局变量:
  • global_getvar []:获取全局变量
  • global_setvar =:设定全局变量
  • 查看:eval ${val-name}

global_getvar domain

eval ${domain}

 


fsctl:发送控制信息

fsctl [send_sighup |

       hupall |

       pause [inbound|outbound] |

       resume [inbound|outbound] |

       shutdown [cancel|elegant|asap|restart] |

       last_sps |

       sps [num] |

       sync_clock |

       sync_clock_when_idle |

       reclaim_mem |

       max_sessions |

       min_dtmf_duration [num] |

       max_dtmf_duration [num] |

       default_dtmf_duration [num] |

       loglevel [level] |

       verbose_events [on|off]

      ]

  • fsctl debug_level [level]:设定日志记录级别(影响日志记录、console输出等)
  • 0 - fatal errors, panic
  • 1 - critical errors, minimal progress at subsystem level
  • 2 - non-critical errors
  • 3 - warnings, progress messages
  • 5 - signaling protocol actions (incoming packets, ...)
  • 7 - media protocol actions (incoming packets, ...)
  • 9 - entering/exiting functions, very verbatim progress
  • fsctl hupall dialed_ext :关闭所有指定呼叫,如:fsctl hupall normal_clearing dialed_ext 1000
  • fsctl shutdown [asap|asap restart|cancel|elegant|now|restart|restart asap|restart elegant]
  • cancel - discontinue a previous shutdown request.
  • elegant - wait for all traffic to stop, while allowing new traffic.
  • asap - wait for all traffic to stop, but deny new traffic.
  • now - shutdown FreeSWITCH immediately.
  • restart - restart FreeSWITCH immediately following the shutdown.

 


通话相关命令简介

  • 查看注册用:
  • sofia status/xmlstatus profile internal reg [1006]
  • show registrations
  • 删除注册用户:sofia profile internal flush_inbound_reg <用户id>
  • 查看通话通道:show channels [like 1006@] as xml
  • 呼叫(1.6版本下,要带absolute_codec_string='PCMA',否则可能是视频呼叫,然后编码失败):
  • originate user/1011 &bridge(user/1013)
  • originate user/1006 &bridge(sofia/external/5001@192.168.6.90)
  • originate user/1011 &playback(rec1011.wav)
  • originate user/1012 &conference(3001)
  • originate user/1011 &echo
  • 关闭所有指定呼叫:hupall [ ]
  • hupall normal_clearing foo bar:关闭所有通道变量foo=bar的channel
  • 加入会议:
  • conference 3001 dial {absolute_codec_string='PCMA@20i'}user/1013
  • conference 3001 dial sofia/external/5001@192.168.6.90
  • 列出所有会议:conference list
  • 呼叫中心:
  • 查看Agent:callcenter_config agent list
  • 查看队列:callcenter_config queue list
  • 顺振:originate user/1006 &bridge(user/1011|user/1012)
  • 同振:originate user/1006 &bridge(user/1011,user/1012)
  • 添加通道变量:originate {origination_caller_id_number=8888,ignore_early_media=true,xugd-wavfile=notice.wav,absolute_codec_string=PCMA}user/1018 &lua(voiceNotify.lua)
  • 重新加载配置:
  • reloadxml:重新一般配置修改(拨号计划、用户等)
  • 网关(重启):sofia profile external restart
  • 只重新加载修改的网关(gwt):
  • sofia profile external killgw gwt
  • sofia profile external rescan
  • reload :重新加载模块
  • reloadacl:重新加载ACL
  • uuid一族(以uuid开始的)
  • uuid_answer :接听
  • uuid_kill [cause]:挂机
  • uuid_bridge :桥接通道
  • uuid_transfer [-bleg|-both] [] []:转移电话
  • uuid_break [all]:停止媒体发送
  • uuid_broadcast [aleg|bleg|both]:播放媒体;
  • uuid_deflect :转移通话
  • uuid_displace [start|stop] [] [mux]:替换媒体(Displace the audio for the target with the specified audio)
  • uuid_record [start|stop|mask|unmask] []:录音,Where limit is the max number of seconds to record
  • uuid_getvar :获取通道上变量
  • uuid_setvar [value]:设定通道变量

 


show:显示信息

show [

  aliases |

  api |

  application |

  bridged_calls |

  calls [count] |

  channels [count|like ] |

  chat |

  codec |

  complete |

  detailed_bridged_calls |

  detailed_calls |

  dialplan |

  endpoint |

  file |

  interface_types |

  interfaces |

  limits

  management |

  modules |

  nat_map |

  registrations |

  say |

  tasks |

  timer |

  ] [as xml|as delim ]

  • aliases – list defined command aliases
  • api – list api commands exposed by loadable modules
  • application – list applications exposed by loadable modules, notably mod_dptools
  • calls [count] – list details of currently active calls; the keyword "count" eliminates the details and only prints the total count of calls
  • channels [count|like ] – list current channels; see Channels vs Calls
  • count – show only the count of active channels, no details
  • like – filter results to include only channels that contain in uuid, channel name, cid_number, cid_name, presence data fields.
  • chat – list chat interfaces
  • codec – list codecs that are currently loaded in FreeSWITCH
  • complete – list command argument completion tables
  • detailed_bridged_calls – same as "show detailed_calls"
  • detailed_calls – like "show calls" but with more fields
  • dialplan – list dialplan interfaces
  • endpoint – list endpoint interfaces currently available to FS
  • file – list supported file format interfaces
  • interface_types – list all interface types with a summary count of each type of interface available
  • interfaces – enumerate all available interfaces by type, showing the module which exposes each interface
  • limits – list database limit interfaces
  • management – list management interfaces
  • module – enumerate modules and the path to each
  • nat_map – list Network Address Translation map
  • registrations – enumerate user extension registrations
  • say – enumerate available TTS (text-to-speech) interface modules with language supported
  • tasks – list FS tasks
  • timer – list timer modules

ubuntu17.10 环境命令行启动freeswitch

1 前台启动freeswitch

./freeswitch  
复制代码


2     后台运行freeswitch

./freeswitch   -nc     
复制代码


  1. 后台运行转前台
./fs_cli            
复制代码


  1. 退回后台运行
    ...
  2. 查看sofia状态
sofia status
复制代码


  1. 查看注册信息
    sofia  status  profile      internal   reg
  2. 列出声音设备
    pa  devlist

8.指定输入、输出端口

pa  indev  #0  
pa outdev  #2
复制代码


9.回路测试

pa looptest
复制代码

10.呼叫  1014

pa  call   1014
复制代码


  1. 挂机
    pa  hangup

12  重新加载模块

reloadxml
复制代码


  1. 重启freeswitch
    sofia    profile  external  rescan
  2. 发起呼叫(假使1000已注册)
    originate   user/1000    &ech0

version            --显示当前版本

status                --现实当前状态

fs_cli中的命令

1 .退出fs_cli

/quit

/bye

/exit

2.几个常用特殊命令

/event           --开启事件接收

/noevents    --关闭事件接收

/nixevent      --开启所有时间(除了特定的一种)

/log                 --设置log级别

/nolog           --关闭log

/filter            --过滤时间

3.订阅事件

/event  plain  ALL

相关实践学习
【涂鸦即艺术】基于云应用开发平台CAP部署AI实时生图绘板
【涂鸦即艺术】基于云应用开发平台CAP部署AI实时生图绘板
相关文章
|
Linux 网络安全 开发工具
【freeSwitch】——centos 7 安装教程及常见问题
【freeSwitch】——centos 7 安装教程及常见问题
1746 0
【freeSwitch】——centos 7 安装教程及常见问题
|
语音技术
FreeSwitch中音乐功能保持和静音回铃声怎样设置
FreeSwitch中音乐功能保持和静音回铃声怎样设置
|
12月前
|
网络协议 Linux Shell
阿里云安装freeswitch的步骤总结
本文介绍在阿里云上安装freeswitch系统三种安装方式:脚本、镜像及Docker。支持多种Linux系统,推荐最小化安装,提供下载地址、一键安装命令及卸载方法。安装后访问IP即可登录,默认账号密码为admin/admin,初始化需等待5-10分钟。
1468 5
|
存储 缓存 网络协议
freeswitch使用说明
freeswitch使用说明
freeswitch使用说明
|
11月前
|
Ubuntu Linux Anolis
docker/脚本/ISO镜像安装FreeSWITCH 1.10.12 图形化界面
本文详解FreeSWITCH三种部署方式:脚本安装(推荐生产环境)、系统镜像(开箱即用)、容器化(适用于测试)。支持AlmaLinux、Rocky Linux、国产麒麟等系统,涵盖硬件要求、安装步骤与安全建议,助力高效搭建企业通信平台。
1983 6
|
关系型数据库 MySQL 数据库连接
FreeSWITCH通过mod_mariadb原生连接MySQL
FreeSWITCH通过mod_mariadb原生连接MySQL
1674 0
|
JSON Ubuntu Linux
FreeSWITCH安装
FreeSWITCH
3148 0
FreeSWITCH安装
|
关系型数据库 MySQL 数据库
debian11编译安装freeswitch
debian11编译安装freeswitch
896 0
|
Ubuntu Linux 开发工具
Android 使用Linphone SDK开发SIP客户端
Android 使用Linphone SDK开发SIP客户端
2809 0
Android 使用Linphone SDK开发SIP客户端
|
JSON Linux 语音技术
FreeSWITCH 语音识别 ASR 模块
最近很多人都对FreeSWITCH和ASR对接比较感谢兴趣,(,考虑到大部分人,只是研究一下,并不准确购买商业模块,特意做一个开源项目给大家提供一个参考。
3727 0