Skip to main content


Created by Ryan Harris, last modified on 2018.02.07


string This variable will cause FreeSWITCH to force the SIP response code to a specific setting when hanging up a call. The example below is one where all possible extensions have been tested and failed and you want FreeSWITCH to generate and respond with a specific code. (This is not a passthrough example).

By the way, you'll be unable to rewrite the hangup cause for a bridge that gets a 180 or 183 packet from the gateway before getting a 4xx, 5xx or 6xx packet (because those bridges don't 'fail'). This happens with SIP providers that give a 183 Session Progress before a 404 Not Found if the PSTN number dialed doesn't exist.


<extension name="nothing_left" continue="true">
<condition break="always">
<action application="set" data="proto_specific_hangup_cause=sip:503"/>
<action application="hangup"/>

Example SIP Response Map

<extension name="from_gw_to_internal">
<condition field="destination_number" expression="^(.*)$">
<action application="set" data="hangup_after_bridge=true"/>
<action application="set" data="continue_on_fail=19"/>
<action application="bridge" data="{sip_cid_type=none}sofia/gateway/gw/$1"/>
<action application="transfer" data="480to503"/>

<extension name="480to503">
<condition field="${proto_specific_hangup_cause}" expression="sip:480">
<action application="set" data="sip_ignore_remote_cause=true"/>
<action application="respond" data="503"/>
<action application="hangup" data="NORMAL_CIRCUIT_CONGESTION"/>