Who says that these DIDs are even assigned to the caller? Virtually all wholesale termination (the fancy word for handling outbound calls) allows for the caller to set the calling party ID to whatever the caller desires. The reason for this (among a few) basically boils down to multihoming (so, example, I use a different provider for termination than for origination (receiving calls)). This is a perfectly legitimate and very common to effect least cost routing.
In any event, if you are able to determine that the number is actually in use by the caller, you would determine the responsible LEC via LRN lookup (this handles portability issues). DID blocks are tied to a particular LEC, but the DID is then handled for portability via LRN (so, this is how you determine which LEC the number got ported to).