Ver Código Fonte

acd添加12345项目的大屏展示数据,FirstStep修改宏为自动判断数据库类型,FsLink修改三方通话外呼到手机号,网页外呼指定ip话机音频编码

baiwenju 5 anos atrás
pai
commit
3c676d0406

+ 4 - 0
ACD/ACD.vcxproj

@@ -131,6 +131,8 @@
131 131
     <ClInclude Include="AgentGroup.h" />
132 132
     <ClInclude Include="AgentOffice.h" />
133 133
     <ClInclude Include="Config.h" />
134
+    <ClInclude Include="SItemAgenStateDuration.h" />
135
+    <ClInclude Include="SItemAgenStateTimeDetail.h" />
134 136
     <ClInclude Include="StrategyLoopByAgentId.h" />
135 137
     <ClInclude Include="Exten.h" />
136 138
     <ClInclude Include="ExtenCtrl.h" />
@@ -181,6 +183,8 @@
181 183
     <ClCompile Include="AgentGroup.cpp" />
182 184
     <ClCompile Include="AgentOffice.cpp" />
183 185
     <ClCompile Include="Config.cpp" />
186
+    <ClCompile Include="SItemAgenStateDuration.cpp" />
187
+    <ClCompile Include="SItemAgenStateTimeDetail.cpp" />
184 188
     <ClCompile Include="StrategyLoopByAgentId.cpp" />
185 189
     <ClCompile Include="Exten.cpp" />
186 190
     <ClCompile Include="ExtenCtrl.cpp" />

+ 12 - 0
ACD/ACD.vcxproj.filters

@@ -224,6 +224,12 @@
224 224
     <ClInclude Include="StrategyLoopByAgentId.h">
225 225
       <Filter>BLL\Strategy</Filter>
226 226
     </ClInclude>
227
+    <ClInclude Include="SItemAgenStateDuration.h">
228
+      <Filter>BLL\Statistics</Filter>
229
+    </ClInclude>
230
+    <ClInclude Include="SItemAgenStateTimeDetail.h">
231
+      <Filter>BLL\Statistics</Filter>
232
+    </ClInclude>
227 233
   </ItemGroup>
228 234
   <ItemGroup>
229 235
     <ClCompile Include="stdafx.cpp">
@@ -356,6 +362,12 @@
356 362
     <ClCompile Include="StrategyLoopByAgentId.cpp">
357 363
       <Filter>BLL\Strategy</Filter>
358 364
     </ClCompile>
365
+    <ClCompile Include="SItemAgenStateDuration.cpp">
366
+      <Filter>BLL\Statistics</Filter>
367
+    </ClCompile>
368
+    <ClCompile Include="SItemAgenStateTimeDetail.cpp">
369
+      <Filter>BLL\Statistics</Filter>
370
+    </ClCompile>
359 371
   </ItemGroup>
360 372
   <ItemGroup>
361 373
     <ResourceCompile Include="ACD.rc">

+ 3 - 3
ACD/Agent.cpp

@@ -161,7 +161,7 @@ void CAgent::__reportLogin()
161 161
 	lstrcpy(repLogin.szGroup, m_GroupID);
162 162
 	lstrcpy(repLogin.szAgentIP, m_AgentIp);
163 163
 
164
-	CSLogic::GetInstance().onSEvent(m_AgentID, REP_EVENT_LOGIN, &repLogin);
164
+	CSLogic::GetInstance().onSEvent(m_AgentID, m_Exten, REP_EVENT_LOGIN, &repLogin);
165 165
 }
166 166
 
