| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #pragma once
- #include "FsLinkInc.h"
- #include "DevInfoInc.h"
- #include "Util.h"
- #include "SqlWrite.h"
- class COperationReactor;
- class VirtualChan;
- class COperation
- {
- public:
- COperation(COperationReactor* pParent, long Instance);
- virtual ~COperation();
- virtual LINE_OP type(void) const = 0;
- long uniqueId(void) const { return reinterpret_cast<long>(this); }
- // 关联操作
- virtual bool attachHostChan(VirtualChan* pChan); // 设置主控通道的关联
- virtual void detachHostChan(void); // 取消通道关联
- // 控制接口
- virtual bool start(LineOpParam* pParam) = 0; // 操作启动(命令方式)
- virtual bool start(PCHAN_EVENT_NOTIFY pNotify); // 操作启动(命令方式)
- virtual bool cancel(long InstanceCancel); // 取消当前操作
- virtual bool hangup(long InstanceHangup); // 操作中挂机
- virtual void setOpInstance(long Instance); // 设置调用标识
- // 事件响应接口
- virtual void onBackgroudJobDone(PBG_JOB_NOTIFY pNotify); // 后台命令执行结束事件处理
- virtual void onAssoChanStateUpdated(VirtualChan* pAssoChan); // 相关通道状态更新处理
- virtual void onHostChanStateUpdated(VirtualChan* pHostChan); // 关联通道状态更新处理
- virtual void onSessionChanStateUpdated(VirtualChan* pChan); // 同会话中通道状态更新处理
- protected:
- COperationReactor* m_pParent; // 宿主类
- VirtualChan* m_pHostChan; // 当前操作的主控通道
- long m_Instance; // 调用标识,用于回传
- long m_InstanceCancel; // 启动取消操作的调用标识
- protected:
- std::string toSql(bool isSuccess,std::string opDesc) {
- Format fmt("insert into op_record(uuid,caller_agent,caller,callee_agent,callee,is_success,op_type,op_desc,op_time) values('%s','%s','%s','%s','%s',%d,%d,'%s','%s') ");
- fmt %m_SessionId %m_CallerAgent %m_Caller %m_CalleeAgent %m_Callee %isSuccess %type() % opDesc %m_OpTime;
- return fmt.str();
- }
- protected:
- std::string m_SessionId; // 会话id
- std::string m_CallerAgent;
- std::string m_Caller;
- std::string m_CalleeAgent;
- std::string m_Callee;
- std::string m_OpTime; //操作时间
- };
|