blob: a4ae8540eb309b66e6de195b300237694e9c255e [file] [log] [blame]
Philipp Maier889fe7f2020-07-06 17:44:12 +02001#pragma once
2
3/* A 64k timeslot on an E1 line can be subdevied into the following
4 * subslot combinations:
5 *
6 * subslot: offset:
7 * [ ][ ][ 16k ][8k_subslot] 0
8 * [ ][ 32k ][_subslot__][8k_subslot] 1
9 * [ ][ subslot ][ 16k ][8k_subslot] 2
10 * [ 64k ][__________][_subslot__][8k_subslot] 3
11 * [ timeslot ][ ][ 16k ][8k_subslot] 4
12 * [ ][ 32K ][_subslot__][8k_subslot] 5
13 * [ ][ subslot ][ 16k ][8k_subslot] 6
14 * [ ][ ][ subslot ][8k_subslot] 7
15 *
16 * Since overlapping assignment of subslots is not possible there is a limited
17 * set of subslot assignments possible. The e1_rates array lists the possible
18 * assignments as depicted above. Also each subslot assignment comes along with
19 * a bit offset in the E1 bitstream. The e1_offsets arrays lists the bit
20 * offsets. */
21static const uint8_t e1_rates[] = { 64, 32, 32, 16, 16, 16, 16, 8, 8, 8, 8, 8, 8, 8, 8 };
22static const uint8_t e1_offsets[] = { 0, 0, 4, 0, 2, 4, 6, 0, 1, 2, 3, 4, 5, 6, 7 };
23
24int mgcp_e1_init(struct mgcp_trunk *trunk, uint8_t ts_nr);
25int mgcp_e1_endp_equip(struct mgcp_endpoint *endp, uint8_t ts, uint8_t ss, uint8_t offs);
26void mgcp_e1_endp_update(struct mgcp_endpoint *endp);
27void mgcp_e1_endp_release(struct mgcp_endpoint *endp);
28int mgcp_e1_send_rtp(struct mgcp_endpoint *endp, struct mgcp_rtp_codec *codec, struct msgb *msg);