167 167
 /*****************************************************************
@@ -187,7 +187,7 @@ void CAgent::__reportLogout(const UINT HostAgent)
187 187
 	repLogout.nAnswerCount = m_AnswerCount;
188 188
 	repLogout.nReposeCount = m_ReposeCount;
189 189
 
190
-	CSLogic::GetInstance().onSEvent(m_AgentID, REP_EVENT_LOGOUT, &repLogout);
190
+	CSLogic::GetInstance().onSEvent(m_AgentID, m_Exten, REP_EVENT_LOGOUT, &repLogout);
191 191
 }
192 192
 
193 193
 /*****************************************************************
@@ -203,7 +203,7 @@ void CAgent::__onStatusUpdate(AGENT_STATE State, bool StartFlag)
203 203
 	EvtStatus.State = State;
204 204
 	EvtStatus.StartFlag = StartFlag;
205 205
 
206
-	CSLogic::GetInstance().onSEvent(m_AgentID, REP_EVENT_STATE, &EvtStatus);
206
+	CSLogic::GetInstance().onSEvent(m_AgentID, m_Exten, REP_EVENT_STATE, &EvtStatus);
207 207
 }
208 208
 
209 209
 /*****************************************************************

+ 201 - 0
ACD/SItemAgenStateDuration.cpp

@@ -0,0 +1,201 @@
1
+#include "StdAfx.h"
2
+#include "SItemAgenStateDuration.h"
3
+#include <atltime.h>
4
+
5
+CSItemAgenState::CSItemAgenState(UINT AgentId,UINT Exten, ULONG LoginId)  :m_AgentID(AgentId),m_Exten(Exten),m_LoginID(LoginId),m_CurrState(AGENT_STATE_UNKNOWN)
6
+{
7
+	
8
+}
9
+
10
+
11
+CSItemAgenState::~CSItemAgenState(void)
12
+{
13
+}
14
+
15
+
16
+void CSItemAgenState::onSEvent(REP_EVENT EvtType, PARAM Param)
17
+{
18
+	switch(EvtType)
19
+	{
20
+	case REP_EVENT_LOGIN:
21
+		__OnAgentLogin();
22
+		break;
23
+	case REP_EVENT_LOGOUT:
24
+		__OnAgentLogout();
25
+		break;
26
+	case REP_EVENT_STATE:
27
+		__OnAgentState(Param);
28
+		break;
29
+	}
30
+}
31
+
32
+
33
+void CSItemAgenState::__OnAgentLogin()
34
+{
35
+	m_CurrState = AGENT_STATE_FREE;
36
+	CString m_strLoginDate;
37
+
38
+	CTime m_time;  
39
+	m_time=CTime::GetCurrentTime();             //获取当前时间日期  
40
+	m_strLoginDate=m_time.Format(_T("%Y-%m-%d %H:%M:%S"));  
41
+
42
+
43
+
44
+
45
+	// 编写SQL语句
46
+	m_Sql.Format(_T("INSERT INTO rep_agentState_Duration (AgentId, Exten,LoginId, LoginTime,LogoutTime)VALUES\
47
+					(%d,%d, %d, '%s',NULL)"),
48
+					m_AgentID,
49
+					m_Exten,
50
+					m_LoginID,
51
+					m_strLoginDate
52
+					);
53
+
54
+	__execSQL();
55
+}
56
+
57
+void CSItemAgenState::__OnAgentLogout()
58
+{
59
+
60
+	__ProcStateEnd(m_CurrState);
61
+
62
+	CString m_strLogoutDate;
63
+
64
+	CTime m_time;    
65
+	m_time=CTime::GetCurrentTime();             //获取当前时间日期  
66
+	m_strLogoutDate=m_time.Format(_T("%Y-%m-%d %H:%M:%S"));  
67
+
68
+
69
+
70
+	m_Sql.Format(_T("UPDATE rep_agentState_Duration SET LogoutTime = '%s' WHERE AgentId = %d AND LoginId = %d"),
71
+		m_strLogoutDate,
72
+		m_AgentID,
73
+		m_LoginID
74
+		);
75
+
76
+	__execSQL();
77
+
78
+}
79
+
80
+
81
+void CSItemAgenState::__OnAgentState( PARAM Param)
82
+{
83
+	T_EvtStatus* pStatus = (T_EvtStatus*)Param;
84
+	ASSERT(pStatus != NULL);
85
+	if(pStatus == NULL)
86
+		return;
87
+	if(!pStatus->StartFlag) return;
88
+
89
+	
90
+
91
+	__ProcStateEnd(m_CurrState);
92
+	switch(pStatus->State)
93
+	{
94
+	case AGENT_STATE_FREE:
95
+		{
96
+			__ProcStateStart(AGENT_STATE_FREE);
97
+		}
98
+		break; 
99
+	case AGENT_STATE_BUSY:
100
+		{
101
+			__ProcStateStart(AGENT_STATE_BUSY);
102
+		}
103
+		break;
104
+	case AGENT_STATE_POST_PROCESSING:
105
+		{
106
+		   __ProcStateStart(AGENT_STATE_POST_PROCESSING);
107
+		}
108
+		break;
109
+	case AGENT_STATE_REPOSE:
110
+		{
111
+			__ProcStateStart(AGENT_STATE_REPOSE);
112
+			__ProcReposeCount();
113
+		}
114
+		break;
115
+	default:
116
+		break;
117
+
118
+	}
119
+
120
+	m_CurrState = pStatus->State;
121
+}
122
+
123
+void CSItemAgenState::__ProcStateStart(AGENT_STATE state)
124
+{ 
125
+	m_StartTime=CTime::GetCurrentTime();             //获取当前时间日期  
126
+}
127
+
128
+void CSItemAgenState::__ProcStateEnd(AGENT_STATE state)
129
+{
130
+	if(m_StartTime==0) return;
131
+	m_EndTime=CTime::GetCurrentTime();             //获取当前时间日期  
132
+
133
+	CTimeSpan  m_DuringTime = m_EndTime - m_StartTime;
134
+
135
+	LONGLONG durtime=  m_DuringTime.GetTotalSeconds();
136
+
137
+	__WriteToSQL(durtime,state);
138
+}
139
+
140
+void CSItemAgenState::__WriteToSQL(int second,AGENT_STATE state)
141
+{
142
+	switch(state)
143
+	{
144
+	case AGENT_STATE_FREE:
145
+		{
146
+			m_Sql.Format(_T("UPDATE rep_agentState_Duration SET Free = Free+%d WHERE AgentId = %d AND LoginId = %d"),
147
+				second,
148
+				m_AgentID,
149
+				m_LoginID
150
+				);
151
+
152
+		}
153
+		break; 
154
+	case AGENT_STATE_BUSY:
155
+		{
156
+			m_Sql.Format(_T("UPDATE rep_agentState_Duration SET Talking = Talking+%d WHERE AgentId = %d AND LoginId = %d"),
157
+				second,
158
+				m_AgentID,
159
+				m_LoginID
160
+				);
161
+		}
162
+		break;
163
+	case AGENT_STATE_POST_PROCESSING:
164
+		{
165
+			m_Sql.Format(_T("UPDATE rep_agentState_Duration SET PostProcess = PostProcess+%d WHERE AgentId = %d AND LoginId = %d"),
166
+				second,
167
+				m_AgentID,
168
+				m_LoginID
169
+				);
170
+		
171
+		}
172
+		break;
173
+	case AGENT_STATE_REPOSE:
174
+		{
175
+			m_Sql.Format(_T("UPDATE rep_agentState_Duration SET Repose =Repose+%d WHERE AgentId = %d AND LoginId = %d"),
176
+				second,
177
+				m_AgentID,
178
+				m_LoginID
179
+				);
180
+			
181
+		}
182
+		break;
183
+	default:
184
+		break;
185
+
186
+	}
187
+
188
+
189
+
190
+	__execSQL();
191
+}
192
+
193
+void CSItemAgenState::__ProcReposeCount()
194
+{
195
+	m_Sql.Format(_T("UPDATE rep_agentState_Duration SET ReposeConut =ReposeConut+%d WHERE AgentId = %d AND LoginId = %d"),
196
+		1,
197
+		m_AgentID,
198
+		m_LoginID
199
+		);
200
+	__execSQL();
201
+}

+ 45 - 0
ACD/SItemAgenStateDuration.h

@@ -0,0 +1,45 @@
1
+#pragma once
2
+#include "sitem.h"
3
+#include "atltime.h" 
4
+#include "TemplateTimer.h"
5
+class CSItemAgenState : public CSItem
6
+{
7
+public:
8
+	CSItemAgenState(UINT AgentId,UINT Exten, ULONG LoginId);
9
+	~CSItemAgenState(void);
10
+
11
+
12
+
13
+     void onSEvent(REP_EVENT EvtType, PARAM Param);	 // ͳ¼ÆÊ¼þ±ä»¯Í¨Öª
14
+
15
+
16
+private:
17
+
18
+	void __OnAgentLogin();
19
+	void __OnAgentLogout();
20
+	void __OnAgentState( PARAM Param);
21
+
22
+	void __ProcStateStart(AGENT_STATE state);
23
+	void __ProcStateEnd(AGENT_STATE state);
24
+
25
+	void __WriteToSQL(int second,AGENT_STATE state);
26
+
27
+	void __ProcReposeCount();
28
+
29
+
30
+private:
31
+	UINT m_AgentID;
32
+	ULONG m_LoginID;
33
+	UINT  m_Exten;
34
+
35
+
36
+
37
+	CTime m_StartTime;
38
+	CTime m_EndTime;
39
+
40
+	AGENT_STATE m_CurrState;
41
+	
42
+
43
+
44
+};
45
+

+ 130 - 0
ACD/SItemAgenStateTimeDetail.cpp

@@ -0,0 +1,130 @@
1
+#include "StdAfx.h"
2
+#include "SItemAgenStateTimeDetail.h"
3
+#include <atltime.h>
4
+
5
+CSItemAgenStateTimeDetail::CSItemAgenStateTimeDetail(UINT AgentId):m_AgentID(AgentId),m_CurrState(AGENT_STATE_UNKNOWN)
6
+{
7
+	
8
+}
9
+
10
+
11
+CSItemAgenStateTimeDetail::~CSItemAgenStateTimeDetail(void)
12
+{
13
+}
14
+
15
+
16
+void CSItemAgenStateTimeDetail::onSEvent(REP_EVENT EvtType, PARAM Param)
17
+{
18
+	switch(EvtType)
19
+	{
20
+	case REP_EVENT_LOGIN:
21
+		break;
22
+	case REP_EVENT_LOGOUT:
23
+		__OnAgentLogout();
24
+		break;
25
+	case REP_EVENT_STATE:
26
+		__OnAgentState(Param);
27
+		break;
28
+	}
29
+}
30
+
31
+
32
+void CSItemAgenStateTimeDetail::__OnAgentLogin()
33
+{
34
+	
35
+}
36
+
37
+void CSItemAgenStateTimeDetail::__OnAgentLogout()
38
+{
39
+
40
+	__ProcStateEnd(m_CurrState);
41
+
42
+}
43
+
44
+
45
+void CSItemAgenStateTimeDetail::__OnAgentState( PARAM Param)
46
+{
47
+	T_EvtStatus* pStatus = (T_EvtStatus*)Param;
48
+	ASSERT(pStatus != NULL);
49
+	if(pStatus == NULL)
50
+		return;
51
+	if(!pStatus->StartFlag) return;
52
+
53
+	
54
+
55
+	__ProcStateEnd(m_CurrState);
56
+	switch(pStatus->State)
57
+	{
58
+	case AGENT_STATE_FREE:
59
+		{
60
+			__ProcStateStart(AGENT_STATE_FREE);
61
+		}
62
+		break; 
63
+	case AGENT_STATE_BUSY:
64
+		{
65
+			__ProcStateStart(AGENT_STATE_BUSY);
66
+		}
67
+		break;
68
+	case AGENT_STATE_POST_PROCESSING:
69
+		{
70
+		   __ProcStateStart(AGENT_STATE_POST_PROCESSING);
71
+		}
72
+		break;
73
+	case AGENT_STATE_REPOSE:
74
+		{
75
+			__ProcStateStart(AGENT_STATE_REPOSE);
76
+	
77
+		}
78
+		break;
79
+	default:
80
+		break;
81
+
82
+	}
83
+
84
+	m_CurrState = pStatus->State;
85
+}
86
+
87
+void CSItemAgenStateTimeDetail::__ProcStateStart(AGENT_STATE state)
88
+{ 
89
+
90
+	CTime m_time;  
91
+	m_time=CTime::GetCurrentTime();             //获取当前时间日期  
92
+	m_StartTime=m_time.Format(_T("%Y-%m-%d %H:%M:%S"));  
93
+
94
+
95
+	CString strDate;
96
+	strDate = m_time.Format("%Y%m%d");
97
+	m_LoginDate = atoi(strDate);
98
+
99
+
100
+	// 编写SQL语句
101
+	m_Sql.Format(_T("INSERT INTO rep_agentState_Detail (AgentId,LoginDate,Type,TimeStart)VALUES\
102
+					(%d, %d, %d, '%s')"),
103
+					m_AgentID,
104
+					m_LoginDate,
105
+					state,
106
+					m_StartTime
107
+					);
108
+
109
+	__execSQL();
110
+}
111
+
112
+void CSItemAgenStateTimeDetail::__ProcStateEnd(AGENT_STATE state)
113
+{
114
+
115
+	CTime m_time;  
116
+	m_time=CTime::GetCurrentTime();             //获取当前时间日期  
117
+	m_EndTime=m_time.Format(_T("%Y-%m-%d %H:%M:%S"));  
118
+
119
+	// 编写SQL语句
120
+
121
+	m_Sql.Format(_T("UPDATE rep_agentState_Detail SET TimeEnd = '%s' WHERE AgentId = %d AND LoginDate = %d AND TimeStart='%s'"),
122
+		m_EndTime,
123
+		m_AgentID,
124
+		m_LoginDate,
125
+		m_StartTime
126
+		);
127
+
128
+	__execSQL();
129
+}
130
+

+ 40 - 0
ACD/SItemAgenStateTimeDetail.h

@@ -0,0 +1,40 @@
1
+#pragma once
2
+#include "sitem.h"
3
+#include "atltime.h" 
4
+#include "TemplateTimer.h"
5
+class CSItemAgenStateTimeDetail : public CSItem
6
+{
7
+public:
8
+	CSItemAgenStateTimeDetail(UINT AgentId);
9
+	~CSItemAgenStateTimeDetail(void);
10
+
11
+
12
+
13
+     void onSEvent(REP_EVENT EvtType, PARAM Param);	 // ͳ¼ÆÊ¼þ±ä»¯Í¨Öª
14
+
15
+
16
+private:
17
+
18
+	void __OnAgentLogin();
19
+	void __OnAgentLogout();
20
+	void __OnAgentState( PARAM Param);
21
+
22
+	void __ProcStateStart(AGENT_STATE state);
23
+	void __ProcStateEnd(AGENT_STATE state);
24
+
25
+
26
+
27
+private:
28
+	UINT m_AgentID;
29
+
30
+
31
+	int     m_LoginDate;
32
+	CString m_StartTime;
33
+	CString m_EndTime;
34
+
35
+	AGENT_STATE m_CurrState;
36
+	
37
+
38
+
39
+};
40
+

+ 76 - 8
ACD/SLogic.cpp

@@ -2,6 +2,8 @@
2 2
 #include "SLogic.h"
3 3
 #include "SItemAgentDetail.h"
4 4
 #include "SItemAgentStatus.h"
5
+#include "SItemAgenStateDuration.h"
6
+#include "SItemAgenStateTimeDetail.h"
5 7
 
6 8
 SINGLETON_IMPLEMENT(CSLogic)
7 9
 
@@ -22,12 +24,34 @@ CSLogic::~CSLogic(void)
22 24
 ****************************************************************/
