Complex implementation

I need some input from anyone who has deployed large scale Asterisk solutions. I have installed many large single site and multisite Asterisk systems but I am now presented with a unique challange.

Company has 5 sites. Primary site has 400 users, second site has 200 users and remaining sites have under 30. They want ALL phones to be controlled by single Asterisk server with a failover backup server. That part is easy… The problem comes with the MPLS bandwidth utilization. In cisco world, I can create regions and make audio codec rules based on transversing these regions. How do I do this in Asterisk? Contexts? Basically I want the 200 phones in the large remote site to be able to talk to other phones in the same site using g711ulaw. The rtp stream SHOULD go directly from phone to phone once the asterisk server initates the connection. Please clarify that asterisk does do this (I do not want the RTP stream coming to the server over the MPLS and back out to the destination phone - that would be pointless waste of bandwidth and in Cisco world once the call is established between the phones, the server drops out of the conversation). The calls coming from the large site to the main site for either access to voicemail or to access the outbound lines (outbound lines will be provided by CIsco 2900 gatewways with PRI trunks) should use g729. This could overload the server with DSP conversions (approxiamtely 50 concurrent calls from remote sites. I realize having a server in each location and just having internal context phones using g711 and the trunk between sites set to g729 would simplify this installation but we are trying to keep the servers all in the data center.

Lastly, is there a device, or a way to have the calls routed to offload the codec conversion to the Cisco 2900 DSPs? Can the phones register to the asterisk server but have rtp point to the Cisco or a media gateway to handle codec conversion in order to keep the asterisk server from having to bare the load of the DSP conversion?

I realize these are complicated questions and I do hope someone has some answers. I think custom contexts “could” do the trick but I don’t think the FreePBX overlay will make management of this simple. I do need to clarify that the server does drop out of the rtp stream between too phones once they start talking to each other. That is a necessity. And I am not familiar with how media gateways interact with systems where we can handle codec conversion before it gets to the asterisk server.