# Question about Includes

**URL:** <https://community.asterisk.org/t/question-about-includes/6492>\
**Category:** Asterisk Support\
**Created:** [May 18, 2006, 10:56pm UTC](https://community.asterisk.org/t/question-about-includes/6492 "2006-05-18T22:56:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lee\_is\_me](https://avatars.discourse-cdn.com/v4/letter/l/8e7dd6/32.png) [@lee\_is\_me](https://community.asterisk.org/u/lee_is_me)\
**Post date:** [May 18, 2006, 10:56pm UTC](https://community.asterisk.org/t/question-about-includes/6492/1 "2006-05-18T22:56:09Z")

</div>

For contextual incudes, does it matter where they are placed within another context? I’m trying to figure out precedence.

Thank you,

Lee

---

<div class="post-metadata">

**Author:** ![rrashid](https://avatars.discourse-cdn.com/v4/letter/r/45deac/32.png) [@rrashid](https://community.asterisk.org/u/rrashid)\
**Post date:** [May 19, 2006, 7:58am UTC](https://community.asterisk.org/t/question-about-includes/6492/2 "2006-05-19T07:58:52Z")

</div>

Absolutely. Asterisk flows thru your dial plan from top to bottom. It goes from one line to the next. Depending on what you have in the file that you are including it can or can not make a diffrence. The way to tell is to ask yourself if you actually pasted the info instead of using the include would it make a diffrence if it was here on this line or on the bottom of the context.

---

<div class="post-metadata">

**Author:** ![RichardHH](https://avatars.discourse-cdn.com/v4/letter/r/a4c791/32.png) [@RichardHH](https://community.asterisk.org/u/RichardHH)\
**Post date:** [May 19, 2006, 8:51am UTC](https://community.asterisk.org/t/question-about-includes/6492/3 "2006-05-19T08:51:55Z")

</div>

Hint:

Read your dialplan LINE for LINE to understand, how a call flows.  
Thats a very good way to SEE actually what happens.

Pay special attention to every “s” extension and to patterns.  
Most mistakes made by people are extensions or pattern catching a call already were they dont want a call to be catched…

Always keep in mind:

You CAN “macronize” all and everything with “loose” patternmatchings (i do that too), but if you want a special extension handled different, put that very extension ABOVE the extension which handles all calls globally.

Asterisk motto:  
First match wins !

Exception: Concurrent matches !  
Imagine this:

exten=\>5554433,1,Dial(SIP/Jane)  
exten=\>5554422,1,Dial(SIP/John)  
exten=\>5554411,1,Dial(SIP/mom)  
exten=\>55544335,1,Dial(SIP/dad)

You see?  
The 555-44-335  
and the  
555-44-33

are a concurrent match!  
If the caller dialed 555-44-33, asterisk doenst know if he is going to dial another “5” to get to “dad” - or if the caller has finished dialing cuz he wants to talk to “Jane” !

You can control this behaviour of asterisk:  
“overlapdialing=yes” in the global section of your extensions.conf

With “yes”, asterisk would start the so called “simple switch”, waiting another 4 seconds for a digit.  
When there is no additional digit dialed, asterisk is routing the call to the extension matching the EXACT number dialed.

Asterisk is repeating this simple switch (4 seconds) AS LONG AS THERE IS A CONCURRENCY STILL PRESENT.

As soon as the additional digits dont match more then one extension, the call gets signalled on that matchingt extension IMMEDIATLY.

This is a very nice way, to have thousands of extensions on your single phonenumber… 😉

The telco/provider is routing the call to you as soon as the “blockdial” matches your number (eg. 555-444-33) - but from then on, the control of the call is COMPLETELY yours - and no1 “forbids” you to attend this number by more digits “internally” with the above logic !

---

<div class="post-metadata">

**Author:** ![lee\_is\_me](https://avatars.discourse-cdn.com/v4/letter/l/8e7dd6/32.png) [@lee\_is\_me](https://community.asterisk.org/u/lee_is_me)\
**Post date:** [May 19, 2006, 2:32pm UTC](https://community.asterisk.org/t/question-about-includes/6492/4 "2006-05-19T14:32:36Z")

</div>

Perfect! Thank you both for your excellent answers.

Lee

---

<div class="post-metadata">

**Author:** ![buzuku](https://avatars.discourse-cdn.com/v4/letter/b/a87d85/32.png) [@buzuku](https://community.asterisk.org/u/buzuku)\
**Post date:** [June 22, 2007, 12:52pm UTC](https://community.asterisk.org/t/question-about-includes/6492/5 "2007-06-22T12:52:08Z")

</div>

very nice explanation!

---

<div class="post-metadata">

**Author:** ![buzuku](https://avatars.discourse-cdn.com/v4/letter/b/a87d85/32.png) [@buzuku](https://community.asterisk.org/u/buzuku)\
**Post date:** [June 23, 2007, 5:19pm UTC](https://community.asterisk.org/t/question-about-includes/6492/6 "2007-06-23T17:19:54Z")

</div>

😆
