aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/msc/sms_queue.h1
-rw-r--r--src/libmsc/gsm_04_11.c6
-rw-r--r--src/libmsc/smpp_openbsc.c7
-rw-r--r--src/libmsc/sms_queue.c1
-rw-r--r--src/libmsc/smsc_vty.c11
-rw-r--r--tests/test_nodes.vty2
6 files changed, 25 insertions, 3 deletions
diff --git a/include/osmocom/msc/sms_queue.h b/include/osmocom/msc/sms_queue.h
index c3a6cfb5c..a6e6aebd3 100644
--- a/include/osmocom/msc/sms_queue.h
+++ b/include/osmocom/msc/sms_queue.h
@@ -13,6 +13,7 @@ struct sms_queue_config {
int max_pending; /* maximum number of gsm_sms_pending in RAM */
bool delete_delivered; /* delete delivered SMS from DB? */
bool delete_expired; /* delete expired SMS from DB? */
+ unsigned int minimum_validity_mins; /* minimum validity period in minutes */
unsigned int default_validity_mins; /* default validity period in minutes */
};
diff --git a/src/libmsc/gsm_04_11.c b/src/libmsc/gsm_04_11.c
index 722973e77..743e2722b 100644
--- a/src/libmsc/gsm_04_11.c
+++ b/src/libmsc/gsm_04_11.c
@@ -626,6 +626,12 @@ static int gsm340_rx_tpdu(struct gsm_trans *trans, struct msgb *msg,
osmo_hexdump(gsms->user_data, gsms->user_data_len));
gsms->validity_minutes = gsm340_validity_period(sms_vpf, sms_vp);
+ if (gsms->validity_minutes < net->sms_queue_cfg->minimum_validity_mins) {
+ LOG_TRANS(trans, LOGL_INFO, "Overriding user-provided validity period (%lu) "
+ "with minimum SMSC validity period (%u) minutes\n", gsms->validity_minutes,
+ net->sms_queue_cfg->minimum_validity_mins);
+ gsms->validity_minutes = net->sms_queue_cfg->minimum_validity_mins;
+ }
rc = sms_route_mt_sms(trans, gsms);
diff --git a/src/libmsc/smpp_openbsc.c b/src/libmsc/smpp_openbsc.c
index 64d4f1e2e..91666a9ca 100644
--- a/src/libmsc/smpp_openbsc.c
+++ b/src/libmsc/smpp_openbsc.c
@@ -267,6 +267,13 @@ static int submit_to_sms(struct gsm_sms **psms, struct gsm_network *net,
else
sms->validity_minutes = (t_validity_absolute - t_now) / 60;
+ if (sms->validity_minutes < net->sms_queue_cfg->minimum_validity_mins) {
+ LOGP(DLSMS, LOGL_INFO, "SMS to %s: Overriding ESME-provided validity period (%lu) "
+ "with minimum SMSC validity period (%u) minutes\n", submit->destination_addr,
+ sms->validity_minutes, net->sms_queue_cfg->minimum_validity_mins);
+ sms->validity_minutes = net->sms_queue_cfg->minimum_validity_mins;
+ }
+
*psms = sms;
return ESME_ROK;
}
diff --git a/src/libmsc/sms_queue.c b/src/libmsc/sms_queue.c
index 24811c513..9f18f4feb 100644
--- a/src/libmsc/sms_queue.c
+++ b/src/libmsc/sms_queue.c
@@ -475,6 +475,7 @@ struct sms_queue_config *sms_queue_cfg_alloc(void *ctx)
sqcfg->delete_delivered = true;
sqcfg->delete_expired = true;
sqcfg->default_validity_mins = 7 * 24 * 60; /* 7 days */
+ sqcfg->minimum_validity_mins = 1;
sqcfg->db_file_path = talloc_strdup(ctx, SMS_DEFAULT_DB_FILE_PATH);
return sqcfg;
diff --git a/src/libmsc/smsc_vty.c b/src/libmsc/smsc_vty.c
index 547b7d58e..e99b23657 100644
--- a/src/libmsc/smsc_vty.c
+++ b/src/libmsc/smsc_vty.c
@@ -99,12 +99,16 @@ DEFUN(cfg_sms_db_del_expired, cfg_sms_db_del_expired_cmd,
}
DEFUN(cfg_sms_def_val_per, cfg_sms_def_val_per_cmd,
- "validity-period default <1-5256000>",
+ "validity-period (minimum|default) <1-5256000>",
"Configure validity period for SMS\n"
+ "Minimum SMS validity period in minutes\n"
"Default SMS validity period in minutes\n"
- "Default SMS validity period in minutes\n")
+ "Validity period in minutes\n")
{
- smqcfg->default_validity_mins = atoi(argv[0]);
+ if (!strcmp(argv[0], "minimum"))
+ smqcfg->minimum_validity_mins = atoi(argv[1]);
+ else
+ smqcfg->default_validity_mins = atoi(argv[1]);
return CMD_SUCCESS;
}
@@ -177,6 +181,7 @@ static int config_write_smsc(struct vty *vty)
vty_out(vty, " database delete-delivered %u%s", smqcfg->delete_delivered, VTY_NEWLINE);
vty_out(vty, " database delete-expired %u%s", smqcfg->delete_expired, VTY_NEWLINE);
+ vty_out(vty, " validity-period minimum %u%s", smqcfg->minimum_validity_mins, VTY_NEWLINE);
vty_out(vty, " validity-period default %u%s", smqcfg->default_validity_mins, VTY_NEWLINE);
return 0;
diff --git a/tests/test_nodes.vty b/tests/test_nodes.vty
index ac3ff1639..8ffb2bdf9 100644
--- a/tests/test_nodes.vty
+++ b/tests/test_nodes.vty
@@ -183,6 +183,8 @@ smsc
queue max-failure 1
database delete-delivered 1
database delete-expired 1
+ validity-period minimum 1
+ validity-period default 10080
end
OsmoMSC# configure terminal