blob: 134926391df9757acc2a3f4589ad57e23728fb68 [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>
26#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}