Просмотр исходного кода

判断数据库类型宏改为自动判断

baiwenju лет назад: 5
Родитель
Сommit
6cf42a46d3
3 измененных файлов с 25 добавлено и 20 удалено
  1. 24 17
      FsLink/CfgSipAccount.cpp
  2. 1 1
      FsLink/FsProxy.cpp
  3. 0 2
      FsLink/stdafx.h

+ 24 - 17
FsLink/CfgSipAccount.cpp

@@ -15,12 +15,12 @@ CCfgSipAccount::~CCfgSipAccount(void)
15 15
 /*****************************************************************
16 16
 **【函数名称】	__free
17 17
 **【函数功能】	释放所有sip账户信息
18
-**【参数】		
19
-**【返回值】	
18
+**【参数】
19
+**【返回值】
20 20
 ****************************************************************/
21
-void CCfgSipAccount::__free( void )
21
+void CCfgSipAccount::__free(void)
22 22
 {
23
-	while(m_nCount > 0)
23
+	while (m_nCount > 0)
24 24
 	{
25 25
 		SIP_ACCOUNT* pAccount = RemoveHead();
26 26
 		ASSERT(pAccount != NULL);
@@ -31,17 +31,24 @@ void CCfgSipAccount::__free( void )
31 31
 /*****************************************************************
32 32
 **【函数名称】	load
33 33
 **【函数功能】	加载所有sip账户信息
34
-**【参数】		
35
-**【返回值】	
34
+**【参数】
35
+**【返回值】
36 36
 ****************************************************************/
37
-bool CCfgSipAccount::load( void )
37
+bool CCfgSipAccount::load(void)
38 38
 {
39 39
 	long Count = 0;
40
-#ifdef DSN_ORACLE
41
-	Count = COtlConnection::GetOtlInstence()->GetSingleDataInt(_T("SELECT COUNT(*)  FROM USER_TAB_COLUMNS WHERE TABLE_NAME = 'CONF_SIP_ACCOUNT' AND COLUMN_NAME ='ISDYNAMICGW'"));
42
-#else 
43
-	Count = COtlConnection::GetOtlInstence()->GetSingleDataInt(_T("select count(*) from information_schema.columns where table_name = 'conf_sip_account' and column_name = 'IsDynamicGw'"));
44
-#endif
40
+	if (DB_MySQL == COtlConnection::GetOtlInstence()->GetDatabaseType() || DB_Oracle == COtlConnection::GetOtlInstence()->GetDatabaseType())
41
+	{
42
+		Count = COtlConnection::GetOtlInstence()->GetSingleDataInt(_T("SELECT COUNT(*)  FROM USER_TAB_COLUMNS WHERE TABLE_NAME = 'CONF_SIP_ACCOUNT' AND COLUMN_NAME ='ISDYNAMICGW'"));
43
+	}
44
+	else if (DB_SQLServer == COtlConnection::GetOtlInstence()->GetDatabaseType())
45
+	{
46
+		Count = COtlConnection::GetOtlInstence()->GetSingleDataInt(_T("select count(*) from information_schema.columns where table_name = 'conf_sip_account' and column_name = 'IsDynamicGw'"));
47
+	}
48
+	else
49
+	{
50
+		return false;
51
+	}
45 52
 
46 53
 	COtlRecordset* pAccountRcd = NULL;
47 54
 	BOOL bAddOk = FALSE;
@@ -112,18 +119,18 @@ void CCfgSipAccount::unload(void)
112 119
 /*****************************************************************
113 120
 **【函数名称】	getAccount
114 121
 **【函数功能】	获取指定sip账户信息
115
-**【参数】		
116
-**【返回值】	
122
+**【参数】
123
+**【返回值】
117 124
 ****************************************************************/
118
-SIP_ACCOUNT* CCfgSipAccount::getAccount( int AccountId )
125
+SIP_ACCOUNT* CCfgSipAccount::getAccount(int AccountId)
119 126
 {
120 127
 	CNode* pNodeCur = m_pNodeHead;
121
-	while(pNodeCur != NULL)
128
+	while (pNodeCur != NULL)
122 129
 	{
123 130
 		SIP_ACCOUNT* pAccount = pNodeCur->data;
124 131
 		ASSERT(pAccount != NULL);
125 132
 
126
-		if(pAccount->Id == AccountId)
133
+		if (pAccount->Id == AccountId)
127 134
 			return pAccount;
128 135
 
129 136
 		pNodeCur = pNodeCur->pNext;

+ 1 - 1
FsLink/FsProxy.cpp

@@ -681,7 +681,7 @@ void CFsProxy::unregBusyChan(CVirtualChan* pChan)
681 681
 bool CFsProxy::ExtenCall(LONG JobId, CVirtualChan* pChan, LPCTSTR CallerNum, LPCTSTR CalleeNum)
682 682
 {
683 683
 	CString EslCmd;
684
-	EslCmd.Format(_T("bgapi originate {origination_caller_id_number=%lu}user/%lu %s XML %s\r\n%s: %ld"),
684
+	EslCmd.Format(_T("bgapi originate {origination_caller_id_number=%lu,absolute_codec_string='PCMA,PCMU'}user/%lu %s XML %s\r\n%s: %ld"),
685 685
 		pChan->no(), pChan->no(), CalleeNum, CConfig::extContext(), ESL_HEADER_JOB_UUID, JobId);
686 686
 
687 687
 	return m_Gateway.sendCmd(EslCmd);

+ 0 - 2
FsLink/stdafx.h

@@ -30,7 +30,5 @@
30 30
 
31 31
 #include <afxmt.h>				// 临界区
32 32
 
33
-#define DSN_ORACLE         // 连接oracle数据库
34
-
35 33
 // TODO: 在此处引用程序需要的其他头文件
36 34
 #include "FsLinkInc.h"