sms: Dispatch a failed signal in many of the MT-sms points

This attempts to dispatch a signal whenever a MT-sms is failing. In
some cases, e.g. with freeing the transaction, this will also happen
for MO-sms.
diff --git a/openbsc/src/gsm_04_11.c b/openbsc/src/gsm_04_11.c
index 65688f5..faa712c 100644
--- a/openbsc/src/gsm_04_11.c
+++ b/openbsc/src/gsm_04_11.c
@@ -811,8 +811,10 @@
 		/* FIXME */
 		dispatch_signal(SS_SMS, S_SMS_MEM_EXCEEDED, sms);
 		counter_inc(net->stats.sms.rp_err_mem);
-	} else
+	} else {
+		dispatch_signal(SS_SMS, S_SMS_UNKNOWN_ERROR, sms);
 		counter_inc(net->stats.sms.rp_err_other);
+	}
 
 	sms_free(sms);
 	trans->sms.sms = NULL;
@@ -832,7 +834,7 @@
 	/* MS tells us that it has memory for more SMS, we need
 	 * to check if we have any pending messages for it and then
 	 * transfer those */
-	dispatch_signal(SS_SMS, S_SMS_SMMA, trans);
+	dispatch_signal(SS_SMS, S_SMS_SMMA, trans->subscr);
 
 	/* check for more messages for this subscriber */
 	sms = db_sms_get_unsent_for_subscr(trans->subscr);
@@ -1044,6 +1046,7 @@
 	transaction_id = trans_assign_trans_id(conn->subscr, GSM48_PDISC_SMS, 0);
 	if (transaction_id == -1) {
 		LOGP(DSMS, LOGL_ERROR, "No available transaction ids\n");
+		dispatch_signal(SS_SMS, S_SMS_UNKNOWN_ERROR, sms);
 		sms_free(sms);
 		return -EBUSY;
 	}
@@ -1055,6 +1058,7 @@
 			    transaction_id, new_callref++);
 	if (!trans) {
 		LOGP(DSMS, LOGL_ERROR, "No memory for trans\n");
+		dispatch_signal(SS_SMS, S_SMS_UNKNOWN_ERROR, sms);
 		sms_free(sms);
 		/* FIXME: send some error message */
 		return -ENOMEM;
@@ -1088,6 +1092,7 @@
 	/* generate the 03.40 TPDU */
 	rc = gsm340_gen_tpdu(msg, sms);
 	if (rc < 0) {
+		dispatch_signal(SS_SMS, S_SMS_UNKNOWN_ERROR, sms);
 		trans_free(trans);
 		sms_free(sms);
 		msgb_free(msg);
@@ -1127,6 +1132,7 @@
 	case GSM_PAGING_EXPIRED:
 	case GSM_PAGING_OOM:
 	case GSM_PAGING_BUSY:
+		dispatch_signal(SS_SMS, S_SMS_UNKNOWN_ERROR, sms);
 		sms_free(sms);
 		rc = -ETIMEDOUT;
 		break;
@@ -1185,6 +1191,7 @@
 {
 	if (trans->sms.sms) {
 		LOGP(DSMS, LOGL_ERROR, "Transaction contains SMS.\n");
+		dispatch_signal(SS_SMS, S_SMS_UNKNOWN_ERROR, trans->sms.sms);
 		sms_free(trans->sms.sms);
 		trans->sms.sms = NULL;
 	}
@@ -1204,6 +1211,7 @@
 				continue;
 			}
 
+			dispatch_signal(SS_SMS, S_SMS_UNKNOWN_ERROR, sms);
 			sms_free(sms);
 			trans->sms.sms = NULL;
 			trans_free(trans);