www.pudn.com > tapi3.zip > TAPICALL.H


// tapicall.h : header file 
// (c) Dialogic corp 1995, 1996 
// 
 
// simplified call states 
#ifndef IDLE 
#define IDLE			0 
#endif 
#define MAKING			1 
#define STOP_MAKING		2 
#define PROGRESS		3 
#define DIALING			4 
#define OFFERING		5 
#define ANSWERING		6 
#define CONNECTED		7 
#define	HOLD			8 
#define DROPPING		9 
#define DISCONNECTED 	10 
 
// digits monitoring/gathering states 
#define	MONITOR_DIGITS			0x0001 
#define START_GATHER			0x0002 
#define RESET_MONITOR_DIGITS	0x0004 
#define END_GATHER_DIGITS		0x0008 
#define RESET_GATHER_RESULT		0x0010 
 
// call direction 
#define INBOUND 		1 
#define OUTBOUND		2 
 
// errors occuring in call progress 
#define MAKE_FAILED			0x00000001 
#define ANSWER_FAILED		0x00000002 
#define DROP_FAILED			0x00000004 
#define DEALLOCATE_FAILED	0x00000008 
// to be continued. . . 
 
typedef struct _callstate { 
	WORD wCallState; 
	WORD wCallDirection; 
	DWORD dwTapiCallState; 
	DWORD dwErrors; 
	} TAPICALLSTATE, *PTAPICALLSTATE; 
 
typedef struct _monitorstate { 
	WORD wState; 
	WORD wLastDigit; 
	DWORD dwDigitMode; 
	DWORD dwGatherResult; 
	WORD wMonitorCount; 
	} MONITORSTATE, *PMONITORSTATE; 
 
///////////////////////////////////////////////////////////////////////////// 
// CTapiCall command target 
 
class CTapiWave;	 
 
class CTapiCall : public CObject 
{ 
	DECLARE_DYNCREATE(CTapiCall) 
protected: 
	CTapiCall();           // protected constructor used by dynamic creation 
	//virtual ~CTapiCall(); 
 
// Attributes 
public: 
	HCALL m_hCall; 
	char m_szDigits[32];	//digits for gathering 
	HWND m_hStatusWnd;	// status window handle 
	HWND m_hCallAlertWnd;	// status window handle 
	DWORD m_dwCallAlert;	// status window aler identifier	 
	UINT m_uiAlertMsg;		// special message for alerting callinfo window 
 
protected: 
	CTapiLine *m_pctLine; 
	TAPICALLSTATE m_CallState; 
	MONITORSTATE m_MonitorState; 
	HANDLE	m_hStateSem; 
	HANDLE  m_hMonitorStateSem; 
	CTapiWave *m_pWave; 
 
// Operations 
public: 
	virtual ~CTapiCall(); 
	CTapiCall(HCALL hCall, CTapiLine *lpLine=NULL);           // public constructor 
	const TAPICALLSTATE& GetFullCallState() 
	{return m_CallState;} 
	WORD GetCallState() 
	{return m_CallState.wCallState;} 
	WORD GetCallDirection() 
	{return m_CallState.wCallDirection;} 
	DWORD GetCallError() 
	{return m_CallState.dwErrors;} 
	BOOL UpdateCallState(WORD wCallState=0xffff, WORD wDirection=0xffff, 
		 DWORD dwTapiCallState = 0xffff, DWORD dwErrors=0L);	  	// verify & update the full state 
	void SetLine(CTapiLine *pLine)			// wrapper for m_pctLine 
	{m_pctLine = pLine;} 
	CTapiLine *GetLine() 
	{return m_pctLine;} 
	HANDLE GetStateSemHandle()	// get state sem 
	{return m_hStateSem;} 
	BOOL InitWave(); 
	BOOL ResetWave(); 
	BOOL Play(LPSTR lpName); 
	BOOL Record(int nFormatID=10, DWORD dwSize=65534); 
	BOOL PlayEx(LPCTSTR lpName); 
	BOOL RecordEx(LPCTSTR lpName, DWORD dwRecTime, int nFormatID=10); 
	BOOL Pause(); 
	BOOL Resume(); 
	BOOL StopWave(); 
	void FinishPlay(WPARAM wParam, LPARAM lParam); 
	void FinishRecord(WPARAM wParam, LPARAM lParam, LPSTR lpName=NULL); 
	DWORD GetHWaveIn(); 
	DWORD GetHWaveOut(); 
	DWORD GetWaveStatus(); 
	DWORD GetWaveVolume(); 
	void  SetWaveVolume(DWORD dwVol=0xffff); 
	LONG GatherDigits(DWORD dwNumDigits, LPCSTR lpszTermDigits,  
    			DWORD dwFirstDigitTimeout, DWORD dwInterDigitTimeout, LPSTR lpBuf); 
	LONG MonitorDigits(DWORD dwMode); 
	BOOL UpdateMonitorState(WORD wType, DWORD dwDigit, DWORD dwMode); 
	BOOL GetMonitorState(PMONITORSTATE pMonState); 
	DWORD GetRecPlayStatus(); 
	virtual void NotifyCallWindow()		// post a message that status has changed	 
	{::PostMessage(m_hStatusWnd, WM_COMMAND, MAKELONG(m_dwCallAlert,BN_CLICKED), (LPARAM)m_hCallAlertWnd);} 
	virtual void NotifyCallWindow(UINT wParam, LONG lParam)		// post a message that status has changed	 
	{::PostMessage(m_hStatusWnd, m_uiAlertMsg, wParam, lParam);} 
 
 
 
// Overrides 
	// ClassWizard generated virtual function overrides 
	//{{AFX_VIRTUAL(CTapiCall) 
	//}}AFX_VIRTUAL 
 
// Implementation 
//protected: 
//	virtual ~CTapiCall(); 
 
	// Generated message map functions 
	//{{AFX_MSG(CTapiCall) 
		// NOTE - the ClassWizard will add and remove member functions here. 
	//}}AFX_MSG 
 
//	DECLARE_MESSAGE_MAP() 
}; 
 
/////////////////////////////////////////////////////////////////////////////