aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-07-29 20:29:28 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-07-29 20:29:28 +0800
commitcaecc9ad80aa4a1f8784417f9b77a8e73a995c73 (patch)
treea9606f8cadbe2e3193729417a992f1c9a90e9688 /openbsc
parentc00bf8f9307ea07ea0644dcf381c466d57dec59e (diff)
osmo-grace: Send USSD messages on the TCH to inform the user..
Send a USSD notification to the user to inform him that the service will go away in a second..
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/Makefile.am2
-rw-r--r--openbsc/src/bsc_msc_grace.c35
2 files changed, 36 insertions, 1 deletions
diff --git a/openbsc/src/Makefile.am b/openbsc/src/Makefile.am
index 3c4d9f3ba..89aae8156 100644
--- a/openbsc/src/Makefile.am
+++ b/openbsc/src/Makefile.am
@@ -35,7 +35,7 @@ bsc_hack_LDADD = libmsc.a libbsc.a libmsc.a libvty.a -ldl -ldbi $(LIBCRYPT)
bs11_config_SOURCES = bs11_config.c abis_nm.c gsm_data.c debug.c \
rs232.c bts_siemens_bs11.c
bsc_msc_ip_SOURCES = bssap.c bsc_msc_ip.c bsc_init.c vty_interface.c vty_interface_bsc.c \
- bsc_msc.c bsc_msc_rf.c bsc_msc_grace.c
+ bsc_msc.c bsc_msc_rf.c bsc_msc_grace.c gsm_04_80.c
bsc_msc_ip_LDADD = libbsc.a libvty.a libsccp.a
diff --git a/openbsc/src/bsc_msc_grace.c b/openbsc/src/bsc_msc_grace.c
index bd95be2e2..91dfcba32 100644
--- a/openbsc/src/bsc_msc_grace.c
+++ b/openbsc/src/bsc_msc_grace.c
@@ -21,6 +21,7 @@
#include <openbsc/bsc_msc_grace.h>
#include <openbsc/bsc_msc_rf.h>
+#include <openbsc/gsm_04_80.h>
#include <openbsc/signal.h>
int bsc_grace_allow_new_connection(struct gsm_network *network)
@@ -28,6 +29,22 @@ int bsc_grace_allow_new_connection(struct gsm_network *network)
return network->rf->policy == S_RF_ON;
}
+static int handle_sub(struct gsm_lchan *lchan, const char *text)
+{
+ /* only send it to TCH */
+ if (lchan->type != GSM_LCHAN_TCH_H && lchan->type != GSM_LCHAN_TCH_F)
+ return -1;
+
+ /* only when active */
+ if (lchan->state != LCHAN_S_ACTIVE)
+ return -1;
+
+ gsm0480_send_ussdNotify(lchan, 0, text);
+ gsm0480_send_releaseComplete(lchan);
+
+ return 0;
+}
+
/*
* The place to handle the grace mode. Right now we will send
* USSD messages to the subscriber, in the future we might start
@@ -35,6 +52,24 @@ int bsc_grace_allow_new_connection(struct gsm_network *network)
*/
static int handle_grace(struct gsm_network *network)
{
+ int ts_nr, lchan_nr;
+ struct gsm_bts *bts;
+ struct gsm_bts_trx *trx;
+
+ if (!network->ussd_grace_txt)
+ return 0;
+
+ llist_for_each_entry(bts, &network->bts_list, list) {
+ llist_for_each_entry(trx, &bts->trx_list, list) {
+ for (ts_nr = 0; ts_nr < TRX_NR_TS; ++ts_nr) {
+ struct gsm_bts_trx_ts *ts = &trx->ts[ts_nr];
+ for (lchan_nr = 0; lchan_nr < TS_MAX_LCHAN; ++lchan_nr) {
+ handle_sub(&ts->lchan[lchan_nr],
+ network->ussd_grace_txt);
+ }
+ }
+ }
+ }
return 0;
}