mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
synced 2025-10-24 16:43:39 +00:00
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...
This commit is contained in:
@@ -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_invoke(struct msgb *msg, int op, int link_id);
|
||||||
int gsm0480_wrap_facility(struct msgb *msg);
|
int gsm0480_wrap_facility(struct msgb *msg);
|
||||||
|
|
||||||
|
int gsm0480_send_ussdNotify(struct gsm_subscriber_connection *conn, const char *text);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -449,3 +449,23 @@ int gsm0480_send_ussd_reject(struct gsm_subscriber_connection *conn,
|
|||||||
|
|
||||||
return gsm0808_submit_dtap(conn, msg, 0);
|
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);
|
||||||
|
}
|
||||||
|
|||||||
@@ -42,6 +42,8 @@
|
|||||||
#include <openbsc/signal.h>
|
#include <openbsc/signal.h>
|
||||||
#include <openbsc/debug.h>
|
#include <openbsc/debug.h>
|
||||||
#include <openbsc/vty.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);
|
extern struct gsm_network *gsmnet_from_vty(struct vty *v);
|
||||||
|
|
||||||
@@ -371,6 +373,47 @@ DEFUN(subscriber_silent_call_stop,
|
|||||||
return CMD_SUCCESS;
|
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,
|
DEFUN(ena_subscr_authorizde,
|
||||||
ena_subscr_authorized_cmd,
|
ena_subscr_authorized_cmd,
|
||||||
"subscriber " SUBSCR_TYPES " ID authorized (0|1)",
|
"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_sms_cmd);
|
||||||
install_element_ve(&subscriber_silent_call_start_cmd);
|
install_element_ve(&subscriber_silent_call_start_cmd);
|
||||||
install_element_ve(&subscriber_silent_call_stop_cmd);
|
install_element_ve(&subscriber_silent_call_stop_cmd);
|
||||||
|
install_element_ve(&subscriber_ussd_notify_cmd);
|
||||||
install_element_ve(&show_stats_cmd);
|
install_element_ve(&show_stats_cmd);
|
||||||
|
|
||||||
install_element(ENABLE_NODE, &ena_subscr_name_cmd);
|
install_element(ENABLE_NODE, &ena_subscr_name_cmd);
|
||||||
|
|||||||
Reference in New Issue
Block a user