I'm sure that other forum member have put this to practice, I haven't, but in theory it should work like this...
If you were using four digit extensions at all locations (just to keep this simple), you would assign a prefix for each of the PBXs.
So...if a caller at PBX A wished to call an extension at PBX B, it's prefix might be 3, so they dial 32012 to reach extension 2012. Outbound rules strip the 3 and send four digits on the bridge trunk, that matches an extension at B and the call is connected.
If the prefix at PBX C is 4, the user at A dials 43102. Outbound rules leave the 4 on and send all 5 digits. At PBX B there is an outbound rule for 4XXXX to strip the 4 and send the remaining digits over the bridge to C. At C it connects to extension 3102.
The more possible routes you have, the more prefixes you will need and you will have to avoid conflicts with existing extension numbers in the tandem PBX. If you were going to set-up something like this , it would be a good idea to do so before all of the interconnected PBXs have had their extension numbers decided upon. Doing so with a large number of existing PBXs will take some planning. A web pattern of trunking is usually more efficient than a star configuration, where all bridge calls tandem through one PBX. It could all be made a bit simpler if, say, all extensions at one PBX were the 2XXX range, another were 3XXX, etc.
This for simple calls from one to another. doing call transfers may introduce other factors. There may also be issues with caller ID displaying something that makes sense to the called party.
Hopefully someone else can offer up some advice, saving you from "re-inventing the wheel"