FreeSWITCH – Hanging up a call with some cause info

Whenever I reject a call, or hang it up, I like to provide some extra info in the response to help explain why the server made the decision, so anyone looking at the traces will understand.

In FreeSWITCH we’ve only got a finite list of Hangup Causes which we can use with the hangup application.

So you try to pick the most appropriate hangup cause code for your scenario, but it’s not always clear to the other party why you’re hanging up the call.

What we can do is include a SIP header to explain it, X-Dbg or X-Reason or something similar, to provide some context.

<action application="set" data="sip_rh_X-Reason=Source IP not Whitelisted"/>
<action application="hangup" data="INCOMING_CALL_BARRED"/>

The sip_rh_ (SIP Response headers) variable is used to set the headers in the SIP response to reject the call.

By including this before the calling the hangup application, FreeSWITCH will add those headers when sending the hangup.

Leave a Reply

Your email address will not be published. Required fields are marked *