aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-11-14 20:38:06 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-11-15 20:06:50 +0100
commit620c2e678ac00831a425310194c8c8450318c134 (patch)
tree031caaa25ca26d4cc1c0e5aa0f0750e72a54b4c9
parentdbc698aef010abfb8efc4be310a6f9fe043cdb5a (diff)
bsc: Add thr audio module to send the MDCX message to the BTS
-rw-r--r--openbsc/include/openbsc/osmo_msc_data.h7
-rw-r--r--openbsc/src/bsc/Makefile.am2
-rw-r--r--openbsc/src/bsc/osmo_bsc_audio.c70
-rw-r--r--openbsc/src/bsc/osmo_bsc_main.c5
4 files changed, 81 insertions, 3 deletions
diff --git a/openbsc/include/openbsc/osmo_msc_data.h b/openbsc/include/openbsc/osmo_msc_data.h
index caf49ef19..5c769c1cd 100644
--- a/openbsc/include/openbsc/osmo_msc_data.h
+++ b/openbsc/include/openbsc/osmo_msc_data.h
@@ -29,10 +29,11 @@
#include <osmocore/timer.h>
struct osmo_bsc_rf;
+struct gsm_network;
struct gsm_audio_support {
- u_int8_t hr : 1,
- ver : 7;
+ uint8_t hr : 1,
+ ver : 7;
};
struct osmo_msc_data {
@@ -71,4 +72,6 @@ int osmo_bsc_msc_init(struct gsm_network *network);
int osmo_bsc_sccp_init(struct gsm_network *gsmnet);
int msc_queue_write(struct bsc_msc_connection *conn, struct msgb *msg, int proto);
+int osmo_bsc_audio_init(struct gsm_network *network);
+
#endif
diff --git a/openbsc/src/bsc/Makefile.am b/openbsc/src/bsc/Makefile.am
index fe2dff0a1..9ebc84632 100644
--- a/openbsc/src/bsc/Makefile.am
+++ b/openbsc/src/bsc/Makefile.am
@@ -7,7 +7,7 @@ bin_PROGRAMS = osmo-bsc
osmo_bsc_SOURCES = osmo_bsc_main.c osmo_bsc_rf.c osmo_bsc_vty.c osmo_bsc_api.c \
osmo_bsc_grace.c osmo_bsc_msc.c osmo_bsc_sccp.c \
- osmo_bsc_filter.c osmo_bsc_bssap.c \
+ osmo_bsc_filter.c osmo_bsc_bssap.c osmo_bsc_audio.c \
$(top_srcdir)/src/debug.c $(top_srcdir)/src/bsc_msc.c \
$(top_srcdir)/src/bsc_init.c
osmo_bsc_LDADD = $(top_builddir)/src/libvty.a \
diff --git a/openbsc/src/bsc/osmo_bsc_audio.c b/openbsc/src/bsc/osmo_bsc_audio.c
new file mode 100644
index 000000000..134926391
--- /dev/null
+++ b/openbsc/src/bsc/osmo_bsc_audio.c
@@ -0,0 +1,70 @@
+/*
+ * ipaccess audio handling
+ *
+ * (C) 2009-2010 by Holger Hans Peter Freyther <zecke@selfish.org>
+ * (C) 2009-2010 by On-Waves
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include <openbsc/osmo_msc_data.h>
+#include <openbsc/osmo_bsc.h>
+#include <openbsc/gsm_data.h>
+#include <openbsc/debug.h>
+#include <openbsc/signal.h>
+
+#include <arpa/inet.h>
+
+static int handle_abisip_signal(unsigned int subsys, unsigned int signal,
+ void *handler_data, void *signal_data)
+{
+ struct gsm_subscriber_connection *con;
+ struct gsm_lchan *lchan = signal_data;
+ int rc;
+
+ if (subsys != SS_ABISIP)
+ return 0;
+
+ con = lchan->conn;
+ if (!con || !con->sccp_con)
+ return 0;
+
+ switch (signal) {
+ case S_ABISIP_CRCX_ACK:
+ /* we can ask it to connect now */
+ LOGP(DMSC, LOGL_DEBUG, "Connecting BTS to port: %d conn: %d\n",
+ con->sccp_con->rtp_port, lchan->abis_ip.conn_id);
+
+ rc = rsl_ipacc_mdcx(lchan, ntohl(INADDR_ANY),
+ con->sccp_con->rtp_port,
+ lchan->abis_ip.rtp_payload2);
+ if (rc < 0) {
+ LOGP(DMSC, LOGL_ERROR, "Failed to send MDCX: %d\n", rc);
+ return rc;
+ }
+ break;
+ }
+
+ return 0;
+}
+
+int osmo_bsc_audio_init(struct gsm_network *net)
+{
+ net->hardcoded_rtp_payload = 98;
+ register_signal_handler(SS_ABISIP, handle_abisip_signal, net);
+ return 0;
+}
diff --git a/openbsc/src/bsc/osmo_bsc_main.c b/openbsc/src/bsc/osmo_bsc_main.c
index 285106202..956eab507 100644
--- a/openbsc/src/bsc/osmo_bsc_main.c
+++ b/openbsc/src/bsc/osmo_bsc_main.c
@@ -236,6 +236,11 @@ int main(int argc, char **argv)
exit(1);
}
+ if (osmo_bsc_audio_init(bsc_gsmnet) != 0) {
+ LOGP(DMSC, LOGL_ERROR, "Failed to register audio support.\n");
+ exit(1);
+ }
+
signal(SIGINT, &signal_handler);
signal(SIGABRT, &signal_handler);
signal(SIGUSR1, &signal_handler);