📄 ipgatewaydlg.h
字号:
// IPGatewayDlg.h : header file
//
#if !defined(AFX_IPGATEWAYDLG_H__792286B9_DFDB_40A7_A0C4_EAC3A9BDA076__INCLUDED_)
#define AFX_IPGATEWAYDLG_H__792286B9_DFDB_40A7_A0C4_EAC3A9BDA076__INCLUDED_
#include "shpa3api.h" // Added by ClassView
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// IP channel protocol
#define PROTOCOL_H323 15 // H323
#define PROTOCOL_SIP 16 // SIP
// max number of the same channel
#define MAX_CHANNEL 128
// Analog channel state
enum ANALOGCH_STATE
{
E_STATE_ANALOG_UNAVAILABLE, // channel unavailable
E_STATE_ANALOG_IDLE, // idle
E_STATE_ANALOG_WAIT_CALLER_CONNECT, // wait for the caller of this Analog channel to connect
E_STATE_ANALOG_PLAY_SELECT, // go to play select music
E_STATE_ANALOG_CHECK_PLAY_SELECT, // playing select music
E_STATE_ANALOG_WAIT_IP_DIAL, // wait for the app to dial with IP channel
E_STATE_ANALOG_WAIT_IP_PICKUP, // wait for the remote ip user to pick up
E_STATE_ANALOG_WAIT_HANGUP, // remote ip user has picked up,wait for anyone to hang up
E_STATE_ANALOG_CALLOUT, // go to dial with this Analog channel
E_STATE_ANALOG_WAIT_CALLEE_PICKUP, // wait for the callee of this Analog channel to pickup
E_STATE_ANALOG_CALLEE_PICKEDUP, // the callee of this Analog channel has picked up
E_STATE_ANALOG_NOANALOG // ?
};
// SS1 channel state
enum SS1CH_STATE
{
E_STATE_SS1_UNAVAILABLE, // channel unavailable
E_STATE_SS1_IDLE, // idle
E_STATE_SS1_WAIT_CALLER_CONNECT, // wait for the caller of this SS1 channel to connect
E_STATE_SS1_PLAY_SELECT, // go to play select music
E_STATE_SS1_CHECK_PLAY_SELECT, // playing select music
E_STATE_SS1_WAIT_IP_DIAL, // wait for the app to dial with IP channel
E_STATE_SS1_WAIT_IP_PICKUP, // wait for the remote ip user to pick up
E_STATE_SS1_WAIT_HANGUP, // remote ip user has picked up,wait for anyone to hang up
E_STATE_SS1_CALLOUT, // go to dial with this SS1 channel
E_STATE_SS1_WAIT_CALLEE_PICKUP, // wait for the callee of this SS1 channel to pick up
E_STATE_SS1_CALLEE_PICKEDUP, // the callee of this SS1 channel has picked up
E_STATE_SS1_NOSS1 // ?
};
// IP channel state
enum IPCH_STATE
{
E_STATE_IP_UNAVAILABLE, // channel unavailable
E_STATE_IP_IDLE, // idle
E_STATE_IP_WAIT_CALLER_CONNECT, // wait for the caller of this IP channel to connect
E_STATE_IP_PLAY_SELECT1, // go to play select1 music
E_STATE_IP_CHECK_PLAY_SELECT1, // playing select1 music
E_STATE_IP_PLAY_SELECT2, // go to play select2 music
E_STATE_IP_CHECK_PLAY_SELECT2, // playing select2 music
E_STATE_IP_WAIT_LINKCH_DIAL, // wait for the app to dial with linked channel
E_STATE_IP_WAIT_LINKCH_PICKUP, // wait for the remote user to pick up
E_STATE_IP_WAIT_HANGUP, // the remote user has picked up, wait for anyone to hang up
E_STATE_IP_CALLOUT, // go to dial with this IP channel
E_STATE_IP_WAIT_CALLEE_PICKUP, // wait for the callee of this IP channel to pick up
E_STATE_IP_CALLEE_PICKEDUP, // the callee of this IP channel has picked up
E_STATE_IP_NOIP // ?
};
// Analog channel
typedef struct
{
int nChId; // channel id
int nIpCh; // the linked IP channel id
int iDirection; // call direction
char szCallerTelNumber[64]; // caller number
char szCalleeTelNumber[64]; // callee number
unsigned long ulTimeOutCounter; // timeout counter
ANALOGCH_STATE Step ; // channel state
}ANALOGCH_STRUCT;
// SS1 channel
typedef struct
{
int nChId; // channel id
int nIpCh; // the linked IP channel id
int iDirection; // call direction
int nCallCapability; // call capability
char szCallerTelNumber[64]; // caller number
char szCalleeTelNumber[64]; // callee number
unsigned long ulTimeOutCounter; // timeout counter
SS1CH_STATE Step ; // channel state
}SS1CH_STRUCT;
#define LINK_WITH_ANALOG 0x0001
#define LINK_WITH_SS1 0x0002
//IP channel
typedef struct
{
int nChId; // channel id
int nLinkCh; // the linked channel id
int nLinkType; // link type
int iDirection; // call direction
char szCallerTelNumber[64]; // caller number
char szCalleeTelNumber[64]; // callee number
unsigned long ulTimeOutCounter; // timeout counter
unsigned long ulCodecType; // audio codec type
IPCH_STATE Step; // channel state
}IPCH_STRUCT;
typedef struct
{
int nDTMF; // dtmf
char szAddress[256]; // ip address
}IP_ADDRESS;
/////////////////////////////////////////////////////////////////////////////
// CIPGatewayDlg dialog
class CIPGatewayDlg : public CDialog
{
// Construction
public:
CIPGatewayDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CIPGatewayDlg)
enum { IDD = IDD_IPGATEWAY_DIALOG };
CListCtrl m_AnalogChList;
CListCtrl m_SS1ChList;
CListCtrl m_IpChList;
CListCtrl m_LogList;
CString m_strErrMsg;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CIPGatewayDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CIPGatewayDlg)
virtual BOOL OnInitDialog();
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnDestroy();
afx_msg void OnDisconnect();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
void InitLab();
void ReadIPAddress();
void ProtocalType();
void AppErrorHandler(int ch);
void InitAllChannel();
BOOL InitCtiSystem();
void InitAnalogChListCtrl();
void InitSS1ChListCtrl();
void InitIpChListCtrl();
void InitLogListCtrl();
void ScanAnalogCh();
void ScanSS1Ch();
void ScanIpCh();
void UpDateAnalogChListCtrl();
void UpDateSS1ChListCtrl();
void UpDateIpChListCtrl();
int m_nTotalCh; // total channel number
int m_nTotalAnalogCh; // total Analog channel number
int m_nTotalSS1Ch; // total SS1 channel number
int m_nTotalIpCh; // total IP channel number
int m_nIPProtocol; // the protocol of IP channel, 0 H323, 1 SIP
ANALOGCH_STRUCT m_AnalogCh[MAX_CHANNEL]; // the array of Analog channels
SS1CH_STRUCT m_SS1Ch[MAX_CHANNEL]; // the array of SS1 channels
IPCH_STRUCT m_IpCh[MAX_CHANNEL]; // the array of IP channels
IP_ADDRESS m_nIPAddress[256]; // IP address book
// set the Analog channel's state
void Session_SetAnalogChState(int nAnalogCh, ANALOGCH_STATE state);
// set the Analog channel's state to callout
BOOL Session_SetAnalogChDial(int nAnalogCh, int nIpCh, char * szCallerTelNumber, char * szCalleeTelNumber, int iDirection);
// find a idle Analog channel
int Session_FindIdleAnalogCh();
// if the Analog channel has picked up
BOOL Session_IsAnalogChPickedUp(int nChId);
// if the Analog channel is idle
BOOL Session_IsAnalogChIdle(int nChId);
// set the SS1 channel's state
void Session_SetSS1ChState(int nSS1Ch, SS1CH_STATE state);
// set the SS1 channel's state to callout
BOOL Session_SetSS1ChDial(int nSS1Ch, int nIpCh, char * szCallerTelNumber, char * szCalleeTelNumber, int iDirection);
// find a idle SS1 channel
int Session_FindIdleSS1Ch();
// if the SS1 channel has picked up
BOOL Session_IsSS1ChPickedUp(int nChId);
// if the SS1 channel is idle
BOOL Session_IsSS1ChIdle(int nChId);
// set the IP channel's state to callout
void Session_SetIpChDial(int nIpCh, int nAnalogCh, char *szCallerTelNumber, char *szCalleeTelNumber, int iDirection);
// find a idle IP channel
int Session_FindIdleIpCh();
// if the IP channel has picked up
BOOL Session_IsIpChPickedUp(int nChId);
// if the IP channel is idle
BOOL Session_IsIpChIdle(int nChId);
// set the linked channel's state to callout
BOOL Session_SetIPLinkChDial(int nLinkCh, int nLinkType, int nIpCh, char *szCallerTelNumber, char *szCalleeTelNumber, int iDirection);
// find a idle channel according link type
int Session_FindIdleIPLinkCh(int nLinkType);
// if the linked channel has picked up
BOOL Session_IsIPLinkChPickedUp(int nLinkCh, int nLinkType);
// if the linked channel is idle
BOOL Session_IsIPLinkChIdle(int nLinkCh, int nLinkType);
};
extern DWORD g_dwLanguageConversion;
extern DWORD g_dwCHINESE_SIMPLIFIED ;
extern DWORD g_dwCHINESE_TRADITIONAL;
extern DWORD g_dwCHINESE_HONGKONG;
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_IPGATEWAYDLG_H__792286B9_DFDB_40A7_A0C4_EAC3A9BDA076__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -