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
This commit is contained in:
Pablo Neira Ayuso 2020-01-15 10:00:24 +01:00 committed by keith
parent 2cad562eb2
commit 83616a8e5f
2 changed files with 12 additions and 2 deletions

View File

@ -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,7 +721,9 @@ 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
else if (rc == -EINPROGRESS)
rc = 0;
return rc;
}

View File

@ -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);
}