FS-Cli常用命令简介

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 <level>:设定指定日志级别;

/log:默认为debug或指定的级别(与loglevel相同);

/nolog:关闭日志;

sofia profile internal siptrace  on/off:开启或关闭SIP消息跟踪功能。

 

全局变量
全局变量:

global_getvar [<varname>]:获取全局变量

global_setvar <varname>=<value>:设定全局变量

查看: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 <clearing_type> dialed_ext <extension>:关闭所有指定呼叫,如: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 <cause> [<variable> <value>]

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 <mod_name>:重新加载模块

reloadacl:重新加载ACL

uuid一族(以uuid开始的)

uuid_answer <uuid>:接听

uuid_kill <uuid> [cause]:挂机

uuid_bridge <uuid> <other_uuid>:桥接通道

uuid_transfer <uuid> [-bleg|-both] <dest-exten> [<dialplan>] [<context>]:转移电话

uuid_break <uuid> [all]:停止媒体发送

uuid_broadcast <uuid> <path> [aleg|bleg|both]:播放媒体;

uuid_deflect <uuid> <sip URL>:转移通话

uuid_displace <uuid> [start|stop] <file> [<limit>] [mux]:替换媒体(Displace the audio for the target with the specified audio)

uuid_record <uuid> [start|stop|mask|unmask] <path> [<limit>]:录音,Where limit is the max number of seconds to record

uuid_getvar <uuid> <varname>:获取通道上变量

uuid_setvar <uuid> <varname> [value]:设定通道变量

 

show:显示信息
show [

   aliases |

   api |

   application |

   bridged_calls |

   calls [count] |

   channels [count|like <match string>] |

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

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 <match string>] – list current channels; see Channels vs Calls

count – show only the count of active channels, no details

like <match string> – filter results to include only channels that contain <match string> 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

你可能感兴趣的