blob: 8db84f9fa69d0a412b5ad4e47c801a31ad70b6ea [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
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (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
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 */
23
24#include <openbsc/osmo_msc_data.h>
25#include <openbsc/osmo_bsc.h>
Holger Hans Peter Freythere2fee352010-12-22 12:32:56 +010026#include <openbsc/abis_rsl.h>
Holger Hans Peter Freyther620c2e62010-11-14 20:38:06 +010027#include <openbsc/gsm_data.h>
28#include <openbsc/debug.h>
29#include <openbsc/signal.h>
30
31#include <arpa/inet.h>
32
33static int handle_abisip_signal(unsigned int subsys, unsigned int signal,
34 void *handler_data, void *signal_data)
35{
36 struct gsm_subscriber_connection *con;
37 struct gsm_lchan *lchan = signal_data;
38 int rc;
39
40 if (subsys != SS_ABISIP)
41 return 0;
42
43 con = lchan->conn;
44 if (!con || !con->sccp_con)
45 return 0;
46
47 switch (signal) {
48 case S_ABISIP_CRCX_ACK:
49 /* we can ask it to connect now */
50 LOGP(DMSC, LOGL_DEBUG, "Connecting BTS to port: %d conn: %d\n",
51 con->sccp_con->rtp_port, lchan->abis_ip.conn_id);
52
53 rc = rsl_ipacc_mdcx(lchan, ntohl(INADDR_ANY),
54 con->sccp_con->rtp_port,
55 lchan->abis_ip.rtp_payload2);
56 if (rc < 0) {
57 LOGP(DMSC, LOGL_ERROR, "Failed to send MDCX: %d\n", rc);
58 return rc;
59 }
60 break;
61 }
62
63 return 0;
64}
65
66int osmo_bsc_audio_init(struct gsm_network *net)
67{
68 net->hardcoded_rtp_payload = 98;
69 register_signal_handler(SS_ABISIP, handle_abisip_signal, net);
70 return 0;
71}