aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith <keith@rhizomatica.org>2019-01-17 01:01:59 +0100
committerKeith Whyte <keith@rhizomatica.org>2019-01-17 14:03:27 +0000
commitc6d219cd830eca9f371fe6ef781d240e4f7874a4 (patch)
tree093ee7207ae298be7932f5435ab28a25fbc4e5c5
parent0e8dfadc7a28143a0c5984c34e9a015c6c04a3e6 (diff)
Make alert notifications vty configurable per ESME
Adds (no) alert-notifications as a per-esme vty command, in order to allow some ESMEs to be excluded from alerts. The default is still to send alert notifications to all esme, so no changes are required to the config file to maintain identical operation after this patch. Change-Id: I57f4d268ca6fe6a233f2caaffce62e4aade01274
-rw-r--r--src/libmsc/smpp_openbsc.c9
-rw-r--r--src/libmsc/smpp_smsc.c1
-rw-r--r--src/libmsc/smpp_smsc.h1
-rw-r--r--src/libmsc/smpp_vty.c26
4 files changed, 35 insertions, 2 deletions
diff --git a/src/libmsc/smpp_openbsc.c b/src/libmsc/smpp_openbsc.c
index 10f3cfaad..fb9b0f832 100644
--- a/src/libmsc/smpp_openbsc.c
+++ b/src/libmsc/smpp_openbsc.c
@@ -283,8 +283,13 @@ static void alert_all_esme(struct smsc *smsc, struct vlr_subscr *vsub,
llist_for_each_entry(esme, &smsc->esme_list, list) {
/* we currently send an alert notification to each ESME that is
* connected, and do not require a (non-existant) delivery
- * pending flag to be set before, FIXME: make this VTY
- * configurable */
+ * pending flag to be set before. */
+ if (!esme->acl->alert_notifications) {
+ LOGP(DSMPP, LOGL_DEBUG,
+ "[%s] is not set to receive Alert Notifications\n",
+ esme->system_id);
+ continue;
+ }
if (esme->acl && esme->acl->deliver_src_imsi) {
smpp_tx_alert(esme, TON_Subscriber_Number,
NPI_Land_Mobile_E212,
diff --git a/src/libmsc/smpp_smsc.c b/src/libmsc/smpp_smsc.c
index ea5303c0d..2350d84a1 100644
--- a/src/libmsc/smpp_smsc.c
+++ b/src/libmsc/smpp_smsc.c
@@ -148,6 +148,7 @@ struct osmo_smpp_acl *smpp_acl_alloc(struct smsc *smsc, const char *sys_id)
acl->smsc = smsc;
strcpy(acl->system_id, sys_id);
+ acl->alert_notifications = 1;
INIT_LLIST_HEAD(&acl->route_list);
llist_add_tail(&acl->list, &smsc->acl_list);
diff --git a/src/libmsc/smpp_smsc.h b/src/libmsc/smpp_smsc.h
index 27a2646ab..dc7b7c1ad 100644
--- a/src/libmsc/smpp_smsc.h
+++ b/src/libmsc/smpp_smsc.h
@@ -68,6 +68,7 @@ struct osmo_smpp_acl {
int deliver_src_imsi;
int osmocom_ext;
int dcs_transparent;
+ int alert_notifications;
struct llist_head route_list;
};
diff --git a/src/libmsc/smpp_vty.c b/src/libmsc/smpp_vty.c
index be55c4de4..589670787 100644
--- a/src/libmsc/smpp_vty.c
+++ b/src/libmsc/smpp_vty.c
@@ -499,6 +499,28 @@ DEFUN(cfg_esme_no_dcs_transp, cfg_esme_no_dcs_transp_cmd,
return CMD_SUCCESS;
}
+DEFUN(cfg_esme_alert_notif, cfg_esme_alert_notif_cmd,
+ "alert-notifications",
+ "Disable sending of SMPP Alert Notifications for this ESME")
+{
+ struct osmo_smpp_acl *acl = vty->index;
+
+ acl->alert_notifications = 1;
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_esme_no_alert_notif, cfg_esme_no_alert_notif_cmd,
+ "no alert-notifications", NO_STR
+ "Disable sending of SMPP Alert Notifications for this ESME")
+{
+ struct osmo_smpp_acl *acl = vty->index;
+
+ acl->alert_notifications = 0;
+
+ return CMD_SUCCESS;
+}
+
static void dump_one_esme(struct vty *vty, struct osmo_esme *esme)
{
@@ -560,6 +582,8 @@ static void config_write_esme_single(struct vty *vty, struct osmo_smpp_acl *acl)
vty_out(vty, " osmocom-extensions%s", VTY_NEWLINE);
if (acl->dcs_transparent)
vty_out(vty, " dcs-transparent%s", VTY_NEWLINE);
+ if (acl->alert_notifications)
+ vty_out(vty, " alert-notifications%s", VTY_NEWLINE);
llist_for_each_entry(r, &acl->route_list, list)
write_esme_route_single(vty, r);
@@ -603,6 +627,8 @@ int smpp_vty_init(void)
install_element(SMPP_ESME_NODE, &cfg_esme_no_osmo_ext_cmd);
install_element(SMPP_ESME_NODE, &cfg_esme_dcs_transp_cmd);
install_element(SMPP_ESME_NODE, &cfg_esme_no_dcs_transp_cmd);
+ install_element(SMPP_ESME_NODE, &cfg_esme_alert_notif_cmd);
+ install_element(SMPP_ESME_NODE, &cfg_esme_no_alert_notif_cmd);
install_element_ve(&show_esme_cmd);