📄 tapiline.h
字号:
#ifndef TAPILINE_H
#define TAPILINE_H
// ----------------------------------------------------------------------------
// Copyright (c) Avaya 2002. All rights reserved.
//
// FILE: TAPILine.h
//
// Derived from
// \CTI\CTIntegrator\Develop\tapisample\\tapiline.cpp
//
// This is the definition file for the tapi support classes.
// See tapiline.cpp for the implementation of these classes
//
// ----------------------------------------------------------------------------
#define LINEDEVSTATE_ALL 0x01FFFFFF
#define LINEADDRESSSTATE_ALL 0x000001FF
#define TEST_FOR_SILENCE 1234
class TAPIConnection;
// ----------------------------------------------------------------------------
// Keep track of asynchronous replies from TAPI functions
typedef struct
{
LPCTSTR Name; // Name of the function that triggered the request
HCALL Call; // Handle of the main call used in the request
} REQUEST_INFO;
// ----------------------------------------------------------------------------
// Class wrapper for TAPI line handling.
class TAPILine
{
public:
TAPILine(TAPIConnection *pConnection);
~TAPILine();
void OnEvent(DWORD Device, DWORD Msg, DWORD Param1, DWORD Param2, DWORD Param3);
HRESULT Open(HLINEAPP hLineApp, DWORD *ApiVersions,
DWORD LineID, DWORD CallPrivilege, DWORD MediaModes);
// Functions to support telephony commands
void MakeCall(LPCTSTR pszAddress);
void HangUp();
void AnswerCall();
void HoldCall();
void RetrieveCall();
void ConferenceCall();
void TransferCall(LPCTSTR pszAddress);
void SetDefaultExt(LPCTSTR pszExt);
LPCTSTR GetDefaultExt() { return (LPCTSTR) m_strDefaultExt; }
public:
DWORD m_LineID; // My index according to my parent
HLINE m_hLine; // My line handle according to TAPI
DWORD m_extension; // The IP Office Extension number that relates to this line
DWORD m_waveOutId; // Index to the wave out device
// Call handles
HCALL m_hConnectedCall; // My current call handle according to TAPI (0 if idle)
HCALL m_hWaitingCall; // I am ringing this call (0 if none)
HCALL m_hHeldCall; // My held call handle according to TAPI (0 if nothing on hold)
HCALL m_hPendingCall; // This call is waiting to be answered according to TAPI (0 if none)
HCALL m_hConferenceCall; // This is the conference call according to TAPI (0 if none)
// Request handles
CMap<HRESULT, HRESULT&, REQUEST_INFO, REQUEST_INFO&> m_Requests;
protected:
// Derived classes could override the behaviour when receiving TAPI events
virtual void OnReply(LONG RequestID, HRESULT Result);
virtual void OnClose();
virtual void OnAddressState(DWORD AddressID, DWORD AddressState);
virtual void OnCallInfo(HCALL hCall, DWORD CallInfoState);
virtual void OnCallState(HCALL hCall, DWORD CallState, DWORD CallStateDetail, DWORD CallPrivilege);
virtual void OnNewCall(DWORD AddressID, HCALL hCall, DWORD CallPrivilege);
virtual void OnLineDevState(DWORD DeviceState, DWORD DeviceStateDetail1, DWORD DeviceStateDetail2);
// Parent messaging
void SendInfoMsg(LPCTSTR pszCommand);
void CheckError(HRESULT hr, LPCTSTR pszCommand);
void StatusChange();
private:
TAPIConnection *m_pTAPIConnection;
CString m_strDefaultExt;
};
typedef TAPILine *PTAPILINE;
extern void getTapiString(CString& result, void *ptr, DWORD Size, DWORD Offset);
extern HRESULT loopLineGetCallInfo(HCALL hCall, LINECALLINFO*& pCallInfo);
extern HRESULT loopLineGetID(DWORD& result, HLINE hLine, DWORD AddressID,
HCALL hCall, DWORD Select, LPCSTR pszDeviceClass);
extern HRESULT loopLineGetAddressCaps(HLINEAPP hLineApp, DWORD DeviceID, DWORD AddressID,
DWORD APIVersion, DWORD ExtVersion, LINEADDRESSCAPS*& pAddressCaps);
#endif TAPILINE_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -