📄 faxsrvview.cpp
字号:
// m_Phonic.faxSendFax(channelType, channelID,CH_FaxPath[channelID]);
CH_State[channelID]=S_ANSWER;//S_SENDFAX;
break;
}
}
void CFaxSrvView::OnIdlePhonicctrl1(long channelType, long channelID)
{
// TODO: Add your control notification handler code here
}
void CFaxSrvView::OnRingPhonicctrl1(long channelType, long channelID)
{
// TODO: Add your control notification handler code here
}
void CFaxSrvView::OnCallInPhonicctrl1(long channelType, long channelID, LPCTSTR callerID, LPCTSTR phoneNumber)
{
// TODO: Add your control notification handler code here
////接收传真
////PlayFile(); S_CALLIN;
////
if(channelID<CH_HALFCOUNT) ////不接收
{
m_Phonic.Answer(channelType,channelID,1);
m_Phonic.Hangup(channelType,channelID,0);
}
else
{
m_Phonic.Answer(channelType,channelID,1);
m_Phonic.PlayFile(channelType,channelID,"",0,0);
// m_Phonic.PlayFile(channelType,channelID,"",0,0); ///多次调用
// m_Phonic.PlayFile(channelType,channelID,"",0,0);
m_Phonic.SetDeviceTimer(channelType,channelID,30);
CH_State[channelID]=S_CALLIN;
}
////RecvFax();
}
void CFaxSrvView::OnPolarityPhonicctrl1(long channelType, long channelID, long Polarity)
{
// TODO: Add your control notification handler code here
OnAnswerPhonicctrl1(channelType, channelID);
}
void CFaxSrvView::OnAnswerPhonicctrl1(long channelType, long channelID)
{
// TODO: Add your control notification handler code here
//发送传真
if(CH_Phone2[channelID]=="")
{
m_Phonic.PlayFile(channelType,channelID,"",0,0);
m_Phonic.PlayFile(channelType,channelID,"",0,0);
// m_Phonic.faxSendFax(channelType,channelID,CH_FaxPath[channelID]);
CH_State[channelID]=S_ANSWER;//S_SENDFAX;
}
else
{
m_Phonic.SendDtmf(channelType,channelID,CH_Phone2[channelID],200,100,0);
m_Phonic.SetDeviceTimer(channelType,channelID,CH_Phone2[channelID].GetLength()*350+50000); ////计算拨号时间+等待应答时间
CH_State[channelID]=S_CALLDTMF;
}
}
void CFaxSrvView::OnCallOutFinishPhonicctrl1(long channelType, long channelID)
{
// TODO: Add your control notification handler code here
CH_State[channelID]=S_CALLOK; ///////主要考虑无反极时摘机判断50秒
m_Phonic.SetDeviceTimer(channelType,channelID,50000);
}
void CFaxSrvView::OnCallFailPhonicctrl1(long channelType, long channelID, long cause)
{
// TODO: Add your control notification handler code here
m_Phonic.Hangup(channelType,channelID,0);
OnHangupPhonicctrl1(channelType, channelID, 0);
}
void CFaxSrvView::OnHangupPhonicctrl1(long channelType, long channelID, long cause)
{
// TODO: Add your control notification handler code here
m_Phonic.Hangup(channelType,channelID,0);
CH_State[channelID]=S_IDLE;
try{
switch(CH_State[channelID])
{
case S_CALLOUT: /////发送类处理
case S_CALLOK:
case S_CALLDTMF:
case S_SENDFAX:
case S_SENDERR:
faxSend.m_strFilter.Format("id='%s' and state=1 and faxdoc='%s'",CH_Uid[channelID],CH_FaxPath[channelID]);
faxSend.Requery();
if(!faxSend.IsEOF())
{
if((faxSend.m_callcount+1)>5) ////超过呼叫次数
{
//////写入错误表
CString temp;
int index1=CH_FaxPath[channelID].ReverseFind('\\');
if(index1>0)
{
temp=CH_FaxPath[channelID].Left(index1)+"\\bak"+CH_FaxPath[channelID].Mid(index1);
// CH_FaxPath[channelID]=temp;
}
else;
MoveFile(CH_FaxPath[channelID],temp);
DeleteFile(CH_FaxPath[channelID]);
if(faxError.IsOpen())
faxError.Requery();
else
faxError.Open();
faxError.AddNew();
faxError.m_userid=faxSend.m_userid;
faxError.m_faxto=faxSend.m_faxto;
faxError.m_faxdoc=temp;
faxError.m_sendtime=time(NULL);
faxError.m_error="超次";
faxError.m_notice="no";
// faxError.m_faxto=faxSend.m_faxto;
faxError.Update();
faxSend.Delete();
faxSend.MoveNext();
}
else
{
faxSend.Edit();
faxSend.m_state="0";
faxSend.m_callcount+=1;
faxSend.m_sendtime=time(NULL);
faxSend.Update();
}
}
break;
case S_SENDOK:
faxSend.m_strFilter.Format("id='%s' and state=1 and faxdoc='%s'",CH_Uid[channelID],CH_FaxPath[channelID]);
faxSend.Requery();
if(!faxSend.IsEOF())
{
faxSend.Delete();
}
{
CString temp;
int index1=CH_FaxPath[channelID].ReverseFind('\\');
if(index1>0)
{
temp=CH_FaxPath[channelID].Left(index1)+"\\bak"+CH_FaxPath[channelID].Mid(index1);
// CH_FaxPath[channelID]=temp;
}
else;
faxBill.AddNew();
faxBill.m_userid=CH_Uid[channelID];
faxBill.m_faxdoc=temp;//CH_FaxPath[channelID];
faxBill.m_faxto=CH_Phone[channelID]+","+CH_Phone2[channelID];
faxBill.m_sendtime=time(NULL);
faxBill.m_notice="no";
faxBill.Update();
faxSend.Delete();
MoveFile(CH_FaxPath[channelID],temp);
DeleteFile(CH_FaxPath[channelID]);
}
break;
////////////////////////////////////////
case S_CALLIN: ///接收类处理
DeleteFile(CH_FaxPath[channelID]);
break;
case S_RECVFAX: ///是否删除为成功的收件
DeleteFile(CH_FaxPath[channelID]);
break;
case S_RECVERR:
DeleteFile(CH_FaxPath[channelID]);
break;
case S_RECVOK:
faxRecv.AddNew();
faxRecv.m_userid=CH_Uid[channelID];
faxRecv.m_faxdoc=CH_FaxPath[channelID];
faxRecv.m_faxfrom=""; /////来电显示
faxRecv.m_recvtime=time(NULL);
faxRecv.m_notice="no";
faxRecv.m_state="ok";
faxRecv.Update();
break;
}
}
catch(CDBException* e)
{
}
}
void CFaxSrvView::OnDTMFPhonicctrl1(long channelType, long channelID, long dtmfCode)
{
// TODO: Add your control notification handler code here
switch(CH_State[channelID])
{
case S_CALLIN:
m_Phonic.StopPlay(channelType, channelID);
CH_RecvDtmf[channelID]+=dtmfCode;
if(CH_RecvDtmf[channelID].GetLength()>=ID_LENGTH)
{///读数据库,判断ID是否有效
////构造文件名:ID_年月日 path\fax_recv
CH_Uid[channelID]=CH_RecvDtmf[channelID];
faxUser.m_strFilter.Format("id='%s'",CH_RecvDtmf[channelID]);
if(faxUser.IsOpen())
faxUser.Requery();
else
faxUser.Open();
if(!faxUser.IsEOF())
{
CTime t1=time(NULL);
CH_FaxPath[channelID].Format("%s\\Recv\\%sR%04d%02d%02d%d%d%d.BFX",
FaxDocPath,CH_RecvDtmf[channelID],
t1.GetYear(),t1.GetMonth(),t1.GetDay(),
t1.GetHour(),t1.GetMinute(),t1.GetSecond());
m_Phonic.faxReceiveFax(channelType, channelID,CH_FaxPath[channelID]);
CH_State[channelID]=S_RECVFAX;
///////////////
}
else
{
m_Phonic.PlayFile(channelType, channelID,"",0,0);
CH_State[channelID]=S_ERROR;
// m_Phonic.Hangup(channelType, channelID,0);
}
}
break;
case S_CALLOUT:
break;
case S_RING:
break;
default:
break;
}
}
void CFaxSrvView::OnPlayEndPhonicctrl1(long channelType, long channelID, long completeSize)
{
// TODO: Add your control notification handler code here
switch(CH_State[channelID])
{
case S_CALLIN: ////继续播放提示
m_Phonic.PlayFile(channelType,channelID,"",0,0);
break;
case S_CALLOUT:
case S_ANSWER:
m_Phonic.faxSendFax(channelType,channelID,CH_FaxPath[channelID]);
CH_State[channelID]=S_SENDFAX;
break;
case S_ERROR:
m_Phonic.Hangup(channelType,channelID,0);
OnHangupPhonicctrl1(channelType,channelID,0);
}
}
void CFaxSrvView::OnFaxErrorPhonicctrl1(long channelType, long channelID, long cause)
{
// TODO: Add your control notification handler code here
m_Phonic.faxStopFax(channelType, channelID);
m_Phonic.Hangup(channelType, channelID,0);
if(CH_State[channelID]==S_RECVFAX)
{
CH_State[channelID]=S_RECVERR;
}
else if(CH_State[channelID]==S_SENDFAX)
{
CH_State[channelID]=S_SENDERR;
}
else
{
}
OnHangupPhonicctrl1(channelType, channelID, 0);
}
void CFaxSrvView::OnOneFaxPageOverPhonicctrl1(long channelType, long channelID, long isFinishedAll)
{
// TODO: Add your control notification handler code here
if(isFinishedAll==1) ////fax 完成
{
m_Phonic.faxStopFax(channelType, channelID);
m_Phonic.Hangup(channelType, channelID,0);
if(CH_State[channelID]==S_RECVFAX)
{
CH_State[channelID]=S_RECVOK;
}
else if(CH_State[channelID]==S_SENDFAX)
{
CH_State[channelID]=S_SENDOK;
}
else
{
}
OnHangupPhonicctrl1(channelType, channelID, 0);
//////////写入数据库Bill Recv
}
else
{
}
}
void CFaxSrvView::OnRecordEndPhonicctrl1(long channelType, long channelID, long completeSize)
{
// TODO: Add your control notification handler code here
}
void CFaxSrvView::OnFlashPhonicctrl1(long channelType, long channelID)
{
// TODO: Add your control notification handler code here
}
void CFaxSrvView::OnSendCallerIDEndPhonicctrl1(long channelType, long channelID)
{
// TODO: Add your control notification handler code here
}
void CFaxSrvView::OnSendV23EndPhonicctrl1(long channelType, long channelID)
{
// TODO: Add your control notification handler code here
}
void CFaxSrvView::OnV23DataReadyPhonicctrl1(long channelType, long channelID, short FAR* pData, long lSize)
{
// TODO: Add your control notification handler code here
}
void CFaxSrvView::OnVoicePhonicctrl1(long channelType, long channelID)
{
// TODO: Add your control notification handler code here
}
void CFaxSrvView::OnSilencePhonicctrl1(long channelType, long channelID)
{
// TODO: Add your control notification handler code here
}
void CFaxSrvView::OnHangingPhonicctrl1(long channelType, long channelID)
{
// TODO: Add your control notification handler code here
}
void CFaxSrvView::OnDtmfOnPhonicctrl1(long channelType, long channelID, long dtmfCode)
{
// TODO: Add your control notification handler code here
}
void CFaxSrvView::OnDtmfOffPhonicctrl1(long channelType, long channelID, long dtmfCode, long count)
{
// TODO: Add your control notification handler code here
}
void CFaxSrvView::OnRealTimeDataPhonicctrl1(long channelType, long channelID, long size)
{
// TODO: Add your control notification handler code here
}
void CFaxSrvView::OnEnergyPhonicctrl1(long channelType, long channelID, long lEnergy)
{
// TODO: Add your control notification handler code here
}
void CFaxSrvView::OnVadPhonicctrl1(long channelType, long channelID, long lVad, long lEnergyAndTime)
{
// TODO: Add your control notification handler code here
}
void CFaxSrvView::OnFlashOverPhonicctrl1(long channelType, long channelID)
{
// TODO: Add your control notification handler code here
}
#include "tifbfx.h"
/////////??tif到bfx的转换。
////////注意测试表明只有分辨率为204X98,尺寸为215.2X291.8, 使用G3 Fax压缩的tif文档,才可以转换
/////////其他格式的不被转换.
void CFaxSrvView::OnButton1()
{
// TODO: Add your control notification handler code here
cvtBfxToTif("send.bfx","send.tif");
cvtTifToBfx("send.tif","send2.bfx");
cvtTifToBfx("psd.tif","psd2.bfx");
cvtTifToBfx("测试页.tif","测试页.bfx");
cvtTifToBfx("测试页2.tif","测试页2.bfx");
cvtTifToBfx("测试页0001.tif","测试页0001.bfx");
cvtTifToBfx("test.tif","test.bfx");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -