laforge has submitted this change. ( )

Change subject: libmsc: SMS, Avoid premature RP-ACK to MS

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
M src/libmsc/gsm_04_11.c
M src/libmsc/smpp_openbsc.c
2 files changed, 12 insertions(+), 2 deletions(-)

  keith: Looks good to me, approved
  pespin: Looks good to me, approved
  fixeria: Verified
  Jenkins Builder: Verified

diff --git a/src/libmsc/gsm_04_11.c b/src/libmsc/gsm_04_11.c
index ae19b27..5c26929 100644
--- a/src/libmsc/gsm_04_11.c
+++ b/src/libmsc/gsm_04_11.c
@@ -629,6 +629,10 @@

        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 @@
                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 */
diff --git a/src/libmsc/smpp_openbsc.c b/src/libmsc/smpp_openbsc.c
index 98b3b53..a79b252 100644
--- a/src/libmsc/smpp_openbsc.c
+++ b/src/libmsc/smpp_openbsc.c
@@ -773,6 +773,10 @@
        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,

To view, visit
To unsubscribe, or for help writing mail filters, visit

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: Ic34d398e0a850856e20380ae35e5c2ae5e3c539b
Gerrit-Change-Number: 16873
Gerrit-PatchSet: 4
Gerrit-Owner: keith <>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pablo Neira Ayuso <>
Gerrit-Reviewer: fixeria <>
Gerrit-Reviewer: keith <>
Gerrit-Reviewer: laforge <>
Gerrit-Reviewer: pespin <>
Gerrit-MessageType: merged

Reply via email to