You are going in the right direction. The way to go is with the DAHDI channel DID module. You should set each port that is currently connected to an analog line (there is no need to create a DID for a port that is not connected). The channel reference is in fact the port, each channel corresponds to a port. The idea is to assign a different DID to each port if what you are trying to accomplish is to always direct incoming calls on a specific line to a specific destination. What is usually done is to assign the line number that corresponds to that line, but this is just for ease of read, you can assign any number that you want. One thing to consider is that if you have several analog lines on a hunt group from the provider, you will have incoming calls on a port that is not necesary the one that the dialed number belongs to.
For example, let's say you have 3 lines:
Line 1, port 1, phone number (212)234-5678
Line 2, port 2, phone number (212)345-6789
Line 3, port 3, phone number (212)456-7890
You can use the phone number as the DID and then create inbound trunks using the DIDs that you created to direct the calls from a specific port into a specific destination.
If the lines are in a hunt group from your provider, a caller may dial 234-5678, which is port 1, but the call might arrive on port 2 or port 3, if port 1 is currently being used. This is important if what you want is to have an incoming call directed to a specific destination based on the number dialed by the caller, as a hunt group has a 1:N relation, instead of a 1:1 relation of lines not in a hunt group.
If you want to direct the calls based on the incoming port, no matter whether the dialed number corresponds to that port or not (as can happen on lines that are part of a hunt group), then you don't have to worry about the hunt group, even though that use case might seem a little strange.