📄 pbxdlg.cpp
字号:
// Ch0挂机Flag==0?
if(m_StationCh[nIndex].bSubmiteChHookFlag)
{
if(SsmSendTone(m_StationCh[nIndex].nChId, 3) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
m_StationCh[nIndex].nStatus = STATION_WAIT_HANGUP;
}
else
{
m_StationCh[nIndex].nLinkToChId = m_StationCh[nIndex].nSaveSubmiteCh;
m_StationCh[nIndex].nStatus = STATION_TALKING;
// E_MSG_CONNECT→ch0
SendMessage(WM_USER+E_MSG_CONNECT, m_StationCh[nIndex].nLinkToChId, m_StationCh[nIndex].nChId);
// 闪断Flag=0
m_StationCh[nIndex].bPressFlag = FALSE;
m_StationCh[nIndex].nSaveSubmiteCh = -1;
// 连接总线(ch0,ch1)
if(SsmTalkWith(m_StationCh[nIndex].nChId, m_StationCh[nIndex].nLinkToChId) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
// 清空DTMF缓冲区
if(SsmClearRxDtmfBuf(m_StationCh[nIndex].nChId) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
}
break;
}
case STATION_F_OPERATE:
{
if(SsmStopSendTone(m_StationCh[nIndex].nChId) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
// Ch0挂机Flag==0?
if(m_StationCh[nIndex].bSubmiteChHookFlag)
{
// 放催挂音
if(SsmSendTone(m_StationCh[nIndex].nChId, 3) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
m_StationCh[nIndex].nStatus = STATION_WAIT_HANGUP;
}
else
{
m_StationCh[nIndex].nLinkToChId = m_StationCh[nIndex].nSaveSubmiteCh;
// E_MSG_CONNECT→ch0
SendMessage(WM_USER+E_MSG_CONNECT, m_StationCh[nIndex].nLinkToChId, m_StationCh[nIndex].nChId);
// 连接总线(ch0,ch1)
if(SsmTalkWith(m_StationCh[nIndex].nChId, m_StationCh[nIndex].nLinkToChId) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
// 清空DTMF缓冲
if(SsmClearRxDtmfBuf(m_StationCh[nIndex].nChId) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
m_StationCh[nIndex].nStatus = STATION_TALKING;
m_StationCh[nIndex].nSaveSubmiteCh = -1;
m_StationCh[nIndex].bPressFlag = FALSE;
}
break;
}
case STATION_GET_1STDTMF:
{
if(!SsmCheckPlay(m_StationCh[nIndex].nChId))
{
SsmStopPlayFile(m_StationCh[nIndex].nChId);
}
}
break;
case STATION_GET_DTMF:
break;
case STATION_REQ_STATION:
break;
case STATION_RING_BACK:
break;
case STATION_WAIT_HANGUP:
break;
case STATION_REQ_ANALOG:
break;
case STATION_DIALOUT_WITH_ANALOG:
break;
case STATION_WAIT_REMOTE_ANALOG_PICKUP:
break;
case STATION_REQ_IP:
break;
case STATION_DIALOUT_WITH_IP:
break;
case STATION_WAIT_REMOTE_IP_PICKUP:
break;
case STATION_F_RING_BACK:
break;
case STATION_F_TALKING:
break;
default:
break;
}
break;
}
case E_SYS_TIMEOUT: // 定时器超时事件
{
switch(m_StationCh[nIndex].nStatus)
{
case STATION_GET_1STDTMF:
{
// 关闭T1
if(SsmStopTimer(m_StationCh[nIndex].nTimer) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
nToneType = 0;
nToneChResult = SsmChkSendTone(m_StationCh[nIndex].nChId, &nToneType);
if(nToneChResult != -1)
{
if(nToneChResult == 1)
{
if(SsmStopSendTone(m_StationCh[nIndex].nChId) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
}
}
else
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
// 放忙音
if(SsmSendTone(m_StationCh[nIndex].nChId, 1) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
if(!SsmCheckPlay(m_StationCh[nIndex].nChId))
{
SsmStopPlayFile(m_StationCh[nIndex].nChId);
}
m_StationCh[nIndex].nStatus = STATION_WAIT_HANGUP;
break;
}
case STATION_DIALOUT_WITH_ANALOG:
{
// 检测是否拨号音
nToneType = 0;
nToneChResult = SsmChkSendTone(m_StationCh[nIndex].nChId, &nToneType);
if(nToneChResult != -1)
{
if(nToneChResult == 1)
{
if(SsmStopSendTone(m_StationCh[nIndex].nChId) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
}
}
else
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
// 发送E_TK_RELEASE
m_StationCh[nIndex].nStatus = STATION_WAIT_HANGUP;
SendMessage(WM_USER+E_TK_RELEASE, m_StationCh[nIndex].nLinkToChId, m_StationCh[nIndex].nChId);
// 关闭TX
if(SsmStopTimer(m_StationCh[nIndex].nTimer) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
// 放忙音
if(SsmSendTone(m_StationCh[nIndex].nChId, 1) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
break;
}
case STATION_DIALOUT_WITH_IP:
{
// 检测是否拨号音
nToneType = 0;
nToneChResult = SsmChkSendTone(m_StationCh[nIndex].nChId, &nToneType);
if(nToneChResult != -1)
{
if(nToneChResult == 1)
{
if(SsmStopSendTone(m_StationCh[nIndex].nChId) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
}
}
else
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
// 发送E_IP_RELEASE
m_StationCh[nIndex].nStatus = STATION_WAIT_HANGUP;
SendMessage(WM_USER+E_IP_RELEASE, m_StationCh[nIndex].nLinkToChId, m_StationCh[nIndex].nChId);
// 关闭TX
if(SsmStopTimer(m_StationCh[nIndex].nTimer) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
// 放忙音
if(SsmSendTone(m_StationCh[nIndex].nChId, 1) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
break;
}
case STATION_F_GET_DTMF:
{
// 关闭T4
if(SsmStopTimer(m_StationCh[nIndex].nTimer) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
nToneType = 0;
nToneChResult = SsmChkSendTone(m_StationCh[nIndex].nChId, &nToneType);
if(nToneChResult != -1)
{
if(nToneChResult == 1)
{
if(SsmStopSendTone(m_StationCh[nIndex].nChId) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
}
}
else
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
// 放忙音
if(SsmSendTone(m_StationCh[nIndex].nChId, 1) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
m_StationCh[nIndex].nStatus = STATION_F_OPERATE;
break;
}
default:
{
// 关闭TX
if(SsmStopTimer(m_StationCh[nIndex].nTimer) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
// 放忙音
if(SsmSendTone(m_StationCh[nIndex].nChId, 1) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
m_StationCh[nIndex].nStatus = STATION_WAIT_HANGUP;
break;
}
}
break;
}
/*+++++++++自定义座席通道消息+++++++++*/
case E_US_SEIZURE:
{
if(STATION_IDLE == m_StationCh[nIndex].nStatus)
{
m_StationCh[nIndex].nStatus = STATION_LOCAL_RING;
// 发送E_US_SEIZURE_ACK_IDLE
SendMessage(WM_USER+E_US_SEIZURE_ACK_IDLE, lParam, m_StationCh[nIndex].nChId);
// 发送振铃音
if(SsmStartRing(m_StationCh[nIndex].nChId) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
m_StationCh[nIndex].nLinkToChId = lParam;
int nType = SsmGetChType(lParam);
// 获取被叫号码
if((nType == 0) || (nType == PROTOCOL_H323) || (nType == PROTOCOL_SIP))
{
if(SsmGetCallerId(m_StationCh[nIndex].nLinkToChId, m_StationCh[nIndex].szCallerId) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
}
else
{
int i = FindIndexByStationChId(lParam);
strcpy(m_StationCh[nIndex].szCallerId, m_StationCh[i].szStationNum);
}
cString.LoadString(IDS_PBX34);
LogToList(LOGTYPE_INFORMATION, m_StationCh[nIndex].nChId, (LPTSTR)(LPCTSTR)cString, m_StationCh[nIndex].szCallerId, m_StationCh[nIndex].szStationNum);
}
else
{
// 发送E_US_SEIZURE_ACK_BUSY
int i = FindIndexByStationChId(lParam);
SendMessage(WM_USER+E_US_SEIZURE_ACK_BUSY, lParam, m_StationCh[i].nChId);
}
break;
}
case E_US_SEIZURE_ACK_IDLE: // 成功占用分机
{
switch(m_StationCh[nIndex].nStatus)
{
case STATION_REQ_STATION:
{
// 放回铃音
if(SsmSendTone(m_StationCh[nIndex].nChId, 2) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
// 获取被叫号码
strcpy(m_StationCh[nIndex].szCalleeId, m_StationCh[nIndex].szPhoneNumBuf);
m_StationCh[nIndex].nLinkToChId = lParam;
m_StationCh[nIndex].nStatus = STATION_RING_BACK;
break;
}
case STATION_F_REQ_STATION: // 呼叫转移的时候占用分机
{
//放回铃音
if(SsmSendTone(m_StationCh[nIndex].nChId, 2) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
//获取被叫号码
strcpy(m_StationCh[nIndex].szCalleeId, m_StationCh[nIndex].szPhoneNumBuf);
m_StationCh[nIndex].nLinkToChId = lParam;
m_StationCh[nIndex].nStatus = STATION_F_RING_BACK;
break;
}
default:
break;
}
break;
}
case E_US_SEIZURE_ACK_BUSY: // 占用分机失败
{
switch(m_StationCh[nIndex].nStatus)
{
case STATION_REQ_STATION:
{
// 放忙音
if(SsmSendTone(m_StationCh[nIndex].nChId, 1) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
m_StationCh[nIndex].nStatus = STATION_WAIT_HANGUP;
break;
}
case STATION_F_REQ_STATION:
{
// 放忙音
if(SsmSendTone(m_StationCh[nIndex].nChId, 1) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
m_StationCh[nIndex].nStatus = STATION_F_OPERATE;
break;
}
default:
break;
}
break;
}
case E_US_PICKUP:
{
// 被叫摘机
switch(m_StationCh[nIndex].nStatus)
{
case STATION_RING_BACK:
{
// 停回铃音
if(SsmStopSendTone(m_StationCh[nIndex].nChId) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
// 连接总线
if(SsmTalkWith(m_StationCh[nIndex].nChId, m_StationCh[nIndex].nLinkToChId) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
m_StationCh[nIndex].nStatus = STATION_TALKING;
break;
}
case STATION_F_RING_BACK:
{
// 停回铃音
if(SsmStopSendTone(m_StationCh[nIndex].nChId) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
// 连接总线(ch1,ch2)
if(SsmTalkWith(m_StationCh[nIndex].nChId, m_StationCh[nIndex].nLinkToChId) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
m_StationCh[nIndex].nStatus = STATION_F_TALKING;
break;
}
default:
break;
}
break;
}
case E_US_RELEASE:
{
// 停止振铃
if(SsmStopRing(m_StationCh[nIndex].nChId) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
m_StationCh[nIndex].nLinkToChId = -1;
m_StationCh[nIndex].bPressFlag = FALSE;
m_StationCh[nIndex].nStatus = STATION_IDLE;
memset(m_StationCh[nIndex].szCallerId, '\0', sizeof(char)*MAX_TELNUM_LEN); //清空被叫号码
break;
}
case F_US_SEIZURE:
{
if(STATION_IDLE == m_StationCh[nIndex].nStatus)
{
// 发送振铃
if(SsmStartRing(m_StationCh[nIndex].nChId) == -1)
{
AppErrorHandler(m_StationCh[nIndex].nChId);
}
m_StationCh[nIndex].nStatus = STATION_LOCAL_RING;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -