aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2012-12-03 15:32:54 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2012-12-03 15:32:54 +0100
commitd2361d970af8fe5d624ed3977982c21c327ac986 (patch)
treee1db89ddfc673219c74dbbf565ae9eefe0f35b25
parentf589221ed0a00c12fce0fac629475851b2680b77 (diff)
bsc: Send the USSD message after the location updating accept.
Make sure to accept the phone first before sending the USSD message.
-rw-r--r--openbsc/include/openbsc/bsc_nat.h4
-rw-r--r--openbsc/include/openbsc/osmo_bsc.h3
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_bssap.c11
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_filter.c18
4 files changed, 25 insertions, 11 deletions
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h
index 696b904b4..7e59c6318 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/bsc_nat.h
@@ -1,6 +1,6 @@
/*
- * (C) 2010-2011 by Holger Hans Peter Freyther <zecke@selfish.org>
- * (C) 2010-2011 by On-Waves
+ * (C) 2010-2012 by Holger Hans Peter Freyther <zecke@selfish.org>
+ * (C) 2010-2012 by On-Waves
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
diff --git a/openbsc/include/openbsc/osmo_bsc.h b/openbsc/include/openbsc/osmo_bsc.h
index 0bc39dc1e..1d216ac25 100644
--- a/openbsc/include/openbsc/osmo_bsc.h
+++ b/openbsc/include/openbsc/osmo_bsc.h
@@ -5,6 +5,8 @@
#include "bsc_api.h"
+#define BSS_SEND_USSD 1
+
struct sccp_connection;
struct osmo_msc_data;
struct bsc_msc_connection;
@@ -39,6 +41,7 @@ int bsc_delete_connection(struct osmo_bsc_sccp_con *sccp);
struct osmo_msc_data *bsc_find_msc(struct gsm_subscriber_connection *conn, struct msgb *);
int bsc_scan_bts_msg(struct gsm_subscriber_connection *conn, struct msgb *msg);
int bsc_scan_msc_msg(struct gsm_subscriber_connection *conn, struct msgb *msg);
+int bsc_send_welcome_ussd(struct gsm_subscriber_connection *conn);
int bsc_handle_udt(struct osmo_msc_data *msc, struct msgb *msg, unsigned int length);
int bsc_handle_dt1(struct osmo_bsc_sccp_con *conn, struct msgb *msg, unsigned int len);
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_bssap.c b/openbsc/src/osmo-bsc/osmo_bsc_bssap.c
index 684a6c186..4190abf18 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_bssap.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_bssap.c
@@ -1,6 +1,6 @@
/* GSM 08.08 BSSMAP handling */
-/* (C) 2009-2011 by Holger Hans Peter Freyther <zecke@selfish.org>
- * (C) 2009-2011 by On-Waves
+/* (C) 2009-2012 by Holger Hans Peter Freyther <zecke@selfish.org>
+ * (C) 2009-2012 by On-Waves
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
@@ -459,6 +459,7 @@ static int dtap_rcvmsg(struct osmo_bsc_sccp_con *conn,
struct dtap_header *header;
struct msgb *gsm48;
uint8_t *data;
+ int rc;
LOGP(DMSC, LOGL_DEBUG, "Rx MSC DTAP: %s\n",
osmo_hexdump(msg->l3h, length));
@@ -495,8 +496,10 @@ static int dtap_rcvmsg(struct osmo_bsc_sccp_con *conn,
memcpy(data, msg->l3h + sizeof(*header), length - sizeof(*header));
/* pass it to the filter for extra actions */
- bsc_scan_msc_msg(conn->conn, gsm48);
- return gsm0808_submit_dtap(conn->conn, gsm48, header->link_id, 1);
+ rc = bsc_scan_msc_msg(conn->conn, gsm48);
+ gsm0808_submit_dtap(conn->conn, gsm48, header->link_id, 1);
+ if (rc == BSS_SEND_USSD)
+ bsc_send_welcome_ussd(conn->conn);
}
int bsc_handle_udt(struct osmo_msc_data *msc,
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_filter.c b/openbsc/src/osmo-bsc/osmo_bsc_filter.c
index 3b657b320..957ceaf95 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_filter.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_filter.c
@@ -225,23 +225,30 @@ int bsc_scan_bts_msg(struct gsm_subscriber_connection *conn, struct msgb *msg)
return 0;
}
-static void send_welcome_ussd(struct gsm_subscriber_connection *conn)
+static int send_welcome_ussd(struct gsm_subscriber_connection *conn)
{
struct osmo_bsc_sccp_con *bsc_con;
bsc_con = conn->sccp_con;
if (!bsc_con) {
LOGP(DMSC, LOGL_DEBUG, "No SCCP connection associated.\n");
- return;
+ return 0;
}
if (!bsc_con->msc->ussd_welcome_txt) {
LOGP(DMSC, LOGL_DEBUG, "No USSD Welcome text defined.\n");
- return;
+ return 0;
}
- gsm0480_send_ussdNotify(conn, 1, bsc_con->msc->ussd_welcome_txt);
+ return BSS_SEND_USSD;
+}
+
+int bsc_send_welcome_ussd(struct gsm_subscriber_connection *conn)
+{
+ gsm0480_send_ussdNotify(conn, 1, conn->sccp_con->msc->ussd_welcome_txt);
gsm0480_send_releaseComplete(conn);
+
+ return 0;
}
/**
@@ -276,7 +283,8 @@ int bsc_scan_msc_msg(struct gsm_subscriber_connection *conn, struct msgb *msg)
}
if (conn->sccp_con->new_subscriber)
- send_welcome_ussd(conn);
+ return send_welcome_ussd(conn);
+ return 0;
}
return 0;