Execute dialplan action after each channel hangs up

I know how to do this on straight Asterisk dial plans, but how do I accomplish this on a freepbx system? I’m not sure what custom file and context to use to catch each channel when it closes to grab its QoS information and store it in a file. I am doing this on a custom asterisk system as a modified cdr string to the database under the ‘h’ extension, but on a production freepbx I will need to use the custom files and I can’t use the cdr record as that will mess up the report modules. Basically after each call I want to write the QoS info for those channels to a text file (basically writing the QpS channel variables) like a second cdr record that will not interfere with the freepbx cdr record already in place. Thanks! - Jeremy

See the section re: custom action on hangup: Hooking for fun and income

1 Like

Awesome, thanks! That should do nicely!

1 Like

Sort of worked… I cannot get “macro-dialout-one-predial-hook” to be called. I watched the log and it is never called. I used “macro-dialout-trunk-predial-hook” and that one worked, at least for trunk calls. Any idea why “macro-dialout-one-predial-hook” is not called? Thanks!

There are several predial hooks for internal calls, and it depends on the ring strategy one uses to reach the extension. A framework I’ve used in the past to catch all of them looks like this:

[macro-dialout-one-predial-hook]
exten => s,1,GoSub(custom-internal-dialplan,s,1)
exten => s,n,MacroExit
 
[macro-dialout-dundi-predial-hook]
exten => s,1,GoSub(custom-internal-dialplan,s,1)
exten => s,n,MacroExit
 
[macro-dial-ringall-predial-hook]
exten => s,1,GoSub(custom-internal-dialplan,s,1)
exten => s,n,MacroExit
 
[macro-dial-hunt-predial-hook]
exten => s,1,GoSub(custom-internal-dialplan,s,1)
exten => s,n,MacroExit

[custom-internal-dialplan]
exten => s,1,NoOp(Entering user defined context...)
exten => s,n,Return

Add your lines to the custom-internal-dialplan context and they will apply to all cases.

Thanks, but unfortunately none of those are ever called. The only one called is “dialout-trunk-predial-hook”. If I do a tail of the log and grep “hook” or “custom”, that is the only one that shows up. It’s PBX version 14.0.13.12, Asterisk version 13.22.0 System Version 12.7.6-1904-1.sng7 (it is a PBXact, is this blocked on a PBXact?) Thanks!

There is an advanced setting for custom includes. Try tweaking that.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.