Time has come to fence railways tracks all along. And on populated stretches, they need at least 6 feet high concrete walls. (CR/WR tried with stone walls, but the stones were stolen!!!) It is local body's responsibility to provide link across the tracks in the form of FOB or FUB/subway. Railways always bears cost of portions coming under their jurisdiction. This is basically a precursor to starting HS trains on the route. And this will save lives of people living near railway tracks or who cross them to get to other side.
Anyway its for individuals' safety, People should avoid use of ear phones when in such risky areas till they are permanently forbidden.