[Home]

Summary:ASTERISK-05991: option to disable sorting in extensions.conf
Reporter:Dan Hollis (bani)Labels:
Date Opened:2006-01-28 15:44:08.000-0600Date Closed:2011-06-07 14:10:49
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:i often find myself fighting against asterisk's sorting of extensions.conf rules.

an option to disable sorting and just process rules in the order i put them in the conf file, first to last, would be excellent.

[general]
sort=no

please? :)
Comments:By: opsys (opsys) 2006-01-28 21:55:57.000-0600

Can you expand on this a little? Can you please provide an example of sorted rules vs. un-sorted rules and what effect the have???

By: Dan Hollis (bani) 2006-01-28 22:21:20.000-0600

do something like

[context]
exten => s,1,Answer
exten => s,n,Blabla-for-noextension

exten => _X1,1,Answer
exten => _X1,n,Blabla-for-X1

exten => _XXX3,1,Answer
exten => _XXX3,n,Blabla-for-XXX3

exten => _X.,1,Answer
exten => _X.,n,Blabla-for-fallthrough

This doesnt work, because _X. gets sorted before _X1,_XXX3, so it always matches. this is undesirable.

other * users have also mentioned they do not like this behavior and would appreciate an option to turn it off.

By: Jason Parker (jparker) 2006-01-28 23:05:13.000-0600

It isn't that it gets "sorted" to hit first.  The "issue" (which is a non-issue IMHO) is that asterisk will wait (for very good reason) for a pattern to match completely, and for it to be the ONLY pattern that matches.

By: Dan Hollis (bani) 2006-01-29 01:30:41.000-0600

sorry north, i believe you are wrong here :)

[context]
exten => s,1,Answer
exten => s,n,Blabla-for-noextension

exten => _X1,1,Answer
exten => _X1,n,Blabla-for-X1

exten => _XXX3,1,Answer
exten => _XXX3,n,Blabla-for-XXX3

include => crapola

[crapola]
exten => _X.,1,Answer
exten => _X.,n,Blabla-for-fallthrough

makes this work perfectly, as intended. without the include, the _X. is hit first always. with the include, it is matched last, yet the other extensions work as intended.

'show dialplan context' demonstrates that the _X. misbehaves with the default asterisk sorting, but behaves as intended with the include, and proves conclusively it is a sorting issue.

this is an ugly workaround though, and an option like 'sort=no' in [general] would make this a lot simpler.

there are other web references to this problem, i'm not the only person who's noticed it. it is non obvious behavior and can be confusing, and the workaround is messy.

By: Jason Parker (jparker) 2006-01-29 02:13:13.000-0600

In this example (and your previous one), if you were to dial 3333, it would wait for a timeout, because there isn't an exact match yet.

Now, if you're talking about a technology that sends it over as a whole...sure, sorting could matter.  You were unclear on this in your first example.

By: Tilghman Lesher (tilghman) 2006-02-05 11:03:43.000-0600

This is not something which can be done with a simple fix.  There is a LOT of logic that depends upon the extensions sorting as they do now.

Given that this is a feature request, I would encourage you to place it on the Wiki, as that is the proper forum for feature requests.  If you expect to see this anytime soon, you might also consider posting a bounty for it.  Again, the Wiki is the appropriate forum for that.