Gamma-ray absorption in massive X-ray binaries