| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- #include "StdAfx.h"
- #include "Config.h"
- CString CConfig::m_LogFilePath = __T("");
- CString CConfig::m_CtiIp = _T("127.0.0.1");
- int CConfig::m_CtiPort = CTI_LISTEN_PORT;
- int CConfig::m_ListenPort = ACD_LISTEN_PORT;
- UINT CConfig::m_PostProcessingTime = 0;
- int CConfig::m_AgentLockedPeriod = 15;
- CArray<CString, LPCTSTR> CConfig::m_CallPrefixList;
- CConfig::CConfig(void)
- {
- }
- /*****************************************************************
- **【函数名称】 load
- **【函数功能】 读取所有配置
- **【参数】
- **【返回值】 成功true,失败false
- ****************************************************************/
- bool CConfig::load()
- {
- IOtlConnection* pConn = IOtlConnection::getInstance();
- // 读取日志文件路径
- m_LogFilePath = pConn->GetSingleDataStr(_T("SELECT value FROM conf_system WHERE name = 'LogPath'"));
- // SOCKET参数
- m_CtiIp = pConn->GetSingleDataStr(_T("SELECT value FROM conf_system WHERE name = 'CtiAddr'"));
- m_CtiPort = pConn->GetSingleDataStr2Int(_T("SELECT value FROM conf_system WHERE name = 'CtiPort'"));
- m_ListenPort = pConn->GetSingleDataStr2Int(_T("SELECT value FROM conf_system WHERE name = 'AcdPort'"));
- // 业务参数
- m_AgentLockedPeriod = pConn->GetSingleDataStr2Int(_T("SELECT value FROM conf_system WHERE name = 'AgentLockedPeriod'"));
- m_PostProcessingTime = pConn->GetSingleDataStr2Int(_T("SELECT value FROM conf_system WHERE name = 'PPTime'"));
- IOtlRecordset* pMatchRcd = pConn->QueryRecords(_T("SELECT prefix FROM conf_trunk_match"));
- if (NULL == pMatchRcd)
- return false;
- int Prefix = 0;
- while(!pMatchRcd->IsEOF())
- {
- pMatchRcd->MoveNextRow();
- m_CallPrefixList.Add(pMatchRcd->GetValueStrByIndex(1));
- } // end while
- IOtlRecordset::DestroyInstance(pMatchRcd); // 释放记录集
- return true;
- }
- /*****************************************************************
- **【函数名称】 isMatchCallPrefix
- **【函数功能】 是否匹配呼叫字冠
- **【参数】
- **【返回值】 成功true,失败false
- ****************************************************************/
- bool CConfig::isMatchCallPrefix( const CString& CalleeNum )
- {
- for(int i = 0; i < m_CallPrefixList.GetCount(); ++i)
- {
- const CString& Prefix = m_CallPrefixList[i];
- if(Prefix == CalleeNum.Left(Prefix.GetLength()))
- return true;
- }
- return false;
- }
|