配置路径

/usr/local/freeswitch/conf/ 或者是/etc/freeswitch

配置文件概述

文件 | 说明
—————————————————————————-
freeswitch.xml | 核心配置文件,整合所有配置文件
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启动时自动装载哪些模块

conf配置文件的目录结构如下:
|
|———autoload_configs/ 一般都是模块级的配置文件,每个模块对应一个。文件名一般以 module_name.conf.xml 方式命名。
|
|———dialplan/ 定义xml拨号计划
|
|———directory/ 它里面的配置文件决定了freeswitch作为注册服务器时哪些用户可以注册上来。freeswitch支持多个域,每个域都可以写到一个xml文件里。默认的配置包括一个default.xml,它里面定义了1000~1019共20个用户。
|
|———extensions.conf
|
|———freeswitch.xml 最重要的xml文件,就是它将所有配置文件“粘”到一起,生成一个大的xml文件log/freeswitch.xml.fsxml
|
|———fur_elise.xml
|
|———jingle_profiles/
|
|———lang/
|
|———mime.types/
|
|———notify-voicemail.tpl
|
|———sip_profiles/ 定义了sip配置文件,有sofia模块在autoload_configs/sofia.conf.xml中加载,由于它本身比较复杂又是核心功能,因此单列一个目录。
|
|———tetris.ttml
|
|———vars.xml 重要通过X-PRE-PROCESS指令定义了一些全局变量。全局变量以$${var}表示,临时变量以${var}表示。
|
|———voicemail.tpl
|
|———web-vm.tpl

启动配置

  1. 使用 freeswitch -help freeswitch --help 会显示以下信息:
  2. -nf -- no forking
  3. -u [user] -- 启动后以非 root 用户 user 身份运行
  4. -g [group] -- 启动后以非 root group 身份运行
  5. -help -- 显示本帮助信息
  6. -version -- 显示版本信息
  7. -waste -- 允许浪费内存,FreeSWITCH 仅需 240K 的栈空间
  8. 你可以使用 ulimit -s 240 限制栈空间使用,或使用该选择忽略警告信息
  9. -core -- 出错时进行内核转储
  10. -hp -- 以高优先级运行
  11. -vg -- valgrind 下运行,调试内存泄露时使用
  12. -nosql -- 不使用 SQLshow channels 类的命令将不能显示结果
  13. -heavy-timer -- 更精确的时钟。可能会更精确,但对系统要求更高
  14. -nonat -- 如果路由器支持 uPnP NAT-PMP,则 FreeSWITCH
  15. 可以自动解决 NAT 穿越问题。如果路由器不支持,则该选项可以使启动更快
  16. -nocal -- 关闭时钟核准。FreeSWTICH 理想的运行环境是 1000 Hz 的内核时钟
  17. 如果你的内核时钟小于 1000 Hz 或在虚拟机上,可以尝试关闭该选项
  18. -nort -- 关闭实时时钟
  19. -stop -- 关闭 FreeSWTICH,它会在 run 目录中查找 PID文件
  20. -nc -- 启动到后台模式,没有控制台
  21. -c -- 启动到控制台,默认
  22. -conf [confdir] -- 指定其它的配置文件所在目录,须与 -log -db 合用
  23. -log [logdir] -- 指定其它的日志目录
  24. -run [rundir] -- 指定其它存放 PID 文件的运行目录
  25. -db [dbdir] -- 指定其它数据库目录
  26. -mod [moddir] -- 指定其它模块目录
  27. -htdocs [htdocsdir] -- 指定其它 HTTP 根目录
  28. -scripts [scriptsdir] -- 指定其它脚本目录