23 25
 ULONG CSLogic::__getAgentLoginId( UINT AgentId )
24 26
 {
27
+	//CString SQL;
28
+	//SQL.Format("SELECT LoginId FROM rep_agent_detail where AgentId = %d ORDER BY LoginId DESC", AgentId);
29
+	//ULONG LoginID = IOtlConnection::getInstance()->GetSingleDataInt(SQL);
30
+	//return ++LoginID;
31
+
32
+	// 20201211 合并12345功能
25 33
 	CString SQL;
34
+	ULONG LoginID = 0;
35
+
36
+	CTime m_time;
37
+	m_time = CTime::GetCurrentTime();             //获取当前时间日期  
38
+	CString str = m_time.Format(_T("%Y%m%d"));
39
+	int Timeid = atoi(str.GetBuffer(0));
40
+
41
+	SQL.Format("SELECT LoginId FROM rep_agentState_Duration where AgentId = %d ORDER BY LoginId DESC", AgentId);
42
+	LoginID = IOtlConnection::getInstance()->GetSingleDataInt(SQL);
26 43
 
27
-	SQL.Format("SELECT LoginId FROM rep_agent_detail where AgentId = %d ORDER BY LoginId DESC", AgentId);
28
-	ULONG LoginID = IOtlConnection::getInstance()->GetSingleDataInt(SQL);
44
+	ULONG  LoninIDTime = LoginID / 100;
45
+
46
+	if (LoginID == 0 || LoginID > 2917092801 || LoninIDTime < Timeid)
47
+	{
48
+		long lognid = Timeid * 100 + 1;
49
+
50
+		return lognid;
51
+	}
29 52
 
30 53
 	return ++LoginID;
54
+
31 55
 }
32 56
 
33 57
 /*****************************************************************
@@ -48,6 +72,25 @@ void CSLogic::__onAgentLogin( UINT AgentId )
48 72
 	m_ItemMap.insert(pair<UINT, CSItem*>(AgentId, pItemStatus));
49 73
 }
50 74
 
75
+void CSLogic::__onAgentLogin(UINT AgentId, UINT Exten)
76
+{
77
+	// 获取当前坐席的签入ID
78
+	ULONG LoginID = __getAgentLoginId(AgentId);
79
+
80
+	CSItem* pItemDetail = new CSItemAgentDetail(AgentId, LoginID);
81
+	m_ItemMap.insert(pair<UINT, CSItem*>(AgentId, pItemDetail));
82
+
83
+	CSItem* pItemStatus = new CSItemAgentStatus(AgentId, LoginID);
84
+	m_ItemMap.insert(pair<UINT, CSItem*>(AgentId, pItemStatus));
85
+
86
+	CSItem* pItemState = new CSItemAgenState(AgentId, Exten, LoginID);
87
+	m_ItemMap.insert(pair<UINT, CSItem*>(AgentId, pItemState));
88
+
89
+
90
+	CSItem* pItemStateTimeDetail = new CSItemAgenStateTimeDetail(AgentId);
91
+	m_ItemMap.insert(pair<UINT, CSItem*>(AgentId, pItemStateTimeDetail));
92
+}
93
+
51 94
 /*****************************************************************
52 95
 **【函数名称】	__onAgentLogout
53 96
 **【函数功能】	坐席签出处理
@@ -84,27 +127,52 @@ void CSLogic::__onAgentLogout( UINT AgentId )
84 127
 				Param: 参数
85 128
 **【返回值】	
86 129
 ****************************************************************/
