view sip-in/call.h @ 64:1f863c63f96b

sip-in: beginning of disconnect handling
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 18 Sep 2022 15:29:30 -0800
parents e5aee661e3b2
children 0d6435808bcd
line wrap: on
line source

/*
 * struct call defined in this header file is the big daddy:
 * it is the main call state structure for themwi-sip-in.
 */

struct call {
	/* call list management */
	char		*sip_call_id;
	struct call	*next;
	/* filled from initial INVITE */
	struct sockaddr_in udp_sin;
	char		*invite_from;
	char		*invite_to;
	char		*invite_via;
	unsigned	invite_cseq;
	char		called_nanp[11];
	char		*from_uri;
	unsigned	from_uri_len;
	char		*from_user;
	unsigned	from_user_len;
	int		use_100rel;
	/* 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	sip_state;
	uint32_t	mgw_state;
	uint32_t	mgw_ep_id;
	uint32_t	mgw_xact;
	uint32_t	mgw_xact_id;
	uint32_t	sdp_addend;
	uint32_t	mncc_state;
	uint32_t	mncc_callref;
	char		invite_fail[80];
	unsigned	sip_tx_count;
};

#define	OVERALL_STATE_CRCX		1
#define	OVERALL_STATE_CALL_GSM		2
#define	OVERALL_STATE_ALERTING		3
#define	OVERALL_STATE_ANSWERED		4
#define	OVERALL_STATE_CONNECTED		5
#define	OVERALL_STATE_TEARDOWN		6
#define	OVERALL_STATE_DEAD_SIP		7

#define	SIP_STATE_INVITE_PROC		1
#define	SIP_STATE_RINGING		2
#define	SIP_STATE_RINGING_PRACK		3
#define	SIP_STATE_INVITE_200		4
#define	SIP_STATE_CONNECTED		5
#define	SIP_STATE_BYE_SENT		6
#define	SIP_STATE_INVITE_ERR		7
#define	SIP_STATE_ENDED			8
#define	SIP_STATE_MSG_SIZE_ERR		9

#define	MNCC_STATE_NO_EXIST		0
#define	MNCC_STATE_STARTED		1
#define	MNCC_STATE_ALERTING		2
#define	MNCC_STATE_ANSWERED		3
#define	MNCC_STATE_CONNECTED		4
#define	MNCC_STATE_DISCONNECT		5
#define	MNCC_STATE_RELEASE		6

#define	MGW_STATE_NO_EXIST		0
#define	MGW_STATE_ALLOCATED		1
#define	MGW_STATE_CONNECTING		2
#define	MGW_STATE_COMPLETE		3
#define	MGW_STATE_DELETING		4