aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-11-17 04:17:46 +0700
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-11-17 18:50:27 +0700
commitdac855e5c85250c7113c5c5af2f54f799369f1d1 (patch)
tree6e4854297b17b29f22820e14e06a87b01fa0e3b9 /src
parent6a6c7f87ca3d51085f01389b36c30096da6d6417 (diff)
USSD: add special 'idle' handler to IUSE for testing
Diffstat (limited to 'src')
-rw-r--r--src/hlr_ussd.c17
-rw-r--r--src/hlr_vty.c5
2 files changed, 20 insertions, 2 deletions
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 @@ static int handle_ussd_own_imsi(struct ss_session *ss,
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 @@ static const struct hlr_iuse hlr_iuses[] = {
.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 @@ DEFUN(cfg_hlr_gsup_ipa_name,
#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"