修改配置 生效

  1. # fs_cli -x "reloadxml"
  2. +OK [Success]
  1. # cat freeswitch.xml
  2. <?xml version="1.0"?>
  3. <!--
  4. NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE
  5. This is the FreeSWITCH default config. Everything you see before you now traverses
  6. down into all the directories including files which include more files. The default
  7. config comes out of the box already working in most situations as a PBX. This will
  8. allow you to get started testing and playing with various things in FreeSWITCH.
  9. Before you start to modify this default please visit this wiki page:
  10. http://wiki.freeswitch.org/wiki/Getting_Started_Guide#Some_stuff_to_try_out.21
  11. If all else fails you can read our FAQ located at:
  12. http://wiki.freeswitch.org/wiki/FreeSwitch_FAQ
  13. NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE
  14. -->
  15. <document type="freeswitch/xml">
  16. <!--#comment
  17. All comments starting with #command will be preprocessed and never sent to the xml parser
  18. Valid instructions:
  19. #include ==> Include another file to this exact point
  20. (partial xml should be encased in <include></include> tags)
  21. #set ==> Set a global variable (can be expanded during preprocessing with $$ variables)
  22. (note the double $$ which denotes preprocessor variables)
  23. #comment ==> A general comment such as this
  24. The preprocessor will compile the full xml document to ${prefix}/log/freeswitch.xml.fsxml
  25. Don't modify it while freeswitch is running cos it is mem mapped in most cases =D
  26. The same can be achieved with the <X-PRE-PROCESS> tag where the attrs 'cmd' and 'data' are
  27. parsed in the same way.
  28. -->
  29. <!--#comment
  30. vars.xml contains all the #set directives for the preprocessor.
  31. -->
  32. <X-PRE-PROCESS cmd="include" data="vars.xml"/>
  33. <section name="configuration" description="Various Configuration">
  34. <X-PRE-PROCESS cmd="include" data="autoload_configs/*.xml"/>
  35. </section>
  36. <section name="dialplan" description="Regex/XML Dialplan">
  37. <X-PRE-PROCESS cmd="include" data="dialplan/*.xml"/>
  38. </section>
  39. <section name="chatplan" description="Regex/XML Chatplan">
  40. <X-PRE-PROCESS cmd="include" data="chatplan/*.xml"/>
  41. </section>
  42. <!-- mod_dingaling is reliant on the vcard data in the "directory" section. -->
  43. <!-- mod_sofia is reliant on the user data for authorization -->
  44. <section name="directory" description="User Directory">
  45. <X-PRE-PROCESS cmd="include" data="directory/*.xml"/>
  46. </section>
  47. <!-- languages section (under development still) -->
  48. <section name="languages" description="Language Management">
  49. <X-PRE-PROCESS cmd="include" data="lang/de/*.xml"/>
  50. <X-PRE-PROCESS cmd="include" data="lang/en/*.xml"/>
  51. <X-PRE-PROCESS cmd="include" data="lang/fr/*.xml"/>
  52. <X-PRE-PROCESS cmd="include" data="lang/ru/*.xml"/>
  53. <X-PRE-PROCESS cmd="include" data="lang/he/*.xml"/>
  54. <X-PRE-PROCESS cmd="include" data="lang/es/es_ES.xml"/>
  55. <X-NO-PRE-PROCESS cmd="include" data="lang/es/es_MX.xml"/>
  56. <X-PRE-PROCESS cmd="include" data="lang/pt/pt_BR.xml"/>
  57. <X-NO-PRE-PROCESS cmd="include" data="lang/pt/pt_PT.xml"/>
  58. <X-NO-PRE-PROCESS cmd="include" data="lang/sv/*.xml"/>
  59. </section>
  60. </document>

预加载配置

  1. <X-PRE-PROCESS cmd="include" data="vars.xml"/>

如果需要引用这些变量,则全局变量以$${var}表示,临时变量以${var}表示

image.png

全局变量var.xml

