[asterisk-dev] extension.conf and dialplan sort logic

Paul Cadach paul at odt.east.telecom.kz
Sun Apr 9 19:26:38 MST 2006


Hi,

Anton wrote:
> Just discovered that extension logic of Asterisk is
> different than in most other applications in telephony
> world, so Asterisk is sorting extensions in a manner of
> shortest-first

As I understand Asterisk sorts extensions just in alphabetical order. '_' sign is less than any other digit so "soft"
matches always comes AFTER exact matches.

> so _. will have higher priority than _123.
> Though it's manageable by splitting contextes, but it makes
> creation of dialplan less comfortable, you always need to
> create more contexts.

There should be sorting naming "best match", where longer matching expression should have higher priority. For example,
_123. should be less than _123[1-3]., but last one should be greater than _123N. (becuase _123[1-3]. defines extension
more exact than _123N.), which is not true for current design ('.' is less than '[' in alphabet and less than 'N').

I think changing of extensions sorting method should not break existing applications, just because currently people have
"work-arounds" to make sorting work correct.


Implementation of weighted "prefix-match" is not so complex but for expressions like _.NNN. it's more non-trivial task.


WBR,
Paul.




More information about the asterisk-dev mailing list