a rough outline-
master box sip.conf has friends defined for both other ones.
each other one only has the master box defined. Probably all as friends.
they either have each others IP or the other boxes register=> to the master box
then:
master box:
exten => _4XXX,1,Goto(extensions,${EXTEN},1) ; 4xxx extensions are local to master box
exten => _5XXX,1,Dial(SIP/otherbox1/${EXTEN}) ; send all the other calls to their right servers
exten => _6XXX,1,Dial(SIP/otherbox2/${EXTEN})
other box 1
exten => _5XXX,1,Goto(extensions,${EXTEN},1) ; 5xxx is local here
exten => _4XXX,1,Dial(SIP/masterbox/${EXTEN})
exten => _6XXX,1,Dial(SIP/masterbox/${EXTEN}) ; send other calls back to master
other box 2
exten => _6XXX,1,Goto(extensions,${EXTEN},1) ; 6xxx is local here
exten => _4XXX,1,Dial(SIP/masterbox/${EXTEN})
exten => _5XXX,1,Dial(SIP/masterbox/${EXTEN}) ; all other calls sent back to master
Were you to do it with a switch statement it might look like:
other box 2
exten => _6XXX,1,Goto(extensions,${EXTEN},1) ; 6xxx is local here
switch => SIP/masterbox
and I believe that will do the same thing but will match anything on the master box. Cant find much info on that tho.