gsm_04_80: Allow to specify the alert pattern for the notification

Allow to specify the level (not the category) of the notification
this provides an easy way to test it on the phones.
This commit is contained in:
Holger Hans Peter Freyther 2010-07-27 18:27:46 +08:00
parent 44d0f19787
commit e731e1d6dd
3 changed files with 18 additions and 9 deletions

View File

@ -24,12 +24,12 @@ int gsm0480_send_ussd_reject(struct gsm_subscriber_connection *conn,
const struct ussd_request *request);
struct msgb *gsm0480_create_notifySS(const char *text);
struct msgb *gsm0480_create_unstructuredSS_Notify(const char *text);
struct msgb *gsm0480_create_unstructuredSS_Notify(int alertLevel, const char *text);
int gsm0480_wrap_invoke(struct msgb *msg, int op, int link_id);
int gsm0480_wrap_facility(struct msgb *msg);
int gsm0480_send_ussdNotify(struct gsm_subscriber_connection *conn, const char *text);
int gsm0480_send_ussdNotify(struct gsm_subscriber_connection *conn, int level, const char *text);
int gsm0480_send_releaseComplete(struct gsm_subscriber_connection *conn);
#endif

View File

@ -314,7 +314,7 @@ struct msgb *gsm0480_create_notifySS(const char *text)
return msg;
}
struct msgb *gsm0480_create_unstructuredSS_Notify(const char *text)
struct msgb *gsm0480_create_unstructuredSS_Notify(int alertPattern, const char *text)
{
struct msgb *msg;
uint8_t *seq_len_ptr, *ussd_len_ptr, *data;
@ -343,7 +343,13 @@ struct msgb *gsm0480_create_unstructuredSS_Notify(const char *text)
ussd_len_ptr[0] = len;
/* USSD-String } */
seq_len_ptr[0] = 3 + 2 + ussd_len_ptr[0];
/* alertingPattern { */
msgb_put_u8(msg, ASN1_OCTET_STRING_TAG);
msgb_put_u8(msg, 1);
msgb_put_u8(msg, alertPattern);
/* } alertingPattern */
seq_len_ptr[0] = 3 + 2 + ussd_len_ptr[0] + 3;
/* } SEQUENCE */
return msg;
@ -456,12 +462,12 @@ int gsm0480_send_ussd_reject(struct gsm_subscriber_connection *conn,
return gsm0808_submit_dtap(conn, msg, 0);
}
int gsm0480_send_ussdNotify(struct gsm_subscriber_connection *conn, const char *text)
int gsm0480_send_ussdNotify(struct gsm_subscriber_connection *conn, int level, const char *text)
{
struct gsm48_hdr *gh;
struct msgb *msg;
msg = gsm0480_create_unstructuredSS_Notify(text);
msg = gsm0480_create_unstructuredSS_Notify(level, text);
if (!msg)
return -1;

View File

@ -375,9 +375,10 @@ DEFUN(subscriber_silent_call_stop,
DEFUN(subscriber_ussd_notify,
subscriber_ussd_notify_cmd,
"subscriber " SUBSCR_TYPES " ID ussd-notify .TEXT",
"subscriber " SUBSCR_TYPES " ID ussd-notify (0|1|2) .TEXT",
SUBSCR_HELP "USSD Notify\n"
"Subscriber ID\n"
"Alerting Level\n"
"Text Message to send\n")
{
char *text;
@ -385,6 +386,7 @@ DEFUN(subscriber_ussd_notify,
struct gsm_network *gsmnet = gsmnet_from_vty(vty);
struct gsm_subscriber *subscr = get_subscr_by_argv(gsmnet, argv[0], argv[1]);
int rc;
int level;
if (!subscr) {
vty_out(vty, "%% No subscriber found for %s %s%s",
@ -392,7 +394,8 @@ DEFUN(subscriber_ussd_notify,
return CMD_WARNING;
}
text = argv_concat(argv, argc, 2);
level = atoi(argv[2]);
text = argv_concat(argv, argc, 3);
if (!text) {
subscr_put(subscr);
return CMD_WARNING;
@ -407,7 +410,7 @@ DEFUN(subscriber_ussd_notify,
return CMD_WARNING;
}
gsm0480_send_ussdNotify(conn, text);
gsm0480_send_ussdNotify(conn, level, text);
gsm0480_send_releaseComplete(conn);
subscr_put(subscr);