87
-void CSLogic::onSEvent( UINT AgentId, REP_EVENT EvtType, PARAM Param )
130
+//void CSLogic::onSEvent( UINT AgentId, REP_EVENT EvtType, PARAM Param )
131
+//{
132
+//	// 坐席签入处理
133
+//	if(EvtType == REP_EVENT_LOGIN) 
134
+//		__onAgentLogin(AgentId);
135
+//
136
+//	SItemMap::iterator itr;
137
+//	SItemMap::iterator itrEnd;
138
+//
139
+//	itr = m_ItemMap.find(AgentId);
140
+//	if(itr == m_ItemMap.end())
141
+//		return;
142
+//
143
+//	itrEnd = m_ItemMap.upper_bound(AgentId);
144
+//	// 事件消息群发
145
+//	for(; itr != itrEnd; ++itr)
146
+//	{
147
+//		itr->second->onSEvent(EvtType, Param);
148
+//	}
149
+//
150
+//	// 坐席签出处理
151
+//	if(EvtType == REP_EVENT_LOGOUT) 
152
+//		__onAgentLogout(AgentId);
153
+//}
154
+
155
+void CSLogic::onSEvent(UINT AgentId, UINT Exten, REP_EVENT EvtType, PARAM Param)
88 156
 {
89 157
 	// 坐席签入处理
90
-	if(EvtType == REP_EVENT_LOGIN) 
91
-		__onAgentLogin(AgentId);
158
+	if (EvtType == REP_EVENT_LOGIN)
159
+		__onAgentLogin(AgentId, Exten);
92 160
 
93 161
 	SItemMap::iterator itr;
94 162
 	SItemMap::iterator itrEnd;
95 163
 
96 164
 	itr = m_ItemMap.find(AgentId);
97
-	if(itr == m_ItemMap.end())
165
+	if (itr == m_ItemMap.end())
98 166
 		return;
99 167
 
100 168
 	itrEnd = m_ItemMap.upper_bound(AgentId);
101 169
 	// 事件消息群发
102
-	for(; itr != itrEnd; ++itr)
170
+	for (; itr != itrEnd; ++itr)
103 171
 	{
104 172
 		itr->second->onSEvent(EvtType, Param);
105 173
 	}
106 174
 
107 175
 	// 坐席签出处理
108
-	if(EvtType == REP_EVENT_LOGOUT) 
176
+	if (EvtType == REP_EVENT_LOGOUT)
109 177
 		__onAgentLogout(AgentId);
110 178
 }

