Hangup Handlers

Can anyone confirm whether FreePBX 2.11 supports using Hangup Handlers?

Just round out this thread, the answer is yes. Thanks to some helpful advice on another forum, I confirmed it works.


Reposting here in case the other thread goes away (all credit to lgaetz). Here’s a quick and dirty test that “… Leverag(es) the predefined context in FreePBX that executes on every outbound call, ‘macro-dialout-trunk-predial-hook’ … In the file, /etc/asterisk/extensions_custom.conf”

[macro-dialout-trunk-predial-hook] ; check to ensure this context doesn't already exist before adding exten => s,1,Set(CHANNEL(hangup_handler_push)=hangup-handler,s,1)

exten => s,1,NoOp(This line will appear in the log AFTER every outgoing call hangs up)
exten => s,n,Return() ;this line is required for all hangup handlers

Reload the dial plan, and now on every outgoing call, this line gets logged:
– Executing [[email protected]:1] NoOp(“SIP/103-0000016b”, “This line will appear in the log AFTER every outgoing call hangs up”) in new stack

You can add a hangup handler anywhere in the call flow process with no regard to what context the call eventually ends up in. Multiple hangup handlers can be added, and you can modify/delete handlers after adding them.