Dialplan hooks in extensions_custom.conf do not register with warning that the they cannot register with priority s,1 because they already exist (in extensions.conf)

I wanted to create a hook that runs after call ends in extensions_custom.conf with Config Edit Module like describe here:

How to run the script after the call ends?

But I run into exactly the same problem as the user of that linked thread no matter what hook I try I get a warning messages like this:

WARNING[24905] pbx.c: Unable to register extension 's' priority 1 in 'macro-dialout-one-predial-hook', already in use

So I grepped all config files in /etc/asterisk for ‘macro-dialout-one-predial-hook’ but the only 2 files I have found this is my extensions_custom.conf and extensions.conf. So I checked extensions.conf and it has for all hooks empty macros like this:

exten => s,1,MacroExit()

Obviously this is conflicting with extensions_custom.conf where I have:

exten => s,1,Noop(Entering user defined context macro-dialout-one-predial-hook in extensions_custom.conf)
exten => s,n,Set(CHANNEL(hangup_handler_push)=marc-do-this-on-hangup,s,1)
exten => s,n,MacroExit

exten => s,1,Noop(Entering user defined context marc-do-this-on-hangup in extensions_custom.conf)
; additional lines 
exten => s,n,Return

So the instructions given in https://community.freepbx.org/t/hooking-for-fun-and-income/57718/23 don’t seem to work anymore on recent releases of PBX Distro. Any ideas on how to solve this issue of conflicting dummy macros from extensions.conf with the ones from extensions_custom.conf?

FreePBX tends to generate code which does generate warnings. In the topic you reference, it is the fallback one that is being rejected. I suspect that is intentional and the warning should be ignored.

I would say that FreePBX is relying on undocumented, implementation details, in Asterisk.

@david55 is correct, the warning is unimportant. If you go to the asterisk console, you can confirm that the dialplan you’ve added is the one that’s active:

*CLI> dialplan show macro-dialout-one-predial-hook
[ Context 'macro-dialout-one-predial-hook' created by 'pbx_config' ]
  's' =>            1. Noop(Entering user defined context macro-dialout-one-predial-hook in extensions_custom.conf) [extensions_custom.conf:2]
                    2. Set(CHANNEL(hangup_handler_push)=marc-do-this-on-hangup,s,1) [extensions_custom.conf:3]
                    3. MacroExit()                                [extensions_custom.conf:4]

-= 1 extension (3 priorities) in 1 context. =-

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