查看全局变量命令 global_getvar

  1. > global_getvar
  2. hostname=VM-0-2-debian
  3. local_ip_v4=172.17.0.2
  4. local_mask_v4=255.255.240.0
  5. local_ip_v6=::1
  6. base_dir=/usr
  7. recordings_dir=/var/lib/freeswitch/recordings
  8. sounds_dir=/usr/share/freeswitch/sounds
  9. conf_dir=/etc/freeswitch
  10. log_dir=/var/log/freeswitch
  11. run_dir=/var/run/freeswitch
  12. db_dir=/var/lib/freeswitch/db
  13. mod_dir=/usr/lib/freeswitch/mod
  14. htdocs_dir=/usr/share/freeswitch/htdocs
  15. script_dir=/usr/share/freeswitch/scripts
  16. temp_dir=/tmp
  17. grammar_dir=/usr/share/freeswitch/grammar
  18. fonts_dir=/usr/share/freeswitch/fonts
  19. images_dir=/var/lib/freeswitch/images
  20. certs_dir=/etc/freeswitch/tls
  21. storage_dir=/var/lib/freeswitch/storage
  22. cache_dir=/var/cache/freeswitch
  23. data_dir=/usr/share/freeswitch
  24. localstate_dir=/var/lib/freeswitch
  25. switch_serial=ac110002d6cc
  26. default_password=1234
  27. sound_prefix=/usr/share/freeswitch/sounds/en/us/callie
  28. domain=172.17.0.2
  29. domain_name=172.17.0.2
  30. hold_music=local_stream://moh
  31. use_profile=external
  32. rtp_sdes_suites=AEAD_AES_256_GCM_8|AEAD_AES_128_GCM_8|AES_CM_256_HMAC_SHA1_80|AES_CM_192_HMAC_SHA1_80|AES_CM_128_HMAC_SHA1_80|AES_CM_256_HMAC_SHA1_32|AES_CM_192_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_32|AES_CM_128_NULL_AUTH
  33. zrtp_secure_media=true
  34. global_codec_prefs=OPUS,G722,PCMU,PCMA,H264,VP8
  35. outbound_codec_prefs=OPUS,G722,PCMU,PCMA,H264,VP8
  36. xmpp_client_profile=xmppc
  37. xmpp_server_profile=xmpps
  38. bind_server_ip=auto
  39. unroll_loops=true
  40. outbound_caller_name=FreeSWITCH
  41. outbound_caller_id=0000000000
  42. call_debug=false
  43. console_loglevel=info
  44. default_areacode=918
  45. default_country=US
  46. presence_privacy=false
  47. au-ring=%(400,200,383,417);%(400,2000,383,417)
  48. be-ring=%(1000,3000,425)
  49. ca-ring=%(2000,4000,440,480)
  50. cn-ring=%(1000,4000,450)
  51. cy-ring=%(1500,3000,425)
  52. cz-ring=%(1000,4000,425)
  53. de-ring=%(1000,4000,425)
  54. dk-ring=%(1000,4000,425)
  55. dz-ring=%(1500,3500,425)
  56. eg-ring=%(2000,1000,475,375)
  57. es-ring=%(1500,3000,425)
  58. fi-ring=%(1000,4000,425)
  59. fr-ring=%(1500,3500,440)
  60. hk-ring=%(400,200,440,480);%(400,3000,440,480)
  61. hu-ring=%(1250,3750,425)
  62. il-ring=%(1000,3000,400)
  63. in-ring=%(400,200,425,375);%(400,2000,425,375)
  64. jp-ring=%(1000,2000,420,380)
  65. ko-ring=%(1000,2000,440,480)
  66. pk-ring=%(1000,2000,400)
  67. pl-ring=%(1000,4000,425)
  68. ro-ring=%(1850,4150,475,425)
  69. rs-ring=%(1000,4000,425)
  70. ru-ring=%(800,3200,425)
  71. sa-ring=%(1200,4600,425)
  72. tr-ring=%(2000,4000,450)
  73. uk-ring=%(400,200,400,450);%(400,2000,400,450)
  74. us-ring=%(2000,4000,440,480)
  75. bong-ring=v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)
  76. beep=%(1000,0,640)
  77. sit=%(274,0,913.8);%(274,0,1370.6);%(380,0,1776.7)
  78. df_us_ssn=(?!219099999|078051120)(?!666|000|9\d{2})\d{3}(?!00)\d{2}(?!0{4})\d{4}
  79. df_luhn=?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|6(?:011|5[0-9]{2})[0-9]{12}|(?:2131|1800|35\d{3})\d{11}
  80. default_provider=example.com
  81. default_provider_username=joeuser
  82. default_provider_password=password
  83. default_provider_from_domain=example.com
  84. default_provider_register=false
  85. default_provider_contact=5000
  86. sip_tls_version=tlsv1,tlsv1.1,tlsv1.2
  87. sip_tls_ciphers=ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH
  88. internal_auth_calls=true
  89. internal_sip_port=5060
  90. internal_tls_port=5061
  91. internal_ssl_enable=false
  92. external_auth_calls=false
  93. external_sip_port=5080
  94. external_tls_port=5081
  95. external_ssl_enable=false
  96. rtp_video_max_bandwidth_in=3mb
  97. rtp_video_max_bandwidth_out=3mb
  98. suppress_cng=true
  99. rtp_liberal_dtmf=true
  100. video_mute_png=/var/lib/freeswitch/images/default-mute.png
  101. video_no_avatar_png=/var/lib/freeswitch/images/default-avatar.png
  102. AT_EPENT1=0 0 0 -1 -1 0 -1 0 -1 -1 0 -1
  103. AT_EPENT2=1 1 1 -1 -1 1 -1 1 -1 -1 1 -1
  104. AT_CPENT1=0 -1 -1 0 -1 0 0 0 -1 -1 0 -1
  105. AT_CPENT2=1 -1 -1 1 -1 1 1 1 -1 -1 1 -1
  106. AT_CMAJ1=0 -1 0 0 -1 0 -1 0 0 -1 0 -1
  107. AT_CMAJ2=1 -1 1 1 -1 1 -1 1 1 -1 1 -1
  108. AT_BBLUES=1 -1 1 -1 -1 1 -1 1 1 1 -1 -1
  109. ATGPENT2=-1 1 -1 1 -1 1 -1 -1 1 -1 1 -1
  110. zrtp_enabled=false
  111. core_uuid=f6b8445a-7057-499e-a2f3-3b7f4fedc41a



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

