I am not sure what you mean by "sun rays" - are you specifically looking for visible beams of sunlight, that is, "god rays", "crepuscular rays" etc. caused by volumetrics? Or do you just mean general light from the sun passing through the curtain? An image of what result you are getting would help, as hard to answer the question without knowing exactly what issue you are experiencing.
That said, doesn't sound like excluding the curtain is the correct approach, as then the sun would shine into the room as if the curtain was not there, which is not realistic. If you want the sun to pass through the curtain then transparency (opacity) or translucency would be the way to go, which will let the sunlight pass through the curtain just as it does a real curtain in the real world.