New Ofcom rules will protect boxes in areas of poor mobile coverage or where they are needed for safety.