Cisco Unified Communications Manager uses closest-match logic to select the best pattern.
When multiple matching patterns are present, the best pattern is selected based on two factors:
It matches the dialed string.
AND
It matches the fewest strings including the dialed string.
For example, the call-routing table includes the patterns 1XXX, 12XX, 121X, and 1234.
When User A dials the string 1200, Cisco Unified Communications Manager compares it to the patterns in its call-routing table. In this case, there are two potentially matching patterns: 1XXX and 12XX. Both of these patterns match the dialed string, but 1XXX matches a total of 1000 strings (from 1000 to 1999), whereas 12XX matches only 100 strings (from 1200 to 1299).
Therefore, 12XX is selected as the destination of this call.
When User B dials the string 1212, there are three potentially matching patterns: 1XXX, 12XX, and 121X. As mentioned previously, 1XXX matches 1000 strings and 12XX matches 100 strings. However, 121X matches only 10 strings. Therefore, 121X is selected as the destination
of the call.
When User C dials the string 1234, there are three potentially matching patterns: 1XXX, 12XX, and 1234. As mentioned earlier, 1XXX matches 1000 strings and 12XX matches 100 strings.
However, 1234 matches only one string (the dialed string); therefore, 1234 is selected as the destination of this call.
Is it always the case?
Let's take another example:
The HQ-CUCM and BR-CUCM are configured with a SIP Trunk using the route list and route group.
Two routes pattern 15! and 1[3-5]XX are configured and pointed to the SIP Trunk as shown below.
1[3-5]XX matches 200 numbers, and 15! stands for unlimited possible numbers.
When dialing 1515, does the HQ-CUCM select the route pattern 1[3-5]XX because the best match?
Let's test how the HQ-CUCM routes the calls by dialing 1515.
From the HQ-CUCM Serviceability page, open the Dialed Number Analyzer, in the dialed string let's use 1515 as the dialed number.
Click in the Do Analysis button.
The output shown that the route pattern 15! is the best match and it's used to route the call through the SIP Trunk instead of the route pattern 1[3-5]XX.
The route pattern 1[3-5]XX is displayed as the Alternate Match.
15! Matches unlimited Digit Strings, but for the purposes of Closest Match Routing in this case, this matches 100 Digit Strings because you only consider the number of potential strings with the given number of digits dialed.