implement timeout/resend mechanism for mgcp_client
At the moment mgcp_client sends the the message out and waits for the response, when the response is received, then a the result is returned through a callback. If no response is received (e.g. packet loss), then simply nothing happens. It would be very helpful if the message gets resend after some time.
Each mgcp_message has a unique ID-Number and osmo-mgw is able to handle resend messages. So if the message was received osmo-mgw, but the response got lost on its way to the client, a resend would not hurt. We only need to upgrade the mgcp_client to resend messages after some timeout in case no response is received.
The problems I see here are not only about the timeout. One serious problem, which is really hard cope with are late MGW responses. Imaginge for some reason osmo-mgw responds very late (a few seconds). The timeouts in the CA already caused all context information to be freed. Then the response is processed by the client, the callback function is called and tries to dereference the pointer to the context information. This is a use-after-free bug. I think the best way to deal with this is to have functionality that allows us to tell the client that we are not interested in the response anymore. By this we can terminate pending requests early just before we free the context data.
We do not have the timeout functionality yet, but we do have a nice way to cancel pending transactions. So if the MGW response times out on the users FSM, the user is still able to cancel the transaction before freeing the context information. This way we prevent a possible use-after-free if an MGW response arrives very late. See also: https://gerrit.osmocom.org/#/c/5110/