summaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmsc/smpp_openbsc.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-11-09 12:51:44 +0100
committerHarald Welte <laforge@gnumonks.org>2012-11-16 22:00:10 +0100
commit8a1b056bff391892eef87fcd646bedf4450a5ae8 (patch)
treeaafe2c4b4c2759da486de5b209b77eeff1cc6fb7 /openbsc/src/libmsc/smpp_openbsc.c
parent9ad036242982b64862449ca645ac1cba8dca1ffc (diff)
SMPP: Implement ALERT NOTIFICATION on attach/detach of subscribers
Diffstat (limited to 'openbsc/src/libmsc/smpp_openbsc.c')
-rw-r--r--openbsc/src/libmsc/smpp_openbsc.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/openbsc/src/libmsc/smpp_openbsc.c b/openbsc/src/libmsc/smpp_openbsc.c
index ff61babbd..c2e4c2852 100644
--- a/openbsc/src/libmsc/smpp_openbsc.c
+++ b/openbsc/src/libmsc/smpp_openbsc.c
@@ -238,6 +238,40 @@ static int smpp_sms_cb(unsigned int subsys, unsigned int signal,
return rc;
}
+/*! \brief signal handler for subscriber related signals */
+static int smpp_subscr_cb(unsigned int subsys, unsigned int signal,
+ void *handler_data, void *signal_data)
+{
+ struct gsm_subscriber *subscr = signal_data;
+ struct smsc *smsc = handler_data;
+ struct osmo_esme *esme;
+ uint8_t smpp_avail_status;
+
+ /* determine the smpp_avail_status depending on attach/detach */
+ switch (signal) {
+ case S_SUBSCR_ATTACHED:
+ smpp_avail_status = 0;
+ break;
+ case S_SUBSCR_DETACHED:
+ smpp_avail_status = 2;
+ break;
+ default:
+ return 0;
+ }
+
+ 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 */
+ smpp_tx_alert(esme, TON_Subscriber_Number,
+ NPI_Land_Mobile_E212, subscr->imsi,
+ smpp_avail_status);
+ }
+
+ return 0;
+}
+
/*! \brief Initialize the OpenBSC SMPP interface */
int smpp_openbsc_init(struct gsm_network *net, uint16_t port)
{
@@ -251,7 +285,7 @@ int smpp_openbsc_init(struct gsm_network *net, uint16_t port)
talloc_free(smsc);
osmo_signal_register_handler(SS_SMS, smpp_sms_cb, net);
+ osmo_signal_register_handler(SS_SUBSCR, smpp_subscr_cb, smsc);
return rc;
}
-