Connecting to asterisk together

hi everyone.
i work in a small office and our main telephny system is elastix.

it has it own WAN connection and the router only routes in connections that comes from out SIP Provider.

we would like to use the SIP in our mobile phones.
so i setup a freepbx server and created a trunk to the elastix.
the freepbx will contain extensional with really long passwords and only a few so it will secure to put the 5060 port to outside.

i created an outbound rule that goes from the freepbx to the main elastix and its working.
i can dial extensions from the freepbx and they will route to the elastix.
what i was unable to do is to dial outside from the freepbx using the elastix sip provider.

can someone please assist?

thanks.

The trunk on the Elastix box needs to be in the from-internal context to use outside routes. Make sure you have a matching outbound route in the Elastix.

but it opened up a new problems as well.
i would like my freepbx extension to recive inside calls from my sip provider CID’s.
the elastix is transmitting them to the Freepbx thats no problem. the problem is when i call from FreePBX to Elastix internal extension i see the outside CID that i define and not the internal extension number.

thanks