view sip-out/call.h @ 217:9f6a148ceb25

tcpserv-dump: brown paper bag
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 24 Jul 2023 22:33:01 -0800
parents bfa9f0c0f0ac
children
line wrap: on
line source

/*
 * In this header file we define two key structures for call state
 * in themwi-sip-out: struct call exists for each call just like in
 * themwi-sip-in, and struct mncc_conn exists for every connection
 * to our outcall socket.
 */

struct mncc_conn {
	int		fd;
	struct mncc_conn *next;
};

#define	MAX_SIP_CALL_ID		30
#define	MAX_SIP_FROM_HEADER	(MAX_SIP_USER_PART + 5 + 17 + 5 + 8)
#define	MAX_SIP_TO_URI		(MAX_SIP_USER_PART + MAX_SIP_DEST_DOMAIN + 5)
#define	MAX_SIP_TO_TAG		63

struct call {
	/* global call list */
	struct call	*next;
	char		sip_call_id[MAX_SIP_CALL_ID+1];
	int		sip_call_exists;
	/* MNCC call origin */
	struct mncc_conn *mncc;
	uint32_t	mncc_callref;
	/* call routing info */
	char		from_user[MAX_SIP_USER_PART+1];
	char		from_header[MAX_SIP_FROM_HEADER+1];
	char		to_uri[MAX_SIP_TO_URI+1];
	char		to_tag[MAX_SIP_TO_TAG+1];
	struct sockaddr_in udp_sin;
	/* PSTN side RTP info */
	struct sockaddr_in pstn_rtp_local;
	struct sockaddr_in pstn_rtp_remote;
	int		use_pcma;
	/* GSM side RTP info */
	struct sockaddr_storage gsm_rtp_osmo;
	struct sockaddr_storage gsm_rtp_tmgw;
	uint32_t	gsm_payload_type;
	uint32_t	gsm_payload_msg_type;
	/* state machines */
	uint32_t	overall_state;
	uint32_t	mncc_state;
	uint32_t	sip_state;
	uint32_t	mgw_state;
	uint32_t	mgw_ep_id;
	uint32_t	mgw_xact;
	uint32_t	mgw_xact_id;
	unsigned	sip_tx_count;
	time_t		sip_clear_time;
	int		dtmf_digit;
	int		dtmf_pending_stop;
};

#define	OVERALL_STATE_GSM_RTP		1
#define	OVERALL_STATE_CRCX		2
#define	OVERALL_STATE_SIP_OUT		3
#define	OVERALL_STATE_RINGING		4
#define	OVERALL_STATE_CONNECTED		5
#define	OVERALL_STATE_TEARDOWN		6
#define	OVERALL_STATE_SIP_FINISH	7
#define	OVERALL_STATE_GC		8

#define	MNCC_STATE_MO_PROC		1
#define	MNCC_STATE_GOT_RTP		2
#define	MNCC_STATE_ALERTING		3
#define	MNCC_STATE_CONNECTED		4
#define	MNCC_STATE_DISCONNECT		5
#define	MNCC_STATE_RELEASE		6

#define	SIP_STATE_INV_SENT		1
#define	SIP_STATE_100_RCVD		2
#define	SIP_STATE_CONNECTED		3
#define	SIP_STATE_CANCEL_SENT		4
#define	SIP_STATE_BYE_SENT		5
#define	SIP_STATE_ACCEPT_100		6
#define	SIP_STATE_ACCEPT_200		7
#define	SIP_STATE_ENDED			8
#define	SIP_STATE_MSG_SIZE_ERR		9

#define	MGW_STATE_NO_EXIST		0
#define	MGW_STATE_ALLOCATED		1
#define	MGW_STATE_IBT_CONN		2
#define	MGW_STATE_COMPLETE		3
#define	MGW_STATE_HELD			4
#define	MGW_STATE_MDCX_IBT		5
#define	MGW_STATE_MDCX_CONN		6
#define	MGW_STATE_MDCX_HOLD		7
#define	MGW_STATE_MDCX_RETR		8
#define	MGW_STATE_DTMF_OP		9
#define	MGW_STATE_DELETING		10