global_getvar domain
eval ${domain}

查看全局变量的值

  1. freeswitch@VM-0-2-debian> global_getvar local_ip_v4
  2. 172.17.0.2

在vars.xml加载之前,FreeSWITCH就已经算出并设置了一些全局变量,但有的时候FreeSWITCH自动算出的变量可能不是
#你想要的,如local_ip_v4的值,在服务器有多个网卡的情况下,可能希望它能得到另外一个网卡的IP地址,这时候就可以通过手动方式设置该变量IP来实现

  1. <X-PRE-PROCESS cmd="set" data="local_ip_v4=192.168.1.251"/>

autoload_configs目录

autoloadconfigs目录下的各种配置文件会在系统启动时装入。一般来说都是模块级的配置文件,每个模块对应一个(注意,并不是所有的模块都有配置文件)。文件名一般以“模块名.conf.xml”的方式命名(模块名中不包含“mod”,如sofia.conf.xml)。

  1. # ls -l
  2. total 508
  3. -rw-r--r-- 1 root root 274 Jan 24 2019 abstraction.conf.xml
  4. -rw-r--r-- 1 root root 1026 Jan 24 2019 acl.conf.xml
  5. -rw-r--r-- 1 root root 422 Jan 24 2019 alsa.conf.xml
  6. -rw-r--r-- 1 root root 3216 Jan 24 2019 amqp.conf.xml
  7. -rw-r--r-- 1 root root 718 Jan 24 2019 amr.conf.xml
  8. -rw-r--r-- 1 root root 205 Jan 24 2019 amrwb.conf.xml
  9. -rw-r--r-- 1 root root 5523 Jan 24 2019 av.conf.xml
  10. -rw-r--r-- 1 root root 3354 Jan 24 2019 avmd.conf.xml
  11. -rw-r--r-- 1 root root 345 Jan 24 2019 blacklist.conf.xml
  12. -rw-r--r-- 1 root root 2000 Jan 24 2019 callcenter.conf.xml
  13. -rw-r--r-- 1 root root 2521 Jan 24 2019 cdr_csv.conf.xml
  14. -rw-r--r-- 1 root root 470 Jan 24 2019 cdr_mongodb.conf.xml
  15. -rw-r--r-- 1 root root 1517 Jan 24 2019 cdr_pg_csv.conf.xml
  16. -rw-r--r-- 1 root root 999 Jan 24 2019 cdr_sqlite.conf.xml
  17. -rw-r--r-- 1 root root 306 Jan 24 2019 cepstral.conf.xml
  18. -rw-r--r-- 1 root root 1335 Jan 24 2019 cidlookup.conf.xml
  19. -rw-rw-r-- 1 root root 992 Apr 2 2019 conference.conf.xml
  20. -rw-r--r-- 1 root root 15057 Jan 24 2019 conference_layouts.conf.xml
  21. -rw-r--r-- 1 root root 2502 Jan 24 2019 console.conf.xml
  22. -rw-r--r-- 1 root root 147 Jan 24 2019 curl.conf.xml
  23. -rw-r--r-- 1 root root 170 Jan 24 2019 db.conf.xml
  24. -rw-r--r-- 1 root root 380 Jan 24 2019 dialplan_directory.conf.xml
  25. -rw-r--r-- 1 root root 270 Jan 24 2019 dingaling.conf.xml
  26. -rw-r--r-- 1 root root 810 Jan 24 2019 directory.conf.xml
  27. -rw-r--r-- 1 root root 442 Jan 24 2019 distributor.conf.xml
  28. -rw-r--r-- 1 root root 1431 Jan 24 2019 easyroute.conf.xml
  29. -rw-r--r-- 1 root root 1074 Jan 24 2019 enum.conf.xml
  30. -rw-r--r-- 1 root root 1220 Jan 24 2019 erlang_event.conf.xml
  31. -rw-r--r-- 1 root root 593 Jan 24 2019 event_multicast.conf.xml
  32. -rw-r--r-- 1 root root 432 Apr 2 2019 event_socket.conf.xml
  33. -rw-r--r-- 1 root root 441 Jan 24 2019 fax.conf.xml
  34. -rw-r--r-- 1 root root 371 Jan 24 2019 fifo.conf.xml
  35. -rw-r--r-- 1 root root 4622 Jan 24 2019 format_cdr.conf.xml
  36. -rw-r--r-- 1 root root 1024 Jan 24 2019 graylog2.conf.xml
  37. -rw-r--r-- 1 root root 260 Jan 24 2019 hash.conf.xml
  38. -rw-r--r-- 1 root root 703 Jan 24 2019 hiredis.conf.xml
  39. -rw-r--r-- 1 root root 5347 Jan 24 2019 httapi.conf.xml
  40. -rw-r--r-- 1 root root 1029 Jan 24 2019 http_cache.conf.xml
  41. -rw-r--r-- 1 root root 155 Jan 24 2019 ivr.conf.xml
  42. -rw-r--r-- 1 root root 445 Jan 24 2019 java.conf.xml
  43. -rw-rw-r-- 1 root root 2730 Apr 2 2019 json_cdr.conf.xml
  44. -rw-r--r-- 1 root root 8703 Jan 24 2019 kazoo.conf.xml
  45. -rw-r--r-- 1 root root 3657 Jan 24 2019 lcr.conf.xml
  46. -rw-r--r-- 1 root root 1910 Jan 24 2019 local_stream.conf.xml
  47. -rw-r--r-- 1 root root 1145 Apr 2 2019 logfile.conf.xml
  48. -rw-r--r-- 1 root root 1313 Jan 24 2019 lua.conf.xml
  49. -rw-r--r-- 1 root root 254 Jan 24 2019 memcache.conf.xml
  50. -rw-r--r-- 1 root root 4765 Nov 13 07:24 modules.conf.xml
  51. -rw-r--r-- 1 root root 541 Jan 24 2019 mongo.conf.xml
  52. -rw-r--r-- 1 root root 494 Jan 24 2019 msrp.conf.xml
  53. -rw-r--r-- 1 root root 2017 Jan 24 2019 nibblebill.conf.xml
  54. -rw-r--r-- 1 root root 1196 Jan 24 2019 opal.conf.xml
  55. -rw-r--r-- 1 root root 1794 Jan 24 2019 opus.conf.xml
  56. -rw-r--r-- 1 root root 537 Jan 24 2019 oreka.conf.xml
  57. -rw-r--r-- 1 root root 2108 Jan 24 2019 osp.conf.xml
  58. -rw-r--r-- 1 root root 593 Jan 24 2019 perl.conf.xml
  59. -rw-r--r-- 1 root root 534 Jan 24 2019 pocketsphinx.conf.xml
  60. -rw-r--r-- 1 root root 9019 Jan 24 2019 portaudio.conf.xml
  61. -rw-r--r-- 1 root root 110 Jan 24 2019 post_load_modules.conf.xml
  62. -rw-r--r-- 1 root root 196 Jan 24 2019 presence_map.conf.xml
  63. -rw-r--r-- 1 root root 575 Jan 24 2019 python.conf.xml
  64. -rw-r--r-- 1 root root 239 Jan 24 2019 redis.conf.xml
  65. -rw-r--r-- 1 root root 296 Jan 24 2019 rss.conf.xml
  66. -rw-r--r-- 1 root root 662 Jan 24 2019 rtmp.conf.xml
  67. -rw-r--r-- 1 root root 1457 Jan 24 2019 sangoma_codec.conf.xml
  68. -rw-r--r-- 1 root root 305 Jan 24 2019 shout.conf.xml
  69. -rw-r--r-- 1 root root 178 Jan 24 2019 skinny.conf.xml
  70. -rw-r--r-- 1 root root 488 Jan 24 2019 smpp.conf.xml
  71. -rw-r--r-- 1 root root 432 Jan 24 2019 sms_flowroute.conf.xml
  72. -rw-r--r-- 1 root root 820 Jan 24 2019 sofia.conf.xml
  73. -rw-r--r-- 1 root root 4580 Jan 24 2019 spandsp.conf.xml
  74. -rw-r--r-- 1 root root 7838 Apr 2 2019 switch.conf.xml
  75. -rw-r--r-- 1 root root 689 Jan 24 2019 syslog.conf.xml
  76. -rw-r--r-- 1 root root 101426 Jan 24 2019 timezones.conf.xml
  77. -rw-r--r-- 1 root root 858 Jan 24 2019 translate.conf.xml
  78. -rw-r--r-- 1 root root 555 Jan 24 2019 tts_commandline.conf.xml
  79. -rw-r--r-- 1 root root 914 Jan 24 2019 unicall.conf.xml
  80. -rw-r--r-- 1 root root 899 Jan 24 2019 unimrcp.conf.xml
  81. -rw-r--r-- 1 root root 727 Jan 24 2019 v8.conf.xml
  82. -rw-r--r-- 1 root root 2989 Jan 24 2019 verto.conf.xml
  83. -rw-r--r-- 1 root root 3698 Jan 24 2019 voicemail.conf.xml
  84. -rw-r--r-- 1 root root 8039 Jan 24 2019 voicemail_ivr.conf.xml
  85. -rw-r--r-- 1 root root 5498 Jan 24 2019 vpx.conf.xml
  86. -rw-r--r-- 1 root root 3993 Jan 24 2019 xml_cdr.conf.xml
  87. -rw-r--r-- 1 root root 2868 Jan 24 2019 xml_curl.conf.xml
  88. -rw-r--r-- 1 root root 694 Apr 2 2019 xml_rpc.conf.xml
  89. -rw-r--r-- 1 root root 563 Jan 24 2019 xml_scgi.conf.xml
  90. -rw-r--r-- 1 root root 203 Jan 24 2019 zeroconf.conf.xml

