I always thought the inbound DID table looked at the whole table and then went with the best match, but I had once run into a Magix where I used route 0 for expect 4, delete 1, which routed to extensions that were 3-digit (the DID's ended in 5200-5250). I used route 1 for expect 4, digits to match 4222, delete 4, add 7112 (or whatever the fax extension was). When calling 4222 it always routed to x222 (which existed for DID 5222). I moved the table 1 to 0 and vice versa and it fixed the issue. So logically, it appeared like it looked at table 0 first, then table 1. Having the general catch all at table 0 caused it to route 4222 and 5222 to x222. Once I put route 0 with 4222 and route 1 as the general catch all, that routed the fax properly and 5222 to 222.
I've installed many Magix over the years and this was the first time I had ever run into that issue. I always use route 0 as the main catch all, so I know that isn't the way it normally works. For some reason though, this Magix looked at the routes in order.