| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680 |
- #include "StdAfx.h"
- #include "AgentOp.h"
- #include "AgentClient.h"
- #include "AgentLog.h"
- #include "AgentEventManager.h"
- #include "PduEntity.h"
- #include "NetCtrlInterface.h"
- CAgentOp::CAgentOp(CAgentClient* pClient)
- {
- m_pAgentClient = pClient;
- }
- CAgentOp::~CAgentOp(void)
- {
- }
- /*****************************************************************
- **【函数名称】 OnRecvCommand
- **【函数功能】 发送坐席操作命令
- **【参数】
- **【返回值】
- ****************************************************************/
- BOOL CAgentOp::SendCmdAgentOp(CPduEntity* pEntity, ErrorCode &nErrCode)
- {
- // 判断连接状态
- if (m_pAgentClient->m_nAgentLinkState != PDU_LINK_STATE_REG_OK)
- {
- m_pAgentClient->SetErrorCode(ERR_NO_AGENT_SOCKET);
- nErrCode = ERR_NO_AGENT_SOCKET;
- return FALSE;
- }
- // 设置分机号和坐席工号
- pEntity->SetDataUInt(1,m_pAgentClient->m_nAgentExtension);
- pEntity->SetDataUInt(2,m_pAgentClient->m_nAgentNumber);
-
- // 发送命令
- if (!CInterfaceWindow::getCommInstance()->Send(pEntity, PDU_DEV_TYPE_ACD, 0))
- {
- m_pAgentClient->SetErrorCode( ERR_SEND_MSG );
- nErrCode = ERR_SEND_MSG;
- return FALSE;
- }
- nErrCode = NO_ERR;
- return TRUE;
- }
- /*****************************************************************
- **【函数名称】 CheckDestNum
- **【函数功能】 操作号码校验
- **【参数】
- **【返回值】
- ****************************************************************/
- BOOL CAgentOp::CheckDestNum(CString strDestNum, ErrorCode& nErrCode)
- {
- // 对号码长度进行校验
- if(strDestNum.GetLength() >= PHONE_NUM_LEN)
- {
- nErrCode = ERR_TARGET_NUMBER_TOO_LONG;
- return FALSE;
- }
- // 检查是否包含特殊字符(或者为空)
- if (strDestNum.Find('%') != -1 || strDestNum.Find('&') != -1 || strDestNum.Find('/') != -1
- || strDestNum.Find('\\') != -1 || strDestNum.Find('@') != -1 || strDestNum.Find('$') != -1 || strDestNum == "")
- {
-
- nErrCode = ERR_DESTNUM_SPACIL;
- return FALSE;
- }
- // 检查是否是操作自己
- CString tmpStrAgentNumber = "";
- CString tmpStrAgentExtension = "";
- tmpStrAgentNumber.Format( "%d", m_pAgentClient->m_nAgentNumber );
- tmpStrAgentExtension.Format( "%d", m_pAgentClient->m_nAgentExtension );
- if (strDestNum == tmpStrAgentNumber || strDestNum == tmpStrAgentExtension)
- {
- nErrCode = ERR_MAKECALL_BY_SELF;
- return FALSE;
- }
- nErrCode = NO_ERR;
- return TRUE;
- }
- /*****************************************************************
- **【函数名称】 Login
- **【函数功能】 签入到ACD服务器
- **【参数】
- **【返回值】
- ****************************************************************/
- void CAgentOp::Login()
- {
- // 打包命令并发送
- CPduEntity cmd(PDU_CMD_AGENT_LOGIN);
- cmd.SetDataString(3, m_pAgentClient->m_sAgentGroup);
- cmd.SetDataUInt(4, m_pAgentClient->m_nAgentType);
- cmd.SetDataUInt(5, m_pAgentClient->m_nWorkOverTime);
- ErrorCode nErrCode;
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_LogIn( false, nErrCode);
- return;
- }
- // 记录到日志
- m_pAgentClient->GetAgentLog()->Log( "座席%d执行签入:分机%d,ACD服务器的id=%d(用于以后的主备),地址%s,端口号%d",
- m_pAgentClient->m_nAgentNumber,
- m_pAgentClient->m_nAgentExtension,
- m_pAgentClient->m_firstAcdServer.m_nAcdServerId,
- m_pAgentClient->m_firstAcdServer.m_sAcdServerIpAddr.GetBuffer(),
- m_pAgentClient->m_firstAcdServer.m_nAcdServerPort );
- // 记得对CString进行ReleaseBuffer操作
- m_pAgentClient->m_firstAcdServer.m_sAcdServerIpAddr.ReleaseBuffer();
- }
- /*****************************************************************
- **【函数名称】 Logout
- **【函数功能】 签出
- **【参数】
- **【返回值】
- ****************************************************************/
- void CAgentOp::Logout()
- {
- // 打包命令并发送
- CPduEntity cmd(PDU_CMD_AGENT_LOGOUT);
- ErrorCode nErrCode;
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_LogOut(false, nErrCode);
- return;
- }
- // 关闭Socket连接
- if(!m_pAgentClient->CloseClient())
- {
- m_pAgentClient->SetErrorCode( ERR_CLOSE_SOCKET );
- m_pAgentClient->GetEventManager()->Fire_Evt_SysError( ERR_CLOSE_SOCKET );
- m_pAgentClient->GetEventManager()->Fire_Evt_LogOut(false, ERR_CLOSE_SOCKET);
- return;
- }
- // 签出成功
- m_pAgentClient->GetEventManager()->Fire_Evt_LogOut( true, 0 );
- m_pAgentClient->GetAgentLog()->Log( "ACD返回执行结果:Cmd_Agent_Acd_LogOut 成功" );
- // 坐席信息反初始化
- m_pAgentClient->m_nAgentState = AGENT_STATE_LOGOUT;
- m_pAgentClient->GetEventManager()->Fire_Evt_AgentStateChanged( m_pAgentClient->m_nAgentState );
- m_pAgentClient->m_nAgentLineState = INNER_STATE_DISABLED;
- m_pAgentClient->GetEventManager()->Fire_Evt_AgentLineStateChanged( m_pAgentClient->m_nAgentLineState );
-
- // 触发连接断开事件
- m_pAgentClient->m_nAgentLinkState = PDU_LINK_STATE_DISCONNECTED;
- m_pAgentClient->GetEventManager()->Fire_Evt_AgentLinkStateChanged(PDU_LINK_STATE_DISCONNECTED);
- }
- // 异步,置忙
- void CAgentOp::SayBusy(int a_nBusyType)
- {
- if (m_pAgentClient->GetAgentState() == AGENT_STATE_BUSY)
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_SayBusy(false, ERR_SAY_BUSY);
- return;
- }
- // 打包命令并发送
- CPduEntity cmd(PDU_CMD_AGENT_SETSTATE);
- cmd.SetDataUInt(3, AGENT_STATE_REPOSE);
- ErrorCode nErrCode;
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_SayBusy(false, nErrCode);
- }
- }
- // 异步,置闲
- void CAgentOp::SayFree()
- {
- // 打包命令并发送
- CPduEntity cmd(PDU_CMD_AGENT_SETSTATE);
- cmd.SetDataUInt(3, AGENT_STATE_FREE);
- ErrorCode nErrCode;
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_SayFree( false, nErrCode);
- }
- }
- // 异步,重置座席
- void CAgentOp::ResetAgent()
- {
- // 打包命令并发送
- CPduEntity cmd(PDU_CMD_AGENT_RESET);
- ErrorCode nErrCode;
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_ResetAgent( false, nErrCode);
- return;
- }
-
- m_pAgentClient->GetEventManager()->Fire_Evt_ResetAgent( true, 0 );
- }
- // 异步,外拨,目前只提供异步的外拨接口
- void CAgentOp::MakeCall(CString a_sTelNum, CString a_sCallerNum)
- {
- ErrorCode nErrCode;
- // 对号码进行校验
- if(!CheckDestNum(a_sTelNum, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_MakeCall(false,
- 0,
- a_sTelNum,
- 0,
- nErrCode);
- return;
- }
- // 命令打包发送
- CPduEntity cmd(PDU_CMD_AGENT_MAKECALL);
- cmd.SetDataString(4, a_sTelNum);
- cmd.SetDataString(5, a_sCallerNum);
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_MakeCall( false,
- 0,
- a_sTelNum,
- 0,
- nErrCode);
- return;
- }
- // 保存外部号码
- m_pAgentClient->m_sOuterNumber = a_sTelNum;
- }
- // 异步,扩展外拨
- void CAgentOp::MakeCallEx(CString a_sTelNum, long a_nType)
- {
- }
- // 异步,预览外拨
- void CAgentOp::PreviewMakeCall( CString a_sTelNumList)
- {
- }
- // 异步,应答
- void CAgentOp::AnswerCall()
- {
- // 打包命令并发送
- CPduEntity cmd(PDU_CMD_AGENT_ANSWER);
- ErrorCode nErrCode;
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_AnswerCall( false, m_pAgentClient->m_nCallID, nErrCode);
- }
- }
- // 异步,挂机
- void CAgentOp::DropCall()
- {
- // 打包命令并发送
- CPduEntity cmd(PDU_CMD_AGENT_HANGUP);
- ErrorCode nErrCode;
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_DropCall( false, 1, m_pAgentClient->m_nCallID, nErrCode);
- }
- }
- // 异步,取消
- void CAgentOp::Cancel()
- {
- // 打包命令并发送
- CPduEntity cmd(PDU_CMD_AGENT_CANCEL);
- ErrorCode nErrCode;
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_Cancel( false, m_pAgentClient->m_nCallID, nErrCode);
- }
- }
- // 保持
- void CAgentOp::Hold()
- {
- // 打包命令并发送
- CPduEntity cmd(PDU_CMD_AGENT_HOLD);
- ErrorCode nErrCode;
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_Hold( false, m_pAgentClient->m_nCallID, nErrCode);
- }
- }
- // 接回
- void CAgentOp::TakeBack()
- {
- // 打包命令并发送
- CPduEntity cmd(PDU_CMD_AGENT_TAKEBACK);
- ErrorCode nErrCode;
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_UnHold( false, 0, nErrCode);
- }
- }
- // 转移
- void CAgentOp::Transfer(CString a_sTelNum, CString a_sCallerNum)
- {
- ErrorCode nErrCode;
- // 对号码进行校验
- if(!CheckDestNum(a_sTelNum, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_Transfer(false, m_pAgentClient->m_nCallID, nErrCode);
- return;
- }
- // 命令打包发送
- CPduEntity cmd(PDU_CMD_AGENT_TRANSTALK);
- cmd.SetDataString(3, a_sTelNum);
- cmd.SetDataString(4, a_sCallerNum);
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_Transfer(false, m_pAgentClient->m_nCallID, nErrCode);
- return;
- }
- // 保存外部号码
- m_pAgentClient->m_sOuterNumber = a_sTelNum;
- }
- // 三方
- void CAgentOp::Meeting(CString a_sTelNum, CString a_sCallerNum)
- {
- ErrorCode nErrCode;
- // 对号码进行校验
- if(!CheckDestNum(a_sTelNum, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_ThreeTalk(false, m_pAgentClient->m_nCallID, nErrCode);
- return;
- }
- // 命令打包发送
- CPduEntity cmd(PDU_CMD_AGENT_THREETALK);
- cmd.SetDataString(3, a_sTelNum);
- cmd.SetDataString(4, a_sCallerNum);
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_ThreeTalk(false, m_pAgentClient->m_nCallID, nErrCode);
- return;
- }
- // 保存外部号码
- m_pAgentClient->m_sOuterNumber = a_sTelNum;
- }
- // 取消转移
- void CAgentOp::CancelTransfer()
- {
- // 打包命令并发送
- CPduEntity cmd(PDU_CMD_AGENT_CANCEL);
- ErrorCode nErrCode;
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_Cancel( false, m_pAgentClient->m_nCallID, nErrCode);
- }
- }
- // 取消三方
- void CAgentOp::CancelMeeting()
- {
- // 打包命令并发送
- CPduEntity cmd(PDU_CMD_AGENT_CANCEL);
- ErrorCode nErrCode;
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_Cancel( false, m_pAgentClient->m_nCallID, nErrCode);
- }
- }
- // 协商呼叫
- void CAgentOp::Consult(CString a_sTelNum, CString a_sCallerNum)
- {
- ErrorCode nErrCode;
- // 对号码进行校验
- if(!CheckDestNum(a_sTelNum, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_Consult(false, 0, nErrCode);
- return;
- }
- // 命令打包发送
- CPduEntity cmd(PDU_CMD_AGENT_CONSULTATION_CALL);
- cmd.SetDataString(4, a_sTelNum);
- cmd.SetDataString(5, a_sCallerNum);
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_Consult(false, 0, nErrCode);
- return;
- }
- // 保存外部号码
- m_pAgentClient->m_sOuterNumber = a_sTelNum;
- }
- // 确认转移
- void CAgentOp::Confirm(long a_nType)
- {
- ErrorCode nErrCode;
- // 打包命令并发送
- CPduEntity cmd(PDU_CMD_AGENT_CONFIRM_TRANSFER);
- cmd.SetDataUInt(3, a_nType); // 协商呼叫完成方式
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_Confirm( false, 0, nErrCode);
- return;
- }
- }
- // 操作接口:代接
- void CAgentOp::Instead(long a_nTelNum)
- {
- ErrorCode nErrCode;
- CString a_sTelNum;
- a_sTelNum.Format("%ld", a_nTelNum);
- // 对号码进行校验
- if(!CheckDestNum(a_sTelNum, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_Instead(false, m_pAgentClient->m_nCallID, nErrCode);
- return;
- }
- // 命令打包发送
- CPduEntity cmd(PDU_CMD_AGENT_MONI_REPLACE);
- cmd.SetDataUInt(4, (unsigned int)a_nTelNum);
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_Instead(false, m_pAgentClient->m_nCallID, nErrCode);
- return;
- }
- // 保存外部号码
- m_pAgentClient->m_sOuterNumber = a_sTelNum;
- }
- // 操作接口:监听座席
- void CAgentOp::Listen(long a_nTelNum)
- {
- CString a_sTelNum;
- a_sTelNum.Format("%ld", a_nTelNum);
- ErrorCode nErrCode;
- // 对号码进行校验
- if(!CheckDestNum(a_sTelNum, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_ListenAgent(false, m_pAgentClient->m_nCallID, nErrCode);
- return;
- }
- // 命令打包发送
- CPduEntity cmd(PDU_CMD_AGENT_MONI_LISTEN);
- cmd.SetDataUInt(4, (unsigned int)a_nTelNum);
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_ListenAgent(false, m_pAgentClient->m_nCallID, nErrCode);
- return;
- }
- // 保存外部号码
- m_pAgentClient->m_sOuterNumber = a_sTelNum;
- }
- // 强插座席
- void CAgentOp::Insert(long a_nTelNum)
- {
- ErrorCode nErrCode;
- CString a_sTelNum;
- a_sTelNum.Format("%ld", a_nTelNum);
- // 对号码进行校验
- if(!CheckDestNum(a_sTelNum, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_InsertAgent(false, m_pAgentClient->m_nCallID, nErrCode);
- return;
- }
- // 命令打包发送
- CPduEntity cmd(PDU_CMD_AGENT_MONI_INSERT);
- cmd.SetDataUInt(4, (unsigned int)a_nTelNum);
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_InsertAgent(false, m_pAgentClient->m_nCallID, nErrCode);
- return;
- }
- // 保存外部号码
- m_pAgentClient->m_sOuterNumber = a_sTelNum;
- }
- // 操作接口:强截座席
- void CAgentOp::Intercept(long a_nTelNum)
- {
- ErrorCode nErrCode;
- CString a_sTelNum;
- a_sTelNum.Format("%ld", a_nTelNum);
- // 对号码进行校验
- if(!CheckDestNum(a_sTelNum, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_InterceptAgent(false, m_pAgentClient->m_nCallID, nErrCode);
- return;
- }
- // 命令打包发送
- CPduEntity cmd(PDU_CMD_AGENT_MONI_INTERCEPT);
- cmd.SetDataUInt(4, (unsigned int)a_nTelNum);
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_InterceptAgent(false, m_pAgentClient->m_nCallID, nErrCode);
- return;
- }
- // 保存外部号码
- m_pAgentClient->m_sOuterNumber = a_sTelNum;
- }
- // 操作接口:强拆座席
- void CAgentOp::Break(long a_nTelNum)
- {
- ErrorCode nErrCode;
- CString a_sTelNum;
- a_sTelNum.Format("%ld", a_nTelNum);
- // 对号码进行校验
- if(!CheckDestNum(a_sTelNum, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_CutAgent(false, m_pAgentClient->m_nCallID, nErrCode);
- return;
- }
- // 命令打包发送
- CPduEntity cmd(PDU_CMD_AGENT_MONI_CUT);
- cmd.SetDataUInt(4, (unsigned int)a_nTelNum);
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_CutAgent(false, m_pAgentClient->m_nCallID, nErrCode);
- return;
- }
- // 保存外部号码
- m_pAgentClient->m_sOuterNumber = a_sTelNum;
- }
- // 操作接口:发送传真
- void CAgentOp::SendFax(CString a_sFilePath)
- {
- CPduEntity cmd(PDU_CMD_AGENT_FAX);
- cmd.SetDataUInt(4, 0);
- cmd.SetDataString(5, a_sFilePath);
- ErrorCode nErrCode;
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_SendFax( false, m_pAgentClient->m_nCallID, nErrCode);
- }
- }
- // 操作接口:接收传真
- void CAgentOp::RecvFax(CString a_sRecvFilePath)
- {
- CPduEntity cmd(PDU_CMD_AGENT_FAX);
- cmd.SetDataUInt(4, 1);
- cmd.SetDataString(5, a_sRecvFilePath);
- ErrorCode nErrCode;
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_RecvFax( false, m_pAgentClient->m_nCallID, nErrCode);
- }
- }
- // 操作接口:转移到指定IVR
- void CAgentOp::TransferToIvr(CString a_sIvrFilePath, long a_nNode, BOOL a_bNeedReturn, CString a_sAssociateData)
- {
- CPduEntity cmd(PDU_CMD_AGENT_TURN_TO_IVR);
- cmd.SetDataUInt(5, a_nNode);
- cmd.SetDataString(6, a_sIvrFilePath);
- cmd.SetDataString(7, a_sAssociateData);
- cmd.SetDataBool(8, a_bNeedReturn == TRUE ? true:false);
- ErrorCode nErrCode;
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_TransferToIvr( false, m_pAgentClient->m_nCallID, nErrCode);
- }
- }
- // 强制签出
- void CAgentOp::ForceAgentLogOut(long a_nTelNum, CString a_sReason)
- {
- ErrorCode nErrCode;
- CString a_sTelNum;
- a_sTelNum.Format("%ld", a_nTelNum);
- // 对号码进行校验
- if(!CheckDestNum(a_sTelNum, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_ForceLogOut(false, nErrCode);
- return;
- }
- CPduEntity cmd(PDU_CMD_AGENT_MONI_FORCE_LOGOUT);
- cmd.SetDataUInt(4, (unsigned int)a_nTelNum);
- cmd.SetDataString(5, a_sReason);
-
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_ForceLogOut( false, nErrCode);
- }
- }
- // 强制控制状态
- void CAgentOp::ForceAgentState(long a_nTelNum, int nState)
- {
- ErrorCode nErrCode;
- CString a_sTelNum;
- a_sTelNum.Format("%ld", a_nTelNum);
- // 对号码进行校验
- if(!CheckDestNum(a_sTelNum, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_ForceControlAgent( false, m_pAgentClient->m_nCallID, nErrCode);
- return;
- }
- CPduEntity cmd(PDU_CMD_AGENT_MONI_FORCE_STATE);
- cmd.SetDataUInt(4, (unsigned int)a_nTelNum);
- cmd.SetDataUInt(5, (unsigned int)nState);
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_ForceControlAgent( false, m_pAgentClient->m_nCallID, nErrCode);
- }
- }
- /*****************************************************************
- **【函数名称】 MuteOn
- **【函数功能】 开始静音
- **【参数】
- **【返回值】
- ****************************************************************/
- void CAgentOp::MuteOn()
- {
- // 打包命令并发送
- CPduEntity cmd(PDU_CMD_AGENT_MUTE);
- cmd.SetDataUInt(3, 0);
- ErrorCode nErrCode;
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_BeginMute( false, m_pAgentClient->m_nCallID, nErrCode);
- }
- }
- /*****************************************************************
- **【函数名称】 MuteOff
- **【函数功能】 结束静音
- **【参数】
- **【返回值】
- ****************************************************************/
- void CAgentOp::MuteOff()
- {
- // 打包命令并发送
- CPduEntity cmd(PDU_CMD_AGENT_MUTE);
- cmd.SetDataUInt(3, 1);
- ErrorCode nErrCode;
- if (!SendCmdAgentOp(&cmd, nErrCode))
- {
- m_pAgentClient->GetEventManager()->Fire_Evt_EndMute( false, m_pAgentClient->m_nCallID, nErrCode);
- }
- }
|