Priorities when an include => is present

Hay all

I am not sure how to explain this so I will try. I noticed that some contexts have an

include => extenstions-custom.conf

ext => whatever,1,play(beep) whatever

What I want to know is how does asterisk handle the include. Will it go to the include file execute that if it can then return and execute what is below that. Or does it execute the the context then goes to the include file???

Anyone know the priority of how files are read? Some files I see have a couple includes so it would be nice to know how asterisk runs or how the code is flowing so I can make decisions of where and how to put custom files into this.

there are two types of includes in asterisk

include => some-context

other one is

#include ‘filename.conf’

The first one is used to include contexts and second is used to include config files. However a point to note is either you include context or files they them selves contain complete contexts defined in there, so its not like a you include some file or context at a particular priority, When ever dialplan parser sees these includes it goes to the pointed location (context or file) reads its contents and appends it to the dialplan tree.

When dialed extension doesn’t match any thing in the current context it goes and searches in the included contexts.

Godson Gera
Asterisk Consultant India Hyderabad

Thank you for the answer. I think priority was the wrong word. You did answer my question though. It looks at the current dial plan context and if there is nothing for the call to do there then it moves to the include. I guess I assumed that when it said to include => that it would pass the call to that then come back to the rest of the context.

What does the #include do? or how would it work if I put it in a context?


as I said in my previous post.

include => is for including contexts defined in the same config file. And this include only works in extensions.conf in other words for dialplans

#include is for including contexts defined in some other config file you can use this in any asterisk configuration file. Like in sip.conf if you want to defined peers and friends in separate files you can do the following

#include "sippeers.conf
#include “sipfriends.conf”

Godson Gera
Asterisk Support Services India