|
|
@@ -91,7 +91,25 @@ bool CConfigLoader::__loadExtenCfg( void )
|
|
91
|
91
|
****************************************************************/
|
|
92
|
92
|
bool CConfigLoader::__loadSipAccountCfg( void )
|
|
93
|
93
|
{
|
|
94
|
|
- IOtlRecordset* pAccountRcd = IOtlConnection::getInstance()->QueryRecords(_T("SELECT id, account, auth_account, password, proxy_addr, proxy_port, reg, reg_interval, IsDynamicGw FROM conf_sip_account ORDER BY id ASC"));
|
|
|
94
|
+ long Count=IOtlConnection::getInstance()->GetSingleDataInt(_T("select count(*) from information_schema.columns where table_name = 'conf_sip_account' and column_name = 'IsDynamicGw'"));
|
|
|
95
|
+ IOtlRecordset* pAccountRcd = NULL;
|
|
|
96
|
+ BOOL bAddOk = FALSE;
|
|
|
97
|
+ if (Count == 1)
|
|
|
98
|
+ {
|
|
|
99
|
+ pAccountRcd = IOtlConnection::getInstance()->QueryRecords(_T("SELECT id, account, auth_account, password, proxy_addr, proxy_port, reg, reg_interval, IsDynamicGw FROM conf_sip_account ORDER BY id ASC"));
|
|
|
100
|
+ }
|
|
|
101
|
+ else if (Count == 0)
|
|
|
102
|
+ {
|
|
|
103
|
+ bAddOk = IOtlConnection::getInstance()->ExecCommand(_T("ALTER TABLE conf_sip_account ADD IsDynamicGw VARCHAR (10) NOT NULL DEFAULT 'false'"));
|
|
|
104
|
+ if (bAddOk == TRUE)
|
|
|
105
|
+ {
|
|
|
106
|
+ pAccountRcd = IOtlConnection::getInstance()->QueryRecords(_T("SELECT id, account, auth_account, password, proxy_addr, proxy_port, reg, reg_interval, IsDynamicGw FROM conf_sip_account ORDER BY id ASC"));
|
|
|
107
|
+ }
|
|
|
108
|
+ else
|
|
|
109
|
+ {
|
|
|
110
|
+ pAccountRcd = IOtlConnection::getInstance()->QueryRecords(_T("SELECT id, account, auth_account, password, proxy_addr, proxy_port, reg, reg_interval FROM conf_sip_account ORDER BY id ASC"));
|
|
|
111
|
+ }
|
|
|
112
|
+ }
|
|
95
|
113
|
if (NULL == pAccountRcd)
|
|
96
|
114
|
return false;
|
|
97
|
115
|
|
|
|
@@ -115,10 +133,17 @@ bool CConfigLoader::__loadSipAccountCfg( void )
|
|
115
|
133
|
pSipAccount->IsReg = false;
|
|
116
|
134
|
pSipAccount->RegInterval = pAccountRcd->GetValueIntByIndex(8);
|
|
117
|
135
|
|
|
118
|
|
- if (lstrcmp(_T("true"), pAccountRcd->GetValueStrByIndex(9)) == 0)
|
|
119
|
|
- pSipAccount->IsDynamicGw = true;
|
|
|
136
|
+ if (Count == 1 || bAddOk == TRUE)
|
|
|
137
|
+ {
|
|
|
138
|
+ if (lstrcmp(_T("true"), pAccountRcd->GetValueStrByIndex(9)) == 0)
|
|
|
139
|
+ pSipAccount->IsDynamicGw = true;
|
|
|
140
|
+ else
|
|
|
141
|
+ pSipAccount->IsDynamicGw = false;
|
|
|
142
|
+ }
|
|
120
|
143
|
else
|
|
|
144
|
+ {
|
|
121
|
145
|
pSipAccount->IsDynamicGw = false;
|
|
|
146
|
+ }
|
|
122
|
147
|
|
|
123
|
148
|
Config.m_SipAccount.AddTail(pSipAccount);
|
|
124
|
149
|
} // end while
|