Skip to main content

FreeSWITCH Conf

配置说明

  • 动态配置,没有 DTD,有 schema 概念
  • 入口配置 switch.conf
  • 模块配置 modules.conf
  • 模式
    • default.xml - <user id="1000" type="pointer"/> 指向 目录里的具体配置
      • default/
        • spec.xml
    • <param name="password" value="$${default_password}"/> 变量引用
  • XML 接口模块
    • mod_xml_cdr
    • mod_xml_curl
    • mod_xml_diaplan
    • mod_xml_radius
    • mod_xml_rpc
    • mod_xml_scgi

预处理

  • include
  • set - 全局变量
    • {variable} - 配置时在预处理后会被替换 - 运行时同 `${variable}`
    • ${variable} - 不受预处理影响
    • 静态,一次性
  • exec - 执行脚本
  • exec-set - 结果设置为变量
  • comment
变量
<!-- 设置变量 -->
<X-PRE-PROCESS cmd="set" data="my_variable='value'"/>
<!--#set my_variable='value'-->

<!-- 不生效 - 临时禁用 -->
<X-PRE-PROCESS cmd="comment" data="my_variable='value'"/>
<X-NO-PRE-PROCESS cmd="set" data="my_variable='value'"/>
<Y-PRE-PROCESS cmd="set" data="my_variable='value'"/>

<X-PRE-PROCESS cmd="exec" data="/path/to/my_script_that_dumps_all_configs_to_stdout.pl"/>
<X-PRE-PROCESS cmd="exec-set" data="local_ip_v4=ip addr show eth1 | awk '/inet /{print $2}' | head -n 1 | cut -d '/' -f 1"/>
  • 不能注释
  • 可以移除或者改名字 - 例如 改为 X-NO-PRE-PROCESS
include
<X-PRE-PROCESS cmd="include" data="vars.xml"/>

<section name="configuration" description="Various Configuration">
<X-PRE-PROCESS cmd="include" data="autoload_configs/*.xml"/>
</section>
vars.xml
<include>
<!-- 被 include 内容 -->
</include>

配置文件

  • extensions.conf
  • freeswitch.xml
  • fur_elise.xml
  • mime.types
  • notify-voicemail.tpl
  • tetris.ttml
  • vars.xml
  • voicemail.tpl
  • web-vm.tpl
  • autoload_configs/ - 自动加载的配置目录
    • switch.conf.xml - 核心配置
  • chatplan/
  • dialplan/
    • features.xml
    • default.xml
    • default/
    • public.xml
    • public/
    • skinny-patterns.xml
    • skinny-patterns/
  • directory/
    • default.xml
    • default/
  • ivr_menus
  • jingle_profiles
  • lang
  • mrcp_profiles
  • sip_profiles
  • skinny_profiles
  • tls
    • dtls-srtp.pem
    • wss.pem

vars

global_getvar variable_name
uuid_getvar <uuid> variable_name

目录

namevaluedesc
base_dir/etc/freeswitch
cache_dir/var/cache/freeswitch
certs_dir/etc/freeswitch/tls
conf_dir/etc/freeswitch
data_dir/share/freeswitch
db_dir/var/lib/freeswitch/db
fonts_dir/share/freeswitch/fonts
grammar_dir/share/freeswitch/grammar
htdocs_dir/share/freeswitch/htdocs
images_dir/var/lib/freeswitch/images
localstate_dir/var/lib/freeswitch
log_dir/var/log/freeswitch
mod_dir/lib/freeswitch/mod
recordings_dir/var/lib/freeswitch/recordings
run_dir/var/run/freeswitch
script_dir/share/freeswitch/scripts
sounds_dir/share/freeswitch/sounds
storage_dir/var/lib/freeswitch/storage
temp_dir/tmp
sound_prefix/share/freeswitch/sounds/en/us/callie

网络

