This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
neels gerrit-no-reply at lists.osmocom.orgneels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-msc/+/16217 ) Change subject: Fix duplicate SMS when SMPP returns to same MSC ...................................................................... Fix duplicate SMS when SMPP returns to same MSC Change-Id: I8c9b61dc05bda6f2b09cbc1890de1f2702f7abc8 --- M include/osmocom/msc/gsm_data.h M src/libmsc/gsm_04_11.c 2 files changed, 15 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/17/16217/1 diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h index bcee213..736d563 100644 --- a/include/osmocom/msc/gsm_data.h +++ b/include/osmocom/msc/gsm_data.h @@ -292,6 +292,7 @@ } gsm411; struct { + bool ongoing; struct osmo_esme *esme; uint32_t sequence_nr; int transaction_mode; diff --git a/src/libmsc/gsm_04_11.c b/src/libmsc/gsm_04_11.c index 367cc6f..186144c 100644 --- a/src/libmsc/gsm_04_11.c +++ b/src/libmsc/gsm_04_11.c @@ -272,9 +272,12 @@ static int gsm340_rx_sms_submit(struct gsm_trans *trans, struct gsm_sms *gsms) { - if (db_sms_store(gsms) != 0) { - LOG_TRANS(trans, LOGL_ERROR, "Failed to store SMS in Database\n"); - return GSM411_RP_CAUSE_MO_NET_OUT_OF_ORDER; + if (!gsms->smpp.ongoing) { + LOG_TRANS(trans, LOGL_NOTICE, "SMS Store %llu\n", gsms->id); + if (db_sms_store(gsms) != 0) { + LOG_TRANS(trans, LOGL_ERROR, "Failed to store SMS in Database\n"); + return GSM411_RP_CAUSE_MO_NET_OUT_OF_ORDER; + } } /* dispatch a signal to tell higher level about it */ send_signal(S_SMS_SUBMITTED, NULL, gsms, 0); @@ -424,10 +427,17 @@ * delivery of the SMS. */ if (smpp_route_smpp_first()) { + /* In case the ESME returns the SMS to this MSC, another entry for this SMS will be created (as usual + * for incoming SMPP requests). However, this code path soon also adds a DB entry, which would create + * duplicate entries, which would send the SMS twice. Avoid that by marking as SMPP ongoing to skip db */ + gsms->smpp.ongoing = true; + rc = smpp_try_deliver(gsms, msc_a); - if (rc == GSM411_RP_CAUSE_MO_NUM_UNASSIGNED) + if (rc == GSM411_RP_CAUSE_MO_NUM_UNASSIGNED) { /* unknown subscriber, try local */ + gsms->smpp.ongoing = false; goto try_local; + } if (rc < 0) { LOG_TRANS(trans, LOGL_ERROR, "SMS delivery error: %d\n", rc); rc = GSM411_RP_CAUSE_MO_TEMP_FAIL; -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/16217 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: I8c9b61dc05bda6f2b09cbc1890de1f2702f7abc8 Gerrit-Change-Number: 16217 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191125/f26fa268/attachment.htm>