The batteries are why the phone still works when the power goes out. That is if you still have an old style (hard wire) phone and not all cordless phones. The cordless phones need 120 VAC  power to run the base station. You should maintain at least one all wire somewhere in your house.
I believe the [common design for COs  is that the] whole building is built in such a way that it is a big Faraday Cage . It would take a pretty close proximity EMP  to take one out. The EMP
danger is in the above ground wiring [and antennas].
Most of this kind of engineering is done for lighting protection, but it is something of an EMP protection as well. That is [on reason why they are continuing to switch to underground wiring, even on expensive long[er] distance routes. The switch to fiber optics helps here also, even though the main rationale for its adoption was capacity and cost.
The phone companies are some of the most engineering conservative utilities in this country. When I worked with them, everything was “double built”. 100 percent redundancy.
And they are learning a lot fast about “hardening” their properties. Some of the upgrades I have seen done inside those little brick buildings spread around the country make them into pillboxes. – Keith S.
I saw the stuff about phone Central Offices (COs) and thought I would contribute a bit as well since this is a part of my area of specialty. Many times people have these nearby and are unaware of them. They look like a generic office building – most have few or no windows and are most often brick, concrete or concrete block. They are generally unobtrusive and sometimes do not even have the company logo on them. They are made this way because they house what is considered critical communications infrastructure and because they are supposed to be semi-secure and protected against all but the very worst mother nature can dish out. They are also a desirable target for terrorists, etc. As far as I know it is a Federal felony to disrupt the operations of one of these buildings so batteries, generators, and so forth would be strictly off limits in all but a true TEOTWAWKI  situation.
This link  has pictures of COs. If you look at the Kansas page you can see the COs that might exist in a small town – where they may serve at most a few hundred customers. The one’s listed under California (619) might serve a few thousand customers. These buildings will generally not be more than about 3 to 5 miles apart in suburban areas and even closer in urban areas so they are quite common, but most people do not have a clue where or what they are.
They do have large battery back-ups and larger one’s have generators. The larger one’s will also have fuel reservoirs of either diesel, propane or gasoline depending on the location, company policy, etc. These are required to keep the system up if the grid goes down – however they are only meant for a few days operation at best on generators. They do change the batteries our regularly because they have to keep the grid operational. [Their surplus battery sales are] a decent way to get good, used deep cycle batteries. The best money can buy. Regards, – Tim P.