This setup was designed for implementations with 2 sites and an HA setup. DNS was configured such that phones would register to their appropriate local PBX to reduce WAN traffic. So basically, one system to manage and one set of dial plans. Due to analog lines we required 3 four port gateways at one site and 1 four port at the smaller site.
This all works great until you go to select a gateway for outbound dialing because there is one dial plan, the order of gateways is the order of gateways. This basically kills you being able to select the closest gateway to you if you are at the satellite location.
The first attempt was to use custom dialing permissions to secure different dial plans to different groups of users. This didn't work as expected. These work more like a router access list in that if your security permissions do not permit you to dial the first dial plan you hit, where the digit pattern matches, the call attempt is kicked back.
Next we cooked up a pooled gateway approach using DNS SRV records to in effect make a single gateway to define in the dial plan entries. Gateway IP addresses at each site would be returned in the order of preference we were looking for at both sites. While this approach worked in bench testing, it fell on its face once we started really testing the system on-site. If the gateway that was selected out of the pool had no lines available in it, the gateway will return a 503 error to the PBX. And since the PBX only knows of 1 gateway, the call essentially fails (system isn't smart enough to go back and grab the next priority gateway).
What we finally arrived at for a configuration that seems to work pretty well is to use DNS to create phantom gateways.
So the dial plans have the gateways defined as:
DNS at Site 1
DNS at Site 2
Thus now if 'out1' has no ports available it returns a 503 to the PBX and the next gateway in the dial plan is selected.
This solution won't work too well if you have a replicated DNS system, but we were using separate DNS servers from the data network for the phones / PBX.
BTW, we did the same sort of thing for 911 dialing. In the 911 dial plan we created a single e911.xyz.com gateway and then with DNS at each of the remote sites made that resolve to the actual gateway we wanted to go out.