修改三方通话功能,在发起三方通话时,先保持住主叫,然后再拉回主叫到会议

CConfigLocal.cpp 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #include "stdafx.h"
  2. #include "CConfigLocal.h"
  3. #include "Config.h"
  4. CConfigLocal::CConfigLocal()
  5. {
  6. m_res_num = 0;
  7. }
  8. CConfigLocal::~CConfigLocal()
  9. {
  10. }
  11. /*****************************************************************
  12. **【函数名称】 Load
  13. **【函数功能】 从配置文件中号码资源信息
  14. **【参数】 a_lpFileName 配置文件名
  15. **【返回值】
  16. ****************************************************************/
  17. void CConfigLocal::load()
  18. {
  19. char t_config_filename[128] = { 0 };
  20. strcpy(t_config_filename, "./TelRes.ini");
  21. // 读取配置文件头
  22. int nTotalCount = GetPrivateProfileInt("Head", "TotalCount", 0, t_config_filename);
  23. ASSERT(nTotalCount != 0);
  24. m_res_num = 0;
  25. // 读取单个命令的配置信息
  26. char t_item_name[32];
  27. char t_tel_num[32];
  28. // 读取配置文件内容
  29. for (int i = 0; i<nTotalCount; i++)
  30. {
  31. ZeroMemory(t_item_name, 32);
  32. sprintf_s(t_item_name, 32, "T%03d", i);
  33. ZeroMemory(t_tel_num, 32);
  34. GetPrivateProfileString("TEL_RES", t_item_name, "", t_tel_num, 31, t_config_filename);
  35. if (strlen(t_tel_num) == 0) {
  36. break;
  37. }
  38. string t_res_str;
  39. t_res_str = t_tel_num;
  40. m_ResSet.insert(t_res_str);
  41. m_res_num = m_ResSet.size();
  42. } // end for(TotalCount)
  43. return ;
  44. }
  45. bool CConfigLocal::isContains(char* p_tel)
  46. {
  47. if (m_res_num == 0)
  48. return true;
  49. if (p_tel == NULL)
  50. return false;
  51. if (strlen(p_tel) == 0)
  52. return false;
  53. char t_tel_buf[32] = { 0 };
  54. getCallNumFromSipAddr(p_tel, t_tel_buf);
  55. //string t_tel_str;
  56. //t_tel_str = t_tel_buf;
  57. set<string>::iterator it = m_ResSet.find(t_tel_buf);
  58. if (it != m_ResSet.end())
  59. {
  60. return true;
  61. }
  62. return false;
  63. }
  64. void CConfigLocal::getCallNumFromSipAddr(char* p_sip_uri, char* p_tel_buf)
  65. {
  66. if (p_sip_uri == NULL)
  67. return;
  68. if (p_tel_buf == NULL)
  69. return;
  70. char* t_p_pos;
  71. char t_szTmpAddr[200];
  72. lstrcpy(t_szTmpAddr, p_sip_uri);
  73. TCHAR *p = strstr(t_szTmpAddr, _T("@"));
  74. if (p != NULL)
  75. *p = 0;
  76. p = strstr(t_szTmpAddr, _T(":"));
  77. if (p == NULL)
  78. t_p_pos = t_szTmpAddr;
  79. else
  80. t_p_pos = p + 1;
  81. strncpy(p_tel_buf, t_p_pos, sizeof(p_tel_buf)-1);
  82. return;
  83. }