GSM 04.08: Improve IMEI recording in hlr.sqlite3 for rejected subscribers

If we send the IDENTITY REQUEST for IMEI before sending the IDENTITY
REQUEST for IMSI, the probability is higher that we receive the IMEI
response and associate it with the respective subscriber.
diff --git a/openbsc/src/gsm_04_08.c b/openbsc/src/gsm_04_08.c
index 06e19ac..b17e1da 100644
--- a/openbsc/src/gsm_04_08.c
+++ b/openbsc/src/gsm_04_08.c
@@ -389,10 +389,6 @@
 		break;
 	case GSM_MI_TYPE_TMSI:
 		DEBUGPC(DMM, "\n");
-		/* we always want the IMEI, too */
-		rc = mm_tx_identity_req(lchan, GSM_MI_TYPE_IMEI);
-		conn->loc_operation->waiting_for_imei = 1;
-
 		/* look up the subscriber based on TMSI, request IMSI if it fails */
 		subscr = subscr_get_by_tmsi(bts->network,
 					    tmsi_from_string(mi_string));
@@ -401,6 +397,9 @@
 			rc = mm_tx_identity_req(lchan, GSM_MI_TYPE_IMSI);
 			conn->loc_operation->waiting_for_imsi = 1;
 		}
+		/* we always want the IMEI, too */
+		rc = mm_tx_identity_req(lchan, GSM_MI_TYPE_IMEI);
+		conn->loc_operation->waiting_for_imei = 1;
 		break;
 	case GSM_MI_TYPE_IMEI:
 	case GSM_MI_TYPE_IMEISV: