Well OK, but this is just pinging and polling:
ModemManager already facilitates intercepting and reporting of disconnection events from the modem.
This pull request seems worth considering and critiquing: