📄 dtp_event.cpp
字号:
else
{
if(CicState[nCic].wRecDirection == CALL_IN_RECORD)
{
if(SsmStopRecToFile(CicState[nCic].nCallInCh) == -1)
ShowMessage("Fail to call SsmStopRecToFile");
}
else if(CicState[nCic].wRecDirection == CALL_OUT_RECORD)
{
if(SsmStopRecToFile(CicState[nCic].nCallOutCh) == -1)
ShowMessage("Fail to call SsmStopRecToFile");
}
else
{
if(SsmSetRecMixer(CicState[nCic].nCallInCh, FALSE, 0) == -1)//CHS:关闭录音混音器开关
//ENG:Turn off the record mixer
ShowMessage("Fail to call SsmSetRecMixer");
if(SsmStopLinkFrom(CicState[nCic].nCallOutCh, CicState[nCic].nCallInCh) == -1)//CHS:断开去话通道到来话通道的总线连接
//ENG:Cut off the bus connect from outgoing channel to incoming channel
ShowMessage("Fail to call SsmStopLinkFrom");
if(SsmStopRecToFile(CicState[nCic].nCallInCh) == -1) //Stop recording
ShowMessage("Fail to call SsmStopRecToFile");
}
}
}
CicState[nCic].nCicState = CIRCUIT_IDLE;
CicState[nCic].nCallInIndex = 0;
CicState[nCic].nCallOutIndex = 0;
memset(CicState[nCic].szCallInDtmf, 0, sizeof(char)*100);
memset(CicState[nCic].szCallOutDtmf, 0, sizeof(char)*100);
}
break;
//Receiving phone number
case S_SPY_RCVPHONUM:
{
if(CicState[nCic].nCicState == CIRCUIT_IDLE)
{
CicState[nCic].nCicState = CIRCUIT_RCV_PHONUM;
}
}
break;
//Ringing
case S_SPY_RINGING:
{
CicState[nCic].nCicState = CIRCUIT_RINGING;
memset(CicState[nCic].szCallerId, 0, sizeof(char)*20);
memset(CicState[nCic].szCalleeId, 0, sizeof(char)*20);
if(SpyGetCallerId(nCic, CicState[nCic].szCallerId) == -1)//CHS:取主叫号码
//ENG:Get calling party number
ShowMessage("Fail to call SpyGetCallerId");
if(SpyGetCalleeId(nCic, CicState[nCic].szCalleeId) == -1)//CHS:取被叫号码
//ENG:Get called party number
ShowMessage("Fail to call SpyGetCalleeId");
}
break;
//Talking
case S_SPY_TALKING:
{
if(CicState[nCic].nCicState == CIRCUIT_RCV_PHONUM)
{
memset(CicState[nCic].szCallerId, 0, sizeof(char)*20);
memset(CicState[nCic].szCalleeId, 0, sizeof(char)*20);
if(SpyGetCallerId(nCic, CicState[nCic].szCallerId) == -1)
ShowMessage("Fail to call SpyGetCallerId");
if(SpyGetCalleeId(nCic, CicState[nCic].szCalleeId) == -1)
ShowMessage("Fail to call SpyGetCalleeId");
}
if((CicState[nCic].nCallInCh = SpyGetCallInCh(nCic)) == -1) //CHS:取得来话通道号
//ENG:Get the number of incoming channel
ShowMessage("Fail to call SpyGetCallInCh");
if((CicState[nCic].nCallOutCh = SpyGetCallOutCh(nCic)) == -1)//CHS:取得去话通道号
//ENG:Get the number of outgoing channel
ShowMessage("Fail to call SpyGetCallOutCh");
CicState[nCic].nCicState = CIRCUIT_TALKING;
//Start recording
//Record file name + Monitored circuit number + Time(hour-minute-second)
char strRecFile[200];
//CString strRecFile;
SYSTEMTIME st;
char szTemp[200];
GetLocalTime(&st);
sprintf(strRecFile,"Rec%d-%d-%d-%d.wav", nCic, st.wHour, st.wMinute, st.wSecond);
//strRecFile.Format("Rec%d-%d-%d-%d.wav", nCic, st.wHour, st.wMinute, st.wSecond);
//strcpy(szTemp, strRecFile.GetBuffer(strRecFile.GetLength()));
//strRecFile.ReleaseBuffer();
strcpy(szTemp,strRecFile);
if(m_nCallFnMode == 0) //Call the function with circuit number as its parameter
{
if(SpyRecToFile(nCic, CicState[nCic].wRecDirection, szTemp, -1, 0L, -1, -1, 0) == -1)
ShowMessage("Fail to call SpyRecToFile");
}
else //Call the function with channel number as its parameter
{
if(CicState[nCic].wRecDirection == CALL_IN_RECORD)
{
if(SsmRecToFile(CicState[nCic].nCallInCh, szTemp, -1, 0L, -1, -1, 0) == -1)
ShowMessage("Fail to call SsmRecToFile");
}
else if(CicState[nCic].wRecDirection == CALL_OUT_RECORD)
{
if(SsmRecToFile(CicState[nCic].nCallOutCh, szTemp, -1, 0L, -1, -1, 0) == -1)
ShowMessage("Fail to call SsmRecToFile");
}
else
{
if(SsmLinkFrom(CicState[nCic].nCallOutCh, CicState[nCic].nCallInCh) == -1) //CHS: 建立从去话通道到来话通道的总线连接
//ENG:Connect the bus from outgoing channel to incoming channel
ShowMessage("Fail to call SsmLinkFrom");
if(SsmSetRecMixer(CicState[nCic].nCallInCh, TRUE, 0) == -1) //CHS:打开录音混音器
//ENG:Turn on the record mixer
ShowMessage("Fail to call SsmSetRecMixer");
if(SsmRecToFile(CicState[nCic].nCallInCh, szTemp, -1, 0L, -1, -1, 0) == -1)//Recording
ShowMessage("Fail to call SsmRecToFile");
}
}
}
break;
default:
break;
}
}
UpdateCircuitListCtrl(nCic);
}
//CHS:收到DTMF之事件
//ENG:Event generated by the driver when DTMF is received
else if(nEventCode == E_CHG_RcvDTMF)
{
nCh = wParam;
//CHS:通道号到电路号的转换
//ENG:Switching from channel number to circuit number
if((nCic = SpyChToCic(nCh)) == -1)
{
ShowMessage("Fail to call SpyChToCic");
}
if(nCic != -1)
{
if(CicState[nCic].nCicState == CIRCUIT_TALKING)
{
cNewDtmf = (char)(0xFFFF & lParam); //CHS:新收到的DTMF
//ENG:Newly received DTMF
if(nCh == CicState[nCic].nCallInCh)
{
CicState[nCic].szCallInDtmf[CicState[nCic].nCallInIndex] = cNewDtmf;
CicState[nCic].nCallInIndex++;
}
else if(nCh == CicState[nCic].nCallOutCh)
{
CicState[nCic].szCallOutDtmf[CicState[nCic].nCallOutIndex] = cNewDtmf;
CicState[nCic].nCallOutIndex++;
}
}
UpdateCircuitListCtrl(nCic);
}
}
}
TForm::WndProc(Message);
return;
}
void __fastcall TDTP_Form::RadioButton1Click(TObject *Sender)
{
m_nCallFnMode = 0;
}
//---------------------------------------------------------------------------
void __fastcall TDTP_Form::RadioButton2Click(TObject *Sender)
{
m_nCallFnMode = 1;
}
//---------------------------------------------------------------------------
//CHS:来话录音
//ENG:Incoming call recording
void __fastcall TDTP_Form::RadioButton3Click(TObject *Sender)
{
CicState[m_cmbCic->ItemIndex].wRecDirection = CALL_IN_RECORD;
}
//---------------------------------------------------------------------------
//CHS:去话录音
//ENG:Outgoing call recording
void __fastcall TDTP_Form::RadioButton4Click(TObject *Sender)
{
// int nCurLine;
// char sz[100];
// m_cmbCic.GetLBText(m_cmbCic.GetCurSel(), sz);
// nCurLine = atoi(sz);
// CicState[nCurLine].wRecDirection = CALL_OUT_RECORD;
CicState[m_cmbCic->ItemIndex].wRecDirection = CALL_OUT_RECORD;
}
//---------------------------------------------------------------------------
//CHS:混合录音
//ENG:Mix-record
void __fastcall TDTP_Form::RadioButton5Click(TObject *Sender)
{
CicState[m_cmbCic->ItemIndex].wRecDirection = MIX_RECORD;
}
//---------------------------------------------------------------------------
void __fastcall TDTP_Form::m_cmbCicChange(TObject *Sender)
{
switch(CicState[m_cmbCic->ItemIndex].wRecDirection)
{
case CALL_IN_RECORD:
RadioButton3->Checked = true;
break;
case CALL_OUT_RECORD:
RadioButton4->Checked = true;
break;
case MIX_RECORD:
RadioButton5->Checked = true;
break;
}
}
//---------------------------------------------------------------------------
void __fastcall TDTP_Form::OnDestroy(TObject *Sender)
{
//CHS:关闭驱动程序
//ENG:Close board driver
if(SsmCloseCti() == -1)
ShowMessage("Fail to call SsmCloseCti");
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -