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