[asterisk-dev] extensions.conf included contexts priorities

Steve Murphy murf at parsetree.com
Wed Apr 25 08:47:00 MST 2007

On Wed, 2007-04-25 at 10:37 -0400, Leif Madsen wrote:
> On Tuesday 24 April 2007 20:26:25 Jared Smith wrote:
> > On 4/24/07, Steve Murphy <murf at parsetree.com> wrote:
> > > Trouble is, is this desired behavior? Or is having the contexts checked
> > > level by level until a match of any kind is found, the better procedure?
> >
> > Well, I for one desire the current behavior.  Everyone else can speak
> > for themselves, but it makes it easy to override an extension included
> > in a more-deeply-nested extension by putting its replacement in a
> > less-deeply-nested context.  If they were all pulled together into one
> > big ball of wax, we'd lose a lot of functionality.
> I also agree here. If you change this functionality, people who depend upon it 
> might come find you and do not such nice things to you :)

Well, I certainly wouldn't **that** to happen!!! OK, I'm totally sold on
keeping current functionality.

For the moment...

I do propose that we make the following change to the
extensions.conf.sample file to minimize user
misunderstanding/frustration over include directives.... the reason this
thread began...

Do you think this might help? Is the English proper?

Index: configs/extensions.conf.sample
--- configs/extensions.conf.sample      (revision 61639)
+++ configs/extensions.conf.sample      (working copy)
@@ -140,15 +140,31 @@
 ; Contexts contain several lines, one for each step of each
 ; extension, which can take one of two forms as listed below,
-; with the first form being preferred.  One may include another
-; context in the current one as well, optionally with a
-; date and time.  Included contexts are included in the order
-; they are listed.
+; with the first form being preferred. 
 ;exten => someexten,{priority|
 ;exten => someexten,{priority|
+; One may include another context in the current one as well,
optionally with a
+; date and time.  Included contexts are included in the order
+; they are listed.
+; The reason a context would include other contexts is for their
+; The algorithm to find an extension is recursive, and works in this
+; fashion: 
+;    a) Try to find a matching extension in the current context
+;       and, if found, begin executing the priorities there in
+;    b) If not found, Search the switches, if any declared, in
+;    c) If still not found, for each include, make that context the
+;       context, and recurse to a).
+; This is a depth-first traversal, and stops with the first context
+; provides a match. As usual, if more than one pattern in a context
will match,
+; the 'best' match will win.
+; Please note that in a context, it does not matter where an include
+; occurs. Whether at the top, or near the bottom, the effect will be
the same.
+; The only thing that matters is that if there is more than one include
+; they will be searched for extensions in order, first to last.
 ; Timing list for includes is 
 ;   <time range>|<days of week>|<days of month>|<months>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3239 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-dev/attachments/20070425/2844c2a2/smime-0001.bin

More information about the asterisk-dev mailing list