[asterisk-dev] A project idea for a journeyman Asterisk developer

Mark Michelson mmichelson at digium.com
Mon Jun 15 16:11:14 CDT 2009


Hi list,

Before Asterisk 1.6.0 was released, Steve Murphy did quite a bit of work to
create a new method of executing the pattern-matching for extensions in the
dialplan.

The biggest change he made was to change the structure used to store extensions
from a linked list to a "trie." The use of this storage method means that the
running time for looking up an extension is no longer bounded by the number of
extensions in the dialplan but rather by the length of extensions in the
dialplan. For installations with hundreds or thousands of extensions, this
change means a remarkable improvement in lookup speed.

The 'extenpatternmatchnew' option debuted in Asterisk 1.6.0, but it was disabled
by default. It was disabled because it hadn't gone through all the tweaking and
testing that the old pattern-matching had been through and possibly due to the
knowledge of unfixed bugs.

Since then, there have been several fixes to extenpatternmatchnew to improve its
pattern-matching accuracy. I think it has reached a point where we should take
the next logical step and consider making extenpatternmatchnew the standard.

I think this can be accomplished through the following steps:

1. Write a module for the tests/ directory which can take a sample dialplan and
sample input, and tell which extension in the dialplan was matched given the input.

2. Test many inputs against many dialplans, making sure that the new pattern
matching algorithm results in the same pattern being matched by the old
algorithm. Community-submitted dialplans would be great for this because you can
test against patterns you may not have thought of yourself.

3. If (2) results in bugs being found, submit issue reports and get the problems
fixed. When the bugs are fixed, re-run all the tests from (2) to be sure there
are no regressions from the bug fixes.

4. Once it is determined that the new algorithm is matching the same patterns as
the old, then change the default option in extensions.conf.sample for
extenpatternmatchnew and change the default setting for it in the code. Commit
the change.

At this point, extenpatternmatchnew will be enabled by default for future
versions of Asterisk. However, since all that testing was done to determine that
the new pattern matching algorithm matches just as accurately as the old one,
there's really no reason to keep the old code around.

5. Remove all code dealing with the old pattern-matching method. Remove the
extenpatternmatchnew option since it now is the standard.

6. Re-run all the tests in 2, fixing any regressions found.

7. Commit the code changes.

Now for the catch. Even though I am presenting this project to the mailing list
and laying out the steps necessary to get the project done, I just don't have
the time to dedicate myself to this task. The difficulty of this project is such
that it can't really be called a "janitor project" but it's small enough that I
don't think you'd necessarily have to be an Asterisk development guru to finish
it successfully.

If there are interested parties, speak up! This is a good opportunity for you to
get more involved in Asterisk's development.

Mark Michelson



More information about the asterisk-dev mailing list