Since it's intermittent, test the voltage to the solenoid sometime when the trailer brakes are locked up, and another time when they're working (not locked up). Have someone else just hold the brake pedal down in the truck so you can keep it in reverse and test the voltage to the solenoid. Does your trailer harness have a 5 prong connection between the truck/trailer? The idea behind the solenoid is that when the truck is put into reverse, it sends voltage through that 5th wire that activates the solenoid and locks the brakes out from engaging. If you have no other wiring issues, it sounds like a bad solenoid to me... but I'm new at this trailer brake thing, so I don't know that I'm qualified to answer all of these questions haha.
Also, does your trailer have any reverse lights on it? Are those lit up when the brakes are locked up? If the reverse lights on the trailer come on, but the brakes are still locked up, that would also point to a bad solenoid. If the brakes lock up, and the reverse lights are also off, that would point to some sort of wiring issue that isn't transferring current to that 5th wire. Just another thing to check.