[asterisk-dev] extension ordering
John Todd
jtodd at loligo.com
Sun Jan 22 18:45:51 MST 2006
>i noticed that the ordering of extensions in the
>internal lists is determined by a strcmp(), which means
>that if a string is a prefix of another,
>the prefix comes first.
>
>Is there a reason for this ? because it seems contrary
>to what is at least common practice in IP routing
>(longest prefix match first), and it would seem
>convenient to me that in a dialplan you have exceptions first
>and a general rule afterwards...
>
>(why i am asking here and not on -users ? because
>on -users i would ask for a workaround, whereas here
>i am asking the motivation of this design choice...)
>
>cheers
>luigi
>_______________________________________________
>--Bandwidth and Colocation provided by Easynews.com --
My reply will probably not make it to the -dev list, since my email
is STILL being filtered by Digium's mailing list provider. Feel free
to cc: the list on your replies.
The answer is: because phones expect to dial on the shortest match,
as the digits are keyed in. If you dial the emergency number here in
North America (911) then you expect to match on the shorter sequence.
Let's use this hypothetical example:
exten => _X11,1,Dial(Zap/g1/${EXTEN})
exten => _9114445555,1,Dial(Zap/g1/${EXTEN})
As the user dials "911", what tells the system that they are not
continuing to dial "4445555" after the digits? Only the timeout on
the digit sequence would indicate that the user is complete, but that
is NOT the expected behavior. Users expect that as soon as they are
finished dialing that the call is placed, not after a delay. Putting
the longer prefix match first become ambiguous without a a delay to
indicate "I am finished dialing."
Now, I will agree with you that this is problematic for the
programmer, and counter-intiutive. I rarely, if ever, use Asterisk
in a mode where each digit is matched. Almost all my calls are IP
based, so I get a "complete" dial sequence which is unambiguous.
However, I still have to put a dialplan into the phones, which is yet
another pain in the neck because the phones are really stupid and
have limited space for a dialplan...
However I see the logic for why it is currently done that way,
historically. Perhaps there should be some way to turn this behavior
off either globally or in a per-context basis (perhaps there already
is, and I'm just missing it!)
JT
More information about the asterisk-dev
mailing list