+ 5 - 2
ACD/SLogic.h

@@ -30,13 +30,16 @@ class CSLogic
30 30
 public:	
31 31
 	~CSLogic(void);
32 32
 
33
-	void onSEvent(UINT AgentId, REP_EVENT EvtType, PARAM Param);	 // 统计事件变化通知
34
-
33
+	//void onSEvent(UINT AgentId, REP_EVENT EvtType, PARAM Param);	 // 统计事件变化通知
34
+	// 20201211合并12345项目
35
+	void onSEvent(UINT AgentId, UINT Exten, REP_EVENT EvtType, PARAM Param);	 // 统计事件变化通知
35 36
 private:
36 37
 	CSLogic(void);
37 38
 
38 39
 	ULONG __getAgentLoginId(UINT AgentId);
39 40
 	void __onAgentLogin(UINT AgentId);
41
+	// 20201211合并12345项目
42
+	void __onAgentLogin(UINT AgentId, UINT Exten);
40 43
 	void __onAgentLogout(UINT AgentId);
41 44
 
42 45
 private:

+ 3 - 3
FirstStep/ConfigLoader.cpp

@@ -92,11 +92,11 @@ bool CConfigLoader::__loadExtenCfg( void )
92 92
 bool CConfigLoader::__loadSipAccountCfg( void )
