aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/vty_interface_layer3.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-07-26 20:01:07 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-07-26 20:01:07 +0800
commitdaf753477e52f744de428a64e68462e3f898f31c (patch)
treed43d3bec48a7fe24671f0171b5c3c74f20208106 /openbsc/src/vty_interface_layer3.c
parent742fc700117d7c81c55b3df7a2486654067a8771 (diff)
gsm_04_80: Add untested code for USSD notification...
One should be able to send a USSD Notification to a given subscriber if we has an active link...
Diffstat (limited to 'openbsc/src/vty_interface_layer3.c')
-rw-r--r--openbsc/src/vty_interface_layer3.c44
1 files changed, 44 insertions, 0 deletions
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);