www.pudn.com > lucent_softphone.rar > MichelleCTI.h
// MichelleCTI.h : Declaration of the CMichelleCTI #ifndef __MICHELLECTI_H_ #define __MICHELLECTI_H_ #include "resource.h" // main symbols //USER ERROR MESSAGE DEFINITION #define LUCNET_ERR_BASE 0X1000 #define LUCENT_UNKNOWN LUCNET_ERR_BASE+1 #define LUCENT_INVALID_PARAM LUCNET_ERR_BASE+2 #define LUCNET_DNINI_ERR LUCNET_ERR_BASE+3 #define LUCENT_ANSWERCALL_ERR LUCNET_ERR_BASE+4 #define LUCENT_MAKECALL_ERR LUCNET_ERR_BASE+5 #define LUCENT_CONFERENCE_ERR LUCNET_ERR_BASE+6 #define LUCENT_TRANSFERCALL_ERR LUCNET_ERR_BASE+7 #define LUCENT_HOLDCALL_ERR LUCNET_ERR_BASE+8 #define LUCENT_CONSULTATION_ERR LUCNET_ERR_BASE+9 #define LUCENT_CLEARCALL_ERR LUCNET_ERR_BASE+10 #define LUCENT_RETRIEVECALL_ERR LUCNET_ERR_BASE+11 #define LUCENT_RECONNECT_ERR LUCNET_ERR_BASE+12 #define LUCENT_CALL_RELEASED LUCNET_ERR_BASE+13 #define LUCENT_AGENT_LOGOUT_ERR LUCNET_ERR_BASE+14 #define LUCENT_AGENT_LOGIN_ERR LUCNET_ERR_BASE+15 #define LUCENT_AGENT_SETNOTREADY_ERR LUCNET_ERR_BASE+16 #define LUCENT_AGENT_SETREADY_ERR LUCNET_ERR_BASE+17 #define LUCENT_ADDRESSTYPE_ERR LUCNET_ERR_BASE+18//Specified a wrong address type // user define message for lucent #define UM_CTI WM_USER+1 //This message should be processed by michelle cti object #define UM_APIFAILED WM_USER+2 //There are some error when operating a csta or acs api #define UM_DN WM_USER+3 //This csta event should be processed by michelle dn object #define UM_CMDMSG WM_USER+4 //This is a message come from a csta api (not a outter message) #define UM_CANCELDIAL WM_USER+5 //This dialing was canceled #include "DirectoryNumber.h" #include "lucentCtiCP.h" ///////////////////////////////////////////////////////////////////////////// // CMichelleCTI class ATL_NO_VTABLE CMichelleCTI : public CComObjectRootEx, public CComCoClass , public IConnectionPointContainerImpl , public IMichelleCTI, public CProxy_IMichelleCTIEvents< CMichelleCTI >, public IWebCTI { public: CMichelleCTI() { m_pUnkMarshaler = NULL; } DECLARE_REGISTRY_RESOURCEID(IDR_MICHELLECTI) DECLARE_NOT_AGGREGATABLE(CMichelleCTI) DECLARE_GET_CONTROLLING_UNKNOWN() DECLARE_PROTECT_FINAL_CONSTRUCT() BEGIN_COM_MAP(CMichelleCTI) COM_INTERFACE_ENTRY(IMichelleCTI) COM_INTERFACE_ENTRY(IConnectionPointContainer) COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p) COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer) COM_INTERFACE_ENTRY(IWebCTI) END_COM_MAP() BEGIN_CONNECTION_POINT_MAP(CMichelleCTI) CONNECTION_POINT_ENTRY(DIID__IMichelleCTIEvents) END_CONNECTION_POINT_MAP() HRESULT FinalConstruct() { memset(&m_serverId,0,sizeof(ACSHandle_t)); memset(&m_loginId,0,sizeof(LoginID_t)); memset(&m_pwdId,0,sizeof(Passwd_t)); m_serverHandle=0; m_invokeId=0; m_iDn=NULL; m_pEventBuf=NULL; m_nEventLen=0; m_lErrCode=0; return CoCreateFreeThreadedMarshaler( GetControllingUnknown(), &m_pUnkMarshaler.p); } void FinalRelease() { m_pUnkMarshaler.Release(); } CComPtr m_pUnkMarshaler; public: static HINSTANCE m_hInstance; static HWND m_hSynWnd; static HANDLE m_hPumpTrd; static UINT m_dwPumpId; ACSHandle_t m_serverHandle; //the server handle char* m_pEventBuf; // the event buffer int m_nEventLen; //the event buffer length IDirectoryNumber* m_iDn; //the registed dn interface long m_lErrCode; //the error code ERRORTYPES m_errType; //the error type string m_ErrMsg; BOOL DefaultHandler(long cstaEvent); private: ServerID_t m_serverId; //lucent server name LoginID_t m_loginId; // the login user name Passwd_t m_pwdId; // the user's password InvokeID_t m_invokeId; //the event's invoke id // IMichelleCTI public: // IMichelleCTI STDMETHOD_(void, UnregisterDN)(/*[in]*/ LPDN dn); STDMETHOD_(LPDN, RegisterDN)(/*[in]*/ BSTR dn, /*[in, optional, defaultvalue(AT_DN)]*/ ADDRTYPES type, /*[in, optional]*/ BSTR acdpos); STDMETHOD_(void, Uninitialize)(); STDMETHOD_(BOOL, Initialize)(/*[in]*/ PBXTYPES pbxtype, /*[in]*/ BSTR server, /*[in]*/ int port, /*[in]*/ BSTR name, /*[in]*/ BSTR pass); STDMETHOD(get_ErrMsg)(/*[out, retval]*/ BSTR *pVal); STDMETHOD(get_ErrCode)(/*[out, retval]*/ long *pVal); STDMETHOD(get_ErrType)(/*[out, retval]*/ ERRORTYPES *pVal); STDMETHOD(get_Initialized)(/*[out, retval]*/ BOOL *pVal); // IWebCTI STDMETHOD_(void, ReportResult)(/*[in]*/ BSTR ReqID, /*[in]*/ BOOL result, /*[in]*/ BSTR reason); STDMETHOD_(void, ReportConfirm)(/*[in]*/ BOOL confirm); STDMETHOD_(void, ReportStatus)(/*[in]*/ BSTR AgentID, /*[in]*/ AGENTSTATES AgentState); STDMETHOD_(void, Login)(/*[in]*/ BSTR AgentID); STDMETHOD_(void, Uninit)(); STDMETHOD_(BOOL, Init)(/*[in]*/ BSTR server, /*[in]*/ int port); }; #endif //__MICHELLECTI_H_