#include "VirtualChan.h" #include "Log.h" #include "FsProxy.h" #include "Operation.h" #include "OperationReactor.h" VirtualChan::VirtualChan(CFsProxy* pParent, uint32_t ChanNo) : m_pParent(pParent), m_No(ChanNo), m_State(CHAN_LOGIC_STATE_FREE), m_IsInMeeting(false), m_pOperation(nullptr), m_RecordFile("") { } VirtualChan::~VirtualChan() { } void VirtualChan::setRecordFile(const std::string & strFileName) { if (strFileName != "" && m_RecordFile == "") { m_RecordFile = strFileName; std::string data = m_pParent->creatJsonRecord(m_SessionId, m_RecordFile); m_pParent->send2Agent(std::to_string(m_No), data); } } void VirtualChan::_setSession(string SessionId, string ChanId) { m_SessionId = SessionId; if (!ChanId.empty()) { m_ChanId = ChanId; m_pParent->regBusyChan(this); } else { m_pParent->unregBusyChan(this); m_ChanId.clear(); } } void VirtualChan::_reset(void) { LOG_INFO("{CVirtualChan}: 执行线路[%lu]重置", m_No); m_State = CHAN_LOGIC_STATE_FREE; m_IsInMeeting = false; m_CalleeNum.clear(); m_CalleeNum.clear(); m_ChanId.clear(); m_SessionId.clear(); m_OpNumber.clear(); m_RecordFile = ""; } bool VirtualChan::bindOp(COperation * pOp) { if(pOp==nullptr || m_pOperation !=nullptr) return false; m_pOperation = pOp; return true; } bool VirtualChan::releaseOp(COperation * pOp) { if(m_pOperation != pOp) return false; m_pOperation = nullptr; return true; }