Set verbose level in asterisk to at least three. Dial in to one of your DID’s, then look in the log file to see in what format the DID was received (if it actually was received). Put that in your Inbound Route.
How are your DID’s connected to your PBX? SIP, DAHDI or Zaptel?
Depending on how your DIDs were ordered they may come into the switch in various formats, usually either 4- or 10-digit numerals, no spaces or hyphens, and usually (but not always) if they’re four digits the digits will be the same as the last four of the actual DID.
In any case they need to look the same way in Incoming Routes.
After upping the verbose and checking the logs as Mikael suggested, I saw that the DID wasn’t being sent. Then I went to my provider and it appeared that DNIS wasn’t enabled. After enabling DNIS, everything works fine.