aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-07-13 10:39:51 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-07-13 10:39:51 +0200
commit7c19c6b4064b10511fa5f5327030c21616905d94 (patch)
tree7ec734baa04e92d68992d8e82121c30ae03a5b94 /openbsc
parent42cf2e03c936d34c1bda7d491f9e367bf02dddce (diff)
sms: Do not go through the routing a second time
If we have tried SMPP first and it was not routable, and then tried the local delivery there is no point in trying SMPP with the same parameters again. Leave early and return unknown sub to the caller.
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/libmsc/gsm_04_11.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/openbsc/src/libmsc/gsm_04_11.c b/openbsc/src/libmsc/gsm_04_11.c
index b316d6213..c2cec26cd 100644
--- a/openbsc/src/libmsc/gsm_04_11.c
+++ b/openbsc/src/libmsc/gsm_04_11.c
@@ -281,13 +281,15 @@ int sms_route_mt_sms(struct gsm_subscriber_connection *conn, struct msgb *msg,
int rc;
#ifdef BUILD_SMPP
+ int smpp_first = smpp_route_smpp_first(gsms, conn);
+
/*
* Route through SMPP first before going to the local database. In case
* of a unroutable message and no local subscriber, SMPP will be tried
* twice. In case of an unknown subscriber continue with the normal
* delivery of the SMS.
*/
- if (smpp_route_smpp_first(gsms, conn)) {
+ if (smpp_first) {
rc = smpp_try_deliver(gsms, conn);
if (rc == 1)
goto try_local;
@@ -306,6 +308,10 @@ try_local:
gsms->dst.addr);
if (!gsms->receiver) {
#ifdef BUILD_SMPP
+ /* Avoid a second look-up */
+ if (smpp_first)
+ return 1; /* cause 1: unknown subscriber */
+
rc = smpp_try_deliver(gsms, conn);
if (rc == 1) {
rc = 1; /* cause 1: unknown subscriber */