Hello,
in a IRD routing strategy, I need to know if an ANI starts with a prefix from a list of prefixes (I need to handle some groups of DNs differently). I want the list to be easily configurable, and I don't want to delegate that check to a service (stored procedure in database or web service).
My current approach is a List in Config-Server, like this:
[Prefixes]
00049123=1
00049456=2
000497789=3
In reality, there are more entries. I don't want to loop over all keys and check if any of them is a prefix of the ANI. That's quite tedious in IRD.
In my sample, I have prefixes with 8 and 9 digits, so my solution is to simply take the 1st 8 digits of the ANI and try to read a list entry. If it fails, I retry with 9 digits. In my production case, I need to try 3 lengths: 11, 12 and 13, for about 20 list entries. I made an assumption about the length values that can occur, and programmed just 3 checks.
But now my assumptions begin to fall apart, I am getting entries with 14 and 15 digits, too, so now I'd have to update my strategy and make 5 checks for every ANI. And sometime later, 10 or 16 digits might appear, and I need to update again. Worse - the list is not maintained by me, and I'm quite certain that those WHO maintain it will forget the length restrictions and then complain that their configuration fails.
Is there any builtin feature in URS that performs this type of check? I need to find the correct prefix, and I need the value that is associated to that prefix. The only remaining precondition is that I check ANIs, and that no entry in my list can be a prefix of another entry (keys like 00049123 and 000491234 would violate that and cannot happen).
Rolf