SS/USSD: implement an IUSE for getting RAN type(s)
Change-Id: I8d95413784b039df50a4cdcac49289060f0414c6
This commit is contained in:
parent
7d29e3473a
commit
4bd7bdb958
|
@ -320,6 +320,41 @@ static int handle_ussd_own_imsi(struct osmo_gsup_conn *conn, struct ss_session *
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int handle_ussd_get_ran(struct osmo_gsup_conn *conn, struct ss_session *ss,
|
||||
const struct osmo_gsup_message *gsup,
|
||||
const struct ss_request *req)
|
||||
{
|
||||
struct hlr_subscriber subscr;
|
||||
const char *response;
|
||||
int rc;
|
||||
|
||||
#define RAN_TYPE_DESC "Available RAN types: "
|
||||
|
||||
rc = db_subscr_get_by_imsi(g_hlr->dbc, ss->imsi, &subscr);
|
||||
switch (rc) {
|
||||
case 0:
|
||||
if (subscr.rat_types[OSMO_RAT_GERAN_A] && subscr.rat_types[OSMO_RAT_UTRAN_IU])
|
||||
response = RAN_TYPE_DESC "GERAN-A (2G) & UTRAN-Iu (3G)";
|
||||
else if (subscr.rat_types[OSMO_RAT_GERAN_A])
|
||||
response = RAN_TYPE_DESC "GERAN-A (2G)";
|
||||
else if (subscr.rat_types[OSMO_RAT_UTRAN_IU])
|
||||
response = RAN_TYPE_DESC "UTRAN-Iu (3G)";
|
||||
else
|
||||
response = "No RAN types available";
|
||||
|
||||
rc = ss_tx_ussd_7bit(ss, true, req->invoke_id, response);
|
||||
break;
|
||||
case -ENOENT:
|
||||
rc = ss_tx_error(ss, true, GSM0480_ERR_CODE_UNKNOWN_SUBSCRIBER);
|
||||
break;
|
||||
case -EIO:
|
||||
default:
|
||||
rc = ss_tx_error(ss, true, GSM0480_ERR_CODE_SYSTEM_FAILURE);
|
||||
break;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static const struct hlr_iuse hlr_iuses[] = {
|
||||
{
|
||||
|
@ -330,6 +365,10 @@ static const struct hlr_iuse hlr_iuses[] = {
|
|||
.name = "own-imsi",
|
||||
.handle_ussd = handle_ussd_own_imsi,
|
||||
},
|
||||
{
|
||||
.name = "get-ran",
|
||||
.handle_ussd = handle_ussd_get_ran,
|
||||
},
|
||||
};
|
||||
|
||||
const struct hlr_iuse *iuse_find(const char *name)
|
||||
|
|
|
@ -133,10 +133,11 @@ DEFUN(cfg_hlr_gsup_bind_ip,
|
|||
#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|get-ran)"
|
||||
#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" \
|
||||
"Respond with available RAN types\n"
|
||||
|
||||
#define EXT_STR "External USSD Handler\n" \
|
||||
"Name of External USSD Handler (IPA CCM ID)\n"
|
||||
|
|
Loading…
Reference in New Issue