⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 directorynumber.h

📁 利用AVAYA AES的TASPI开发的一套软电话系统,仅供参考,ACTIVEX形式的.
💻 H
字号:
	
// DirectoryNumber.h : Declaration of the CDirectoryNumber

#ifndef __DIRECTORYNUMBER_H_
#define __DIRECTORYNUMBER_H_

#include "resource.h"       // main symbols
#include "lucentCtiCP.h"

#include "dnevent.h"

#include <string>
using namespace std;

#define ERR_INI	-100
/////////////////////////////////////////////////////////////////////////////
// CDirectoryNumber
class ATL_NO_VTABLE CDirectoryNumber : 
	public CComObjectRootEx<CComMultiThreadModel>,
	public CComCoClass<CDirectoryNumber, &CLSID_DirectoryNumber>,
	public IConnectionPointContainerImpl<CDirectoryNumber>,
	public IDirectoryNumber,
	public CProxy_IDirectoryNumberEvents< CDirectoryNumber >,
	public IGenesysOB
{
public:
	CDirectoryNumber()
	{
		m_pUnkMarshaler = NULL;
	}

DECLARE_REGISTRY_RESOURCEID(IDR_DIRECTORYNUMBER)
DECLARE_NOT_AGGREGATABLE(CDirectoryNumber)
DECLARE_GET_CONTROLLING_UNKNOWN()

DECLARE_PROTECT_FINAL_CONSTRUCT()

BEGIN_COM_MAP(CDirectoryNumber)
	COM_INTERFACE_ENTRY(IDirectoryNumber)
	COM_INTERFACE_ENTRY(IConnectionPointContainer)
	COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
	COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
	COM_INTERFACE_ENTRY(IGenesysOB)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(CDirectoryNumber)
CONNECTION_POINT_ENTRY(DIID__IDirectoryNumberEvents)
END_CONNECTION_POINT_MAP()


	HRESULT FinalConstruct()
	{
		m_invokeId=0;
		m_serverHandle=0;
		m_monitorId=0;
		m_lErrCode=ERR_INI;
		m_ErrMsg="";
		m_bConnect=FALSE;
		m_splitMonitorId=0;

		m_bIsCmdMsg=FALSE;
		memset(&m_ani,0,sizeof(DeviceID_t));
		memset(&m_dnis,0,sizeof(DeviceID_t));
		memset(&m_activeConnId,0,sizeof(ConnectionID_t));
		memset(&m_holdConnId,0,sizeof(ConnectionID_t));
		memset(&m_deviceId,0,sizeof(DeviceID_t));
		memset(&m_agentId,0,sizeof(AgentID_t));
		memset(&m_agentPwd,0,sizeof(AgentPassword_t));
		memset(&m_agentGroup,0,sizeof(AgentGroup_t) );
		memset(&m_thisDevice,0,sizeof (ExtendedDeviceID_t));
		memset(&m_otherDevice,0,sizeof (ExtendedDeviceID_t));
		m_agentStat=AS_NotReady;
		m_bLogged=FALSE;
		m_callType=CT_Unknown;

		return CoCreateFreeThreadedMarshaler(
			GetControllingUnknown(), &m_pUnkMarshaler.p);
	}

	void FinalRelease()
	{
		m_pUnkMarshaler.Release();

		
	}

	CComPtr<IUnknown> m_pUnkMarshaler;
public:
	BOOL DefaultHandler(dnevent* event);

	BOOL Initialize(BSTR deviceId,ACSHandle_t serverHandle,InvokeID_t invokeId);
	void Uninitialize();
	BOOL KVListToAppString(IKVList* pkvlist, char* pAppString,UINT bufLen);
	BOOL GetAnsiFromBSTR(char** dest, BSTR source);
	BOOL GetAnsiFromInt(char** dest,int source);
	BOOL ValidateString(char* pStr,UINT bufLen);

	InvokeID_t m_invokeId;
	ACSHandle_t m_serverHandle;
	CSTAMonitorCrossRefID_t m_monitorId;
	CSTAMonitorCrossRefID_t m_splitMonitorId;
	BOOL m_bIsCmdMsg;
private:
	DeviceID_t m_deviceId; //the monitered device

	ConnectionID_t m_activeConnId; // the active connecton id
	ConnectionID_t m_holdConnId; // the hold connection id

	ExtendedDeviceID_t m_otherDevice; // other dn in this evnet
	ExtendedDeviceID_t m_thisDevice; //this dn in this event
	DeviceID_t m_dnis;//the dnis (the called device NO)
	DeviceID_t m_ani;//the ani (the calling device NO)

	AgentID_t m_agentId;//agent id
	AgentPassword_t m_agentPwd;// agent password
	AgentGroup_t m_agentGroup; //agent group
	AGENTSTATES m_agentStat;//agent state
	BOOL m_bLogged;
	CALLTYPES m_callType; // the call type

	long m_lErrCode;
	string m_ErrMsg;

	BOOL m_bConnect; // the connect state flag
	BOOL OnCallDial();
	BOOL OnConsultDial();
	void DNPostMessage(UINT msg, WPARAM wParam ,LPARAM lParam);
	BOOL FillEvent(dnevent* pEvent);// Before this event is fired out, fill some info into it

	BOOL GetCallInfo(CSTADeliveredEvent_t* pDeliverEvent);
	BOOL GetCallInfo(CSTAEstablishedEvent_t* pDeliverEvent);
	BOOL GetCallInfo(CSTAHeldEvent_t* pHeldEvent);
	BOOL GetCallInfo(CSTARetrievedEvent_t* pRetrieveEvent);
	BOOL GetCallInfo(CSTAConnectionClearedEvent_t* pConnclearEvnet);
	BOOL GetCallInfo(CSTAConferencedEvent_t* pConfer);
	BOOL GetCallInfo(CSTATransferredEvent_t* pTransfer);
	BOOL GetCallInfo(CSTAFailedEvent_t* pFailed);
//	BOOL GetCallInfo(CSTAFailedEvent_t* pFailed);
	BOOL GetCallInfo(CSTAOriginatedEvent_t* pOriginated);
	BOOL GetCallInfo(CSTALoggedOnEvent_t* pLogon);
	BOOL GetCallInfo(CSTALoggedOffEvent_t* pLogoff);

	BOOL MonitorSplit(AgentGroup_t* agentSplit);// monitor a acd group for agent login and logout
	void StopMonitor(CSTAMonitorCrossRefID_t monitorId); //stop a monitor

// IDirectoryNumber
public:
	STDMETHOD_(BOOL, SendDTMF)(/*[in]*/ BSTR tone);
	STDMETHOD(get_HoldConnID)(/*[out, retval]*/ BSTR *pVal);
	STDMETHOD(get_ActiveConnID)(/*[out, retval]*/ BSTR *pVal);
	STDMETHOD(ID2ConnID)(/*[in]*/ long id, /*[out, retval]*/ BSTR *connid);
	STDMETHOD(get_HoldID)(/*[out, retval]*/ long *pVal);
	STDMETHOD(get_ActiveID)(/*[out, retval]*/ long *pVal);
	STDMETHOD_(BOOL, UpdateData)(/*[in, optional]*/ BSTR connid, /*[in]*/ LPKVLIST data);
	STDMETHOD_(BOOL, DeleteData)(/*[in, optional]*/ BSTR connid, /*[in]*/ BSTR key);
	STDMETHOD_(BOOL, DeleteAllData)(/*[in, optional]*/ BSTR connid);
	STDMETHOD_(BOOL, AttachData)(/*[in, optional]*/ BSTR connid, /*[in]*/ LPKVLIST data);
	STDMETHOD_(BOOL, CancelForward)(/*[in, optional]*/ FORWARDMODES mode);
	STDMETHOD_(BOOL, Forward)(/*[in]*/ BSTR dn, /*[in, optional]*/ FORWARDMODES mode);
	STDMETHOD_(BOOL, AlternateCall)();
	STDMETHOD_(BOOL, SingleStepTransfer)(/*[in]*/ BSTR dn, /*[in, optional]*/ LPKVLIST data);
	STDMETHOD_(BOOL, MuteTransfer)(/*[in]*/ BSTR dn, /*[in, optional]*/ LPKVLIST data);
	STDMETHOD_(BOOL, RedirectCall)(/*[in]*/ BSTR dn, /*[in, optional]*/ BSTR connid);
	STDMETHOD_(BOOL, MergeCalls)(/*[in, optional]*/ MERGETYPES type);
	STDMETHOD_(BOOL, ReconnectCall)();
	STDMETHOD_(BOOL, DeleteFromConference)(/*[in]*/ BSTR dn);
	STDMETHOD_(BOOL, CompleteConference)();
	STDMETHOD_(BOOL, InitConferenceCall)(/*[in]*/ BSTR dn, /*[in, optional]*/ LPKVLIST data);
	STDMETHOD_(BOOL, CompleteTransfer)();
	STDMETHOD_(BOOL, InitTransferCall)(/*[in]*/ BSTR dn, /*[in, optional]*/ LPKVLIST data);
	STDMETHOD_(BOOL, RetrieveCall)(/*[in, optional]*/ BSTR connid);
	STDMETHOD_(BOOL, HoldCall)(/*[in, optional]*/ BSTR connid);
	STDMETHOD_(BOOL, ReleaseCall)(/*[in, optional]*/ BSTR connid, /*[in, optional]*/ BOOL hangup = FALSE);
	STDMETHOD_(BOOL, AnswerCall)(/*[in, optional]*/ BSTR connid);
	STDMETHOD_(BOOL, MakeCall)(/*[in]*/ BSTR dn, /*[in, optional]*/ LPKVLIST data);
	STDMETHOD_(BOOL, AgentSetNotReady)(/*[in, optional]*/ AGENTMODES mode);
	STDMETHOD_(BOOL, AgentSetReady)(/*[in, optional]*/ AGENTMODES mode);
	STDMETHOD_(BOOL, AgentLogout)();
	STDMETHOD_(BOOL, AgentLogin)(/*[in]*/ BSTR AgentID, /*[in, optional]*/ BSTR AgentPassword, /*[in, optional]*/ BSTR ACDQ, /*[in, optional]*/ AGENTMODES mode);
	STDMETHOD(get_ErrReport)(/*[out, retval]*/ BOOL *pVal);
	STDMETHOD(get_DND)(/*[out, retval]*/ BOOL *pVal);
	STDMETHOD(get_OnHook)(/*[out, retval]*/ BOOL *pVal);
	STDMETHOD(get_AgentState)(/*[out, retval]*/ AGENTSTATES *pVal);
	STDMETHOD(get_ACDQ)(/*[out, retval]*/ BSTR *pVal);
	STDMETHOD(get_AgentID)(/*[out, retval]*/ BSTR *pVal);
	STDMETHOD(get_Logged)(/*[out, retval]*/ BOOL *pVal);
	STDMETHOD(get_Type)(/*[out, retval]*/ ADDRTYPES *pVal);
	STDMETHOD(get_Number)(/*[out, retval]*/ BSTR *pVal);
	STDMETHOD(get_Registered)(/*[out, retval]*/ BOOL *pVal);
	STDMETHOD(get_ErrMsg)(/*[out, retval]*/ BSTR *pVal);
	STDMETHOD(get_ErrCode)(/*[out, retval]*/ long *pVal);
// IGenesysOB
	STDMETHOD(get_RescheduleFlag)(int * pVal)
	{
		if (pVal == NULL)
			return E_POINTER;
			
		return E_NOTIMPL;
	}
	STDMETHOD(get_CampaignBatchID)(int * pVal)
	{
		if (pVal == NULL)
			return E_POINTER;
			
		return E_NOTIMPL;
	}
	STDMETHOD(get_CampaignID)(int * pVal)
	{
		if (pVal == NULL)
			return E_POINTER;
			
		return E_NOTIMPL;
	}
	STDMETHOD(get_Campaign)(BSTR * pVal)
	{
		if (pVal == NULL)
			return E_POINTER;
			
		return E_NOTIMPL;
	}
	STDMETHOD(get_ProjectName)(BSTR * pVal)
	{
		if (pVal == NULL)
			return E_POINTER;
			
		return E_NOTIMPL;
	}
	STDMETHOD(get_CustomerID)(int * pVal)
	{
		if (pVal == NULL)
			return E_POINTER;
			
		return E_NOTIMPL;
	}
	STDMETHOD(get_CustomerName)(BSTR * pVal)
	{
		if (pVal == NULL)
			return E_POINTER;
			
		return E_NOTIMPL;
	}
	STDMETHOD(get_CustomerTitle)(BSTR * pVal)
	{
		if (pVal == NULL)
			return E_POINTER;
			
		return E_NOTIMPL;
	}
	STDMETHOD(get_EventID)(int * pVal)
	{
		if (pVal == NULL)
			return E_POINTER;
			
		return E_NOTIMPL;
	}
	STDMETHOD(put_EventID)(int pVal)
	{
		return E_NOTIMPL;
	}
	STDMETHOD(get_PhoneNumber)(BSTR * pVal)
	{
		if (pVal == NULL)
			return E_POINTER;
			
		return E_NOTIMPL;
	}
	STDMETHOD(put_PhoneNumber)(BSTR pVal)
	{
		return E_NOTIMPL;
	}
	STDMETHOD(put_NeverCall)(BOOL)
	{
		return E_NOTIMPL;
	}
	STDMETHOD(put_ExpectedStartDate)(BSTR )
	{
		return E_NOTIMPL;
	}
	STDMETHOD_(BOOL, Init)(LPKVLIST data)
	{
		return 0;
	}
	STDMETHOD_(VOID, Uninit)()
	{
		return;
	}
	STDMETHOD(get_AgentMode)(/*[out, retval]*/ AGENTMODES *pVal)
	{
		*pVal=AM_Unknown;
		return S_OK;
	}
	STDMETHOD(put_DND)(/*[in]*/ BOOL newVal)
	{
		return S_OK;
	}
	STDMETHOD(put_ErrReport)(/*[in]*/ BOOL newVal)
	{
		return S_OK;
	}

};

#endif //__DIRECTORYNUMBER_H_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -