File structure?

I have a question on how I can better organize my .conf files.

I have 3 different groups of people who use my VoIP service. Let’s call them ‘Office’, ‘Factory’ and ‘Public’. In my Asterisk directory, I have created three folders: ‘office’, ‘factory’ and ‘public’, inside each of which has a sip.conf and an extensions.conf file with appropriate account and extension information.

Say, for example, I need to limit some users of the ‘Public’ group so they cannot make calls outside the building. Obviously I would create two separate contexts. One for users who can make calls outside the build, and one for users who cannot. I would then assign the appropriate context to each user.

Right now, I have each appropriate context defined in the main extensions.conf. What I’d like to do is reduce the clutter in extensions.conf and move each context into the extensions.conf in the appropriate subfolder. How do I tell the main extensions.conf file to include the other extensions.conf files without putting an #include in a context of its own?

I hope what I’ve explained makes sense. If not, please ask questions and I’ll try to answer.

Thanks much,
Jay

the include directive is nothing other than an “insert” for whatever is in the include file.

so if i have a list of extensions in an include file

exten => 101... exten => 102... exten => 103...

and include them somewhere, they go under whatever context the include statement is in. so, if the above “file” is called extensions.include and i do like so:

[internal]
#include “extensions.include”

then those three extensions will be in the internal context.

however, if the include file has a context (or several) in it

[restrictedaccess] exten => 101... exten => 102... exten => 103... [fullaccess] exten => 104... exten => 105... exten => 106...

then including it is basically inserting an entire context into the dialplan.

for your situation, it sounds like you want to do the following:

[internal]
include => local ; local dialing pattern
include => longdistance ; long distance dialing pattern
include => toll-free ; toll free dialing pattern
#include “office/extensions.include”
#include “factory/extensions.include”
#include “public/extensions.include” ; to allow for internal dialing across all divisions

[restricted]
#include “office/extensions.include”
#include “factory/extensions.include”
#include “public/extensions.include”

then, in your sip.conf (or the subfiles, which you would just include in the main sip.conf), you would define the context for each device based on it’s location…so for your public devices, they get to go to the restricted context, everyone else gets the internal context.

sorry this is so long, but i think that the include features are one of the best ways to granularize your dialplan and keep everything organized, just like you are doing…