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
This commit is contained in:
Alexander Couzens 2016-08-21 20:16:33 +02:00 committed by Harald Welte
parent c2f2ad8a5f
commit aa386d29fd
2 changed files with 15 additions and 4 deletions

View File

@ -198,6 +198,7 @@ enum {
MSC_CTR_SMS_DELIVERED,
MSC_CTR_SMS_RP_ERR_MEM,
MSC_CTR_SMS_RP_ERR_OTHER,
MSC_CTR_SMS_DELIVER_UNKNOWN_ERROR,
MSC_CTR_CALL_MO_SETUP,
MSC_CTR_CALL_MO_CONNECT_ACK,
MSC_CTR_CALL_MT_SETUP,
@ -216,6 +217,7 @@ static const struct rate_ctr_desc msc_ctr_description[] = {
[MSC_CTR_SMS_DELIVERED] = {"sms.delivered", "Global SMS Deliver attempts."},
[MSC_CTR_SMS_RP_ERR_MEM] = {"sms.rp_err_mem", "CAUSE_MT_MEM_EXCEEDED errors of MS responses on a sms deliver attempt."},
[MSC_CTR_SMS_RP_ERR_OTHER] = {"sms.rp_err_other", "Other error of MS responses on a sms delive attempt."},
[MSC_CTR_SMS_DELIVER_UNKNOWN_ERROR] = {"sms.deliver_unknown_error", "Unknown error occured during sms delivery."},
/* FIXME: count also sms delivered */
[MSC_CTR_CALL_MO_SETUP] = {"call.mo_setup", "Received setup requests from a MS to init a MO call."},
[MSC_CTR_CALL_MO_CONNECT_ACK] = {"call.mo_connect_ack", "Received a connect ack from MS of a MO call. Call is now succesful connected up."},

View File

@ -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 @@ int sms_route_mt_sms(struct gsm_subscriber_connection *conn, struct msgb *msg,
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 @@ try_local:
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 */