#include "stdafx.h" #include "CConfigLocal.h" #include "Config.h" CConfigLocal::CConfigLocal() { m_res_num = 0; } CConfigLocal::~CConfigLocal() { } /***************************************************************** **【函数名称】 Load **【函数功能】 从配置文件中号码资源信息 **【参数】 a_lpFileName 配置文件名 **【返回值】 ****************************************************************/ void CConfigLocal::load() { char t_config_filename[128] = { 0 }; strcpy(t_config_filename, "./TelRes.ini"); // 读取配置文件头 int nTotalCount = GetPrivateProfileInt("Head", "TotalCount", 0, t_config_filename); ASSERT(nTotalCount != 0); m_res_num = 0; // 读取单个命令的配置信息 char t_item_name[32]; char t_tel_num[32]; // 读取配置文件内容 for (int i = 0; i::iterator it = m_ResSet.find(t_tel_buf); if (it != m_ResSet.end()) { return true; } return false; } void CConfigLocal::getCallNumFromSipAddr(char* p_sip_uri, char* p_tel_buf) { if (p_sip_uri == NULL) return; if (p_tel_buf == NULL) return; char* t_p_pos; char t_szTmpAddr[200]; lstrcpy(t_szTmpAddr, p_sip_uri); TCHAR *p = strstr(t_szTmpAddr, _T("@")); if (p != NULL) *p = 0; p = strstr(t_szTmpAddr, _T(":")); if (p == NULL) t_p_pos = t_szTmpAddr; else t_p_pos = p + 1; strncpy(p_tel_buf, t_p_pos, sizeof(p_tel_buf)-1); return; }