Even though I don't know the specifics, I take issue with the very idea that merely contacting someone can constitute harassment. At the very least, the content of the message should be taken into account. Intent, more than raw actions taken out of context, is what determines wrongdoing.
Note that I'm not suggesting that the actual law is being misinterpreted. I'm merely stating my personal views about the existence of such a law.
Merely contacting someone may violate the specific terms of a specific restraining order. Restraining orders very often, by design, restrain conduct that would not, absent the order, be prohibited by any law (they would generally be unnecessary if they didn't, since the law itself already restrains any conduct it prohibits.)
Note that I'm not suggesting that the actual law is being misinterpreted. I'm merely stating my personal views about the existence of such a law.