加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

FreeSWITCH命令大全

发布时间:2020-12-14 04:45:04 所属栏目:大数据 来源:网络整理
导读:? FreeSWITCH启动即查看 FreeSWITCH一般安装在路径 /usr/local/freeswitch ,可执行程序位于/usr/local/freeswitch/bin 下,配置文件位于/usr/local/freeswitch/conf(当然这写不是绝对的,具体还要看你自己安装时候的配置) 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
‘‘‘
View Code

?

启动、关闭

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

# 启动freeswitch
freeswitch

# 关闭freeswitch
shutdown

?

[email?protected]> 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

‘‘‘
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     
‘‘‘
View Code

?

  后台启动了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]
[email?protected]> 
‘‘‘

?

问题解决  

  如果 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=[email?protected]          [email?protected]
  -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"/>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读