First, get yourself and anyone else well away from the crossing. If there’s a railway telephone, use that to get instructions from the signal operator. Then, if there’s time, move the vehicle clear of the crossing.
You may also be interested in these theory test questions