The basic approach is to make a long list of times, compute positions and observing angles at each one, and check whether line of sight (LOS) is obscured by anything. Do it at, say, 5 minute intervals, and then for any interval during which the LOS changed state, repeat the procedure using 5 second intervals. This won't catch an outage shorter that happens entirely within one 5 minute interval, but you can make additional tests to find intervals in which they might occur. On the other hand, if you try it and find that doing the procedure for a whole day in one second intervals runs fast enough, just start with that and be done.
Added in response to comments:
What effects you have to model in order to decide whether LOS exists depends on how precise you need to be. The smaller the error you can tolerate, the harder you have to work to get there. @Spiros Makris your method with the spheres is the right place to start, and for some purposes there's no need to push farther. There is always something missing from any model, but many of them don't matter much. If all you need is to know times plus or minus a minute, you're already done; but if you need sub-second precision, you have a long way to go.
You could start with the aberration of light as a relatively simple, and purely geometric, effect. Another aspect of geometry is the obstructing body isn't a sphere, but a spinning oblate spheroid. Before you try to model that exactly, however, first consider that there's a smallest radius and a largest radius, so making your simple calculation with spheres of two different sizes will tell you how much variation there is from this part of the problem.
If the obstructing body has no atmosphere, you're done; but if it does, the complications are significant. If it's the Earth, then at least there is a ton of data and models that others have made, but you will have to judge for yourself how deep down the rabbit hole you want to go. First, what frequency are we talking about? You said communicating, but do you mean by radio or laser? At what wavelength, and with how many decibels of signal-to-noise available in your link budget? Different bands are affected by the atmosphere in sometimes very different ways. How good does the communication quality have to be? Is a single example atmosphere good enough, or do you need to take the weather into account? (worst case rain fade is really ugly for radio, and IR or visible light is blocked completely by clouds) These also get into the question of just how closely you want your comm signal to skirt the surface.
If you make the radius of your obscuring sphere 50 km larger, then you don't have to worry about weather anymore; but if every last second of data throughput is important to you, then you need to consider things like the 4/3 effective radius model (wiki / 1983 paper / 2013 paper).
There are lots more data and models available to dig deep into any of these questions, and many more. One useful standard reference is the International Earth Rotation Service's Tech Note 36, which talks about correcting measurements for things like the general relativity applicable to satellite laser rangefinding, and the effect of ionosphere and troposphere on very long baseline interferometric radio astronomy. If you are interested in radio propagation, then the International Telecommunications Union has a huge collection of highly detailed recommendations to offer; I would start with ITU-R P.618, Propagation Data and Prediction Methods Required for the Design of Earth-Space Telecommunication Systems.
Please note, I am not recommending that you actually do all of this! Read, or at least skim, the references, but don't plan to type more than a couple of the equations into your code. Completeness (with respect to what has been published; complete description of the phenomena is impossible) would be an awful lot of work, which might be fun but is almost certainly not worth it unless you are, for example, a government agency trying to write requirements for designing and building a major new satellite acquisition program.