升龙物业 老版本 ocx IPO, 加密狗 转值班电话

TaskIvrPlayVoice.cpp 3.2KB

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