Call hanging / rejecting

I want to hang up/reject call programmatically. How can I do that ? what is the function for the same ?

I know ast_answer is there for accepting incoming call.

You should be able to use Hangup() to hang up the call even before answering it.

is there anything like ast_hangup ?

what is the schema of hangup call ? I suppose I have to pass channel id right ?

Hi jkedar,

Could you give us an example or scenario I am trying understand what you need to achieve.

Basically two scenarios:

For an incoming call, If my logic tells me to reject call, I want to reject call.

For an established call, If my logic tells me to hang up call, I want to hang up call.

In order to hangup a call before it’s even answered, use the Hangup() command, or the SoftHangup() command…

That way, you can write your dialplan to figure out whether or not to answer the call, and if you DON’T want to accept the call, you use the Hangup() command, which will summarily drop the call (resulting in a “non-zero” status message). No worries about the non-zero status message, it does that anytime a call is forced to disconnect.