smpp: fix return cause

Return cause 38 when default SMPP route is unavailable. This
is better than cause 1.

Change-Id: If3241d50a78fa611981e55fef6ae4c72b0a2a167
This commit is contained in:
Benoit Bolsee 2017-07-05 11:46:55 +02:00 committed by Neels Hofmeyr
parent 95606647ef
commit d34ed5768c
4 changed files with 17 additions and 12 deletions

View File

@ -296,6 +296,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.",

View File

@ -709,17 +709,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)

View File

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

View File

@ -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,