blob: 82728fe3787b2685a19e3fbbd28747c784cec9d0 [file] [log] [blame]
Philipp Maierc66ab2c2020-06-02 20:55:34 +02001#pragma once
2
Philipp Maierbea56782020-07-01 23:18:58 +02003enum mgcp_trunk_type {
4 MGCP_TRUNK_VIRTUAL,
5 MGCP_TRUNK_E1,
6};
7
Philipp Maierc66ab2c2020-06-02 20:55:34 +02008struct mgcp_trunk {
9 struct llist_head entry;
10
11 struct mgcp_config *cfg;
12
13 int trunk_nr;
Philipp Maier04bbb9d2020-07-02 21:21:26 +020014 enum mgcp_trunk_type trunk_type;
Philipp Maierc66ab2c2020-06-02 20:55:34 +020015
16 char *audio_fmtp_extra;
Philipp Maierc66ab2c2020-06-02 20:55:34 +020017 int audio_send_ptime;
18 int audio_send_name;
19 int audio_loop;
20
21 int no_audio_transcoding;
22
23 int omit_rtcp;
24 int keepalive_interval;
25
26 /* RTP patching */
27 int force_constant_ssrc; /* 0: don't, 1: once */
28 int force_aligned_timing;
29 bool rfc5993_hr_convert;
30
31 /* spec handling */
32 int force_realloc;
33
34 /* timer */
35 struct osmo_timer_list keepalive_timer;
36
37 /* When set, incoming RTP packets are not filtered
38 * when ports and ip-address do not match (debug) */
39 int rtp_accept_all;
40
41 unsigned int number_endpoints;
42 unsigned int vty_number_endpoints;
43 struct mgcp_endpoint **endpoints;
44
45 /* global rate counters to measure the trunks overall performance and health */
46 struct mgcp_ratectr_trunk ratectr;
47};
48
49struct mgcp_trunk *mgcp_trunk_alloc(struct mgcp_config *cfg, enum mgcp_trunk_type ttype, int nr);
50int mgcp_trunk_alloc_endpts(struct mgcp_trunk *tcfg);
51struct mgcp_trunk *mgcp_trunk_by_num(const struct mgcp_config *cfg, int index);
52struct mgcp_trunk *mgcp_trunk_by_name(const struct mgcp_config *cfg, const char *epname);
Philipp Maier7e9ddc92020-06-10 15:22:32 +020053int e1_trunk_nr_from_epname(const char *epname);
Philipp Maierd19de2e2020-06-03 13:55:33 +020054
55/* The virtual trunk is always created on trunk id 0 for historical reasons,
56 * use this define constant as ID when allocating a virtual trunk. Other
57 * trunks may be assigned with arbritrary id numbers */
58#define MGCP_VIRT_TRUNK_ID 0