2020-06-02 18:55:34 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-07-06 15:44:12 +00:00
|
|
|
#include <osmocom/gsm/i460_mux.h>
|
2020-11-26 21:16:23 +00:00
|
|
|
#include <osmocom/abis/e1_input.h>
|
2021-08-23 23:36:49 +00:00
|
|
|
#include <osmocom/mgcp/mgcp_ratectr.h>
|
|
|
|
|
2020-07-06 15:44:12 +00:00
|
|
|
|
|
|
|
#define LOGPTRUNK(trunk, cat, level, fmt, args...) \
|
|
|
|
LOGP(cat, level, "trunk:%u " fmt, \
|
|
|
|
trunk ? trunk->trunk_nr : 0, \
|
|
|
|
## args)
|
|
|
|
|
2020-07-01 21:18:58 +00:00
|
|
|
enum mgcp_trunk_type {
|
|
|
|
MGCP_TRUNK_VIRTUAL,
|
|
|
|
MGCP_TRUNK_E1,
|
|
|
|
};
|
|
|
|
|
2021-07-09 08:24:33 +00:00
|
|
|
extern const struct value_string mgcp_trunk_type_strs[];
|
|
|
|
static inline const char *mgcp_trunk_type_strs_str(enum mgcp_trunk_type val)
|
|
|
|
{ return get_value_string(mgcp_trunk_type_strs, val); }
|
|
|
|
|
2020-06-02 18:55:34 +00:00
|
|
|
struct mgcp_trunk {
|
|
|
|
struct llist_head entry;
|
|
|
|
|
|
|
|
struct mgcp_config *cfg;
|
|
|
|
|
2021-07-19 11:53:28 +00:00
|
|
|
unsigned int trunk_nr;
|
2020-07-02 19:21:26 +00:00
|
|
|
enum mgcp_trunk_type trunk_type;
|
2020-06-02 18:55:34 +00:00
|
|
|
|
|
|
|
int audio_send_ptime;
|
|
|
|
int audio_send_name;
|
|
|
|
|
|
|
|
int omit_rtcp;
|
|
|
|
int keepalive_interval;
|
|
|
|
|
|
|
|
/* RTP patching */
|
|
|
|
int force_constant_ssrc; /* 0: don't, 1: once */
|
|
|
|
int force_aligned_timing;
|
|
|
|
bool rfc5993_hr_convert;
|
|
|
|
|
|
|
|
/* spec handling */
|
|
|
|
int force_realloc;
|
|
|
|
|
|
|
|
/* timer */
|
|
|
|
struct osmo_timer_list keepalive_timer;
|
|
|
|
|
|
|
|
/* When set, incoming RTP packets are not filtered
|
|
|
|
* when ports and ip-address do not match (debug) */
|
|
|
|
int rtp_accept_all;
|
|
|
|
|
|
|
|
unsigned int number_endpoints;
|
|
|
|
struct mgcp_endpoint **endpoints;
|
|
|
|
|
2021-07-26 09:17:15 +00:00
|
|
|
/* rate counters and stat items to measure the trunks overall performance and health */
|
2020-06-02 18:55:34 +00:00
|
|
|
struct mgcp_ratectr_trunk ratectr;
|
2021-07-26 09:17:15 +00:00
|
|
|
struct mgcp_stat_trunk stats;
|
2020-07-06 15:44:12 +00:00
|
|
|
|
|
|
|
union {
|
|
|
|
/* Virtual trunk specific */
|
|
|
|
struct {
|
|
|
|
unsigned int vty_number_endpoints;
|
|
|
|
} v;
|
|
|
|
/* E1 specific */
|
|
|
|
struct {
|
|
|
|
unsigned int vty_line_nr;
|
2023-02-09 12:39:31 +00:00
|
|
|
uint8_t ts_usecount[NUM_E1_TS-1];
|
2020-11-26 21:16:23 +00:00
|
|
|
struct osmo_i460_timeslot i460_ts[NUM_E1_TS-1];
|
|
|
|
/* Note: on an E1 line TS 0 is devoted to framing and
|
|
|
|
* alignment and therefore only NUM_E1_TS-1 timeslots
|
|
|
|
* are available for traffic. */
|
2020-07-06 15:44:12 +00:00
|
|
|
} e1;
|
|
|
|
};
|
2020-06-02 18:55:34 +00:00
|
|
|
};
|
|
|
|
|
2021-07-19 11:53:28 +00:00
|
|
|
struct mgcp_trunk *mgcp_trunk_alloc(struct mgcp_config *cfg, enum mgcp_trunk_type ttype, unsigned int nr);
|
2020-07-06 15:44:12 +00:00
|
|
|
int mgcp_trunk_equip(struct mgcp_trunk *trunk);
|
2021-07-19 11:53:28 +00:00
|
|
|
struct mgcp_trunk *mgcp_trunk_by_num(const struct mgcp_config *cfg, enum mgcp_trunk_type ttype, unsigned int nr);
|
2020-06-02 18:55:34 +00:00
|
|
|
struct mgcp_trunk *mgcp_trunk_by_name(const struct mgcp_config *cfg, const char *epname);
|
2021-07-19 11:53:28 +00:00
|
|
|
int e1_trunk_nr_from_epname(unsigned int *trunk_nr, const char *epname);
|
2020-07-06 15:44:12 +00:00
|
|
|
struct mgcp_trunk *mgcp_trunk_by_line_num(const struct mgcp_config *cfg, unsigned int num);
|
2020-06-03 11:55:33 +00:00
|
|
|
|
|
|
|
/* The virtual trunk is always created on trunk id 0 for historical reasons,
|
|
|
|
* use this define constant as ID when allocating a virtual trunk. Other
|
|
|
|
* trunks may be assigned with arbritrary id numbers */
|
|
|
|
#define MGCP_VIRT_TRUNK_ID 0
|