aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc/osmo_bsc_audio.c
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2017-07-04 23:08:44 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2017-08-27 17:40:52 +0200
commited3157ce46cde0f3973a5ee0a0a53909f361ae7c (patch)
tree072f9b723003554bead716390f6ed8bf7351d103 /src/osmo-bsc/osmo_bsc_audio.c
parent2758330b6ab37ff30afca8306080f0e82ef5a732 (diff)
move openbsc/* to repos root
This is the first step in creating this repository from the legacy openbsc.git. Like all other Osmocom repositories, keep the autoconf and automake files in the repository root. openbsc.git has been the sole exception, which ends now. Change-Id: I9c6f2a448d9cb1cc088cf1cf6918b69d7e69b4e7
Diffstat (limited to 'src/osmo-bsc/osmo_bsc_audio.c')
-rw-r--r--src/osmo-bsc/osmo_bsc_audio.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/osmo-bsc/osmo_bsc_audio.c b/src/osmo-bsc/osmo_bsc_audio.c
new file mode 100644
index 00000000..11602090
--- /dev/null
+++ b/src/osmo-bsc/osmo_bsc_audio.c
@@ -0,0 +1,73 @@
+/*
+ * 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 Affero General Public License as published by
+ * the Free Software Foundation; either version 3 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <openbsc/bsc_msc_data.h>
+#include <openbsc/osmo_bsc.h>
+#include <openbsc/abis_rsl.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:
+ /*
+ * TODO: handle handover here... then the audio should go to
+ * the old mgcp port..
+ */
+ /* 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)
+{
+ osmo_signal_register_handler(SS_ABISIP, handle_abisip_signal, net);
+ return 0;
+}