Call Us Today! 877.742.2583

Page tree
Skip to end of metadata
Go to start of metadata


Emmanuel Schmidbauer created a simple Lua script that sends a replacement cause code to Leg A instead of the cause code received from Leg B.


 Click here to expand Table of Contents

Cause Code Substitution Script

Invoke the following Lua script in a parameter to a bridge command similar to the following example line:

<action application="set" data="execute_on_post_originate=lua process_480.lua ${uuid}"/>
<action application="bridge" data="sofia/internal/"/>


-- process_480.lua
-- check for response code and send different one back
uuid = argv[1];
api = freeswitch.API();
sip_invite_failure_status = api:executeString("uuid_getvar "..uuid.." sip_invite_failure_status");
if sip_invite_failure_status == "480" then
    reply = api:executeString("uuid_setvar "..uuid.." last_bridge_proto_specific_hangup_cause sip:503");


This example demonstrates how to send cause code 503 to the Leg A after Leg B returns a cause code 480. You can expand on this for more cause codes or even look up the translation in a database.