MSC_ConnectionHandler: fix race condition in f_establish_fully()

For more details, see I25e10e28de174337233e6a3bb32cc16f2d7d614e.

Change-Id: Icdb4f2e0edc4cb6e2010a9299331e7e93d0ca007
Related: OS#4619
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 8ac7051..0d4c81b 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -801,6 +801,9 @@
 
 			/* register our component for this channel number at the RSL Emulation */
 			f_rslem_register(0, new_chan_nr);
+			/* dispatch queued messages for this channel (if any) */
+			f_rslem_dchan_queue_dispatch();
+
 			var PDU_ML3_MS_NW l3_tx := valueof(ts_RRM_AssignmentComplete('00'O));
 			/* send assignment complete over the new channel */
 			RSL.send(ts_RSL_EST_IND(new_chan_nr, valueof(ts_RslLinkID_DCCH(0)),
@@ -1093,6 +1096,15 @@
 		g_media.mgcp_conn[1].mdcx_seen_exp := 0;
 	}
 
+	/* On receipt of the BSSAP Assignment Command, the IUT (osmo-bsc) will allocate
+	 * a channel and send us RR Assignment Command together with ip.access CRCX.
+	 * There is a risk that the RSL Emulation component would dequeue and process
+	 * ip.access CRCX faster than we process the Assignment Command and register
+	 * the corresponding handler for the indicated RSL channel number. This would
+	 * result in a failure, because at that moment there will be no handler for
+	 * ip.access CRCX. Let's guard against this and enable additional queueing. */
+	f_rslem_dchan_queue_enable();
+
 	f_create_mgcp_expect(mgcpcrit);
 	BSSAP.send(ass_cmd);