autoload_configs目录中有一个特殊的modules.conf.xml,其决定了FreeSWITCH启动时自动加载哪些模块。如下面的配置片断,如果需要在FreeSWITCH启动时自动加载某个模块,就在这里添加一行,如果不需要,就注释掉或直接删除。

  1. cat modules.conf.xml
  2. <configuration name="modules.conf" description="Modules">
  3. <modules>
  4. <!-- Loggers (I'd load these first) -->
  5. <load module="mod_console"/>
  6. <!-- <load module="mod_graylog2"/> -->
  7. <load module="mod_logfile"/>
  8. <!-- <load module="mod_syslog"/> -->
  9. <!--<load module="mod_yaml"/>-->
  10. <!-- Multi-Faceted -->
  11. <!-- mod_enum is a dialplan interface, an application interface and an api command interface -->
  12. <load module="mod_enum"/>
  13. <!-- XML Interfaces -->
  14. <load module="mod_xml_rpc"/>
  15. <!-- <load module="mod_xml_curl"/> -->
  16. <!--<load module="mod_xml_cdr"/>-->
  17. <!-- <load module="mod_xml_radius"/> -->
  18. <!-- <load module="mod_xml_scgi"/> -->
  19. <!-- Event Handlers -->
  20. <!-- <load module="mod_amqp"/> -->
  21. <load module="mod_cdr_csv"/>
  22. <!-- <load module="mod_cdr_sqlite"/> -->
  23. <!-- <load module="mod_event_multicast"/> -->
  24. <load module="mod_event_socket"/>
  25. <!-- <load module="mod_event_zmq"/> -->
  26. <!-- <load module="mod_zeroconf"/> -->
  27. <!-- <load module="mod_erlang_event"/> -->
  28. <!-- <load module="mod_smpp"/> -->
  29. <!-- <load module="mod_snmp"/> -->
  30. <!-- Directory Interfaces -->
  31. <!-- <load module="mod_ldap"/> -->
  32. <!-- Endpoints -->
  33. <!-- <load module="mod_dingaling"/> -->
  34. <!-- <load module="mod_portaudio"/> -->
  35. <!-- <load module="mod_alsa"/> -->
  36. <load module="mod_sofia"/>
  37. <load module="mod_loopback"/>
  38. <!-- <load module="mod_woomera"/> -->
  39. <!-- <load module="mod_freetdm"/> -->
  40. <!-- <load module="mod_unicall"/> -->
  41. <!-- <load module="mod_skinny"/> -->
  42. <!-- <load module="mod_khomp"/> -->
  43. <load module="mod_rtc"/>
  44. <!-- <load module="mod_rtmp"/> -->
  45. <!--<load module="mod_verto"/>-->
  46. <!-- Applications -->
  47. <load module="mod_signalwire"/>
  48. <load module="mod_commands"/>
  49. <load module="mod_conference"/>
  50. <!-- <load module="mod_curl"/> -->
  51. <load module="mod_db"/>
  52. <load module="mod_dptools"/>
  53. <load module="mod_expr"/>
  54. <load module="mod_fifo"/>
  55. <load module="mod_hash"/>
  56. <!--<load module="mod_mongo"/> -->
  57. <!--<load module="mod_voicemail"/>-->
  58. <!--<load module="mod_directory"/>-->
  59. <!--<load module="mod_distributor"/>-->
  60. <!--<load module="mod_lcr"/>-->
  61. <!--<load module="mod_easyroute"/>-->
  62. <load module="mod_esf"/>
  63. <load module="mod_fsv"/>
  64. <!--<load module="mod_cluechoo"/>-->
  65. <load module="mod_valet_parking"/>
  66. <!--<load module="mod_fsk"/>-->
  67. <!--<load module="mod_spy"/>-->
  68. <!--<load module="mod_sms"/>-->
  69. <!--<load module="mod_sms_flowroute"/>-->
  70. <!--<load module="mod_smpp"/>-->
  71. <!--<load module="mod_random"/>-->
  72. <load module="mod_httapi"/>
  73. <!--<load module="mod_translate"/>-->
  74. <!-- SNOM Module -->
  75. <!--<load module="mod_snom"/>-->
  76. <!-- This one only works on Linux for now -->
  77. <!--<load module="mod_ladspa"/>-->
  78. <!-- Dialplan Interfaces -->
  79. <!-- <load module="mod_dialplan_directory"/> -->
  80. <load module="mod_dialplan_xml"/>
  81. <!--<load module="mod_dialplan_asterisk"/>-->
  82. <!-- Codec Interfaces -->
  83. <load module="mod_spandsp"/>
  84. <load module="mod_g723_1"/>
  85. <load module="mod_g729"/>
  86. <load module="mod_amr"/>
  87. <!--<load module="mod_ilbc"/>-->
  88. <!--<load module="mod_h26x"/>-->
  89. <load module="mod_b64"/>
  90. <!--<load module="mod_siren"/>-->
  91. <!--<load module="mod_isac"/>-->
  92. <load module="mod_opus"/>
  93. <!-- File Format Interfaces -->
  94. <load module="mod_av"/>
  95. <load module="mod_sndfile"/>
  96. <load module="mod_native_file"/>
  97. <load module="mod_png"/>
  98. <!-- <load module="mod_shell_stream"/> -->
  99. <!--For icecast/mp3 streams/files-->
  100. <!--<load module="mod_shout"/>-->
  101. <!--For local streams (play all the files in a directory)-->
  102. <load module="mod_local_stream"/>
  103. <load module="mod_tone_stream"/>
  104. <!-- Timers -->
  105. <!-- <load module="mod_timerfd"/> -->
  106. <!-- <load module="mod_posix_timer"/> -->
  107. <!-- Languages -->
  108. <!-- <load module="mod_v8"/> -->
  109. <!-- <load module="mod_perl"/> -->
  110. <!-- <load module="mod_python"/> -->
  111. <!-- <load module="mod_java"/> -->
  112. <load module="mod_lua"/>
  113. <!-- ASR /TTS -->
  114. <!-- <load module="mod_flite"/> -->
  115. <!-- <load module="mod_pocketsphinx"/> -->
  116. <!-- <load module="mod_cepstral"/> -->
  117. <!-- <load module="mod_tts_commandline"/> -->
  118. <!-- <load module="mod_rss"/> -->
  119. <!-- Say -->
  120. <load module="mod_say_en"/>
  121. <!-- <load module="mod_say_ru"/> -->
  122. <!-- <load module="mod_say_zh"/> -->
  123. <!-- <load module="mod_say_sv"/> -->
  124. <!-- Third party modules -->
  125. <!--<load module="mod_nibblebill"/>-->
  126. <!--<load module="mod_callcenter"/>-->
  127. <load module="mod_json_cdr"/>
  128. </modules>
  129. </configuration>

快捷设置

在autoload_configs/switch.conf.xml,定义了一些控制台快捷操作命令。可以通过键盘的F1-F12来使用它们

  1. <cli-keybindings>
  2. <key name="1" value="help"/>
  3. <key name="2" value="status"/>
  4. <key name="3" value="show channels"/>
  5. <key name="4" value="show calls"/>
  6. <key name="5" value="sofia status"/>
  7. <key name="6" value="reloadxml"/>
  8. <key name="7" value="console loglevel 0"/>
  9. <key name="8" value="console loglevel 7"/>
  10. <key name="9" value="sofia status profile internal"/>
  11. <key name="10" value="sofia profile internal siptrace on"/>
  12. <key name="11" value="sofia profile internal siptrace off"/>
  13. <key name="12" value="version"/>
  14. </cli-keybindings>

日志目录

/var/log/freeswitch

日志级别

查看日志级别

  1. # fs_cli -x "console loglevel help"
  2. USAGE:
  3. --------------------------------------------------------------------------------
  4. console loglevel [[0-7] | <loglevel_string>]
  5. Set the logging verbosity of the console from 0 (least verbose) to
  6. 7 (debugging), or specify the loglevel as a string:
  7. 0 console
  8. 1 alert
  9. 2 crit
  10. 3 err
  11. 4 warning
  12. 5 notice
  13. 6 info
  14. 7 debug
  15. --------------------------------------------------------------------------------
  • debug,info,notice,warning,err,crit,alert:7个级别
  • 1~7: 对应上面7个级别(7为debug,1为alert)
  • 0:关闭所有输出(console loglevel 0);

/etc/freeswitch/vars.xml

  1. # cat vars.xml |grep console_loglevel
  2. <X-PRE-PROCESS cmd="set" data="console_loglevel=info"/>

修改日志存放路径

  1. conf\autoload_configs\switch.conf.xml文件中控制着所有的日志输出级别
  2. <param name="loglevel" value="debug"/>

`

`

常见问题

5060端口没有启动

执行

  1. fs_cli -x 'load mod_sofia'

image.png

  1. # netstat -anp|grep 5060
  2. tcp 0 0 172.17.0.2:5060 0.0.0.0:* LISTEN 18356/freeswitch
  3. tcp6 0 0 ::1:5060 :::* LISTEN 18356/freeswitch
  4. udp 0 0 172.17.0.2:5060 0.0.0.0:* 18356/freeswitch
  5. udp6 0 0 ::1:5060 :::*

默认密码

FreeSWITCH的默认密码为1234,客户端使用该密码拨号时,会有10秒的延时。通过修改此默认密码,可以避免这个延时。如把新密码设为2345,此时可以把conf目录下的vars.xml中的:

  1. <X-PRE-PROCESS cmd="set" data="default_password=1234"/>

默认密码是1234 会休眠1000

  1. <condition field="${default_password}" expression="^1234$" break="never">
  2. <action application="log" data="CRIT WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING "/>
  3. <action application="log" data="CRIT Open $${conf_dir}/vars.xml and change the default_password."/>
  4. <action application="log" data="CRIT Once changed type 'reloadxml' at the console."/>
  5. <action application="log" data="CRIT WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING "/>
  6. <action application="sleep" data="10000"/>
  7. </condition>

修改为

  1. <X-PRE-PROCESS cmd="set" data="default_password=2345"/>

参考

https://blog.csdn.net/weixin_45843878/article/details/105655400
https://www.jianshu.com/p/61ce097c9026#52