www.pudn.com > lucent_softphone.rar > CTIEvent.h


	 
// CTIEvent.h : Declaration of the CCTIEvent 
 
#ifndef __CTIEVENT_H_ 
#define __CTIEVENT_H_ 
 
#include "resource.h"       // main symbols 
 
#include "dnevent.h" 
///////////////////////////////////////////////////////////////////////////// 
// CCTIEvent 
class ATL_NO_VTABLE CCTIEvent :  
	public CComObjectRootEx, 
	public CComCoClass, 
	public ICTIEvent 
{ 
public: 
	CCTIEvent() 
	{ 
		m_pUnkMarshaler = NULL; 
 
		m_cstaEvent=NULL; 
		m_attEvent=NULL; 
	} 
 
DECLARE_REGISTRY_RESOURCEID(IDR_CTIEVENT) 
DECLARE_NOT_AGGREGATABLE(CCTIEvent) 
DECLARE_GET_CONTROLLING_UNKNOWN() 
 
DECLARE_PROTECT_FINAL_CONSTRUCT() 
 
BEGIN_COM_MAP(CCTIEvent) 
	COM_INTERFACE_ENTRY(ICTIEvent) 
	COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p) 
END_COM_MAP() 
 
	HRESULT FinalConstruct() 
	{ 
		m_GenesysEvent=CODEMAX; 
		m_cstaEvent=NULL; 
		m_attEvent=NULL; 
		m_lpList=NULL; 
		CallType=CT_Unknown; 
 
		memset(&ThisDN,0,sizeof(DeviceID_t)); 
		memset(&OtherDN,0,sizeof(DeviceID_t)); 
		memset(&DNIS,0,sizeof(DeviceID_t)); 
		memset(&ANI,0,sizeof(DeviceID_t)); 
		memset(&AgentID,0,sizeof(AgentID_t)); 
		ConnID=0; 
		return CoCreateFreeThreadedMarshaler( 
			GetControllingUnknown(), &m_pUnkMarshaler.p); 
	} 
 
	void FinalRelease() 
	{ 
		if (m_cstaEvent) delete m_cstaEvent; 
		if (m_attEvent) delete m_attEvent; 
		if (m_lpList) 
		{ 
			m_lpList->Release(); 
			m_lpList=NULL; 
		} 
 
		m_pUnkMarshaler.Release(); 
	} 
 
	CComPtr m_pUnkMarshaler; 
 
private: 
	CSTAEvent_t* m_cstaEvent; 
	ATTEvent_t* m_attEvent; 
	LPKVLIST m_lpList; 
 
	//members for mapping to Genesys event 
	DeviceID_t ThisDN; 
	DeviceID_t OtherDN; 
	DeviceID_t DNIS; 
	DeviceID_t ANI; 
	long ConnID; 
	AgentID_t AgentID; 
	CALLTYPES CallType; 
 
	BOOL AppStringToKVlist(char* pAppString,IKVList* pKvlist); 
	BOOL CopyCharToString(char nChar,char* pKey,char* pVal); 
	BOOL AddToKVList(IKVList* pIKvlist,char* pKey,char* pVal); 
	BOOL Initialize(); 
	BOOL CopyProperty(CCTIEvent* newEvent); 
public: 
	EVENTCODES m_GenesysEvent; //the genesys event 
 
	BOOL SetEvent(CSTAEvent_t* cstaEvent); 
	BOOL SetEvent(dnevent* pDnEvent); 
// ICTIEvent 
public: 
	STDMETHOD(get_WebAddr)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_WebPrjType)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_WebNmRoomId)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_WebChatRoomId)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_WebTMail)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_WebCallPhone)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_WebIPAddr)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_WebCustIDBrNo)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_WebCustEmail)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_WebCustMPhone)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_WebCustPhone)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_WebCustName)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_WebReqType)(/*[out, retval]*/ int *pVal); 
	STDMETHOD(get_WebReqID)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD_(LPCTIEVENT, Copy)(); 
	STDMETHOD(get_Extensions)(/*[out, retval]*/ LPKVLIST *pVal); 
	STDMETHOD(get_Reasons)(/*[out, retval]*/ LPKVLIST *pVal); 
	STDMETHOD(get_UserData)(/*[out, retval]*/ LPKVLIST *pVal); 
	STDMETHOD(get_CLID)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_CallingLineName)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_ANI)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_DNIS)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_ThirdPartyDNRole)(/*[out, retval]*/ DNROLES *pVal); 
	STDMETHOD(get_ThirdPartyTrunk)(/*[out, retval]*/ long *pVal); 
	STDMETHOD(get_ThirdPartyQueue)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_ThirdPartyDN)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_OtherDNRole)(/*[out, retval]*/ DNROLES *pVal); 
	STDMETHOD(get_OtherTrunk)(/*[out, retval]*/ long *pVal); 
	STDMETHOD(get_OtherQueue)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_OtherDN)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_ThisDNRole)(/*[out, retval]*/ DNROLES *pVal); 
	STDMETHOD(get_ThisTrunk)(/*[out, retval]*/ long *pVal); 
	STDMETHOD(get_ThisQueue)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_ThisDN)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_ErrorMessage)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_ErrorCode)(/*[out, retval]*/ long *pVal); 
	STDMETHOD(get_AgentMode)(/*[out, retval]*/ AGENTMODES *pVal); 
	STDMETHOD(get_AgentID)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_CallState)(/*[out, retval]*/ CALLSTATES *pVal); 
	STDMETHOD(get_CallType)(/*[out, retval]*/ CALLTYPES *pVal); 
	STDMETHOD(get_NetNodeID)(/*[out, retval]*/ int *pVal); 
	STDMETHOD(get_NetCallID)(/*[out, retval]*/ long *pVal); 
	STDMETHOD(get_NodeID)(/*[out, retval]*/ int *pVal); 
	STDMETHOD(get_CallID)(/*[out, retval]*/ long *pVal); 
	STDMETHOD(get_PrevConnID)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_ConnID)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_CustomerID)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_HomeLocation)(/*[out, retval]*/ BSTR *pVal); 
	STDMETHOD(get_RefID)(/*[out, retval]*/ int *pVal); 
	STDMETHOD(get_Event)(/*[out, retval]*/ EVENTCODES *pVal); 
}; 
 
#endif //__CTIEVENT_H_