summaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmsc
diff options
context:
space:
mode:
authorBenoit Bolsee <benoit.bolsee@wtl.be>2017-07-05 11:46:55 +0200
committerHarald Welte <laforge@gnumonks.org>2017-07-08 10:45:08 +0000
commit21a7523fcffc0f83587f50f178c41cbed65ef9b6 (patch)
tree3837959af040688184cd8dba06259c0dff7709e8 /openbsc/src/libmsc
parent11acfad02a833999c37ee267864d082241a90afb (diff)
smpp: fix return cause
Return cause 38 when default SMPP route is unavailable. This is better than cause 1. Change-Id: If3241d50a78fa611981e55fef6ae4c72b0a2a167
Diffstat (limited to 'openbsc/src/libmsc')
-rw-r--r--openbsc/src/libmsc/gsm_04_11.c1
-rw-r--r--openbsc/src/libmsc/smpp_openbsc.c9
-rw-r--r--openbsc/src/libmsc/smpp_smsc.c16
-rw-r--r--openbsc/src/libmsc/smpp_smsc.h3
4 files changed, 17 insertions, 12 deletions
diff --git a/openbsc/src/libmsc/gsm_04_11.c b/openbsc/src/libmsc/gsm_04_11.c
index aa2030f80..acf425aa0 100644
--- a/openbsc/src/libmsc/gsm_04_11.c
+++ b/openbsc/src/libmsc/gsm_04_11.c
@@ -294,6 +294,7 @@ int sms_route_mt_sms(struct gsm_subscriber_connection *conn, struct msgb *msg,
if (smpp_first) {
rc = smpp_try_deliver(gsms, conn, deferred);
if (rc == GSM411_RP_CAUSE_MO_NUM_UNASSIGNED)
+ /* unknown subscriber, try local */
goto try_local;
if (rc < 0) {
LOGP(DLSMS, LOGL_ERROR, "%s: SMS delivery error: %d.",
diff --git a/openbsc/src/libmsc/smpp_openbsc.c b/openbsc/src/libmsc/smpp_openbsc.c
index f94968a3f..f7d144191 100644
--- a/openbsc/src/libmsc/smpp_openbsc.c
+++ b/openbsc/src/libmsc/smpp_openbsc.c
@@ -702,17 +702,18 @@ int smpp_try_deliver(struct gsm_sms *sms,
{
struct osmo_esme *esme;
struct osmo_smpp_addr dst;
+ int rc;
memset(&dst, 0, sizeof(dst));
dst.ton = sms->dst.ton;
dst.npi = sms->dst.npi;
memcpy(dst.addr, sms->dst.addr, sizeof(dst.addr));
- esme = smpp_route(g_smsc, &dst);
- if (!esme)
- return GSM411_RP_CAUSE_MO_NUM_UNASSIGNED;
+ rc = smpp_route(g_smsc, &dst, &esme);
+ if (!rc)
+ rc = deliver_to_esme(esme, sms, conn, deferred);
- return deliver_to_esme(esme, sms, conn, deferred);
+ return rc;
}
struct smsc *smsc_from_vty(struct vty *v)
diff --git a/openbsc/src/libmsc/smpp_smsc.c b/openbsc/src/libmsc/smpp_smsc.c
index 4c2e4aac8..04afc49bb 100644
--- a/openbsc/src/libmsc/smpp_smsc.c
+++ b/openbsc/src/libmsc/smpp_smsc.c
@@ -270,8 +270,7 @@ void smpp_esme_put(struct osmo_esme *esme)
}
/*! \brief try to find a SMPP route (ESME) for given destination */
-struct osmo_esme *
-smpp_route(const struct smsc *smsc, const struct osmo_smpp_addr *dest)
+int smpp_route(const struct smsc *smsc, const struct osmo_smpp_addr *dest, struct osmo_esme **pesme)
{
struct osmo_smpp_route *r;
struct osmo_smpp_acl *acl = NULL;
@@ -314,15 +313,20 @@ smpp_route(const struct smsc *smsc, const struct osmo_smpp_addr *dest)
struct osmo_esme *esme;
DEBUGP(DSMPP, "ACL even has ESME, we can route to it!\n");
esme = acl->esme;
- if (esme->bind_flags & ESME_BIND_RX)
- return esme;
- else
+ if (esme->bind_flags & ESME_BIND_RX) {
+ *pesme = esme;
+ return 0;
+ } else
LOGP(DSMPP, LOGL_NOTICE, "[%s] is matching route, "
"but not bound for Rx, discarding MO SMS\n",
esme->system_id);
}
- return NULL;
+ *pesme = NULL;
+ if (acl)
+ return GSM48_CC_CAUSE_NETWORK_OOO;
+ else
+ return GSM48_CC_CAUSE_UNASSIGNED_NR;
}
diff --git a/openbsc/src/libmsc/smpp_smsc.h b/openbsc/src/libmsc/smpp_smsc.h
index d8e82e421..c9209ef8b 100644
--- a/openbsc/src/libmsc/smpp_smsc.h
+++ b/openbsc/src/libmsc/smpp_smsc.h
@@ -126,8 +126,7 @@ void smpp_smsc_stop(struct smsc *smsc);
void smpp_esme_get(struct osmo_esme *esme);
void smpp_esme_put(struct osmo_esme *esme);
-struct osmo_esme *
-smpp_route(const struct smsc *smsc, const struct osmo_smpp_addr *dest);
+int smpp_route(const struct smsc *smsc, const struct osmo_smpp_addr *dest, struct osmo_esme **emse);
struct osmo_smpp_acl *smpp_acl_alloc(struct smsc *smsc, const char *sys_id);
struct osmo_smpp_acl *smpp_acl_by_system_id(struct smsc *smsc,