sms: Make default SMS validity period configurable via VTY

Change-Id: Ie2c81c1d5795dd9aaf07b9766013f20b01abc762
changes/37/28137/5
Harald Welte 5 months ago committed by laforge
parent e6f1160046
commit 2765a18450
  1. 1
      include/osmocom/msc/sms_queue.h
  2. 2
      src/libmsc/smpp_openbsc.c
  3. 1
      src/libmsc/sms_queue.c
  4. 14
      src/libmsc/smsc_vty.c
  5. 1
      tests/test_nodes.vty

@ -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 default_validity_mins; /* default validity period in minutes */
};
struct sms_queue_config *sms_queue_cfg_alloc(void *ctx);

@ -263,7 +263,7 @@ static int submit_to_sms(struct gsm_sms **psms, struct gsm_network *net,
t_validity_absolute = smpp_parse_time_format((const char *) submit->validity_period, &t_now);
if (!t_validity_absolute)
sms->validity_minutes = 7 * 24 * 60; /* default: 7 days */
sms->validity_minutes = net->sms_queue_cfg->default_validity_mins;
else
sms->validity_minutes = (t_validity_absolute - t_now) / 60;

@ -474,6 +474,7 @@ struct sms_queue_config *sms_queue_cfg_alloc(void *ctx)
sqcfg->max_fail = 1;
sqcfg->delete_delivered = true;
sqcfg->delete_expired = true;
sqcfg->default_validity_mins = 7 * 24 * 60; /* 7 days */
sqcfg->db_file_path = talloc_strdup(ctx, SMS_DEFAULT_DB_FILE_PATH);
return sqcfg;

@ -98,6 +98,17 @@ DEFUN(cfg_sms_db_del_expired, cfg_sms_db_del_expired_cmd,
return CMD_SUCCESS;
}
DEFUN(cfg_sms_def_val_per, cfg_sms_def_val_per_cmd,
"validity-period default <1-5256000>",
"Configure validity period for SMS\n"
"Default SMS validity period in minutes\n"
"Default SMS validity period in minutes\n")
{
smqcfg->default_validity_mins = atoi(argv[0]);
return CMD_SUCCESS;
}
/***********************************************************************
* View / Enable Node
***********************************************************************/
@ -166,6 +177,8 @@ 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 default %u%s", smqcfg->default_validity_mins, VTY_NEWLINE);
return 0;
}
@ -183,6 +196,7 @@ void smsc_vty_init(struct gsm_network *msc_network)
install_element(SMSC_NODE, &cfg_sms_queue_fail_cmd);
install_element(SMSC_NODE, &cfg_sms_db_del_delivered_cmd);
install_element(SMSC_NODE, &cfg_sms_db_del_expired_cmd);
install_element(SMSC_NODE, &cfg_sms_def_val_per_cmd);
/* enable node */
install_element(ENABLE_NODE, &smsqueue_trigger_cmd);

@ -183,6 +183,7 @@ smsc
queue max-failure 1
database delete-delivered 1
database delete-expired 1
validity-period default 10080
end
OsmoMSC# configure terminal

Loading…
Cancel
Save