From what I can see, hangup itself  is just intrinsically a fragile API and should be used as little as possible, so I've renamed it to _hangup, and changed the one other caller to use the function above, hangupIfNecessary.  I've pushed this change to your branch; if I've missed something, you're more than welcome to revert.