| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- #include "stdafx.h"
- #include "TaskIvrContinueQuene.h"
- #include "LineHolder.h"
- #include "LogicLine.h"
- #include "IvrFlowHolder.h"
- #include "IvrFlow.h"
- #include "NetworkCti.h"
- #include "CtiCore.h"
- CTaskIvrContinueQuene::CTaskIvrContinueQuene(CPduEntity &PduEntity): CTask(PduEntity), m_Step(0)
- {
- }
- CTaskIvrContinueQuene::~CTaskIvrContinueQuene(void)
- {
- }
- /*****************************************************************
- **【函数名称】 DoTask
- **【函数功能】 Task处理
- **【参数】
- **【返回值】 void
- ****************************************************************/
- BOOL CTaskIvrContinueQuene::DoTask()
- {
- // 显示日志
- ShowLog();
- // 校验
- if(!Verify()) return FALSE;
- // 设置当前操作类型
- m_pCurrLine->opType() = PDU_CMD_IVR_QUEUE_CONTINUE;
- // 设备操作
- LineOpParam pLineOpParam;
- memset(&pLineOpParam,0,sizeof(pLineOpParam));
- lstrcpy(pLineOpParam.szParam3,m_CurrCmd.GetDataString(5)); // 等待放音文件名
- pLineOpParam.nParam1 = PVM_PLAY_ONLY; // 1放音收号 2 只放音不收号
- return CCtiCore::GetInstance().getDevLink().exec((long)this, LINE_OP_PLAY_VOICE, m_pCurrLine->lineId(), &pLineOpParam);
- }
- /*****************************************************************
- **【函数名称】 Verify
- **【函数功能】 校验
- **【参数】
- **【返回值】 BOOL
- ****************************************************************/
- BOOL CTaskIvrContinueQuene::Verify()
- {
- // 线路绑定校验
- if(!_bindLogicLine(m_CurrCmd.GetDataUInt(3)))
- return FALSE;
- // 放音内容校验
- if(m_CurrCmd.GetDataString(5) == "")
- {
- ILogger::getInstance().log(LOG_CLASS_BUSI, LOG_LEVEL_WARNING, _T("{Task}: 线路[%d]执行IVR继续等待排队任务校验时失败:等待提示音文件为空"), m_pCurrLine->lineId());
- return FALSE;
- }
- return TRUE;
- }
- /*****************************************************************
- **【函数名称】 ShowLog
- **【函数功能】 显示日志
- **【参数】
- **【返回值】 void
- ****************************************************************/
- void CTaskIvrContinueQuene::ShowLog()
- {
- // 显示日志
- ILogger::getInstance().log(LOG_CLASS_SOCKET, LOG_LEVEL_NORMAL, _T("IVR->CTI, CMD = [IVR继续排队], \
- IVR = %d, Line = %u, CallerNum = %s, FileName = %s"),
- m_CurrCmd.GetDataInt(1),
- m_CurrCmd.GetDataUInt(3),
- m_CurrCmd.GetDataString(4),
- m_CurrCmd.GetDataString(5));
- }
- /*****************************************************************
- **【函数名称】 OnDevOpResult
- **【函数功能】 底层线路操作结果
- **【参数】
- **【返回值】 void
- ****************************************************************/
- BOOL CTaskIvrContinueQuene::OnDevOpResult(EventOpResult &EvtInfo)
- {
- if(m_Step == 0)
- {
- // 向ACD发暂停排队命令
- CPduEntity CmdPauseQueue(PDU_CMD_CTI_ACD_QUEUE_PAUSE);
- CmdPauseQueue.SetDataInt(0, m_CurrCmd.GetDataInt(1));
- CNetworkCti::GetInstance().send2ACD(CmdPauseQueue);
- // 命令返回
- _ProcCmdReturn(FALSE, true);
- }
- return FALSE;
- }
- /*****************************************************************
- **【函数名称】 OnCmdOperation
- **【函数功能】 task附加操作处理接口
- **【参数】 命令
- **【返回值】 void
- ****************************************************************/
- BOOL CTaskIvrContinueQuene::OnCmdOperation(CPduEntity &PduEntity)
- {
- // 设置排队成功标志
- if(PduEntity.GetCmdType() != PDU_CMD_IVR_QUEUE_CONTINUE) return FALSE;
- if(!PduEntity.GetIsExecReturn()) return FALSE;
- if(!PduEntity.GetDataBool(0)) return FALSE;
- m_Step = 1;
- // 发送停止放音
- // 2019-09-11,颐和随访
- LineOpParam pLineOpParam;
- memset(&pLineOpParam,0,sizeof(pLineOpParam));
- pLineOpParam.nParam1 = /*PVM_STOP_PLAY*/PVM_PLAY_ONLY;
- CCtiCore::GetInstance().getDevLink().exec((long)NULL, LINE_OP_PLAY_VOICE, m_pCurrLine->lineId(), &pLineOpParam); // 执行标识置为NULL,即不需等待底层的执行结果
-
- Sleep(200);
- // 获取返回命令信息 分配的坐席工号,分机号
- m_CurrCmd.SetDataUInt(7, PduEntity.GetDataUInt(7));
- m_CurrCmd.SetDataUInt(8, PduEntity.GetDataUInt(8));
- // 命令返回,并释放占用的线路
- _ProcCmdReturn(TRUE, true);
-
- return TRUE;
- }
|