中间件标准版5.1git,去除基础模块

TaskIvrPlayVoice.cpp 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #include "stdafx.h"
  2. #include "TaskIvrPlayVoice.h"
  3. #include "LineHolder.h"
  4. #include "LogicLine.h"
  5. #include "SessionHolder.h"
  6. #include "CallSession.h"
  7. #include "CtiCore.h"
  8. CTaskIvrPlayVoice::CTaskIvrPlayVoice(CPduEntity &PduEntity): CTask(PduEntity)
  9. {
  10. }
  11. CTaskIvrPlayVoice::~CTaskIvrPlayVoice(void)
  12. {
  13. }
  14. /*****************************************************************
  15. **【函数名称】 DoTask
  16. **【函数功能】 Task处理
  17. **【参数】
  18. **【返回值】 void
  19. ****************************************************************/
  20. BOOL CTaskIvrPlayVoice::DoTask()
  21. {
  22. // 显示日志
  23. ShowLog();
  24. // 校验
  25. if(!Verify()) return FALSE;
  26. // 设置当前操作类型
  27. m_pCurrLine->opType() = PDU_CMD_IVR_PLAY_DTMF;
  28. UINT t_lineId = m_pCurrLine->lineId();
  29. // 向底层设备发送放音收号命令
  30. LineOpParam pLineOpParam;
  31. memset(&pLineOpParam,0,sizeof(pLineOpParam));
  32. pLineOpParam.nParam1 = m_CurrCmd.GetDataInt(4); // 放音收号模式,1:放音收号,2:只放音,3:只收号
  33. pLineOpParam.nParam2 = m_CurrCmd.GetDataInt(5); // 放音内容类型
  34. pLineOpParam.nParam3 = m_CurrCmd.GetDataInt(6); // 数字播报模式
  35. pLineOpParam.nParam4 = m_CurrCmd.GetDataInt(7); // 引擎音库
  36. pLineOpParam.nParam5 = m_CurrCmd.GetDataInt(8); // 语速
  37. pLineOpParam.nParam6 = m_CurrCmd.GetDataInt(9); // 音量
  38. pLineOpParam.nParam7 = m_CurrCmd.GetDataInt(10); // 收号位数
  39. pLineOpParam.nParam8 = m_CurrCmd.GetDataInt(12); // 收号时间间隔
  40. pLineOpParam.nParam9 = m_CurrCmd.GetDataInt(13); // 收号时是否放音
  41. lstrcpy(pLineOpParam.szParam1, m_CurrCmd.GetDataString(11)); // 结束标识
  42. lstrcpy(pLineOpParam.szParam3, m_CurrCmd.GetDataString(15)); // 放音内容
  43. return CCtiCore::GetInstance().getDevLink().exec((long)this, LINE_OP_PLAY_VOICE, t_lineId, &pLineOpParam);
  44. }
  45. /*****************************************************************
  46. **【函数名称】 Verify
  47. **【函数功能】 校验
  48. **【参数】
  49. **【返回值】 BOOL
  50. ****************************************************************/
  51. BOOL CTaskIvrPlayVoice::Verify()
  52. {
  53. // 线路绑定校验
  54. if(!_bindLogicLine(m_CurrCmd.GetDataUInt(3)))
  55. return FALSE;
  56. // 放音内容校验
  57. if(m_CurrCmd.GetDataInt(4) != PVM_WAIT_DIGIT && m_CurrCmd.GetDataString(15) == "")
  58. {
  59. ILogger::getInstance().log(LOG_CLASS_BUSI, LOG_LEVEL_WARNING, _T("{Task}: 线路[%d]执行IVR放音收号任务校验时失败:放音内容为空"), m_pCurrLine->lineId());
  60. return FALSE;
  61. }
  62. return TRUE;
  63. }
  64. /*****************************************************************
  65. **【函数名称】 ShowLog
  66. **【函数功能】 显示日志
  67. **【参数】
  68. **【返回值】 void
  69. ****************************************************************/
  70. void CTaskIvrPlayVoice::ShowLog()
  71. {
  72. // 显示日志
  73. ILogger::getInstance().log(LOG_CLASS_SOCKET, LOG_LEVEL_NORMAL,
  74. _T("IVR->CTI, CMD = [IVR放音收号],IVR = %d, Line = %u, FileName = %s"),
  75. m_CurrCmd.GetDataInt(1),
  76. m_CurrCmd.GetDataUInt(3),
  77. m_CurrCmd.GetDataString(15));
  78. }
  79. /*****************************************************************
  80. **【函数名称】 ProcTaskResult
  81. **【函数功能】 处理Pdu命令返回
  82. **【参数】 成功还是失败
  83. **【返回值】 void
  84. ****************************************************************/
  85. BOOL CTaskIvrPlayVoice::OnDevOpResult(EventOpResult &EvtInfo)
  86. {
  87. // 设置按键数据
  88. m_CurrCmd.SetDataString(16, EvtInfo.szData);
  89. // 命令返回
  90. _ProcCmdReturn(EvtInfo.bIsSucceed, true);
  91. return TRUE;
  92. }