Skip to main content

Chapter 32: Channel Variables Catalog

Channel variables are per-channel named string values that FreeSWITCH maintains for the lifetime of a call leg. They are referenced in dialplan expressions and application arguments as ${variable_name}. Variables are set by the user directory when a caller authenticates, by dialplan actions such as set and export, by endpoint modules such as mod_sofia, and by core applications at runtime. A variable set with set applies only to the current leg; export additionally propagates the variable to any B-leg created by a subsequent bridge.

Call Control and Routing

These variables govern what FreeSWITCH does before, during, and after a bridge.

VariablePurpose
continue_on_failControls dialplan continuation when a bridge attempt fails. Set to true to continue processing regardless of failure cause. Set to a comma-separated list of Q.850 cause names (e.g., USER_BUSY,NO_ANSWER) or numeric codes (e.g., 17,18) to continue only on those specific causes. Default: false.
hangup_after_bridgeWhen true, the A-leg is terminated as soon as the B-leg hangs up. When false (default), dialplan execution continues after the bridge returns. Evaluated after park_after_bridge and transfer_after_bridge.
park_after_bridgeWhen true, the call is parked after the bridge returns instead of continuing dialplan execution. Evaluated before hangup_after_bridge.
park_after_early_bridgeWhen true, the call is parked after an early-media bridge terminates, before the B-leg answers. Corresponds to SWITCH_PARK_AFTER_EARLY_BRIDGE_VARIABLE in switch_types.h.
transfer_after_bridgeSpecifies a dialplan transfer destination (extension [dialplan [context]]) to execute after a bridge completes.
transfer_after_early_bridgeSpecifies a dialplan transfer destination to execute when an early-media bridge terminates before the B-leg answers. Corresponds to SWITCH_TRANSFER_AFTER_EARLY_BRIDGE_VARIABLE.
call_timeoutMaximum number of seconds to wait for the B-leg to answer when using the bridge application. Applies to the A-leg and governs all bridges on that channel. Has no effect once early media is received unless ignore_early_media=true is also set. Default: 60.
park_timeoutWhen set on a parked channel, the call is disconnected after this many seconds. Accepts an integer or the form seconds:HANGUP_CAUSE_NAME. If not set the parked call is held until explicitly transferred. Example: park_timeout=30:MEDIA_TIMEOUT.
fail_on_single_rejectApplies when the , (AND) operator is used in a bridge dial string. When true, a single rejection from any listed destination terminates the entire bridge attempt immediately. Can be set to a specific cause name (USER_BUSY) to fail only on that cause, or a negated cause (!NORMAL_CLEARING) to fail on all other causes. Accepts a custom delimiter list: ^^:CAUSE1:CAUSE2. Default: false.
failure_causesComma-separated list of Q.850 cause names. When the bridge returns with one of these causes, the channel is considered failed and transfer_on_fail is invoked. Operates as the reverse of continue_on_fail. Defined in switch_channel.c.
transfer_on_failDialplan transfer destination to execute when a bridge fails. Used in conjunction with failure_causes. Format: extension [dialplan [context]]. Defined in switch_channel.c.
bridge_early_mediaWhen true, live audio received as early media from the B-leg is buffered and played back to the A-leg as ringback. Increases resource usage relative to the default (false). Useful with loopback channels or multi-destination originations where network-generated tones must be relayed accurately.
ignore_early_mediaControls whether early media (SIP 183 with SDP) causes the bridge to "connect" immediately. true ignores early media and keeps ringing until the B-leg answers. ring_ready behaves like true but also sends a SIP 180 to the A-leg when the first 183 is received. Default: false.
ringbackAudio to play to the A-leg while waiting for the B-leg to answer (early media phase). Accepts a full filesystem path to an audio file or a TGML tone string (e.g., %(2000,4000,440,480)). Takes effect only when there is no early media from the B-leg unless ignore_early_media is also set.
transfer_ringbackAudio to play to the A-leg during a transfer when the channel is already answered. Accepts the same formats as ringback.
transfer_fallback_extensionDialplan extension to transfer a call to when a transfer attempt fails. Set this before executing the transfer.
hold_musicAudio stream to play when a channel is placed on hold. Accepts a local stream reference (e.g., local_stream://moh) or a full audio file path.
temp_hold_musicOverrides hold_music for a single hold operation. Cleared automatically after the hold ends. Corresponds to SWITCH_TEMP_HOLD_MUSIC_VARIABLE in switch_types.h.
instant_ringbackWhen true, ringback defined by ringback is generated immediately without waiting for a ringing indication from the B-leg. Default: false.
max_forwardsSets the SIP Max-Forwards header value for outbound requests on this channel. Corresponds to SWITCH_MAX_FORWARDS_VARIABLE.
max_session_transfersMaximum number of times a channel may be transferred. When the count is exceeded, further transfer attempts are rejected. Corresponds to SWITCH_MAX_SESSION_TRANSFERS_VARIABLE in switch_types.h.
export_varsComma-separated list of variable names to automatically export to any B-leg created by a bridge. Equivalent to calling export on each listed variable. Corresponds to SWITCH_EXPORT_VARS_VARIABLE.
bridge_export_varsLike export_vars but variables are exported only to the B-leg for the duration of the bridge, not permanently. Corresponds to SWITCH_BRIDGE_EXPORT_VARS_VARIABLE.
send_silence_when_idleInteger. When set to a negative value (typically -1), FreeSWITCH sends comfort-noise silence packets to the channel when there is no audio to send. Prevents RTP timeouts on devices that require a continuous media stream. Read by switch_ivr.c and switch_rtp.c. Corresponds to SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE.
playback_terminatorsString of DTMF digits that cause a playing audio file to stop immediately. Example: 1234567890*#. Set to none to disable termination. Applies to playback, read, play_and_get_digits, and similar applications. Corresponds to SWITCH_PLAYBACK_TERMINATORS_VARIABLE.
ignore_display_updatesWhen true, incoming SIP UPDATE or re-INVITE requests that only modify display name are silently ignored and not relayed to the bridged party. Corresponds to SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE.
enable_heartbeat_eventsInteger seconds. When set, FreeSWITCH fires a SESSION_HEARTBEAT event on this channel at the specified interval. Useful for monitoring long-duration calls. Corresponds to SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE.

Routing and Recovery Controls

These variables steer dialplan transfer/redirect behavior and call recovery.

VariablePurpose
force_transfer_contextForces the dialplan context used by the transfer application when no context is given in the transfer arguments.
force_transfer_dialplanForces the dialplan engine used by the transfer application when none is given in the transfer arguments.
inbound_dialplanOverrides the dialplan engine used for inbound calls on the endpoint.
group_contextDialplan context applied to channels created by the group dialer.
inline_destinationDestination used for inline dialplan execution on a redirected or hung-up leg.
disable_q850_reasonWhen true, suppresses the Q.850 Reason header in SIP hangup signaling.
ignore_completed_elsewhereWhen true, ignores the SIP "completed elsewhere" indication on CANCEL so the call is not flagged as answered elsewhere.
enum_nameserverDNS nameserver(s) used for ENUM lookups by mod_enum.
recovery_profile_nameOverrides the SIP profile name stored and used for call recovery.
secondary_recovery_moduleName of a secondary endpoint module consulted when recovering a call.

Bridge and Transfer

These variables are set by the core when a bridge or transfer is active or has just completed. Most are read-only at runtime; a few are also operator-settable to influence behavior.

VariablePurpose
bridge_channelSet by the core on both legs when a bridge is established. Contains the channel name (e.g., sofia/internal/1001@10.0.0.1) of the remote leg. Read-only; set in switch_ivr_bridge.c. Corresponds to SWITCH_BRIDGE_CHANNEL_VARIABLE.
bridge_uuidSet by the core on both legs when a bridge is established. Contains the UUID of the remote leg. Cleared when the bridge ends. Read-only. Corresponds to SWITCH_BRIDGE_UUID_VARIABLE.
bridge_toSet to the channel name of the most recently bridged B-leg after the bridge completes. Read-only; corresponds to SWITCH_BRIDGE_VARIABLE (bridge_to) in switch_types.h.
last_bridge_toSet to the channel name of the previously bridged B-leg when a new bridge supersedes it. Useful for inspecting bridge history after multiple sequential bridges. Read-only; corresponds to SWITCH_LAST_BRIDGE_VARIABLE.
signal_bridge_toUUID of the channel for a signal-only bridge (used by uuid_bridge). The two legs pass signaling to each other but media is handled independently. Operator-settable before calling signal_bridge. Corresponds to SWITCH_SIGNAL_BRIDGE_VARIABLE.
signal_bondSet on a channel to the UUID of its signal-bonded peer after a signal bridge is established. Read-only; set by switch_ivr_bridge.c. Corresponds to SWITCH_SIGNAL_BOND_VARIABLE.
originate_signal_bondSet on the A-leg channel immediately after origination to the UUID of the newly created B-leg. Distinct from signal_bond in that it records the origination relationship rather than a subsequent signal bridge. Read-only. Corresponds to SWITCH_ORIGINATE_SIGNAL_BOND_VARIABLE.
originatorUUID of the channel that originated this leg. Set on the B-leg by the originate engine. Read-only; corresponds to SWITCH_ORIGINATOR_VARIABLE.
originator_codecCodec string of the A-leg at the time of origination. Set on the B-leg by the core (switch_core_session.c) so the B-leg can offer a compatible codec list. Read-only; corresponds to SWITCH_ORIGINATOR_CODEC_VARIABLE.
originator_video_codecVideo codec string of the A-leg at the time of origination. Set on the B-leg alongside originator_codec. Read-only; corresponds to SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE.
exec_after_bridge_appDialplan application name to execute on this channel immediately after the bridge returns. The application runs before dialplan processing resumes. Corresponds to SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE.
exec_after_bridge_argArgument string for the application named in exec_after_bridge_app. Corresponds to SWITCH_EXEC_AFTER_BRIDGE_ARG_VARIABLE.
att_xfer_resultSet by the att_xfer (attended transfer) application to success or failure after the transfer completes. Read-only; set in mod_dptools.c. Corresponds to SWITCH_ATT_XFER_RESULT_VARIABLE.
transfer_historyMulti-value variable. Each transfer appends a record in the format epoch:uuid:type:destination. Read by CDR modules to reconstruct the transfer chain. Read-only; set by switch_ivr.c and mod_sofia. Corresponds to SWITCH_TRANSFER_HISTORY_VARIABLE.
transfer_sourceIdentifies the source of the most recent transfer on this channel. Format matches the entries in transfer_history. Read-only; set alongside transfer_history. Corresponds to SWITCH_TRANSFER_SOURCE_VARIABLE.
holding_uuidUUID of the channel currently on hold associated with this channel. Set by mod_sofia during attended transfer scenarios. The originate engine reads and clears this variable when bridging back. Corresponds to SWITCH_HOLDING_UUID_VARIABLE.
soft_holding_uuidUUID of a channel placed in a "soft" hold during a three-way call or similar scenario. Cleared when the three-way terminates and the held party is bridged back. Corresponds to SWITCH_SOFT_HOLDING_UUID_VARIABLE.
endpoint_dispositionDescribes the SIP negotiation outcome set by mod_sofia and the core state machine. Common values: RECEIVED, EARLY MEDIA, ANSWER, PROXY MEDIA, DELAYED NEGOTIATION, CODEC NEGOTIATION ERROR, NO CODECS, REDIRECT_ERROR, ATTENDED_TRANSFER. Read-only. Corresponds to SWITCH_ENDPOINT_DISPOSITION_VARIABLE.
channel_nameThe full channel name string (e.g., sofia/internal/1001@example.com). Set by the core when the channel is created. Read-only. Corresponds to SWITCH_CHANNEL_NAME_VARIABLE.
audio_spool_pathDirectory path where audio files are spooled before being written to their final location. When set, the core writes audio to this path first and then moves it. Corresponds to SWITCH_AUDIO_SPOOL_PATH_VARIABLE.

Bridge Behavior and Pre-Execution

These variables tune the bridge and uuid_bridge applications, attended/blind transfer, and the intercept application.

VariablePurpose
bridge_answer_timeoutSeconds to wait for the A-leg to answer during a bridge before bailing out. Integer seconds.
bridge_terminate_keyDTMF digit that, when received, terminates the bridge. Single-key string.
bridge_filter_dtmfWhen true, DTMF is filtered (not passed) across the bridge.
bridge_generate_comfort_noiseGenerates comfort-noise toward the far leg during the bridge. true uses level 1400, or supply an integer level (values below -1 disable).
continue_on_answer_timeoutWhen true, the bridge continues rather than failing when the answer timeout is reached.
answer_delayMilliseconds to sleep immediately after a channel is answered. Integer ms; ignored in proxy/text mode.
answer_flagsDefault flags for the answer application when called with no arguments. Substring-matched values is_conference, decode_video, and debug_video set the corresponding channel flags.
bridge_pre_execute_appDialplan application executed on the A-leg before the bridge loop begins.
bridge_pre_execute_dataArgument data passed to bridge_pre_execute_app.
bridge_pre_execute_aleg_appApplication executed on the caller (A) leg just before a multi-threaded bridge.
bridge_pre_execute_aleg_dataArgument data for bridge_pre_execute_aleg_app.
bridge_pre_execute_bleg_appApplication executed on the callee (B) leg just before a multi-threaded bridge.
bridge_pre_execute_bleg_dataArgument data for bridge_pre_execute_bleg_app.
camponWhen true, enables camp-on (retry) behavior on bridge.
attended_transfer_no_copyComma-separated list of variable names NOT to copy across legs during an attended transfer.
blind_transfer_uuidUUID of the leg to hang up or transfer when performing a blind transfer.
confirm_blind_transferWhen true, requires confirmation handling for blind transfers.
deny_refer_requestsWhen true on a bridged leg, rejects incoming SIP REFER (transfer) requests.
hold_hangup_xfer_extenWhen a held leg's bridge ends, transfer the other leg to this extension instead of hanging it up.
xfer_uuidsSupplies the pair of leg UUIDs for an att_xfer operation.
intercept_pre_bondWhen true, allows intercept to grab a leg that is in a pre-bond state.
intercept_unanswered_onlyWhen true, restricts intercept to unanswered legs only.
intercept_unbridged_onlyWhen true, restricts intercept to unbridged legs only.
uuid_bridge_continue_on_cancelWhen true, a uuid_bridge parks the surviving leg rather than hanging up when a leg cancels.
uuid_bridge_park_on_cancelWhen true, parks the surviving leg on a uuid_bridge cancel.

Origination

These variables are set inside the {} global block or [] per-leg block of an originate command or bridge dial string. They control how outbound legs are established.

VariablePurpose
originate_timeoutTotal wall-clock seconds to wait across all legs before the originate fails. When using the | (OR) operator, applies to the entire sequence unless originate_continue_on_timeout is set. Default: 60.
originate_continue_on_timeoutWhen true and the | (OR) operator is used, the originate continues to the next destination after originate_timeout expires on the current destination instead of failing. Default: false.
originate_retriesNumber of times to retry the entire originate dial string on failure. Valid range: 1 to 100. Works only when originate_retry_sleep_ms is also set or the value is 100 or fewer.
originate_retry_sleep_msMilliseconds to wait between originate retry attempts. Valid range: 500 to 60000.
leg_timeoutPer-leg answer timeout in seconds. Set in the [] per-leg block. Overrides call_timeout for that leg. Cannot be used in the global {} block; use originate_timeout there instead.
leg_progress_timeoutPer-leg timeout in seconds for receiving any early media or ring indication. If no media is received within this window the leg is abandoned. Set in the [] per-leg block.
leg_delay_startSeconds to delay before initiating this leg. Set in the [] per-leg block. The leg_timeout timer does not start until after the delay expires.
group_confirm_keyDTMF digit the called party must press to accept the call. Used for answer confirmation in parallel or sequential ring scenarios. The call is not bridged until the key is received.
group_confirm_fileAudio file to play to the B-leg while waiting for the confirmation key. Played in a loop until the key is pressed or a timeout occurs.
group_confirm_error_fileAudio file to play to the B-leg when a wrong DTMF key is received.
group_confirm_timeoutSeconds to wait for the confirmation key. When set, takes precedence over group_confirm_cancel_timeout.
group_confirm_cancel_timeoutWhen true, cancels the confirmation timeout so the B-leg is held indefinitely until a key is received. Has no effect if group_confirm_timeout is also set.
group_confirm_read_timeoutMilliseconds of silence after a key press before accepting the input.
fail_on_single_rejectSee Call Control and Routing section above.
originated_legsSet on the A-leg after origination completes. Contains a pipe-delimited list of uuid:disposition:cause for each B-leg that was attempted. Populated by the originate engine in switch_ivr_originate.c. Read-only after origination.
originate_dispositionSet on the caller channel to indicate the outcome of an originate. Possible values include success, failure, call accepted, and Q.850 cause name strings. Read-only; set by originate engine.
originating_leg_uuidSet on a B-leg channel to record the UUID of the A-leg that originated it. Read-only; set by originate engine.
sip_invite_to_uriWhen set before a bridge, overrides the To URI placed in the outbound SIP INVITE. Read by mod_sofia in sofia_glue.c.
sip_invite_from_uriWhen set before a bridge, overrides the From URI placed in the outbound SIP INVITE. Read by mod_sofia in sofia_glue.c.
sip_invite_req_uriWhen set before a bridge, overrides the Request-URI of the outbound SIP INVITE. Read by mod_sofia in sofia_glue.c.
sip_invite_domainOverrides the domain portion of the INVITE. Set automatically from the gateway from_domain if not already set. Read by mod_sofia in mod_sofia.c.

Originated-Leg Controls

These variables are set on the A-leg (or in the dial string) to shape the outbound leg created by bridge/originate.

VariablePurpose
origination_uuidForces the originated session to use this UUID instead of an auto-generated one.
origination_channel_nameSets the display name of the originated peer channel.
origination_callee_id_nameSets the originated peer channel's callee_id_name.
origination_callee_id_numberSets the originated peer channel's callee_id_number.
origination_audio_modeOverrides the outbound SDP audio direction for the originated leg: sendrecv, sendonly, recvonly, or inactive (consumed once, then cleared).
origination_nested_varsWhen true, allows nested/recursive ${var} expansion during origination by disabling variable-existence checking.
call_uuidLogical call-group UUID. Used as the channel's Channel-Call-UUID in events and propagated from caller to originated peer legs so multiple legs share one call UUID.
inherit_codecWhen true, an outbound/B-leg inherits the codec of the originating leg.
leg_requiredWhen true on an originated leg, marks that leg as required in the dial.
preserve_originated_varsWhen false, originated-leg variables are not preserved onto the caller leg.
push_channel_nameWhen true, derives and pushes the B-leg channel name (X-FS-Channel-Name) from the caller leg.

Caller Identity

FreeSWITCH maintains several caller-ID variables with distinct scopes and precedence.

VariablePurpose
caller_id_nameThe display name presented by the inbound call. Set by the endpoint module from the incoming SIP From header or equivalent. Effectively read-only in the dialplan; modify presentation using effective_caller_id_name.
caller_id_numberThe calling number presented by the inbound call. Set by the endpoint module from the incoming SIP From header or equivalent. Effectively read-only in the dialplan; modify presentation using effective_caller_id_number.
effective_caller_id_nameOverrides the caller ID name presented to downstream parties. Automatically exported to the B-leg. Must be set before calling bridge; it is not valid in an origination string. To remove an override, set to _undef_.
effective_caller_id_numberOverrides the caller ID number presented to downstream parties. Automatically exported to the B-leg. Must be set before calling bridge; it is not valid in an origination string.
outbound_caller_id_nameDefault caller ID name used for user-directory-driven outbound calls. Typically set in the directory entry and referenced in conference and gateway configurations.
outbound_caller_id_numberDefault caller ID number used for user-directory-driven outbound calls. Typically set in the directory entry.
origination_caller_id_nameCaller ID name to use when originating a new call (A-leg). Specified inside the {} origination variable block in an originate command or bridge dial string. Takes precedence over effective_caller_id_name at origination time.
origination_caller_id_numberCaller ID number to use when originating a new call (A-leg). Specified inside the {} origination variable block.

Effective and Initial Callee Identity

These override the caller/callee identity presented in outbound signaling.

VariablePurpose
effective_callee_id_nameOverrides the callee ID name presented in outbound signaling.
effective_callee_id_numberOverrides the callee ID number presented in outbound signaling.
initial_callee_id_nameSets the initial (pre-update) callee ID name for outbound signaling.
initial_callee_id_numberSets the initial (pre-update) callee ID number for outbound signaling.
effective_aniOverrides the ANI used for the call's effective caller profile.
effective_aniiiOverrides the ANI II digits for the call's effective caller profile.

SIP

These variables expose SIP message fields and control SIP header injection. They are specific to channels handled by mod_sofia.

Inbound Fields (set by mod_sofia on call arrival)

VariablePurpose
sip_from_userThe user part of the SIP From URI of the incoming request.
sip_from_hostThe host part of the SIP From URI of the incoming request.
sip_from_uriThe full From URI (user@host) of the incoming request.
sip_from_displayThe display name from the SIP From header (quoted string), if present. Set in sofia.c.
sip_to_userThe user part of the SIP To URI of the incoming request.
sip_to_hostThe host part of the SIP To URI of the incoming request.
sip_to_uriThe full To URI (user@host) of the incoming request.
sip_req_uriThe full Request-URI of the incoming SIP INVITE. Set by sofia_glue.c.
sip_contact_userThe user part of the SIP Contact URI from the incoming request.
sip_contact_hostThe host part of the SIP Contact URI from the incoming request.
sip_call_idThe SIP Call-ID header value of the dialog. Set on arrival and updated on reINVITE.
sip_user_agentThe User-Agent or Server header string from the remote SIP party.
sip_network_ipIP address of the network interface on which the SIP message arrived. Set by mod_sofia.
sip_received_ipSource IP address from which the SIP request was received. May differ from sip_network_ip when NAT is involved.
sip_via_hostHost portion of the topmost Via header in the incoming SIP request.
sip_via_portPort from the topmost Via header in the incoming SIP request.
sip_via_rportrport parameter from the topmost Via header, if present.
sip_via_protocolTransport protocol from the topmost Via header (e.g., UDP, TCP, TLS).
sip_cid_typeThe caller-ID presentation type derived from the inbound identity headers. Set by mod_sofia in sofia.c to rpid when a Remote-Party-ID header is present, or pid when a P-Asserted-Identity or P-Preferred-Identity header is present.

Authentication Fields

VariablePurpose
sip_auth_usernameThe username credential presented during SIP digest authentication. Populated by mod_sofia and available in the directory auth event.
sip_auth_passwordThe password used during SIP digest authentication. Available during directory lookup for authenticating registrations and calls.
sip_auth_realmThe digest realm from the SIP authentication challenge. Populated by mod_sofia.

Redirect Handling

VariablePurpose
outbound_redirect_fatalWhen true, a SIP 3xx redirect response causes the bridge to fail immediately instead of following the redirect. Read by mod_sofia in sofia.c.
sip_redirect_profileSofia profile name to use when following a 3xx redirect. Defaults to the current profile name.
sip_redirect_contextDialplan context to use when routing a redirected call. Defaults to redirected.
sip_redirect_dialplanDialplan module to use when routing a redirected call. Defaults to XML.
sip_redirect_forkWhen true, a 3xx redirect with multiple Contact headers causes FreeSWITCH to originate all contacts simultaneously rather than sequentially.
sip_redirected_toSet by mod_sofia to the full Contact URI that was selected when following a 3xx redirect. Read-only; set after redirect processing.
sip_contact_paramsExtra parameters appended (after a ;) to the outbound Contact URI built by mod_sofia when routing an inbound or redirected call. Read by sofia_glue.c.

Custom Headers

VariablePurpose
sip_h_X-Header-NamePrefix pattern for injecting or reading arbitrary SIP headers. Any channel variable whose name begins with sip_h_ causes mod_sofia to include the corresponding header (with the sip_h_ prefix stripped) in outbound SIP messages. Incoming custom headers are also stored using this prefix. Example: setting sip_h_X-Account-Code=1234 adds X-Account-Code: 1234 to the outbound INVITE.

SIP Variable Conventions

mod_sofia exposes all incoming SIP headers as channel variables using the prefix sip_h_. For standard headers this means sip_h_Subject, sip_h_P-Asserted-Identity, and so on. For outbound calls, setting a channel variable with the sip_h_ prefix causes mod_sofia to inject the corresponding header into the outgoing INVITE or other SIP message (the prefix is stripped to form the header name). Custom extension headers follow the same convention: sip_h_X-My-Header=value produces X-My-Header: value in the INVITE.

In addition to the raw sip_h_ map, mod_sofia parses a number of frequently used headers into dedicated variables at call arrival:

  • sip_from_user, sip_from_host, sip_from_uri, sip_from_display
  • sip_to_user, sip_to_host, sip_to_uri, sip_req_uri
  • sip_contact_user, sip_contact_host
  • sip_call_id, sip_user_agent
  • sip_via_host, sip_via_port, sip_via_rport, sip_via_protocol
  • sip_network_ip, sip_received_ip

These parsed variables are convenient aliases; the raw header is still accessible via the sip_h_ prefix if needed.

Presence

VariablePurpose
presence_idSIP URI identifying this channel for presence subscription purposes. When set, mod_sofia uses this value to generate NOTIFY events for subscribed watchers. Example: 1000@example.com.
presence_dataArbitrary string attached to presence state notifications. Passed through to NOTIFY event bodies.

Outbound Header Control

Set on the originating leg, these shape the headers and routing of the outbound INVITE generated by mod_sofia.

VariablePurpose
sip_force_full_fromForces the From header of the outbound INVITE to this full value.
sip_force_full_toForces the To header of the outbound INVITE to this full value.
sip_invite_from_paramsExtra parameters appended to the From header of the outbound INVITE.
sip_invite_to_paramsExtra parameters appended to the To header of the outbound INVITE.
sip_invite_paramsExtra parameters appended to the request-URI of the outbound INVITE.
sip_invite_contact_paramsExtra parameters appended to the Contact header of the outbound INVITE.
sip_invite_pid_paramsExtra parameters appended to the P-Asserted/P-Preferred-Identity header of the outbound INVITE.
sip_invite_tel_paramsExtra tel-URI parameters appended to the outbound INVITE.
sip_invite_cseqForces a specific numeric CSeq value on the outbound INVITE.
sip_invite_route_uriSets the Route header URI for the outbound INVITE.
sip_route_uriOverrides the outbound proxy/Route URI used to send the INVITE (and subsequent requests), bypassing normal routing.
sip_contact_uriOverrides the Contact URI used as the redirect/target for inbound legs.
sip_content_encodingSets the Content-Encoding header on the outbound INVITE's SDP body.
sip_h_dateSupplies an explicit Date header for the outbound INVITE.
sip_h_identitySupplies an explicit STIR/SHAKEN Identity (PASSporT) header on the outbound INVITE.
sip_allowValue used to build the Allow header on UPDATE-based callee-ID/display updates; if it contains UPDATE, UPDATE is treated as allowed.
sip_transportForces the SIP transport (udp/tcp/tls/…) for the outbound request when not set in the URI.
sip_require_timerWhen false, disables advertising/requiring the SIP session timer on the outbound INVITE.
sip_cid_in_1xxWhen false, disables sending callee ID in 1xx provisional responses even if the profile enables it.
sip_cid_suppress_privacy_noneWhen true, suppresses the explicit Privacy: none indication that FreeSWITCH otherwise adds.
sip_reasonOverrides the SIP Reason header sent on outbound BYE/CANCEL (full Reason-header string), unless disable_q850_reason suppresses it.

Behavior Controls

VariablePurpose
sip_auto_simplifyWhen true, FreeSWITCH attempts to refer/transfer itself out of the call path (call simplification) on bridge.
sip_copy_custom_headersWhen false, stops sip_h_* custom headers from being copied across bridged/transferred legs (default on).
sip_copy_multipartWhen false, disables copying the sip_multipart body to the new leg on transfer (default on).
sip_disable_recordingWhen true, rejects an inbound SIPREC/record request with 488 instead of starting recording.
sip_enable_soatrue/false to enable or disable Sofia SOA (offer/answer) processing for the channel.
sip_force_nat_modeWhen true, forces NAT mode on the channel (sets the NAT flag and sip_nat_detected).
sip_sticky_contactWhen true, forces "sticky" NAT contact behavior (record-route plus a NAT session timeout).
sip_ignore_reinvitesWhen true, answers re-INVITEs with 200 OK without renegotiating media.
sip_ignore_remote_causeWhen true, uses FreeSWITCH's own hangup cause rather than the bridged leg's SIP cause.
sip_wait_for_aleg_ackWhen true, defers sending ACK on the B-leg until the A-leg's ACK arrives (3PCC-style coordination).
sip_watch_headersComma-separated list (up to 10) of SIP header names to watch; matching inbound headers are surfaced as events.
sip_gateway_nameNames a configured gateway to associate with the channel at hangup so its failure statistics are updated.
sip_use_gatewayNames a gateway whose credentials are used to answer an auth challenge on the outbound call.
sip_challenge_realmSets the realm used when responding to a call with a 401/407 challenge; falls back to sip_to_host.
sip_exclude_contactContact value to exclude when the sofia_contact function resolves a registration's contact.
sip_match_user_agentUser-Agent substring to match when sofia_contact resolves a registration's contact.
sip_refer_replyThe sipfrag reply string returned to a REFER before the transferred leg is hung up.
sip_invite_failure_statusCustom SIP status used in the sipfrag of a blind-transfer-failure NOTIFY.
sip_blind_transfer_eventThe SIP Event header value used in the sipfrag NOTIFY that completes a blind transfer.
sip_call_tls_orq_connect_timeoutNumeric TLS outgoing-request connect timeout for the outbound INVITE (when supported by the linked sofia-sip).
sip_603plus_passthroughWhen true, restores the 603+ Reason (from sip_603plus_reason) on outbound decline even when disable_q850_reason would suppress it.
sip_603plus_reasonThe Reason-header string used with sip_603plus_passthrough on a 603 response.

STIR/SHAKEN

VariablePurpose
sip_stir_shaken_attestAttestation level (A/B/C) that triggers generation of a STIR/SHAKEN Identity (PASSporT) header on the outbound INVITE.
sip_stir_shaken_vs_hangup_on_failWhen true, the inbound verification service hangs up the call on missing/invalid Identity instead of only setting verstat.
sip_stir_shaken_vs_max_ageMaximum allowed PASSporT age in seconds for inbound verification (default 60).
sip_stir_shaken_vs_require_dateWhen true, requires a valid SIP Date within the freshness window for inbound verification.

Auto-Answer and MSRP

VariablePurpose
sip_auto_answerWhen true on an outbound leg, sends an Event: talk auto-answer NOTIFY on 180/183 (Polycom-style auto-answer).
sip_auto_answer_suppress_notifyWhen true, suppresses the auto-answer NOTIFY that sip_auto_answer would send.
sip_msrp_file_nameFilename used by MSRP file transfer to name the sent/received file.
sip_msrp_local_file_selectorLocal file selector advertised for an MSRP file-transfer offer.
sip_msrp_offer_activeControls the MSRP setup direction (active offer) in the generated SDP for MSRP.

Media Endpoints and SDP

These variables expose the negotiated media addresses and SDP bodies. They are set by the core media engine (switch_core_media.c) and are read-only during a live call.

VariablePurpose
local_media_ipIP address on which FreeSWITCH is listening for inbound RTP audio from the remote party. Set after SDP negotiation. Corresponds to SWITCH_LOCAL_MEDIA_IP_VARIABLE.
local_media_portUDP port on which FreeSWITCH is listening for inbound RTP audio. Set after SDP negotiation. Corresponds to SWITCH_LOCAL_MEDIA_PORT_VARIABLE.
advertised_media_ipIP address advertised in the local SDP for audio RTP. May differ from local_media_ip when NAT is in use or an ext-rtp-ip override is configured. Corresponds to SWITCH_ADVERTISED_MEDIA_IP_VARIABLE.
remote_media_ipIP address of the remote party's audio RTP endpoint, extracted from the received SDP. Read-only. Corresponds to SWITCH_REMOTE_MEDIA_IP_VARIABLE.
remote_media_portUDP port of the remote party's audio RTP endpoint. Read-only. Corresponds to SWITCH_REMOTE_MEDIA_PORT_VARIABLE.
local_video_ipIP address on which FreeSWITCH is listening for inbound video RTP. Corresponds to SWITCH_LOCAL_VIDEO_IP_VARIABLE.
local_video_portUDP port on which FreeSWITCH is listening for inbound video RTP. Corresponds to SWITCH_LOCAL_VIDEO_PORT_VARIABLE.
remote_video_ipIP address of the remote party's video RTP endpoint. Read-only. Corresponds to SWITCH_REMOTE_VIDEO_IP_VARIABLE.
remote_video_portUDP port of the remote party's video RTP endpoint. Read-only. Corresponds to SWITCH_REMOTE_VIDEO_PORT_VARIABLE.
local_text_ipIP address on which FreeSWITCH is listening for inbound text (T.140/RED) RTP. Set for calls involving real-time text. Corresponds to SWITCH_LOCAL_TEXT_IP_VARIABLE.
local_text_portUDP port on which FreeSWITCH is listening for inbound text RTP. Corresponds to SWITCH_LOCAL_TEXT_PORT_VARIABLE.
switch_r_sdpThe raw SDP body received from the remote party (the offer or answer, depending on call direction). Set by the media engine. Read-only. Corresponds to SWITCH_R_SDP_VARIABLE.
switch_l_sdpThe raw local SDP body that FreeSWITCH generated and sent to the remote party. Set by the media engine. Read-only. Corresponds to SWITCH_L_SDP_VARIABLE.
switch_m_sdpThe SDP body from the B-leg, stored on the A-leg for reference during media negotiation. Also called the "media SDP" or "B SDP". Corresponds to SWITCH_B_SDP_VARIABLE (switch_m_sdp) in switch_types.h.
passthru_ptime_mismatchWhen true, allows a bridge to proceed even when the ptime (packetization interval) in the two SDPs does not match, rather than failing or renegotiating. Corresponds to SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE.

SDP and Negotiation Controls

These influence the generated SDP, codec filtering, and early-media/redirect signaling.

VariablePurpose
alert_infoSets the SIP Alert-Info header value on outbound signaling.
early_use_180When true, sends SIP 180 instead of 183 for early media/ringing.
outbound_redirect_infoSupplies the SIP Diversion/redirect info for outbound calls (presence suppresses the default).
ep_codec_prefer_sdpWhen true, prefers the codec ordering from the received SDP over local preference.
filter_codec_stringCodec string used to filter the negotiated/proxied codec list.
sdp_m_per_ptimeMultiplier controlling m=/ptime grouping in the generated SDP.
verbose_sdpWhen true, generates more verbose SDP output.
ndlb_sendrecv_in_sessionNo-default-lazy-behavior flag forcing a=sendrecv at the SDP session level.
exclude_outgoing_extra_headerRegex of sip_h_/extra header names to exclude from outbound SIP requests.
fs_send_unsupported_infoWhen true, sends SIP INFO even with unsupported content.
fs_send_unsupported_messageWhen true, sends SIP MESSAGE even with unsupported content.
ignore_sdp_iceWhen true, ignores ICE candidates present in the received SDP.
add_ice_candidatesWhen true, adds ICE candidates to the generated SDP for the session.
disable_udptl_auto_adjustWhen true, disables automatic UDPTL (T.38) remote-address auto-adjust.

Media and RTP

These variables control codec selection, RTP security, and media path behavior.

VariablePurpose
codec_stringComma-separated list of codec names to offer or accept during negotiation. FreeSWITCH intersects this list with the endpoint's capabilities. Example: PCMU,PCMA,G722. If unset, the profile default applies.
absolute_codec_stringComma-separated list of codecs to use exactly as specified, with no intersection or modification by FreeSWITCH. Overrides codec_string when set. Useful to force a specific codec regardless of what the remote party offers.
media_mix_inbound_outbound_codecsBoolean controlling which codecs are offered on the outbound B-leg. By default FreeSWITCH offers the B-leg exactly the codecs that were offered on the inbound A-leg. Set to true to instead offer the A-leg codecs mixed with the configured outbound codec list (the pre-FS-8321 behavior). Mixing can produce large codec lists that exceed the UDP MTU and cause call-setup failures, which is why the unmixed behavior is the default. Read in switch_core_media.c.
bypass_mediaWhen true, RTP media flows directly between the two endpoints (peer-to-peer). FreeSWITCH continues to handle signaling but does not process media packets. Both endpoints must be reachable by each other.
bypass_media_after_bridgeWhen true, FreeSWITCH switches to bypass media mode after the bridge is established. Corresponds to SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE in switch_types.h.
proxy_mediaWhen true, RTP packets are forwarded through FreeSWITCH without parsing or processing. Lighter than full media handling but heavier than bypass_media. Requires late negotiation to be enabled in the SIP profile.
rtp_secure_mediaControls SRTP negotiation. Accepted values: mandatory (SAVP only), optional (prefer SAVP, accept AVP), forbidden (deny SAVP), default (accept SAVP if offered inbound). Optionally followed by a colon-delimited list of cipher suites (e.g., mandatory:AES_CM_256_HMAC_SHA1_80). The deprecated values true (equivalent to mandatory) and false (equivalent to forbidden) are still accepted.
rtp_secure_media_inboundApplies rtp_secure_media semantics only to the inbound RTP direction.
rtp_secure_media_outboundApplies rtp_secure_media semantics only to the outbound RTP direction.
jitterbuffer_msecActivates the RTP jitter buffer. Format: length:max_length:max_drift, where each value is in milliseconds (numeric) or packet counts (numeric followed by p). Example: 60:200:20 or 2p:25p:4p. Can be set on the B-leg only using export nolocal:jitterbuffer_msec=60.
media_bug_answer_reqWhen true, media bugs (used by recording and other media-processing applications) are activated only after the channel is answered.

RTP and Media Statistics

FreeSWITCH populates a family of rtp_* channel variables with per-stream statistics during and after a call. These are read-only diagnostics; they cannot be set to influence behavior. Examples include:

  • rtp_audio_in_raw_bytes, rtp_audio_in_media_bytes, rtp_audio_in_packet_count, rtp_audio_in_media_packet_count - inbound audio stream counters.
  • rtp_audio_out_raw_bytes, rtp_audio_out_media_bytes, rtp_audio_out_packet_count - outbound audio stream counters.
  • rtp_audio_in_skip_packet_count, rtp_audio_in_jitter_packet_count, rtp_audio_in_dtmf_packet_count - quality indicators for the inbound stream.
  • rtp_use_codec_string - the codec string that was actually selected and in use for RTP, as opposed to what was offered.

These variables are written by switch_rtp.c and switch_core_media.c and are available for CDR templates and post-call reporting via api_hangup_hook or api_reporting_hook.


RTP and RTCP Tuning

Set before media is established, these tune RTP/RTCP transport, SSRC, payload types, and bug workarounds.

VariablePurpose
rtcp_audio_interval_msecRTCP sender-report interval (ms) for the audio stream; enables RTCP when set.
rtcp_video_interval_msecRTCP sender-report interval (ms) for the video stream; enables RTCP when set.
rtcp_text_interval_msecRTCP interval (ms) for the real-time text (T.140) stream.
rtcp_muxWhen false, disables RTCP multiplexing on the RTP port (rtcp-mux is otherwise offered).
rtp_assume_rtcpWhen true, assumes/auto-detects RTCP for audio and video even when not signaled.
rtp_remote_audio_rtcp_portOverrides the remote RTCP port for the audio stream.
rtp_remote_video_rtcp_portOverrides the remote RTCP port for the video stream.
rtp_remote_text_rtcp_portOverrides the remote RTCP port for the text stream.
rtp_auto_adjust_thresholdConsecutive packets (1–65535) from a new source before RTP auto-adjust re-points the send address.
rtp_autoflushWhen true, enables the RTP autoflush flag so buffered inbound audio is flushed.
rtp_autoflush_during_bridgeOverrides whether RTP autoflush is active while bridged.
rtp_rewrite_timestampsWhen true, regenerates contiguous outbound RTP timestamps.
rtp_timer_nameSelects the soft-timer used for the RTP session, overriding the profile default.
rtp_use_ssrcForces a specific audio RTP SSRC (decimal).
rtp_use_video_ssrcForces a specific video RTP SSRC (decimal).
rtp_use_text_ssrcForces a specific text RTP SSRC (decimal).
rtp_nack_buffer_sizeVideo NACK retransmission buffer size in packets (1–499; default 100) when NACK is enabled.
rtp_2833_send_payloadForces the outbound RFC 2833 (telephone-event) DTMF payload type (must be >64 in the Sofia path).
rtp_2833_recv_payloadForces the inbound RFC 2833 DTMF payload type (must be >64 in the Sofia path).
rtp_info_when_no_2833When not false (default true), if no telephone-event is in the SDP, DTMF switches to SIP INFO.
rtp_liberal_dtmfWhen true, accepts DTMF more permissively (liberal-DTMF flag).
rtp_manual_rtp_bugsManually sets the audio RTP bug-workaround bitmask (bug-name list).
rtp_manual_video_rtp_bugsManually sets the video RTP bug-workaround list.
rtp_manual_text_rtp_bugsManually sets the text RTP bug-workaround list.

Jitter Buffer and Bridge Timing

VariablePurpose
rtp_jitter_buffer_during_bridgeWhen true, keeps the jitter buffer active during a bridge (paused by default).
rtp_notimer_during_bridgeOverrides whether the RTP soft-timer is disabled while bridged.
jb_av_sync_msecTarget audio/video sync offset (ms) for the jitter buffer.
jb_use_timestampsWhen true, the jitter buffer orders by RTP timestamps instead of sequence numbers.
jb_video_low_bitrateLow-bitrate threshold (kbps) governing video jitter-buffer behavior.

Codec, fmtp, and Bandwidth Forcing

VariablePurpose
rtp_codec_negotiationCodec-negotiation strategy: generous, greedy, or scrooge (invalid values ignored).
rtp_force_audio_fmtpOverrides the fmtp attribute emitted for the audio codec in the local SDP.
rtp_force_video_fmtpOverrides the fmtp attribute emitted for the video codec in the local SDP.
rtp_mirror_fmtpWhen true (and no forced fmtp), mirrors the configured video fmtp into the outbound SDP.
rtp_append_audio_sdpAppends raw text to the generated audio m= section of the local SDP.
rtp_append_video_sdpAppends raw text to the generated video m= section of the local SDP.
rtp_disable_byteswapWhen true, disables automatic L16 byte-swapping on little-endian hosts.
rtp_video_max_bandwidthMaximum video bandwidth (e.g. 1mb/256kb; default 1mb); falls back to rtp_video_max_bandwidth_out.
rtp_video_max_bandwidth_inMaximum inbound video bandwidth advertised/applied for the video stream.
rtp_video_max_bandwidth_outMaximum outbound video bandwidth for the video encoder.

SRTP, DTLS, and Secure Media

VariablePurpose
rtp_use_dtlsWhen true, forces DTLS-SRTP on the audio engine even without AVPF.
rtp_dtls_mtuDTLS handshake MTU in bytes (1 to max; default 1200).
rtp_allow_crypto_in_avpWhen true, accepts a=crypto offered under RTP/AVP (instead of RTP/SAVP), contrary to RFC 3711.
srtp_allow_idle_gapsWhen true, allows idle/silence gaps in the SRTP stream rather than forcing continuous send.
webrtc_enable_dtlsWhen explicitly false, disables DTLS for WebRTC media.
uuid_media_secure_mediaSecure-media (SRTP) setting applied when re-establishing media via uuid_media.
media_webrtcWhen true, treats the media session as WebRTC (enables WebRTC media defaults).
NDLB_support_asterisk_missing_srtp_authWhen true, tolerates Asterisk peers that omit SRTP auth parameters.

Bypass and Proxy Media

VariablePurpose
bypass_keep_codecWhen true, copies the current ep_codec_string to absolute_codec_string on entering bypass/proxy media to preserve the negotiated codec.
bypass_media_resume_on_holdWhen true, gates bypass_media_after_hold so bypass-media behavior is re-evaluated on (un)hold.
bypass_media_after_holdWhen true (with bypass_media_resume_on_hold), attempts to leave the media path after a hold/unhold.
bypass_media_after_bridge_oldschoolWhen true, uses the legacy code path for switching to bypass media after a bridge.
bypass_media_sdp_filterSDP filter expression applied to the bypassed/proxied SDP before it is relayed to the other leg.

Voice Activity, Fax Tone, and Misc Media

VariablePurpose
rtp_enable_vad_inWhen true, enables inbound voice-activity detection.
rtp_enable_vad_outWhen true, enables outbound voice-activity detection.
rtp_disable_vad_inWhen true, disables inbound voice-activity detection.
rtp_disable_vad_outWhen true, disables outbound voice-activity detection.
vad_threshVAD energy threshold for the vad detector.
vad_voice_msMinimum voice duration (ms) before the VAD detector declares speech.
suppress_cngWhen true, suppresses generation/use of comfort noise (CNG).
rtp_disable_holdWhen true, disables hold handling (suppresses sendonly/hold toggling) for the channel.
fax_tone_detect_expiresExpiry time (seconds) for inband fax (CNG/CED) tone detection.
fax_tone_detect_sleepQuiet interval (seconds) between fax tone-detection attempts.
v18_modeSelects V.18 TDD/text-telephone mode (e.g. 5BIT_45/baudot, 5BIT_50, DTMF, EDT, BELL103/ascii).
core_video_blank_imagePath to an image used as the blank/placeholder video frame.
stream_prebufferPrebuffer size (bytes) applied when opening a streaming file for playback.
media_reneg_after_broadcastControls media renegotiation after a broadcast (displace) ends.

Recording

These variables control the behavior of the record_session application and the record application. Variable names that are uppercase by convention must be set with the exact case shown.

VariablePurpose
RECORD_STEREOWhen true, records the A-leg audio to the left channel and the B-leg audio to the right channel of a stereo file. Default: false.
RECORD_STEREO_SWAPWhen true, reverses the channel assignment of RECORD_STEREO: B-leg goes to the left channel and A-leg to the right.
RECORD_READ_ONLYWhen true, only the read (incoming) audio is written to the recording file.
RECORD_WRITE_ONLYWhen true, only the write (outgoing) audio is written to the recording file.
record_sample_rateInteger sample rate (Hz) to use for the recording file. Example: 8000, 16000, 48000.
RECORD_MIN_SECMinimum recording duration in seconds. Recordings shorter than this value are deleted after the session ends. Default: 3.
RECORD_HANGUP_ON_ERRORWhen true, the call is terminated if the recording file cannot be opened or written.
RECORD_APPENDWhen true, audio is appended to an existing recording file rather than overwriting it.
RECORD_BRIDGE_REQWhen true, recording only begins when the channel enters a bridged state.
RECORD_TITLEID3-style title tag written into the recording file header where the format supports it (e.g., WAV, OGG).
RECORD_COPYRIGHTID3-style copyright tag written into the recording file header.
RECORD_SOFTWAREID3-style software tag written into the recording file header.
RECORD_ARTISTID3-style artist tag written into the recording file header.
RECORD_COMMENTID3-style comment tag written into the recording file header.
RECORD_DATEID3-style date tag written into the recording file header.
record_fill_cngWhen true, comfort noise is inserted into the recording during periods of silence to prevent the file from containing dead air.
recording_follow_transferWhen true, an active record_session recording continues after the channel is transferred to a new leg, following the call rather than stopping at transfer.
record_post_process_exec_appDialplan application to execute after a recording completes. Format: app_name::app_args. Defined in switch_types.h as SWITCH_RECORD_POST_PROCESS_EXEC_APP_VARIABLE.
record_post_process_exec_apiAPI command to execute after a recording completes. Defined in switch_types.h as SWITCH_RECORD_POST_PROCESS_EXEC_API_VARIABLE.

Additional Recording Controls

VariablePurpose
record_rateSample rate (Hz) for the record application's output file.
record_indicationPath to an indication/comfort file played into the recording read stream.
recording_follow_attxferWhen true, an active recording follows the leg through an attended transfer.
flip_record_on_holdWhen true, swaps the recording channels when the call is placed on hold.
RECORD_TOGGLE_ON_REPEATWhen true, a repeated record DTMF binding toggles recording instead of restarting it.
native_backup_extensionFallback file extension for the backup file in native-format playback/record (default wav).
failed_xml_cdr_prefixVariable-name prefix for XML CDR data attached to failed origination legs.
failed_json_cdr_prefixVariable-name prefix for JSON CDR data attached to failed origination legs.

Hangup and CDR

These variables are populated at hangup time and are commonly read in CDR templates and post-call dialplan logic.

VariablePurpose
hangup_causeQ.850 cause name string for the hangup of this channel (e.g., NORMAL_CLEARING, USER_BUSY). Set by the core state machine at hangup time. Available for CDR processing and in api_hangup_hook logic.
hangup_cause_q850Numeric Q.850 cause code corresponding to hangup_cause. Set alongside hangup_cause in switch_core_state_machine.c.
bridge_hangup_causeQ.850 cause name for the last B-leg that was bridged on this channel. Set by the core when a bridge terminates. Useful when continue_on_fail=true and hangup_after_bridge=false: inspect this to determine what caused the B-leg to disconnect before deciding the next dialplan action.
last_bridge_hangup_causeSet on the A-leg by the core (switch_channel.c) to the cause of the most recently terminated B-leg. Useful after multiple sequential bridge attempts.
proto_specific_hangup_causeForces FreeSWITCH to use a specific SIP response code when hanging up, regardless of the Q.850 cause. Format: sip:NNN (e.g., sip:503). Setting this before hangup causes mod_sofia to send the specified code. Can also be read after a failed bridge to inspect the exact SIP response code received from the remote party.
sip_hangup_dispositionSet by mod_sofia to describe how the SIP session was terminated. Possible values: send_bye (FreeSWITCH sent BYE), recv_bye (remote party sent BYE), send_cancel (FreeSWITCH cancelled an unanswered outbound leg), recv_cancel (remote party cancelled), send_refuse (FreeSWITCH rejected with 4xx/5xx), recv_refuse (remote party rejected with 4xx/5xx). Read-only; set at hangup.
process_cdrControls CDR generation for this channel. Values: true (default, process CDR), false (suppress CDR), a_only (only generate CDR for the A-leg), b_only (only generate CDR for the B-leg). Unconditionally exported. Corresponds to SWITCH_PROCESS_CDR_VARIABLE.
skip_cdr_causesComma-separated list of Q.850 cause names. If the channel hangs up with one of these causes, CDR generation is suppressed. Corresponds to SWITCH_SKIP_CDR_CAUSES_VARIABLE.
force_process_cdrWhen true, forces CDR processing even for channels that would normally be excluded (e.g., loopback legs). Corresponds to SWITCH_FORCE_PROCESS_CDR_VARIABLE.
copy_xml_cdrWhen true, the A-leg XML CDR is copied to the B-leg at bridge time. Used to associate the CDR data of the originating leg with the bridged leg. Corresponds to SWITCH_COPY_XML_CDR_VARIABLE.
copy_json_cdrWhen true, the A-leg JSON CDR is copied to the B-leg at bridge time. Functions like copy_xml_cdr but for the JSON CDR format. Corresponds to SWITCH_COPY_JSON_CDR_VARIABLE.
accountcodeArbitrary account code attached to the channel. Used by CDR modules: if the value matches a template name in cdr_csv.conf.xml, that template is used for CSV CDR generation.

Session UUIDs

These variables implement RFC 7989 (Session-ID) tracking and other UUID-based session identification. They are managed by the core and are typically read-only in the dialplan.

VariablePurpose
session_uuidThe RFC 7989 Session-ID for this call leg. Generated by the core and exchanged with the remote party via the Session-ID SIP header. Persists across transfers and bridges to provide end-to-end call correlation. Corresponds to SWITCH_RFC7989_SESSION_ID_VARIABLE.
remote_session_uuidThe RFC 7989 Session-ID received from the remote party. Populated by mod_sofia when the remote includes a Session-ID header. Corresponds to SWITCH_RFC7989_REMOTE_SESSION_ID_VARIABLE.
app_session_uuidApplication-layer session UUID, distinct from the RFC 7989 signaling UUID. Used when an application creates its own session correlation context. Corresponds to SWITCH_RFC7989_APP_SESSION_ID_VARIABLE.
generic_param_session_uuidCarries a session UUID passed as a generic SIP parameter rather than as a dedicated Session-ID header. Used in interoperability scenarios where the Session-ID header is not supported. Corresponds to SWITCH_RFC7989_GENERIC_PARAM_VARIABLE.

Application Execution and CDR

These variables control per-channel application logging and speech handle caching.

VariablePurpose
disable_app_logWhen true, the core does not log application execution records for this channel (switch_core_session.c). Reduces log verbosity for high-volume automated channels. Corresponds to SWITCH_DISABLE_APP_LOG_VARIABLE.
current_applicationSet by the core to the name of the dialplan application currently executing on this channel. Read-only; updated in switch_core_session.c before each application runs. Corresponds to SWITCH_CURRENT_APPLICATION_VARIABLE.
current_application_dataSet by the core to the argument string of the currently executing application. Read-only; updated alongside current_application. Corresponds to SWITCH_CURRENT_APPLICATION_DATA_VARIABLE.
current_application_responseSet by some applications to a string describing the outcome of their execution (e.g., SUCCESS, TIMEOUT, FAILURE). Available after the application returns. Corresponds to SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE.
read_resultSet by the read application after it completes. Values: success (digits collected), timeout (no input within timeout), failure (channel error). Corresponds to SWITCH_READ_RESULT_VARIABLE.
read_terminator_usedSet by the read application to the terminator digit that stopped collection, or empty if the digit count was reached without a terminator. Corresponds to SWITCH_READ_TERMINATOR_USED_VARIABLE.
cache_speech_handlesWhen true, ASR/TTS engine handles opened during detect_speech or TTS playback are cached across multiple calls rather than torn down and reopened each time. Reduces latency for repeated speech operations. Corresponds to SWITCH_CACHE_SPEECH_HANDLES_VARIABLE.

Playback, TTS, and Application Controls

These tune playback, speak/TTS, and assorted dialplan applications.

VariablePurpose
tts_engineDefault TTS engine used by speak/playback when none is specified.
tts_voiceDefault TTS voice used by speak/playback when none is specified.
playback_timeout_secPer-file playback timeout in seconds.
playback_timeout_sec_cumulativeCumulative playback timeout in seconds across files.
playback_timeout_as_successWhen true, a playback timeout is treated as success rather than failure.
playback_delimiterDelimiter character separating multiple files in a playback string.
playback_sleep_valSleep (ms) inserted between files when using playback_delimiter.
app_disable_expand_variablesWhen true, disables ${var} expansion in application argument strings.
ivr_menu_terminatorTerminator digit for IVR menu digit collection.
DISPLACE_HANGUP_ON_ERRORControls whether displace_session hangs up the channel on error.
hangup_after_conferenceWhen false, the channel is not hung up after leaving a conference (default hangs up).
outcall_flagsConference flags applied to legs dialed out via conference dial.
valet_ticketTicket/slot identifier used by mod_valet_parking.
python_script_pathExtra path appended to the Python module search path for mod_python3.
mutex_timeoutTimeout (seconds) a channel waits to acquire a mutex.
mutex_feedbackAudio/file (or silence) played to a channel waiting on a mutex.
mutex_orbit_extenExtension to send a waiting mutex channel to on timeout (sets a default 60s timeout).
mutex_orbit_contextDialplan context for the mutex orbit on timeout.
mutex_orbit_dialplanDialplan engine for the mutex orbit on timeout.

DTMF

These variables control DTMF handling for a channel.

VariablePurpose
dtmf_typeSets the DTMF signaling method for outbound legs. Accepted values: rfc2833 (in-band RTP telephone-event), info (SIP INFO messages), none (no DTMF). When not set, the negotiated method from the SDP is used. FreeSWITCH reads and writes this variable in switch_core_media.c. For inband detection, start_dtmf must also be applied in the dialplan.
drop_dtmfWhen true, DTMF events received on the channel are discarded and not forwarded to the bridged party. Set on an inbound channel before answer, or on an outbound channel before bridge. Verified against RFC 4733 (in-band). May also work with SIP INFO and inband. Defined in switch_core_io.c.
drop_dtmf_masking_digitsWhen drop_dtmf=true, this string specifies a replacement digit sequence to write into the audio stream where DTMF tones would have been, masking the tones rather than leaving silence.
drop_dtmf_masking_fileWhen drop_dtmf=true, path to an audio file to splice into the audio stream to mask dropped DTMF tones.
sensitive_dtmfWhen true, DTMF events are not logged in the application log. Useful for channels handling PIN entry. Corresponds to SWITCH_SENSITIVE_DTMF_VARIABLE.

DTMF Binding and Tone Detection

VariablePurpose
bind_meta_keyDTMF digit used as the meta/trigger key for bind_meta_app (default *).
bind_digit_digit_timeoutInter-digit timeout (ms) for the bind_digit_action dmachine (default 1500).
bind_digit_input_timeoutOverall input timeout (ms) for the bind_digit_action dmachine.
bda_terminatorsTerminator digits for the dmachine created by bind_digit_action.
asr_intercept_dtmfWhen true, DTMF detected by the ASR engine is intercepted/queued rather than passed through.
pass_rfc2833When true, passes RFC 2833 (telephone-event) DTMF through transparently.
digits_dialed_filterRegex; matching dialed digits are masked in the digits_dialed history.
sleep_eat_digitsWhen true, the sleep application consumes DTMF received during the sleep.
min_dup_digit_spacing_msMinimum spacing (ms) before a duplicate inband DTMF digit is accepted.
dtmf_verboseWhen true, enables verbose logging of detected inband DTMF.
pound_replaceDigit string that replaces # in say/spell playback.
star_replaceDigit string that replaces * in say/spell playback.
tone_detect_expiresExpiry time (seconds) for a tone_detect detector.
tone_detect_hitsNumber of hits required before tone_detect fires.
tone_detect_sleepQuiet interval (seconds) between tone_detect evaluations.

Directory and Account

These variables are typically set in user directory XML entries and are loaded onto the channel when a user authenticates.

VariablePurpose
user_contextThe dialplan context to use when routing calls originating from this user. Set in the directory <variable> block. Example: default.
toll_allowComma-separated list of calling class names (e.g., local,domestic,international) granted to this user. The dialplan tests this variable against condition expressions to implement class-of-service routing.
vm-passwordVoicemail PIN for this user. Set as a directory <param> (not a <variable>). Read by mod_voicemail during mailbox authentication.

Execution Hooks

These variables trigger dialplan applications or API commands automatically at defined call lifecycle points.

VariablePurpose
execute_on_answerDialplan application to execute when the called party answers. Use export nolocal:execute_on_answer=app args to target the B-leg. The application runs only on channels not yet in the answered state.
execute_on_pre_answerDialplan application to execute when the channel enters pre-answer (early media) state.
execute_on_mediaDialplan application to execute when media is established on the channel.
execute_on_ringDialplan application to execute when the channel begins ringing.
execute_on_originateDialplan application to execute immediately after an originate succeeds (B-leg answered). Corresponds to SWITCH_CHANNEL_EXECUTE_ON_ORIGINATE_VARIABLE.
execute_on_pre_originateDialplan application to execute before origination begins. Corresponds to SWITCH_CHANNEL_EXECUTE_ON_PRE_ORIGINATE_VARIABLE.
execute_on_post_originateDialplan application to execute after origination is fully complete. Corresponds to SWITCH_CHANNEL_EXECUTE_ON_POST_ORIGINATE_VARIABLE.
execute_on_pre_bridgeDialplan application to execute immediately before a bridge is established.
execute_on_post_bridgeDialplan application to execute immediately after a bridge completes.
execute_on_tone_detectDialplan application to execute when a tone is detected by the tone_detect application. Corresponds to SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE.
api_on_answerAPI command to execute when the called party answers. Use export nolocal:api_on_answer=command args to target the B-leg. To execute a dialplan application instead, use execute_on_answer.
api_on_pre_answerAPI command to execute when the channel enters pre-answer state.
api_on_mediaAPI command to execute when media is established on the channel.
api_on_ringAPI command to execute when the channel begins ringing.
api_on_originateAPI command to execute after an originate succeeds. Corresponds to SWITCH_CHANNEL_API_ON_ORIGINATE_VARIABLE.
api_on_pre_originateAPI command to execute before origination begins. Corresponds to SWITCH_CHANNEL_API_ON_PRE_ORIGINATE_VARIABLE.
api_on_post_originateAPI command to execute after origination is fully complete. Corresponds to SWITCH_CHANNEL_API_ON_POST_ORIGINATE_VARIABLE.
api_on_tone_detectAPI command to execute when a tone is detected by the tone_detect application. Corresponds to SWITCH_CHANNEL_API_ON_TONE_DETECT_VARIABLE.
api_before_bridgeAPI command to execute immediately before a bridge is established. Corresponds to SWITCH_API_BRIDGE_START_VARIABLE.
api_after_bridgeAPI command to execute after a bridge completes.
api_hangup_hookAPI command to execute when the channel hangs up.
api_reporting_hookAPI command to execute when the channel reaches the reporting state (post-hangup CDR phase). Corresponds to SWITCH_API_REPORTING_HOOK_VARIABLE.
session_in_hangup_hookWhen true, the session remains available during api_hangup_hook execution, allowing the API command to access channel variables. Corresponds to SWITCH_SESSION_IN_HANGUP_HOOK_VARIABLE.

Event and Logging Hooks

VariablePurpose
fire_talk_eventsWhen true, fires "talking" events from RTP VAD.
fire_not_talk_eventsWhen true, fires "not talking" events from RTP VAD.
fire_asr_eventsWhen true, fires ASR detection events to the event system.
verbose_presenceWhen true, enables verbose presence event generation for the session.
heartbeat_fire_on_setWhen true, fires a session heartbeat event immediately when the heartbeat is (re)set.
heartbeat_use_schedulerWhen true, drives the session heartbeat via the scheduler instead of inline.
session_copy_loglevelWhen true, copies the session log level to a newly originated child session.
log_audio_stats_on_hangupWhen true, logs RTP audio statistics on hangup.
hangup_complete_with_xmlWhen true, includes the channel XML CDR in hangup-complete handling.

Module Reference Variables

Variables introduced by the optional modules documented in Part 9: Module Reference. Each module page carries the authoritative table (what sets the variable, what reads it, and accepted values); the index below maps each variable to its module so it can be found from here. Generic core variables that these modules merely read (such as caller_id_number, destination_number, language, or the directory variables) are documented in the sections above and are not repeated here.

ModuleVariablesReference
mod_avmdavmd_detect, avmd_total_time, execute_on_avmd_beepmod_avmd
mod_bertbert_window_ms, bert_timeout_ms, bert_max_err, bert_hangup_on_error, bert_debug_io_file, bert_timer_name, bert_stats_sync_lost, bert_stats_sync_lost_countmod_bert
mod_cidlookuporiginal_caller_id_name, cidlookup_source, cidlookup_areamod_cidlookup
mod_curlcurl_response_data, curl_response_code, curl_method, curl_connect_timeout, curl_timeout, curl_sendfile_url, curl_sendfile_filename_element, curl_sendfile_filename, curl_sendfile_extrapost, curl_sendfile_report, curl_sendfile_identifiermod_curl
mod_cvexecute_on_cv_detect_primary, execute_on_cv_detect_off_primary, execute_on_cv_detect_nested, execute_on_cv_detect_off_nestedmod_cv
mod_directorydirectory_group_selection, directory_voicemail_profile, directory_search_ordermod_directory
mod_distributorDISTRIBUTORmod_distributor
mod_easyrouteeasy_destnum, easy_dialstring, easy_group, easy_limit, easy_acctcodemod_easyroute
mod_fskfsk_phone_num, fsk_phone_name, fsk_datetime, fsk_uri, execute_on_fsk, fsk_simplify_profile, fsk_simplify_contextmod_fsk
mod_lcrintrastate, intralata, lrn, max_rate, lcr_auto_route, lcr_route_count, lcr_route_N, lcr_rate_N, lcr_carrier_N, lcr_codec_N, lcr_carrier, lcr_rate, lcr_user_rate, lcr_rate_field, lcr_user_rate_field, lcr_query_digits, lcr_query_profile, lcr_query_expanded_digits, lcr_query_expanded_lrn_digits, lcr_lrnmod_lcr
mod_nibblebillnibble_rate, nibble_account, nibble_increment, nibble_rounding, nibble_minimum, nobal_amt, lowbal_amt, nibble_bill, nibble_total_billed, nibble_current_balancemod_nibblebill
mod_osposp_source_device, osp_source_nid, osp_custom_info_1 … osp_custom_info_8, osp_networkid_userparam, osp_networkid_uriparam, osp_outstring_userparam, osp_outstring_uriparam, osp_user_phone, osp_outbound_proxy, osp_profile_name, osp_transaction_handle, osp_transaction_id, osp_lookup_status, osp_next_status, osp_route_total, osp_route_count, osp_auto_route, osp_termination_causemod_osp
mod_translatetranslated, translate_profile, country, default_country, areacode, default_areacodemod_translate
mod_vmdvmd_detect, vmd_min_timemod_vmd
mod_voicemail_ivrvoicemail_authorizedmod_voicemail_ivr
mod_h323progress-indication, alerting-indication, fax_enable_t38_insistmod_h323
mod_opalhas_t38, opal_execute_on_t38, opal_api_on_t38mod_opal
mod_vlcvlc_force_width, vlc_force_height, vlc_capture_offset, vlc_interval, vlc_rate, vlc_channelsmod_vlc
mod_webmwebmv2_video_offsetmod_webm
mod_smppsmpp_gateway, smpp_from_user, smpp_to_usermod_smpp
mod_format_cdrformat_cdr_base, force_process_cdrmod_format_cdr
mod_json_cdrjson_cdr_base, force_process_cdrmod_json_cdr
mod_odbc_cdrodbc-cdr-ignore-legmod_odbc_cdr
mod_hiredishiredis_raw_response, hiredis_limit_exceededmod_hiredis