Instead of using one of the dialplan hooks, in this case, it’s better to create a Custom Destination to set the hangup hander. So the call flow would go something like:
Inbound Route → Custom Destination → Conference
With custom dialplan like:
[mahbell-sethh]
exten => s,1,Noop(Entering user defined context mahbell-sethh in extensions_custom.conf)
exten => s,n,Set(CHANNEL(hangup_handler_push)=mahbell-do-this-on-hangup,s,1)
exten => s,n,Return
[mahbell-do-this-on-hangup]
exten => s,1,Noop(Entering user defined context mahbell-do-this-on-hangup in extensions_custom.conf)
; additional lines
exten => s,n,Return
For the custom dest you would use a Gosub line of mahbell-sethh,s,1
, enable the return option and set the destination for the caller after setting the HH.