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 | |
Max | 3332ac4 | 2018-12-17 11:17:33 +0100 | [diff] [blame] | 38 | #define DEBUGCC(l, r, fmt, args...) DEBUGP(DMNCC, "(call %x, remote %x) " fmt, l->callref, r->callref, ##args) |
| 39 | |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 40 | void *tall_call_ctx; |
| 41 | |
| 42 | static LLIST_HEAD(call_list); |
| 43 | |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 44 | static uint32_t new_callref = 0x00000001; |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 45 | |
Harald Welte | ab386e6 | 2011-09-01 18:18:43 +0200 | [diff] [blame] | 46 | struct mncc_int mncc_int = { |
Andreas Eversberg | a83d511 | 2013-12-07 18:32:28 +0100 | [diff] [blame] | 47 | .def_codec = { GSM48_CMODE_SPEECH_V1, GSM48_CMODE_SPEECH_V1 }, |
Harald Welte | ab386e6 | 2011-09-01 18:18:43 +0200 | [diff] [blame] | 48 | }; |
| 49 | |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 50 | static void free_call(struct gsm_call *call) |
| 51 | { |
| 52 | llist_del(&call->entry); |
| 53 | DEBUGP(DMNCC, "(call %x) Call removed.\n", call->callref); |
| 54 | talloc_free(call); |
| 55 | } |
| 56 | |
| 57 | |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 58 | static struct gsm_call *get_call_ref(uint32_t callref) |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 59 | { |
| 60 | struct gsm_call *callt; |
| 61 | |
| 62 | llist_for_each_entry(callt, &call_list, entry) { |
| 63 | if (callt->callref == callref) |
| 64 | return callt; |
| 65 | } |
| 66 | return NULL; |
| 67 | } |
| 68 | |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 69 | /* on incoming call, look up database and send setup to remote subscr. */ |
| 70 | static int mncc_setup_ind(struct gsm_call *call, int msg_type, |
| 71 | struct gsm_mncc *setup) |
| 72 | { |
| 73 | struct gsm_mncc mncc; |
| 74 | struct gsm_call *remote; |
| 75 | |
| 76 | memset(&mncc, 0, sizeof(struct gsm_mncc)); |
| 77 | mncc.callref = call->callref; |
| 78 | |
| 79 | /* already have remote call */ |
| 80 | if (call->remote_ref) |
| 81 | return 0; |
| 82 | |
| 83 | /* transfer mode 1 would be packet mode, which was never specified */ |
| 84 | if (setup->bearer_cap.mode != 0) { |
| 85 | LOGP(DMNCC, LOGL_NOTICE, "(call %x) We don't support " |
| 86 | "packet mode\n", call->callref); |
| 87 | mncc_set_cause(&mncc, GSM48_CAUSE_LOC_PRN_S_LU, |
| 88 | GSM48_CC_CAUSE_BEARER_CA_UNAVAIL); |
| 89 | goto out_reject; |
| 90 | } |
| 91 | |
| 92 | /* we currently only do speech */ |
| 93 | if (setup->bearer_cap.transfer != GSM_MNCC_BCAP_SPEECH) { |
| 94 | LOGP(DMNCC, LOGL_NOTICE, "(call %x) We only support " |
| 95 | "voice calls\n", call->callref); |
| 96 | mncc_set_cause(&mncc, GSM48_CAUSE_LOC_PRN_S_LU, |
| 97 | GSM48_CC_CAUSE_BEARER_CA_UNAVAIL); |
| 98 | goto out_reject; |
| 99 | } |
| 100 | |
| 101 | /* create remote call */ |
Andreas Eversberg | c5e0851 | 2013-01-25 08:36:32 +0100 | [diff] [blame] | 102 | if (!(remote = talloc_zero(tall_call_ctx, struct gsm_call))) { |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 103 | mncc_set_cause(&mncc, GSM48_CAUSE_LOC_PRN_S_LU, |
| 104 | GSM48_CC_CAUSE_RESOURCE_UNAVAIL); |
| 105 | goto out_reject; |
| 106 | } |
| 107 | llist_add_tail(&remote->entry, &call_list); |
| 108 | remote->net = call->net; |
| 109 | remote->callref = new_callref++; |
Max | 3332ac4 | 2018-12-17 11:17:33 +0100 | [diff] [blame] | 110 | DEBUGCC(call, remote, "Creating new remote instance.\n"); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 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; |
Max | 3332ac4 | 2018-12-17 11:17:33 +0100 | [diff] [blame] | 119 | DEBUGCC(call, remote, "Accepting call.\n"); |
Harald Welte | bf0a7c9 | 2012-08-24 16:48:21 +0200 | [diff] [blame] | 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; |
Max | 3332ac4 | 2018-12-17 11:17:33 +0100 | [diff] [blame] | 125 | DEBUGCC(call, remote, "Modify channel mode.\n"); |
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; |
Max | 3332ac4 | 2018-12-17 11:17:33 +0100 | [diff] [blame] | 132 | DEBUGCC(call, remote, "Forwarding SETUP to remote.\n"); |
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; |
Max | 3332ac4 | 2018-12-17 11:17:33 +0100 | [diff] [blame] | 150 | DEBUGCC(call, remote, "Forwarding ALERT to remote.\n"); |
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; |
Max | 3332ac4 | 2018-12-17 11:17:33 +0100 | [diff] [blame] | 163 | DEBUGCC(call, remote, "Forwarding NOTIF to remote.\n"); |
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 | { |
Neels Hofmeyr | f9773b0 | 2018-11-29 23:01:58 +0100 | [diff] [blame] | 170 | struct gsm_mncc connect_ack; |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 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; |
Max | 3332ac4 | 2018-12-17 11:17:33 +0100 | [diff] [blame] | 184 | DEBUGCC(call, remote, "Sending CONNECT to remote.\n"); |
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; |
Max | 3332ac4 | 2018-12-17 11:17:33 +0100 | [diff] [blame] | 190 | DEBUGCC(call, remote, "Bridging with remote.\n"); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 191 | |
Neels Hofmeyr | f9773b0 | 2018-11-29 23:01:58 +0100 | [diff] [blame] | 192 | return mncc_tx_to_cc(call->net, MNCC_BRIDGE, &bridge); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 193 | } |
| 194 | |
| 195 | static int mncc_disc_ind(struct gsm_call *call, int msg_type, |
| 196 | struct gsm_mncc *disc) |
| 197 | { |
| 198 | struct gsm_call *remote; |
| 199 | |
| 200 | /* send release */ |
| 201 | DEBUGP(DMNCC, "(call %x) Releasing call with cause %d\n", |
| 202 | call->callref, disc->cause.value); |
Harald Welte | 7655637 | 2010-12-22 23:57:45 +0100 | [diff] [blame] | 203 | mncc_tx_to_cc(call->net, MNCC_REL_REQ, disc); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 204 | |
| 205 | /* send disc to remote */ |
| 206 | if (!(remote = get_call_ref(call->remote_ref))) { |
| 207 | return 0; |
| 208 | } |
| 209 | disc->callref = remote->callref; |
Max | 3332ac4 | 2018-12-17 11:17:33 +0100 | [diff] [blame] | 210 | DEBUGCC(call, remote, "Disconnecting remote with cause %d\n", disc->cause.value); |
Harald Welte | 7655637 | 2010-12-22 23:57:45 +0100 | [diff] [blame] | 211 | return mncc_tx_to_cc(remote->net, MNCC_DISC_REQ, disc); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 212 | } |
| 213 | |
| 214 | static int mncc_rel_ind(struct gsm_call *call, int msg_type, struct gsm_mncc *rel) |
| 215 | { |
| 216 | struct gsm_call *remote; |
| 217 | |
| 218 | /* send release to remote */ |
| 219 | if (!(remote = get_call_ref(call->remote_ref))) { |
| 220 | free_call(call); |
| 221 | return 0; |
| 222 | } |
Holger Hans Peter Freyther | a61c709 | 2011-01-27 15:05:45 +0100 | [diff] [blame] | 223 | |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 224 | rel->callref = remote->callref; |
Max | 3332ac4 | 2018-12-17 11:17:33 +0100 | [diff] [blame] | 225 | DEBUGCC(call, remote, "Releasing remote with cause %d\n", rel->cause.value); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 226 | |
Holger Hans Peter Freyther | a61c709 | 2011-01-27 15:05:45 +0100 | [diff] [blame] | 227 | /* |
| 228 | * Release this side of the call right now. Otherwise we end up |
| 229 | * in this method for the other call and will also try to release |
| 230 | * it and then we will end up with a double free and a crash |
| 231 | */ |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 232 | free_call(call); |
Holger Hans Peter Freyther | a61c709 | 2011-01-27 15:05:45 +0100 | [diff] [blame] | 233 | mncc_tx_to_cc(remote->net, MNCC_REL_REQ, rel); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 234 | |
| 235 | return 0; |
| 236 | } |
| 237 | |
| 238 | static int mncc_rel_cnf(struct gsm_call *call, int msg_type, struct gsm_mncc *rel) |
| 239 | { |
| 240 | free_call(call); |
| 241 | return 0; |
| 242 | } |
| 243 | |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 244 | /* Internal MNCC handler input function (from CC -> MNCC -> here) */ |
Harald Welte | 29b64e9 | 2010-12-23 01:07:46 +0100 | [diff] [blame] | 245 | int int_mncc_recv(struct gsm_network *net, struct msgb *msg) |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 246 | { |
Harald Welte | 29b64e9 | 2010-12-23 01:07:46 +0100 | [diff] [blame] | 247 | void *arg = msgb_data(msg); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 248 | struct gsm_mncc *data = arg; |
Harald Welte | 29b64e9 | 2010-12-23 01:07:46 +0100 | [diff] [blame] | 249 | int msg_type = data->msg_type; |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 250 | int callref; |
| 251 | struct gsm_call *call = NULL, *callt; |
| 252 | int rc = 0; |
| 253 | |
| 254 | /* Special messages */ |
| 255 | switch(msg_type) { |
| 256 | } |
| 257 | |
| 258 | /* find callref */ |
| 259 | callref = data->callref; |
| 260 | llist_for_each_entry(callt, &call_list, entry) { |
| 261 | if (callt->callref == callref) { |
| 262 | call = callt; |
| 263 | break; |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | /* create callref, if setup is received */ |
| 268 | if (!call) { |
| 269 | if (msg_type != MNCC_SETUP_IND) |
Harald Welte | 29b64e9 | 2010-12-23 01:07:46 +0100 | [diff] [blame] | 270 | goto out_free; /* drop */ |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 271 | /* create call */ |
| 272 | if (!(call = talloc_zero(tall_call_ctx, struct gsm_call))) { |
| 273 | struct gsm_mncc rel; |
| 274 | |
| 275 | memset(&rel, 0, sizeof(struct gsm_mncc)); |
| 276 | rel.callref = callref; |
| 277 | mncc_set_cause(&rel, GSM48_CAUSE_LOC_PRN_S_LU, |
| 278 | GSM48_CC_CAUSE_RESOURCE_UNAVAIL); |
Harald Welte | 7655637 | 2010-12-22 23:57:45 +0100 | [diff] [blame] | 279 | mncc_tx_to_cc(net, MNCC_REL_REQ, &rel); |
Harald Welte | 29b64e9 | 2010-12-23 01:07:46 +0100 | [diff] [blame] | 280 | goto out_free; |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 281 | } |
| 282 | llist_add_tail(&call->entry, &call_list); |
| 283 | call->net = net; |
| 284 | call->callref = callref; |
| 285 | DEBUGP(DMNCC, "(call %x) Call created.\n", call->callref); |
| 286 | } |
| 287 | |
Andreas Eversberg | 9acbe4c | 2013-03-11 08:12:43 +0100 | [diff] [blame] | 288 | if (mncc_is_data_frame(msg_type)) { |
Neels Hofmeyr | e2f24d5 | 2017-05-08 15:12:20 +0200 | [diff] [blame] | 289 | LOGP(DMNCC, LOGL_ERROR, "(call %x) Received data frame, which is not supported.\n", |
| 290 | call->callref); |
Andreas Eversberg | 9acbe4c | 2013-03-11 08:12:43 +0100 | [diff] [blame] | 291 | goto out_free; |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 292 | } |
| 293 | |
Andreas Eversberg | 9acbe4c | 2013-03-11 08:12:43 +0100 | [diff] [blame] | 294 | DEBUGP(DMNCC, "(call %x) Received message %s\n", call->callref, |
| 295 | get_mncc_name(msg_type)); |
| 296 | |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 297 | switch(msg_type) { |
| 298 | case MNCC_SETUP_IND: |
| 299 | rc = mncc_setup_ind(call, msg_type, arg); |
| 300 | break; |
| 301 | case MNCC_SETUP_CNF: |
| 302 | rc = mncc_setup_cnf(call, msg_type, arg); |
| 303 | break; |
| 304 | case MNCC_SETUP_COMPL_IND: |
| 305 | break; |
| 306 | case MNCC_CALL_CONF_IND: |
| 307 | /* we now need to MODIFY the channel */ |
Harald Welte | 7655637 | 2010-12-22 23:57:45 +0100 | [diff] [blame] | 308 | mncc_tx_to_cc(call->net, MNCC_LCHAN_MODIFY, data); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 309 | break; |
| 310 | case MNCC_ALERT_IND: |
| 311 | rc = mncc_alert_ind(call, msg_type, arg); |
| 312 | break; |
| 313 | case MNCC_NOTIFY_IND: |
| 314 | rc = mncc_notify_ind(call, msg_type, arg); |
| 315 | break; |
| 316 | case MNCC_DISC_IND: |
| 317 | rc = mncc_disc_ind(call, msg_type, arg); |
| 318 | break; |
| 319 | case MNCC_REL_IND: |
| 320 | case MNCC_REJ_IND: |
| 321 | rc = mncc_rel_ind(call, msg_type, arg); |
| 322 | break; |
| 323 | case MNCC_REL_CNF: |
| 324 | rc = mncc_rel_cnf(call, msg_type, arg); |
| 325 | break; |
| 326 | case MNCC_FACILITY_IND: |
| 327 | break; |
| 328 | case MNCC_START_DTMF_IND: |
Harald Welte | 0c566a4 | 2016-10-29 22:23:19 +0200 | [diff] [blame] | 329 | rc = mncc_tx_to_cc(net, MNCC_START_DTMF_REJ, data); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 330 | break; |
| 331 | case MNCC_STOP_DTMF_IND: |
Harald Welte | 0c566a4 | 2016-10-29 22:23:19 +0200 | [diff] [blame] | 332 | rc = mncc_tx_to_cc(net, MNCC_STOP_DTMF_RSP, data); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 333 | break; |
| 334 | case MNCC_MODIFY_IND: |
| 335 | mncc_set_cause(data, GSM48_CAUSE_LOC_PRN_S_LU, |
| 336 | GSM48_CC_CAUSE_SERV_OPT_UNIMPL); |
| 337 | DEBUGP(DMNCC, "(call %x) Rejecting MODIFY with cause %d\n", |
| 338 | call->callref, data->cause.value); |
Harald Welte | 7655637 | 2010-12-22 23:57:45 +0100 | [diff] [blame] | 339 | rc = mncc_tx_to_cc(net, MNCC_MODIFY_REJ, data); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 340 | break; |
| 341 | case MNCC_MODIFY_CNF: |
| 342 | break; |
| 343 | case MNCC_HOLD_IND: |
| 344 | mncc_set_cause(data, GSM48_CAUSE_LOC_PRN_S_LU, |
| 345 | GSM48_CC_CAUSE_SERV_OPT_UNIMPL); |
| 346 | DEBUGP(DMNCC, "(call %x) Rejecting HOLD with cause %d\n", |
| 347 | call->callref, data->cause.value); |
Harald Welte | 7655637 | 2010-12-22 23:57:45 +0100 | [diff] [blame] | 348 | rc = mncc_tx_to_cc(net, MNCC_HOLD_REJ, data); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 349 | break; |
| 350 | case MNCC_RETRIEVE_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 RETRIEVE 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_RETRIEVE_REJ, data); |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 356 | break; |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 357 | default: |
| 358 | LOGP(DMNCC, LOGL_NOTICE, "(call %x) Message unhandled\n", callref); |
| 359 | break; |
| 360 | } |
| 361 | |
Harald Welte | 29b64e9 | 2010-12-23 01:07:46 +0100 | [diff] [blame] | 362 | out_free: |
Holger Hans Peter Freyther | a8ddb08 | 2012-03-01 20:30:32 +0100 | [diff] [blame] | 363 | msgb_free(msg); |
Harald Welte | 29b64e9 | 2010-12-23 01:07:46 +0100 | [diff] [blame] | 364 | |
Harald Welte | 3e6376d | 2010-12-22 23:54:51 +0100 | [diff] [blame] | 365 | return rc; |
| 366 | } |