view mgw/struct.h @ 128:5685412bd6aa

sip-in: pass DTMF start & stop to themwi-mgw
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 01 Oct 2022 23:07:01 -0800
parents f062c32a5116
children 529906fddcfa
line wrap: on
line source

/*
 * This header file defines internal data structures for themwi-mgw.
 */

struct bind_range_cfg {
	struct in_addr	bind_ip;
	unsigned	port_range_start;
	unsigned	port_range_end;
	unsigned	port_next;
	unsigned	port_tries;
};

struct rtp_one_end {
	int	rtp_fd;
	int	rtcp_fd;
	struct sockaddr_in bound_addr;
	struct sockaddr_in remote_addr;
};

struct endpoint {
	unsigned	ep_type;
	struct rtp_one_end rtp_gsm;
	struct rtp_one_end rtp_pstn;
	unsigned	gsm_payload_type;
	unsigned	gsm_payload_msg_type;
	unsigned	gsm_rtp_pkt_size;
	unsigned	gsm_payload_magic;
	unsigned	pstn_payload_type;
	unsigned	fwd_mode;
	/* gateway functionality */
	void		*gsm_encoder_state;
	void		*gsm_decoder_state;
	/* GSM to PSTN forwarding */
	int		g2p_state;
	uint32_t	g2p_ssrc;
	uint32_t	g2p_last_ts;
	uint16_t	g2p_last_seq;
	uint16_t	g2p_out_seq;
	int		g2p_drop_flag;
	int		g2p_err_flags;
	struct timeval	g2p_local_time;
	/* DTMF generation toward PSTN */
	unsigned	dtmf_frames_sent;
	uint32_t	dtmf_last_ts;
	int16_t		*dtmf_sample_ptr;
	int		dtmf_m_bit;
	int		dtmf_stop_req;
	int		dtmf_aftermath;
	/* PSTN to GSM forwarding */
	int		p2g_state;
	uint32_t	p2g_ssrc;
	uint32_t	p2g_last_ts;
	uint16_t	p2g_last_seq;
	uint16_t	p2g_out_seq;
	int		p2g_drop_flag;
	int		p2g_err_flags;
	/* linked list management */
	unsigned	ep_id;
	struct endpoint	*next;
	struct endpoint	*dtmf_next;
	struct endpoint	**dtmf_pp;
};

struct ctrl_conn {
	struct endpoint	*endp_list;
	unsigned	next_ep_id;
};