Question about Includes

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

Thank you,

Lee

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.

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… :wink:

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 !

Perfect! Thank you both for your excellent answers.

Lee

very nice explanation!

:laughing: