| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- #include "StdAfx.h"
- #include "TapiOpIntercept.h"
- #include "DevControl.h"
- #include "TapiLine.h"
- #include "LineOpExec.h"
- CTapiOpIntercept::CTapiOpIntercept(LONG Instance) : CTapiOpBase(Instance), m_PendingCall(NULL), m_Step(0)
- {
- }
- CTapiOpIntercept::~CTapiOpIntercept(void)
- {
- }
- /*****************************************************************
- **【函数名称】 start
- **【函数功能】 操作启动(命令方式)
- **【参数】 pParam 操作启动参数
- **【返回值】
- ****************************************************************/
- bool CTapiOpIntercept::start( LineOpParam* pParam )
- {
- // 校验状态
- if(m_pAssistLine->status() != INNER_STATE_TALKING)
- return false;
- // 通知启动日志
- CDevControl::GetInstance().onEventLog(LOG_LEVEL_NORMAL, _T("{OP_Intercept}: Exten[%s]执行强截, DestNum = %s"), m_pHostLine->extenID(), m_pAssistLine->extenID());
- // 开始Park活动呼叫
- m_PendingCall = m_pAssistLine->activeCall();
- m_Step = 1;
- return m_pAssistLine->linePark(m_PendingCall, CONST_TAPI_CODE_PARK);
- }
- /*****************************************************************
- **【函数名称】 cancel
- **【函数功能】 操作取消(命令方式)
- **【参数】
- **【返回值】
- ****************************************************************/
- bool CTapiOpIntercept::cancel( LONG InstanceCancel )
- {
- return false;
- }
- /*****************************************************************
- **【函数名称】 end
- **【函数功能】 操作完成
- **【参数】 IsSucceed 操作是否成功
- **【返回值】
- ****************************************************************/
- void CTapiOpIntercept::end( bool IsSucceed )
- {
- if(IsSucceed)
- {
- CDevControl::GetInstance().onEventLog(LOG_LEVEL_NORMAL, _T("{OP_Intercept}: Exten[%s]强截成功, DestNum = %s"), m_pHostLine->extenID(), m_pAssistLine->extenID());
- }
- else
- {
- CDevControl::GetInstance().onEventLog(LOG_LEVEL_WARNING, _T("{OP_Intercept}: Exten[%s]强截失败, DestNum = %s"), m_pHostLine->extenID(), m_pAssistLine->extenID());
- } // end if
- // 返回执行结果
- CLineOpExec::GetInstance().onTapiOpResult(m_Instance, this, IsSucceed);
- }
- /*****************************************************************
- **【函数名称】 onReply
- **【函数功能】 线路操作异步响应事件
- **【参数】 pEventLine 触发事件的线路
- RequestID
- Result
- **【返回值】
- ****************************************************************/
- void CTapiOpIntercept::onReply( CTapiLine* pEventLine, LONG RequestID, HRESULT Result )
- {
- switch(m_Step)
- {
- case 1: // 正在Parking
- {
- (Result == S_OK) ? m_Step = 2 : end(false);
- }
- break;
- case 2: // 正在UnParking
- {
- if(Result != S_OK)
- {
- m_pAssistLine->lineUnPark(m_PendingCall, CONST_TAPI_CODE_PARK);
- end(false);
- } // end if
- }
- break;
- } // end switch
- }
- /*****************************************************************
- **【函数名称】 onCallState
- **【函数功能】 呼叫状态事件
- **【参数】 pEventLine 触发事件的线路
- CallId 触发事件的呼叫句柄
- CallState 呼叫基本状态
- CallStateDetail 呼叫明细状态
- **【返回值】
- ****************************************************************/
- void CTapiOpIntercept::onCallState( CTapiLine* pEventLine, HCALL CallId, DWORD CallState, DWORD CallStateDetail )
- {
- // Parking 操作完成
- if(m_Step == 1 && (CallId == m_PendingCall) && (CallState & LINECALLSTATE_DISCONNECTED))
- {
- m_Step = 2;
- m_pAssistLine->redoCallStatus(CallId, CallState, CallStateDetail);
- m_pHostLine->lineUnPark(m_PendingCall, CONST_TAPI_CODE_PARK);
- } // end if
- // UnParking 操作完成
- if(m_Step == 2 && (pEventLine == m_pHostLine) && (CallState & LINECALLSTATE_CONNECTED))
- {
- end(true);
- } // end if
- }
- /*****************************************************************
- **【函数名称】 onDevLinkEventS
- **【函数功能】 DevLink中S事件响应
- **【参数】 pEventLine 触发事件的线路
- pInfoS DevLink S事件内容
- **【返回值】
- ****************************************************************/
- void CTapiOpIntercept::onDevLinkEventS( CTapiLine* pEventLine, DevLinkInfoS* pInfoS )
- {
- }
- /*****************************************************************
- **【函数名称】 onDevLinkEventD
- **【函数功能】 DevLink中D事件响应
- **【参数】 pEventLine 触发事件的线路
- DevLinkCallId DevLink事件CallId
- **【返回值】
- ****************************************************************/
- void CTapiOpIntercept::onDevLinkEventD( CTapiLine* pEventLine, int DevLinkCallId )
- {
- }
- /*****************************************************************
- **【函数名称】 onDevLinkEventA
- **【函数功能】 DevLink中A事件响应
- **【参数】 pEventLine 触发事件的线路
- DevLinkCallId DevLink事件CallId
- **【返回值】
- ****************************************************************/
- void CTapiOpIntercept::onDevLinkEventA( CTapiLine* pEventLine, int DevLinkCallId )
- {
- }
|