aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openbsc/include/openbsc/gsm_04_80.h2
-rw-r--r--openbsc/src/gsm_04_80.c20
-rw-r--r--openbsc/src/vty_interface_layer3.c44
3 files changed, 66 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/gsm_04_80.h b/openbsc/include/openbsc/gsm_04_80.h
index e0a7c3623..8215ca736 100644
--- a/openbsc/include/openbsc/gsm_04_80.h
+++ b/openbsc/include/openbsc/gsm_04_80.h
@@ -29,4 +29,6 @@ struct msgb *gsm0480_create_unstructuredSS_Notify(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);
+
#endif
diff --git a/openbsc/src/gsm_04_80.c b/openbsc/src/gsm_04_80.c
index 462d9789e..135582d1d 100644
--- a/openbsc/src/gsm_04_80.c
+++ b/openbsc/src/gsm_04_80.c
@@ -449,3 +449,23 @@ 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)
+{
+ struct gsm48_hdr *gh;
+ struct msgb *msg;
+
+ msg = gsm0480_create_unstructuredSS_Notify(text);
+ if (!msg)
+ return -1;
+
+ gsm0480_wrap_invoke(msg, GSM0480_OP_CODE_USS_NOTIFY, 0);
+ gsm0480_wrap_facility(msg);
+
+ /* And finally pre-pend the L3 header */
+ gh = (struct gsm48_hdr *) msgb_push(msg, sizeof(*gh));
+ gh->proto_discr = GSM48_PDISC_NC_SS;
+ gh->msg_type = GSM0480_MTYPE_REGISTER;
+
+ return gsm0808_submit_dtap(conn, msg, 0);
+}
diff --git a/openbsc/src/vty_interface_layer3.c b/openbsc/src/vty_interface_layer3.c
index 157260a59..34e61bb5b 100644
--- a/openbsc/src/vty_interface_layer3.c
+++ b/openbsc/src/vty_interface_layer3.c
@@ -42,6 +42,8 @@
#include <openbsc/signal.h>
#include <openbsc/debug.h>
#include <openbsc/vty.h>
+#include <openbsc/gsm_04_80.h>
+#include <openbsc/chan_alloc.h>
extern struct gsm_network *gsmnet_from_vty(struct vty *v);
@@ -371,6 +373,47 @@ DEFUN(subscriber_silent_call_stop,
return CMD_SUCCESS;
}
+DEFUN(subscriber_ussd_notify,
+ subscriber_ussd_notify_cmd,
+ "subscriber " SUBSCR_TYPES " ID ussd-notify .TEXT",
+ SUBSCR_HELP "USSD Notify\n"
+ "Subscriber ID\n"
+ "Text Message to send\n")
+{
+ char *text;
+ struct gsm_subscriber_connection *conn;
+ struct gsm_network *gsmnet = gsmnet_from_vty(vty);
+ struct gsm_subscriber *subscr = get_subscr_by_argv(gsmnet, argv[0], argv[1]);
+ int rc;
+
+ if (!subscr) {
+ vty_out(vty, "%% No subscriber found for %s %s%s",
+ argv[0], argv[1], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ text = argv_concat(argv, argc, 2);
+ if (!text) {
+ subscr_put(subscr);
+ return CMD_WARNING;
+ }
+
+ conn = connection_for_subscr(subscr);
+ if (!conn) {
+ vty_out(vty, "%% An active connection is required for %s %s%s",
+ argv[0], argv[1], VTY_NEWLINE);
+ subscr_put(subscr);
+ talloc_free(text);
+ return CMD_WARNING;
+ }
+
+ gsm0480_send_ussdNotify(conn, text);
+
+ subscr_put(subscr);
+ talloc_free(text);
+ return CMD_SUCCESS;
+}
+
DEFUN(ena_subscr_authorizde,
ena_subscr_authorized_cmd,
"subscriber " SUBSCR_TYPES " ID authorized (0|1)",
@@ -582,6 +625,7 @@ int bsc_vty_init_extra(void)
install_element_ve(&subscriber_silent_sms_cmd);
install_element_ve(&subscriber_silent_call_start_cmd);
install_element_ve(&subscriber_silent_call_stop_cmd);
+ install_element_ve(&subscriber_ussd_notify_cmd);
install_element_ve(&show_stats_cmd);
install_element(ENABLE_NODE, &ena_subscr_name_cmd);