| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- #include "stdafx.h"
- #include "TaskIvrPlayVoice.h"
- #include "LineHolder.h"
- #include "LogicLine.h"
- #include "SessionHolder.h"
- #include "CallSession.h"
- #include "CtiCore.h"
- CTaskIvrPlayVoice::CTaskIvrPlayVoice(CPduEntity &PduEntity): CTask(PduEntity)
- {
- }
- CTaskIvrPlayVoice::~CTaskIvrPlayVoice(void)
- {
- }
- /*****************************************************************
- **【函数名称】 DoTask
- **【函数功能】 Task处理
- **【参数】
- **【返回值】 void
- ****************************************************************/
- BOOL CTaskIvrPlayVoice::DoTask()
- {
- // 显示日志
- ShowLog();
-
- // 校验
- if(!Verify()) return FALSE;
- // 设置当前操作类型
- m_pCurrLine->opType() = PDU_CMD_IVR_PLAY_DTMF;
- UINT t_lineId = m_pCurrLine->lineId();
- // 向底层设备发送放音收号命令
- LineOpParam pLineOpParam;
- memset(&pLineOpParam,0,sizeof(pLineOpParam));
- pLineOpParam.nParam1 = m_CurrCmd.GetDataInt(4); // 放音收号模式,1:放音收号,2:只放音,3:只收号
- pLineOpParam.nParam2 = m_CurrCmd.GetDataInt(5); // 放音内容类型
- pLineOpParam.nParam3 = m_CurrCmd.GetDataInt(6); // 数字播报模式
- pLineOpParam.nParam4 = m_CurrCmd.GetDataInt(7); // 引擎音库
- pLineOpParam.nParam5 = m_CurrCmd.GetDataInt(8); // 语速
- pLineOpParam.nParam6 = m_CurrCmd.GetDataInt(9); // 音量
- pLineOpParam.nParam7 = m_CurrCmd.GetDataInt(10); // 收号位数
- pLineOpParam.nParam8 = m_CurrCmd.GetDataInt(12); // 收号时间间隔
- pLineOpParam.nParam9 = m_CurrCmd.GetDataInt(13); // 收号时是否放音
- lstrcpy(pLineOpParam.szParam1, m_CurrCmd.GetDataString(11)); // 结束标识
- lstrcpy(pLineOpParam.szParam3, m_CurrCmd.GetDataString(15)); // 放音内容
- return CCtiCore::GetInstance().getDevLink().exec((long)this, LINE_OP_PLAY_VOICE, t_lineId, &pLineOpParam);
- }
- /*****************************************************************
- **【函数名称】 Verify
- **【函数功能】 校验
- **【参数】
- **【返回值】 BOOL
- ****************************************************************/
- BOOL CTaskIvrPlayVoice::Verify()
- {
- // 线路绑定校验
- if(!_bindLogicLine(m_CurrCmd.GetDataUInt(3)))
- return FALSE;
- // 放音内容校验
- if(m_CurrCmd.GetDataInt(4) != PVM_WAIT_DIGIT && m_CurrCmd.GetDataString(15) == "")
- {
- ILogger::getInstance().log(LOG_CLASS_BUSI, LOG_LEVEL_WARNING, _T("{Task}: 线路[%d]执行IVR放音收号任务校验时失败:放音内容为空"), m_pCurrLine->lineId());
- return FALSE;
- }
- return TRUE;
- }
- /*****************************************************************
- **【函数名称】 ShowLog
- **【函数功能】 显示日志
- **【参数】
- **【返回值】 void
- ****************************************************************/
- void CTaskIvrPlayVoice::ShowLog()
- {
- // 显示日志
- ILogger::getInstance().log(LOG_CLASS_SOCKET, LOG_LEVEL_NORMAL,
- _T("IVR->CTI, CMD = [IVR放音收号],IVR = %d, Line = %u, FileName = %s"),
- m_CurrCmd.GetDataInt(1),
- m_CurrCmd.GetDataUInt(3),
- m_CurrCmd.GetDataString(15));
- }
- /*****************************************************************
- **【函数名称】 ProcTaskResult
- **【函数功能】 处理Pdu命令返回
- **【参数】 成功还是失败
- **【返回值】 void
- ****************************************************************/
- BOOL CTaskIvrPlayVoice::OnDevOpResult(EventOpResult &EvtInfo)
- {
- // 设置按键数据
- m_CurrCmd.SetDataString(16, EvtInfo.szData);
-
- // 命令返回
- _ProcCmdReturn(EvtInfo.bIsSucceed, true);
- return TRUE;
- }
|