93 93
 {
94 94
 	long Count = 0;
95
-#ifdef DSN_ORACLE
95
+	if (DB_MySQL == IOtlConnection::getInstance()->GetDatabaseType() || DB_Oracle == IOtlConnection::getInstance()->GetDatabaseType())
96 96
 	Count = IOtlConnection::getInstance()->GetSingleDataInt(_T("SELECT COUNT(*)  FROM USER_TAB_COLUMNS WHERE TABLE_NAME = 'CONF_SIP_ACCOUNT' AND COLUMN_NAME ='ISDYNAMICGW'"));
97
-#else 
97
+	else if (DB_SQLServer == IOtlConnection::getInstance()->GetDatabaseType())
98 98
 	Count = IOtlConnection::getInstance()->GetSingleDataInt(_T("select count(*) from information_schema.columns where table_name = 'conf_sip_account' and column_name = 'IsDynamicGw'"));
99
-#endif
99
+ 
100 100
 	IOtlRecordset* pAccountRcd = NULL;
101 101
 	BOOL bAddOk = FALSE;
102 102
 	if (Count == 1)

+ 0 - 1
FirstStep/stdafx.h

@@ -26,7 +26,6 @@
26 26
 
27 27
 #include <afxdisp.h>        // MFC ×Ô¶¯»¯Àà
28 28
 
29
-#define DSN_ORACLE         // Á¬½ÓoracleÊý¾Ý¿â
30 29
 
31 30
 
32 31
 #ifndef _AFX_NO_OLE_SUPPORT

+ 23 - 3
FsLink/EslGateway.cpp

@@ -314,9 +314,29 @@ void CEslGateway::__onEslEvtChanEvent( esl_event_t* pEvent )
314 314
 	ASSERT(HeaderValue != NULL);
315 315
 	lstrcpy(Notify.ChanId, HeaderValue);
316 316
 
317
-	// 获取主被叫
318
-	HeaderValue = esl_event_get_header(pEvent, ESL_HEADER_CALLER);
319
-	lstrcpy(Notify.Caller, HeaderValue);
317
+	try
318
+	{
319
+		LOGGER(LOG_LEVEL_NORMAL, _T("{CEslGateway}: 获取主叫 start"));
320
+		// 自定义主叫,如果自定义主叫不为空,使用自定义主叫(分机呼叫修改)
321
+		HeaderValue = esl_event_get_header(pEvent, ESL_HEADER_CHAN_OP_CALLER);
322
+		if (HeaderValue != NULL)
323
+		{
324
+			lstrcpy(Notify.Caller, HeaderValue);
325
+		}
326
+		else
327
+		{
328
+			// 获取主被叫
329
+			HeaderValue = esl_event_get_header(pEvent, ESL_HEADER_CALLER);
330
+			lstrcpy(Notify.Caller, HeaderValue);
331
+		}
332
+		LOGGER(LOG_LEVEL_NORMAL, _T("{CEslGateway}: 获取主叫 end"));
333
+	}
334
+	catch (const std::exception& e)
335
+	{
336
+		LOGGER(LOG_LEVEL_NORMAL, _T("{CEslGateway}: 获取主叫异常[%s]"),e.what());
337
+	}
338
+	
339
+
320 340
 	HeaderValue = esl_event_get_header(pEvent, ESL_HEADER_CALLEE);
321 341
 	if (HeaderValue != NULL)
322 342
 	{

+ 2 - 0
FsLink/FsLinkInc.h

@@ -77,6 +77,7 @@
77 77
 // FS变量相关
78 78
 #define ESL_VAR_OP_INSTANCE					_T("op_instance")
79 79
 #define ESL_VAR_DTMF_KEY					_T("dtmf_key")
80
+#define ESL_VAR_OP_CALLER                   _T("op_caller")       
80 81
 
81 82
 // ESL事件头域
82 83
 #define ESL_HEADER_CHAN_UNIQUE_ID			_T("Caller-Unique-ID")
@@ -96,6 +97,7 @@
96 97
 #define ESL_HEADER_CALL_FAILED_CAUSE		_T("variable_originate_disposition")
97 98
 #define ESL_HEADER_CHAN_OP_INSTANCE			_T("variable_op_instance")
98 99
 #define ESL_HEADER_DTMF						_T("DTMF-Digit")
100
+#define ESL_HEADER_CHAN_OP_CALLER           _T("variable_op_caller")    // 自定义主叫
99 101
 
100 102
 // ESL事件头域常量值
101 103
 #define ESL_HDR_DIRECTION_INBOUND			_T("inbound")

+ 26 - 3
FsLink/FsProxy.cpp

@@ -681,9 +681,26 @@ 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,absolute_codec_string='PCMA,PCMU'}user/%lu %s XML %s\r\n%s: %ld"),
685
-		pChan->no(), pChan->no(), CalleeNum, CConfig::extContext(), ESL_HEADER_JOB_UUID, JobId);
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
+	//	pChan->no(), pChan->no(), CalleeNum, CConfig::extContext(), ESL_HEADER_JOB_UUID, JobId);
686 686
 
