summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/host/layer23/include/osmocom/bb/mobile/settings.h1
-rw-r--r--src/host/layer23/src/mobile/gsm411_sms.c16
-rw-r--r--src/host/layer23/src/mobile/settings.c2
-rw-r--r--src/host/layer23/src/mobile/vty_interface.c22
4 files changed, 37 insertions, 4 deletions
diff --git a/src/host/layer23/include/osmocom/bb/mobile/settings.h b/src/host/layer23/include/osmocom/bb/mobile/settings.h
index a1bce06b..4e5d5a19 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/settings.h
+++ b/src/host/layer23/include/osmocom/bb/mobile/settings.h
@@ -21,6 +21,7 @@ struct gsm_settings {
/* SMS */
char sms_sca[22];
+ bool store_sms;
/* test card simulator settings */
char test_imsi[16];
diff --git a/src/host/layer23/src/mobile/gsm411_sms.c b/src/host/layer23/src/mobile/gsm411_sms.c
index fe13ba1b..623ba538 100644
--- a/src/host/layer23/src/mobile/gsm411_sms.c
+++ b/src/host/layer23/src/mobile/gsm411_sms.c
@@ -177,8 +177,8 @@ static int gsm411_trans_free(struct gsm_trans *trans)
* receive SMS
*/
-/* now here comes our SMS */
-static int gsm340_rx_sms_deliver(struct osmocom_ms *ms, struct msgb *msg,
+/* store the SMS to disk */
+static int sms_store(struct osmocom_ms *ms, struct msgb *msg,
struct gsm_sms *gsms)
{
const char osmocomsms[] = ".osmocom/bb/sms.txt";
@@ -187,8 +187,6 @@ static int gsm340_rx_sms_deliver(struct osmocom_ms *ms, struct msgb *msg,
char vty_text[sizeof(gsms->text)], *p;
FILE *fp;
- mobile_prim_ntfy_sms_new(ms, gsms);
-
/* remove linefeeds and show at VTY */
strcpy(vty_text, gsms->text);
for (p = vty_text; *p; p++) {
@@ -222,6 +220,16 @@ fail:
return 0;
}
+/* now here comes our SMS */
+static int gsm340_rx_sms_deliver(struct osmocom_ms *ms, struct msgb *msg,
+ struct gsm_sms *gsms)
+{
+ mobile_prim_ntfy_sms_new(ms, gsms);
+ if (!ms->settings.store_sms)
+ return 0;
+ return sms_store(ms, msg, gsms);
+}
+
/* process an incoming TPDU (called from RP-DATA)
* return value > 0: RP CAUSE for ERROR; < 0: silent error; 0 = success */
static int gsm340_rx_tpdu(struct gsm_trans *trans, struct msgb *msg, uint8_t msg_ref)
diff --git a/src/host/layer23/src/mobile/settings.c b/src/host/layer23/src/mobile/settings.c
index f1c0cfcd..7370b0ab 100644
--- a/src/host/layer23/src/mobile/settings.c
+++ b/src/host/layer23/src/mobile/settings.c
@@ -92,6 +92,8 @@ int gsm_settings_init(struct osmocom_ms *ms)
set->any_timeout = MOB_C7_DEFLT_ANY_TIMEOUT;
+ set->store_sms = true;
+
INIT_LLIST_HEAD(&set->abbrev);
return 0;
diff --git a/src/host/layer23/src/mobile/vty_interface.c b/src/host/layer23/src/mobile/vty_interface.c
index f8ecb28c..ec1216ff 100644
--- a/src/host/layer23/src/mobile/vty_interface.c
+++ b/src/host/layer23/src/mobile/vty_interface.c
@@ -1766,6 +1766,26 @@ DEFUN(cfg_ms_no_sms_sca, cfg_ms_no_sms_sca_cmd, "no sms-service-center",
return CMD_SUCCESS;
}
+DEFUN(cfg_ms_no_sms_store, cfg_ms_no_sms_store_cmd, "no sms-store",
+ NO_STR "Store SMS in the home directory")
+{
+ struct osmocom_ms *ms = vty->index;
+ struct gsm_settings *set = &ms->settings;
+
+ set->store_sms = false;
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_ms_sms_store, cfg_ms_sms_store_cmd, "sms-store",
+ "Store SMS in the home directory")
+{
+ struct osmocom_ms *ms = vty->index;
+ struct gsm_settings *set = &ms->settings;
+
+ set->store_sms = true;
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_no_cw, cfg_ms_no_cw_cmd, "no call-waiting",
NO_STR "Disallow waiting calls")
{
@@ -2909,6 +2929,8 @@ int ms_vty_init(void)
install_element(MS_NODE, &cfg_ms_neighbour_cmd);
install_element(MS_NODE, &cfg_ms_no_neighbour_cmd);
install_element(MS_NODE, &cfg_ms_any_timeout_cmd);
+ install_element(MS_NODE, &cfg_ms_sms_store_cmd);
+ install_element(MS_NODE, &cfg_ms_no_sms_store_cmd);
install_element(MS_NODE, &cfg_ms_support_cmd);
install_node(&support_node, config_write_dummy);
install_element(SUPPORT_NODE, &cfg_ms_sup_dtmf_cmd);