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
Pablo Neira Ayuso 3 years ago committed by keith
parent 2cad562eb2
commit 83616a8e5f
  1. 10
  2. 4

@ -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) {
* 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);
return rc;
else if (rc == -EINPROGRESS)
rc = 0;
return rc;
/* Receive a 04.11 RP-DATA message in accordance with Section */

@ -773,6 +773,10 @@ static int deliver_to_esme(struct osmo_esme *esme, struct gsm_sms *sms,
if (ret < 0)
return ret;
sms->smpp.esme = esme;
return smpp_cmd_enqueue(esme, vsub, sms,