The first step is to setup individual dahdi lines for that card. So going in Trunk setup and make a Dahdi Trunk, give it a name e.g. dahdi1, and in the Dahdi identifier just put the number 1, like wise with the next line e.g. dahdi2, and in the identifier put the number 2. Please note here that I am assuming that the ports you are using for the two lines are port 1 and port 2, if you have them in 3 and 4, naturally you need to change the numbers above.
Now you have setup separate dahdi trunk lines...
The next step is optional, especially if all your outbound calls are going out via the SIP Trunks. But if you want to use your PSTN lines for outbound, in your outbound routes, instead of just referencing Dahdi/G0 as your trunk for outgoing, you would now have e.g.
Trunk 1 : dahdi1
Trunk 2 : dahdi2
The critical step which you need to implement so that your system can determine which line the call come in on is by going into the PBX menu and select ZAP Channel DIDs
You will see a some entries. To setup line 1 (port 1), you would enter
Channel : 1 {this correlates to the dahdi number you setup in the trunks}
Description : Johns Line {whatever description you want)
DID : 0244922993 {this does not have to be the line number it is just number}
and do the same for Channel : 2
Channel : 2 {this correlates to the dahdi number you setup in the trunks}
Description : Johns Line {whatever description you want)
DID : 0244922999 {this does not have to be the line number it is just number}
Now I mentioned that the DID does not have to match the line phone number, as it is just a reference number, but why complicate things, and makes it easier sorting out issues, so use the exact phone number of the line that is in port 1.
Now in the inbound routes, you can now enter a DID (which are the DID's you setup in ZAP Channel DIDs).
So in the inbound routes, you setup DID : 0244922993 / CID {leave empty} and at the end destination 1000
and the same again for the other DID you setup DID : 0244922999 / CID {leave empty} and at the end destination 8999
Now one final thing, you need to manually edit a file called
/etc/asterisk/dahdi-channels.conf
in under each port, you will see that the context=from-pstn, this needs to be changed to context=from-dahdi (context used to be from-zaptel and this still works as well).
Once you have made this change, reboot, and try it...