首页 > 其他分享 >FreeSWITCH命令大全

FreeSWITCH命令大全

时间:2023-01-04 18:13:40浏览次数:37  
标签:__ -- 0.0 ____ 命令 freeswitch FreeSWITCH ___ 大全

FreeSWITCH启动、查看、及关闭
  FreeSWITCH一般安装在路径 /usr/local/freeswitch ,可执行程序位于/usr/local/freeswitch/bin 下,配置文件位于/usr/local/freeswitch/conf(当然这写不是绝对的,具体还要看你自己安装时候的配置)

​FreeSWITCH帮助命令​

freeswitch -help


'''
Usage: freeswitch [OPTIONS]

These are the optional arguments you can pass to freeswitch:
-nf -- no forking
-reincarnate -- restart the switch on an uncontrolled exit
-reincarnate-reexec -- run execv on a restart (helpful for upgrades)
-u [user] -- specify user to switch to
-g [group] -- specify group to switch to
-core -- dump cores
-help -- this message
-version -- print the version and exit
-rp -- enable high(realtime) priority settings
-lp -- enable low priority settings
-np -- enable normal priority settings
-vg -- run under valgrind
-nosql -- disable internal sql scoreboard
-heavy-timer -- Heavy Timer, possibly more accurate but at a cost
-nonat -- disable auto nat detection
-nonatmap -- disable auto nat port mapping
-nocal -- disable clock calibration
-nort -- disable clock clock_realtime
-stop -- stop freeswitch
-nc -- do not output to a console and background
-ncwait -- do not output to a console and background but wait until the system is ready before exiting (implies -nc)
-c -- output to a console and stay in the foreground

Options to control locations of files:
-base [basedir] -- alternate prefix directory
-cfgname [filename] -- alternate filename for FreeSWITCH main configuration file
-conf [confdir] -- alternate directory for FreeSWITCH configuration files
-log [logdir] -- alternate directory for logfiles
-run [rundir] -- alternate directory for runtime files
-db [dbdir] -- alternate directory for the internal database
-mod [moddir] -- alternate directory for modules
-htdocs [htdocsdir] -- alternate directory for htdocs
-scripts [scriptsdir] -- alternate directory for scripts
-temp [directory] -- alternate directory for temporary files
-grammar [directory] -- alternate directory for grammar files
-certs [directory] -- alternate directory for certificates
-recordings [directory] -- alternate directory for recordings
-storage [directory] -- alternate directory for voicemail storage
-cache [directory] -- alternate directory for cache files
-sounds [directory] -- alternate directory for sound files
'''

 

​启动、关闭​

  如果不带参数的话,直接在命令行中输入 freeswitch 就能启动,当你看到下面所示内容时基本就是启动正常了

# 启动freeswitch
freeswitch

# 关闭freeswitch
shutdown

 


freeswitch@d0a5f22d2bb3> 2019-06-06 09:48:51.667336 [CONSOLE] switch_core.c:2438
.=============================================================.
| _____ ______ _____ _____ ____ _ _ |
| | ___| __ ___ ___/ ___\ \ / /_ _|_ _/ ___| | | | |
| | |_ | '__/ _ \/ _ \___ \\ \ /\ / / | | | || | | |_| | |
| | _|| | | __/ __/___) |\ V V / | | | || |___| _ | |
| |_| |_| \___|\___|____/ \_/\_/ |___| |_| \____|_| |_| |
| |
.=============================================================.
| Anthony Minessale II, Michael Jerris, Brian West, Others |
| FreeSWITCH (http://www.freeswitch.org) |
| Paypal Donations Appreciated: [email protected] |
| Brought to you by ClueCon http://www.cluecon.com/ |
.=============================================================.

.=======================================================================================================.
| _ _ ____ _ ____ |
| / \ _ __ _ __ _ _ __ _| | / ___| |_ _ ___ / ___|___ _ __ |
| / _ \ | '_ \| '_ \| | | |/ _` | | | | | | | | |/ _ \ | / _ \| '_ \ |
| / ___ \| | | | | | | |_| | (_| | | | |___| | |_| | __/ |__| (_) | | | | |
| /_/ \_\_| |_|_| |_|\__,_|\__,_|_| \____|_|\__,_|\___|\____\___/|_| |_| |
| |
| ____ _____ ____ ____ __ |
| | _ \_ _/ ___| / ___|___ _ __ / _| ___ _ __ ___ _ __ ___ ___ |
| | |_) || || | | | / _ \| '_ \| |_ / _ \ '__/ _ \ '_ \ / __/ _ \ |
| | _ < | || |___ | |__| (_) | | | | _| __/ | | __/ | | | (_| __/ |
| |_| \_\|_| \____| \____\___/|_| |_|_| \___|_| \___|_| |_|\___\___| |
| |
| ____ _ ____ |
| / ___| |_ _ ___ / ___|___ _ __ ___ ___ _ __ ___ |
| | | | | | | |/ _ \ | / _ \| '_ \ / __/ _ \| '_ ` _ \ |
| | |___| | |_| | __/ |__| (_) | | | | _ | (_| (_) | | | | | | |
| \____|_|\__,_|\___|\____\___/|_| |_| (_) \___\___/|_| |_| |_| |
| |
.=======================================================================================================.


2019-06-06 09:48:51.667349 [INFO] switch_core.c:2447
FreeSWITCH Version 1.8.5~64bit ( 64bit)

FreeSWITCH Started
Max Sessions [1000]
Session Rate [30]
SQL [Enabled]

 

如果有错误信息,会以红色字体的形式提现出来,这时需要自己去排查错误

 

​后台启动、关闭​

  当然我们一般运行 FreeSWITCH 都是以后台的形式

# 后台启动
freeswitch -nc

# 关闭后台freeswitch
freeswitch -stop

 


​查看相关日志​

  我们可以首先查看一下FreeSWITCH是否正常启动

netstat -anp | grep freeswitch
1.


'''
tcp 0 0 172.17.0.7:8081 0.0.0.0:* LISTEN 14252/freeswitch
tcp 0 0 172.17.0.7:8082 0.0.0.0:* LISTEN 14252/freeswitch
tcp 0 0 172.17.0.7:7443 0.0.0.0:* LISTEN 14252/freeswitch
tcp 0 0 172.17.0.7:5080 0.0.0.0:* LISTEN 14252/freeswitch
tcp 0 0 172.17.0.7:5060 0.0.0.0:* LISTEN 14252/freeswitch
tcp 0 0 172.17.0.7:2855 0.0.0.0:* LISTEN 14252/freeswitch
tcp 0 0 172.17.0.7:2856 0.0.0.0:* LISTEN 14252/freeswitch
tcp 0 0 172.17.0.7:5066 0.0.0.0:* LISTEN 14252/freeswitch
udp 0 0 0.0.0.0:1337 0.0.0.0:* 14252/freeswitch
udp 0 0 172.17.0.7:52133 172.17.0.1:5351 ESTABLISHED 14252/freeswitch
udp 0 0 172.17.0.7:5060 0.0.0.0:* 14252/freeswitch
udp 0 0 172.17.0.7:5080 0.0.0.0:* 14252/freeswitch
unix 3 [ ] STREAM CONNECTED 2109650 14252/freeswitch
unix 3 [ ] STREAM CONNECTED 2105745 14252/freeswitch
unix 3 [ ] STREAM CONNECTED 2107133 14252/freeswitch
unix 3 [ ] STREAM CONNECTED 2105746 14252/freeswitch
unix 3 [ ] STREAM CONNECTED 2108033 14252/freeswitch
unix 3 [ ] STREAM CONNECTED 2107132 14252/freeswitch
unix 3 [ ] STREAM CONNECTED 2108032 14252/freeswitch
unix 3 [ ] STREAM CONNECTED 2109651 14252/freeswitch
unix 3 [ ] STREAM CONNECTED 2107134 14252/freeswitch
unix 3 [ ] STREAM CONNECTED 2107131 14252/freeswitch
unix 3 [ ] STREAM CONNECTED 2102897 14252/freeswitch
unix 3 [ ] STREAM CONNECTED 2102898 14252/freeswitch
'''

  后台启动了FreeSWITCH后我们需要查看相关日志需要用 fs_cli 命令,如果出现下图内容就说明连上了

fs_cli
'''
.=======================================================.
| _____ ____ ____ _ ___ |
| | ___/ ___| / ___| | |_ _| |
| | |_ \___ \ | | | | | | |
| | _| ___) | | |___| |___ | | |
| |_| |____/ \____|_____|___| |
| |
.=======================================================.
| Anthony Minessale II, Ken Rice, |
| Michael Jerris, Travis Cross |
| FreeSWITCH (http://www.freeswitch.org) |
| Paypal Donations Appreciated: [email protected] |
| Brought to you by ClueCon http://www.cluecon.com/ |
.=======================================================.

.=======================================================================================================.
| _ _ ____ _ ____ |
| / \ _ __ _ __ _ _ __ _| | / ___| |_ _ ___ / ___|___ _ __ |
| / _ \ | '_ \| '_ \| | | |/ _` | | | | | | | | |/ _ \ | / _ \| '_ \ |
| / ___ \| | | | | | | |_| | (_| | | | |___| | |_| | __/ |__| (_) | | | | |
| /_/ \_\_| |_|_| |_|\__,_|\__,_|_| \____|_|\__,_|\___|\____\___/|_| |_| |
| |
| ____ _____ ____ ____ __ |
| | _ \_ _/ ___| / ___|___ _ __ / _| ___ _ __ ___ _ __ ___ ___ |
| | |_) || || | | | / _ \| '_ \| |_ / _ \ '__/ _ \ '_ \ / __/ _ \ |
| | _ < | || |___ | |__| (_) | | | | _| __/ | | __/ | | | (_| __/ |
| |_| \_\|_| \____| \____\___/|_| |_|_| \___|_| \___|_| |_|\___\___| |
| |
| ____ _ ____ |
| / ___| |_ _ ___ / ___|___ _ __ ___ ___ _ __ ___ |
| | | | | | | |/ _ \ | / _ \| '_ \ / __/ _ \| '_ ` _ \ |
| | |___| | |_| | __/ |__| (_) | | | | _ | (_| (_) | | | | | | |
| \____|_|\__,_|\___|\____\___/|_| |_| (_) \___\___/|_| |_| |_| |
| |
.=======================================================================================================.

Type /help <enter> to see a list of commands

 


[This app Best viewed at 160x60 or more..]
+OK log level [7]
freeswitch@d0a5f22d2bb3>
'''


​问题解决  ​

  如果 fs_cli 命令连不上,报错信息如下:

[ERROR] fs_cli.c:1679 main() Error Connecting []
Usage: fs_cli [-H <host>] [-P <port>] [-p <secret>] [-d <level>] [-x command] [-t <timeout_ms>] [profile]

-?,-h --help Usage Information
-H, --host=hostname Host to connect
-P, --port=port Port to connect (1 - 65535)
-u, --user=user@domain user@domain
-p, --password=password Password
-i, --interrupt Allow Control-c to interrupt
-x, --execute=command Execute Command and Exit
-l, --loglevel=command Log Level
-U, --log-uuid Include UUID in log output
-S, --log-uuid-short Include shortened UUID in log output
-q, --quiet Disable logging
-r, --retry Retry connection on failure
-R, --reconnect Reconnect if disconnected
-d, --debug=level Debug Level (0 - 7)
-b, --batchmode Batch mode
-t, --timeout Timeout for API commands (in miliseconds)
-T, --connect-timeout Timeout for socket connection (in miliseconds)
-n, --no-color Disable color


  这时需要修改一下连接IP,首先我们需要启动 enable the mod_event_socket 模块,文件 位于 /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml ,然后修改默认的启动IP,修改文件位于  /usr/local/freeswitch/conf/autoload_configs/event_socket.conf.xml ,然后重启 FreeSWITCH 即可

nano /usr/local/freeswitch/conf/autoload_configs/event_socket.conf.xml

'''
<configuration name="event_socket.conf" description="Socket Client">
<settings>
<param name="nat-map" value="false"/>
<param name="listen-ip" value="::"/>
<param name="listen-port" value="8021"/>
<param name="password" value="ClueCon"/>
<!--<param name="apply-inbound-acl" value="loopback.auto"/>-->
<!--<param name="stop-on-bind-error" value="true"/>-->
</settings>
</configuration>
'''

# 将上面的<param name="listen-ip" value="::"/>改为<param name="listen-ip" value="0.0.0.0"/>

 


​查看状态​

  在 fs_cli 中输入 status

freeswitch@d0a5f22d2bb3> status
'''
UP 0 years, 0 days, 0 hours, 0 minutes, 17 seconds, 869 milliseconds, 212 microseconds
FreeSWITCH (Version 1.8.5 64bit) is ready
0 session(s) since startup
0 session(s) - peak 0, last 5min 0
0 session(s) per Sec out of max 30, peak 0, last 5min 0
1000 session(s) max
min idle cpu 0.00/99.50
Current Stack Size/Max 240K/8192K
'''


在 fs_cli 中输入 sofia status

freeswitch@d0a5f22d2bb3> sofia status
'''
Name Type Data State
=================================================================================================
172.17.0.7 alias internal ALIASED
external profile sip:[email protected]:5080 RUNNING (0)
external::example.com gateway sip:[email protected] NOREG
internal profile sip:[email protected]:5060 RUNNING (0)
=================================================================================================
2 profiles 1 alias
'''

 


添加一个用户
  在 /usr/local/freeswitch/comf/directory/default 下有默认的1000-1019共20个账号,可以通过 copy 并修改其中的 user_id 来实现增加新的账号

 

路由配置
默认路由文件:/usr/local/freeswitch/comf/dialplan/default.xml ,可以修改他
添加新的路有也可以修改文件:/usr/local/freeswitch/comf/dialplan/default
外线来电路有配置文件:/usr/local/freeswitch/comf/dialplan/public.xml
待续....


配置文件
  FreeSwitch的配置文件默认是放在 ​FreeSwitch\Conf\​ 下,最顶层是的 ​FreeSwitch.xml​,也就是说最先加载的就是这个 XML, FreeSwitch 根据这个 XML 依次加载 Conf 目录下的其它配置文件。

先说conf根目录下的文件

freeswitch.xml:主配置文件,它会使用include语句装入其它文件。
vars.xml:一些常用变量,都在这个配置文件中定义。
再说conf下的文件夹

​autoload_configs​:存放自动加载的配置文件。
此文件夹下的modules.conf.xml:配置当freeswitch启动时自动装载哪些模块。
此文件夹下其它xml:一般来说都是对应每个模块的配置文件。
​chatplan​文件夹:存放的是聊天计划配置文件。
​dialplan​文件夹:存放的是拨号计划配置文件。
​directory​文件夹:用户目录,存储跟用户相关的信息。
此文件夹下的的defalut目录是默认的用户目录配置,default下的xml文件是对应每个sip用户的,每个sip用户都有一个配置文件。
​ivr_menus​文件夹:IVR菜单配置文件。
​jingle_profiles​文件夹:连接Google Talk的相关配置文件。
​lang​文件夹:多语言支持配置文件。
此文件夹下的en为英语,fr文件夹是法语。
​mrcp_profiles​文件夹:MRCP的相关配置,用于跟第三方语音合成和语音识别系统对接。
​sip_profiles​文件夹:sip配置文件
此文件夹下的internal.xml:一个SIP profile,或称作一个SIP-UA,监听在本地IP及端口5060。
此文件夹下的externa.xml:另一个SIP-UA,用作外部连接,端口5080。
​skinny_profiles​文件夹:思科SCCP协议话机的配置文件。

标签:__,--,0.0,____,命令,freeswitch,FreeSWITCH,___,大全
From: https://www.cnblogs.com/kn-zheng/p/17025637.html

相关文章

  • C语言中使用ESL连接FreeSwitch
    前言之前在【FreeSwitch开发实践】在nodejs中用ESL连接FreeSwitch一文介绍了在NodeJS下使用ESL连接FreeSwitch,本文则对在C语言下使用ESL连接FreeSwitch作了一个系统介绍......
  • 针对FreeSWITCH的最佳开源GUI解决方案
    为了获得FreeSWITCH的最大利益,您需要能够正确选择GUI解决方案。看看FreeSWITCH的一些开源GUI解决方案,见证了它们的广泛普及和采用率。FreeSWITCHGUI被广泛地描述为FsG......
  • 手把手教你部署验证freeswitch(避免踩坑)
    介绍:freeswitch可集成ASR(语音识别)和TTS(文本转语音)创建智能电话机器人和用户通话,可用于问卷调查,自动催缴等业务,电话咨询服务,支持百度,科大,阿里云,腾讯等ASR系统,可以真人预......
  • FreeSWITCH学习笔记3(3.5)- 初识FreeSWITCH
    目录配置SIP网关拨打外部电话:从某一分机上呼出呼入电话处理 配置SIP网关拨打外部电话 originatesofia/gateway/zlz/1003&echo(前提是设置了1003,并且选定了才......
  • FreeSWITCH学习笔记3(3.3、3.4)- 初识FreeSWITCH
    目录:1、配置FreeSWITCH2、FreeSWITCH用作软电话 1、配置FreeSWITCH具体参考:《FreeSWITCH权威指南》3.3节以下,将通过添加一个新的FreeSWITCH用户来简单熟悉一下Free......
  • FreeSWITCH学习笔记1 - PSTN与VoIP基础
    目录: FreeSWITCHFreeSWITCH是一个电话的软交换解决方案,包括一个软电话和软交换机用以提供语音和聊天的产品驱动。FreeSWITCH可以用作交换机引擎、PBX、多媒体网关以......
  • FreeSWITCH学习笔记2 - PSTN、PBX及呼叫中心业务
    目录:POTSPBXPrivateBranchExchange,用户级交换机,即公司内部使用的电话业务网络,系统内部分机用户分享一定数量的外线。PBX俗称:程控交换机,程控用户交换机,电话交换机,......
  • FreeSWITCH学习笔记3(3.1、3.2)- 初识FreeSWITCH
    目录:FreeSWITCH的功能连接SIP电话连接SIP电话——实操 1、FreeSWITCH的功能  安装完成FreeSWITCH后,以管理员身份运行。通过在控制台中输入:shutdown......
  • FreeSWITCH学习笔记7(7-7.3.1) - SIP协议
    目录:   7.1、SIP协议基础 7.1.1、HTTP与SIP协议基础   7.1.2、SIP的基础概念和相关元素       7.1.3、SIP协议的基本方法和头域简介 ......
  • FreeSWITCH学习笔记7(7.3.2-结束) - SIP协议
    目录: 7.3.2、通过B2BUA呼叫 具体流程描述见7.3.2。  7.4、深入理解SIP7.4.1、SIPURI 7.4.2、SDP和SOASDP——(SessionDescriptionProtocol,会话描述......