Global Variables
About
At startup FreeSWITCH creates some global variables, these are read-only (technically, you can change them, but changing the value has no effect). Some of these are used heavily in the default configuration, others are just there for informational purpose.
On this page we list all these pre-defined variables.
Click here to expand Table of Contents
- 1 Networking & SIP Related
- 1.1 hostname
- 1.2 local_ip_v4
- 1.3 local_ip_v6
- 1.4 local_mask_v4
- 1.5 nat_public_addr
- 1.6 nat_private_addr
- 1.7 nat_type
- 1.8 zrtp_enabled ZRTP IS NOW DEPREICATED and will be removed out of the docs
- 2 Directories
- 2.1 base_dir
- 2.2 cache_dir
- 2.3 certs_dir
- 2.4 conf_dir
- 2.5 db_dir
- 2.6 grammar_dir
- 2.7 htdocs_dir
- 2.8 log_dir
- 2.9 mod_dir
- 2.10 recordings_dir
- 2.11 run_dir
- 2.12 script_dir
- 2.13 sounds_dir
- 2.14 sound_prefix
- 2.15 storage_dir
- 2.16 temp_dir
- 3 Others
- 3.1 core_uuid
- 3.2 switch_serial
Networking & SIP Related
hostname
string This global variable is set dynamically by the FreeSWITCH core and is set to the host name of the server on which FreeSWITCH is running. You cannot override the value of this variable by setting it. However if you change the host name of the server the value of the variable will be updated.
local_ip_v4
string
This global variable is set dynamically by the FreeSWITCH core by asking the underlying OS for the IP address of the server on which FreeSWITCH is running. If the server has multiple IP addresses this will be set to the first one returned by the OS. In the default configuration there are many settings that use this global variable.
You cannot override the value of this global variable, because it will be reset by the FreeSWITCH core every minute. If your server has multiple IP addresses and you want to force FreeSWITCH to use a particular IP address, you can create a global variable force_local_ip_v4
and set it to the IP address you prefer. You must also set the local_ip_v4 variable to this IP address, you can do it by simply setting local_ip_v4 to use the value of force_local_ip_v4
Example: force_local_ip_v4
<X-PRE-PROCESS cmd="set" data="force_local_ip_v4=1.1.1.1"/>
<X-PRE-PROCESS cmd="set" data="local_ip_v4=$${force_local_ip_v4 }"/>
FreeSWITCH will not validate that the IP address you entered for force_local_ip_v4
is actually pointing to the server, it's up to you to ensure that you use a valid IP address that's routed correctly to the server.
local_ip_v6
string
This global variable is set dynamically by the FreeSWITCH core by asking the underlying OS for the IPv6 address of the server on which FreeSWITCH is running (if it supports IPv6). If the server has multiple IPv6 addresses this will be set to the first one returned by the OS. In the default configuration this variable is used for setting up IPv6 SIP and Verto Profiles.
You cannot override the value of this global variable, because it will be reset by the FreeSWITCH core every minute. If your server has multiple IPv6 addresses and you want to force FreeSWITCH to use a particular IPv6 address, you can create a global variable force_local_ip_v6 and set it to the IP address you prefer. You must also set the local_ip_v6 variable to this IP address, you can do it by simply setting local_ip_v6 to use the value of force_local_ip_v6.
Example: force_local_ip_v6
<X-PRE-PROCESS cmd="set" data="force_local_ip_v4=1.1.1.1"/>
<X-PRE-PROCESS cmd="set" data="local_ip_v4=$${force_local_ip_v4 }"/>
FreeSWITCH will not validate that the IPv6 address you entered for force_local_ip_v6
is actually pointing to the server, it's up to you to ensure that you use a valid IP address that's routed correctly to the server.
local_mask_v4
string
This global variable is set dynamically by the FreeSWITCH core by using the network mask received from the underlying OS when determining the local_ip_v4.
nat_public_addr
string
If you use auto-nat and FreeSWITCH was able to identify the public IP address pointing to your server, this variable will be set with the auto detected public IP address.
nat_private_addr
string
If you use auto-nat and a public IP address was detected, this variable will be set with the private IP address to which the detected public IP address is mapped.
nat_type
string
If you use auto-nat FreeSWITCH will set this global variable to the type of auto nat device it detected this can be either pmp or upnp.
zrtp_enabled ZRTP IS NOW DEPREICATED and will be removed out of the docs
string
This global variable is set by the FreeSWITCH core to the value of the global rtp-enable-zrtp setting in switch.conf.xml. For more information see the SIP TLS page.
Directories
These variables show the default directory used by FreeSWITCH for certain files. At startup FreeSWITCH will assign default values to all of these, to use a different directory, you can pass it along as a Command Line Switch at startup.
base_dir
string
This defines the base directory for most other directory settings
cache_dir
string
certs_dir
string
conf_dir
string
db_dir
string
grammar_dir
string
htdocs_dir
string
log_dir
string
mod_dir
string
recordings_dir
string
run_dir
string
script_dir
string
sounds_dir
string
sound_prefix
string Directory prefix where the sounds for phrase macros live, and where recordings are saved by default. See mod_dptools:record, mod_dptools:record_session, and mod_commands's (the FreeSWITCH API) uuid_record
.
See Variables on how to check the values of local and global variables.
storage_dir
string
temp_dir
string
Others
core_uuid
string
switch_serial
string