Overriding Contexts in freepbx

We often get people asking how to make changes extensions.conf without breaking next time they upgrade. This can be accomplished by understanding how asterisk processes contexts.

Asterisk will always register the first context it sees, and if it sees it again, it will ignore the context. The main extensions.conf includes extensions_custom.conf just after extensions_additional.conf and before any of its own dialplan.

What does that mean?

That means if you want to make your own changes, simply copy the entire context into extensions_custom.conf and make your changes there. This will completely override the one in extensions.conf and not get reverted when you upgrade. Since extensions_additional.conf comes before - you can’t overrid contexts there without changing the order of the includes which will get overwritten when you upgrade.

Beware - when making such changes, you should check after an upgrade that there were no changes made to the original context you overrode that you may care about. Also - over time, we will move more and more of core into extensions_additional.conf - but I will add an extensions_additional_override.conf into the main file as the first context to help those who really like to tweak things.