I've attached a tarball that should be extracted into the ejabberd-modules directory.
This patch implements server responses to ping requests, and, after seeing
EJAB-173 it can also be configured to send ping packets to clients (by default it only responds to pings). The timer is fixed, not based on an inactivity period, but otherwise should work well. I'm sure there's some kind of cost to running thousands of these things, but since it's a module it can be enabled and configured per host in the normal ways, and is off by default.