Old Post, but the answer is important.
Red and Green from Telco go to red and green on RJ 31X Gray and brown go to premise wiring(inside phone wiring. In Alarms systems you plug in a 31 X cord to Alarm Panel. If an Alarm condition exis, the Panel lifts the premise phones(Inside phones), so it will not stop panel from dialing.
Another meathod is to install a Silicone Bilateral switch(a little diode) that allows a phone or phones priority. When it goes off hook, all other extensions will be dead(will not stop from dialing out).