I spent 25 years in the wonderful world of pest control. Carpenter bees were always more of a nuisance than a difficulty in eliminating. The problem should be addressed though, since given enough time they can cause considerable damage.
The holes are exactly 3/8 of an inch in diameter. One inside the bee then bores at right angles and eventually leaves eggs to hatch at a later date. These are the chambers in your photos.
If the entry hole can be accessed, not always easy, idealy an insect dust should be blown in, followed by a temporary application of wood putty or wood glue a day or so later. As fearsome as they look, they are solitary bees and do not swarm. You would almost have to catch one in your bare hand before they would sting.
This type of work is generally best left to a professional.
Expanding foam should work. The reason the bees bore right through is the entry point has not been treated properly. An insect dust is generally a desicant which is safe for the general public but will kill the adult bees through dehydration and if the holes are sealed properly will also kill the young bees as they emerge from their eggs.
A million years ago we used residual liquids like chlorodane and dursban which worked well but they have been removed from the market, with justication by the EPA. Any certified pest control operator will have access to proper materials and be able use them under label directions.
Also, the damage in the photos while unsightly is not serious structural damage. You would want to eliminate the bees from leader and gutter areas. I hate to sound like a shill for the industry but ladder work , while handling insecticides and a few of these bees flying around is really best left to those who do this for a living.
The above link will tell you more than you ever cared to know about carpenter bees, and very useful info about how to control them.
Good luck!
PS. Carpenter bees don't sting, and we DIY this problem annually for MUCH less than the Professionals charge! (For any other bee, however, I'd definitely call in a pro in a bee suit!)
Part of the damage you are seeing in the photo is from woodpeckers, I bet. We've always had a few carpenter bees, but this year the woodpeckers discovered them, and turned up in force to feast on the bee larvae. The bees never did as much damage as the woodpeckers did!
In my recent post regarding using a professional for carpenter bees I was refering to areas of difficult access, mostly ladder work. If access is easy and safe there is nothing wrong with doing it yourself. Probably 80 percent of pest problems can be treated successfully with the proper knowledge and over the counter products. If however you find yourself having to retreat the area or areas annually you might want to conside using a professional who offers some sort of guarantee.
Opps, how do you insert a .jpg photo?