How to capture the DID from a T1/PRI channel


I am almost sure someone already answered this but could not find it…
I need to find out within a dial plan the number that was dialed.
For example, suppose a DID number 954 123-4567 is dialed and is channeled to the asterisk via the T1,
I need to capture this number that was dialed. I know it is coded within the T1 time slots, how can I get it within Asterisk dial-plan.


little confused on what you wan to do here but if the T1 is passin the DID to you then just go to the context that your T1 goes to and list the DID,s there here is how some of mine look

exten => 7311110008,1,Goto(cpatel,s,1)
exten => 7311110009,1,Goto(jansutton,s,1)
exten => 7311110010,1,GoTo(floyd,s,1)
exten => 7311110011,1,GoTo(matts,s,1)
exten => 7311110012,1,GoTo(hqin,s,1)


The DID should be in the T1, I just was not sure if the T1 driver knows how to extract it.