blob: 304e9670676c7f56f03cd05f1a45480ae22a9704 [file] [log] [blame]
Philipp Maier621ba032017-11-07 17:19:25 +01001/* (C) 2017 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
2 * All Rights Reserved
3 *
4 * Author: Philipp Maier
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
15 *
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21#pragma once
22
23#include <osmocom/mgcp_client/mgcp_client.h>
24#include <osmocom/msc/gsm_data.h>
25
Neels Hofmeyra8945ce2018-11-30 00:44:32 +010026struct ran_conn;
27
Philipp Maier621ba032017-11-07 17:19:25 +010028/* MGCP state handler context. This context information stores all information
29 * to handle the direction of the RTP streams via MGCP. There is one instance
Neels Hofmeyrc036b792018-11-29 22:37:51 +010030 * of this context struct per RAN connection.
31 * (see also struct ran_conn) */
Philipp Maier621ba032017-11-07 17:19:25 +010032struct mgcp_ctx {
33 /* FSM instance, which handles the connection switching procedure */
34 struct osmo_fsm_inst *fsm;
35
Philipp Maiera2353c62018-02-08 14:15:59 +010036 /* RTP endpoint string. This string identifies the endpoint
Philipp Maier621ba032017-11-07 17:19:25 +010037 * on the MGW on which the RAN and CN connection is created. This
Philipp Maiera2353c62018-02-08 14:15:59 +010038 * endpoint number is assigned by the MGW. */
39 char rtp_endpoint[MGCP_ENDPOINT_MAXLEN];
40
41 /* Call id of the current call. Will be derived from the callref
42 * of the transaction that is valid during the first CRCX. (The
43 * callref may change throughout the call) */
44 unsigned int call_id;
Philipp Maier621ba032017-11-07 17:19:25 +010045
46 /* Set to true, when the context information is no longer needed */
47 bool free_ctx;
48
49 /* RTP connection identifiers */
50 char conn_id_ran[MGCP_CONN_ID_LENGTH];
51 char conn_id_cn[MGCP_CONN_ID_LENGTH];
52
53 /* Copy of the pointer and the data with context information
54 * needed to process the AoIP and MGCP requests (system data) */
55 struct mgcp_client *mgcp;
56 struct gsm_trans *trans;
57 mgcp_trans_id_t mgw_pending_trans;
58};
59
Neels Hofmeyrb16259f2018-12-20 02:57:56 +010060int msc_mgcp_try_call_assignment(struct gsm_trans *trans);
Philipp Maier621ba032017-11-07 17:19:25 +010061int msc_mgcp_call_assignment(struct gsm_trans *trans);
Neels Hofmeyr85cb2532018-12-11 18:59:27 +010062int msc_mgcp_ass_complete(struct ran_conn *conn, uint16_t port, char *addr);
Neels Hofmeyrf383d412018-12-19 17:05:13 +010063int msc_mgcp_ass_fail(struct ran_conn *conn);
Philipp Maier621ba032017-11-07 17:19:25 +010064int msc_mgcp_call_complete(struct gsm_trans *trans, uint16_t port, char *addr);
65int msc_mgcp_call_release(struct gsm_trans *trans);