Asterisk domains

how can i configure different domains on asterisk to avoid groups/branches from sharing ext. and dialing each other by mistake

that is handled by utilizing “contexts”. Each group would have their own context. You would have to program into the dialplan a jump between two contexts.

in your sip.conf, you simply define context= whenever a user attempts to dial an extension it will happen inside that specific context.