view sip-in/call.h @ 141:e499e8db8b82

sip-in: handle call hold and retrieve
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 08 Oct 2022 13:28:30 -0800
parents 5685412bd6aa
children
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;
	unsigned	in_tag_num;
	/* 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;
	time_t		sip_clear_time;
	int		dtmf_digit;
	int		dtmf_pending_stop;
};

#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_REL		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
#define	MGW_STATE_DTMF_OP		5
#define	MGW_STATE_HELD			6
#define	MGW_STATE_HOLD_OP		7
#define	MGW_STATE_RETRIEVE_OP		8