The following off-the-shelf AC-input optocoupler module, clearly designed for O-gauge applications, came up in this thread. Note how it uses DC-input chips (like the $2 eBay 4-channel module above) and added a bridge-rectifier in front of and a capacitor on the output.
A bit spendy in my opinion but validates the concept!