Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 1 | /* mncc_builtin.c - default, minimal built-in MNCC Application for |
Alexander Couzens | fbd96f5 | 2016-08-29 18:40:02 +0200 | [diff] [blame] | 2 | * standalone bsc_hack (network-in-the-box mode) */ |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 3 | |
| 4 | /* (C) 2008-2010 by Harald Welte <laforge@gnumonks.org> |
| 5 | * (C) 2009 by Andreas Eversberg <Andreas.Eversberg@versatel.de> |
| 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 | |
| 25 | #include <stdio.h> |
| 26 | #include <stdlib.h> |
| 27 | #include <string.h> |
| 28 | #include <errno.h> |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 29 | |
| 30 | #include <openbsc/gsm_04_08.h> |
| 31 | #include <openbsc/debug.h> |
| 32 | #include <openbsc/mncc.h> |
Harald Welte | ab386e6 | 2011-09-01 18:18:43 +0200 | [diff] [blame] | 33 | #include <openbsc/mncc_int.h> |
Pablo Neira Ayuso | 136f453 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 34 | #include <osmocom/core/talloc.h> |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 35 | #include <openbsc/gsm_data.h> |
| 36 | #include <openbsc/transaction.h> |
| 37 | #include <openbsc/rtp_proxy.h> |
| 38 | |
| 39 | void *tall_call_ctx; |
| 40 | |
| 41 | static LLIST_HEAD(call_list); |
| 42 | |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 43 | static uint32_t new_callref = 0x00000001; |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 44 | |
Harald Welte | ab386e6 | 2011-09-01 18:18:43 +0200 | [diff] [blame] | 45 | struct mncc_int mncc_int = { |
Andreas Eversberg | a83d511 | 2013-12-07 18:32:28 +0100 | [diff] [blame] | 46 | .def_codec = { GSM48_CMODE_SPEECH_V1, GSM48_CMODE_SPEECH_V1 }, |
Harald Welte | ab386e6 | 2011-09-01 18:18:43 +0200 | [diff] [blame] | 47 | }; |
| 48 | |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 49 | static void free_call(struct gsm_call *call) |
| 50 | { |
| 51 | llist_del(&call->entry); |
| 52 | DEBUGP(DMNCC, "(call %x) Call removed.\n", call->callref); |
| 53 | talloc_free(call); |
| 54 | } |
| 55 | |
| 56 | |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 57 | static struct gsm_call *get_call_ref(uint32_t callref) |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 58 | { |
| 59 | struct gsm_call *callt; |
| 60 | |
| 61 | llist_for_each_entry(callt, &call_list, entry) { |
| 62 | if (callt->callref == callref) |
| 63 | return callt; |
| 64 | } |
| 65 | return NULL; |
| 66 | } |
| 67 | |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 68 | /* on incoming call, look up database and send setup to remote subscr. */ |
| 69 | static int mncc_setup_ind(struct gsm_call *call, int msg_type, |
| 70 | struct gsm_mncc *setup) |
| 71 | { |
| 72 | struct gsm_mncc mncc; |
| 73 | struct gsm_call *remote; |
| 74 | |
| 75 | memset(&mncc, 0, sizeof(struct gsm_mncc)); |
| 76 | mncc.callref = call->callref; |
| 77 | |
| 78 | /* already have remote call */ |
| 79 | if (call->remote_ref) |
| 80 | return 0; |
| 81 | |
| 82 | /* transfer mode 1 would be packet mode, which was never specified */ |
| 83 | if (setup->bearer_cap.mode != 0) { |
| 84 | LOGP(DMNCC, LOGL_NOTICE, "(call %x) We don't support " |
| 85 | "packet mode\n", call->callref); |
| 86 | mncc_set_cause(&mncc, GSM48_CAUSE_LOC_PRN_S_LU, |
| 87 | GSM48_CC_CAUSE_BEARER_CA_UNAVAIL); |
| 88 | goto out_reject; |
| 89 | } |
| 90 | |
| 91 | /* we currently only do speech */ |
| 92 | if (setup->bearer_cap.transfer != GSM_MNCC_BCAP_SPEECH) { |
| 93 | LOGP(DMNCC, LOGL_NOTICE, "(call %x) We only support " |
| 94 | "voice calls\n", call->callref); |
| 95 | mncc_set_cause(&mncc, GSM48_CAUSE_LOC_PRN_S_LU, |
| 96 | GSM48_CC_CAUSE_BEARER_CA_UNAVAIL); |
| 97 | goto out_reject; |
| 98 | } |
| 99 | |
| 100 | /* create remote call */ |
Andreas Eversberg | c5e0851 | 2013-01-25 08:36:32 +0100 | [diff] [blame] | 101 | if (!(remote = talloc_zero(tall_call_ctx, struct gsm_call))) { |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 102 | mncc_set_cause(&mncc, GSM48_CAUSE_LOC_PRN_S_LU, |
| 103 | GSM48_CC_CAUSE_RESOURCE_UNAVAIL); |
| 104 | goto out_reject; |
| 105 | } |
| 106 | llist_add_tail(&remote->entry, &call_list); |
| 107 | remote->net = call->net; |
| 108 | remote->callref = new_callref++; |
| 109 | DEBUGP(DMNCC, "(call %x) Creating new remote instance %x.\n", |
| 110 | call->callref, remote->callref); |
| 111 | |
| 112 | /* link remote call */ |
| 113 | call->remote_ref = remote->callref; |
| 114 | remote->remote_ref = call->callref; |
| 115 | |
Harald Welte | bf0a7c9 | 2012-08-24 16:48:21 +0200 | [diff] [blame] | 116 | /* send call proceeding */ |
| 117 | memset(&mncc, 0, sizeof(struct gsm_mncc)); |
| 118 | mncc.callref = call->callref; |
| 119 | DEBUGP(DMNCC, "(call %x) Accepting call.\n", call->callref); |
| 120 | mncc_tx_to_cc(call->net, MNCC_CALL_PROC_REQ, &mncc); |
| 121 | |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 122 | /* modify mode */ |
| 123 | memset(&mncc, 0, sizeof(struct gsm_mncc)); |
| 124 | mncc.callref = call->callref; |
Neels Hofmeyr | 0e5a7c4 | 2017-05-08 15:12:20 +0200 | [diff] [blame] | 125 | DEBUGP(DMNCC, "(call %x) Modify channel mode\n", call->callref); |
Harald Welte | 7655637 | 2010-12-22 23:57:45 +0100 | [diff] [blame] | 126 | mncc_tx_to_cc(call->net, MNCC_LCHAN_MODIFY, &mncc); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 127 | |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 128 | /* send setup to remote */ |
| 129 | // setup->fields |= MNCC_F_SIGNAL; |
| 130 | // setup->signal = GSM48_SIGNAL_DIALTONE; |
| 131 | setup->callref = remote->callref; |
| 132 | DEBUGP(DMNCC, "(call %x) Forwarding SETUP to remote.\n", call->callref); |
Harald Welte | 7655637 | 2010-12-22 23:57:45 +0100 | [diff] [blame] | 133 | return mncc_tx_to_cc(remote->net, MNCC_SETUP_REQ, setup); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 134 | |
| 135 | out_reject: |
Harald Welte | 7655637 | 2010-12-22 23:57:45 +0100 | [diff] [blame] | 136 | mncc_tx_to_cc(call->net, MNCC_REJ_REQ, &mncc); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 137 | free_call(call); |
| 138 | return 0; |
| 139 | } |
| 140 | |
| 141 | static int mncc_alert_ind(struct gsm_call *call, int msg_type, |
| 142 | struct gsm_mncc *alert) |
| 143 | { |
| 144 | struct gsm_call *remote; |
| 145 | |
| 146 | /* send alerting to remote */ |
| 147 | if (!(remote = get_call_ref(call->remote_ref))) |
| 148 | return 0; |
| 149 | alert->callref = remote->callref; |
| 150 | DEBUGP(DMNCC, "(call %x) Forwarding ALERT to remote.\n", call->callref); |
Harald Welte | 7655637 | 2010-12-22 23:57:45 +0100 | [diff] [blame] | 151 | return mncc_tx_to_cc(remote->net, MNCC_ALERT_REQ, alert); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 152 | } |
| 153 | |
| 154 | static int mncc_notify_ind(struct gsm_call *call, int msg_type, |
| 155 | struct gsm_mncc *notify) |
| 156 | { |
| 157 | struct gsm_call *remote; |
| 158 | |
| 159 | /* send notify to remote */ |
| 160 | if (!(remote = get_call_ref(call->remote_ref))) |
| 161 | return 0; |
| 162 | notify->callref = remote->callref; |
| 163 | DEBUGP(DMNCC, "(call %x) Forwarding NOTIF to remote.\n", call->callref); |
Harald Welte | 7655637 | 2010-12-22 23:57:45 +0100 | [diff] [blame] | 164 | return mncc_tx_to_cc(remote->net, MNCC_NOTIFY_REQ, notify); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 165 | } |
| 166 | |
| 167 | static int mncc_setup_cnf(struct gsm_call *call, int msg_type, |
| 168 | struct gsm_mncc *connect) |
| 169 | { |
| 170 | struct gsm_mncc connect_ack, frame_recv; |
| 171 | struct gsm_network *net = call->net; |
| 172 | struct gsm_call *remote; |
Harald Welte | 53d51f5 | 2015-12-03 14:59:04 +0100 | [diff] [blame] | 173 | struct gsm_mncc_bridge bridge = { .msg_type = MNCC_BRIDGE }; |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 174 | |
| 175 | /* acknowledge connect */ |
| 176 | memset(&connect_ack, 0, sizeof(struct gsm_mncc)); |
| 177 | connect_ack.callref = call->callref; |
| 178 | DEBUGP(DMNCC, "(call %x) Acknowledge SETUP.\n", call->callref); |
Harald Welte | 7655637 | 2010-12-22 23:57:45 +0100 | [diff] [blame] | 179 | mncc_tx_to_cc(call->net, MNCC_SETUP_COMPL_REQ, &connect_ack); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 180 | |
| 181 | /* send connect message to remote */ |
| 182 | if (!(remote = get_call_ref(call->remote_ref))) |
| 183 | return 0; |
| 184 | connect->callref = remote->callref; |
| 185 | DEBUGP(DMNCC, "(call %x) Sending CONNECT to remote.\n", call->callref); |
Harald Welte | 7655637 | 2010-12-22 23:57:45 +0100 | [diff] [blame] | 186 | mncc_tx_to_cc(remote->net, MNCC_SETUP_RSP, connect); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 187 | |
| 188 | /* bridge tch */ |
Harald Welte | 53d51f5 | 2015-12-03 14:59:04 +0100 | [diff] [blame] | 189 | bridge.callref[0] = call->callref; |
| 190 | bridge.callref[1] = call->remote_ref; |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 191 | DEBUGP(DMNCC, "(call %x) Bridging with remote.\n", call->callref); |
| 192 | |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 193 | /* proxy mode */ |
| 194 | if (!net->handover.active) { |
| 195 | /* in the no-handover case, we can bridge, i.e. use |
| 196 | * the old RTP proxy code */ |
Harald Welte | 53d51f5 | 2015-12-03 14:59:04 +0100 | [diff] [blame] | 197 | return mncc_tx_to_cc(call->net, MNCC_BRIDGE, &bridge); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 198 | } else { |
| 199 | /* in case of handover, we need to re-write the RTP |
| 200 | * SSRC, sequence and timestamp values and thus |
| 201 | * need to enable RTP receive for both directions */ |
| 202 | memset(&frame_recv, 0, sizeof(struct gsm_mncc)); |
| 203 | frame_recv.callref = call->callref; |
Harald Welte | 7655637 | 2010-12-22 23:57:45 +0100 | [diff] [blame] | 204 | mncc_tx_to_cc(call->net, MNCC_FRAME_RECV, &frame_recv); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 205 | frame_recv.callref = call->remote_ref; |
Harald Welte | 7655637 | 2010-12-22 23:57:45 +0100 | [diff] [blame] | 206 | return mncc_tx_to_cc(call->net, MNCC_FRAME_RECV, &frame_recv); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 207 | } |
| 208 | } |
| 209 | |
| 210 | static int mncc_disc_ind(struct gsm_call *call, int msg_type, |
| 211 | struct gsm_mncc *disc) |
| 212 | { |
| 213 | struct gsm_call *remote; |
| 214 | |
| 215 | /* send release */ |
| 216 | DEBUGP(DMNCC, "(call %x) Releasing call with cause %d\n", |
| 217 | call->callref, disc->cause.value); |
Harald Welte | 7655637 | 2010-12-22 23:57:45 +0100 | [diff] [blame] | 218 | mncc_tx_to_cc(call->net, MNCC_REL_REQ, disc); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 219 | |
| 220 | /* send disc to remote */ |
| 221 | if (!(remote = get_call_ref(call->remote_ref))) { |
| 222 | return 0; |
| 223 | } |
| 224 | disc->callref = remote->callref; |
| 225 | DEBUGP(DMNCC, "(call %x) Disconnecting remote with cause %d\n", |
| 226 | remote->callref, disc->cause.value); |
Harald Welte | 7655637 | 2010-12-22 23:57:45 +0100 | [diff] [blame] | 227 | return mncc_tx_to_cc(remote->net, MNCC_DISC_REQ, disc); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | static int mncc_rel_ind(struct gsm_call *call, int msg_type, struct gsm_mncc *rel) |
| 231 | { |
| 232 | struct gsm_call *remote; |
| 233 | |
| 234 | /* send release to remote */ |
| 235 | if (!(remote = get_call_ref(call->remote_ref))) { |
| 236 | free_call(call); |
| 237 | return 0; |
| 238 | } |
Holger Hans Peter Freyther | a61c709 | 2011-01-27 15:05:45 +0100 | [diff] [blame] | 239 | |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 240 | rel->callref = remote->callref; |
| 241 | DEBUGP(DMNCC, "(call %x) Releasing remote with cause %d\n", |
| 242 | call->callref, rel->cause.value); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 243 | |
Holger Hans Peter Freyther | a61c709 | 2011-01-27 15:05:45 +0100 | [diff] [blame] | 244 | /* |
| 245 | * Release this side of the call right now. Otherwise we end up |
| 246 | * in this method for the other call and will also try to release |
| 247 | * it and then we will end up with a double free and a crash |
| 248 | */ |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 249 | free_call(call); |
Holger Hans Peter Freyther | a61c709 | 2011-01-27 15:05:45 +0100 | [diff] [blame] | 250 | mncc_tx_to_cc(remote->net, MNCC_REL_REQ, rel); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 251 | |
| 252 | return 0; |
| 253 | } |
| 254 | |
| 255 | static int mncc_rel_cnf(struct gsm_call *call, int msg_type, struct gsm_mncc *rel) |
| 256 | { |
| 257 | free_call(call); |
| 258 | return 0; |
| 259 | } |
| 260 | |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 261 | /* Internal MNCC handler input function (from CC -> MNCC -> here) */ |
Harald Welte | 29b64e9 | 2010-12-23 01:07:46 +0100 | [diff] [blame] | 262 | int int_mncc_recv(struct gsm_network *net, struct msgb *msg) |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 263 | { |
Harald Welte | 29b64e9 | 2010-12-23 01:07:46 +0100 | [diff] [blame] | 264 | void *arg = msgb_data(msg); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 265 | struct gsm_mncc *data = arg; |
Harald Welte | 29b64e9 | 2010-12-23 01:07:46 +0100 | [diff] [blame] | 266 | int msg_type = data->msg_type; |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 267 | int callref; |
| 268 | struct gsm_call *call = NULL, *callt; |
| 269 | int rc = 0; |
| 270 | |
| 271 | /* Special messages */ |
| 272 | switch(msg_type) { |
| 273 | } |
| 274 | |
| 275 | /* find callref */ |
| 276 | callref = data->callref; |
| 277 | llist_for_each_entry(callt, &call_list, entry) { |
| 278 | if (callt->callref == callref) { |
| 279 | call = callt; |
| 280 | break; |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | /* create callref, if setup is received */ |
| 285 | if (!call) { |
| 286 | if (msg_type != MNCC_SETUP_IND) |
Harald Welte | 29b64e9 | 2010-12-23 01:07:46 +0100 | [diff] [blame] | 287 | goto out_free; /* drop */ |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 288 | /* create call */ |
| 289 | if (!(call = talloc_zero(tall_call_ctx, struct gsm_call))) { |
| 290 | struct gsm_mncc rel; |
| 291 | |
| 292 | memset(&rel, 0, sizeof(struct gsm_mncc)); |
| 293 | rel.callref = callref; |
| 294 | mncc_set_cause(&rel, GSM48_CAUSE_LOC_PRN_S_LU, |
| 295 | GSM48_CC_CAUSE_RESOURCE_UNAVAIL); |
Harald Welte | 7655637 | 2010-12-22 23:57:45 +0100 | [diff] [blame] | 296 | mncc_tx_to_cc(net, MNCC_REL_REQ, &rel); |
Harald Welte | 29b64e9 | 2010-12-23 01:07:46 +0100 | [diff] [blame] | 297 | goto out_free; |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 298 | } |
| 299 | llist_add_tail(&call->entry, &call_list); |
| 300 | call->net = net; |
| 301 | call->callref = callref; |
| 302 | DEBUGP(DMNCC, "(call %x) Call created.\n", call->callref); |
| 303 | } |
| 304 | |
Andreas Eversberg | 9acbe4c | 2013-03-11 08:12:43 +0100 | [diff] [blame] | 305 | if (mncc_is_data_frame(msg_type)) { |
Neels Hofmeyr | 0e5a7c4 | 2017-05-08 15:12:20 +0200 | [diff] [blame] | 306 | LOGP(DMNCC, LOGL_ERROR, "(call %x) Received data frame, which is not supported.\n", |
| 307 | call->callref); |
Andreas Eversberg | 9acbe4c | 2013-03-11 08:12:43 +0100 | [diff] [blame] | 308 | goto out_free; |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 309 | } |
| 310 | |
Andreas Eversberg | 9acbe4c | 2013-03-11 08:12:43 +0100 | [diff] [blame] | 311 | DEBUGP(DMNCC, "(call %x) Received message %s\n", call->callref, |
| 312 | get_mncc_name(msg_type)); |
| 313 | |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 314 | switch(msg_type) { |
| 315 | case MNCC_SETUP_IND: |
| 316 | rc = mncc_setup_ind(call, msg_type, arg); |
| 317 | break; |
| 318 | case MNCC_SETUP_CNF: |
| 319 | rc = mncc_setup_cnf(call, msg_type, arg); |
| 320 | break; |
| 321 | case MNCC_SETUP_COMPL_IND: |
| 322 | break; |
| 323 | case MNCC_CALL_CONF_IND: |
| 324 | /* we now need to MODIFY the channel */ |
Harald Welte | 7655637 | 2010-12-22 23:57:45 +0100 | [diff] [blame] | 325 | mncc_tx_to_cc(call->net, MNCC_LCHAN_MODIFY, data); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 326 | break; |
| 327 | case MNCC_ALERT_IND: |
| 328 | rc = mncc_alert_ind(call, msg_type, arg); |
| 329 | break; |
| 330 | case MNCC_NOTIFY_IND: |
| 331 | rc = mncc_notify_ind(call, msg_type, arg); |
| 332 | break; |
| 333 | case MNCC_DISC_IND: |
| 334 | rc = mncc_disc_ind(call, msg_type, arg); |
| 335 | break; |
| 336 | case MNCC_REL_IND: |
| 337 | case MNCC_REJ_IND: |
| 338 | rc = mncc_rel_ind(call, msg_type, arg); |
| 339 | break; |
| 340 | case MNCC_REL_CNF: |
| 341 | rc = mncc_rel_cnf(call, msg_type, arg); |
| 342 | break; |
| 343 | case MNCC_FACILITY_IND: |
| 344 | break; |
| 345 | case MNCC_START_DTMF_IND: |
Harald Welte | 0c566a4 | 2016-10-29 22:23:19 +0200 | [diff] [blame] | 346 | rc = mncc_tx_to_cc(net, MNCC_START_DTMF_REJ, data); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 347 | break; |
| 348 | case MNCC_STOP_DTMF_IND: |
Harald Welte | 0c566a4 | 2016-10-29 22:23:19 +0200 | [diff] [blame] | 349 | rc = mncc_tx_to_cc(net, MNCC_STOP_DTMF_RSP, data); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 350 | break; |
| 351 | case MNCC_MODIFY_IND: |
| 352 | mncc_set_cause(data, GSM48_CAUSE_LOC_PRN_S_LU, |
| 353 | GSM48_CC_CAUSE_SERV_OPT_UNIMPL); |
| 354 | DEBUGP(DMNCC, "(call %x) Rejecting MODIFY with cause %d\n", |
| 355 | call->callref, data->cause.value); |
Harald Welte | 7655637 | 2010-12-22 23:57:45 +0100 | [diff] [blame] | 356 | rc = mncc_tx_to_cc(net, MNCC_MODIFY_REJ, data); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 357 | break; |
| 358 | case MNCC_MODIFY_CNF: |
| 359 | break; |
| 360 | case MNCC_HOLD_IND: |
| 361 | mncc_set_cause(data, GSM48_CAUSE_LOC_PRN_S_LU, |
| 362 | GSM48_CC_CAUSE_SERV_OPT_UNIMPL); |
| 363 | DEBUGP(DMNCC, "(call %x) Rejecting HOLD with cause %d\n", |
| 364 | call->callref, data->cause.value); |
Harald Welte | 7655637 | 2010-12-22 23:57:45 +0100 | [diff] [blame] | 365 | rc = mncc_tx_to_cc(net, MNCC_HOLD_REJ, data); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 366 | break; |
| 367 | case MNCC_RETRIEVE_IND: |
| 368 | mncc_set_cause(data, GSM48_CAUSE_LOC_PRN_S_LU, |
| 369 | GSM48_CC_CAUSE_SERV_OPT_UNIMPL); |
| 370 | DEBUGP(DMNCC, "(call %x) Rejecting RETRIEVE with cause %d\n", |
| 371 | call->callref, data->cause.value); |
Harald Welte | 7655637 | 2010-12-22 23:57:45 +0100 | [diff] [blame] | 372 | rc = mncc_tx_to_cc(net, MNCC_RETRIEVE_REJ, data); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 373 | break; |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 374 | default: |
| 375 | LOGP(DMNCC, LOGL_NOTICE, "(call %x) Message unhandled\n", callref); |
| 376 | break; |
| 377 | } |
| 378 | |
Harald Welte | 29b64e9 | 2010-12-23 01:07:46 +0100 | [diff] [blame] | 379 | out_free: |
Holger Hans Peter Freyther | a8ddb08 | 2012-03-01 20:30:32 +0100 | [diff] [blame] | 380 | msgb_free(msg); |
Harald Welte | 29b64e9 | 2010-12-23 01:07:46 +0100 | [diff] [blame] | 381 | |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 382 | return rc; |
| 383 | } |