I have an existing outbound route in FreePBX. When I dial 811, it gets routed to a standard 10-digit phone number. FreePBX has built a plan for that in extensions_additional.conf.
I would like to add an extra command that gets executed when I dial 811. If I put the command in extensions_custom.conf under [from-internal-custom], and have asterisk reload the dialplan, it always seems to replace one of the existing commands in extensions_additional.conf.
So, for example, if the command that I add to extensions_custom.conf is:
exten => 811,1,System(…)
Then the number 1 entry in in extensions_additional.conf will be replaced with the new entry when I dial 811.
If I change my new entry in extensions_custom.conf so that it uses an “n” instead of 1, I get the same result, except the 7th entry in extensions_additional.conf is omitted (in this case Set(_NODEST=).
Can anyone tell me what I need to do to simply add an additional command in extensions_custom.conf without causing Asterisk to omit anything that’s in the existing dialplan in extension_additional.conf?
If your goal is to define the extension 811 twice in two different locations then I feel like you’re doing something wrong. Choose what you want to do when you dial 811, and define it once.
To answer the question as asked, this is the simplest way:
[from-internal-adhominem]
; define custom destination with dial string
; from-internal-adhominem,s,1
; and Misc Application of 811 pointing to custom dest
exten => s,1,…
exten => s,n,…
exten => s,n,…
The intermediate level, while slightly more complex, is preferred as the GUI will prevent you from creating an extension of 811 if it’s already in use for something else.
I wouldn’t describe this as my goal. Rather, I’m merely asking a question.
Is it possible to have FreePBX define a dialplan for “811” in extensions_additional.conf, and to add (without replacing) an additional line to that dialplan in extensions_custom.conf?
Asterisk starts with the base config , in this case
/etc/asterisk/extensions.conf
and includes in place any “#include” 'd file accepting the last , the end result is a sum of all “last setting wins” , so if an extension is defined but later redifined, the last one wiins
As @dicko said, you can modify FreePBX generated contexts by editing the custom/override file(s) but it’s easier said than done. In cases where it’s possible I still don’t recommend it, as your changes may turn out to have unintended consequences when the generated contexts change with module updates, or just normal config changes. If you need to inject your own dialplan in normal call flow, the supported method is to use a hook: Hooking for fun and income