blob: 515cfa7fbfe4b26d74d2d28191ab72291d246142 [file] [log] [blame]
Holger Hans Peter Freyther620c2e62010-11-14 20:38:06 +01001/*
2 * ipaccess audio handling
3 *
4 * (C) 2009-2010 by Holger Hans Peter Freyther <zecke@selfish.org>
5 * (C) 2009-2010 by On-Waves
6 * All Rights Reserved
7 *
8 * This program is free software; you can redistribute it and/or modify
Harald Welte9af6ddf2011-01-01 15:25:50 +01009 * it under the terms of the GNU Affero General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
Holger Hans Peter Freyther620c2e62010-11-14 20:38:06 +010011 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Harald Welte9af6ddf2011-01-01 15:25:50 +010016 * GNU Affero General Public License for more details.
Holger Hans Peter Freyther620c2e62010-11-14 20:38:06 +010017 *
Harald Welte9af6ddf2011-01-01 15:25:50 +010018 * You should have received a copy of the GNU Affero General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
Holger Hans Peter Freyther620c2e62010-11-14 20:38:06 +010020 *
21 */
22
23#include <openbsc/osmo_msc_data.h>
24#include <openbsc/osmo_bsc.h>
Holger Hans Peter Freythere2fee352010-12-22 12:32:56 +010025#include <openbsc/abis_rsl.h>
Holger Hans Peter Freyther620c2e62010-11-14 20:38:06 +010026#include <openbsc/gsm_data.h>
27#include <openbsc/debug.h>
28#include <openbsc/signal.h>
29
30#include <arpa/inet.h>
31
32static int handle_abisip_signal(unsigned int subsys, unsigned int signal,
33 void *handler_data, void *signal_data)
34{
35 struct gsm_subscriber_connection *con;
36 struct gsm_lchan *lchan = signal_data;
37 int rc;
38
39 if (subsys != SS_ABISIP)
40 return 0;
41
42 con = lchan->conn;
43 if (!con || !con->sccp_con)
44 return 0;
45
46 switch (signal) {
47 case S_ABISIP_CRCX_ACK:
48 /* we can ask it to connect now */
49 LOGP(DMSC, LOGL_DEBUG, "Connecting BTS to port: %d conn: %d\n",
50 con->sccp_con->rtp_port, lchan->abis_ip.conn_id);
51
52 rc = rsl_ipacc_mdcx(lchan, ntohl(INADDR_ANY),
53 con->sccp_con->rtp_port,
54 lchan->abis_ip.rtp_payload2);
55 if (rc < 0) {
56 LOGP(DMSC, LOGL_ERROR, "Failed to send MDCX: %d\n", rc);
57 return rc;
58 }
59 break;
60 }
61
62 return 0;
63}
64
65int osmo_bsc_audio_init(struct gsm_network *net)
66{
67 net->hardcoded_rtp_payload = 98;
68 register_signal_handler(SS_ABISIP, handle_abisip_signal, net);
69 return 0;
70}