#include "StdAfx.h" #include "OpAnswer.h" #include "VirtualChan.h" #include "OperationReactor.h" #include "FsProxy.h" COpAnswer::COpAnswer(COperationReactor* pParent, LONG Instance) : COperation(pParent, Instance) { } COpAnswer::~COpAnswer(void) { } /***************************************************************** **【函数名称】 _end **【函数功能】 操作完成 **【参数】 IsSucceed 操作是否成功 lpData 随路数据 **【返回值】 ****************************************************************/ void COpAnswer::_end( bool IsSucceed ) { if(IsSucceed) { LOGGER(LOG_LEVEL_NORMAL, _T("{OpAnswer}: 分机[%lu]应答成功, CallerNum = %s"), m_pHostChan->no(), m_pHostChan->callerNum()); } else { LOGGER(LOG_LEVEL_WARNING, _T("{OpAnswer}: 分机[%lu]应答失败, CallerNum = %s"), m_pHostChan->no(), m_pHostChan->callerNum()); } m_pParent->onOpResult(m_Instance, this, IsSucceed); } /***************************************************************** **【函数名称】 start **【函数功能】 执行操作 **【参数】 **【返回值】 *****************************************************************/ bool COpAnswer::start( LineOpParam* pParam ) { // 校验状态 if(m_pHostChan->state() != CHAN_LOGIC_STATE_ALERTING) return false; // 通知启动日志 LOGGER(LOG_LEVEL_NORMAL, _T("{OpAnswer}: 分机[%lu]执行应答, CallerNum = %s"), m_pHostChan->no(), m_pHostChan->callerNum()); // 开始应答 return CFsProxy::GetInstance().answer(uniqueId(), m_pHostChan); } /***************************************************************** **【函数名称】 onBackgroudJobDone **【函数功能】 后台命令执行结束事件处理 **【参数】 **【返回值】 *****************************************************************/ void COpAnswer::onBackgroudJobDone( PBG_JOB_NOTIFY pNotify ) { if(strstr(pNotify->JobBody, ESL_JOB_DONE_RES_OK) != NULL) _end(true); else _end(false); }