ANI is a billing number (and is usually provided by the originating Telco), and CPN (calling party number) is usually the 'caller ID' number. Some 'older' systems are capable of sending ANI, but not of sending CPN (i've seen this on some rural DMS-10 switches, and certain Alcatel switches.) So, there are really 'two' numbers that get sent with the call. For a residential or POTS customer, ANI and CPN are almost always the same. But for wireless or large business callers, the ANI is often the 'trunk billing number' and the CPN would be the users's DID number.
I suspect you're getting both DNIS and ANI (or some version of it). My 'plain T1' trunks are configured for *ani*DNIS*, so I got *2155551212*2100* from my carrier, and my equipment looks for the * between the groups. It uses the ANI as billing reference, and the DNIS (2100 above) as the 'routing' number/extension. When we switched carriers, the 'new' one was giving me the CPN instead of the ANI. Most of the time CPN is more 'useful', but it's a little less reliable as it is not always 'verified' by the carriers in between, but sometimes they are. I've seen calls were I get a 4 digit CPN or a 7 digit CPN, when I should always be getting 10 digits. (An ANI is always 10 digits, but the CPN can vary based on local customs.)
Does that help?