-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SCCP rules sorting based on ID #249
Comments
Hello @faizann
|
Hi @vetss The change is significant in functionality but is not a lot of code lines. I didn't delete the code but just commented out the older rules. You can see at this line I am only comparing IDs and returning that as the result of comparator. I also commented out all the tests. |
My reasoning for change is that there is already a bug in my previous PR where we sort based on callingParty if calledParty addresses are same. That was a flawed logic as that still doesn't give proper sorting when comparing a rule which has callingParty but a different calledParty. Hence that randomness is highly dangerous and I realised that it gets complicated to keep track of sorting. ID based rules sorting gives a very clear view of what gets matched first and then has a natural fall through process. |
Hello @faizann
I was asking for the case "Also there is a bug in callingDigits rule sorting in case where there are 2 rules with same calledDigits but 1 of them has callingDigits and there are 1 or more rules with only calledDigits.". I do not possibly still understand what is a bug in current implementation. If you see it please clarify more, better in soce update suggestion.
Please describe more what you see dangerous (may be examples). I am asking because just changing of behavior will affect current customers and there must be a big reason to do it. We need to care in this case of backward compatibility when old configs will be auto converted into a new style (possibly with proper ID changing) + manual update announsing. |
Hi @vetss The problem with current sorting algorithm with both calling/called party is this. The sorting goes like this Of course we cannot just move to RuleID based sorting. I think we can allow the type of ordering based on a specific flag in SCCP general settings where users can pick legacy or new RuleID based ordering. I can submit that code if you agree. For me RuleID based sorting was very helpful and solved a lot of headaches. |
Hello @faizann thanks for a detailed problem description.
like replace:
with
?
|
Hello @faizann after internal discussion I think that it is better "to introduce a Factory to load Rule algorithms, by default it would be shipped with the current RuleAlgorithm and config but you could add a new RuleAlgorithm to be able to make a better version of rule ordering and matching thus keeping backward compatibility but allowing new customers to move to the new rule ordering, once it is stable we can declare the previous one deprecated and remove it 1 or 2 major versions later." So we agree for a possibility of both algos implementation with old algo by default. @faizann please let me know if it is good for you. Can you please also comment my comment for brinning to a liveness of the old algo ("1)" in my previous message). |
Hi @vetss This is a very good idea indeed. I will work on a PR to get rule sorting based on your comments and test it. Thanks |
… cases rule sorting was wrong. Added RuleComparatorById to allow sorting of rules by ID. RuleComparator can be set using jboss-beans between legacy rulecomparator or rulecomparatorById
…rule sorting based on digits+wildcards is there. A bug where callingParty based rulesorting was giving wrong sorting order is fixed. New rulesorting algorithm based on RULE IDs is available and can be configured to use via jboss-beans.xml
Currently SCCP rules are sorted based on calledDigits and callingDigits patterns. This gets confusing to know which rule is checked first while rule matching. The GUI displays rules sorted based on ID.
It is better to sort the rules internally for matching based on RuleID as well. This will make it cleaner.
Also there is a bug in callingDigits rule sorting in case where there are 2 rules with same calledDigits but 1 of them has callingDigits and there are 1 or more rules with only calledDigits.
The comparison between calledDigits rules can in some cases put the callingDigits rule below in the order and hence doesn't get matched. A fix is this but still it is better that we just simplify and use RuleIDs for sorting.
The text was updated successfully, but these errors were encountered: