From 85a304a4fe71e2b74e1881cc517c23950252796a Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 6 Jul 2015 16:41:30 +0200 Subject: sms: Add a way to always route SMS through SMPP systems default-route would only be looked at after there has been no subscriber in the local database. Depending on the setup this is not what one wants. This has been discussed at the OsmoDevCon and there have been hacks in some branches. Let's introduce a VTY command to select if SMPP should be consulted first and then fallback to the current behavior. --- openbsc/src/libmsc/gsm_04_11.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'openbsc/src/libmsc/gsm_04_11.c') diff --git a/openbsc/src/libmsc/gsm_04_11.c b/openbsc/src/libmsc/gsm_04_11.c index 2b6966d44..b316d6213 100644 --- a/openbsc/src/libmsc/gsm_04_11.c +++ b/openbsc/src/libmsc/gsm_04_11.c @@ -280,6 +280,27 @@ int sms_route_mt_sms(struct gsm_subscriber_connection *conn, struct msgb *msg, { int rc; +#ifdef BUILD_SMPP + /* + * 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)) { + rc = smpp_try_deliver(gsms, conn); + if (rc == 1) + goto try_local; + if (rc < 0) { + rc = 21; /* cause 21: short message transfer rejected */ + /* FIXME: handle the error somehow? */ + } + return rc; + } + +try_local: +#endif + /* determine gsms->receiver based on dialled number */ gsms->receiver = subscr_get_by_extension(conn->bts->network->subscr_group, gsms->dst.addr); -- cgit v1.2.3