Skip to content



Hangup an incoming PJSIP channel with a SIP response code


Hangs up an incoming PJSIP channel and returns the specified SIP response code in the final response to the caller.


This function must be called BEFORE anything that might cause any other final (non 1XX) response to be sent. For example calling 'Answer()' or 'Playback' without the 'noanswer' option will cause the call to be answered and a final 200 response to be sent.

As with the 'Hangup' application, the dialplan will terminate after calling this function.

The cause code set on the channel will be translated to a standard ISDN cause code using the table defined in ast_sip_hangup_sip2cause() in res_pjsip.c

Example: Terminate call with 437 response code
same = n,PJSIPHangup(437)
Example: Terminate call with 437 response code using the response code name
Example: Terminate call with 437 response code based on condition
same = n,ExecIf($[${SOMEVALUE} = ${SOME_BAD_VALUE}]?PJSIPHangup(437))


  • Cause - May be one of...

    • Response code - A numeric response code in the range 400 ->699

    • Response code name - A response code name from 'third-party/pjproject/source/pjsip/include/pjsip/sip_msg.h' such as 'USE_IDENTITY_HEADER' or 'PJSIP_SC_USE_IDENTITY_HEADER'

Generated Version

This documentation was generated from Asterisk branch 20 using version GIT