A major problem with ASW (Anti-submarine warfare) is that your submarine detection software equipment is turned off most of the time, and when it is used it requires a lot of trained operators and lawyers (to deal with the growing number of lawsuits filed by NGOs seeking to protect sea animals from noise pollution). Ships depend on intelligence, usually from large organizations like the CIA or military intel operations, to alert them that a submarine threat might exist in their area.
For nearly a decade now, research has been underway on a solution in the form of Continuous Active Sonar (CAS). This is a low level sonar signal that operates like radar, providing a continuous flow of data on what might be down there. Current sonars send out a more powerful signal, but at a low rate (one or more a minute). This annoys underwater creatures, and lawyers representing the critters make it difficult for the navy to even train with this equipment. CAS is based on the growing effectiveness of passive sonar (that just listens, and uses an electronic library of sounds to identify enemy ships). CAS makes it possible to identify increasingly quiet submarines, that depend on their stealth to get close enough to fire a torpedo.
The problem with CAS is that it's been a tricky technology to perfect, although recently there have been some promising tests at sea. If CAS could be perfected and deployed, it would give ships round the clock warning of approaching submarines. With a mature CAS technology, it would also be able to detect approaching torpedoes, and deploy underwater decoys. Eventually, when someone gets CAS to work reliably for sailors to use regularly.