sms: change rp err cause of smpp_try_deliver errors
smpp_try_deliver could fail with rc < 0. In such cases don't send the MS the rp
error sms rejected (cause 21). A rejected message should not be sent again. The
spec 04 11 recommends sending cause 41 Temporary failure in unknown cases.
Add also a log message and rate counter for such cases.
Tweaked-By: Neels Hofmeyr <nhofmeyr@sysmocom.de>
Change-Id: Ia03e50ce2bd9a7d1054cc5a6000fd73bd3497c03
diff --git a/openbsc/src/libmsc/gsm_04_11.c b/openbsc/src/libmsc/gsm_04_11.c
index 6d3f41b..d1fdfb9 100644
--- a/openbsc/src/libmsc/gsm_04_11.c
+++ b/openbsc/src/libmsc/gsm_04_11.c
@@ -40,6 +40,7 @@
#include <osmocom/gsm/gsm_utils.h>
#include <osmocom/gsm/gsm0411_utils.h>
+#include <osmocom/gsm/protocol/gsm_04_11.h>
#include <openbsc/debug.h>
#include <openbsc/gsm_data.h>
@@ -294,8 +295,12 @@
if (rc == 1)
goto try_local;
if (rc < 0) {
- rc = 21; /* cause 21: short message transfer rejected */
- /* FIXME: handle the error somehow? */
+ LOGP(DLSMS, LOGL_ERROR, "%s: SMS delivery error: %d.",
+ subscr_name(conn->subscr), rc);
+ rc = GSM411_RP_CAUSE_MO_TEMP_FAIL;
+ /* rc will be logged by gsm411_send_rp_error() */
+ rate_ctr_inc(&conn->bts->network->msc_ctrs->ctr[
+ MSC_CTR_SMS_DELIVER_UNKNOWN_ERROR]);
}
return rc;
}
@@ -319,8 +324,12 @@
rc = 1; /* cause 1: unknown subscriber */
rate_ctr_inc(&conn->bts->network->msc_ctrs->ctr[MSC_CTR_SMS_NO_RECEIVER]);
} else if (rc < 0) {
- rc = 21; /* cause 21: short message transfer rejected */
- /* FIXME: handle the error somehow? */
+ LOGP(DLSMS, LOGL_ERROR, "%s: SMS delivery error: %d.",
+ subscr_name(conn->subscr), rc);
+ rc = GSM411_RP_CAUSE_MO_TEMP_FAIL;
+ /* rc will be logged by gsm411_send_rp_error() */
+ rate_ctr_inc(&conn->bts->network->msc_ctrs->ctr[
+ MSC_CTR_SMS_DELIVER_UNKNOWN_ERROR]);
}
#else
rc = 1; /* cause 1: unknown subscriber */