Summary:ASTERISK-18271: Pattern matching with res_config_mysql extensions does not behave as expected
Reporter:Charlie Smurthwaite (catphish)Labels:
Date Opened:2011-08-14 08:03:17Date Closed:2017-02-22 12:09:48.000-0600
Versions: Frequency of
Description:When using RealTime extensions from MySQL with res_config_mysql and overlapping pattern extensions, selection of an extension does not work as expected. Test case:

Extensions in mysql with appropriate context:

Dialed number: 8001

Expected behaviour:
_800. matches number because it is the most explicit match

Actual behaviour:
_80. matches number because it is the first matching extension in the mysql resultset (query is ordered by extension)
Comments:By: Charlie Smurthwaite (catphish) 2011-09-05 03:43:32.785-0500

I am currently using the following very blunt hack to work around this:

\[Edit:\] [~mjordan]

Removed inline patch. Patches have to be attached and/or put up for code review after signing a contributor license agreement.

By: Gregory Hinton Nietsky (irroot) 2011-09-05 04:09:59.238-0500

This seems like a logical approach to what you wanting to do however there should not be multiple extensions in the dialplan so yes it works but do not see it been accepted into the code base.

By: snuffy (snuffy) 2011-09-24 22:05:52.967-0500

Does the same thing occur when using say res_config_odbc?

Is it possible for you to try?

By: Matt Jordan (mjordan) 2015-09-22 10:44:43.551-0500

Relevant conversation from #asterisk:

<catphish> i'm sad this has never been accepted, i have to keep this as a local patch: https://issues.asterisk.org/jira/browse/ASTERISK-18271
* darkbasic (~quassel@niko.linuxsystems.it) has joined #asterisk
* darkbasic_ has quit (Ping timeout: 250 seconds)
<mjordan> catphish: no one put it up for review, or attached it as a valid patch.
<mjordan> The fact that someone did it inline is actually quite bad, as there's no CLA for inline patches. Which means I now have to go remove it.
* cyford (~support@c-73-137-1-6.hsd1.ga.comcast.net) has joined #asterisk
<mjordan> Particularly since res_config_mysql is a community supported module.
<mjordan> So... yeah.

I'm going to put the relevant instructions for participating in a peer review on this issue. If someone would like to submit a patch for this issue that fixes it, that'd be greatly appreciated. Thanks!

By: Matt Jordan (mjordan) 2015-09-22 10:44:58.280-0500

Thanks for the contribution! If you'd like your contribution to be included faster, you should submit your patch for code review by the Asterisk Developer Community. To do so, please follow the Code Review [1] instructions on the wiki. Be sure to:
* Verify that your patch conforms to the Coding Guidelines [2]
* Review the Code Review Checklist [3] for common items reviewers will look for
* If necessary, provide tests for the Asterisk Test Suite that verify the correctness of your patch [4]

When ready, submit your patch and any tests to Review Board [5] for code review.


[1] https://wiki.asterisk.org/wiki/display/AST/Code+Review
[2] https://wiki.asterisk.org/wiki/display/AST/Coding+Guidelines
[3] https://wiki.asterisk.org/wiki/display/AST/Code+Review+Checklist
[4] https://wiki.asterisk.org/wiki/display/AST/Asterisk+Test+Suite+Documentation
[5] https://wiki.asterisk.org/wiki/display/AST/Review+Board+Usage

By: Friendly Automation (friendly-automation) 2017-02-22 12:09:49.084-0600

Change 5049 merged by zuul:
pbx_realtime: Prevent premature extension matching


By: Friendly Automation (friendly-automation) 2017-02-22 12:09:51.705-0600

Change 5061 merged by zuul:
pbx_realtime: Prevent premature extension matching


By: Friendly Automation (friendly-automation) 2017-02-22 12:09:54.424-0600

Change 5060 merged by zuul:
pbx_realtime: Prevent premature extension matching