DID coming in SIP trunk routed out another SIP trunk

We have a DID coming in on a SIP trunk and I need to auto-route it to another PBX through another SIP trunk… Is this possible?

The system says extension doesn’t exist. Any work arounds? Kinda new to asterisk, so detail would help…

We are using Asterisk 1.6.0.6 with Asterisk GUI 2.0 running on CentOS 5.2

Thanks in advance.

Dan

Yes, this is possible, here are snippets from the extensions.conf and sip.conf of our main pbx and a from a test server, the main pbx forward a call for a specific DID to the test server, through a sip trunk (a sip friend defined in sip.conf) called vvcc (the test server):

extensions.conf, main pbx (inbound_context is the context for the inbound calls coming from our SIP/E1 gateway, defined in sip.conf as a sip friend):

[inbound_context]
exten=>0099001122,1,Dial(SIP/vvcc/${EXTEN})

sip.conf, main pbx:

[vvcc]
type=friend
host=192.168.100.33
port=5061
context=vvcc_out
insecure=port,invite
disallow=all
allow=ulaw
qualify=yes
dtmfmode=rfc2833

extensions.conf, test server:

[inbound]
exten=>0099001122,1,Answer
exten=>0099001122,2,Playback(test)
exten=>0099001122,3,Hangup

sip.conf, test server:

[main_pbx]
type=friend
context=inbound
host=192.168.100.12
insecure=port,invite
disallow=all
allow=alaw,ulaw
qualify=yes
dtmfmode=rfc2833
canreinvite=no

Hope it helps you.

Cheers.

Marco Bruni
www.marcobruni.net