falconia has submitted this change. (
https://gerrit.osmocom.org/c/osmo-hlr/+/34450?usp=email )
(
2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: SMS over GSUP: implement forwarding of MT SMS
......................................................................
SMS over GSUP: implement forwarding of MT SMS
When an SMSC tries to deliver an SM to a subscriber, it will send us
an MT-forwardSM.req GSUP message. We look up the subscriber by IMSI
and see if they are attached to a VLR. If the subscriber is attached,
we forward the message to the MSC/VLR, otherwise return an error
to the SMSC.
Related: OS#6135
Change-Id: Ib3551bf7839690606c677461758c5cfef5f0aa7b
---
M include/osmocom/hlr/hlr_sms.h
M src/hlr.c
M src/hlr_sms.c
3 files changed, 48 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
fixeria: Looks good to me, but someone else must approve
pespin: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/include/osmocom/hlr/hlr_sms.h b/include/osmocom/hlr/hlr_sms.h
index 727e408..e6e476e 100644
--- a/include/osmocom/hlr/hlr_sms.h
+++ b/include/osmocom/hlr/hlr_sms.h
@@ -29,3 +29,4 @@
void smsc_route_free(struct hlr_smsc_route *rt);
void forward_mo_sms(struct osmo_gsup_req *req);
+void forward_mt_sms(struct osmo_gsup_req *req);
diff --git a/src/hlr.c b/src/hlr.c
index 501eabc..eae9e84 100644
--- a/src/hlr.c
+++ b/src/hlr.c
@@ -560,6 +560,9 @@
case OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST:
forward_mo_sms(req);
break;
+ case OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST:
+ forward_mt_sms(req);
+ break;
default:
LOGP(DMAIN, LOGL_DEBUG, "Unhandled GSUP message type %s\n",
osmo_gsup_message_type_name(req->gsup.message_type));
diff --git a/src/hlr_sms.c b/src/hlr_sms.c
index 672d6c9..c8c8e49 100644
--- a/src/hlr_sms.c
+++ b/src/hlr_sms.c
@@ -190,3 +190,31 @@
strlen(smsc->name) + 1);
osmo_gsup_forward_to_local_peer(req->cb_data, &dest_peer, req, NULL);
}
+
+/***********************************************************************
+ * forwarding of MT SMS from SMSCs to MSC/VLR based on IMSI
+ ***********************************************************************/
+
+void forward_mt_sms(struct osmo_gsup_req *req)
+{
+ struct hlr_subscriber subscr;
+ struct osmo_cni_peer_id dest_peer;
+ int rc;
+
+ rc = db_subscr_get_by_imsi(g_hlr->dbc, req->gsup.imsi, &subscr);
+ if (rc < 0) {
+ osmo_gsup_req_respond_err(req, GMM_CAUSE_IMSI_UNKNOWN,
+ "IMSI unknown");
+ return;
+ }
+ /* is this subscriber currently attached to a VLR? */
+ if (!subscr.vlr_number[0]) {
+ osmo_gsup_req_respond_err(req, GMM_CAUSE_IMPL_DETACHED,
+ "subscriber not attached to a VLR");
+ return;
+ }
+ osmo_cni_peer_id_set(&dest_peer, OSMO_CNI_PEER_ID_IPA_NAME,
+ (const uint8_t *) subscr.vlr_number,
+ strlen(subscr.vlr_number) + 1);
+ osmo_gsup_forward_to_local_peer(req->cb_data, &dest_peer, req, NULL);
+}
--
To view, visit
https://gerrit.osmocom.org/c/osmo-hlr/+/34450?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Change-Id: Ib3551bf7839690606c677461758c5cfef5f0aa7b
Gerrit-Change-Number: 34450
Gerrit-PatchSet: 4
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged