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

Record.cpp 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #include "StdAfx.h"
  2. #include "Record.h"
  3. #include "Config.h"
  4. #include "CtiCore.h"
  5. #include "LogicLine.h"
  6. SINGLETON_IMPLEMENT(CRecord)
  7. CRecord::CRecord(void)
  8. {
  9. // 获取录音参数信息
  10. CConfig& Config = CConfig::GetInstance();
  11. m_RecordType = Config.recordType();
  12. m_FilePath = Config.recFilePath();
  13. }
  14. CRecord::~CRecord(void)
  15. {
  16. }
  17. /*****************************************************************
  18. **【函数名称】 __creatFileName
  19. **【函数功能】 创建录音文件路径以及录音文件名
  20. **【参数】 pLine; 待录音线路
  21. FileName: 输出参数,生成的录音文件名
  22. **【返回值】
  23. ****************************************************************/
  24. void CRecord::__creatFileName( CLogicLine* pLine, CString& FileName )
  25. {
  26. CTime TimeNow = CTime::GetCurrentTime();
  27. CString DateMark = TimeNow.Format(_T("%Y%m%d")); // 日期标识
  28. CString TimeMark = TimeNow.Format(_T("%H%M%S")); // 时间标识
  29. FileName.Format(_T("%s\\%s\\%d\\%d_%d_%s.wav"), m_FilePath, DateMark, pLine->lineId(),
  30. pLine->callId(), pLine->lineId(), TimeMark);
  31. }
  32. /*****************************************************************
  33. **【函数名称】 StartRecord
  34. **【函数功能】 开始录音
  35. **【参数】
  36. **【返回值】 录音是否成功
  37. ****************************************************************/
  38. bool CRecord::record( CLogicLine* pLine, CString& RecFile )
  39. {
  40. if(m_RecordType != RECORD_TYPE_TRUNK && m_RecordType != RECORD_TYPE_EXTEN)
  41. {
  42. ILogger::getInstance().log(LOG_CLASS_BUSI, LOG_LEVEL_ERROR, _T("{Record}: 启动录音时检测出录音类型配置错误, 类型=%d"), m_RecordType);
  43. return false;
  44. }
  45. if(pLine == NULL) return false;
  46. if(m_RecordType == RECORD_TYPE_TRUNK && pLine->type() == DEV_RES_TYPE_EXT) return false;
  47. if(m_RecordType == RECORD_TYPE_EXTEN && pLine->type() != DEV_RES_TYPE_EXT) return false;
  48. if(pLine->recordFile() != "") return false;
  49. // 获取录音文件名
  50. __creatFileName(pLine, RecFile);
  51. // 发送录音命令
  52. LineOpParam LineOpInfo;
  53. memset(&LineOpInfo,0,sizeof(LineOpInfo));
  54. LineOpInfo.nParam1 = LINE_RECORD_START; // 开始录音
  55. lstrcpy((LPSTR)LineOpInfo.szParam3, RecFile);
  56. CCtiCore::GetInstance().getDevLink().exec(-1, LINE_OP_RECORD, pLine->lineId(), &LineOpInfo);
  57. // 显示日志
  58. ILogger::getInstance().log(LOG_CLASS_BUSI, LOG_LEVEL_NORMAL, _T("{Record}: 开始录音, RecordLine = %d, RecordFile = %s"), pLine->lineId(), RecFile);
  59. return true;
  60. }