687
+	try
688
+	{
689
+		LOGGER(LOG_LEVEL_NORMAL, _T("{CFsProxy}: ExtenCall start"));
690
+		CString CallString;
691
+		CString  Caller, Called;
692
+		Called = CalleeNum;
693
+		if (!m_CallStringMaker.makeCallStringWithDefault(Caller, Called, CallString))
694
+			return false;
695
+		EslCmd.Format(_T("bgapi originate {origination_caller_id_number=%s,%s=%lu,absolute_codec_string='PCMA,PCMU'}user/%lu %s XML %s\r\n%s: %ld"),
696
+			Called, ESL_VAR_OP_CALLER, pChan->no(), pChan->no(), CalleeNum, CConfig::extContext(), ESL_HEADER_JOB_UUID, JobId);
697
+		LOGGER(LOG_LEVEL_NORMAL, _T("{CFsProxy}: ExtenCall end"));
698
+	}
699
+	catch (const std::exception& e)
700
+	{
701
+		LOGGER(LOG_LEVEL_NORMAL, _T("{CFsProxy}: ExtenCall 异常[%s]"), e.what());
702
+	}
703
+	
687 704
 	return m_Gateway.sendCmd(EslCmd);
688 705
 }
689 706
 
@@ -820,8 +837,8 @@ std::string CFsProxy::EslCommand(std::string strFsIp, int FsPort, std::string st
820 837
 ****************************************************************/
821 838
 bool CFsProxy::meeting(LONG JobId, CString CallerNum, CString DestNum, LPCTSTR MeetingId)
822 839
 {
840
+	/*
823 841
 	bool bMatchPrefix = m_CallStringMaker.isMatchPrefix(DestNum);
824
-
825 842
 	TRUNK_MATCH* pMatch = NULL;
826 843
 	CString CallString;
827 844
 	if (!m_CallStringMaker.makeCallString(CallerNum, DestNum, CallString, pMatch))
@@ -847,6 +864,12 @@ bool CFsProxy::meeting(LONG JobId, CString CallerNum, CString DestNum, LPCTSTR M
847 864
 			}
848 865
 		}
849 866
 	}
867
+	*/
868
+
869
+	CString CallString;
870
+	if (!m_CallStringMaker.makeCallString(CallerNum, DestNum, CallString))
871
+		return false;
872
+	
850 873
 	LOGGER(LOG_LEVEL_NORMAL, _T("{FsProxy}: 三方会议呼叫字符串: %s"), CallString);
851 874
 
852 875
 	CString EslCmd;

+ 1 - 1
FsLink/VirtualChan.cpp

@@ -47,7 +47,7 @@ void CVirtualChan::_setSession( LPCTSTR SessionId, LPCTSTR ChanId )
47 47
 ****************************************************************/
48 48
 void CVirtualChan::_reset( void )
49 49
 {
50
-	LOGGER(LOG_LEVEL_NORMAL, _T("{CVirtualChan}: 执行线路[%lu]重置",m_No));
50
+	LOGGER(LOG_LEVEL_NORMAL, _T("{CVirtualChan}: 执行线路[%lu]重置"), m_No);
51 51
 	m_State = CHAN_LOGIC_STATE_FREE;
52 52
 	m_IsInMeeting = false;
53 53
 	m_CalleeNum = _T("");