Clear Command before CRCX OK may leak MGW endpoint
Filing this here at OsmoMGW because I assume the solution should be part of the libosmo-mgcp-client code.
In the test BSC_Tests.TC_ho_in_fail_msc_clears, in some test iterations the Clear Command happens in-between a CRCX and its CRCX OK.
(To get deterministic test results, a patch inserts a little delay, but that's not the point of this issue)
In such a test run, if a CRCX+CRCX-OK completes before the Clear Command, osmo-bsc correctly DLCXes it:
MGW BSC MSC <----- CRCX -----> CRCX OK <----- Clear Command -----> Clear Complete <----- DLCX (DLCX may happen before or after the Clear Complete) -----> DLCX OK
But if the Clear Command happens in-between the CRCX and its CRCX OK, then osmo-bsc fails to DLCX that endpoint conn:
MGW BSC MSC <----- CRCX <----- Clear Command -----> CRCX OK -----> Clear Complete (...missing DLCX)
I would expect to see a DLCX for the CRCX'd endpoint conn, before or after the Clear Complete.
So far it seems to be missing: the T_guard runs an entire minute without seeing a DLCX.
Above mentioned HO test is not a good test case for this because the failure is too non-deterministic.
Hence we need a separate ttcn test that has no automation on the MGCP port happening to get full control of the message sequences and issue the Clear Command directly after the CRCX and before the CRCX OK.
It would make sense to model this case for a normal voice lchan activation, because this problem is probably not limited to handover.