📄 directorynumber.h
字号:
// DirectoryNumber.h : Declaration of the CDirectoryNumber
#ifndef __DIRECTORYNUMBER_H_
#define __DIRECTORYNUMBER_H_
#include "resource.h" // main symbols
#include "ctcv4CP.h"
enum PHONE_STATE
{
CTC_NULL=3, // means this state's index in this table
CTC_INITIAL=3,
CTC_ACTIVE=0,
CTC_DELIVER=1,
CTC_RECEIVE=4,
CTC_HOLD=2,
CTC_UNKNOWN=5,
CTC_ERROR=6
};
/////////////////////////////////////////////////////////////////////////////
// CDirectoryNumber
class ATL_NO_VTABLE CDirectoryNumber :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<CDirectoryNumber, &CLSID_DirectoryNumber>,
public IConnectionPointContainerImpl<CDirectoryNumber>,
public IDirectoryNumber,
public IGenesysOB,
public CProxy_IDirectoryNumberEvents< CDirectoryNumber >
{
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(IGenesysOB)
COM_INTERFACE_ENTRY(IConnectionPointContainer)
COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(CDirectoryNumber)
CONNECTION_POINT_ENTRY(DIID__IDirectoryNumberEvents)
END_CONNECTION_POINT_MAP()
HRESULT FinalConstruct()
{
m_pCTI=NULL;
m_posDN=NULL;
m_extDN=NULL;
m_hMonitor=NULL;
m_bDisableDialing=FALSE;
m_hNotifyApi=NULL;
m_hConfirm=NULL;
return CoCreateFreeThreadedMarshaler(
GetControllingUnknown(), &m_pUnkMarshaler.p);
}
void FinalRelease()
{
Uninitialize();
m_pUnkMarshaler.Release();
}
CComPtr<IUnknown> m_pUnkMarshaler;
public:
//property
CMichelleCTI *m_pCTI;
CDirectoryNumber *m_posDN;
CDirectoryNumber *m_extDN;
ctcDeviceString m_ThisDN;
ctcChanId m_channelId;
ADDRTYPES m_type;
//method
//The CTC DN monitor thread
static UINT _stdcall MointorThread(void* p);
BOOL DefaultHandler(ctcEventData* pEvent,list<WPARAM>* eventList); // the main message process handler
BOOL Initialize(char* dn,ctcChanId chanelID, ADDRTYPES type, CMichelleCTI *pCTI); //initialize the dn
void Uninitialize(); //Uninitialize this dn
BOOL OnDialing(); // show dialing dialog
private:
//property
BOOL m_bDisableDialing; // Disable the dialing dialog
HANDLE m_hMonitor;//monitor thread management
UINT m_idMonitor; //THE monitor thread id
BOOL m_bMonitorOn; // if set false, the monitor should be closed
//some info prepaired for VB
UINT m_ActiveCallRef;
UINT m_HoldCallRef;
// the api fail info
long m_lErrCode;
string m_ErrMsg;
//obtain states
BOOL m_bInvokingApi; // Whether there is a api is in invoking
ctcEventData m_curState; // the saved current telephon state
//event for synchronize
HANDLE m_hNotifyApi; // Notify the invoking api that the phone state has been updated,ini signal
HANDLE m_hConfirm; //defalult handler confirm api has check the phone state, ini nonsignal
//method
void ClearApiInfo(); // clear some info repaired for execute method
void DNPackFireEvent(ctcEventData* pEvent,BOOL& bNotFire,list<WPARAM>* eventList); // fire FAKE event to vb
void RefreshSavedStatus(ctcEventData* pEvent); // Refresh the saved telephon state with current event
void PumpPhoneState(char* pData); //for record info, output the phone's current state
BOOL InSet(UINT ctcState,list<PHONE_STATE> phoneState); //Check if the ctc stae is included in the phone state list
// Validate the specified routine. If it is, return a event list that represent the routine
BOOL ValidateStateRoutine(UINT startState,UINT endState,list<UINT>*routine);
BOOL SearchRoutine(PHONE_STATE start,PHONE_STATE end,list<UINT>* eventList,int* level);
// Translate kvlist to string
BOOL KVListToAppString(IKVList* pkvlist, char* pAppString,UINT bufLen);
BOOL GetAnsiFromBSTR(char** dest, BSTR source);
BOOL GetAnsiFromInt(char** dest,int source);
//convert from ctc state to phone state
PHONE_STATE GetPhoneState(UINT ctcState);
// IDirectoryNumber
STDMETHOD_(BOOL, SendDTMF)(/*[in]*/ BSTR tone);
STDMETHOD(get_RaiseAllEvents)(/*[out, retval]*/ VARIANT_BOOL *pVal);
STDMETHOD(put_RaiseAllEvents)(/*[in]*/ VARIANT_BOOL newVal);
STDMETHOD(get_DisableDialingDialog)(/*[out, retval]*/ VARIANT_BOOL *pVal);
STDMETHOD(put_DisableDialingDialog)(/*[in]*/ VARIANT_BOOL newVal);
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(put_ErrReport)(/*[in]*/ BOOL newVal);
STDMETHOD(get_ErrReport)(/*[out, retval]*/ BOOL *pVal);
STDMETHOD(put_DND)(/*[in]*/ BOOL newVal);
STDMETHOD(get_DND)(/*[out, retval]*/ BOOL *pVal);
STDMETHOD(get_OnHook)(/*[out, retval]*/ BOOL *pVal);
STDMETHOD(get_AgentMode)(/*[out, retval]*/ AGENTMODES *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 newVal )
{
return E_NOTIMPL;
}
STDMETHOD(put_ExpectedStartDate)(BSTR )
{
return E_NOTIMPL;
}
STDMETHOD_(BOOL, Init)(LPKVLIST data)
{
return TRUE;
}
STDMETHOD_(VOID, Uninit)()
{
return;
}
STDMETHOD(NeverCallThisPhone)(VARIANT_BOOL * bRet)
{
if (bRet == NULL)
return E_POINTER;
return E_NOTIMPL;
}
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -