Passing CID and DID on forwarded calls


I have an Asterisk Box (lets call it the main box) and a second Asterisk box with a PRI connected (lets call it the PRI box). They are in two seperate locations and all extensions are on the main box.

I am looking at forwarding all calls which currently come in on the PRI to the Main Asterisk box, at no point will there be extensions on the PRI box, it is there to forward all calls.

The current configuration i have is a SIP extension(1000) on the PRI box which the main box is registered to. All calls are passed to this extension but when the call reaches the main box i have no CID or DID details which i need to route the call. What is the best way of doing this? I am using Asterisk 1.4.25.

Many thanks for any help.

For DNID, it is just a matter of using a wildcard match:

exten => _X.,1,Dial(SIP/trunk/${EXTEN})

For CLI, you need to check for any options that may be set that override the CLI or force it to be ignored.

Thanks for that, worked perfect.