How to add action on call to custom extension in FreePBX

In FreePBX, add the following config to /etc/asterisk/extensions_custom.conf in order to add a custom extension 999 that just plays Hello world when called:

[from-internal-additional-custom]
exten => 999,1,Answer()
exten => 999,n,Wait(1)
exten => 999,n,Playback(hello-world)
exten => 999,n,Wait(1)
exten => 999,n,Hangup()

Don’t forget to reload Asterisk e.g. using the core reload command from the Administrator menu => Asterisk CLI in order for the changes to take effect.

How the dialplan routing works

Note that we have added this in the [from-internal-additional-custom] context, which is included at the beginning of the [from-internal-additional] context by FreePBX in extensions_additional.conf:

[from-internal-additional]
include => from-internal-additional-custom

The [from-internal-additional] context in turn is included in [from-internal]In other words, our custom extension999 will be active for all phones calling from the[from-internal] context - which is, by default, all internal extensions.