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:
parent
95606647ef
commit
d34ed5768c
|
@ -296,6 +296,7 @@ int sms_route_mt_sms(struct gsm_subscriber_connection *conn, struct msgb *msg,
|
||||||
if (smpp_first) {
|
if (smpp_first) {
|
||||||
rc = smpp_try_deliver(gsms, conn, deferred);
|
rc = smpp_try_deliver(gsms, conn, deferred);
|
||||||
if (rc == GSM411_RP_CAUSE_MO_NUM_UNASSIGNED)
|
if (rc == GSM411_RP_CAUSE_MO_NUM_UNASSIGNED)
|
||||||
|
/* unknown subscriber, try local */
|
||||||
goto try_local;
|
goto try_local;
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
LOGP(DLSMS, LOGL_ERROR, "%s: SMS delivery error: %d.",
|
LOGP(DLSMS, LOGL_ERROR, "%s: SMS delivery error: %d.",
|
||||||
|
|
|
@ -709,17 +709,18 @@ int smpp_try_deliver(struct gsm_sms *sms,
|
||||||
{
|
{
|
||||||
struct osmo_esme *esme;
|
struct osmo_esme *esme;
|
||||||
struct osmo_smpp_addr dst;
|
struct osmo_smpp_addr dst;
|
||||||
|
int rc;
|
||||||
|
|
||||||
memset(&dst, 0, sizeof(dst));
|
memset(&dst, 0, sizeof(dst));
|
||||||
dst.ton = sms->dst.ton;
|
dst.ton = sms->dst.ton;
|
||||||
dst.npi = sms->dst.npi;
|
dst.npi = sms->dst.npi;
|
||||||
memcpy(dst.addr, sms->dst.addr, sizeof(dst.addr));
|
memcpy(dst.addr, sms->dst.addr, sizeof(dst.addr));
|
||||||
|
|
||||||
esme = smpp_route(g_smsc, &dst);
|
rc = smpp_route(g_smsc, &dst, &esme);
|
||||||
if (!esme)
|
if (!rc)
|
||||||
return GSM411_RP_CAUSE_MO_NUM_UNASSIGNED;
|
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)
|
struct smsc *smsc_from_vty(struct vty *v)
|
||||||
|
|
|
@ -270,8 +270,7 @@ void smpp_esme_put(struct osmo_esme *esme)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief try to find a SMPP route (ESME) for given destination */
|
/*! \brief try to find a SMPP route (ESME) for given destination */
|
||||||
struct osmo_esme *
|
int smpp_route(const struct smsc *smsc, const struct osmo_smpp_addr *dest, struct osmo_esme **pesme)
|
||||||
smpp_route(const struct smsc *smsc, const struct osmo_smpp_addr *dest)
|
|
||||||
{
|
{
|
||||||
struct osmo_smpp_route *r;
|
struct osmo_smpp_route *r;
|
||||||
struct osmo_smpp_acl *acl = NULL;
|
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;
|
struct osmo_esme *esme;
|
||||||
DEBUGP(DSMPP, "ACL even has ESME, we can route to it!\n");
|
DEBUGP(DSMPP, "ACL even has ESME, we can route to it!\n");
|
||||||
esme = acl->esme;
|
esme = acl->esme;
|
||||||
if (esme->bind_flags & ESME_BIND_RX)
|
if (esme->bind_flags & ESME_BIND_RX) {
|
||||||
return esme;
|
*pesme = esme;
|
||||||
else
|
return 0;
|
||||||
|
} else
|
||||||
LOGP(DSMPP, LOGL_NOTICE, "[%s] is matching route, "
|
LOGP(DSMPP, LOGL_NOTICE, "[%s] is matching route, "
|
||||||
"but not bound for Rx, discarding MO SMS\n",
|
"but not bound for Rx, discarding MO SMS\n",
|
||||||
esme->system_id);
|
esme->system_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
*pesme = NULL;
|
||||||
|
if (acl)
|
||||||
|
return GSM48_CC_CAUSE_NETWORK_OOO;
|
||||||
|
else
|
||||||
|
return GSM48_CC_CAUSE_UNASSIGNED_NR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -126,8 +126,7 @@ void smpp_smsc_stop(struct smsc *smsc);
|
||||||
void smpp_esme_get(struct osmo_esme *esme);
|
void smpp_esme_get(struct osmo_esme *esme);
|
||||||
void smpp_esme_put(struct osmo_esme *esme);
|
void smpp_esme_put(struct osmo_esme *esme);
|
||||||
|
|
||||||
struct osmo_esme *
|
int smpp_route(const struct smsc *smsc, const struct osmo_smpp_addr *dest, struct osmo_esme **emse);
|
||||||
smpp_route(const struct smsc *smsc, const struct osmo_smpp_addr *dest);
|
|
||||||
|
|
||||||
struct osmo_smpp_acl *smpp_acl_alloc(struct smsc *smsc, const char *sys_id);
|
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,
|
struct osmo_smpp_acl *smpp_acl_by_system_id(struct smsc *smsc,
|
||||||
|
|
Loading…
Reference in New Issue