mirror of
https://gerrit.osmocom.org/osmo-gbproxy
synced 2024-08-18 08:56:23 +00:00
[VTY] Add feature to send silent SMS from console
"Silent SMS" is a SMS that is delivered (and confirmed) but not shown on the display of the phone. You can now send such SMS by using sms send silent extension 12345 text or sms send silent imsi 123451234512345 text
This commit is contained in:
parent
c73d983daf
commit
9ee8ee9afc
1 changed files with 46 additions and 4 deletions
|
@ -194,12 +194,12 @@ struct gsm_sms *sms_from_text(struct gsm_subscriber *receiver, const char *text)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _send_sms_buffer(struct gsm_subscriber *receiver,
|
static int _send_sms_buffer(struct gsm_subscriber *receiver,
|
||||||
struct buffer *b)
|
struct buffer *b, u_int8_t tp_pid)
|
||||||
{
|
{
|
||||||
struct gsm_sms *sms;
|
struct gsm_sms *sms;
|
||||||
|
|
||||||
sms = sms_from_text(receiver, buffer_getstr(b));
|
sms = sms_from_text(receiver, buffer_getstr(b));
|
||||||
|
sms->protocol_id = tp_pid;
|
||||||
gsm411_send_sms_subscr(receiver, sms);
|
gsm411_send_sms_subscr(receiver, sms);
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
|
@ -219,7 +219,27 @@ DEFUN(sms_send_ext,
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
|
|
||||||
b = argv_to_buffer(argc, argv, 1);
|
b = argv_to_buffer(argc, argv, 1);
|
||||||
rc = _send_sms_buffer(receiver, b);
|
rc = _send_sms_buffer(receiver, b, 0);
|
||||||
|
buffer_free(b);
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUN(sms_send_silent_ext,
|
||||||
|
sms_send_silent_ext_cmd,
|
||||||
|
"sms send silent extension EXTEN .LINE",
|
||||||
|
"Send a silent message to a subscriber identified by EXTEN")
|
||||||
|
{
|
||||||
|
struct gsm_subscriber *receiver;
|
||||||
|
struct buffer *b;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
receiver = subscr_get_by_extension(gsmnet, argv[0]);
|
||||||
|
if (!receiver)
|
||||||
|
return CMD_WARNING;
|
||||||
|
|
||||||
|
b = argv_to_buffer(argc, argv, 1);
|
||||||
|
rc = _send_sms_buffer(receiver, b, 64);
|
||||||
buffer_free(b);
|
buffer_free(b);
|
||||||
subscr_put(receiver);
|
subscr_put(receiver);
|
||||||
|
|
||||||
|
@ -240,7 +260,27 @@ DEFUN(sms_send_imsi,
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
|
|
||||||
b = argv_to_buffer(argc, argv, 1);
|
b = argv_to_buffer(argc, argv, 1);
|
||||||
rc = _send_sms_buffer(receiver, b);
|
rc = _send_sms_buffer(receiver, b, 0);
|
||||||
|
buffer_free(b);
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUN(sms_send_silent_imsi,
|
||||||
|
sms_send_silent_imsi_cmd,
|
||||||
|
"sms send silent imsi IMSI .LINE",
|
||||||
|
"Send a silent message to a subscriber identified by IMSI")
|
||||||
|
{
|
||||||
|
struct gsm_subscriber *receiver;
|
||||||
|
struct buffer *b;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
receiver = subscr_get_by_imsi(gsmnet, argv[0]);
|
||||||
|
if (!receiver)
|
||||||
|
return CMD_WARNING;
|
||||||
|
|
||||||
|
b = argv_to_buffer(argc, argv, 1);
|
||||||
|
rc = _send_sms_buffer(receiver, b, 64);
|
||||||
buffer_free(b);
|
buffer_free(b);
|
||||||
subscr_put(receiver);
|
subscr_put(receiver);
|
||||||
|
|
||||||
|
@ -307,6 +347,8 @@ int bsc_vty_init_extra(struct gsm_network *net)
|
||||||
install_element(VIEW_NODE, &sms_send_pend_cmd);
|
install_element(VIEW_NODE, &sms_send_pend_cmd);
|
||||||
install_element(VIEW_NODE, &sms_send_ext_cmd);
|
install_element(VIEW_NODE, &sms_send_ext_cmd);
|
||||||
install_element(VIEW_NODE, &sms_send_imsi_cmd);
|
install_element(VIEW_NODE, &sms_send_imsi_cmd);
|
||||||
|
install_element(VIEW_NODE, &sms_send_silent_ext_cmd);
|
||||||
|
install_element(VIEW_NODE, &sms_send_silent_imsi_cmd);
|
||||||
|
|
||||||
install_element(CONFIG_NODE, &cfg_subscr_cmd);
|
install_element(CONFIG_NODE, &cfg_subscr_cmd);
|
||||||
install_node(&subscr_node, dummy_config_write);
|
install_node(&subscr_node, dummy_config_write);
|
||||||
|
|
Loading…
Reference in a new issue