Change in osmo-hlr[master]: USSD: add special 'idle' handler to IUSE for testing

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Tue Nov 17 21:54:08 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hlr/+/21183 )

Change subject: USSD: add special 'idle' handler to IUSE for testing
......................................................................

USSD: add special 'idle' handler to IUSE for testing

Change-Id: I0d566a60e95ce2da951f22ad47c6155c5b6a338c
---
M doc/manuals/chapters/ussd.adoc
M src/hlr_ussd.c
M src/hlr_vty.c
M tests/test_nodes.vty
4 files changed, 24 insertions(+), 4 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/doc/manuals/chapters/ussd.adoc b/doc/manuals/chapters/ussd.adoc
index 3ab587f..6100c93 100644
--- a/doc/manuals/chapters/ussd.adoc
+++ b/doc/manuals/chapters/ussd.adoc
@@ -67,7 +67,9 @@
 can be assigned to one or more USSD request prefixes:
 
 * `own-msisdn` returns subscriber's MSISDN (if assigned);
-* `own-imsi` returns subscriber's IMSI.
+* `own-imsi` returns subscriber's IMSI;
+* `test-idle` keeps the session idle until the MS terminates it, or
+  the guard timer expires (may be useful for testing).
 
 Additional handlers can be added on request.
 
diff --git a/src/hlr_ussd.c b/src/hlr_ussd.c
index 399bdbc..35b74b6 100644
--- a/src/hlr_ussd.c
+++ b/src/hlr_ussd.c
@@ -379,6 +379,19 @@
 	return 0;
 }
 
+/* This handler just keeps the session idle unless the guard timer expires. */
+static int handle_ussd_test_idle(struct ss_session *ss,
+				 const struct osmo_gsup_message *gsup,
+				 const struct ss_request *req)
+{
+	char buf[GSM0480_USSD_7BIT_STRING_LEN + 1];
+	snprintf(buf, sizeof(buf), "Keeping your session idle, it will expire "
+		 "at most in %u seconds.", g_hlr->ncss_guard_timeout);
+	ss->state = OSMO_GSUP_SESSION_STATE_CONTINUE;
+	ss_tx_to_ms_ussd_7bit(ss, req->invoke_id, buf);
+	return 0;
+}
+
 
 static const struct hlr_iuse hlr_iuses[] = {
 	{
@@ -389,6 +402,10 @@
 		.name = "own-imsi",
 		.handle_ussd = handle_ussd_own_imsi,
 	},
+	{
+		.name = "test-idle",
+		.handle_ussd = handle_ussd_test_idle,
+	},
 };
 
 const struct hlr_iuse *iuse_find(const char *name)
diff --git a/src/hlr_vty.c b/src/hlr_vty.c
index a054cbe..4b91aa9 100644
--- a/src/hlr_vty.c
+++ b/src/hlr_vty.c
@@ -174,10 +174,11 @@
 #define UROUTE_STR "Routing Configuration\n"
 #define PREFIX_STR "Prefix-Matching Route\n" "USSD Prefix\n"
 
-#define INT_CHOICE "(own-msisdn|own-imsi)"
+#define INT_CHOICE "(own-msisdn|own-imsi|test-idle)"
 #define INT_STR "Internal USSD Handler\n" \
 		"Respond with subscribers' own MSISDN\n" \
-		"Respond with subscribers' own IMSI\n"
+		"Respond with subscribers' own IMSI\n" \
+		"Keep the session idle (useful for testing)\n"
 
 #define EXT_STR "External USSD Handler\n" \
 		"Name of External USSD Handler (IPA CCM ID)\n"
diff --git a/tests/test_nodes.vty b/tests/test_nodes.vty
index d9971f7..cf1707a 100644
--- a/tests/test_nodes.vty
+++ b/tests/test_nodes.vty
@@ -51,7 +51,7 @@
   database PATH
   euse NAME
   no euse NAME
-  ussd route prefix PREFIX internal (own-msisdn|own-imsi)
+  ussd route prefix PREFIX internal (own-msisdn|own-imsi|test-idle)
   ussd route prefix PREFIX external EUSE
   no ussd route prefix PREFIX
   ussd default-route external EUSE

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/21183
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Change-Id: I0d566a60e95ce2da951f22ad47c6155c5b6a338c
Gerrit-Change-Number: 21183
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201117/9458e800/attachment.htm>


More information about the gerrit-log mailing list