ConnectorFSM.h 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937
  1. #pragma once
  2. #include "SpHelper.h"
  3. #include "SpFSM.h"
  4. #include "SpIni.h"
  5. #include "IHttpFunc.h"
  6. #include "Event.h"
  7. #include "../include/EventCode.h"
  8. #ifdef _WIN32
  9. #include "resource.h"
  10. #else
  11. #include "uuid/uuid.h"
  12. #endif
  13. #include "http_callrouter.h"
  14. #include "../mod_assistantchannel/VideoDesc.h"
  15. #include "../mod_sipphone/SIPPhone_client_g.h"
  16. using namespace SIPPhone;
  17. #include "../mod_assistantchannel/AssistantChannel_client_g.h"
  18. using namespace AssistantChannel;
  19. #include "../mod_mediacontroller/MediaController_client_g.h"
  20. using namespace MediaController;
  21. #include "../mod_assistantchannel/chan_protocol.h"
  22. #include "CallType.h"
  23. #include "CounterConnector_def_g.h"
  24. #include "CounterConnector_msg_g.h"
  25. using namespace CounterConnector;
  26. #include "../mod_interactioncontext/InteractionContext_client_g.h"
  27. #include "../mod_interactioncontext/InteractionContext_def_g.h"
  28. using namespace InteractionContext;
  29. #include <vector>
  30. #include <string>
  31. #ifndef RVC_DEFAULT_HTTPTIMEOUT
  32. #define RVC_DEFAULT_HTTPTIMEOUT 10
  33. #endif // !RVC_DEFAULT_HTTPTIMEOUT
  34. #define USER_EVT_PICKUP_CALL EVT_USER+1
  35. #define USER_EVT_HANDFREE_CALL EVT_USER+2
  36. #define USER_EVT_HANGUP EVT_USER+3
  37. #define USER_EVT_COMMAND_CALL EVT_USER+4
  38. #define USER_EVT_DOUBLE_RECORD_CALL EVT_USER+5
  39. #define USER_EVT_JMP_FAIL EVT_USER+11
  40. #define USER_EVT_JMP_HANDFREE EVT_USER+12
  41. #define USER_EVT_JMP_PICKUP EVT_USER+13
  42. #define USER_EVT_TO_HANDFREE EVT_USER+14
  43. #define USER_EVT_TO_PICKUP EVT_USER+15
  44. #define USER_EVT_SIP_STATE_CONNECTED EVT_USER+21
  45. #define USER_EVT_SIP_STATE_IDLE EVT_USER+22
  46. #define USER_EVT_CHAN_STATE_CONNECTED EVT_USER+31
  47. #define USER_EVT_CHAN_STATE_IDLE EVT_USER+33
  48. #define USER_EVT_RECONNECT EVT_USER+40
  49. #define USER_EVT_AGENT_WRITABLE EVT_USER+41
  50. #define USER_EVT_ERROR EVT_USER+10
  51. #define USER_EVT_EXIT EVT_USER+50
  52. #define USER_EVT_STOP_RECORD_BROADCAST EVT_USER+55
  53. #define USER_EVT_ASSISTCHAN_IDEL EVT_USER+60
  54. #define USER_EVT_SIPPHONE_IDEL EVT_USER+61
  55. #define USER_EVT_STARTVIDEODISPLAY EVT_USER+70
  56. #define USER_EVT_STOPVIDEODISPLAY EVT_USER+71
  57. #define USER_EVT_SHOWLOACALVIDEO EVT_USER+72
  58. #define USER_EVT_STOPLOCALVIDEO EVT_USER+73
  59. #define USER_EVT_SHOWLOACALREMOTEVIDEO EVT_USER+74
  60. #define USER_EVT_STOPLOACALREMOTEVIDEO EVT_USER+75
  61. enum CurServerNum
  62. {
  63. Error_Server = -1,
  64. MAIN_SERVER,
  65. BACK_SERVER
  66. };
  67. #ifndef MAX_VOIP_SERVER_NUM
  68. #define MAX_VOIP_SERVER_NUM 10
  69. #endif
  70. struct ChanStateConnectedEvent : public FSMEvent
  71. {
  72. ChanStateConnectedEvent(const char *param) : FSMEvent(USER_EVT_CHAN_STATE_CONNECTED), m_param(param) {}
  73. CSimpleStringA m_param;
  74. };
  75. struct StartVideoDisplayEvent : public FSMEvent
  76. {
  77. StartVideoDisplayEvent(const char *param) : FSMEvent(USER_EVT_STARTVIDEODISPLAY), m_param(param) {}
  78. CSimpleStringA m_param;
  79. };
  80. struct ShowLocalVideoEvent : public FSMEvent
  81. {
  82. ShowLocalVideoEvent(const char *param) : FSMEvent(USER_EVT_SHOWLOACALVIDEO), m_param(param) {}
  83. CSimpleStringA m_param;
  84. };
  85. struct ShowLocalAndRemoteVideoEvent : public FSMEvent
  86. {
  87. ShowLocalAndRemoteVideoEvent(const char *param) : FSMEvent(USER_EVT_SHOWLOACALREMOTEVIDEO), m_param(param) {}
  88. CSimpleStringA m_param;
  89. };
  90. struct CallingParam
  91. {
  92. //呼叫模式,0:可视柜台正常呼叫,1:PAD主动外呼,2:PAD被动呼叫,来源PAD,3:PAD被动呼叫,来源手机端,4:双录连线
  93. CallingTypeEnum nCallType;
  94. //<!--会场ession,用于手机与PAD,或者pad与pad交互的会场号-->
  95. CSimpleStringA connect_session;
  96. CSimpleStringA connect_ip;
  97. int connect_port;
  98. CSimpleStringA subid;
  99. int assistant_port;
  100. };
  101. //<!--会话相关参数,用于主动拒接的场景 -->
  102. struct SessionParam
  103. {
  104. CSimpleStringA connect_session; //会话标识
  105. CSimpleStringA connect_ip; //分行网关服务器ip
  106. int event_port; //分行网关挂断事件监听端口
  107. };
  108. #ifndef MAX_LENGTH_OF_BRANCHNO
  109. #define MAX_LENGTH_OF_BRANCHNO 4
  110. #endif
  111. #ifndef MAX_LENGTH_OF_SESSIONID
  112. #define MAX_LENGTH_OF_SESSIONID 16
  113. #endif
  114. #ifndef MAX_LENGTH_OF_CONNECTIP
  115. #define MAX_LENGTH_OF_CONNECTIP 16
  116. #endif
  117. #ifndef MAX_LENGTH_OF_SUBID
  118. #define MAX_LENGTH_OF_SUBID 16
  119. #endif
  120. #ifndef SUBID_LENGTH
  121. #define SUBID_LENGTH 8
  122. #endif
  123. class ACMCallFSM : public FSMImpl<ACMCallFSM>, public IFSMStateHooker
  124. {
  125. public:
  126. enum {s0,s7,s8,s9,s10,s11,s12,s13,s14,s20,s21,s22,s23,s24,s3,s4,s50,s51,s52,s53,s60,s61,s62,s63};
  127. BEGIN_FSM_STATE(ACMCallFSM)
  128. FSM_STATE_ENTRY(s0,"Offline",s0_on_entry,s0_on_exit,s0_on_event)
  129. FSM_STATE_ENTRY(s7,"ShowLocalVideo",s7_on_entry,s7_on_exit,s7_on_event)
  130. FSM_STATE_ENTRY(s9,"Livedetect",s9_on_entry,s9_on_exit,s9_on_event)
  131. FSM_STATE_ENTRY(s8,"Delay",s8_on_entry,s8_on_exit,s8_on_event)
  132. FSM_STATE_ENTRY(s10,"Calling_Start",s10_on_entry,s10_on_exit,s10_on_event)
  133. FSM_STATE_ENTRY(s11,"Calling_SipConnect",s11_on_entry,s11_on_exit,s11_on_event)
  134. FSM_STATE_ENTRY(s12,"Calling_ChanConnect",s12_on_entry,s12_on_exit,s12_on_event)
  135. FSM_STATE_ENTRY(s13,"Calling_AllReady",s13_on_entry,s13_on_exit,s13_on_event)
  136. FSM_STATE_ENTRY(s14,"ShowLocalRemoteVideo",s14_on_entry,s14_on_exit,s14_on_event)
  137. FSM_STATE_ENTRY(s20, "ExitCall_Start",s20_on_entry,s20_on_exit,s20_on_event)
  138. FSM_STATE_ENTRY(s21, "ExitChan_Finished",s21_on_entry,s21_on_exit,s21_on_event)
  139. FSM_STATE_ENTRY(s22, "ExitSip_Finished",s22_on_entry,s22_on_exit,s22_on_event)
  140. FSM_STATE_ENTRY(s23, "ExitCall_AllFinished",s23_on_entry,s23_on_exit,s23_on_event)
  141. FSM_STATE_ENTRY(s24, "ExitCall_Delay",s24_on_entry,s24_on_exit,s24_on_event)
  142. FSM_STATE_ENTRY(s3, "HandFree",s3_on_entry,s3_on_exit,s3_on_event)
  143. FSM_STATE_ENTRY(s4, "Pickup",s4_on_entry,s4_on_exit,s4_on_event)
  144. FSM_STATE_ENTRY(s50, "Broken0",s50_on_entry,s50_on_exit,s50_on_event)
  145. FSM_STATE_ENTRY(s51, "Broken_SipFinished",s51_on_entry,s51_on_exit,s51_on_event)
  146. FSM_STATE_ENTRY(s52, "Broken_ChanFinished",s52_on_entry,s52_on_exit,s52_on_event)
  147. FSM_STATE_ENTRY(s53, "Broken_AllFinished",s53_on_entry,s53_on_exit,s53_on_event)
  148. FSM_STATE_ENTRY(s60, "Hangup_Start",s60_on_entry,s60_on_exit,s60_on_event)
  149. FSM_STATE_ENTRY(s61, "Hangup_SipFinished",s61_on_entry,s61_on_exit,s61_on_event)
  150. FSM_STATE_ENTRY(s62, "Hangup_ChanFinished",s62_on_entry,s62_on_exit,s62_on_event)
  151. FSM_STATE_ENTRY(s63, "Hangup_AllFinished",s63_on_entry,s63_on_exit,s63_on_event)
  152. END_FSM_STATE()
  153. BEGIN_FSM_RULE(ACMCallFSM,s0)
  154. FSM_RULE_ENTRY_ANY(s0, s8, USER_EVT_PICKUP_CALL)
  155. FSM_RULE_ENTRY_ANY(s0, s9, USER_EVT_STARTVIDEODISPLAY)
  156. FSM_RULE_ENTRY_ANY(s0, s7, USER_EVT_SHOWLOACALVIDEO)
  157. FSM_RULE_ENTRY_ANY(s0, s14, USER_EVT_SHOWLOACALREMOTEVIDEO)
  158. FSM_RULE_ENTRY_ANY(s7, s0, USER_EVT_STOPLOCALVIDEO)
  159. FSM_RULE_ENTRY_ANY(s9, s0, USER_EVT_STOPVIDEODISPLAY)
  160. FSM_RULE_ENTRY_ANY(s14, s0, USER_EVT_STOPLOACALREMOTEVIDEO)
  161. FSM_RULE_ENTRY_ANY(s0, FSM_STATE_EXIT, USER_EVT_EXIT)
  162. FSM_RULE_ENTRY_ANY(s0, s8, USER_EVT_HANDFREE_CALL)
  163. FSM_RULE_ENTRY_ANY(s0, s8, USER_EVT_COMMAND_CALL)
  164. FSM_RULE_ENTRY_ANY(s0, s8, USER_EVT_DOUBLE_RECORD_CALL)
  165. FSM_RULE_ENTRY_ANY(s14, s0, USER_EVT_STOP_RECORD_BROADCAST)
  166. FSM_RULE_ENTRY_ANY(s8, s11, EVT_TIMER)
  167. FSM_RULE_ENTRY_ANY(s11, s12, USER_EVT_SIP_STATE_CONNECTED)
  168. FSM_RULE_ENTRY_ANY(s11, s23, USER_EVT_JMP_FAIL)
  169. FSM_RULE_ENTRY_ANY(s11, s21, EVT_TIMER)
  170. FSM_RULE_ENTRY_ANY(s11, s23, USER_EVT_SIP_STATE_IDLE)
  171. FSM_RULE_ENTRY_ANY(s11, s21, USER_EVT_HANGUP)
  172. FSM_RULE_ENTRY_ANY(s21, s23, USER_EVT_SIP_STATE_IDLE)
  173. FSM_RULE_ENTRY_ANY(s21, s23, USER_EVT_JMP_FAIL)
  174. FSM_RULE_ENTRY_ANY(s12, s13, USER_EVT_CHAN_STATE_CONNECTED)
  175. FSM_RULE_ENTRY_ANY(s12, s21, USER_EVT_CHAN_STATE_IDLE)
  176. FSM_RULE_ENTRY_ANY(s12, s22, USER_EVT_SIP_STATE_IDLE)
  177. FSM_RULE_ENTRY_ANY(s12, s21, USER_EVT_JMP_FAIL)
  178. FSM_RULE_ENTRY_ANY(s22, s23, USER_EVT_CHAN_STATE_IDLE)
  179. FSM_RULE_ENTRY_ANY(s12, s20, USER_EVT_HANGUP)
  180. FSM_RULE_ENTRY_ANY(s20, s21, USER_EVT_CHAN_STATE_IDLE)
  181. FSM_RULE_ENTRY_ANY(s20, s22, USER_EVT_SIP_STATE_IDLE)
  182. FSM_RULE_ENTRY_ANY(s13, s3, USER_EVT_JMP_HANDFREE)
  183. FSM_RULE_ENTRY_ANY(s13, s4, USER_EVT_JMP_PICKUP)
  184. FSM_RULE_ENTRY_ANY(s23, s0, EVT_TIMER)
  185. FSM_RULE_ENTRY_ANY(s23, s24, USER_EVT_RECONNECT)
  186. FSM_RULE_ENTRY_ANY(s24, s11, EVT_TIMER)
  187. FSM_RULE_ENTRY_ANY(s3, s4, USER_EVT_TO_PICKUP)
  188. FSM_RULE_ENTRY_ANY(s3, s51, USER_EVT_SIP_STATE_IDLE)
  189. FSM_RULE_ENTRY_ANY(s3, s52, USER_EVT_CHAN_STATE_IDLE)
  190. FSM_RULE_ENTRY_ANY(s3, s60, USER_EVT_HANGUP)
  191. FSM_RULE_ENTRY_ANY(s4, s3, USER_EVT_TO_HANDFREE)
  192. FSM_RULE_ENTRY_ANY(s4, s51, USER_EVT_SIP_STATE_IDLE)
  193. FSM_RULE_ENTRY_ANY(s4, s52, USER_EVT_CHAN_STATE_IDLE)
  194. FSM_RULE_ENTRY_ANY(s4, s60, USER_EVT_HANGUP)
  195. FSM_RULE_ENTRY_ANY(s50, s51, USER_EVT_SIP_STATE_IDLE)
  196. FSM_RULE_ENTRY_ANY(s50, s52, USER_EVT_CHAN_STATE_IDLE)
  197. FSM_RULE_ENTRY_ANY(s51, s53, USER_EVT_CHAN_STATE_IDLE)
  198. FSM_RULE_ENTRY_ANY(s52, s53, USER_EVT_SIP_STATE_IDLE)
  199. FSM_RULE_ENTRY_ANY(s52, s53, USER_EVT_JMP_FAIL)
  200. FSM_RULE_ENTRY_ANY(s53, s0, EVT_TIMER)
  201. FSM_RULE_ENTRY_ANY(s60, s61, USER_EVT_SIP_STATE_IDLE)
  202. FSM_RULE_ENTRY_ANY(s60, s62, USER_EVT_CHAN_STATE_IDLE)
  203. FSM_RULE_ENTRY_ANY(s61, s63, USER_EVT_CHAN_STATE_IDLE)
  204. FSM_RULE_ENTRY_ANY(s62, s63, USER_EVT_SIP_STATE_IDLE)
  205. FSM_RULE_ENTRY_ANY(s62, s63, USER_EVT_JMP_FAIL)
  206. FSM_RULE_ENTRY_ANY(s63, s0, EVT_TIMER)
  207. //assitchannel重启后,状态跳转到Offline
  208. FSM_RULE_ENTRY_ANY(s3, s0, USER_EVT_ASSISTCHAN_IDEL)
  209. FSM_RULE_ENTRY_ANY(s4, s0, USER_EVT_ASSISTCHAN_IDEL)
  210. FSM_RULE_ENTRY_ANY(s50, s0, USER_EVT_ASSISTCHAN_IDEL)
  211. FSM_RULE_ENTRY_ANY(s51, s0, USER_EVT_ASSISTCHAN_IDEL)
  212. FSM_RULE_ENTRY_ANY(s52, s0, USER_EVT_ASSISTCHAN_IDEL)
  213. FSM_RULE_ENTRY_ANY(s53, s0, USER_EVT_ASSISTCHAN_IDEL)
  214. FSM_RULE_ENTRY_ANY(s60, s0, USER_EVT_ASSISTCHAN_IDEL)
  215. FSM_RULE_ENTRY_ANY(s61, s0, USER_EVT_ASSISTCHAN_IDEL)
  216. FSM_RULE_ENTRY_ANY(s62, s0, USER_EVT_ASSISTCHAN_IDEL)
  217. FSM_RULE_ENTRY_ANY(s63, s0, USER_EVT_ASSISTCHAN_IDEL)
  218. //sipphone重启后,所有状态跳转到Offline
  219. FSM_RULE_ENTRY_ANY(s8, s0, USER_EVT_SIPPHONE_IDEL)
  220. FSM_RULE_ENTRY_ANY(s10, s0, USER_EVT_SIPPHONE_IDEL)
  221. FSM_RULE_ENTRY_ANY(s11, s0, USER_EVT_SIPPHONE_IDEL)
  222. FSM_RULE_ENTRY_ANY(s12, s0, USER_EVT_SIPPHONE_IDEL)
  223. FSM_RULE_ENTRY_ANY(s13, s0, USER_EVT_SIPPHONE_IDEL)
  224. FSM_RULE_ENTRY_ANY(s20, s0, USER_EVT_SIPPHONE_IDEL)
  225. FSM_RULE_ENTRY_ANY(s21, s0, USER_EVT_SIPPHONE_IDEL)
  226. FSM_RULE_ENTRY_ANY(s22, s0, USER_EVT_SIPPHONE_IDEL)
  227. FSM_RULE_ENTRY_ANY(s23, s0, USER_EVT_SIPPHONE_IDEL)
  228. FSM_RULE_ENTRY_ANY(s24, s0, USER_EVT_SIPPHONE_IDEL)
  229. FSM_RULE_ENTRY_ANY(s3, s0, USER_EVT_SIPPHONE_IDEL)
  230. FSM_RULE_ENTRY_ANY(s4, s0, USER_EVT_SIPPHONE_IDEL)
  231. FSM_RULE_ENTRY_ANY(s50, s0, USER_EVT_SIPPHONE_IDEL)
  232. FSM_RULE_ENTRY_ANY(s51, s0, USER_EVT_SIPPHONE_IDEL)
  233. FSM_RULE_ENTRY_ANY(s52, s0, USER_EVT_SIPPHONE_IDEL)
  234. FSM_RULE_ENTRY_ANY(s53, s0, USER_EVT_SIPPHONE_IDEL)
  235. FSM_RULE_ENTRY_ANY(s60, s0, USER_EVT_SIPPHONE_IDEL)
  236. FSM_RULE_ENTRY_ANY(s61, s0, USER_EVT_SIPPHONE_IDEL)
  237. FSM_RULE_ENTRY_ANY(s62, s0, USER_EVT_SIPPHONE_IDEL)
  238. FSM_RULE_ENTRY_ANY(s63, s0, USER_EVT_SIPPHONE_IDEL)
  239. //sipphone重启后,所有状态跳转到Offline
  240. //分布式呼叫场景,拒接主动挂断
  241. FSM_RULE_ENTRY_ANY(s0, s60, USER_EVT_HANGUP)
  242. //分布式呼叫场景,拒接主动挂断
  243. END_FSM_RULE()
  244. ACMCallFSM();
  245. ~ACMCallFSM();
  246. virtual void OnStateTrans(int iSrcState, int iDstState);
  247. virtual ErrorCodeEnum OnInit();
  248. virtual ErrorCodeEnum OnExit();
  249. void s0_on_entry();
  250. void s0_on_exit();
  251. unsigned int s0_on_event(FSMEvent* event);
  252. void s7_on_entry();
  253. void s7_on_exit();
  254. unsigned int s7_on_event(FSMEvent* event);
  255. void s8_on_entry();
  256. void s8_on_exit();
  257. unsigned int s8_on_event(FSMEvent* event);
  258. void s9_on_entry();
  259. void s9_on_exit();
  260. unsigned int s9_on_event(FSMEvent* event);
  261. void s10_on_entry();
  262. void s10_on_exit();
  263. unsigned int s10_on_event(FSMEvent* event);
  264. void s11_on_entry();
  265. void s11_on_exit();
  266. unsigned int s11_on_event(FSMEvent* event);
  267. void s12_on_entry();
  268. void s12_on_exit();
  269. unsigned int s12_on_event(FSMEvent* event);
  270. void s13_on_entry();
  271. void s13_on_exit();
  272. unsigned int s13_on_event(FSMEvent* event);
  273. void s14_on_entry();
  274. void s14_on_exit();
  275. unsigned int s14_on_event(FSMEvent* event);
  276. void s20_on_entry();
  277. void s20_on_exit();
  278. unsigned int s20_on_event(FSMEvent* event);
  279. void s21_on_entry();
  280. void s21_on_exit();
  281. unsigned int s21_on_event(FSMEvent* event);
  282. void s22_on_entry();
  283. void s22_on_exit();
  284. unsigned int s22_on_event(FSMEvent* event);
  285. void s23_on_entry();
  286. void s23_on_exit();
  287. unsigned int s23_on_event(FSMEvent* event);
  288. void s24_on_entry();
  289. void s24_on_exit();
  290. unsigned int s24_on_event(FSMEvent* event);
  291. void s3_on_entry();
  292. void s3_on_exit();
  293. unsigned int s3_on_event(FSMEvent* event);
  294. void s4_on_entry();
  295. void s4_on_exit();
  296. unsigned int s4_on_event(FSMEvent* event);
  297. void s50_on_entry();
  298. void s50_on_exit();
  299. unsigned int s50_on_event(FSMEvent* event);
  300. void s51_on_entry();
  301. void s51_on_exit();
  302. unsigned int s51_on_event(FSMEvent* event);
  303. void s52_on_entry();
  304. void s52_on_exit();
  305. unsigned int s52_on_event(FSMEvent* event);
  306. void s53_on_entry();
  307. void s53_on_exit();
  308. unsigned int s53_on_event(FSMEvent* event);
  309. void s60_on_entry();
  310. void s60_on_exit();
  311. unsigned int s60_on_event(FSMEvent* event);
  312. void s61_on_entry();
  313. void s61_on_exit();
  314. unsigned int s61_on_event(FSMEvent* event);
  315. void s62_on_entry();
  316. void s62_on_exit();
  317. unsigned int s62_on_event(FSMEvent* event);
  318. void s63_on_entry();
  319. void s63_on_exit();
  320. unsigned int s63_on_event(FSMEvent* event);
  321. BOOL m_bHangup;
  322. //sip呼叫失败次数,连续10次SIP呼叫失败触发自检重启SIPPHONE
  323. unsigned int m_nSipErrorNum;
  324. unsigned int m_nLiveDetctionTime;
  325. BOOL ReConnectionAssistchan();
  326. BOOL ReConnectionSipphone(bool bLog = true);
  327. BOOL ReConnectionSyncService();
  328. int GetCallRouteList();
  329. ErrorCodeEnum StartVideo(const char *param)
  330. {
  331. DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Start Video");
  332. if (!m_pPhoneClient)
  333. return Error_NetBroken;
  334. PhoneService_StartVideo_Info Info;
  335. ErrorCodeEnum Error = ParseVideoDesc(param, Info.remote_ip, Info.remote_port,
  336. Info.remote_width, Info.remote_height, Info.remote_fps,
  337. Info.local_view_x, Info.local_view_y, Info.local_view_cx, Info.local_view_cy,
  338. Info.remote_view_x, Info.remote_view_y, Info.remote_view_cx, Info.remote_view_cy);
  339. Info.local_hwd_move = 0;
  340. Info.remote_hwd_move = 1;
  341. DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("start video, remote width:%d, remote height:%d, local(%d,%d,%d,%d),remote(%d,%d,%d,%d), remote_fps:%d",
  342. Info.remote_width, Info.remote_height,
  343. Info.local_view_x, Info.local_view_y, Info.local_view_cx, Info.local_view_cy,
  344. Info.remote_view_x, Info.remote_view_y, Info.remote_view_cx, Info.remote_view_cy, Info.remote_fps);
  345. if (Error == Error_Succeed) {
  346. Error = (*m_pPhoneClient)(EntityResource::getLink().upgradeLink())->StartVideo(Info);
  347. }
  348. else {
  349. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("parse video desc failed!");
  350. }
  351. return Error;
  352. }
  353. ErrorCodeEnum StopVideo()
  354. {
  355. DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Stop Video");
  356. if (!m_pPhoneClient)
  357. return Error_NetBroken;
  358. return (*m_pPhoneClient)(EntityResource::getLink().upgradeLink())->StopVideo();
  359. }
  360. ErrorCodeEnum StartVideoRender(const char* param)
  361. {
  362. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Start Record Video Render, and param is %s.", param);
  363. if (!m_pPhoneClient)
  364. return Error_NetBroken;
  365. PhoneService_StartVideoRender_Info Info;
  366. ErrorCodeEnum Error = ParseVideoRenderDesc(param,
  367. Info.local_view_x, Info.local_view_y, Info.local_view_cx, Info.local_view_cy,
  368. Info.remote_view_x, Info.remote_view_y, Info.remote_view_cx, Info.remote_view_cy);
  369. Info.local_hwd_move = 0;
  370. Info.remote_hwd_move = 1;
  371. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("start record video render,local(%d,%d,%d,%d),remote(%d,%d,%d,%d)",
  372. Info.local_view_x, Info.local_view_y, Info.local_view_cx, Info.local_view_cy,
  373. Info.remote_view_x, Info.remote_view_y, Info.remote_view_cx, Info.remote_view_cy);
  374. if (Error == Error_Succeed) {
  375. Error = (*m_pPhoneClient)(EntityResource::getLink().upgradeLink())->StartVideoRender(Info);
  376. }
  377. else {
  378. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("parse video desc failed!");
  379. }
  380. return Error;
  381. }
  382. ErrorCodeEnum StopVideoRender()
  383. {
  384. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Stop Record Video Render");
  385. if (!m_pPhoneClient)
  386. return Error_NetBroken;
  387. return (*m_pPhoneClient)(EntityResource::getLink().upgradeLink())->StopVideoRender();
  388. }
  389. ErrorCodeEnum RealSipErrorCheck()
  390. {
  391. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Sip connect Fail 6 times,RealSipErrorCheck!");
  392. if (!m_pPhoneClient)
  393. return Error_NetBroken;
  394. return (*m_pPhoneClient)(EntityResource::getLink().upgradeLink())->RealErrorCheck();
  395. }
  396. ErrorCodeEnum SetCallingType(CallingTypeEnum eType)
  397. {
  398. if (!m_pPhoneClient)
  399. return Error_NetBroken;
  400. DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("SetCallingType = %d.", eType);
  401. PhoneService_SetCallingParam_Info info;
  402. info.CallType = eType;
  403. return (*m_pPhoneClient)(EntityResource::getLink().upgradeLink())->SetCallingParam(info);
  404. }
  405. ErrorCodeEnum StopSpeakerAudioCapture()
  406. {
  407. ErrorCodeEnum rc = Error_NotImpl;
  408. MediaService_ClientBase* pMSClient = new MediaService_ClientBase(m_pEntity);
  409. if(pMSClient->Connect() != Error_Succeed)
  410. {
  411. pMSClient->SafeDelete();
  412. pMSClient = NULL;
  413. }
  414. else
  415. {
  416. DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("MSClient connected success!");
  417. rc = (*pMSClient)(EntityResource::getLink().upgradeLink())->StopSpeakerRender();
  418. DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("pMSClient StopSpeakerRender rc:0x%08x",rc);
  419. if(rc != Error_Succeed){
  420. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Stop Speaker Render failed return 0x%08x", rc);
  421. }
  422. pMSClient->GetFunction()->CloseSession();
  423. pMSClient = NULL;
  424. }
  425. return rc;
  426. }
  427. private:
  428. int TranslateState(int innerState);
  429. ErrorCodeEnum SetCallState(int state);
  430. void get_format_uuid(char* strbuffer, size_t ulen)
  431. {
  432. #ifdef RVC_OS_WIN
  433. UUID uuid;
  434. size_t uuidlen = 0;
  435. RPC_CSTR buf;
  436. UuidCreate((UUID*)&uuid);
  437. UuidToString((UUID*)&uuid, &buf);
  438. uuidlen = strlen((const char*)buf);
  439. if (uuidlen < ulen) {
  440. memcpy(strbuffer, (const char*)buf, uuidlen);
  441. }
  442. RpcStringFree(&buf);
  443. #else
  444. uuid_t uuid;
  445. uuid_generate(uuid);
  446. uuid_unparse(uuid, strbuffer);
  447. #endif
  448. }
  449. ErrorCodeEnum GetLocalIP(char *buff, size_t ulen)
  450. {
  451. #if defined(RVC_OS_WIN)
  452. char tmp[MAX_PATH] = { 0 };
  453. gethostname(tmp, sizeof(tmp));
  454. hostent* ent = gethostbyname(tmp);
  455. if (ent) {
  456. int icount = 0;
  457. for (; ent->h_addr_list[icount]; ) {
  458. ++icount;
  459. }
  460. m_iNetAdapterNum = icount;
  461. for (int i = 0; ent->h_addr_list[i]; ++i) {
  462. if (ent->h_addrtype == AF_INET) {
  463. struct in_addr* in = (struct in_addr*)ent->h_addr_list[i];
  464. char* p = inet_ntoa(*in);
  465. if (p[0] != '0') {
  466. if (strstr(p, "198.168.") == NULL && 0 != strncmp(p, "2.0.0.1", strlen("2.0.0.1"))) {
  467. strcpy(buff, p);
  468. DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("local ip == %s", buff);
  469. return Error_Succeed;
  470. }
  471. }
  472. }
  473. }
  474. }
  475. return Error_Unexpect;
  476. #else
  477. ErrorCodeEnum error = Error_Unexpect;
  478. int sockfd = -1;
  479. struct ifconf ifconf;
  480. struct ifreq* ifreq = NULL;
  481. char strbuf[256] = { 0 };
  482. ifconf.ifc_len = 256;
  483. ifconf.ifc_buf = strbuf;
  484. if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
  485. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("socket error");
  486. return error;
  487. }
  488. ioctl(sockfd, SIOCGIFCONF, &ifconf); //get all socket info
  489. ifreq = (struct ifreq*)ifconf.ifc_buf;
  490. for (int i = (ifconf.ifc_len / sizeof(struct ifreq)); i > 0; i--) {
  491. if (ifreq->ifr_flags == AF_INET) { //for ipv4
  492. char* strIP = inet_ntoa(((struct sockaddr_in*)&(ifreq->ifr_addr))->sin_addr);
  493. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("name = %s, local addr = %s", ifreq->ifr_name, strIP);
  494. ifreq++;
  495. if (NULL != strIP) {
  496. if (NULL == strstr(strIP, "198.168.") && NULL == strstr(strIP, "127.0.0.1")) {
  497. strcpy(buff, strIP);
  498. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("local ip == %s", buff);
  499. error = Error_Succeed;
  500. break;
  501. }
  502. }
  503. }
  504. }
  505. close(sockfd);
  506. return error;
  507. #endif //RVC_OS_WIN
  508. }
  509. ErrorCodeEnum MakeCall(const char *hint_callnum,int nSipServer)
  510. {
  511. if (!m_pPhoneClient) {
  512. return Error_NetBroken;
  513. }
  514. if((m_strSIPCallNum[nSipServer]=="")&&(m_strSIPProxyIP[nSipServer]=="")&&(m_iSIPProxyPort[nSipServer]==0)){
  515. return Error_Param;
  516. }
  517. CSimpleStringA strCode;
  518. PhoneService_MakeCall_Req Req;
  519. PhoneService_MakeCall_Ans Ans;
  520. Req.to_uri = MakeCallUri(hint_callnum,nSipServer);
  521. PhoneService_SetCallingParam_Info info;
  522. info.CallType = NORMAL_CALLTYPE;
  523. if (DOUBLERECORD_CALLTYPE == m_CallingParam.nCallType){
  524. info.CallType = DOUBLERECORD_CALLTYPE;
  525. }
  526. (*m_pPhoneClient)(EntityResource::getLink().upgradeLink())->SetCallingParam(info);
  527. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("before make call, call type is %d, to_uri:%s", info.CallType, Req.to_uri.GetData());
  528. ErrorCodeEnum Error = (*m_pPhoneClient)(EntityResource::getLink().upgradeLink())->MakeCall(Req, Ans, 10000);
  529. return Error;
  530. }
  531. ErrorCodeEnum MakeCall(const char *to_uri, const char *from_uri, const char *call_id, CallingParam callingparam)
  532. {
  533. if (!m_pPhoneClient){
  534. return Error_NetBroken;
  535. }
  536. CSimpleStringA strCode;
  537. PhoneService_MakeCall_Req Req;
  538. PhoneService_MakeCall_Ans Ans;
  539. Req.to_uri = to_uri;
  540. Req.from_uri = from_uri;
  541. Req.call_id = call_id;
  542. //设置呼叫参数
  543. PhoneService_SetCallingParam_Info info;
  544. info.CallType = callingparam.nCallType;
  545. info.connect_session = callingparam.connect_session;
  546. info.connect_ip = callingparam.connect_ip;
  547. info.connect_port = callingparam.connect_port;
  548. (*m_pPhoneClient)(EntityResource::getLink().upgradeLink())->SetCallingParam(info);
  549. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("before make call, call type is %d, to_uri:%s, from_uri:%s, call_id:%s", info.CallType, to_uri, from_uri, call_id);
  550. ErrorCodeEnum Error = (*m_pPhoneClient)(EntityResource::getLink().upgradeLink())->MakeCall(Req, Ans, 10000);
  551. return Error;
  552. }
  553. ErrorCodeEnum HangupCall()
  554. {
  555. DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Hangup Call!");
  556. if (!m_pPhoneClient) {
  557. return Error_NetBroken;
  558. }
  559. PhoneService_HangupCall_Req Req;
  560. PhoneService_HangupCall_Ans Ans;
  561. if (!m_SessionParam.connect_session.IsNullOrEmpty()){
  562. Req.session_num = m_SessionParam.connect_session;
  563. DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Hangup Call connect_session = %s", m_SessionParam.connect_session.GetData());
  564. }
  565. if (!m_SessionParam.connect_ip.IsNullOrEmpty()){
  566. Req.branch_server_ip = m_SessionParam.connect_ip;
  567. DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Hangup Call connect_ip = %s", m_SessionParam.connect_ip.GetData());
  568. }
  569. if (m_SessionParam.event_port){
  570. Req.branch_server_port = m_SessionParam.event_port;
  571. }
  572. return (*m_pPhoneClient)(EntityResource::getLink().upgradeLink())->HangupCall(Req, Ans, 10000);
  573. }
  574. ErrorCodeEnum ReleaseCall(int type)
  575. {
  576. if (!m_pPhoneClient)
  577. return Error_NetBroken;
  578. PhoneService_ReleaseCall_Req Req;
  579. Req.type = type;
  580. PhoneService_ReleaseCall_Ans Ans;
  581. return (*m_pPhoneClient)(EntityResource::getLink().upgradeLink())->ReleaseCall(Req, Ans, 10000);
  582. }
  583. ErrorCodeEnum StartChannel(int nChanServer)
  584. {
  585. if (!m_pChannelClient) {
  586. return Error_NetBroken;
  587. }
  588. if ((m_strChanProxyIP[nChanServer]=="")&&(m_strChanCallNum[nChanServer]=="")&&(m_iChanProxyPort[nChanServer]==0)){
  589. return Error_Param;
  590. }
  591. ChannelService_Connect_Req Req;
  592. ChannelService_Connect_Ans Ans;
  593. Req.callno = m_strChanCallNum[nChanServer];
  594. Req.ip = m_strChanProxyIP[nChanServer];
  595. Req.port = m_iChanProxyPort[nChanServer];
  596. return m_pChannelClient->Connect(Req, Ans, 10000);
  597. }
  598. CSimpleStringA MakeSubid(CSimpleStringA subid)
  599. {
  600. int idlen = subid.GetLength();
  601. if (idlen > SUBID_LENGTH)
  602. {
  603. return subid.SubString(idlen - SUBID_LENGTH, SUBID_LENGTH);
  604. }
  605. else
  606. {
  607. return subid;
  608. }
  609. }
  610. ErrorCodeEnum StartChannel(int nChanServer,CallingParam callparam)
  611. {
  612. if (!m_pChannelClient) {
  613. return Error_NetBroken;
  614. }
  615. ChannelService_Connect_Req Req;
  616. ChannelService_Connect_Ans Ans;
  617. if ((m_strChanProxyIP[nChanServer]=="")&&(m_strChanCallNum[nChanServer]=="")&&(m_iChanProxyPort[nChanServer]==0)){
  618. return Error_Param;
  619. }
  620. else{
  621. Req.callno = m_strChanCallNum[nChanServer];
  622. Req.ip = m_strChanProxyIP[nChanServer];
  623. Req.port = m_iChanProxyPort[nChanServer];
  624. Req.etype = NORMAL_CALLTYPE;
  625. return m_pChannelClient->Connect(Req, Ans, 10000);
  626. }
  627. }
  628. ErrorCodeEnum StopChannel()
  629. {
  630. DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("stop channel");
  631. if (!m_pPhoneClient) {
  632. return Error_NetBroken;
  633. }
  634. ChannelService_Close_Req Req;
  635. ChannelService_Close_Ans Ans;
  636. return m_pChannelClient->Close(Req, Ans, 10000);
  637. }
  638. CSimpleStringA MakeCallUri(const char *callnum,const char *serverip,int serverport)
  639. {
  640. return CSimpleStringA::Format("sip:%s@%s:%d;transport=UDP",
  641. callnum, (LPCSTR)serverip,serverport);
  642. }
  643. CSimpleStringA MakeCallUri(const char *hint_callnum,int nServer)
  644. {
  645. if (m_iSIPProxyPort[nServer] == 5060)
  646. {
  647. return CSimpleStringA::Format("sip:%s@%s;transport=UDP",
  648. hint_callnum, (LPCSTR)m_strSIPProxyIP[nServer]);
  649. }
  650. else
  651. {
  652. return CSimpleStringA::Format("sip:%s@%s:%d;transport=UDP",
  653. hint_callnum, (LPCSTR)m_strSIPProxyIP[nServer], m_iSIPProxyPort[nServer]);
  654. }
  655. }
  656. ErrorCodeEnum LoadConfig()
  657. {
  658. int iTimeOut = RVC_DEFAULT_HTTPTIMEOUT;
  659. int iPrintDbg = 0;
  660. SpIniMappingTable table;
  661. table.AddEntryString("CounterConnector", "sip_proxy_ip", m_strSIPProxyIP[0], NULL);
  662. table.AddEntryInt("CounterConnector", "sip_proxy_port", m_iSIPProxyPort[0], 0);
  663. table.AddEntryString("CounterConnector", "sip_default_call_no", m_strSIPCallNum[0], NULL);
  664. table.AddEntryString("CounterConnector", "chan_proxy_ip", m_strChanProxyIP[0], NULL);
  665. table.AddEntryInt("CounterConnector", "chan_proxy_port", m_iChanProxyPort[0], 0);
  666. table.AddEntryString("CounterConnector", "chan_default_call_no", m_strChanCallNum[0], NULL);
  667. table.AddEntryString("CounterConnector", "sip_proxy_ip_backup", m_strSIPProxyIP[1], NULL);
  668. table.AddEntryInt("CounterConnector", "sip_proxy_port_backup", m_iSIPProxyPort[1], 0);
  669. table.AddEntryString("CounterConnector", "sip_default_call_no_backup", m_strSIPCallNum[1], NULL);
  670. table.AddEntryString("CounterConnector", "chan_proxy_ip_backup", m_strChanProxyIP[1], NULL);
  671. table.AddEntryInt("CounterConnector", "chan_proxy_port_backup", m_iChanProxyPort[1], 0);
  672. table.AddEntryString("CounterConnector", "chan_default_call_no_backup", m_strChanCallNum[1], NULL);
  673. table.AddEntryString("CounterConnector", "default_voip_server", m_strDefaultServer, NULL);
  674. table.AddEntryString("CounterConnector", "http_call_route_addr", m_strHttpCallRouteAddr, NULL);
  675. table.AddEntryInt("CounterConnector", "http_timeout", iTimeOut, 0);
  676. table.AddEntryInt("CounterConnector", "http_printdbg", iPrintDbg, 0);
  677. CSmartPointer<IConfigInfo> spConfig;
  678. ErrorCodeEnum Error = m_pEntity->GetFunction()->OpenConfig(Config_CenterSetting, spConfig);
  679. if (Error == Error_Succeed) {
  680. Error = table.Load(spConfig);
  681. if (Error_Succeed == Error) {
  682. if (iTimeOut > 0 && iTimeOut < 20 * RVC_DEFAULT_HTTPTIMEOUT) {
  683. m_iHttpTimeOut = iTimeOut;
  684. }
  685. if (iPrintDbg) {
  686. m_bHttpPrinttDbg = true;
  687. }
  688. }
  689. }
  690. return Error;
  691. }
  692. ErrorCodeEnum LoadTerminalId()
  693. {
  694. CSystemStaticInfo Info;
  695. ErrorCodeEnum Error = m_pEntity->GetFunction()->GetSystemStaticInfo(Info);
  696. if (Error == Error_Succeed) {
  697. m_strTerminalId = Info.strTerminalID;
  698. }
  699. return Error;
  700. }
  701. ErrorCodeEnum AllowAgentWrite()
  702. {
  703. if (!m_pChannelClient)
  704. return Error_NetBroken;
  705. ChannelService_Send_Info Info;
  706. Info.compress = false;
  707. Info.encrypt = false;
  708. Info.id = 0;
  709. Info.sub_type = 0;
  710. Info.type = ACM_TYPE_MODE;
  711. return (*m_pChannelClient)(EntityResource::getLink().upgradeLink())->Send(Info);
  712. }
  713. ErrorCodeEnum StartRing()
  714. {
  715. #ifdef _WIN32
  716. BOOL bRet = ::PlaySoundA(MAKEINTRESOURCEA(IDR_RINGOUT), ModuleBase::GetModuleBase()->GetInstance(), SND_ASYNC|SND_RESOURCE|SND_LOOP);
  717. if (bRet) {
  718. m_bRing = TRUE;
  719. return Error_Succeed;
  720. }
  721. else {
  722. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("play sound failed!%d", GetLastError());
  723. return Error_Unexpect;
  724. }
  725. #else
  726. m_bRing = TRUE;
  727. return Error_Succeed;
  728. #endif
  729. }
  730. void StopRing()
  731. {
  732. #ifdef _WIN32
  733. if (m_bRing) {
  734. BOOL bRet = FALSE;
  735. int tries = 0;
  736. do {
  737. bRet = ::PlaySoundA(NULL, NULL, SND_ASYNC|SND_LOOP);
  738. } while (bRet == FALSE && (Sleep(100), tries < 3));
  739. m_bRing = FALSE;
  740. }
  741. #else
  742. if (m_bRing) {
  743. m_bRing = FALSE;
  744. }
  745. #endif
  746. }
  747. BOOL CheckBeginRing(int iSrcState, int iDstState)
  748. {
  749. if (iSrcState == ACMCallFSM::s0 && iDstState == ACMCallFSM::s10)
  750. return TRUE;
  751. return FALSE;
  752. }
  753. BOOL CheckEndRing(int iSrcState, int iDstState)
  754. {
  755. if (m_bRing) {
  756. if (iSrcState == ACMCallFSM::s10 || iSrcState == ACMCallFSM::s12) {
  757. if (iDstState != ACMCallFSM::s10 && iDstState != ACMCallFSM::s12)
  758. return TRUE;
  759. }
  760. }
  761. return FALSE;
  762. }
  763. int GetDelayTime();
  764. void SetDelayTime();
  765. int ParseDefaultServer(const char* strServer);
  766. int GetFailedErrorCode(int iSrcState);
  767. int LogFailedWarns(int iFailedCode, const char* strmsg);
  768. public:
  769. BOOL m_bHandFree;
  770. //坐席控制话筒的当前状态
  771. BOOL m_bAgentHandFree;
  772. BOOL m_bIsAgentControl;
  773. //流程拨号,带技能号
  774. CSimpleStringA m_strHintCallNum;
  775. BOOL m_bAssistchanIdel;
  776. CurServerNum m_nCurSipServer;
  777. CurServerNum m_nCurChanServer;
  778. //呼叫类型,用于区分是分布式呼叫还是常规呼叫,由业务中台设置或者指令模块设置
  779. CallingParam m_CallingParam;
  780. SessionParam m_SessionParam;
  781. int m_nSysCallType;//0:普通模式,1:p2p模式
  782. int m_iFailedLastState;
  783. BOOL m_bIsPadDevice;
  784. BOOL m_bConAssist;
  785. BOOL m_bConSipphone;
  786. int m_iCallRouteType;
  787. CSimpleStringA m_strQueueName;
  788. CSimpleStringA m_strAddClientLevel;
  789. BOOL m_bNeedQueueName;
  790. private:
  791. DWORD m_nStarttime;
  792. PhoneService_ClientBase *m_pPhoneClient;
  793. ChannelService_ClientBase *m_pChannelClient;
  794. SyncService_ClientBase*m_pSyncServiceClient;
  795. CSimpleStringA m_strTerminalId;
  796. CSimpleStringA m_strSIPProxyIP[2];
  797. int m_iSIPProxyPort[2];
  798. CSimpleStringA m_strSIPCallNum[2];
  799. CSimpleStringA m_strChanProxyIP[2];
  800. int m_iChanProxyPort[2];
  801. CSimpleStringA m_strChanCallNum[2];
  802. //去分行化
  803. node_list_head_t *m_pCallRouteList;
  804. CSimpleStringA m_strDefaultServer;
  805. std::vector<std::string> m_voipserver;
  806. ErrorCodeEnum m_LastSipError;
  807. ErrorCodeEnum m_LastAssistError;
  808. int m_iNetAdapterNum;
  809. CSimpleStringA m_strHttpCallRouteAddr;
  810. CSimpleStringA m_strHttpServerAPI;
  811. int m_iHttpTimeOut;
  812. bool m_bHttpPrinttDbg;
  813. BOOL m_bRing;
  814. };