namevaluedesc
domain$${local_ip_v4}default/fallback domain
domain_name$${domain}
external_auth_callsfalse
external_rtp_ipstun:stun.freeswitch.orgstun-set
external_sip_ipstun:stun.freeswitch.orgstun-set
unroll_loopstruesip loopback unrolling
external_sip_port5080
external_ssl_enablefalse
external_tls_port5081
internal_auth_callstrue
internal_sip_port5060
internal_ssl_enablefalse
internal_tls_port5061
local_ip_v4192.168.1.1
local_ip_v6::1
local_mask_v4255.255.252.0
zrtp_secure_mediatrueZRTP
nat_public_addr
nat_private_addr
nat_type
rtp_secure_mediaSRTP
rtp_secure_media_inbound
rtp_secure_media_outbound

媒体

namevaluedesc
call_debugfalse
console_loglevelinfo
default_areacode918
default_countryUS
namevaluedesc
core_uuid
default_password1234
default_providerexample.com
default_provider_contact5000
default_provider_from_domainexample.com
default_provider_passwordpassword
default_provider_registerfalse
default_provider_usernamejoeuser
global_codec_prefsOPUS,G722,PCMU,PCMA,H264,VP8
outbound_codec_prefsOPUS,G722,PCMU,PCMA,H264,VP8
hold_musiclocal_stream://moh
outbound_caller_id0000000000
outbound_caller_nameFreeSWITCHconference.conf.xml, user directory default
presence_privacyfalse
rtp_liberal_dtmftrue
rtp_video_max_bandwidth_in3mb
rtp_video_max_bandwidth_out3mb
suppress_cngtrue
use_profileexternal
  • codecname[@8000h|16000h|32000h[@XXi]]

dingaling

namevaluedesc
bind_server_ipauto
xmpp_client_profilexmppc
xmpp_server_profilexmpps

switch.conf

<configuration name="switch.conf" description="Core Configuration">
<cli-keybindings>
<!-- bind function key -->
<key name="[1-12]" value="[api command]"/>
</cli-keybindings>
<!-- 所有 codec 默认 20ms -->
<default-ptimes>
<!-- <codec name="G729" ptime="40"/> -->
</default-ptimes>
<settings>
</settings>
</configuration>
settingvaluedesc
max-db-handles50
db-handle-timeout10
min-idle-cpu25
event-heartbeat-interval10
max-sessions1000
sessions-per-second30
logleveldebug全局默认 log 级别
debug-level0-10
sql-buffer-len1m
max-sql-buffer-len2m
min-dtmf-duration400最低 400
max-dtmf-duration192000
default_dtmf_duration2000
verbose-channel-eventsno
enable-clock-nanosleeptrue
enable-monotonic-timingtrue
rtp-start-port16384
rtp-end-port32768
rtp-port-usage-robustnesstrue使用端口前先测试未被使用
rtp-enable-zrtpfalse
rtp-retain-crypto-keysfalse
core-db-dsn数据库配置
core-db-name
auto-create-schemastrue
auto-clear-sqltrue
enable-early-hanguptrue
core-dbtype
multiple-registrationstrue
max-audio-channels2

默认按键绑定

keycommand
F1help
F2status
F3show channels
F4show calls
F5sofia status
F6reloadxml
F7console loglevel 0
F8console loglevel 7
F9sofia status profile internal
F10sofia profile internal siptrace on
F11sofia profile internal siptrace off
F12version

modules.conf

  • 顺序
    • logger
    • Multi-Faceted
    • xml interface
    • event handler
    • directory interface
    • Endpoints
    • Applications
    • SNOM
    • Dialplan Interfaces
    • Codec Interfaces
    • File Format Interfaces
    • Timer
    • Languages
    • ASR/TTS
    • Say
    • 第三方
<configuration name="modules.conf" description="Modules">
<modules>
<!-- 自定义加载模块 - 内置模块不需要 path -->
<load module="mod_com_g729" path="/opt/fs/mod_com" critical="true"/>
</modules>
</configuration>

通道