Is order of #include statements in conf files important?

This relates to an issue that I am seeing with FreePbx writing conf files, and my workaround to fix, but the question relates to the order of #include statements when read by Asterisk when extending a context.

FreePbx appears to not add the outgoing_proxy parameter to the PJSIP conf files it writes. To address this, without messing with the FreePbx written pjsip.registration.conf file, I have included the parameter in pjsip.registration_custom.conf as follows:

[ATrunk](+) type=registration outbound_proxy=THEPROXYSERVER

with the intention of extending the registration context. However, in pjsip.registration.conf, the include statement added by FreePbx is before the context at the start of the file, and not after at the end.

#include pjsip.registration_custom.conf [ATrunk] type=registration transport=0.0.0.0-udp .......rest of context

In this situation, will the include work, or will it be ignored (i.e. to use the [context](+) form, does it have to be read after the context it extends, or does Asterisk manage this either way)?

Thanks

I believe it would need to be after or else it could try to add it to the wrong section (if another with the same name exists).

Thanks for your reply (you are, of course, correct!)

There appears to be a second related question here though - Asterisk does not appear to accept the extends context syntax in file includes.

[TrunkA](+) type=registration

If you use the freePbx file structure, and add additional user options in _custom_post.conf, it only works if you do NOT specify the context or type. For a single PJSIP line this is OK, as the additions are made to the preceding context, but I am not sure where Asterisk would put the option if there were two contexts (trunks)!

The old version that we use (1.6.1.0) certainly honours (+) in included files. Inclusion with #include is basically text operation and the parse is done on the result.