#ifndef _SIP_UA_H
#define _SIP_UA_H

#include "sip_ua_pub.h"
#include "sip.h"
#include "../../../pal/pal.h"

#define sip_response_match_ua_dialog(sipMsg)  sip_ua_match_dialog_with_rsp(sipMsg)

typedef struct _SIP_UA_SAP
{
    	BYTE	proxyType;
	char		userName[16];
	char		domain[SIP_MAX_DOMAIN_NAME_LEN];
	int		(*recv_req)(WORD sipUaPort, WORD usrPort, WORD dialogId, BYTE method, SIP_API_STRUCT *sipApiMsg, pal_cg_struct *cg);
	int		(*recv_resp)(WORD usrPort, WORD dialogId, WORD statusCode, SIP_API_STRUCT *sipApiMsg);
}SIP_UA_SAP;

typedef struct _SIP_EVENTHANDLE_STRUCT
{
	int		(*recv_req)(WORD sipUaPort, WORD usrPort, WORD dialogId, BYTE method, SIP_API_STRUCT *sipApiMsg, pal_cg_struct *cg);
	int		(*recv_resp)(WORD usrPort, WORD dialogId, WORD statusCode, SIP_API_STRUCT *sipApiMsg);
}SIP_EVENTHANDLE_STRUCT;

int sip_ua_init();
//int sip_ua_bind(SIP_UA_SAP *sap);
int sip_ua_init_port(WORD port);
int sip_ua_init_dialog(WORD dialogId);

int sip_ua_get_port();


WORD sip_ua_match_dialog_with_req(SIP_API_STRUCT *request);
WORD sip_ua_match_dialog_with_rsp(SIP_API_STRUCT *response);

int sip_query_sip_ua_users(SIP_URI *sipUri);

#endif

