linux版本中间件

Chan.cpp 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #include "Chan.h"
  2. #include "Log.h"
  3. Chan::Chan(const DEV_RES_TYPE& emType, const std::string& strNo):AsrInfo(),m_emType(emType),m_No(strNo)
  4. {
  5. m_CallID=""; // 会话id
  6. m_ChanID = ""; // 通道id
  7. m_Caller = "";// 主叫
  8. m_Callee = "";// 被叫
  9. }
  10. Chan::~Chan()
  11. {
  12. LOG_DEBUG_S(boost::str(Format("[%s][%s]通道资源析构[%s][%s]") %(m_emType != DEV_RES_TYPE_EXT ?"中继":"分机") % m_No % m_CallID%m_ChanID));
  13. }
  14. void Chan::Create(const std::string & strCallID, const std::string & strChanID, const std::string & strCaller, const std::string & strCallee, const CALL_DIRECTION & emCallDirect)
  15. {
  16. m_CallID = strCallID; // 会话id
  17. m_ChanID = strChanID; // 通道id
  18. m_Caller = strCaller;// 主叫
  19. m_Callee = strCallee;// 被叫
  20. m_emCallDirect = emCallDirect;
  21. }
  22. void Chan::Hangup()
  23. {
  24. __reset();
  25. m_CallID = ""; // 会话id
  26. m_ChanID = ""; // 通道id
  27. m_Caller = "";// 主叫
  28. m_Callee = "";// 被叫
  29. }
  30. std::string Chan::to_string()
  31. {
  32. Format fmt("CallID[%s]ChanID[%s]Caller[%s]Callee[%s]");
  33. fmt%m_CallID %m_ChanID %m_Caller %m_Callee;
  34. std::string str = fmt.str();
  35. return str;
  36. }