Clean up stale endpoints after OsmoBSC crash
When OsmoBSC crashes, OsmoMGW doesn't know about that and continues to maintain endpoints, allocated by the old OsmoBSC process forever.
I see two possible ways to resolve this:
1) RTP activity timeout (a standard feature of many VoIP servers). If we don't see RTP activity on a certain endpoint, assume it dead, file an alarm to O&M and deallocate resources. The trick here is that this might happen for various reasons even if OsmoBSC is live and kicking. So we should somehow let it know that the endpoint has failed. Otherwise, this is an important alarm in itself, besides handling crashed OsmoBSC.
2) Somehow maintain a connection between OsmoBSC and OsmoMGW. Maybe a form of a ping/pong with a random OsmoBSC ID. So that if OsmoBSC crashes and is restarted, it send a different ID and OsmoMGW knows it's time to deallocate endpoints allocated by the previous OsmoBSC instance.
PS I don't know MGCP but I would think it should have ways to handle such situations?
PPS A workaround in the situation with a single OsmoMGW handling a single OsmoBSC is to always restart them simultaneously. So that if one crashes, the other one is forced to restart as well.