aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2020-01-15 10:00:24 +0100
committerkeith <keith@rhizomatica.org>2020-01-15 14:47:04 +0000
commit83616a8e5f0bfcae411fd5d6d1492380d5a943b0 (patch)
treed80f1bd7c1452bbb5ed24f28d7a5fbf4e5fe28be
parent2cad562eb221c88098b56c9686bbfb2fd97ef830 (diff)
libmsc: SMS, Avoid premature RP-ACK to MS
There was one libmsc commit to openbsc that was thus far missing in osmo-msc. This commit completes the work on delayed response from an ESME. Without this patch, the SMR sends an RP-ACK to the mobile station, and subsequently a DELIVER_SM_REPONSE from the ESME provokes either a second RP-ACK, or an RP-ERROR; both of which result in "unhandled at this state (IDLE)" from the SMR After this patch, we have two things corrected: 1) RP-ERROR respects Deliver-SM error cause. 2) No more "unhandled as this state" error from the SMR Extract from original commit message: -------- libmsc: annotate esme route in the sms object from deliver_to_esme() Annotate this esme route, so we can use it to return -EINPROGRESS to skip sending premature RP-ACK to the mobile station, in case we're handling sms routes through SMPP. -------- Fixes: #OS4351 Change-Id: Ic34d398e0a850856e20380ae35e5c2ae5e3c539b
-rw-r--r--src/libmsc/gsm_04_11.c10
-rw-r--r--src/libmsc/smpp_openbsc.c4
2 files changed, 12 insertions, 2 deletions
diff --git a/src/libmsc/gsm_04_11.c b/src/libmsc/gsm_04_11.c
index ae19b2762..5c2692944 100644
--- a/src/libmsc/gsm_04_11.c
+++ b/src/libmsc/gsm_04_11.c
@@ -629,6 +629,10 @@ static int gsm340_rx_tpdu(struct gsm_trans *trans, struct msgb *msg,
rc = sms_route_mt_sms(trans, gsms);
+ /* This SMS got routed through SMPP and we are waiting on the response. */
+ if (gsms->smpp.esme) {
+ return -EINPROGRESS;
+ }
/*
* This SMS got routed through SMPP or no receiver exists.
* In any case, we store it in the database for further processing.
@@ -717,8 +721,10 @@ static int gsm411_rx_rp_ud(struct msgb *msg, struct gsm_trans *trans,
return gsm411_send_rp_ack(trans, rph->msg_ref);
else if (rc > 0)
return gsm411_send_rp_error(trans, rph->msg_ref, rc);
- else
- return rc;
+ else if (rc == -EINPROGRESS)
+ rc = 0;
+
+ return rc;
}
/* Receive a 04.11 RP-DATA message in accordance with Section 7.3.1.2 */
diff --git a/src/libmsc/smpp_openbsc.c b/src/libmsc/smpp_openbsc.c
index 98b3b5370..a79b2524c 100644
--- a/src/libmsc/smpp_openbsc.c
+++ b/src/libmsc/smpp_openbsc.c
@@ -773,6 +773,10 @@ static int deliver_to_esme(struct osmo_esme *esme, struct gsm_sms *sms,
if (ret < 0)
return ret;
+ OSMO_ASSERT(!sms->smpp.esme);
+ smpp_esme_get(esme);
+ sms->smpp.esme = esme;
+
return smpp_cmd_enqueue(esme, vsub, sms,
deliver.sequence_number);
}